@phonghq/go-chat 1.0.43 → 1.0.44
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/IconPlan.vue.d.ts +13 -1
- package/dist/assets/icons/call/IconPhoneCancel.vue.d.ts +13 -1
- package/dist/assets/icons/customer-detail/IconPhone.vue.d.ts +13 -1
- package/dist/chat/App.vue.d.ts +13 -2
- package/dist/chat/page/home/ChatList.vue.d.ts +2 -0
- package/dist/chat/page/home/ChatMessageItem.vue.d.ts +1 -0
- package/dist/chat/page/home/ChatMessageItem2.vue.d.ts +19 -0
- package/dist/chat/page/home/Home.vue.d.ts +2 -0
- package/dist/chat/page/home/InputChat.vue.d.ts +2 -0
- package/dist/components/chat/call/Calling.vue.d.ts +4 -2
- package/dist/components/chat/common/tabs/TabBase.vue.d.ts +18 -0
- package/dist/components/common/drawer/DrawerBaseCustom.vue.d.ts +1 -1
- package/dist/components/ui/select/Select.vue.d.ts +20 -0
- package/dist/components/ui/select/SelectContent.vue.d.ts +24 -0
- package/dist/components/ui/select/SelectGroup.vue.d.ts +10 -0
- package/dist/components/ui/select/SelectItem.vue.d.ts +18 -0
- package/dist/components/ui/select/SelectItemText.vue.d.ts +10 -0
- package/dist/components/ui/select/SelectLabel.vue.d.ts +14 -0
- package/dist/components/ui/select/SelectScrollDownButton.vue.d.ts +14 -0
- package/dist/components/ui/select/SelectScrollUpButton.vue.d.ts +14 -0
- package/dist/components/ui/select/SelectSeparator.vue.d.ts +7 -0
- package/dist/components/ui/select/SelectTrigger.vue.d.ts +17 -0
- package/dist/components/ui/select/SelectValue.vue.d.ts +10 -0
- package/dist/components/ui/select/index.d.ts +11 -0
- package/dist/components/ui/tabs/Tabs.vue.d.ts +20 -0
- package/dist/components/ui/tabs/TabsContent.vue.d.ts +14 -0
- package/dist/components/ui/tabs/TabsList.vue.d.ts +14 -0
- package/dist/components/ui/tabs/TabsTrigger.vue.d.ts +14 -0
- package/dist/components/ui/tabs/index.d.ts +4 -0
- package/dist/composable/useInitData.d.ts +1 -1
- package/dist/composable/useListConversations.d.ts +1 -1
- package/dist/composable/useListentEvent.d.ts +5 -0
- package/dist/composable/usePlivo.d.ts +1 -0
- package/dist/constant/color.d.ts +2 -2
- package/dist/go-chat.es.js +14752 -14211
- package/dist/go-chat.umd.js +15 -15
- package/dist/style.css +1 -1
- package/dist/test/assets/icons/IconPlan.vue.js +23 -3
- package/dist/test/assets/icons/call/IconPhone.vue.js +6 -19
- package/dist/test/assets/icons/call/IconPhoneCancel.vue.js +32 -21
- package/dist/test/assets/icons/customer-detail/IconPhone.vue.js +23 -3
- package/dist/test/chat/App.vue.js +222 -299
- package/dist/test/chat/page/customer-check-in/CustomerCheckIn.vue.js +3 -1
- package/dist/test/chat/page/customer-detail/CustomerDetail.vue.js +2 -2
- package/dist/test/chat/page/home/ChatList.vue.js +64 -34
- package/dist/test/chat/page/home/ChatMessage.vue.js +10 -1
- package/dist/test/chat/page/home/ChatMessageItem.vue.js +63 -80
- package/dist/test/chat/page/home/ChatMessageItem2.vue.js +351 -0
- package/dist/test/chat/page/home/Home.vue.js +15 -7
- package/dist/test/chat/page/home/HomeHeader.vue.js +8 -4
- package/dist/test/chat/page/home/InputChat.vue.js +58 -37
- package/dist/test/components/chat/call/Calling.vue.js +111 -67
- package/dist/test/components/chat/common/tab/TabBase.vue.js +1 -0
- package/dist/test/components/chat/common/tabs/TabBase.vue.js +92 -0
- package/dist/test/components/chat/layout/mobile/Footer.vue.js +6 -1
- package/dist/test/components/common/drawer/DrawerBaseCustom.vue.js +1 -0
- package/dist/test/components/common/select/SelectBase.vue.js +139 -0
- package/dist/test/components/ui/select/Select.vue.js +49 -0
- package/dist/test/components/ui/select/SelectContent.vue.js +98 -0
- package/dist/test/components/ui/select/SelectGroup.vue.js +37 -0
- package/dist/test/components/ui/select/SelectItem.vue.js +86 -0
- package/dist/test/components/ui/select/SelectItemText.vue.js +37 -0
- package/dist/test/components/ui/select/SelectLabel.vue.js +40 -0
- package/dist/test/components/ui/select/SelectScrollDownButton.vue.js +58 -0
- package/dist/test/components/ui/select/SelectScrollUpButton.vue.js +58 -0
- package/dist/test/components/ui/select/SelectSeparator.vue.js +39 -0
- package/dist/test/components/ui/select/SelectTrigger.vue.js +76 -0
- package/dist/test/components/ui/select/SelectValue.vue.js +37 -0
- package/dist/test/components/ui/select/index.js +11 -0
- package/dist/test/components/ui/tabs/Tabs.vue.js +54 -0
- package/dist/test/components/ui/tabs/TabsContent.vue.js +44 -0
- package/dist/test/components/ui/tabs/TabsList.vue.js +44 -0
- package/dist/test/components/ui/tabs/TabsTrigger.vue.js +45 -0
- package/dist/test/components/ui/tabs/index.js +4 -0
- package/dist/test/composable/useInitData.js +5 -5
- package/dist/test/composable/useListConversations.js +32 -29
- package/dist/test/composable/useListentEvent.js +45 -0
- package/dist/test/composable/usePlivo.js +6 -1
- package/dist/test/constant/color.js +4 -2
- package/dist/test/plugins/axios-gci.js +1 -1
- package/dist/test/utils/chat/auth.js +1 -1
- package/dist/test/utils/chat/call.js +2 -3
- package/dist/test/utils/chat/conversation.js +2 -2
- package/dist/test/utils/chat/page-error.js +25 -0
- package/dist/test/utils/chat/user.js +7 -2
- package/dist/test/utils/string-helper.js +13 -0
- package/dist/types/chat/global.d.ts +6 -5
- package/dist/types/conversation.d.ts +1 -0
- package/dist/utils/chat/auth.d.ts +1 -1
- package/dist/utils/chat/conversation.d.ts +1 -0
- package/dist/utils/chat/page-error.d.ts +4 -0
- package/dist/utils/chat/user.d.ts +3 -0
- package/dist/utils/string-helper.d.ts +1 -0
- package/package.json +3 -2
- package/dist/components/layout/Blank.vue.d.ts +0 -9
- package/dist/components/layout/Default.vue.d.ts +0 -9
- package/dist/components/modal/Confirm.vue.d.ts +0 -2
- package/dist/composable/useError.d.ts +0 -4
- package/dist/composable/useModalConfirm.d.ts +0 -5
- package/dist/test/components/ListenEvent.vue.js +0 -45
- package/dist/test/components/layout/Blank.vue.js +0 -19
- package/dist/test/components/layout/Default.vue.js +0 -21
- package/dist/test/components/modal/Confirm.vue.js +0 -164
- package/dist/test/composable/useError.js +0 -10
- package/dist/test/composable/useModalConfirm.js +0 -39
- /package/dist/components/{ListenEvent.vue.d.ts → common/select/SelectBase.vue.d.ts} +0 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/// <reference types="C:/phonghq/go-chat-v2/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
|
|
2
|
+
import { reactiveOmit } from "@vueuse/core";
|
|
3
|
+
import { TabsRoot, 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 = {}.TabsRoot;
|
|
21
|
+
/** @type {[typeof __VLS_components.TabsRoot, typeof __VLS_components.TabsRoot, ]} */ ;
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
TabsRoot;
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
const __VLS_1 = __VLS_asFunctionalComponent(__VLS_0, new __VLS_0({
|
|
26
|
+
dataSlot: "tabs",
|
|
27
|
+
...(__VLS_ctx.forwarded),
|
|
28
|
+
...{ class: (__VLS_ctx.cn('flex flex-col gap-2', props.class)) },
|
|
29
|
+
}));
|
|
30
|
+
const __VLS_2 = __VLS_1({
|
|
31
|
+
dataSlot: "tabs",
|
|
32
|
+
...(__VLS_ctx.forwarded),
|
|
33
|
+
...{ class: (__VLS_ctx.cn('flex flex-col gap-2', props.class)) },
|
|
34
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_1));
|
|
35
|
+
var __VLS_4 = {};
|
|
36
|
+
{
|
|
37
|
+
const { default: __VLS_5 } = __VLS_3.slots;
|
|
38
|
+
const [slotProps] = __VLS_getSlotParameters(__VLS_5);
|
|
39
|
+
// @ts-ignore
|
|
40
|
+
[forwarded, cn,];
|
|
41
|
+
var __VLS_6 = {
|
|
42
|
+
...(slotProps),
|
|
43
|
+
};
|
|
44
|
+
__VLS_3.slots['' /* empty slot name completion */];
|
|
45
|
+
}
|
|
46
|
+
var __VLS_3;
|
|
47
|
+
// @ts-ignore
|
|
48
|
+
var __VLS_7 = __VLS_6;
|
|
49
|
+
const __VLS_base = (await import('vue')).defineComponent({
|
|
50
|
+
__typeEmits: {},
|
|
51
|
+
__typeProps: {},
|
|
52
|
+
});
|
|
53
|
+
const __VLS_export = {};
|
|
54
|
+
export default {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/// <reference types="C:/phonghq/go-chat-v2/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
|
|
2
|
+
import { reactiveOmit } from "@vueuse/core";
|
|
3
|
+
import { TabsContent } from "reka-ui";
|
|
4
|
+
import { cn } from "../../../lib/utils";
|
|
5
|
+
const props = defineProps();
|
|
6
|
+
const delegatedProps = reactiveOmit(props, "class");
|
|
7
|
+
debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
|
|
8
|
+
const __VLS_ctx = {
|
|
9
|
+
...{},
|
|
10
|
+
...{},
|
|
11
|
+
...{},
|
|
12
|
+
...{},
|
|
13
|
+
};
|
|
14
|
+
let __VLS_elements;
|
|
15
|
+
let __VLS_components;
|
|
16
|
+
let __VLS_directives;
|
|
17
|
+
const __VLS_0 = {}.TabsContent;
|
|
18
|
+
/** @type {[typeof __VLS_components.TabsContent, typeof __VLS_components.TabsContent, ]} */ ;
|
|
19
|
+
// @ts-ignore
|
|
20
|
+
TabsContent;
|
|
21
|
+
// @ts-ignore
|
|
22
|
+
const __VLS_1 = __VLS_asFunctionalComponent(__VLS_0, new __VLS_0({
|
|
23
|
+
dataSlot: "tabs-content",
|
|
24
|
+
...{ class: (__VLS_ctx.cn('flex-1 outline-none', props.class)) },
|
|
25
|
+
...(__VLS_ctx.delegatedProps),
|
|
26
|
+
}));
|
|
27
|
+
const __VLS_2 = __VLS_1({
|
|
28
|
+
dataSlot: "tabs-content",
|
|
29
|
+
...{ class: (__VLS_ctx.cn('flex-1 outline-none', props.class)) },
|
|
30
|
+
...(__VLS_ctx.delegatedProps),
|
|
31
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_1));
|
|
32
|
+
var __VLS_4 = {};
|
|
33
|
+
const { default: __VLS_5 } = __VLS_3.slots;
|
|
34
|
+
// @ts-ignore
|
|
35
|
+
[cn, delegatedProps,];
|
|
36
|
+
var __VLS_6 = {};
|
|
37
|
+
var __VLS_3;
|
|
38
|
+
// @ts-ignore
|
|
39
|
+
var __VLS_7 = __VLS_6;
|
|
40
|
+
const __VLS_base = (await import('vue')).defineComponent({
|
|
41
|
+
__typeProps: {},
|
|
42
|
+
});
|
|
43
|
+
const __VLS_export = {};
|
|
44
|
+
export default {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/// <reference types="C:/phonghq/go-chat-v2/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
|
|
2
|
+
import { reactiveOmit } from "@vueuse/core";
|
|
3
|
+
import { TabsList } from "reka-ui";
|
|
4
|
+
import { cn } from "../../../lib/utils";
|
|
5
|
+
const props = defineProps();
|
|
6
|
+
const delegatedProps = reactiveOmit(props, "class");
|
|
7
|
+
debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
|
|
8
|
+
const __VLS_ctx = {
|
|
9
|
+
...{},
|
|
10
|
+
...{},
|
|
11
|
+
...{},
|
|
12
|
+
...{},
|
|
13
|
+
};
|
|
14
|
+
let __VLS_elements;
|
|
15
|
+
let __VLS_components;
|
|
16
|
+
let __VLS_directives;
|
|
17
|
+
const __VLS_0 = {}.TabsList;
|
|
18
|
+
/** @type {[typeof __VLS_components.TabsList, typeof __VLS_components.TabsList, ]} */ ;
|
|
19
|
+
// @ts-ignore
|
|
20
|
+
TabsList;
|
|
21
|
+
// @ts-ignore
|
|
22
|
+
const __VLS_1 = __VLS_asFunctionalComponent(__VLS_0, new __VLS_0({
|
|
23
|
+
dataSlot: "tabs-list",
|
|
24
|
+
...(__VLS_ctx.delegatedProps),
|
|
25
|
+
...{ class: (__VLS_ctx.cn('bg-chat-haze-200 inline-flex w-fit items-center justify-center rounded-xl p-[3px]', props.class)) },
|
|
26
|
+
}));
|
|
27
|
+
const __VLS_2 = __VLS_1({
|
|
28
|
+
dataSlot: "tabs-list",
|
|
29
|
+
...(__VLS_ctx.delegatedProps),
|
|
30
|
+
...{ class: (__VLS_ctx.cn('bg-chat-haze-200 inline-flex w-fit items-center justify-center rounded-xl p-[3px]', props.class)) },
|
|
31
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_1));
|
|
32
|
+
var __VLS_4 = {};
|
|
33
|
+
const { default: __VLS_5 } = __VLS_3.slots;
|
|
34
|
+
// @ts-ignore
|
|
35
|
+
[delegatedProps, cn,];
|
|
36
|
+
var __VLS_6 = {};
|
|
37
|
+
var __VLS_3;
|
|
38
|
+
// @ts-ignore
|
|
39
|
+
var __VLS_7 = __VLS_6;
|
|
40
|
+
const __VLS_base = (await import('vue')).defineComponent({
|
|
41
|
+
__typeProps: {},
|
|
42
|
+
});
|
|
43
|
+
const __VLS_export = {};
|
|
44
|
+
export default {};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/// <reference types="C:/phonghq/go-chat-v2/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
|
|
2
|
+
import { reactiveOmit } from "@vueuse/core";
|
|
3
|
+
import { TabsTrigger, useForwardProps } from "reka-ui";
|
|
4
|
+
import { cn } from "../../../lib/utils";
|
|
5
|
+
const props = defineProps();
|
|
6
|
+
const delegatedProps = reactiveOmit(props, "class");
|
|
7
|
+
const forwardedProps = useForwardProps(delegatedProps);
|
|
8
|
+
debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
|
|
9
|
+
const __VLS_ctx = {
|
|
10
|
+
...{},
|
|
11
|
+
...{},
|
|
12
|
+
...{},
|
|
13
|
+
...{},
|
|
14
|
+
};
|
|
15
|
+
let __VLS_elements;
|
|
16
|
+
let __VLS_components;
|
|
17
|
+
let __VLS_directives;
|
|
18
|
+
const __VLS_0 = {}.TabsTrigger;
|
|
19
|
+
/** @type {[typeof __VLS_components.TabsTrigger, typeof __VLS_components.TabsTrigger, ]} */ ;
|
|
20
|
+
// @ts-ignore
|
|
21
|
+
TabsTrigger;
|
|
22
|
+
// @ts-ignore
|
|
23
|
+
const __VLS_1 = __VLS_asFunctionalComponent(__VLS_0, new __VLS_0({
|
|
24
|
+
dataSlot: "tabs-trigger",
|
|
25
|
+
...{ class: (__VLS_ctx.cn('data-[state=active]:bg-white focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground inline-flex flex-1 items-center justify-center gap-1.5 rounded-xl px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow,background-color] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=\'size-\'])]:size-4', props.class)) },
|
|
26
|
+
...(__VLS_ctx.forwardedProps),
|
|
27
|
+
}));
|
|
28
|
+
const __VLS_2 = __VLS_1({
|
|
29
|
+
dataSlot: "tabs-trigger",
|
|
30
|
+
...{ class: (__VLS_ctx.cn('data-[state=active]:bg-white focus-visible:ring-ring/50 focus-visible:outline-ring text-foreground inline-flex flex-1 items-center justify-center gap-1.5 rounded-xl px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow,background-color] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*=\'size-\'])]:size-4', props.class)) },
|
|
31
|
+
...(__VLS_ctx.forwardedProps),
|
|
32
|
+
}, ...__VLS_functionalComponentArgsRest(__VLS_1));
|
|
33
|
+
var __VLS_4 = {};
|
|
34
|
+
const { default: __VLS_5 } = __VLS_3.slots;
|
|
35
|
+
// @ts-ignore
|
|
36
|
+
[cn, forwardedProps,];
|
|
37
|
+
var __VLS_6 = {};
|
|
38
|
+
var __VLS_3;
|
|
39
|
+
// @ts-ignore
|
|
40
|
+
var __VLS_7 = __VLS_6;
|
|
41
|
+
const __VLS_base = (await import('vue')).defineComponent({
|
|
42
|
+
__typeProps: {},
|
|
43
|
+
});
|
|
44
|
+
const __VLS_export = {};
|
|
45
|
+
export default {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ref } from 'vue';
|
|
2
2
|
import { sdkInit } from '../plugins/sdk';
|
|
3
|
-
import {
|
|
3
|
+
import { checkTenantPhoneOnGapInsight, dataProfile, getProfile, loginLink } from '../utils/chat/auth';
|
|
4
4
|
import { routerPush } from '../utils/chat/chat-router';
|
|
5
5
|
import { PAGE } from '../constant/general';
|
|
6
6
|
import { connectMqtt, subscribeToTopic, unsubscribeFromTopic } from '../plugins/mqtt';
|
|
@@ -21,7 +21,7 @@ export function useInitData() {
|
|
|
21
21
|
// return
|
|
22
22
|
// }
|
|
23
23
|
}
|
|
24
|
-
await initData(data.props, data.
|
|
24
|
+
await initData(data.props, data.responsive);
|
|
25
25
|
await connectMqtt();
|
|
26
26
|
const res = checkNotificationParams();
|
|
27
27
|
isRouterReady.value = true;
|
|
@@ -33,14 +33,14 @@ export function useInitData() {
|
|
|
33
33
|
return {};
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
|
-
const initData = async (props,
|
|
36
|
+
const initData = async (props, responsive) => {
|
|
37
37
|
await getProfile();
|
|
38
38
|
if (dataProfile.value?.user_type == 'tenant') {
|
|
39
|
-
await
|
|
39
|
+
await checkTenantPhoneOnGapInsight();
|
|
40
40
|
}
|
|
41
41
|
unsubscribeFromTopic(TOPIC_DETAIL_CALL + dataProfile.value?.id);
|
|
42
42
|
subscribeToTopic(TOPIC_DETAIL_CALL + dataProfile.value?.id);
|
|
43
|
-
if (
|
|
43
|
+
if (responsive == 'mobile') {
|
|
44
44
|
routerPush(PAGE.CHAT_LIST);
|
|
45
45
|
}
|
|
46
46
|
else {
|
|
@@ -8,7 +8,7 @@ import { readMessages } from '../utils/chat/message';
|
|
|
8
8
|
import { useDigibot } from '../composable/useDigibot';
|
|
9
9
|
import { getCache, setCache } from '../utils/chat/cache';
|
|
10
10
|
const { digibotData, digibotId } = useDigibot();
|
|
11
|
-
export const useListConversations = (is_unknown) => {
|
|
11
|
+
export const useListConversations = (is_unknown, is_tenant) => {
|
|
12
12
|
const STORAGE_KEY = 'chat-conversation-';
|
|
13
13
|
let pageCount = 0;
|
|
14
14
|
const listConversations = ref([]);
|
|
@@ -51,36 +51,36 @@ export const useListConversations = (is_unknown) => {
|
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
53
|
const mqttMessageHandler = (topic, data) => {
|
|
54
|
-
if ((data.is_unknown ?? 0)
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
54
|
+
if ((data.is_unknown ?? 0) == is_unknown || (!is_tenant && is_unknown == 0)) {
|
|
55
|
+
getDataMqtt();
|
|
56
|
+
if (topic === TOPIC_HOME[0] + dataProfile.value?.id ||
|
|
57
|
+
topic === TOPIC_HOME[3] + dataProfile.value?.id) {
|
|
58
|
+
const index = listConversations.value.findIndex((item) => item.id === data.id);
|
|
59
|
+
const hasChatBox = listConversations.value.findIndex((item) => item.id === digibotId);
|
|
60
|
+
if (index != -1) {
|
|
61
|
+
listConversations.value.splice(index, 1);
|
|
62
|
+
}
|
|
63
|
+
if (hasChatBox > -1) {
|
|
64
|
+
listConversations.value.splice(1, 0, data);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
listConversations.value.unshift(data);
|
|
68
|
+
}
|
|
63
69
|
}
|
|
64
|
-
if (
|
|
65
|
-
listConversations.value.
|
|
70
|
+
if (topic === TOPIC_HOME[1] + dataProfile.value?.id) {
|
|
71
|
+
const index = listConversations.value.findIndex((item) => item.id === data.id);
|
|
72
|
+
if (index != -1) {
|
|
73
|
+
listConversations.value[index].unread_count = 0;
|
|
74
|
+
}
|
|
66
75
|
}
|
|
67
|
-
|
|
68
|
-
listConversations.value.unshift(data);
|
|
76
|
+
if (topic === TOPIC_HOME[2] + dataProfile.value?.id) {
|
|
77
|
+
listConversations.value.unshift(data?.conversations);
|
|
69
78
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
if (topic === TOPIC_HOME[2] + dataProfile.value?.id) {
|
|
78
|
-
listConversations.value.unshift(data?.conversations);
|
|
79
|
-
}
|
|
80
|
-
if (topic === TOPIC_STATUS_USER + dataProfile.value?.id) {
|
|
81
|
-
const index = listConversations.value.findIndex((e) => e.receiver_id == Number(data?.customer_id));
|
|
82
|
-
if (index != -1) {
|
|
83
|
-
listConversations.value[index].status = data.is_online ? 1 : 0;
|
|
79
|
+
if (topic === TOPIC_STATUS_USER + dataProfile.value?.id) {
|
|
80
|
+
const index = listConversations.value.findIndex((e) => e.receiver_id == Number(data?.customer_id));
|
|
81
|
+
if (index != -1) {
|
|
82
|
+
listConversations.value[index].status = data.is_online ? 1 : 0;
|
|
83
|
+
}
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
};
|
|
@@ -89,11 +89,14 @@ export const useListConversations = (is_unknown) => {
|
|
|
89
89
|
}, 5000);
|
|
90
90
|
const getData = async (data, option) => {
|
|
91
91
|
try {
|
|
92
|
+
if (!is_tenant && is_unknown == 1)
|
|
93
|
+
return;
|
|
92
94
|
params.value = { ...params.value, ...(data ?? {}) };
|
|
95
|
+
const is_unknown_value = is_tenant ? is_unknown : undefined;
|
|
93
96
|
if (option?.reset) {
|
|
94
97
|
params.value.page = 1;
|
|
95
98
|
}
|
|
96
|
-
const res = await getConversation({ ...params.value, is_unknown });
|
|
99
|
+
const res = await getConversation({ ...params.value, is_unknown: is_unknown_value });
|
|
97
100
|
if (option?.reset) {
|
|
98
101
|
listConversations.value = [];
|
|
99
102
|
if (is_unknown == 0 && dataProfile.value?.user_type == 'tenant')
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { onMounted, onUnmounted, ref } from 'vue';
|
|
2
|
+
import { currentPage } from '../utils/chat/chat-router';
|
|
3
|
+
import { PAGE } from '../constant/general';
|
|
4
|
+
import { useDebounce } from '../utils/debounce';
|
|
5
|
+
// import router from '../router'
|
|
6
|
+
//PINIA
|
|
7
|
+
export const responsiveObserver = ref('tablet');
|
|
8
|
+
export function useListenEvent() {
|
|
9
|
+
onMounted(() => {
|
|
10
|
+
window.addEventListener('resize', getResponsiveObserverDebounce);
|
|
11
|
+
});
|
|
12
|
+
onUnmounted(() => {
|
|
13
|
+
window.removeEventListener('resize', getResponsiveObserverDebounce);
|
|
14
|
+
});
|
|
15
|
+
const getResponsiveObserver = () => {
|
|
16
|
+
const appChatRef = document.getElementById('appChatMain');
|
|
17
|
+
if (!appChatRef)
|
|
18
|
+
return;
|
|
19
|
+
const width = appChatRef?.offsetWidth ?? 0;
|
|
20
|
+
if (width >= 1180) {
|
|
21
|
+
if (responsiveObserver.value != 'window') {
|
|
22
|
+
responsiveObserver.value = 'window';
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
else if (width >= 640) {
|
|
26
|
+
if (responsiveObserver.value != 'tablet') {
|
|
27
|
+
responsiveObserver.value = 'tablet';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
if (responsiveObserver.value != 'mobile') {
|
|
32
|
+
if (currentPage.value == PAGE.HOME) {
|
|
33
|
+
currentPage.value = PAGE.CHAT_LIST;
|
|
34
|
+
}
|
|
35
|
+
responsiveObserver.value = 'mobile';
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
const getResponsiveObserverDebounce = useDebounce(() => {
|
|
40
|
+
getResponsiveObserver();
|
|
41
|
+
}, 50);
|
|
42
|
+
return {
|
|
43
|
+
getResponsiveObserver
|
|
44
|
+
};
|
|
45
|
+
}
|
|
@@ -157,12 +157,17 @@ export function usePlivo(callback) {
|
|
|
157
157
|
callback(PLIVO_CALL_STATUS.MEDIA_PERMISSION_FAIL);
|
|
158
158
|
}
|
|
159
159
|
};
|
|
160
|
+
const plivoCallSwishSpeaker = (id) => {
|
|
161
|
+
alert(id);
|
|
162
|
+
plivoBrowserSdk?.client?.audio?.set?.(id);
|
|
163
|
+
};
|
|
160
164
|
return {
|
|
161
165
|
plivoLogin,
|
|
162
166
|
plivoCallAnswer,
|
|
163
167
|
plivoCallReject,
|
|
164
168
|
plivoCall,
|
|
165
169
|
plivoEndCall,
|
|
166
|
-
plivoCallSwishMute
|
|
170
|
+
plivoCallSwishMute,
|
|
171
|
+
plivoCallSwishSpeaker,
|
|
167
172
|
};
|
|
168
173
|
}
|
|
@@ -9,10 +9,12 @@ var Color;
|
|
|
9
9
|
Color["Primary_Hover"] = "#699FF5";
|
|
10
10
|
Color["Primary_RGB"] = "41, 121, 255";
|
|
11
11
|
// Error = '#ff3b3b',
|
|
12
|
-
|
|
12
|
+
// Error = '#EF4444',
|
|
13
|
+
Color["Error"] = "#ef4444";
|
|
13
14
|
Color["Error_Hover"] = "#FF8A75";
|
|
14
15
|
// Success = '#1DA91D',
|
|
15
|
-
|
|
16
|
+
// Success = '#22C55E',
|
|
17
|
+
Color["Success"] = "#4ade80";
|
|
16
18
|
Color["Success_Hover"] = "#5FD9A0";
|
|
17
19
|
Color["Success_Bg"] = "#E9FFE4";
|
|
18
20
|
Color["Warning"] = "#f3a22c";
|
|
@@ -13,7 +13,7 @@ export const setAxiosGciInstance = (token, domain, id) => {
|
|
|
13
13
|
instance.interceptors.response.use((response) => {
|
|
14
14
|
console.log(response);
|
|
15
15
|
const data = response?.data;
|
|
16
|
-
if (data?.status == 'OK' && data?.result?.status == 'OK' && data?.result?.data) {
|
|
16
|
+
if (data?.status == 'OK' && (data?.result?.status == 'OK' || data?.result?.status == 200) && data?.result?.data) {
|
|
17
17
|
return Promise.resolve(data?.result?.data);
|
|
18
18
|
}
|
|
19
19
|
else {
|
|
@@ -38,7 +38,7 @@ export const getProfile = async () => {
|
|
|
38
38
|
// ) as IResProfile
|
|
39
39
|
return res;
|
|
40
40
|
};
|
|
41
|
-
export const
|
|
41
|
+
export const checkTenantPhoneOnGapInsight = async () => {
|
|
42
42
|
const id = localStorage.getItem('chat_id');
|
|
43
43
|
const res = await axios.get(`/api/v1/message/tenant/get-info?tenant_name=${id}`);
|
|
44
44
|
if (res.error || !res?.data)
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import axios from '../../plugins/axios';
|
|
2
2
|
import { dataProfile } from '../../utils/chat/auth';
|
|
3
|
-
import {
|
|
4
|
-
const { showError } = useError();
|
|
3
|
+
import { showPageError } from '../../utils/chat/page-error';
|
|
5
4
|
const BARE_WEBSOCKET_URL = 'https://web-socket.dev01.dtsmart.dev';
|
|
6
5
|
// const BARE_WEBSOCKET_URL = 'https://web-socket-test.dev01.dtsmart.dev'
|
|
7
6
|
// const BARE_WEBSOCKET_URL = 'http://192.168.1.173:3000'
|
|
@@ -156,6 +155,6 @@ export const createSipAccount = async (data) => {
|
|
|
156
155
|
return result;
|
|
157
156
|
}
|
|
158
157
|
catch (e) {
|
|
159
|
-
|
|
158
|
+
showPageError('We’re having trouble connecting the call. Please try again in a moment');
|
|
160
159
|
}
|
|
161
160
|
};
|
|
@@ -49,7 +49,7 @@ export const publicTopicConversationUpdate = async (data) => {
|
|
|
49
49
|
status: 1,
|
|
50
50
|
color: dataProfile.value?.color ?? '',
|
|
51
51
|
is_call: dataProfile.value?.color ?? '',
|
|
52
|
-
is_unknown: data.
|
|
52
|
+
is_unknown: data.is_unknown,
|
|
53
53
|
};
|
|
54
54
|
publishMessage(`${TOPIC_HOME[0] + Number(data.infoUser?.id)}`, JSON.stringify(dataMessageForReceiver));
|
|
55
55
|
const dataMessageMyself = {
|
|
@@ -65,7 +65,7 @@ export const publicTopicConversationUpdate = async (data) => {
|
|
|
65
65
|
unread_count: 0,
|
|
66
66
|
status: 1,
|
|
67
67
|
color: data.infoUser?.color,
|
|
68
|
-
is_unknown: data.
|
|
68
|
+
is_unknown: data.is_unknown,
|
|
69
69
|
};
|
|
70
70
|
publishMessage(`${TOPIC_HOME[0] + Number(dataProfile.value?.id)}`, JSON.stringify(dataMessageMyself));
|
|
71
71
|
};
|
|
@@ -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
|
+
};
|
|
@@ -8,6 +8,11 @@ export const getUserHistory = async (phone) => {
|
|
|
8
8
|
const res = await axios_gci.get(`/v1/pos/customer/site/history?phone=${phone}`);
|
|
9
9
|
return res;
|
|
10
10
|
};
|
|
11
|
+
export const getUserSearch = async (params) => {
|
|
12
|
+
const res = await axios_gci.get('/v1/appointment/customer/list/all', { params });
|
|
13
|
+
console.log(res);
|
|
14
|
+
return res?.items ?? [];
|
|
15
|
+
};
|
|
11
16
|
export const getUserDetailChat = async (params) => {
|
|
12
17
|
const res = await axios.get('/api/v1/message/customer/info', { params });
|
|
13
18
|
return res;
|
|
@@ -15,11 +20,11 @@ export const getUserDetailChat = async (params) => {
|
|
|
15
20
|
export function getItemsByYear(data, key = 'created_at') {
|
|
16
21
|
let result = [];
|
|
17
22
|
if (data?.length) {
|
|
18
|
-
let curYear = dayjs(data[0][key]).format(
|
|
23
|
+
let curYear = dayjs(data[0][key]).format('YYYY');
|
|
19
24
|
let items = [];
|
|
20
25
|
for (let i = 0; i < data.length; i++) {
|
|
21
26
|
items.push(data[i]);
|
|
22
|
-
let nextItemYear = data[i + 1] ? dayjs(data[i + 1][key]).format(
|
|
27
|
+
let nextItemYear = data[i + 1] ? dayjs(data[i + 1][key]).format('YYYY') : curYear;
|
|
23
28
|
if (nextItemYear != curYear) {
|
|
24
29
|
result.push({
|
|
25
30
|
year: curYear,
|
|
@@ -25,3 +25,16 @@ export const phoneNumberFormat = (phone, halfShowType = 1) => {
|
|
|
25
25
|
}
|
|
26
26
|
return "";
|
|
27
27
|
};
|
|
28
|
+
export function phoneNumberFormatInput(input) {
|
|
29
|
+
const digits = input.replace(/\D/g, '').slice(0, 10);
|
|
30
|
+
const len = digits.length;
|
|
31
|
+
if (len === 0)
|
|
32
|
+
return '';
|
|
33
|
+
if (len < 4) {
|
|
34
|
+
return `(${digits}`;
|
|
35
|
+
}
|
|
36
|
+
if (len < 7) {
|
|
37
|
+
return `(${digits.slice(0, 3)}) ${digits.slice(3)}`;
|
|
38
|
+
}
|
|
39
|
+
return `(${digits.slice(0, 3)}) ${digits.slice(3, 6)}-${digits.slice(6)}`;
|
|
40
|
+
}
|
|
@@ -10,19 +10,20 @@ export type GoChatProps = {
|
|
|
10
10
|
};
|
|
11
11
|
export interface GoChatInstance {
|
|
12
12
|
unreadCount: number;
|
|
13
|
-
getUserRemote: () =>
|
|
13
|
+
getUserRemote: () => IResUser | null;
|
|
14
14
|
callStatus: PlivoCallStatusType | null;
|
|
15
15
|
callLabel: string;
|
|
16
16
|
startCall: (() => Promise<void>) | undefined;
|
|
17
17
|
endCall: (() => void) | undefined;
|
|
18
18
|
openSettings: () => void;
|
|
19
|
+
initData: (data: any) => void;
|
|
19
20
|
}
|
|
20
21
|
export interface CallInstance {
|
|
21
22
|
userRemoter: Ref<IResUser | null>;
|
|
22
23
|
callStatus: Ref<PlivoCallStatusType | null>;
|
|
23
|
-
startCall: (
|
|
24
|
-
endCall: (
|
|
25
|
-
answer: (
|
|
24
|
+
startCall: (data: IResUser) => Promise<void>;
|
|
25
|
+
endCall: () => void;
|
|
26
|
+
answer: () => Promise<void>;
|
|
26
27
|
label: ComputedRef<string>;
|
|
27
28
|
}
|
|
28
|
-
export type PAGE_RESPONSIVE = 'mobile' | 'tablet';
|
|
29
|
+
export type PAGE_RESPONSIVE = 'mobile' | 'tablet' | 'window';
|
|
@@ -49,7 +49,7 @@ export declare const setDataLogin: (id: string, token: string, domain: string) =
|
|
|
49
49
|
export declare const loginTenant: (body: IBodyLoginTenant) => Promise<any>;
|
|
50
50
|
export declare const loginLink: (params: IPramsLoginLink) => Promise<any>;
|
|
51
51
|
export declare const getProfile: () => Promise<IResProfile>;
|
|
52
|
-
export declare const
|
|
52
|
+
export declare const checkTenantPhoneOnGapInsight: () => Promise<any>;
|
|
53
53
|
export declare const submitTenantPhone: (body: {
|
|
54
54
|
phone: string;
|
|
55
55
|
tenant_id: string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const goChatError: import("vue").Ref<string, string>;
|
|
2
|
+
export declare const mediaPermissionState: import("vue").Ref<"prompt" | "granted" | "denied", "prompt" | "granted" | "denied">;
|
|
3
|
+
export declare const handleMedialPermissionError: () => Promise<void>;
|
|
4
|
+
export declare const showPageError: (error: string) => void;
|
|
@@ -189,6 +189,9 @@ export declare const userHistory: import("vue").Ref<{
|
|
|
189
189
|
visit_count: number;
|
|
190
190
|
} | null>;
|
|
191
191
|
export declare const getUserHistory: (phone: string) => Promise<GetCustomerHistoryResponse>;
|
|
192
|
+
export declare const getUserSearch: (params: {
|
|
193
|
+
keywords: string;
|
|
194
|
+
}) => Promise<any>;
|
|
192
195
|
export declare const getUserDetailChat: (params: {
|
|
193
196
|
phone: string;
|
|
194
197
|
client_id: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@phonghq/go-chat",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.44",
|
|
4
4
|
"private": false,
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@rushstack/eslint-patch": "^1.8.0",
|
|
50
50
|
"@tsconfig/node20": "^20.1.4",
|
|
51
|
-
"@types/node": "^
|
|
51
|
+
"@types/node": "^25.0.3",
|
|
52
52
|
"@vitejs/plugin-vue": "^5.0.5",
|
|
53
53
|
"@vitejs/plugin-vue-jsx": "^4.0.0",
|
|
54
54
|
"@vue/eslint-config-prettier": "^9.0.0",
|
|
@@ -61,6 +61,7 @@
|
|
|
61
61
|
"postcss": "^8.4.47",
|
|
62
62
|
"sass": "^1.64.1",
|
|
63
63
|
"sass-loader": "^13.3.2",
|
|
64
|
+
"shadcn-vue": "^2.4.3",
|
|
64
65
|
"tailwindcss": "^3.4.12",
|
|
65
66
|
"typescript": "~5.4.0",
|
|
66
67
|
"vite": "^5.3.1",
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, {
|
|
2
|
-
default?: ((props: {}) => any) | undefined;
|
|
3
|
-
}>;
|
|
4
|
-
export default _default;
|
|
5
|
-
type __VLS_WithSlots<T, S> = T & {
|
|
6
|
-
new (): {
|
|
7
|
-
$slots: S;
|
|
8
|
-
};
|
|
9
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, {
|
|
2
|
-
default?: ((props: {}) => any) | undefined;
|
|
3
|
-
}>;
|
|
4
|
-
export default _default;
|
|
5
|
-
type __VLS_WithSlots<T, S> = T & {
|
|
6
|
-
new (): {
|
|
7
|
-
$slots: S;
|
|
8
|
-
};
|
|
9
|
-
};
|