@phonghq/go-chat 1.0.0 → 1.0.2
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/README.md +4 -0
- package/dist/assets/icons/IconArrowLeft.vue.d.ts +2 -0
- package/dist/assets/icons/IconArrowLeft.vue.js +29 -0
- package/dist/assets/icons/IconPhone.vue.d.ts +2 -0
- package/dist/assets/icons/IconPhone.vue.js +19 -0
- package/dist/assets/icons/IconPlan.vue.d.ts +2 -0
- package/dist/assets/icons/IconPlan.vue.js +19 -0
- package/dist/assets/icons/IconPlus.vue.d.ts +2 -0
- package/dist/assets/icons/IconPlus.vue.js +22 -0
- package/dist/assets/icons/IconSearch.vue.d.ts +32 -0
- package/dist/assets/icons/IconSearch.vue.js +68 -0
- package/dist/assets/icons/call/IconMic.vue.d.ts +14 -0
- package/dist/assets/icons/call/IconMic.vue.js +123 -0
- package/dist/assets/icons/call/IconPhone.vue.d.ts +2 -0
- package/dist/assets/icons/call/IconPhone.vue.js +35 -0
- package/dist/assets/icons/call/IconPhoneCancel.vue.d.ts +2 -0
- package/dist/assets/icons/call/IconPhoneCancel.vue.js +35 -0
- package/dist/assets/icons/call/IconSpeaker.vue.d.ts +14 -0
- package/dist/assets/icons/call/IconSpeaker.vue.js +62 -0
- package/dist/assets/icons/customer-appointment/IconFilter.vue.d.ts +2 -0
- package/dist/assets/icons/customer-appointment/IconFilter.vue.js +53 -0
- package/dist/assets/icons/customer-detail/IconArrow.vue.d.ts +2 -0
- package/dist/assets/icons/customer-detail/IconArrow.vue.js +22 -0
- package/dist/assets/icons/customer-detail/IconCheck.vue.d.ts +2 -0
- package/dist/assets/icons/customer-detail/IconCheck.vue.js +27 -0
- package/dist/assets/icons/customer-detail/IconDate.vue.d.ts +2 -0
- package/dist/assets/icons/customer-detail/IconDate.vue.js +43 -0
- package/dist/assets/icons/customer-detail/IconGroup.vue.d.ts +2 -0
- package/dist/assets/icons/customer-detail/IconGroup.vue.js +48 -0
- package/dist/assets/icons/customer-detail/IconMessage.vue.d.ts +2 -0
- package/dist/assets/icons/customer-detail/IconMessage.vue.js +28 -0
- package/dist/assets/icons/customer-detail/IconNote.vue.d.ts +2 -0
- package/dist/assets/icons/customer-detail/IconNote.vue.js +29 -0
- package/dist/assets/icons/customer-detail/IconPhone.vue.d.ts +2 -0
- package/dist/assets/icons/customer-detail/IconPhone.vue.js +21 -0
- package/dist/assets/icons/customer-detail/IconPin.vue.d.ts +2 -0
- package/dist/assets/icons/customer-detail/IconPin.vue.js +29 -0
- package/dist/assets/icons/customer-detail/IconSearch.vue.d.ts +2 -0
- package/dist/assets/icons/customer-detail/IconSearch.vue.js +29 -0
- package/dist/chat/App.vue.d.ts +5 -0
- package/dist/chat/App.vue.js +502 -0
- package/dist/chat/main.d.ts +3 -0
- package/dist/chat/main.js +2 -0
- package/dist/chat/page/customer-appointment/CustomerAppointment.vue.d.ts +2 -0
- package/dist/chat/page/customer-appointment/CustomerAppointment.vue.js +207 -0
- package/dist/chat/page/customer-check-in/CollapseCheckIn.vue.d.ts +12 -0
- package/dist/chat/page/customer-check-in/CollapseCheckIn.vue.js +80 -0
- package/dist/chat/page/customer-check-in/CustomerCheckIn.vue.d.ts +2 -0
- package/dist/chat/page/customer-check-in/CustomerCheckIn.vue.js +136 -0
- package/dist/chat/page/customer-detail/CustomerDetail.vue.d.ts +7 -0
- package/dist/chat/page/customer-detail/CustomerDetail.vue.js +235 -0
- package/dist/chat/page/customer-detail/SubInformation.vue.d.ts +16 -0
- package/dist/chat/page/customer-detail/SubInformation.vue.js +102 -0
- package/dist/chat/page/error/Error.vue.d.ts +2 -0
- package/dist/chat/page/error/Error.vue.js +64 -0
- package/dist/chat/page/home/ChatList.vue.d.ts +20 -0
- package/dist/chat/page/home/ChatList.vue.js +380 -0
- package/dist/chat/page/home/ChatMessage.vue.d.ts +16 -0
- package/dist/chat/page/home/ChatMessage.vue.js +271 -0
- package/dist/chat/page/home/Home.vue.d.ts +14 -0
- package/dist/chat/page/home/Home.vue.js +327 -0
- package/dist/chat/page/home/HomeHeader.vue.d.ts +10 -0
- package/dist/chat/page/home/HomeHeader.vue.js +122 -0
- package/dist/chat/page/home/InputChat.vue.d.ts +19 -0
- package/dist/chat/page/home/InputChat.vue.js +226 -0
- package/dist/chat/page/home/NewCustomer.vue.d.ts +6 -0
- package/dist/chat/page/home/NewCustomer.vue.js +82 -0
- package/dist/components/ListenEvent.vue.d.ts +2 -0
- package/dist/components/ListenEvent.vue.js +45 -0
- package/dist/components/chat/ScrollEvent/ScrollEvent.vue.d.ts +22 -0
- package/dist/components/chat/ScrollEvent/ScrollEvent.vue.js +197 -0
- package/dist/components/chat/call/Calling.vue.d.ts +7 -0
- package/dist/components/chat/call/Calling.vue.js +291 -0
- package/dist/components/chat/card/CardCustomerDetail.vue.d.ts +13 -0
- package/dist/components/chat/card/CardCustomerDetail.vue.js +28 -0
- package/dist/components/chat/common/collapse/CollapseBase.vue.d.ts +20 -0
- package/dist/components/chat/common/collapse/CollapseBase.vue.js +59 -0
- package/dist/components/chat/common/input/InputSearch.vue.d.ts +16 -0
- package/dist/components/chat/common/input/InputSearch.vue.js +71 -0
- package/dist/components/chat/common/popover/PopoverBase.vue.d.ts +35 -0
- package/dist/components/chat/common/popover/PopoverBase.vue.js +148 -0
- package/dist/components/chat/common/spin/BaseSpin.vue.d.ts +2 -0
- package/dist/components/chat/common/spin/BaseSpin.vue.js +12 -0
- package/dist/components/chat/customer/Avatar.vue.d.ts +11 -0
- package/dist/components/chat/customer/Avatar.vue.js +79 -0
- package/dist/components/chat/layout/mobile/Footer.vue.d.ts +2 -0
- package/dist/components/chat/layout/mobile/Footer.vue.js +109 -0
- package/dist/components/common/CustomLoading.vue.d.ts +2 -0
- package/dist/components/common/CustomLoading.vue.js +19 -0
- package/dist/components/common/Notification/NotificationDescription.vue.d.ts +7 -0
- package/dist/components/common/Notification/NotificationDescription.vue.js +38 -0
- package/dist/components/common/button/ButtonBase.vue.d.ts +22 -0
- package/dist/components/common/button/ButtonBase.vue.js +78 -0
- package/dist/components/common/button/ButtonToggle.vue.d.ts +20 -0
- package/dist/components/common/button/ButtonToggle.vue.js +70 -0
- package/dist/components/common/checkbox/CCheckboxNumber.vue.d.ts +16 -0
- package/dist/components/common/checkbox/CCheckboxNumber.vue.js +48 -0
- package/dist/components/common/collapse/BaseCollapse.vue.d.ts +12 -0
- package/dist/components/common/collapse/BaseCollapse.vue.js +36 -0
- package/dist/components/common/collapse/BaseCollapseItem.vue.d.ts +4 -0
- package/dist/components/common/collapse/BaseCollapseItem.vue.js +22 -0
- package/dist/components/common/drawer/DrawerBase.vue.d.ts +39 -0
- package/dist/components/common/drawer/DrawerBase.vue.js +126 -0
- package/dist/components/common/dropdown/DropdownBase.vue.d.ts +21 -0
- package/dist/components/common/dropdown/DropdownBase.vue.js +91 -0
- package/dist/components/common/input/CInputSearch.vue.d.ts +14 -0
- package/dist/components/common/input/CInputSearch.vue.js +62 -0
- package/dist/components/common/modal/ModalBase.vue.d.ts +35 -0
- package/dist/components/common/modal/ModalBase.vue.js +164 -0
- package/dist/components/common/popover/PopoverBase.vue.d.ts +3 -0
- package/dist/components/common/popover/PopoverBase.vue.js +36 -0
- package/dist/components/common/slider/BaseSlider.vue.d.ts +11 -0
- package/dist/components/common/slider/BaseSlider.vue.js +70 -0
- package/dist/components/common/spin/CSpin.vue.d.ts +9 -0
- package/dist/components/common/spin/CSpin.vue.js +41 -0
- package/dist/components/common/tooltip/TooltipBase.vue.d.ts +2 -0
- package/dist/components/common/tooltip/TooltipBase.vue.js +8 -0
- package/dist/components/layout/Blank.vue.d.ts +9 -0
- package/dist/components/layout/Blank.vue.js +19 -0
- package/dist/components/layout/Default.vue.d.ts +9 -0
- package/dist/components/layout/Default.vue.js +21 -0
- package/dist/components/modal/Confirm.vue.d.ts +2 -0
- package/dist/components/modal/Confirm.vue.js +164 -0
- package/dist/components/ui/button/CButton.vue.d.ts +19 -0
- package/dist/components/ui/button/CButton.vue.js +49 -0
- package/dist/components/ui/button/c-button.d.ts +7 -0
- package/dist/components/ui/button/c-button.js +26 -0
- package/dist/components/ui/checkbox/Checkbox.vue.d.ts +18 -0
- package/dist/components/ui/checkbox/Checkbox.vue.js +79 -0
- package/dist/components/ui/checkbox/index.d.ts +1 -0
- package/dist/components/ui/checkbox/index.js +1 -0
- package/dist/components/ui/collapsible/Collapsible.vue.d.ts +16 -0
- package/dist/components/ui/collapsible/Collapsible.vue.js +47 -0
- package/dist/components/ui/collapsible/CollapsibleContent.vue.d.ts +10 -0
- package/dist/components/ui/collapsible/CollapsibleContent.vue.js +41 -0
- package/dist/components/ui/collapsible/CollapsibleTrigger.vue.d.ts +10 -0
- package/dist/components/ui/collapsible/CollapsibleTrigger.vue.js +35 -0
- package/dist/components/ui/collapsible/index.d.ts +3 -0
- package/dist/components/ui/collapsible/index.js +3 -0
- package/dist/components/ui/dialog/Dialog.vue.d.ts +14 -0
- package/dist/components/ui/dialog/Dialog.vue.js +42 -0
- package/dist/components/ui/dialog/DialogClose.vue.d.ts +10 -0
- package/dist/components/ui/dialog/DialogClose.vue.js +35 -0
- package/dist/components/ui/dialog/DialogContent.vue.d.ts +29 -0
- package/dist/components/ui/dialog/DialogContent.vue.js +84 -0
- package/dist/components/ui/dialog/DialogDescription.vue.d.ts +14 -0
- package/dist/components/ui/dialog/DialogDescription.vue.js +43 -0
- package/dist/components/ui/dialog/DialogFooter.vue.d.ts +13 -0
- package/dist/components/ui/dialog/DialogFooter.vue.js +26 -0
- package/dist/components/ui/dialog/DialogHeader.vue.d.ts +13 -0
- package/dist/components/ui/dialog/DialogHeader.vue.js +26 -0
- package/dist/components/ui/dialog/DialogScrollContent.vue.d.ts +30 -0
- package/dist/components/ui/dialog/DialogScrollContent.vue.js +99 -0
- package/dist/components/ui/dialog/DialogTitle.vue.d.ts +14 -0
- package/dist/components/ui/dialog/DialogTitle.vue.js +43 -0
- package/dist/components/ui/dialog/DialogTrigger.vue.d.ts +10 -0
- package/dist/components/ui/dialog/DialogTrigger.vue.js +35 -0
- package/dist/components/ui/dialog/index.d.ts +9 -0
- package/dist/components/ui/dialog/index.js +9 -0
- package/dist/components/ui/drawer/Drawer.vue.d.ts +26 -0
- package/dist/components/ui/drawer/Drawer.vue.js +48 -0
- package/dist/components/ui/drawer/DrawerContent.vue.d.ts +33 -0
- package/dist/components/ui/drawer/DrawerContent.vue.js +81 -0
- package/dist/components/ui/drawer/DrawerDescription.vue.d.ts +14 -0
- package/dist/components/ui/drawer/DrawerDescription.vue.js +42 -0
- package/dist/components/ui/drawer/DrawerFooter.vue.d.ts +13 -0
- package/dist/components/ui/drawer/DrawerFooter.vue.js +26 -0
- package/dist/components/ui/drawer/DrawerHeader.vue.d.ts +13 -0
- package/dist/components/ui/drawer/DrawerHeader.vue.js +26 -0
- package/dist/components/ui/drawer/DrawerOverlay.vue.d.ts +7 -0
- package/dist/components/ui/drawer/DrawerOverlay.vue.js +37 -0
- package/dist/components/ui/drawer/DrawerTitle.vue.d.ts +14 -0
- package/dist/components/ui/drawer/DrawerTitle.vue.js +42 -0
- package/dist/components/ui/drawer/index.d.ts +8 -0
- package/dist/components/ui/drawer/index.js +8 -0
- package/dist/components/ui/dropdown-menu/DropdownMenu.vue.d.ts +14 -0
- package/dist/components/ui/dropdown-menu/DropdownMenu.vue.js +41 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuCheckboxItem.vue.d.ts +20 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuCheckboxItem.vue.js +79 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuContent.vue.d.ts +28 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuContent.vue.js +61 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuGroup.vue.d.ts +10 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuGroup.vue.js +35 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuItem.vue.d.ts +15 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuItem.vue.js +43 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuLabel.vue.d.ts +15 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuLabel.vue.js +43 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuRadioGroup.vue.d.ts +14 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuRadioGroup.vue.js +41 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuRadioItem.vue.d.ts +18 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuRadioItem.vue.js +80 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuSeparator.vue.d.ts +7 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuSeparator.vue.js +37 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuShortcut.vue.d.ts +13 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuShortcut.vue.js +26 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuSub.vue.d.ts +14 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuSub.vue.js +41 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuSubContent.vue.d.ts +30 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuSubContent.vue.js +46 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue.d.ts +14 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue.js +58 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuTrigger.vue.d.ts +10 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuTrigger.vue.js +41 -0
- package/dist/components/ui/dropdown-menu/index.d.ts +15 -0
- package/dist/components/ui/dropdown-menu/index.js +15 -0
- package/dist/components/ui/popover/Popover.vue.d.ts +14 -0
- package/dist/components/ui/popover/Popover.vue.js +41 -0
- package/dist/components/ui/popover/PopoverContent.vue.d.ts +28 -0
- package/dist/components/ui/popover/PopoverContent.vue.js +60 -0
- package/dist/components/ui/popover/PopoverTrigger.vue.d.ts +10 -0
- package/dist/components/ui/popover/PopoverTrigger.vue.js +35 -0
- package/dist/components/ui/popover/index.d.ts +3 -0
- package/dist/components/ui/popover/index.js +3 -0
- package/dist/components/ui/radio-group/RadioGroup.vue.d.ts +18 -0
- package/dist/components/ui/radio-group/RadioGroup.vue.js +46 -0
- package/dist/components/ui/radio-group/RadioGroupItem.vue.d.ts +7 -0
- package/dist/components/ui/radio-group/RadioGroupItem.vue.js +71 -0
- package/dist/components/ui/radio-group/index.d.ts +2 -0
- package/dist/components/ui/radio-group/index.js +2 -0
- package/dist/components/ui/slider/Slider.vue.d.ts +13 -0
- package/dist/components/ui/slider/Slider.vue.js +155 -0
- package/dist/components/ui/slider/index.d.ts +1 -0
- package/dist/components/ui/slider/index.js +1 -0
- package/dist/components/ui/switch/Switch.vue.d.ts +18 -0
- package/dist/components/ui/switch/Switch.vue.js +61 -0
- package/dist/components/ui/switch/index.d.ts +1 -0
- package/dist/components/ui/switch/index.js +1 -0
- package/dist/composable/useCallHelper.d.ts +23 -0
- package/dist/composable/useCallHelper.js +170 -0
- package/dist/composable/useInitData.d.ts +11 -0
- package/dist/composable/useInitData.js +84 -0
- package/dist/composable/useModalConfirm.d.ts +5 -0
- package/dist/composable/useModalConfirm.js +39 -0
- package/dist/constant/color.d.ts +22 -0
- package/dist/constant/color.js +43 -0
- package/dist/constant/datetime.d.ts +5 -0
- package/dist/constant/datetime.js +5 -0
- package/dist/constant/general.d.ts +8 -0
- package/dist/constant/general.js +9 -0
- package/dist/constant/message.d.ts +8 -0
- package/dist/constant/message.js +8 -0
- package/dist/constant/mqtt.d.ts +4 -0
- package/dist/constant/mqtt.js +11 -0
- package/dist/constant/user.d.ts +8 -0
- package/dist/constant/user.js +9 -0
- package/dist/go-chat.es.js +64024 -2699
- package/dist/go-chat.umd.js +15 -3
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +5 -0
- package/dist/plugins/axios-gci.d.ts +3 -0
- package/dist/plugins/axios-gci.js +25 -0
- package/dist/plugins/axios.d.ts +3 -0
- package/dist/plugins/axios.js +85 -0
- package/dist/plugins/mqtt.d.ts +10 -0
- package/dist/plugins/mqtt.js +128 -0
- package/dist/plugins/sdk.d.ts +19 -0
- package/dist/plugins/sdk.js +83 -0
- package/dist/plugins/websocket.d.ts +4 -0
- package/dist/plugins/websocket.js +65 -0
- package/dist/style.css +1 -1
- package/dist/types/chat/user.d.ts +88 -0
- package/dist/types/chat/user.js +1 -0
- package/dist/types/conversation.d.ts +18 -0
- package/dist/types/conversation.js +1 -0
- package/dist/utils/chat/auth.d.ts +45 -0
- package/dist/utils/chat/auth.js +51 -0
- package/dist/utils/chat/call.d.ts +5 -0
- package/dist/utils/chat/call.js +61 -0
- package/dist/utils/chat/chat-router.d.ts +3 -0
- package/dist/utils/chat/chat-router.js +9 -0
- package/dist/utils/chat/conversation.d.ts +3 -0
- package/dist/utils/chat/conversation.js +7 -0
- package/dist/utils/chat/message.d.ts +17 -0
- package/dist/utils/chat/message.js +42 -0
- package/dist/utils/chat/user.d.ts +193 -0
- package/dist/utils/chat/user.js +33 -0
- package/dist/utils/debounce.d.ts +1 -0
- package/dist/utils/debounce.js +9 -0
- package/dist/utils/json.d.ts +2 -0
- package/dist/utils/json.js +18 -0
- package/dist/utils/logger.d.ts +3 -0
- package/dist/utils/logger.js +5 -0
- package/dist/utils/string-helper.d.ts +1 -0
- package/dist/utils/string-helper.js +27 -0
- package/package.json +8 -7
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
/// <reference types="C:/phonghq/go-chat/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
|
|
2
|
+
import { reactiveOmit } from '@vueuse/core';
|
|
3
|
+
import { SliderRange, SliderRoot, SliderThumb, SliderTrack, useForwardPropsEmits } from 'reka-ui';
|
|
4
|
+
import { cn } from '../../../lib/utils';
|
|
5
|
+
const props = defineProps();
|
|
6
|
+
const emits = defineEmits();
|
|
7
|
+
const delegatedProps = reactiveOmit(props, 'class');
|
|
8
|
+
const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
|
9
|
+
const handlePointerup = (e) => {
|
|
10
|
+
if (e.currentTarget.hasPointerCapture(e.pointerId)) {
|
|
11
|
+
;
|
|
12
|
+
e.currentTarget.releasePointerCapture(e.pointerId);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
|
|
16
|
+
const __VLS_ctx = {
|
|
17
|
+
...{},
|
|
18
|
+
...{},
|
|
19
|
+
...{},
|
|
20
|
+
...{},
|
|
21
|
+
...{},
|
|
22
|
+
};
|
|
23
|
+
let __VLS_elements;
|
|
24
|
+
let __VLS_components;
|
|
25
|
+
let __VLS_directives;
|
|
26
|
+
const __VLS_0 = {}.SliderRoot;
|
|
27
|
+
/** @type {[typeof __VLS_components.SliderRoot, typeof __VLS_components.SliderRoot, ]} */ ;
|
|
28
|
+
// @ts-ignore
|
|
29
|
+
SliderRoot;
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
const __VLS_1 = __VLS_asFunctionalComponent(__VLS_0, new __VLS_0({
|
|
32
|
+
...{ 'onPointerdown': {} },
|
|
33
|
+
...{ 'onMousedown': {} },
|
|
34
|
+
...{ 'onPointerup': {} },
|
|
35
|
+
...{ class: (__VLS_ctx.cn('relative flex w-full touch-none select-none items-center data-[orientation=vertical]:flex-col data-[orientation=vertical]:w-2 data-[orientation=vertical]:h-full', props.class)) },
|
|
36
|
+
...(__VLS_ctx.forwarded),
|
|
37
|
+
}));
|
|
38
|
+
const __VLS_2 = __VLS_1({
|
|
39
|
+
...{ 'onPointerdown': {} },
|
|
40
|
+
...{ 'onMousedown': {} },
|
|
41
|
+
...{ 'onPointerup': {} },
|
|
42
|
+
...{ class: (__VLS_ctx.cn('relative flex w-full touch-none select-none items-center data-[orientation=vertical]:flex-col data-[orientation=vertical]:w-2 data-[orientation=vertical]:h-full', props.class)) },
|
|
43
|
+
...(__VLS_ctx.forwarded),
|
|
44
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_1));
|
|
45
|
+
let __VLS_4;
|
|
46
|
+
let __VLS_5;
|
|
47
|
+
const __VLS_6 = ({ pointerdown: {} },
|
|
48
|
+
{ onPointerdown: ((e) => {
|
|
49
|
+
e?.stopPropagation();
|
|
50
|
+
e?.target.setPointerCapture?.(e.pointerId);
|
|
51
|
+
console.log(e);
|
|
52
|
+
}) });
|
|
53
|
+
const __VLS_7 = ({ mousedown: {} },
|
|
54
|
+
{ onMousedown: ((e) => e.stopPropagation()) });
|
|
55
|
+
const __VLS_8 = ({ pointerup: {} },
|
|
56
|
+
{ onPointerup: (__VLS_ctx.handlePointerup) });
|
|
57
|
+
var __VLS_9 = {};
|
|
58
|
+
const { default: __VLS_10 } = __VLS_3.slots;
|
|
59
|
+
// @ts-ignore
|
|
60
|
+
[cn, forwarded, handlePointerup,];
|
|
61
|
+
const __VLS_11 = {}.SliderTrack;
|
|
62
|
+
/** @type {[typeof __VLS_components.SliderTrack, typeof __VLS_components.SliderTrack, ]} */ ;
|
|
63
|
+
// @ts-ignore
|
|
64
|
+
SliderTrack;
|
|
65
|
+
// @ts-ignore
|
|
66
|
+
const __VLS_12 = __VLS_asFunctionalComponent(__VLS_11, new __VLS_11({
|
|
67
|
+
...{ class: "relative h-2 w-full data-[orientation=vertical]:w-2 grow overflow-hidden rounded-full bg-white" },
|
|
68
|
+
}));
|
|
69
|
+
const __VLS_13 = __VLS_12({
|
|
70
|
+
...{ class: "relative h-2 w-full data-[orientation=vertical]:w-2 grow overflow-hidden rounded-full bg-white" },
|
|
71
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_12));
|
|
72
|
+
const { default: __VLS_15 } = __VLS_14.slots;
|
|
73
|
+
const __VLS_16 = {}.SliderRange;
|
|
74
|
+
/** @type {[typeof __VLS_components.SliderRange, ]} */ ;
|
|
75
|
+
// @ts-ignore
|
|
76
|
+
SliderRange;
|
|
77
|
+
// @ts-ignore
|
|
78
|
+
const __VLS_17 = __VLS_asFunctionalComponent(__VLS_16, new __VLS_16({
|
|
79
|
+
...{ class: "absolute h-full data-[orientation=vertical]:w-full bg-primary" },
|
|
80
|
+
}));
|
|
81
|
+
const __VLS_18 = __VLS_17({
|
|
82
|
+
...{ class: "absolute h-full data-[orientation=vertical]:w-full bg-primary" },
|
|
83
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_17));
|
|
84
|
+
var __VLS_14;
|
|
85
|
+
for (const [value, key] of __VLS_getVForSourceType((__VLS_ctx.modelValue))) {
|
|
86
|
+
// @ts-ignore
|
|
87
|
+
[modelValue,];
|
|
88
|
+
const __VLS_21 = {}.SliderThumb;
|
|
89
|
+
/** @type {[typeof __VLS_components.SliderThumb, typeof __VLS_components.SliderThumb, ]} */ ;
|
|
90
|
+
// @ts-ignore
|
|
91
|
+
SliderThumb;
|
|
92
|
+
// @ts-ignore
|
|
93
|
+
const __VLS_22 = __VLS_asFunctionalComponent(__VLS_21, new __VLS_21({
|
|
94
|
+
key: (key),
|
|
95
|
+
...{ class: "block h-5 w-5 rounded-full border-2 border-primary bg-white ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50" },
|
|
96
|
+
}));
|
|
97
|
+
const __VLS_23 = __VLS_22({
|
|
98
|
+
key: (key),
|
|
99
|
+
...{ class: "block h-5 w-5 rounded-full border-2 border-primary bg-white ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50" },
|
|
100
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_22));
|
|
101
|
+
const { default: __VLS_25 } = __VLS_24.slots;
|
|
102
|
+
const __VLS_26 = {}.ATooltip;
|
|
103
|
+
/** @type {[typeof __VLS_components.ATooltip, typeof __VLS_components.aTooltip, typeof __VLS_components.ATooltip, typeof __VLS_components.aTooltip, ]} */ ;
|
|
104
|
+
// @ts-ignore
|
|
105
|
+
ATooltip;
|
|
106
|
+
// @ts-ignore
|
|
107
|
+
const __VLS_27 = __VLS_asFunctionalComponent(__VLS_26, new __VLS_26({}));
|
|
108
|
+
const __VLS_28 = __VLS_27({}, ...__VLS_functionalComponentArgsRest(__VLS_27));
|
|
109
|
+
const { default: __VLS_30 } = __VLS_29.slots;
|
|
110
|
+
__VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
|
|
111
|
+
...{ class: "h-5 w-5 opacity-0" },
|
|
112
|
+
});
|
|
113
|
+
{
|
|
114
|
+
const { title: __VLS_31 } = __VLS_29.slots;
|
|
115
|
+
(value);
|
|
116
|
+
}
|
|
117
|
+
var __VLS_29;
|
|
118
|
+
var __VLS_24;
|
|
119
|
+
}
|
|
120
|
+
var __VLS_3;
|
|
121
|
+
/** @type {__VLS_StyleScopedClasses['relative']} */ ;
|
|
122
|
+
/** @type {__VLS_StyleScopedClasses['h-2']} */ ;
|
|
123
|
+
/** @type {__VLS_StyleScopedClasses['w-full']} */ ;
|
|
124
|
+
/** @type {__VLS_StyleScopedClasses['data-[orientation=vertical]:w-2']} */ ;
|
|
125
|
+
/** @type {__VLS_StyleScopedClasses['grow']} */ ;
|
|
126
|
+
/** @type {__VLS_StyleScopedClasses['overflow-hidden']} */ ;
|
|
127
|
+
/** @type {__VLS_StyleScopedClasses['rounded-full']} */ ;
|
|
128
|
+
/** @type {__VLS_StyleScopedClasses['bg-white']} */ ;
|
|
129
|
+
/** @type {__VLS_StyleScopedClasses['absolute']} */ ;
|
|
130
|
+
/** @type {__VLS_StyleScopedClasses['h-full']} */ ;
|
|
131
|
+
/** @type {__VLS_StyleScopedClasses['data-[orientation=vertical]:w-full']} */ ;
|
|
132
|
+
/** @type {__VLS_StyleScopedClasses['bg-primary']} */ ;
|
|
133
|
+
/** @type {__VLS_StyleScopedClasses['block']} */ ;
|
|
134
|
+
/** @type {__VLS_StyleScopedClasses['h-5']} */ ;
|
|
135
|
+
/** @type {__VLS_StyleScopedClasses['w-5']} */ ;
|
|
136
|
+
/** @type {__VLS_StyleScopedClasses['rounded-full']} */ ;
|
|
137
|
+
/** @type {__VLS_StyleScopedClasses['border-2']} */ ;
|
|
138
|
+
/** @type {__VLS_StyleScopedClasses['border-primary']} */ ;
|
|
139
|
+
/** @type {__VLS_StyleScopedClasses['bg-white']} */ ;
|
|
140
|
+
/** @type {__VLS_StyleScopedClasses['ring-offset-background']} */ ;
|
|
141
|
+
/** @type {__VLS_StyleScopedClasses['transition-colors']} */ ;
|
|
142
|
+
/** @type {__VLS_StyleScopedClasses['focus-visible:outline-none']} */ ;
|
|
143
|
+
/** @type {__VLS_StyleScopedClasses['focus-visible:ring-2']} */ ;
|
|
144
|
+
/** @type {__VLS_StyleScopedClasses['focus-visible:ring-ring']} */ ;
|
|
145
|
+
/** @type {__VLS_StyleScopedClasses['focus-visible:ring-offset-2']} */ ;
|
|
146
|
+
/** @type {__VLS_StyleScopedClasses['disabled:pointer-events-none']} */ ;
|
|
147
|
+
/** @type {__VLS_StyleScopedClasses['disabled:opacity-50']} */ ;
|
|
148
|
+
/** @type {__VLS_StyleScopedClasses['h-5']} */ ;
|
|
149
|
+
/** @type {__VLS_StyleScopedClasses['w-5']} */ ;
|
|
150
|
+
/** @type {__VLS_StyleScopedClasses['opacity-0']} */ ;
|
|
151
|
+
const __VLS_export = (await import('vue')).defineComponent({
|
|
152
|
+
__typeEmits: {},
|
|
153
|
+
__typeProps: {},
|
|
154
|
+
});
|
|
155
|
+
export default {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as CSlider } from "./Slider.vue";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as CSlider } from "./Slider.vue";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { SwitchRootProps } from 'reka-ui';
|
|
2
|
+
import type { HTMLAttributes } from 'vue';
|
|
3
|
+
type __VLS_Props = SwitchRootProps & {
|
|
4
|
+
class?: HTMLAttributes['class'];
|
|
5
|
+
};
|
|
6
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
7
|
+
"update:modelValue": (payload: boolean) => any;
|
|
8
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
9
|
+
"onUpdate:modelValue"?: ((payload: boolean) => any) | undefined;
|
|
10
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
11
|
+
thumb?: ((props: {}) => any) | undefined;
|
|
12
|
+
}>;
|
|
13
|
+
export default _default;
|
|
14
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
15
|
+
new (): {
|
|
16
|
+
$slots: S;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/// <reference types="C:/phonghq/go-chat/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
|
|
2
|
+
import { reactiveOmit } from '@vueuse/core';
|
|
3
|
+
import { SwitchRoot, SwitchThumb, useForwardPropsEmits } from 'reka-ui';
|
|
4
|
+
import { cn } from '../../../lib/utils';
|
|
5
|
+
const props = defineProps();
|
|
6
|
+
const emits = defineEmits();
|
|
7
|
+
const delegatedProps = reactiveOmit(props, 'class');
|
|
8
|
+
const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
|
9
|
+
debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
|
|
10
|
+
const __VLS_ctx = {
|
|
11
|
+
...{},
|
|
12
|
+
...{},
|
|
13
|
+
...{},
|
|
14
|
+
...{},
|
|
15
|
+
...{},
|
|
16
|
+
};
|
|
17
|
+
let __VLS_elements;
|
|
18
|
+
let __VLS_components;
|
|
19
|
+
let __VLS_directives;
|
|
20
|
+
const __VLS_0 = {}.SwitchRoot;
|
|
21
|
+
/** @type {[typeof __VLS_components.SwitchRoot, typeof __VLS_components.SwitchRoot, ]} */ ;
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
SwitchRoot;
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
const __VLS_1 = __VLS_asFunctionalComponent(__VLS_0, new __VLS_0({
|
|
26
|
+
...(__VLS_ctx.forwarded),
|
|
27
|
+
...{ class: (__VLS_ctx.cn('peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-[#D1D1D1]', props.class)) },
|
|
28
|
+
}));
|
|
29
|
+
const __VLS_2 = __VLS_1({
|
|
30
|
+
...(__VLS_ctx.forwarded),
|
|
31
|
+
...{ class: (__VLS_ctx.cn('peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-[#D1D1D1]', props.class)) },
|
|
32
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_1));
|
|
33
|
+
var __VLS_4 = {};
|
|
34
|
+
const { default: __VLS_5 } = __VLS_3.slots;
|
|
35
|
+
// @ts-ignore
|
|
36
|
+
[forwarded, cn,];
|
|
37
|
+
const __VLS_6 = {}.SwitchThumb;
|
|
38
|
+
/** @type {[typeof __VLS_components.SwitchThumb, typeof __VLS_components.SwitchThumb, ]} */ ;
|
|
39
|
+
// @ts-ignore
|
|
40
|
+
SwitchThumb;
|
|
41
|
+
// @ts-ignore
|
|
42
|
+
const __VLS_7 = __VLS_asFunctionalComponent(__VLS_6, new __VLS_6({
|
|
43
|
+
...{ class: (__VLS_ctx.cn('pointer-events-none block h-5 w-5 rounded-full bg-white shadow-sm ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-1')) },
|
|
44
|
+
}));
|
|
45
|
+
const __VLS_8 = __VLS_7({
|
|
46
|
+
...{ class: (__VLS_ctx.cn('pointer-events-none block h-5 w-5 rounded-full bg-white shadow-sm ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-1')) },
|
|
47
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_7));
|
|
48
|
+
const { default: __VLS_10 } = __VLS_9.slots;
|
|
49
|
+
// @ts-ignore
|
|
50
|
+
[cn,];
|
|
51
|
+
var __VLS_11 = {};
|
|
52
|
+
var __VLS_9;
|
|
53
|
+
var __VLS_3;
|
|
54
|
+
// @ts-ignore
|
|
55
|
+
var __VLS_12 = __VLS_11;
|
|
56
|
+
const __VLS_base = (await import('vue')).defineComponent({
|
|
57
|
+
__typeEmits: {},
|
|
58
|
+
__typeProps: {},
|
|
59
|
+
});
|
|
60
|
+
const __VLS_export = {};
|
|
61
|
+
export default {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as CSwitch } from "./Switch.vue";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as CSwitch } from "./Switch.vue";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { IResUser } from '../types/message';
|
|
2
|
+
type Offer = {
|
|
3
|
+
link: string;
|
|
4
|
+
offer: any;
|
|
5
|
+
user: any;
|
|
6
|
+
server: any;
|
|
7
|
+
};
|
|
8
|
+
export declare function useCallHelper(): {
|
|
9
|
+
call: (user: IResUser) => Promise<void>;
|
|
10
|
+
end: (link: any) => void;
|
|
11
|
+
endPc: (link: any) => void;
|
|
12
|
+
handleOfferResponse: (data: {
|
|
13
|
+
link: string;
|
|
14
|
+
answer: any;
|
|
15
|
+
}) => Promise<void>;
|
|
16
|
+
handleOffer: (data: Offer) => Promise<boolean>;
|
|
17
|
+
addIceCandidate: (data: {
|
|
18
|
+
link: string;
|
|
19
|
+
candidate: any;
|
|
20
|
+
}) => Promise<void>;
|
|
21
|
+
sendOfferOk: () => Promise<boolean | undefined>;
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,170 @@
|
|
|
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
|
+
import { ref } from 'vue';
|
|
6
|
+
export function useCallHelper() {
|
|
7
|
+
let pc;
|
|
8
|
+
let iceStunServiceLink = '';
|
|
9
|
+
let iceServer = null;
|
|
10
|
+
let answer;
|
|
11
|
+
let offer = null;
|
|
12
|
+
const remoteAudio = () => {
|
|
13
|
+
return document.getElementById('go-chat-remote-audio');
|
|
14
|
+
};
|
|
15
|
+
const localAudio = () => {
|
|
16
|
+
return document.getElementById('go-chat-local-audio');
|
|
17
|
+
};
|
|
18
|
+
const userRemoter = ref(null);
|
|
19
|
+
const call = async (user) => {
|
|
20
|
+
userRemoter.value = user;
|
|
21
|
+
await getIceServiceLink();
|
|
22
|
+
startPeerConnection();
|
|
23
|
+
const offer = await pc?.createOffer();
|
|
24
|
+
await pc?.setLocalDescription(offer);
|
|
25
|
+
publishMessage(TOPIC_DETAIL_CALL + (userRemoter.value?.id ?? ''), {
|
|
26
|
+
type: 'offer',
|
|
27
|
+
offer,
|
|
28
|
+
link: iceStunServiceLink,
|
|
29
|
+
server: iceServer,
|
|
30
|
+
user: dataProfile.value
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
const end = (link) => {
|
|
34
|
+
endPc(link);
|
|
35
|
+
publishMessage(TOPIC_DETAIL_CALL + (userRemoter.value?.id ?? ''), {
|
|
36
|
+
type: 'end-call',
|
|
37
|
+
link: iceStunServiceLink
|
|
38
|
+
});
|
|
39
|
+
iceStunServiceLink = '';
|
|
40
|
+
};
|
|
41
|
+
const endPc = (link) => {
|
|
42
|
+
if (!link || link === iceStunServiceLink) {
|
|
43
|
+
if (pc) {
|
|
44
|
+
pc?.close();
|
|
45
|
+
pc = null;
|
|
46
|
+
}
|
|
47
|
+
const remote = remoteAudio();
|
|
48
|
+
const local = localAudio();
|
|
49
|
+
if (remote)
|
|
50
|
+
remote.srcObject = null;
|
|
51
|
+
if (local)
|
|
52
|
+
local.srcObject = null;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const test = async (data) => {
|
|
56
|
+
const pcs = new RTCPeerConnection({
|
|
57
|
+
iceServers: data
|
|
58
|
+
});
|
|
59
|
+
console.log('www', data);
|
|
60
|
+
pcs.onicecandidate = (e) => console.log('Candidate:', e.candidate);
|
|
61
|
+
pcs.onicegatheringstatechange = () => console.log('Gathering:', pc.iceGatheringState);
|
|
62
|
+
const offer = await pcs.createOffer();
|
|
63
|
+
await pcs.setLocalDescription(offer);
|
|
64
|
+
};
|
|
65
|
+
const startPeerConnection = async () => {
|
|
66
|
+
// iceServer[1].credentialType = 'oauth'
|
|
67
|
+
// test(iceServer)
|
|
68
|
+
const data = { 'iceServers': [{ 'urls': 'stun:stun.cloudflare.com:3478' }] };
|
|
69
|
+
pc = new RTCPeerConnection(data);
|
|
70
|
+
// console.log(pc)
|
|
71
|
+
// pc = new RTCPeerConnection({ iceServers: data })
|
|
72
|
+
// console.log( "hung" , pc)
|
|
73
|
+
pc.onicegatheringstatechange = () => {
|
|
74
|
+
console.log('ICE gathering state:', pc.iceGatheringState);
|
|
75
|
+
};
|
|
76
|
+
pc.oniceconnectionstatechange = () => {
|
|
77
|
+
console.log('ICE connection state:', pc.iceConnectionState);
|
|
78
|
+
};
|
|
79
|
+
pc.addEventListener('icecandidate', (event) => {
|
|
80
|
+
console.log('iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii');
|
|
81
|
+
if (event.candidate) {
|
|
82
|
+
console.log("New ICE candidate:", event.candidate);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
pc.onicecandidate = (event) => {
|
|
86
|
+
console.log('iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii');
|
|
87
|
+
if (event.candidate) {
|
|
88
|
+
publishMessage(TOPIC_DETAIL_CALL + (userRemoter.value?.id ?? ''), {
|
|
89
|
+
type: 'candidate',
|
|
90
|
+
candidate: event.candidate,
|
|
91
|
+
link: iceStunServiceLink
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
pc.ontrack = (event) => {
|
|
96
|
+
console.log('aaaaaaa');
|
|
97
|
+
const remote = remoteAudio();
|
|
98
|
+
if (remote)
|
|
99
|
+
remote.srcObject = event.streams[0];
|
|
100
|
+
};
|
|
101
|
+
navigator.mediaDevices.getUserMedia({ audio: true }).then((stream) => {
|
|
102
|
+
const local = localAudio();
|
|
103
|
+
if (local)
|
|
104
|
+
local.srcObject = stream;
|
|
105
|
+
stream.getTracks().forEach((track) => pc?.addTrack(track, stream));
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
const getIceServiceLink = async () => {
|
|
109
|
+
const res = await getIceService();
|
|
110
|
+
console.log(res);
|
|
111
|
+
iceStunServiceLink = res[0]?.urls[0] ?? '';
|
|
112
|
+
iceServer = res;
|
|
113
|
+
};
|
|
114
|
+
const handleOffer = async (data) => {
|
|
115
|
+
if (pc)
|
|
116
|
+
return false;
|
|
117
|
+
if (!data.link || !data.offer || !data.user || !data.server)
|
|
118
|
+
return false;
|
|
119
|
+
offer = data;
|
|
120
|
+
return true;
|
|
121
|
+
};
|
|
122
|
+
const sendOfferOk = async () => {
|
|
123
|
+
if (!offer)
|
|
124
|
+
return;
|
|
125
|
+
try {
|
|
126
|
+
iceStunServiceLink = offer.link;
|
|
127
|
+
iceServer = offer.server;
|
|
128
|
+
userRemoter.value = offer.user;
|
|
129
|
+
startPeerConnection();
|
|
130
|
+
console.log(pc, 'aaaaaaa');
|
|
131
|
+
await pc.setRemoteDescription(new RTCSessionDescription(offer.offer));
|
|
132
|
+
answer = await pc?.createAnswer();
|
|
133
|
+
await pc?.setLocalDescription(answer);
|
|
134
|
+
publishMessage(TOPIC_DETAIL_CALL + (userRemoter.value?.id ?? ''), {
|
|
135
|
+
type: 'offer-response',
|
|
136
|
+
answer,
|
|
137
|
+
link: iceStunServiceLink
|
|
138
|
+
});
|
|
139
|
+
return true;
|
|
140
|
+
}
|
|
141
|
+
catch (e) {
|
|
142
|
+
console.log(e);
|
|
143
|
+
return false;
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
const handleOfferResponse = async (data) => {
|
|
147
|
+
if (!data.link || !data.answer || data.link != iceStunServiceLink)
|
|
148
|
+
return;
|
|
149
|
+
await pc?.setRemoteDescription(new RTCSessionDescription(data.answer));
|
|
150
|
+
};
|
|
151
|
+
const addIceCandidate = async (data) => {
|
|
152
|
+
try {
|
|
153
|
+
if (data.candidate && data.link == iceStunServiceLink) {
|
|
154
|
+
await pc.addIceCandidate(data.candidate);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
catch (e) {
|
|
158
|
+
console.error('Error adding received ICE candidate', e);
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
return {
|
|
162
|
+
call,
|
|
163
|
+
end,
|
|
164
|
+
endPc,
|
|
165
|
+
handleOfferResponse,
|
|
166
|
+
handleOffer,
|
|
167
|
+
addIceCandidate,
|
|
168
|
+
sendOfferOk
|
|
169
|
+
};
|
|
170
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PAGE_RESPONSE } from '../types/chat/global';
|
|
2
|
+
export declare const isRouterReady: import("vue").Ref<boolean, boolean>;
|
|
3
|
+
export declare function useInitData(): {
|
|
4
|
+
NOTIFY_ID_APPOINTMENT_NAME: string;
|
|
5
|
+
initPage: (data: {
|
|
6
|
+
id?: string;
|
|
7
|
+
token?: string;
|
|
8
|
+
domain?: string;
|
|
9
|
+
response: PAGE_RESPONSE;
|
|
10
|
+
}) => Promise<void>;
|
|
11
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { ref } from 'vue';
|
|
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';
|
|
9
|
+
//PINIA
|
|
10
|
+
export const isRouterReady = ref(false);
|
|
11
|
+
export function useInitData() {
|
|
12
|
+
const NOTIFY_ID_APPOINTMENT_NAME = 'notifyIdAppointment';
|
|
13
|
+
const initPage = async (data) => {
|
|
14
|
+
try {
|
|
15
|
+
isRouterReady.value = false;
|
|
16
|
+
const sdk_res = await sdkInit({ id: data.id, token: data.token, domain: data.domain });
|
|
17
|
+
if (sdk_res.tenant_error) {
|
|
18
|
+
const api_link_res = await loginApiLink();
|
|
19
|
+
// if (api_link_res.client_error) {
|
|
20
|
+
// routerPush(PAGE.TENANT_ERROR)
|
|
21
|
+
// return
|
|
22
|
+
// }
|
|
23
|
+
}
|
|
24
|
+
// connectMqtt()
|
|
25
|
+
await initData();
|
|
26
|
+
if (data.response == 'mobile') {
|
|
27
|
+
routerPush(PAGE.CHAT_LIST);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
routerPush(PAGE.HOME);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
catch (error) {
|
|
34
|
+
console.log(error);
|
|
35
|
+
}
|
|
36
|
+
finally {
|
|
37
|
+
isRouterReady.value = true;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const initData = async () => {
|
|
41
|
+
await getProfile();
|
|
42
|
+
getWebSocket();
|
|
43
|
+
unsubscribeFromTopic(TOPIC_DETAIL_CALL + dataProfile.value?.id);
|
|
44
|
+
subscribeToTopic(TOPIC_DETAIL_CALL + dataProfile.value?.id);
|
|
45
|
+
};
|
|
46
|
+
const loginApiLink = async () => {
|
|
47
|
+
try {
|
|
48
|
+
const queryString = window.location.search;
|
|
49
|
+
const urlParams = new URLSearchParams(queryString);
|
|
50
|
+
const tenant_id = urlParams.get('tenant_id') || '';
|
|
51
|
+
const phone = urlParams.get('phone') || '';
|
|
52
|
+
const message = urlParams.get('message') || '';
|
|
53
|
+
const customer_name = urlParams.get('customer_name') || '';
|
|
54
|
+
const business_name = urlParams.get('business_name') || '';
|
|
55
|
+
if (!tenant_id || !phone || !message || !customer_name || !business_name)
|
|
56
|
+
return { client_error: true };
|
|
57
|
+
const param = {
|
|
58
|
+
tenant_id,
|
|
59
|
+
phone,
|
|
60
|
+
message,
|
|
61
|
+
customer_name,
|
|
62
|
+
business_name
|
|
63
|
+
};
|
|
64
|
+
await loginLink(param);
|
|
65
|
+
clearApiParams();
|
|
66
|
+
return {};
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
console.log(error);
|
|
70
|
+
return { client_error: true };
|
|
71
|
+
}
|
|
72
|
+
finally {
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
const clearApiParams = () => {
|
|
76
|
+
const url = new URL(window.location.href);
|
|
77
|
+
url.search = "";
|
|
78
|
+
window.history.replaceState({}, document.title, url);
|
|
79
|
+
};
|
|
80
|
+
return {
|
|
81
|
+
NOTIFY_ID_APPOINTMENT_NAME,
|
|
82
|
+
initPage
|
|
83
|
+
};
|
|
84
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ref } from 'vue';
|
|
2
|
+
// export type ConfirmPayload = {
|
|
3
|
+
// headerTitle?: string
|
|
4
|
+
// bodyTitle?: string
|
|
5
|
+
// bodyImage?: string
|
|
6
|
+
// bodyMessage?: string
|
|
7
|
+
// confirmButtonText?: string
|
|
8
|
+
// cancelButtonText?: string
|
|
9
|
+
// timeOut?: number //seconds
|
|
10
|
+
// type?: 'confirm' | 'information'
|
|
11
|
+
// }
|
|
12
|
+
//
|
|
13
|
+
// export type ConfirmPayloadPromise = AddPromise<ConfirmPayload>
|
|
14
|
+
const handleConfirm = ref(null);
|
|
15
|
+
function setHandleConfirm(callback) {
|
|
16
|
+
handleConfirm.value = callback;
|
|
17
|
+
}
|
|
18
|
+
export function useModalConfirm() {
|
|
19
|
+
function setHandleConfirm(callback) {
|
|
20
|
+
handleConfirm.value = callback;
|
|
21
|
+
}
|
|
22
|
+
function modalConfirm(data) {
|
|
23
|
+
return new Promise((resolve, reject) => {
|
|
24
|
+
if (handleConfirm.value == null) {
|
|
25
|
+
reject('Modal is not already active');
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
handleConfirm.value({
|
|
29
|
+
...data,
|
|
30
|
+
resolve,
|
|
31
|
+
reject
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
setHandleConfirm,
|
|
37
|
+
modalConfirm
|
|
38
|
+
};
|
|
39
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare const enum Status_Color {
|
|
2
|
+
Orange = "#F2994A",
|
|
3
|
+
Blue_Teal = "#F2994A"
|
|
4
|
+
}
|
|
5
|
+
declare const enum Color {
|
|
6
|
+
Primary = "#0051E6",
|
|
7
|
+
Primary_Hover = "#699FF5",
|
|
8
|
+
Primary_RGB = "41, 121, 255",
|
|
9
|
+
Error = "#ff3b3b",
|
|
10
|
+
Error_Hover = "#FF8A75",
|
|
11
|
+
Success = "#1DA91D",
|
|
12
|
+
Success_Hover = "#5FD9A0",
|
|
13
|
+
Success_Bg = "#E9FFE4",
|
|
14
|
+
Warning = "#f3a22c",
|
|
15
|
+
Text = "#333333",
|
|
16
|
+
Link = "#1890ff",
|
|
17
|
+
Default_Appointment = "#rgb(244, 185, 124)",
|
|
18
|
+
Done_Appointment = "#00d652",
|
|
19
|
+
Cancel_Appointment = "#ff0000"
|
|
20
|
+
}
|
|
21
|
+
export default Color;
|
|
22
|
+
export declare function defineRootColor(): void;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export var Status_Color;
|
|
2
|
+
(function (Status_Color) {
|
|
3
|
+
Status_Color["Orange"] = "#F2994A";
|
|
4
|
+
Status_Color["Blue_Teal"] = "#F2994A";
|
|
5
|
+
})(Status_Color || (Status_Color = {}));
|
|
6
|
+
var Color;
|
|
7
|
+
(function (Color) {
|
|
8
|
+
Color["Primary"] = "#0051E6";
|
|
9
|
+
Color["Primary_Hover"] = "#699FF5";
|
|
10
|
+
Color["Primary_RGB"] = "41, 121, 255";
|
|
11
|
+
Color["Error"] = "#ff3b3b";
|
|
12
|
+
Color["Error_Hover"] = "#FF8A75";
|
|
13
|
+
Color["Success"] = "#1DA91D";
|
|
14
|
+
Color["Success_Hover"] = "#5FD9A0";
|
|
15
|
+
Color["Success_Bg"] = "#E9FFE4";
|
|
16
|
+
Color["Warning"] = "#f3a22c";
|
|
17
|
+
Color["Text"] = "#333333";
|
|
18
|
+
Color["Link"] = "#1890ff";
|
|
19
|
+
Color["Default_Appointment"] = "#rgb(244, 185, 124)";
|
|
20
|
+
Color["Done_Appointment"] = "#00d652";
|
|
21
|
+
Color["Cancel_Appointment"] = "#ff0000";
|
|
22
|
+
})(Color || (Color = {}));
|
|
23
|
+
export default Color;
|
|
24
|
+
export function defineRootColor() {
|
|
25
|
+
const root = document.querySelector(':root');
|
|
26
|
+
if (root) {
|
|
27
|
+
root.style?.setProperty('--chat-color-primary', Color.Primary);
|
|
28
|
+
// root.style?.setProperty('--chat-color-primary_hover', Color.Primary_Hover)
|
|
29
|
+
// root.style?.setProperty('--chat-color-primary_rgb', Color.Primary_RGB)
|
|
30
|
+
// root.style?.setProperty('--chat-color-error', Color.Error)
|
|
31
|
+
// root.style?.setProperty('--chat-color-error_hover', Color.Error_Hover)
|
|
32
|
+
root.style?.setProperty('--chat-color-success', Color.Success);
|
|
33
|
+
// root.style?.setProperty('--chat-color-success-bg', Color.Success_Bg)
|
|
34
|
+
// root.style?.setProperty('--chat-color-success_hover', Color.Success_Hover)
|
|
35
|
+
// root.style?.setProperty('--chat-color-second-success', Color.Success)
|
|
36
|
+
// root.style?.setProperty('--chat-color-warning', Color.Warning)
|
|
37
|
+
// root.style?.setProperty('--chat-color-text', Color.Text)
|
|
38
|
+
// root.style?.setProperty('--chat-color-link', Color.Link)
|
|
39
|
+
// root.style?.setProperty('--chat-color-default_appointment', Color.Default_Appointment)
|
|
40
|
+
// root.style?.setProperty('--chat-color-done_appointment', Color.Done_Appointment)
|
|
41
|
+
// root.style?.setProperty('--chat-color-cancel_appointment', Color.Cancel_Appointment)
|
|
42
|
+
}
|
|
43
|
+
}
|