@phonghq/go-chat 1.0.72 → 1.0.74
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/assets/icons/call/IconClock.vue.d.ts +2 -0
- package/dist/assets/icons/call/IconClock.vue.js +22 -0
- package/dist/assets/icons/call/IconClose.vue.d.ts +2 -0
- package/dist/assets/icons/call/IconClose.vue.js +26 -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 +22 -0
- package/dist/assets/icons/call/IconPhoneCancel.vue.d.ts +14 -0
- package/dist/assets/icons/call/IconPhoneCancel.vue.js +46 -0
- package/dist/assets/icons/call/IconSoundDownload.vue.d.ts +2 -0
- package/dist/assets/icons/call/IconSoundDownload.vue.js +50 -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/chat/IconCalendar.vue.d.ts +14 -0
- package/dist/assets/icons/chat/IconCalendar.vue.js +42 -0
- package/dist/assets/icons/chat/IconCheck.vue.d.ts +2 -0
- package/dist/assets/icons/chat/IconCheck.vue.js +22 -0
- package/dist/assets/icons/chat/IconInfo.vue.d.ts +2 -0
- package/dist/assets/icons/chat/IconInfo.vue.js +20 -0
- package/dist/assets/icons/chat/IconLink.vue.d.ts +14 -0
- package/dist/assets/icons/chat/IconLink.vue.js +42 -0
- package/dist/assets/icons/chat/IconMenuDot.vue.d.ts +2 -0
- package/dist/assets/icons/chat/IconMenuDot.vue.js +31 -0
- package/dist/assets/icons/customer-appointment/IconChevronRight.vue.d.ts +2 -0
- package/dist/assets/icons/customer-appointment/IconChevronRight.vue.js +22 -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 +14 -0
- package/dist/assets/icons/customer-detail/IconPhone.vue.js +41 -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/assets/icons/global/IconAiCheck.vue.d.ts +2 -0
- package/dist/assets/icons/global/IconAiCheck.vue.js +28 -0
- package/dist/assets/icons/global/IconArrowLeft.vue.d.ts +2 -0
- package/dist/assets/icons/global/IconArrowLeft.vue.js +29 -0
- package/dist/assets/icons/global/IconBackspace.vue.d.ts +2 -0
- package/dist/assets/icons/global/IconBackspace.vue.js +28 -0
- package/dist/assets/icons/global/IconCloseCircle.vue.d.ts +2 -0
- package/dist/assets/icons/global/IconCloseCircle.vue.js +36 -0
- package/dist/assets/icons/global/IconMessageOutline.vue.d.ts +2 -0
- package/dist/assets/icons/global/IconMessageOutline.vue.js +22 -0
- package/dist/assets/icons/global/IconPhone.vue.d.ts +2 -0
- package/dist/assets/icons/global/IconPhone.vue.js +19 -0
- package/dist/assets/icons/global/IconPlan.vue.d.ts +14 -0
- package/dist/assets/icons/global/IconPlan.vue.js +39 -0
- package/dist/assets/icons/global/IconPlus.vue.d.ts +2 -0
- package/dist/assets/icons/global/IconPlus.vue.js +22 -0
- package/dist/assets/icons/global/IconSearch.vue.d.ts +32 -0
- package/dist/assets/icons/global/IconSearch.vue.js +68 -0
- package/dist/assets/icons/global/IconSms.vue.d.ts +2 -0
- package/dist/assets/icons/global/IconSms.vue.js +22 -0
- package/dist/assets/icons/global/IconUser.vue.d.ts +2 -0
- package/dist/assets/icons/global/IconUser.vue.js +25 -0
- package/dist/assets/icons/lib/IconZoomOut.vue.d.ts +5 -0
- package/dist/assets/icons/lib/IconZoomOut.vue.js +52 -0
- package/dist/chat/App.vue.d.ts +26 -0
- package/dist/chat/App.vue.js +928 -0
- package/dist/chat/ChatHeader.vue.d.ts +15 -0
- package/dist/chat/ChatHeader.vue.js +218 -0
- package/dist/chat/main.d.ts +7 -0
- package/dist/chat/main.js +7 -0
- package/dist/chat/page/customer-appointment/CustomerAppointment.vue.d.ts +9 -0
- package/dist/chat/page/customer-appointment/CustomerAppointment.vue.js +262 -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 +138 -0
- package/dist/chat/page/customer-detail/CustomerDetail.vue.d.ts +7 -0
- package/dist/chat/page/customer-detail/CustomerDetail.vue.js +234 -0
- package/dist/chat/page/customer-detail/SubInformation.vue.d.ts +16 -0
- package/dist/chat/page/customer-detail/SubInformation.vue.js +134 -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 +104 -0
- package/dist/chat/page/home/ChatList.vue.js +654 -0
- package/dist/chat/page/home/ChatMessage.vue.d.ts +21 -0
- package/dist/chat/page/home/ChatMessage.vue.js +210 -0
- package/dist/chat/page/home/ChatMessageItem.vue.d.ts +20 -0
- package/dist/chat/page/home/ChatMessageItem.vue.js +397 -0
- package/dist/chat/page/home/ChatMessageItem2.vue.d.ts +19 -0
- package/dist/chat/page/home/ChatMessageItem2.vue.js +351 -0
- package/dist/chat/page/home/DropZone.vue.d.ts +13 -0
- package/dist/chat/page/home/DropZone.vue.js +130 -0
- package/dist/chat/page/home/Home.vue.d.ts +29 -0
- package/dist/chat/page/home/Home.vue.js +472 -0
- package/dist/chat/page/home/HomeHeader.vue.d.ts +18 -0
- package/dist/chat/page/home/HomeHeader.vue.js +514 -0
- package/dist/chat/page/home/InputChat.vue.d.ts +27 -0
- package/dist/chat/page/home/InputChat.vue.js +412 -0
- package/dist/chat/page/home/NewCustomer.vue.d.ts +7 -0
- package/dist/chat/page/home/NewCustomer.vue.js +83 -0
- package/dist/chat/page/home/PhoneNumpad.vue.d.ts +22 -0
- package/dist/chat/page/home/PhoneNumpad.vue.js +161 -0
- package/dist/chat/page/setting/Setting.vue.d.ts +2 -0
- package/dist/chat/page/setting/Setting.vue.js +277 -0
- package/dist/chat/page/setting/SettingSuccess.vue.d.ts +2 -0
- package/dist/chat/page/setting/SettingSuccess.vue.js +33 -0
- package/dist/components/chat/ScrollEvent/ScrollEvent.vue.d.ts +24 -0
- package/dist/components/chat/ScrollEvent/ScrollEvent.vue.js +207 -0
- package/dist/components/chat/call/Calling.vue.d.ts +17 -0
- package/dist/components/chat/call/Calling.vue.js +594 -0
- package/dist/components/chat/call/TimeLeft.vue.d.ts +5 -0
- package/dist/components/chat/call/TimeLeft.vue.js +59 -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/modal/Modal.vue.d.ts +94 -0
- package/dist/components/chat/common/modal/Modal.vue.js +260 -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 +10 -0
- package/dist/components/chat/common/spin/BaseSpin.vue.js +43 -0
- package/dist/components/chat/common/switch/SwitchBase.vue.d.ts +17 -0
- package/dist/components/chat/common/switch/SwitchBase.vue.js +76 -0
- package/dist/components/chat/common/tab/TabBase.vue.d.ts +30 -0
- package/dist/components/chat/common/tab/TabBase.vue.js +86 -0
- package/dist/components/chat/common/tabs/TabBase.vue.d.ts +18 -0
- package/dist/components/chat/common/tabs/TabBase.vue.js +93 -0
- package/dist/components/chat/customer/Avatar.vue.d.ts +12 -0
- package/dist/components/chat/customer/Avatar.vue.js +127 -0
- package/dist/components/chat/layout/mobile/Footer.vue.d.ts +2 -0
- package/dist/components/chat/layout/mobile/Footer.vue.js +114 -0
- package/dist/components/chat/select/SelectBase.vue.d.ts +24 -0
- package/dist/components/chat/select/SelectBase.vue.js +105 -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/drawer/DrawerBaseCustom.vue.d.ts +33 -0
- package/dist/components/common/drawer/DrawerBaseCustom.vue.js +135 -0
- package/dist/components/common/dropdown/DropdownBase.vue.d.ts +21 -0
- package/dist/components/common/dropdown/DropdownBase.vue.js +93 -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 +187 -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/select/SelectBase.vue.d.ts +33 -0
- package/dist/components/common/select/SelectBase.vue.js +120 -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/PageError.vue.d.ts +2 -0
- package/dist/components/layout/PageError.vue.js +91 -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 +66 -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/select/Select.vue.d.ts +20 -0
- package/dist/components/ui/select/Select.vue.js +49 -0
- package/dist/components/ui/select/SelectContent.vue.d.ts +24 -0
- package/dist/components/ui/select/SelectContent.vue.js +103 -0
- package/dist/components/ui/select/SelectGroup.vue.d.ts +10 -0
- package/dist/components/ui/select/SelectGroup.vue.js +37 -0
- package/dist/components/ui/select/SelectItem.vue.d.ts +18 -0
- package/dist/components/ui/select/SelectItem.vue.js +73 -0
- package/dist/components/ui/select/SelectItemText.vue.d.ts +10 -0
- package/dist/components/ui/select/SelectItemText.vue.js +37 -0
- package/dist/components/ui/select/SelectLabel.vue.d.ts +14 -0
- package/dist/components/ui/select/SelectLabel.vue.js +40 -0
- package/dist/components/ui/select/SelectScrollDownButton.vue.d.ts +14 -0
- package/dist/components/ui/select/SelectScrollDownButton.vue.js +58 -0
- package/dist/components/ui/select/SelectScrollUpButton.vue.d.ts +14 -0
- package/dist/components/ui/select/SelectScrollUpButton.vue.js +58 -0
- package/dist/components/ui/select/SelectSeparator.vue.d.ts +7 -0
- package/dist/components/ui/select/SelectSeparator.vue.js +39 -0
- package/dist/components/ui/select/SelectTrigger.vue.d.ts +17 -0
- package/dist/components/ui/select/SelectTrigger.vue.js +49 -0
- package/dist/components/ui/select/SelectValue.vue.d.ts +10 -0
- package/dist/components/ui/select/SelectValue.vue.js +37 -0
- package/dist/components/ui/select/index.d.ts +11 -0
- package/dist/components/ui/select/index.js +11 -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/components/ui/tabs/Tabs.vue.d.ts +20 -0
- package/dist/components/ui/tabs/Tabs.vue.js +54 -0
- package/dist/components/ui/tabs/TabsContent.vue.d.ts +14 -0
- package/dist/components/ui/tabs/TabsContent.vue.js +44 -0
- package/dist/components/ui/tabs/TabsList.vue.d.ts +14 -0
- package/dist/components/ui/tabs/TabsList.vue.js +44 -0
- package/dist/components/ui/tabs/TabsTrigger.vue.d.ts +14 -0
- package/dist/components/ui/tabs/TabsTrigger.vue.js +45 -0
- package/dist/components/ui/tabs/index.d.ts +4 -0
- package/dist/components/ui/tabs/index.js +4 -0
- package/dist/composable/useDigibot.d.ts +7 -0
- package/dist/composable/useDigibot.js +23 -0
- package/dist/composable/useInitData.d.ts +12 -0
- package/dist/composable/useInitData.js +101 -0
- package/dist/composable/useListConversations.d.ts +59 -0
- package/dist/composable/useListConversations.js +220 -0
- package/dist/composable/useListentEvent.d.ts +5 -0
- package/dist/composable/useListentEvent.js +69 -0
- package/dist/composable/usePlivo.d.ts +15 -0
- package/dist/composable/usePlivo.js +201 -0
- package/dist/constant/color.d.ts +22 -0
- package/dist/constant/color.js +47 -0
- package/dist/constant/datetime.d.ts +7 -0
- package/dist/constant/datetime.js +7 -0
- package/dist/constant/general.d.ts +11 -0
- package/dist/constant/general.js +12 -0
- package/dist/constant/message.d.ts +8 -0
- package/dist/constant/message.js +8 -0
- package/dist/constant/mqtt.d.ts +7 -0
- package/dist/constant/mqtt.js +18 -0
- package/dist/constant/user.d.ts +8 -0
- package/dist/constant/user.js +9 -0
- package/dist/go-chat.es.js +18766 -17073
- package/dist/go-chat.umd.js +23 -23
- 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 +84 -0
- package/dist/plugins/mqtt.d.ts +8 -0
- package/dist/plugins/mqtt.js +189 -0
- package/dist/plugins/pocketbase.d.ts +5 -0
- package/dist/plugins/pocketbase.js +15 -0
- package/dist/plugins/sdk.d.ts +18 -0
- package/dist/plugins/sdk.js +73 -0
- package/dist/plugins/websocket.d.ts +15 -0
- package/dist/plugins/websocket.js +151 -0
- package/dist/style.css +1 -1
- package/dist/types/chat/auth.d.ts +41 -0
- package/dist/types/chat/auth.js +1 -0
- package/dist/types/chat/call.d.ts +19 -0
- package/dist/types/chat/call.js +23 -0
- package/dist/types/chat/global.d.ts +58 -0
- package/dist/types/chat/global.js +1 -0
- package/dist/types/chat/promise.d.ts +17 -0
- package/dist/types/chat/promise.js +1 -0
- package/dist/types/chat/user.d.ts +88 -0
- package/dist/types/chat/user.js +1 -0
- package/dist/types/conversation.d.ts +23 -0
- package/dist/types/conversation.js +1 -0
- package/dist/types/global.d.ts +11 -0
- package/dist/types/global.js +15 -0
- package/dist/types/message.d.ts +52 -0
- package/dist/types/message.js +1 -0
- package/dist/utils/chat/cache.d.ts +7 -0
- package/dist/utils/chat/cache.js +63 -0
- package/dist/utils/chat/chat-router.d.ts +5 -0
- package/dist/utils/chat/chat-router.js +14 -0
- package/dist/utils/chat/page-error.d.ts +4 -0
- package/dist/utils/chat/page-error.js +25 -0
- package/dist/utils/chat/phone-string.d.ts +1 -0
- package/dist/utils/chat/phone-string.js +4 -0
- package/dist/utils/chat/queue.d.ts +7 -0
- package/dist/utils/chat/queue.js +30 -0
- package/dist/utils/chat/store/auth.d.ts +62 -0
- package/dist/utils/chat/store/auth.js +93 -0
- package/dist/utils/chat/store/call.d.ts +15 -0
- package/dist/utils/chat/store/call.js +160 -0
- package/dist/utils/chat/store/conversation.d.ts +14 -0
- package/dist/utils/chat/store/conversation.js +73 -0
- package/dist/utils/chat/store/message.d.ts +27 -0
- package/dist/utils/chat/store/message.js +70 -0
- package/dist/utils/chat/store/time-limit.d.ts +5 -0
- package/dist/utils/chat/store/time-limit.js +8 -0
- package/dist/utils/chat/store/user.d.ts +200 -0
- package/dist/utils/chat/store/user.js +44 -0
- package/dist/utils/dayjs-helper.d.ts +3 -0
- package/dist/utils/dayjs-helper.js +8 -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 +3 -0
- package/dist/utils/string-helper.js +43 -0
- package/dist/views/NotTenantPhone.vue.d.ts +9 -0
- package/dist/views/NotTenantPhone.vue.js +99 -0
- package/dist/views/home/phone-numpad/ConvercationList.vue.d.ts +19 -0
- package/dist/views/home/phone-numpad/ConvercationList.vue.js +177 -0
- package/dist/views/home/phone-numpad/PhoneNumpad.vue.d.ts +32 -0
- package/dist/views/home/phone-numpad/PhoneNumpad.vue.js +403 -0
- package/package.json +1 -1
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { dataProfile } from './store/auth';
|
|
2
|
+
export function setCache(key, data, ttlMs = 1000) {
|
|
3
|
+
if (!dataProfile.value?.id)
|
|
4
|
+
return;
|
|
5
|
+
const now = Date.now();
|
|
6
|
+
const id = dataProfile.value?.id;
|
|
7
|
+
const payload = {
|
|
8
|
+
timestamp: now,
|
|
9
|
+
ttl: ttlMs,
|
|
10
|
+
id: id,
|
|
11
|
+
data
|
|
12
|
+
};
|
|
13
|
+
localStorage.setItem(key, JSON.stringify(payload));
|
|
14
|
+
}
|
|
15
|
+
export function getCache(key) {
|
|
16
|
+
if (!dataProfile.value?.id)
|
|
17
|
+
return { data: null };
|
|
18
|
+
const raw = localStorage.getItem(key);
|
|
19
|
+
const id = dataProfile.value?.id;
|
|
20
|
+
if (!raw)
|
|
21
|
+
return { data: null };
|
|
22
|
+
try {
|
|
23
|
+
const payload = JSON.parse(raw);
|
|
24
|
+
if (!payload.timestamp || !payload.ttl)
|
|
25
|
+
return { data: null };
|
|
26
|
+
if (!payload?.id || payload?.id != id)
|
|
27
|
+
return { data: null };
|
|
28
|
+
const isExpired = Date.now() - payload.timestamp > payload.ttl;
|
|
29
|
+
return {
|
|
30
|
+
data: payload.data,
|
|
31
|
+
needReload: isExpired
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
catch (e) {
|
|
35
|
+
console.warn("Cache parse error:", e);
|
|
36
|
+
return { data: null };
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export function clearCache(key) {
|
|
40
|
+
localStorage.removeItem(key);
|
|
41
|
+
}
|
|
42
|
+
export function removeOldestCache(limit, prefix) {
|
|
43
|
+
const allKeys = Object.keys(localStorage).filter(k => k.startsWith(prefix));
|
|
44
|
+
if (allKeys.length > limit) {
|
|
45
|
+
const entries = allKeys.map(k => {
|
|
46
|
+
const raw = localStorage.getItem(k);
|
|
47
|
+
try {
|
|
48
|
+
const parsed = JSON.parse(raw || "{}");
|
|
49
|
+
return { key: k, expire: parsed.timestamp || 0 };
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return { key: k, expire: 0 };
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
entries.sort((a, b) => a.expire - b.expire);
|
|
56
|
+
while (entries.length > limit) {
|
|
57
|
+
const oldest = entries.shift();
|
|
58
|
+
if (oldest) {
|
|
59
|
+
localStorage.removeItem(oldest.key);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { PAGE } from '../../constant/general';
|
|
2
|
+
export declare const currentPage: import("vue").Ref<PAGE, PAGE>;
|
|
3
|
+
export declare let beforeEach: ((page: PAGE) => null | PAGE) | null;
|
|
4
|
+
export declare const routerPush: (page: PAGE) => void;
|
|
5
|
+
export declare const routerBack: () => void;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ref } from 'vue';
|
|
2
|
+
import { PAGE } from '../../constant/general';
|
|
3
|
+
export const currentPage = ref(PAGE.HOME);
|
|
4
|
+
export let beforeEach = null;
|
|
5
|
+
let pastPage = PAGE.HOME;
|
|
6
|
+
export const routerPush = (page) => {
|
|
7
|
+
const to_page = beforeEach?.(page) ?? page;
|
|
8
|
+
if (to_page != currentPage.value)
|
|
9
|
+
pastPage = currentPage.value;
|
|
10
|
+
currentPage.value = to_page;
|
|
11
|
+
};
|
|
12
|
+
export const routerBack = () => {
|
|
13
|
+
currentPage.value = pastPage;
|
|
14
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const goChatError: import("vue").Ref<string, string>;
|
|
2
|
+
export declare const mediaPermissionState: import("vue").Ref<"granted" | "denied" | "prompt", "granted" | "denied" | "prompt">;
|
|
3
|
+
export declare const handleMedialPermissionError: () => Promise<void>;
|
|
4
|
+
export declare const showPageError: (error: string) => void;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ref } from 'vue';
|
|
2
|
+
export const goChatError = ref('');
|
|
3
|
+
export const mediaPermissionState = ref('granted');
|
|
4
|
+
export const handleMedialPermissionError = async () => {
|
|
5
|
+
if (navigator.permissions && navigator.permissions.query) {
|
|
6
|
+
try {
|
|
7
|
+
const result = await navigator.permissions.query({ name: 'microphone' });
|
|
8
|
+
if (result.state == 'prompt') {
|
|
9
|
+
goChatError.value =
|
|
10
|
+
'Microphone access is needed. Please allow microphone permission to continue.';
|
|
11
|
+
}
|
|
12
|
+
else if (result.state == 'denied') {
|
|
13
|
+
goChatError.value =
|
|
14
|
+
'You have denied microphone access. Please enable microphone permission in your browser to continue the call.';
|
|
15
|
+
}
|
|
16
|
+
mediaPermissionState.value = result.state;
|
|
17
|
+
}
|
|
18
|
+
catch (err) {
|
|
19
|
+
console.log(err);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
export const showPageError = (error) => {
|
|
24
|
+
goChatError.value = error;
|
|
25
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const formatPhone10number: (phone: string, dial?: string) => string;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export class AsyncQueue {
|
|
2
|
+
queue = [];
|
|
3
|
+
running = false;
|
|
4
|
+
constructor() {
|
|
5
|
+
this.queue = [];
|
|
6
|
+
this.running = false;
|
|
7
|
+
}
|
|
8
|
+
add(task) {
|
|
9
|
+
return new Promise((resolve, reject) => {
|
|
10
|
+
this.queue.push({ task, resolve, reject });
|
|
11
|
+
this._run();
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
async _run() {
|
|
15
|
+
if (this.running)
|
|
16
|
+
return;
|
|
17
|
+
this.running = true;
|
|
18
|
+
while (this.queue.length > 0) {
|
|
19
|
+
const { task, resolve, reject } = this.queue.shift();
|
|
20
|
+
try {
|
|
21
|
+
const result = await task();
|
|
22
|
+
resolve(result);
|
|
23
|
+
}
|
|
24
|
+
catch (err) {
|
|
25
|
+
reject(err);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
this.running = false;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { IResLoginLink, IResProfile } from '../../../types/chat/auth';
|
|
2
|
+
interface IBodyLoginTenant {
|
|
3
|
+
tenant_id: string;
|
|
4
|
+
}
|
|
5
|
+
interface IPramsLoginLink {
|
|
6
|
+
tenant_id: string;
|
|
7
|
+
phone: string;
|
|
8
|
+
message: string;
|
|
9
|
+
customer_name: string;
|
|
10
|
+
business_name: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const dataProfile: import("vue").Ref<{
|
|
13
|
+
id: number;
|
|
14
|
+
username: string;
|
|
15
|
+
tenant_id: string | null;
|
|
16
|
+
phone: string;
|
|
17
|
+
tenant_phone_limit: number;
|
|
18
|
+
tenant_phone_forwarding: string;
|
|
19
|
+
avatar: string | null;
|
|
20
|
+
user_type: "customer" | "tenant";
|
|
21
|
+
has_business_tenant_phone?: boolean | undefined;
|
|
22
|
+
color: string;
|
|
23
|
+
is_sms_active: number;
|
|
24
|
+
} | null, IResProfile | {
|
|
25
|
+
id: number;
|
|
26
|
+
username: string;
|
|
27
|
+
tenant_id: string | null;
|
|
28
|
+
phone: string;
|
|
29
|
+
tenant_phone_limit: number;
|
|
30
|
+
tenant_phone_forwarding: string;
|
|
31
|
+
avatar: string | null;
|
|
32
|
+
user_type: "customer" | "tenant";
|
|
33
|
+
has_business_tenant_phone?: boolean | undefined;
|
|
34
|
+
color: string;
|
|
35
|
+
is_sms_active: number;
|
|
36
|
+
} | null>;
|
|
37
|
+
export declare const dataLoginLink: import("vue").Ref<{
|
|
38
|
+
token: string;
|
|
39
|
+
refresh_token: string;
|
|
40
|
+
conversation_id: number;
|
|
41
|
+
receiver_id: number;
|
|
42
|
+
} | null, IResLoginLink | {
|
|
43
|
+
token: string;
|
|
44
|
+
refresh_token: string;
|
|
45
|
+
conversation_id: number;
|
|
46
|
+
receiver_id: number;
|
|
47
|
+
} | null>;
|
|
48
|
+
export declare const setDataLogin: (id: string, token: string, domain: string) => void;
|
|
49
|
+
export declare const loginTenant: (body: IBodyLoginTenant) => Promise<any>;
|
|
50
|
+
export declare const loginLink: (params: IPramsLoginLink) => Promise<any>;
|
|
51
|
+
export declare const getProfile: () => Promise<IResProfile>;
|
|
52
|
+
export declare const checkTenantPhoneOnGapInsight: () => Promise<any>;
|
|
53
|
+
export declare const submitTenantPhone: (body: {
|
|
54
|
+
phone: string;
|
|
55
|
+
tenant_id: string;
|
|
56
|
+
}) => Promise<any>;
|
|
57
|
+
export declare const updateProfile: (body: {
|
|
58
|
+
phone: string;
|
|
59
|
+
}) => Promise<any>;
|
|
60
|
+
export declare const getBusinessInfo: () => Promise<any>;
|
|
61
|
+
export declare const logout: () => Promise<void>;
|
|
62
|
+
export {};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import axios from '../../../plugins/axios';
|
|
2
|
+
import { gapMiniAppSdk } from '../../../plugins/sdk';
|
|
3
|
+
import { ref } from 'vue';
|
|
4
|
+
import axios_gci from '../../../plugins/axios-gci';
|
|
5
|
+
export const dataProfile = ref(null);
|
|
6
|
+
export const dataLoginLink = ref(null);
|
|
7
|
+
let dataLogin = {
|
|
8
|
+
id: '',
|
|
9
|
+
token: '',
|
|
10
|
+
domain: ''
|
|
11
|
+
};
|
|
12
|
+
export const setDataLogin = (id, token, domain) => {
|
|
13
|
+
dataLogin = { id, token, domain };
|
|
14
|
+
};
|
|
15
|
+
export const loginTenant = async (body) => {
|
|
16
|
+
const res = await axios.post('/api/v1/message/tenant/login', body);
|
|
17
|
+
localStorage.setItem('chat_token', res?.token);
|
|
18
|
+
localStorage.setItem('refresh_token', res?.refresh_token);
|
|
19
|
+
dataLogin.id = body.tenant_id;
|
|
20
|
+
dataLogin.token = res?.token;
|
|
21
|
+
dataProfile.value = res;
|
|
22
|
+
return res;
|
|
23
|
+
};
|
|
24
|
+
export const loginLink = async (params) => {
|
|
25
|
+
const res = await axios.get('/api/v1/message/tenant/gci-link', { params: params });
|
|
26
|
+
localStorage.setItem('chat_token', res?.token);
|
|
27
|
+
localStorage.setItem('refresh_token', res?.refresh_token);
|
|
28
|
+
dataLogin.id = params.tenant_id;
|
|
29
|
+
dataLogin.token = res?.token;
|
|
30
|
+
dataLoginLink.value = res;
|
|
31
|
+
return res;
|
|
32
|
+
};
|
|
33
|
+
export const getProfile = async () => {
|
|
34
|
+
const res = await axios.get('/api/v1/message/user/me');
|
|
35
|
+
localStorage.setItem('chat_user', JSON.stringify(res));
|
|
36
|
+
dataProfile.value = res;
|
|
37
|
+
// dataProfile.value = Object.fromEntries(
|
|
38
|
+
// Object.entries(res).filter(([key]) => !['tenant_phone'].includes(key))
|
|
39
|
+
// ) as IResProfile
|
|
40
|
+
return res;
|
|
41
|
+
};
|
|
42
|
+
export const checkTenantPhoneOnGapInsight = async () => {
|
|
43
|
+
const id = localStorage.getItem('chat_id');
|
|
44
|
+
const res = await axios.get(`/api/v1/message/tenant/get-info?tenant_name=${id}`);
|
|
45
|
+
if (res?.error || !res?.data)
|
|
46
|
+
throw new Error(res.error);
|
|
47
|
+
// if (dataProfile.value) dataProfile.value.tenant_phone = res?.data?.go_chat_phone ?? ''
|
|
48
|
+
if (dataProfile.value)
|
|
49
|
+
dataProfile.value.tenant_phone_limit = Number(res?.data?.go_chat_phone_limit ?? 0);
|
|
50
|
+
if (dataProfile.value)
|
|
51
|
+
dataProfile.value.tenant_phone_forwarding = res?.data?.go_chat_phone_forwarding ?? '';
|
|
52
|
+
// if (
|
|
53
|
+
// dataProfile.value?.phone != dataProfile.value?.tenant_phone &&
|
|
54
|
+
// dataProfile.value?.tenant_phone
|
|
55
|
+
// ) {
|
|
56
|
+
// updateProfile({ phone: dataProfile.value?.tenant_phone })
|
|
57
|
+
// }
|
|
58
|
+
return res;
|
|
59
|
+
};
|
|
60
|
+
export const submitTenantPhone = async (body) => {
|
|
61
|
+
const res = await axios.post('/api/v1/message/tenant/update-phone', body);
|
|
62
|
+
dataLoginLink.value = res;
|
|
63
|
+
return res;
|
|
64
|
+
};
|
|
65
|
+
export const updateProfile = async (body) => {
|
|
66
|
+
const res = await axios.post('/api/v1/message/tenant/update', {
|
|
67
|
+
...body,
|
|
68
|
+
id: dataProfile.value?.id
|
|
69
|
+
});
|
|
70
|
+
dataProfile.value = res;
|
|
71
|
+
return res;
|
|
72
|
+
};
|
|
73
|
+
export const getBusinessInfo = async () => {
|
|
74
|
+
const res = await axios_gci.get('/v1/pos/business/site/get-info');
|
|
75
|
+
return res;
|
|
76
|
+
};
|
|
77
|
+
export const logout = async () => {
|
|
78
|
+
dataLogin = { id: '', token: '', domain: '' };
|
|
79
|
+
dataProfile.value = null;
|
|
80
|
+
localStorage.removeItem('chat_accessToken');
|
|
81
|
+
localStorage.removeItem('chat_domain');
|
|
82
|
+
localStorage.removeItem('chat_id');
|
|
83
|
+
try {
|
|
84
|
+
gapMiniAppSdk?.getInstance()?.closeApp?.();
|
|
85
|
+
if (gapMiniAppSdk?.getInstance()?.getBridge()) {
|
|
86
|
+
gapMiniAppSdk?.getInstance()?.closeApp();
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
window.location.href = '/login';
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
catch (error) { }
|
|
93
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IResUser } from '../../../types/message';
|
|
2
|
+
export declare const getIceService: () => Promise<import("axios").AxiosResponse<any, any>>;
|
|
3
|
+
export declare const callClient: (data: {
|
|
4
|
+
call_uuid: string;
|
|
5
|
+
clientId: string;
|
|
6
|
+
}) => Promise<void>;
|
|
7
|
+
export declare const callOutBound: (user: IResUser) => Promise<void>;
|
|
8
|
+
export declare const plivoCall: (user: IResUser) => Promise<any>;
|
|
9
|
+
export declare const plivoEndCall: (uuid: string) => Promise<void>;
|
|
10
|
+
export declare const downloadRecord: (url_pub: string) => Promise<void>;
|
|
11
|
+
export declare const getPlivoAccessToken: () => Promise<any>;
|
|
12
|
+
export declare const createSipAccount: (data: {
|
|
13
|
+
did_number: string;
|
|
14
|
+
sip_username: string;
|
|
15
|
+
}) => Promise<any>;
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import axios from '../../../plugins/axios';
|
|
2
|
+
import { dataProfile } from './auth';
|
|
3
|
+
import { showPageError } from '../page-error';
|
|
4
|
+
const BARE_WEBSOCKET_URL = 'https://web-socket.dev01.dtsmart.dev';
|
|
5
|
+
// const BARE_WEBSOCKET_URL = 'https://web-socket-test.dev01.dtsmart.dev'
|
|
6
|
+
// const BARE_WEBSOCKET_URL = 'http://192.168.1.173:3000'
|
|
7
|
+
export const getIceService = async () => {
|
|
8
|
+
const res = await axios.post('/api/v1/message/call/ice-servers', {
|
|
9
|
+
key_id: '3dc07e93f89e44ef5d5ff98c91edb520',
|
|
10
|
+
api_token: 'c0a60a3d2b0f490b2c99fd7ff095ed1218fd7eda55c80c8b70efc9e0b8dfcd85'
|
|
11
|
+
}, {
|
|
12
|
+
token: '3VbvrMLtH6b0b9vBe0mhJz9G9NKyATiL'
|
|
13
|
+
});
|
|
14
|
+
return res;
|
|
15
|
+
};
|
|
16
|
+
// export const callClient = async (body: IResCall): Promise<any> => {
|
|
17
|
+
// const res = await axios.post('/call/answer', body, {
|
|
18
|
+
// })
|
|
19
|
+
// return res
|
|
20
|
+
// }
|
|
21
|
+
export const callClient = async (data) => {
|
|
22
|
+
const url = BARE_WEBSOCKET_URL + '/ws/answer';
|
|
23
|
+
try {
|
|
24
|
+
const response = await fetch(url, {
|
|
25
|
+
method: 'POST',
|
|
26
|
+
body: JSON.stringify(data),
|
|
27
|
+
headers: {
|
|
28
|
+
['Content-Type']: 'application/json'
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
if (!response.ok) {
|
|
32
|
+
throw new Error(`Response status: ${response.status}`);
|
|
33
|
+
}
|
|
34
|
+
const result = await response.json();
|
|
35
|
+
console.log(result);
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
console.error(error.message);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
export const callOutBound = async (user) => {
|
|
42
|
+
const url = BARE_WEBSOCKET_URL + '/call/outbound';
|
|
43
|
+
try {
|
|
44
|
+
const response = await fetch(url, {
|
|
45
|
+
method: 'POST',
|
|
46
|
+
body: JSON.stringify({
|
|
47
|
+
from: dataProfile.value?.phone,
|
|
48
|
+
to: user?.phone ?? ''
|
|
49
|
+
}),
|
|
50
|
+
headers: {
|
|
51
|
+
['Content-Type']: 'application/json'
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
if (!response.ok) {
|
|
55
|
+
throw new Error(`Response status: ${response.status}`);
|
|
56
|
+
}
|
|
57
|
+
const result = await response.json();
|
|
58
|
+
console.log(result);
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
console.error(error.message);
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
export const plivoCall = async (user) => {
|
|
65
|
+
const url = BARE_WEBSOCKET_URL + '/ws/call';
|
|
66
|
+
const response = await fetch(url, {
|
|
67
|
+
method: 'POST',
|
|
68
|
+
body: JSON.stringify({
|
|
69
|
+
// from: '18668259612' || dataProfile.value?.phone,
|
|
70
|
+
from: '18668259612' || dataProfile.value?.phone,
|
|
71
|
+
to: user?.phone || '',
|
|
72
|
+
// clientId: dataProfile.value?.tenant_id
|
|
73
|
+
}),
|
|
74
|
+
headers: {
|
|
75
|
+
['Content-Type']: 'application/json'
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
if (!response.ok) {
|
|
79
|
+
throw new Error(`Response status: ${response.status}`);
|
|
80
|
+
}
|
|
81
|
+
const result = await response.json();
|
|
82
|
+
return result;
|
|
83
|
+
};
|
|
84
|
+
export const plivoEndCall = async (uuid) => {
|
|
85
|
+
const url = BARE_WEBSOCKET_URL + '/ws/end-call';
|
|
86
|
+
const response = await fetch(url, {
|
|
87
|
+
method: 'POST',
|
|
88
|
+
body: JSON.stringify({
|
|
89
|
+
call_uuid: uuid
|
|
90
|
+
}),
|
|
91
|
+
headers: {
|
|
92
|
+
['Content-Type']: 'application/json'
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
if (!response.ok) {
|
|
96
|
+
throw new Error(`Response status: ${response.status}`);
|
|
97
|
+
}
|
|
98
|
+
const result = await response.json();
|
|
99
|
+
console.log(result);
|
|
100
|
+
};
|
|
101
|
+
export const downloadRecord = async (url_pub) => {
|
|
102
|
+
const url = BARE_WEBSOCKET_URL + '/ws/download-record';
|
|
103
|
+
const response = await fetch(url, {
|
|
104
|
+
method: 'POST',
|
|
105
|
+
body: JSON.stringify({
|
|
106
|
+
url: url_pub
|
|
107
|
+
}),
|
|
108
|
+
headers: {
|
|
109
|
+
['Content-Type']: 'application/json'
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
if (!response.ok) {
|
|
113
|
+
throw new Error(`Response status: ${response.status}`);
|
|
114
|
+
}
|
|
115
|
+
const blob = await response.blob();
|
|
116
|
+
const url_blob = window.URL.createObjectURL(blob);
|
|
117
|
+
const a = document.createElement("a");
|
|
118
|
+
a.href = url_blob;
|
|
119
|
+
a.download = "recording.mp3";
|
|
120
|
+
a.click();
|
|
121
|
+
a.remove();
|
|
122
|
+
};
|
|
123
|
+
export const getPlivoAccessToken = async () => {
|
|
124
|
+
const url = BARE_WEBSOCKET_URL + '/ws/generate-token';
|
|
125
|
+
const response = await fetch(url, {
|
|
126
|
+
method: 'POST',
|
|
127
|
+
body: JSON.stringify({
|
|
128
|
+
// clientId: dataProfile.value?.tenant_id,
|
|
129
|
+
username: dataProfile.value?.id?.toString()
|
|
130
|
+
}),
|
|
131
|
+
headers: {
|
|
132
|
+
['Content-Type']: 'application/json'
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
if (!response.ok) {
|
|
136
|
+
throw new Error(`Response status: ${response.status}`);
|
|
137
|
+
}
|
|
138
|
+
const result = await response.json();
|
|
139
|
+
return result?.accessToken;
|
|
140
|
+
};
|
|
141
|
+
export const createSipAccount = async (data) => {
|
|
142
|
+
try {
|
|
143
|
+
const url = BARE_WEBSOCKET_URL + '/ws/create-sip-account';
|
|
144
|
+
const response = await fetch(url, {
|
|
145
|
+
method: 'POST',
|
|
146
|
+
body: JSON.stringify(data),
|
|
147
|
+
headers: {
|
|
148
|
+
['Content-Type']: 'application/json'
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
if (!response.ok) {
|
|
152
|
+
throw new Error(`Response status: ${response.status}`);
|
|
153
|
+
}
|
|
154
|
+
const result = await response.json();
|
|
155
|
+
return result;
|
|
156
|
+
}
|
|
157
|
+
catch (e) {
|
|
158
|
+
showPageError('We’re having trouble connecting the call. Please try again in a moment');
|
|
159
|
+
}
|
|
160
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { IConversation, IParamGetConversation } from '../../../types/conversation';
|
|
2
|
+
import type { DataWithMetaResponse } from '../../../types/global';
|
|
3
|
+
import type { IResUser } from '../../../types/message';
|
|
4
|
+
export declare const getConversation: (param: IParamGetConversation) => Promise<DataWithMetaResponse<IConversation[]>>;
|
|
5
|
+
export declare const getConversationView: (id: any) => Promise<IConversation>;
|
|
6
|
+
export declare const createConversation: (phone: string) => Promise<IConversation>;
|
|
7
|
+
export declare const publicTopicConversationUpdate: (data: {
|
|
8
|
+
infoUser: IResUser | null;
|
|
9
|
+
isSendImg?: boolean;
|
|
10
|
+
message?: string;
|
|
11
|
+
isCall?: string;
|
|
12
|
+
is_known: number;
|
|
13
|
+
conversation_id: number;
|
|
14
|
+
}) => Promise<void>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import axios from '../../../plugins/axios';
|
|
2
|
+
import { getCountUnread } from './message';
|
|
3
|
+
import dayjs from 'dayjs';
|
|
4
|
+
import { DATE_FORMATS, TIME_ZONE_UTC } from '../../../constant/datetime';
|
|
5
|
+
import { dataProfile } from './auth';
|
|
6
|
+
import { publishMessage } from '../../../plugins/mqtt';
|
|
7
|
+
import { TOPIC_HOME } from '../../../constant/mqtt';
|
|
8
|
+
export const getConversation = async (param) => {
|
|
9
|
+
const res = await axios.get('/api/v1/message/conversation/get-conversation', {
|
|
10
|
+
params: param
|
|
11
|
+
});
|
|
12
|
+
return res;
|
|
13
|
+
};
|
|
14
|
+
export const getConversationView = async (id) => {
|
|
15
|
+
let res = await axios.get('/api/v1/message/conversation/view', {
|
|
16
|
+
params: { id }
|
|
17
|
+
});
|
|
18
|
+
res.receiver_id = res.customer_id ?? 0;
|
|
19
|
+
return res;
|
|
20
|
+
};
|
|
21
|
+
export const createConversation = async (phone) => {
|
|
22
|
+
let res = await axios.post('/api/v1/message/conversation/create', { phone });
|
|
23
|
+
return res.conversation;
|
|
24
|
+
};
|
|
25
|
+
export const publicTopicConversationUpdate = async (data) => {
|
|
26
|
+
const res = await getCountUnread({
|
|
27
|
+
conversation_id: data.infoUser?.id ?? 0,
|
|
28
|
+
receiver_id: Number(data.infoUser?.id)
|
|
29
|
+
});
|
|
30
|
+
let last_message = data.message ?? '';
|
|
31
|
+
if (data.isSendImg)
|
|
32
|
+
last_message = `Photo`;
|
|
33
|
+
else if (data.isCall != undefined) {
|
|
34
|
+
if (data.isCall == 'call') {
|
|
35
|
+
last_message = `Call ended` || 'Call canceled' || 'Call missed';
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const current = dayjs().tz(TIME_ZONE_UTC).format(DATE_FORMATS['DATE_FORMAT_FULL']);
|
|
39
|
+
const dataMessageForReceiver = {
|
|
40
|
+
id: data.conversation_id ?? 0,
|
|
41
|
+
// receiver_id: Number(data.infoUser?.id ?? 0),
|
|
42
|
+
receiver_id: Number(dataProfile.value?.id ?? 0),
|
|
43
|
+
username: '',
|
|
44
|
+
phone: dataProfile.value?.phone ?? '',
|
|
45
|
+
avatar: dataProfile.value?.avatar ?? '',
|
|
46
|
+
last_message,
|
|
47
|
+
last_message_time: current,
|
|
48
|
+
created_at: current,
|
|
49
|
+
updated_at: current,
|
|
50
|
+
unread_count: (res?.unread_count ?? 0),
|
|
51
|
+
status: 1,
|
|
52
|
+
color: dataProfile.value?.color ?? '',
|
|
53
|
+
is_call: '',
|
|
54
|
+
is_known: data.is_known,
|
|
55
|
+
};
|
|
56
|
+
publishMessage(`${TOPIC_HOME[0] + Number(data.infoUser?.id)}`, JSON.stringify(dataMessageForReceiver));
|
|
57
|
+
const dataMessageMyself = {
|
|
58
|
+
id: data.conversation_id ?? 0,
|
|
59
|
+
receiver_id: Number(data.infoUser?.id ?? 0),
|
|
60
|
+
username: data.infoUser?.username ?? '',
|
|
61
|
+
phone: data.infoUser?.phone ?? '',
|
|
62
|
+
avatar: data.infoUser?.avatar ?? '',
|
|
63
|
+
last_message,
|
|
64
|
+
last_message_time: current,
|
|
65
|
+
created_at: current,
|
|
66
|
+
updated_at: current,
|
|
67
|
+
unread_count: 0,
|
|
68
|
+
status: 1,
|
|
69
|
+
color: data.infoUser?.color,
|
|
70
|
+
is_known: data.is_known,
|
|
71
|
+
};
|
|
72
|
+
publishMessage(`${TOPIC_HOME[0] + Number(dataProfile.value?.id)}`, JSON.stringify(dataMessageMyself));
|
|
73
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { DataWithMetaResponse } from '../../../types/global';
|
|
2
|
+
import type { IResMessage, IResUser, IUploadFile } from '../../../types/message';
|
|
3
|
+
interface IParamsMessage {
|
|
4
|
+
page: number;
|
|
5
|
+
receiver_id: string;
|
|
6
|
+
}
|
|
7
|
+
export declare const getMessage: (params: IParamsMessage) => Promise<DataWithMetaResponse<IResMessage[]>>;
|
|
8
|
+
export declare const getDetailReceiver: (receiverId: string) => Promise<IResUser>;
|
|
9
|
+
export declare const getDetailUser: (id: any) => Promise<IResUser | null>;
|
|
10
|
+
export declare const readMessages: (conversationId: any) => Promise<import("axios").AxiosResponse<any, any> | undefined>;
|
|
11
|
+
export declare const sendMessage: (body: FormData) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
12
|
+
export declare const sendMessageSmsTest: (body: {
|
|
13
|
+
from: string;
|
|
14
|
+
to: string;
|
|
15
|
+
host_id: string;
|
|
16
|
+
text: string;
|
|
17
|
+
}) => Promise<import("axios").AxiosResponse<any, any> | undefined>;
|
|
18
|
+
export declare const getCountUnread: (params: {
|
|
19
|
+
conversation_id: number;
|
|
20
|
+
receiver_id: number;
|
|
21
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
22
|
+
export declare const upLoadImage: (body: FormData) => Promise<IUploadFile[]>;
|
|
23
|
+
export declare const activePlivoMode: (body: {
|
|
24
|
+
id: any;
|
|
25
|
+
is_sms: number;
|
|
26
|
+
}) => Promise<any>;
|
|
27
|
+
export {};
|