@phonghq/go-chat 1.0.4 → 1.0.6
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/IconArrowLeft.vue.d.ts +2 -0
- package/dist/assets/icons/IconPhone.vue.d.ts +2 -0
- package/dist/assets/icons/IconPlan.vue.d.ts +2 -0
- package/dist/assets/icons/IconPlus.vue.d.ts +2 -0
- package/dist/assets/icons/IconSearch.vue.d.ts +32 -0
- package/dist/assets/icons/call/IconMic.vue.d.ts +14 -0
- package/dist/assets/icons/call/IconPhone.vue.d.ts +2 -0
- package/dist/assets/icons/call/IconPhoneCancel.vue.d.ts +2 -0
- package/dist/assets/icons/call/IconSpeaker.vue.d.ts +14 -0
- package/dist/assets/icons/customer-appointment/IconFilter.vue.d.ts +2 -0
- package/dist/assets/icons/customer-detail/IconArrow.vue.d.ts +2 -0
- package/dist/assets/icons/customer-detail/IconCheck.vue.d.ts +2 -0
- package/dist/assets/icons/customer-detail/IconDate.vue.d.ts +2 -0
- package/dist/assets/icons/customer-detail/IconGroup.vue.d.ts +2 -0
- package/dist/assets/icons/customer-detail/IconMessage.vue.d.ts +2 -0
- package/dist/assets/icons/customer-detail/IconNote.vue.d.ts +2 -0
- package/dist/assets/icons/customer-detail/IconPhone.vue.d.ts +2 -0
- package/dist/assets/icons/customer-detail/IconPin.vue.d.ts +2 -0
- package/dist/assets/icons/customer-detail/IconSearch.vue.d.ts +2 -0
- package/dist/chat/App.vue.d.ts +5 -0
- package/dist/chat/main.d.ts +6 -0
- package/dist/chat/page/customer-appointment/CustomerAppointment.vue.d.ts +2 -0
- package/dist/chat/page/customer-check-in/CollapseCheckIn.vue.d.ts +12 -0
- package/dist/chat/page/customer-check-in/CustomerCheckIn.vue.d.ts +2 -0
- package/dist/chat/page/customer-detail/CustomerDetail.vue.d.ts +7 -0
- package/dist/chat/page/customer-detail/SubInformation.vue.d.ts +16 -0
- package/dist/chat/page/error/Error.vue.d.ts +2 -0
- package/dist/chat/page/home/ChatList.vue.d.ts +20 -0
- package/dist/chat/page/home/ChatMessage.vue.d.ts +17 -0
- package/dist/chat/page/home/Home.vue.d.ts +14 -0
- package/dist/chat/page/home/HomeHeader.vue.d.ts +10 -0
- package/dist/chat/page/home/InputChat.vue.d.ts +19 -0
- package/dist/chat/page/home/NewCustomer.vue.d.ts +6 -0
- package/dist/components/ListenEvent.vue.d.ts +2 -0
- package/dist/components/chat/ScrollEvent/ScrollEvent.vue.d.ts +22 -0
- package/dist/components/chat/call/Calling.vue.d.ts +7 -0
- package/dist/components/chat/card/CardCustomerDetail.vue.d.ts +13 -0
- package/dist/components/chat/common/collapse/CollapseBase.vue.d.ts +20 -0
- package/dist/components/chat/common/input/InputSearch.vue.d.ts +16 -0
- package/dist/components/chat/common/popover/PopoverBase.vue.d.ts +35 -0
- package/dist/components/chat/common/spin/BaseSpin.vue.d.ts +2 -0
- package/dist/components/chat/customer/Avatar.vue.d.ts +12 -0
- package/dist/components/chat/layout/mobile/Footer.vue.d.ts +2 -0
- package/dist/components/common/CustomLoading.vue.d.ts +2 -0
- package/dist/components/common/Notification/NotificationDescription.vue.d.ts +7 -0
- package/dist/components/common/button/ButtonBase.vue.d.ts +22 -0
- package/dist/components/common/button/ButtonToggle.vue.d.ts +20 -0
- package/dist/components/common/checkbox/CCheckboxNumber.vue.d.ts +16 -0
- package/dist/components/common/collapse/BaseCollapse.vue.d.ts +12 -0
- package/dist/components/common/collapse/BaseCollapseItem.vue.d.ts +4 -0
- package/dist/components/common/drawer/DrawerBase.vue.d.ts +39 -0
- package/dist/components/common/dropdown/DropdownBase.vue.d.ts +21 -0
- package/dist/components/common/input/CInputSearch.vue.d.ts +14 -0
- package/dist/components/common/modal/ModalBase.vue.d.ts +35 -0
- package/dist/components/common/popover/PopoverBase.vue.d.ts +3 -0
- package/dist/components/common/slider/BaseSlider.vue.d.ts +11 -0
- package/dist/components/common/spin/CSpin.vue.d.ts +9 -0
- package/dist/components/common/tooltip/TooltipBase.vue.d.ts +2 -0
- package/dist/components/layout/Blank.vue.d.ts +9 -0
- package/dist/components/layout/Default.vue.d.ts +9 -0
- package/dist/components/modal/Confirm.vue.d.ts +2 -0
- package/dist/components/ui/button/CButton.vue.d.ts +19 -0
- package/dist/components/ui/button/c-button.d.ts +7 -0
- package/dist/components/ui/checkbox/Checkbox.vue.d.ts +18 -0
- package/dist/components/ui/checkbox/index.d.ts +1 -0
- package/dist/components/ui/collapsible/Collapsible.vue.d.ts +16 -0
- package/dist/components/ui/collapsible/CollapsibleContent.vue.d.ts +10 -0
- package/dist/components/ui/collapsible/CollapsibleTrigger.vue.d.ts +10 -0
- package/dist/components/ui/collapsible/index.d.ts +3 -0
- package/dist/components/ui/dialog/Dialog.vue.d.ts +14 -0
- package/dist/components/ui/dialog/DialogClose.vue.d.ts +10 -0
- package/dist/components/ui/dialog/DialogContent.vue.d.ts +29 -0
- package/dist/components/ui/dialog/DialogDescription.vue.d.ts +14 -0
- package/dist/components/ui/dialog/DialogFooter.vue.d.ts +13 -0
- package/dist/components/ui/dialog/DialogHeader.vue.d.ts +13 -0
- package/dist/components/ui/dialog/DialogScrollContent.vue.d.ts +30 -0
- package/dist/components/ui/dialog/DialogTitle.vue.d.ts +14 -0
- package/dist/components/ui/dialog/DialogTrigger.vue.d.ts +10 -0
- package/dist/components/ui/dialog/index.d.ts +9 -0
- package/dist/components/ui/drawer/Drawer.vue.d.ts +26 -0
- package/dist/components/ui/drawer/DrawerContent.vue.d.ts +33 -0
- package/dist/components/ui/drawer/DrawerDescription.vue.d.ts +14 -0
- package/dist/components/ui/drawer/DrawerFooter.vue.d.ts +13 -0
- package/dist/components/ui/drawer/DrawerHeader.vue.d.ts +13 -0
- package/dist/components/ui/drawer/DrawerOverlay.vue.d.ts +7 -0
- package/dist/components/ui/drawer/DrawerTitle.vue.d.ts +14 -0
- package/dist/components/ui/drawer/index.d.ts +8 -0
- package/dist/components/ui/dropdown-menu/DropdownMenu.vue.d.ts +14 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuCheckboxItem.vue.d.ts +20 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuContent.vue.d.ts +28 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuGroup.vue.d.ts +10 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuItem.vue.d.ts +15 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuLabel.vue.d.ts +15 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuRadioGroup.vue.d.ts +14 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuRadioItem.vue.d.ts +18 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuSeparator.vue.d.ts +7 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuShortcut.vue.d.ts +13 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuSub.vue.d.ts +14 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuSubContent.vue.d.ts +30 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue.d.ts +14 -0
- package/dist/components/ui/dropdown-menu/DropdownMenuTrigger.vue.d.ts +10 -0
- package/dist/components/ui/dropdown-menu/index.d.ts +15 -0
- package/dist/components/ui/popover/Popover.vue.d.ts +14 -0
- package/dist/components/ui/popover/PopoverContent.vue.d.ts +28 -0
- package/dist/components/ui/popover/PopoverTrigger.vue.d.ts +10 -0
- package/dist/components/ui/popover/index.d.ts +3 -0
- package/dist/components/ui/radio-group/RadioGroup.vue.d.ts +18 -0
- package/dist/components/ui/radio-group/RadioGroupItem.vue.d.ts +7 -0
- package/dist/components/ui/radio-group/index.d.ts +2 -0
- package/dist/components/ui/slider/Slider.vue.d.ts +13 -0
- package/dist/components/ui/slider/index.d.ts +1 -0
- package/dist/components/ui/switch/Switch.vue.d.ts +18 -0
- package/dist/components/ui/switch/index.d.ts +1 -0
- package/dist/composable/useCallHelper.d.ts +23 -0
- package/dist/composable/useDigibot.d.ts +7 -0
- package/dist/composable/useInitData.d.ts +11 -0
- package/dist/composable/useModalConfirm.d.ts +5 -0
- package/dist/constant/color.d.ts +22 -0
- package/dist/constant/datetime.d.ts +5 -0
- package/dist/constant/general.d.ts +8 -0
- package/dist/constant/message.d.ts +8 -0
- package/dist/constant/mqtt.d.ts +4 -0
- package/dist/constant/user.d.ts +8 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/plugins/axios-gci.d.ts +3 -0
- package/dist/plugins/axios.d.ts +3 -0
- package/dist/plugins/mqtt.d.ts +10 -0
- package/dist/plugins/sdk.d.ts +19 -0
- package/dist/plugins/websocket.d.ts +4 -0
- package/dist/style.css +1 -1
- package/dist/test/assets/icons/IconArrowLeft.vue.js +29 -0
- package/dist/test/assets/icons/IconPhone.vue.js +19 -0
- package/dist/test/assets/icons/IconPlan.vue.js +19 -0
- package/dist/test/assets/icons/IconPlus.vue.js +22 -0
- package/dist/test/assets/icons/IconSearch.vue.js +68 -0
- package/dist/test/assets/icons/call/IconMic.vue.js +123 -0
- package/dist/test/assets/icons/call/IconPhone.vue.js +35 -0
- package/dist/test/assets/icons/call/IconPhoneCancel.vue.js +35 -0
- package/dist/test/assets/icons/call/IconSpeaker.vue.js +62 -0
- package/dist/test/assets/icons/customer-appointment/IconFilter.vue.js +53 -0
- package/dist/test/assets/icons/customer-detail/IconArrow.vue.js +22 -0
- package/dist/test/assets/icons/customer-detail/IconCheck.vue.js +27 -0
- package/dist/test/assets/icons/customer-detail/IconDate.vue.js +43 -0
- package/dist/test/assets/icons/customer-detail/IconGroup.vue.js +48 -0
- package/dist/test/assets/icons/customer-detail/IconMessage.vue.js +28 -0
- package/dist/test/assets/icons/customer-detail/IconNote.vue.js +29 -0
- package/dist/test/assets/icons/customer-detail/IconPhone.vue.js +21 -0
- package/dist/test/assets/icons/customer-detail/IconPin.vue.js +29 -0
- package/dist/test/assets/icons/customer-detail/IconSearch.vue.js +29 -0
- package/dist/test/chat/App.vue.js +502 -0
- package/dist/test/chat/main.js +6 -0
- package/dist/test/chat/page/customer-appointment/CustomerAppointment.vue.js +207 -0
- package/dist/test/chat/page/customer-check-in/CollapseCheckIn.vue.js +80 -0
- package/dist/test/chat/page/customer-check-in/CustomerCheckIn.vue.js +136 -0
- package/dist/test/chat/page/customer-detail/CustomerDetail.vue.js +235 -0
- package/dist/test/chat/page/customer-detail/SubInformation.vue.js +102 -0
- package/dist/test/chat/page/error/Error.vue.js +64 -0
- package/dist/test/chat/page/home/ChatList.vue.js +387 -0
- package/dist/test/chat/page/home/ChatMessage.vue.js +295 -0
- package/dist/test/chat/page/home/Home.vue.js +332 -0
- package/dist/test/chat/page/home/HomeHeader.vue.js +127 -0
- package/dist/test/chat/page/home/InputChat.vue.js +255 -0
- package/dist/test/chat/page/home/NewCustomer.vue.js +84 -0
- package/dist/test/components/ListenEvent.vue.js +45 -0
- package/dist/test/components/chat/ScrollEvent/ScrollEvent.vue.js +197 -0
- package/dist/test/components/chat/call/Calling.vue.js +291 -0
- package/dist/test/components/chat/card/CardCustomerDetail.vue.js +28 -0
- package/dist/test/components/chat/common/collapse/CollapseBase.vue.js +59 -0
- package/dist/test/components/chat/common/input/InputSearch.vue.js +71 -0
- package/dist/test/components/chat/common/popover/PopoverBase.vue.js +148 -0
- package/dist/test/components/chat/common/spin/BaseSpin.vue.js +12 -0
- package/dist/test/components/chat/customer/Avatar.vue.js +101 -0
- package/dist/test/components/chat/layout/mobile/Footer.vue.js +109 -0
- package/dist/test/components/common/CustomLoading.vue.js +19 -0
- package/dist/test/components/common/Notification/NotificationDescription.vue.js +38 -0
- package/dist/test/components/common/button/ButtonBase.vue.js +78 -0
- package/dist/test/components/common/button/ButtonToggle.vue.js +70 -0
- package/dist/test/components/common/checkbox/CCheckboxNumber.vue.js +48 -0
- package/dist/test/components/common/collapse/BaseCollapse.vue.js +36 -0
- package/dist/test/components/common/collapse/BaseCollapseItem.vue.js +22 -0
- package/dist/test/components/common/drawer/DrawerBase.vue.js +126 -0
- package/dist/test/components/common/dropdown/DropdownBase.vue.js +91 -0
- package/dist/test/components/common/input/CInputSearch.vue.js +62 -0
- package/dist/test/components/common/modal/ModalBase.vue.js +164 -0
- package/dist/test/components/common/popover/PopoverBase.vue.js +36 -0
- package/dist/test/components/common/slider/BaseSlider.vue.js +70 -0
- package/dist/test/components/common/spin/CSpin.vue.js +41 -0
- package/dist/test/components/common/tooltip/TooltipBase.vue.js +8 -0
- package/dist/test/components/layout/Blank.vue.js +19 -0
- package/dist/test/components/layout/Default.vue.js +21 -0
- package/dist/test/components/modal/Confirm.vue.js +164 -0
- package/dist/test/components/ui/button/CButton.vue.js +49 -0
- package/dist/test/components/ui/button/c-button.js +26 -0
- package/dist/test/components/ui/checkbox/Checkbox.vue.js +79 -0
- package/dist/test/components/ui/checkbox/index.js +1 -0
- package/dist/test/components/ui/collapsible/Collapsible.vue.js +47 -0
- package/dist/test/components/ui/collapsible/CollapsibleContent.vue.js +41 -0
- package/dist/test/components/ui/collapsible/CollapsibleTrigger.vue.js +35 -0
- package/dist/test/components/ui/collapsible/index.js +3 -0
- package/dist/test/components/ui/dialog/Dialog.vue.js +42 -0
- package/dist/test/components/ui/dialog/DialogClose.vue.js +35 -0
- package/dist/test/components/ui/dialog/DialogContent.vue.js +84 -0
- package/dist/test/components/ui/dialog/DialogDescription.vue.js +43 -0
- package/dist/test/components/ui/dialog/DialogFooter.vue.js +26 -0
- package/dist/test/components/ui/dialog/DialogHeader.vue.js +26 -0
- package/dist/test/components/ui/dialog/DialogScrollContent.vue.js +99 -0
- package/dist/test/components/ui/dialog/DialogTitle.vue.js +43 -0
- package/dist/test/components/ui/dialog/DialogTrigger.vue.js +35 -0
- package/dist/test/components/ui/dialog/index.js +9 -0
- package/dist/test/components/ui/drawer/Drawer.vue.js +48 -0
- package/dist/test/components/ui/drawer/DrawerContent.vue.js +81 -0
- package/dist/test/components/ui/drawer/DrawerDescription.vue.js +42 -0
- package/dist/test/components/ui/drawer/DrawerFooter.vue.js +26 -0
- package/dist/test/components/ui/drawer/DrawerHeader.vue.js +26 -0
- package/dist/test/components/ui/drawer/DrawerOverlay.vue.js +37 -0
- package/dist/test/components/ui/drawer/DrawerTitle.vue.js +42 -0
- package/dist/test/components/ui/drawer/index.js +8 -0
- package/dist/test/components/ui/dropdown-menu/DropdownMenu.vue.js +41 -0
- package/dist/test/components/ui/dropdown-menu/DropdownMenuCheckboxItem.vue.js +79 -0
- package/dist/test/components/ui/dropdown-menu/DropdownMenuContent.vue.js +61 -0
- package/dist/test/components/ui/dropdown-menu/DropdownMenuGroup.vue.js +35 -0
- package/dist/test/components/ui/dropdown-menu/DropdownMenuItem.vue.js +43 -0
- package/dist/test/components/ui/dropdown-menu/DropdownMenuLabel.vue.js +43 -0
- package/dist/test/components/ui/dropdown-menu/DropdownMenuRadioGroup.vue.js +41 -0
- package/dist/test/components/ui/dropdown-menu/DropdownMenuRadioItem.vue.js +80 -0
- package/dist/test/components/ui/dropdown-menu/DropdownMenuSeparator.vue.js +37 -0
- package/dist/test/components/ui/dropdown-menu/DropdownMenuShortcut.vue.js +26 -0
- package/dist/test/components/ui/dropdown-menu/DropdownMenuSub.vue.js +41 -0
- package/dist/test/components/ui/dropdown-menu/DropdownMenuSubContent.vue.js +46 -0
- package/dist/test/components/ui/dropdown-menu/DropdownMenuSubTrigger.vue.js +58 -0
- package/dist/test/components/ui/dropdown-menu/DropdownMenuTrigger.vue.js +41 -0
- package/dist/test/components/ui/dropdown-menu/index.js +15 -0
- package/dist/test/components/ui/popover/Popover.vue.js +41 -0
- package/dist/test/components/ui/popover/PopoverContent.vue.js +60 -0
- package/dist/test/components/ui/popover/PopoverTrigger.vue.js +35 -0
- package/dist/test/components/ui/popover/index.js +3 -0
- package/dist/test/components/ui/radio-group/RadioGroup.vue.js +46 -0
- package/dist/test/components/ui/radio-group/RadioGroupItem.vue.js +71 -0
- package/dist/test/components/ui/radio-group/index.js +2 -0
- package/dist/test/components/ui/slider/Slider.vue.js +155 -0
- package/dist/test/components/ui/slider/index.js +1 -0
- package/dist/test/components/ui/switch/Switch.vue.js +61 -0
- package/dist/test/components/ui/switch/index.js +1 -0
- package/dist/test/composable/useCallHelper.js +170 -0
- package/dist/test/composable/useDigibot.js +22 -0
- package/dist/test/composable/useInitData.js +84 -0
- package/dist/test/composable/useModalConfirm.js +39 -0
- package/dist/test/constant/color.js +43 -0
- package/dist/test/constant/datetime.js +5 -0
- package/dist/test/constant/general.js +9 -0
- package/dist/test/constant/message.js +8 -0
- package/dist/test/constant/mqtt.js +11 -0
- package/dist/test/constant/user.js +9 -0
- package/dist/test/lib/utils.js +5 -0
- package/dist/test/plugins/axios-gci.js +25 -0
- package/dist/test/plugins/axios.js +85 -0
- package/dist/test/plugins/mqtt.js +128 -0
- package/dist/test/plugins/sdk.js +83 -0
- package/dist/test/plugins/websocket.js +65 -0
- package/dist/test/types/call.js +1 -0
- package/dist/test/types/chat/auth.js +1 -0
- package/dist/test/types/chat/global.js +1 -0
- package/dist/test/types/chat/promise.js +1 -0
- package/dist/test/types/chat/user.js +1 -0
- package/dist/test/types/conversation.js +1 -0
- package/dist/test/types/global.js +15 -0
- package/dist/test/types/message.js +1 -0
- package/dist/test/utils/chat/auth.js +51 -0
- package/dist/test/utils/chat/call.js +61 -0
- package/dist/test/utils/chat/chat-router.js +8 -0
- package/dist/test/utils/chat/conversation.js +7 -0
- package/dist/test/utils/chat/message.js +42 -0
- package/dist/test/utils/chat/user.js +33 -0
- package/dist/test/utils/debounce.js +9 -0
- package/dist/test/utils/json.js +18 -0
- package/dist/test/utils/logger.js +5 -0
- package/dist/test/utils/string-helper.js +27 -0
- package/dist/types/call.d.ts +4 -0
- package/dist/types/chat/auth.d.ts +37 -0
- package/dist/types/chat/global.d.ts +7 -0
- package/dist/types/chat/promise.d.ts +17 -0
- package/dist/types/chat/user.d.ts +88 -0
- package/dist/types/conversation.d.ts +18 -0
- package/dist/types/global.d.ts +11 -0
- package/dist/types/message.d.ts +43 -0
- package/dist/utils/chat/auth.d.ts +45 -0
- package/dist/utils/chat/call.d.ts +5 -0
- package/dist/utils/chat/chat-router.d.ts +3 -0
- package/dist/utils/chat/conversation.d.ts +3 -0
- package/dist/utils/chat/message.d.ts +17 -0
- package/dist/utils/chat/user.d.ts +193 -0
- package/dist/utils/debounce.d.ts +1 -0
- package/dist/utils/json.d.ts +2 -0
- package/dist/utils/logger.d.ts +3 -0
- package/dist/utils/string-helper.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import axios from '../../plugins/axios';
|
|
2
|
+
import { gapMiniAppSdk } from '../../plugins/sdk';
|
|
3
|
+
import { ref } from 'vue';
|
|
4
|
+
export const dataProfile = ref(null);
|
|
5
|
+
export const dataLoginLink = ref(null);
|
|
6
|
+
let dataLogin = {
|
|
7
|
+
id: '',
|
|
8
|
+
token: '',
|
|
9
|
+
domain: ''
|
|
10
|
+
};
|
|
11
|
+
export const setDataLogin = (id, token, domain) => {
|
|
12
|
+
dataLogin = { id, token, domain };
|
|
13
|
+
};
|
|
14
|
+
export const loginTenant = async (body) => {
|
|
15
|
+
const res = await axios.post('/api/v1/message/tenant/login', body);
|
|
16
|
+
localStorage.setItem('chat_token', res?.token);
|
|
17
|
+
localStorage.setItem('refresh_token', res?.refresh_token);
|
|
18
|
+
dataLogin.id = body.tenant_id;
|
|
19
|
+
dataLogin.token = res?.token;
|
|
20
|
+
dataProfile.value = res;
|
|
21
|
+
return res;
|
|
22
|
+
};
|
|
23
|
+
export const loginLink = async (params) => {
|
|
24
|
+
const res = await axios.get('/api/v1/message/tenant/gci-link', { params: params });
|
|
25
|
+
localStorage.setItem('chat_token', res?.token);
|
|
26
|
+
localStorage.setItem('refresh_token', res?.refresh_token);
|
|
27
|
+
dataLogin.id = params.tenant_id;
|
|
28
|
+
dataLogin.token = res?.token;
|
|
29
|
+
dataLoginLink.value = res;
|
|
30
|
+
return res;
|
|
31
|
+
};
|
|
32
|
+
export const getProfile = async () => {
|
|
33
|
+
const res = await axios.get('/api/v1/message/user/me');
|
|
34
|
+
localStorage.setItem('chat_user', JSON.stringify(res?.data));
|
|
35
|
+
dataProfile.value = res;
|
|
36
|
+
return res;
|
|
37
|
+
};
|
|
38
|
+
export const logout = async () => {
|
|
39
|
+
dataLogin = { id: '', token: '', domain: '' };
|
|
40
|
+
dataProfile.value = null;
|
|
41
|
+
localStorage.removeItem('chat_accessToken');
|
|
42
|
+
localStorage.removeItem('chat_domain');
|
|
43
|
+
localStorage.removeItem('chat_id');
|
|
44
|
+
window.location.href = '/login';
|
|
45
|
+
try {
|
|
46
|
+
if (gapMiniAppSdk?.getInstance()?.getBridge()) {
|
|
47
|
+
gapMiniAppSdk?.getInstance()?.closeApp();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
catch (error) { }
|
|
51
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import axios from '../../plugins/axios';
|
|
2
|
+
import { dataProfile } from '../../utils/chat/auth';
|
|
3
|
+
const BARE_WEBSOCKET_URL = 'https://web-socket.dev01.dtsmart.dev';
|
|
4
|
+
// const BARE_WEBSOCKET_URL = 'http://192.168.1.173:3000'
|
|
5
|
+
export const getIceService = async () => {
|
|
6
|
+
const res = await axios.post('/api/v1/message/call/ice-servers', {
|
|
7
|
+
key_id: '3dc07e93f89e44ef5d5ff98c91edb520',
|
|
8
|
+
api_token: 'c0a60a3d2b0f490b2c99fd7ff095ed1218fd7eda55c80c8b70efc9e0b8dfcd85'
|
|
9
|
+
}, {
|
|
10
|
+
token: '3VbvrMLtH6b0b9vBe0mhJz9G9NKyATiL'
|
|
11
|
+
});
|
|
12
|
+
return res;
|
|
13
|
+
};
|
|
14
|
+
// export const callClient = async (body: IResCall): Promise<any> => {
|
|
15
|
+
// const res = await axios.post('/call/answer', body, {
|
|
16
|
+
// })
|
|
17
|
+
// return res
|
|
18
|
+
// }
|
|
19
|
+
export const callClient = async (body) => {
|
|
20
|
+
const url = BARE_WEBSOCKET_URL + '/call/answer';
|
|
21
|
+
try {
|
|
22
|
+
const response = await fetch(url, {
|
|
23
|
+
method: 'POST',
|
|
24
|
+
body: JSON.stringify(body),
|
|
25
|
+
headers: {
|
|
26
|
+
['Content-Type']: 'application/json'
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
if (!response.ok) {
|
|
30
|
+
throw new Error(`Response status: ${response.status}`);
|
|
31
|
+
}
|
|
32
|
+
const result = await response.json();
|
|
33
|
+
console.log(result);
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
console.error(error.message);
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
export const callOutBound = async (user) => {
|
|
40
|
+
const url = BARE_WEBSOCKET_URL + '/call/outbound';
|
|
41
|
+
try {
|
|
42
|
+
const response = await fetch(url, {
|
|
43
|
+
method: 'POST',
|
|
44
|
+
body: JSON.stringify({
|
|
45
|
+
from: dataProfile.value?.phone,
|
|
46
|
+
to: user?.phone ?? ''
|
|
47
|
+
}),
|
|
48
|
+
headers: {
|
|
49
|
+
['Content-Type']: 'application/json'
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
if (!response.ok) {
|
|
53
|
+
throw new Error(`Response status: ${response.status}`);
|
|
54
|
+
}
|
|
55
|
+
const result = await response.json();
|
|
56
|
+
console.log(result);
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
console.error(error.message);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ref } from 'vue';
|
|
2
|
+
import { PAGE } from '../../constant/general';
|
|
3
|
+
export const currentPage = ref(PAGE.HOME);
|
|
4
|
+
let beforeEach = null;
|
|
5
|
+
export const routerPush = (page) => {
|
|
6
|
+
const to_page = beforeEach?.(page) ?? null;
|
|
7
|
+
currentPage.value = to_page ?? page;
|
|
8
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import axios from '../../plugins/axios';
|
|
2
|
+
export const getMessage = async (params) => {
|
|
3
|
+
const res = await axios.get('/api/v1/message/message/get-message', {
|
|
4
|
+
params
|
|
5
|
+
});
|
|
6
|
+
return res;
|
|
7
|
+
};
|
|
8
|
+
export const getDetailReceiver = async (receiverId) => {
|
|
9
|
+
const res = await axios.get(`/api/v1/message/message/get-user?receiver_id=${receiverId}`);
|
|
10
|
+
return res;
|
|
11
|
+
};
|
|
12
|
+
export const getDetailUser = async (id) => {
|
|
13
|
+
if (!id)
|
|
14
|
+
return null;
|
|
15
|
+
const res = await axios.get(`/api/v1/message/message/user-detail?id=${id}`);
|
|
16
|
+
return res;
|
|
17
|
+
};
|
|
18
|
+
export const readMessages = async (conversationId) => {
|
|
19
|
+
if (!conversationId)
|
|
20
|
+
return;
|
|
21
|
+
return axios.post(`/api/v1/message/message/mark-as-read?conversation_id=${conversationId}`);
|
|
22
|
+
};
|
|
23
|
+
export const sendMessage = async (body) => {
|
|
24
|
+
const res = await axios.post('/api/v1/message/message/send-message', body, {
|
|
25
|
+
headers: {
|
|
26
|
+
'Content-Type': 'multipart/form-data'
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return res;
|
|
30
|
+
};
|
|
31
|
+
export const getCountUnread = async (params) => {
|
|
32
|
+
const res = await axios.get('/api/v1/message/message/unread-count', { params });
|
|
33
|
+
return res;
|
|
34
|
+
};
|
|
35
|
+
export const upLoadImage = async (body) => {
|
|
36
|
+
const res = await axios.post('/api/v1/general/storage/upload', body, {
|
|
37
|
+
headers: {
|
|
38
|
+
'Content-Type': 'multipart/form-data'
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
return res;
|
|
42
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ref } from 'vue';
|
|
2
|
+
import axios from '../../plugins/axios-gci';
|
|
3
|
+
import dayjs from 'dayjs';
|
|
4
|
+
export const user = ref(null);
|
|
5
|
+
export const userHistory = ref(null);
|
|
6
|
+
export const getUserHistory = async (phone) => {
|
|
7
|
+
const res = await axios.get(`/v1/pos/customer/site/history?phone=${phone}`);
|
|
8
|
+
return res;
|
|
9
|
+
};
|
|
10
|
+
export function getItemsByYear(data, key = 'created_at') {
|
|
11
|
+
let result = [];
|
|
12
|
+
if (data?.length) {
|
|
13
|
+
let curYear = dayjs(data[0][key]).format("YYYY");
|
|
14
|
+
let items = [];
|
|
15
|
+
for (let i = 0; i < data.length; i++) {
|
|
16
|
+
items.push(data[i]);
|
|
17
|
+
let nextItemYear = data[i + 1] ? dayjs(data[i + 1][key]).format("YYYY") : curYear;
|
|
18
|
+
if (nextItemYear != curYear) {
|
|
19
|
+
result.push({
|
|
20
|
+
year: curYear,
|
|
21
|
+
items: [...items]
|
|
22
|
+
});
|
|
23
|
+
curYear = nextItemYear;
|
|
24
|
+
items = [];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
result.push({
|
|
28
|
+
year: curYear,
|
|
29
|
+
items: [...items]
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export const isJsonString = (str) => {
|
|
2
|
+
try {
|
|
3
|
+
JSON.parse(str);
|
|
4
|
+
}
|
|
5
|
+
catch (e) {
|
|
6
|
+
return false;
|
|
7
|
+
}
|
|
8
|
+
return true;
|
|
9
|
+
};
|
|
10
|
+
export const tryParseJson = (data) => {
|
|
11
|
+
try {
|
|
12
|
+
const result = JSON.parse(data);
|
|
13
|
+
return result;
|
|
14
|
+
}
|
|
15
|
+
catch (e) {
|
|
16
|
+
return data;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export const phoneNumberFormat = (phone, halfShowType = 1) => {
|
|
2
|
+
let number = (("" + phone) || '').replace(/[^\d*]/g, "");
|
|
3
|
+
if (number.length > 10) {
|
|
4
|
+
number = number.substring(number.length - 10);
|
|
5
|
+
}
|
|
6
|
+
if (number.length == 10) {
|
|
7
|
+
if (true) {
|
|
8
|
+
if (halfShowType == 4) {
|
|
9
|
+
number = (number || '').replace(/(\d{3})(\d{3})(\d{4})/, "*** $3");
|
|
10
|
+
}
|
|
11
|
+
if (halfShowType == 3) {
|
|
12
|
+
number = (number || '').replace(/(\d{3})(\d{3})(\d{4})/, "($3)");
|
|
13
|
+
}
|
|
14
|
+
if (halfShowType == 2) {
|
|
15
|
+
number = (number || '').replace(/(\d{3})(\d{3})(\d{4})/, "***-***-$3");
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
number = (number || '').replace(/(\d{3})(\d{3})(\d{4})/, "(***) ***-$3");
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
number = (number || '').replace(/(\d{3})(\d{3})(\d{4})/, "($1) $2-$3");
|
|
23
|
+
}
|
|
24
|
+
return number;
|
|
25
|
+
}
|
|
26
|
+
return "";
|
|
27
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
interface IBodyLoginTenant {
|
|
2
|
+
tenant_id: string;
|
|
3
|
+
}
|
|
4
|
+
interface IResLoginLink {
|
|
5
|
+
token: string;
|
|
6
|
+
refresh_token: string;
|
|
7
|
+
conversation_id: number;
|
|
8
|
+
receiver_id: number;
|
|
9
|
+
}
|
|
10
|
+
interface IBodyLoginCustomer {
|
|
11
|
+
phone: string;
|
|
12
|
+
}
|
|
13
|
+
interface IBodyVerifyOTP {
|
|
14
|
+
session_uuid: string;
|
|
15
|
+
phone: string;
|
|
16
|
+
otp: string;
|
|
17
|
+
}
|
|
18
|
+
interface IResProfile {
|
|
19
|
+
id: number;
|
|
20
|
+
username: string;
|
|
21
|
+
tenant_id: string | null;
|
|
22
|
+
phone: string;
|
|
23
|
+
avatar: string | null;
|
|
24
|
+
user_type: 'customer' | 'tenant';
|
|
25
|
+
color: string;
|
|
26
|
+
}
|
|
27
|
+
interface IPramsLoginLink {
|
|
28
|
+
tenant_id: string;
|
|
29
|
+
phone: string;
|
|
30
|
+
message: string;
|
|
31
|
+
customer_name: string;
|
|
32
|
+
business_name: string;
|
|
33
|
+
}
|
|
34
|
+
interface IRefreshToken {
|
|
35
|
+
refresh_token: string;
|
|
36
|
+
}
|
|
37
|
+
export type { IBodyLoginTenant, IBodyLoginCustomer, IBodyVerifyOTP, IResProfile, IPramsLoginLink, IRefreshToken, IResLoginLink };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export type ConfirmPayload = {
|
|
2
|
+
headerTitle?: string;
|
|
3
|
+
bodyTitle?: string;
|
|
4
|
+
bodyImage?: string;
|
|
5
|
+
bodyMessage?: string;
|
|
6
|
+
confirmButtonText?: string;
|
|
7
|
+
cancelButtonText?: string;
|
|
8
|
+
timeOut?: number;
|
|
9
|
+
type?: 'confirm' | 'information';
|
|
10
|
+
};
|
|
11
|
+
export type ConfirmPayloadPromise = AddPromise<ConfirmPayload>;
|
|
12
|
+
export type AddPromise<T = unknown> = T & {
|
|
13
|
+
resolve: Resolve;
|
|
14
|
+
reject?: Reject;
|
|
15
|
+
};
|
|
16
|
+
export type Resolve = any;
|
|
17
|
+
export type Reject = any;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
export type GetCustomerHistoryResponse = {
|
|
2
|
+
checkin: Checkin[];
|
|
3
|
+
order: Order[];
|
|
4
|
+
appointment: Appointment[];
|
|
5
|
+
cashback: Cashback[];
|
|
6
|
+
full_name: string;
|
|
7
|
+
lifetime_point: number;
|
|
8
|
+
total_appointment: number;
|
|
9
|
+
total_money: number;
|
|
10
|
+
visit_count: number;
|
|
11
|
+
};
|
|
12
|
+
export type Checkin = {
|
|
13
|
+
id: number;
|
|
14
|
+
created_at: string;
|
|
15
|
+
status: string;
|
|
16
|
+
point_bonus: number;
|
|
17
|
+
};
|
|
18
|
+
type Order = {
|
|
19
|
+
id: number;
|
|
20
|
+
created_at: string;
|
|
21
|
+
tip: any;
|
|
22
|
+
customer_id: number;
|
|
23
|
+
customer_name: string;
|
|
24
|
+
customer_phone: string;
|
|
25
|
+
customer_email: any;
|
|
26
|
+
customer_address: any;
|
|
27
|
+
payment_method: any;
|
|
28
|
+
currency: any;
|
|
29
|
+
start_time: any;
|
|
30
|
+
expected_end_time: any;
|
|
31
|
+
end_time: any;
|
|
32
|
+
picked_up_time: any;
|
|
33
|
+
promotion_code: any;
|
|
34
|
+
total_before_discount: number;
|
|
35
|
+
total_after_discount: number;
|
|
36
|
+
employee_id: any;
|
|
37
|
+
employee_name: any;
|
|
38
|
+
type: string;
|
|
39
|
+
note: any;
|
|
40
|
+
owner_note: any;
|
|
41
|
+
order_status: number;
|
|
42
|
+
status: number;
|
|
43
|
+
updated_at: string;
|
|
44
|
+
cancel_reason: any;
|
|
45
|
+
delivered_time: any;
|
|
46
|
+
completed_time: any;
|
|
47
|
+
order_code: string;
|
|
48
|
+
checkin_id: any;
|
|
49
|
+
total_change: number;
|
|
50
|
+
tax: number;
|
|
51
|
+
is_waiting: number;
|
|
52
|
+
is_recheck: number;
|
|
53
|
+
gift_card_price: number;
|
|
54
|
+
pax_standalone_active: any;
|
|
55
|
+
ach_payment_active: any;
|
|
56
|
+
ach_payment_data: any;
|
|
57
|
+
total_cash_discount: number;
|
|
58
|
+
is_tip_on_device: number;
|
|
59
|
+
tip_by_credit_card: number;
|
|
60
|
+
service_fee: number;
|
|
61
|
+
external_credit_card: number;
|
|
62
|
+
qr_code: string;
|
|
63
|
+
in_service: number;
|
|
64
|
+
attachment: any;
|
|
65
|
+
};
|
|
66
|
+
export type Appointment = {
|
|
67
|
+
id: number;
|
|
68
|
+
created_at: string;
|
|
69
|
+
services: any;
|
|
70
|
+
status: string;
|
|
71
|
+
start_time: string;
|
|
72
|
+
end_time_expected: string;
|
|
73
|
+
note: string;
|
|
74
|
+
extra_data: string;
|
|
75
|
+
};
|
|
76
|
+
type Cashback = {
|
|
77
|
+
id: number;
|
|
78
|
+
customer_id: number;
|
|
79
|
+
type: string;
|
|
80
|
+
old_cashback: number;
|
|
81
|
+
change: number;
|
|
82
|
+
new_cashback: number;
|
|
83
|
+
description: string;
|
|
84
|
+
data: any;
|
|
85
|
+
created_at: string;
|
|
86
|
+
updated_at: string;
|
|
87
|
+
};
|
|
88
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type IConversation = {
|
|
2
|
+
id: number;
|
|
3
|
+
receiver_id: number;
|
|
4
|
+
username: string | null;
|
|
5
|
+
customer_phone: string;
|
|
6
|
+
avatar: string | null;
|
|
7
|
+
last_message: string;
|
|
8
|
+
last_message_time: string;
|
|
9
|
+
created_at: string;
|
|
10
|
+
updated_at: string;
|
|
11
|
+
unread_count: number;
|
|
12
|
+
status: number;
|
|
13
|
+
color: string;
|
|
14
|
+
};
|
|
15
|
+
export type IParamGetConversation = {
|
|
16
|
+
page?: number;
|
|
17
|
+
search?: string;
|
|
18
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { MessageState } from '../constant/message';
|
|
2
|
+
export type IResUser = {
|
|
3
|
+
id: string;
|
|
4
|
+
username: string;
|
|
5
|
+
phone: string;
|
|
6
|
+
avatar: string | null;
|
|
7
|
+
tenant_id: string | null;
|
|
8
|
+
conversation_id: number;
|
|
9
|
+
color: string;
|
|
10
|
+
status: number;
|
|
11
|
+
last_offline_at: string;
|
|
12
|
+
};
|
|
13
|
+
export type IResMessage = {
|
|
14
|
+
id: number | string;
|
|
15
|
+
conversation_id: number;
|
|
16
|
+
sender_id: number;
|
|
17
|
+
receiver_id: number;
|
|
18
|
+
message: string | null;
|
|
19
|
+
created_at: string;
|
|
20
|
+
attachments: IAttachment[];
|
|
21
|
+
state?: MessageStateType;
|
|
22
|
+
error?: string;
|
|
23
|
+
};
|
|
24
|
+
export interface IAttachment {
|
|
25
|
+
file_name: string;
|
|
26
|
+
file_path: string;
|
|
27
|
+
file_local?: Blob;
|
|
28
|
+
mime?: string;
|
|
29
|
+
size?: number;
|
|
30
|
+
}
|
|
31
|
+
export type IResUploadImage = {
|
|
32
|
+
files: IUploadFile[];
|
|
33
|
+
};
|
|
34
|
+
export type IUploadFile = {
|
|
35
|
+
name: string;
|
|
36
|
+
type: string;
|
|
37
|
+
size: number;
|
|
38
|
+
base_url: string;
|
|
39
|
+
path: string;
|
|
40
|
+
url: string;
|
|
41
|
+
delete_url: string;
|
|
42
|
+
};
|
|
43
|
+
export type MessageStateType = typeof MessageState[keyof typeof MessageState];
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
avatar: string | null;
|
|
18
|
+
user_type: "customer" | "tenant";
|
|
19
|
+
color: string;
|
|
20
|
+
} | null, IResProfile | {
|
|
21
|
+
id: number;
|
|
22
|
+
username: string;
|
|
23
|
+
tenant_id: string | null;
|
|
24
|
+
phone: string;
|
|
25
|
+
avatar: string | null;
|
|
26
|
+
user_type: "customer" | "tenant";
|
|
27
|
+
color: string;
|
|
28
|
+
} | null>;
|
|
29
|
+
export declare const dataLoginLink: import("vue").Ref<{
|
|
30
|
+
token: string;
|
|
31
|
+
refresh_token: string;
|
|
32
|
+
conversation_id: number;
|
|
33
|
+
receiver_id: number;
|
|
34
|
+
} | null, IResLoginLink | {
|
|
35
|
+
token: string;
|
|
36
|
+
refresh_token: string;
|
|
37
|
+
conversation_id: number;
|
|
38
|
+
receiver_id: number;
|
|
39
|
+
} | null>;
|
|
40
|
+
export declare const setDataLogin: (id: string, token: string, domain: string) => void;
|
|
41
|
+
export declare const loginTenant: (body: IBodyLoginTenant) => Promise<any>;
|
|
42
|
+
export declare const loginLink: (params: IPramsLoginLink) => Promise<any>;
|
|
43
|
+
export declare const getProfile: () => Promise<any>;
|
|
44
|
+
export declare const logout: () => Promise<void>;
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IResUser } from '../../types/message';
|
|
2
|
+
import type { IResCall } from '../../types/call';
|
|
3
|
+
export declare const getIceService: () => Promise<import("axios").AxiosResponse<any, any>>;
|
|
4
|
+
export declare const callClient: (body: IResCall) => Promise<void>;
|
|
5
|
+
export declare const callOutBound: (user: IResUser) => Promise<void>;
|
|
@@ -0,0 +1,17 @@
|
|
|
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 getCountUnread: (params: {
|
|
13
|
+
conversation_id: number;
|
|
14
|
+
receiver_id: number;
|
|
15
|
+
}) => Promise<import("axios").AxiosResponse<any, any>>;
|
|
16
|
+
export declare const upLoadImage: (body: FormData) => Promise<IUploadFile[]>;
|
|
17
|
+
export {};
|