@phonghq/go-chat 1.0.42 → 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.
Files changed (114) hide show
  1. package/dist/assets/icons/IconPlan.vue.d.ts +13 -1
  2. package/dist/assets/icons/call/IconPhoneCancel.vue.d.ts +13 -1
  3. package/dist/assets/icons/customer-detail/IconPhone.vue.d.ts +13 -1
  4. package/dist/chat/App.vue.d.ts +13 -2
  5. package/dist/chat/page/home/ChatList.vue.d.ts +10 -0
  6. package/dist/chat/page/home/ChatMessageItem.vue.d.ts +1 -0
  7. package/dist/chat/page/home/ChatMessageItem2.vue.d.ts +19 -0
  8. package/dist/chat/page/home/Home.vue.d.ts +2 -0
  9. package/dist/chat/page/home/InputChat.vue.d.ts +2 -0
  10. package/dist/components/chat/call/Calling.vue.d.ts +4 -2
  11. package/dist/components/chat/common/tabs/TabBase.vue.d.ts +18 -0
  12. package/dist/components/common/drawer/DrawerBaseCustom.vue.d.ts +1 -1
  13. package/dist/components/ui/select/Select.vue.d.ts +20 -0
  14. package/dist/components/ui/select/SelectContent.vue.d.ts +24 -0
  15. package/dist/components/ui/select/SelectGroup.vue.d.ts +10 -0
  16. package/dist/components/ui/select/SelectItem.vue.d.ts +18 -0
  17. package/dist/components/ui/select/SelectItemText.vue.d.ts +10 -0
  18. package/dist/components/ui/select/SelectLabel.vue.d.ts +14 -0
  19. package/dist/components/ui/select/SelectScrollDownButton.vue.d.ts +14 -0
  20. package/dist/components/ui/select/SelectScrollUpButton.vue.d.ts +14 -0
  21. package/dist/components/ui/select/SelectSeparator.vue.d.ts +7 -0
  22. package/dist/components/ui/select/SelectTrigger.vue.d.ts +17 -0
  23. package/dist/components/ui/select/SelectValue.vue.d.ts +10 -0
  24. package/dist/components/ui/select/index.d.ts +11 -0
  25. package/dist/components/ui/tabs/Tabs.vue.d.ts +20 -0
  26. package/dist/components/ui/tabs/TabsContent.vue.d.ts +14 -0
  27. package/dist/components/ui/tabs/TabsList.vue.d.ts +14 -0
  28. package/dist/components/ui/tabs/TabsTrigger.vue.d.ts +14 -0
  29. package/dist/components/ui/tabs/index.d.ts +4 -0
  30. package/dist/composable/useDigibot.d.ts +1 -1
  31. package/dist/composable/useInitData.d.ts +5 -2
  32. package/dist/composable/useListConversations.d.ts +4 -1
  33. package/dist/composable/useListentEvent.d.ts +5 -0
  34. package/dist/composable/usePlivo.d.ts +1 -0
  35. package/dist/constant/color.d.ts +2 -2
  36. package/dist/go-chat.es.js +14663 -14004
  37. package/dist/go-chat.umd.js +15 -15
  38. package/dist/style.css +1 -1
  39. package/dist/test/assets/icons/IconPlan.vue.js +23 -3
  40. package/dist/test/assets/icons/IconUser.vue.js +25 -0
  41. package/dist/test/assets/icons/call/IconPhone.vue.js +6 -19
  42. package/dist/test/assets/icons/call/IconPhoneCancel.vue.js +32 -21
  43. package/dist/test/assets/icons/customer-detail/IconPhone.vue.js +23 -3
  44. package/dist/test/chat/App.vue.js +303 -282
  45. package/dist/test/chat/page/customer-check-in/CustomerCheckIn.vue.js +3 -1
  46. package/dist/test/chat/page/customer-detail/CustomerDetail.vue.js +4 -4
  47. package/dist/test/chat/page/home/ChatList.vue.js +113 -43
  48. package/dist/test/chat/page/home/ChatMessage.vue.js +10 -1
  49. package/dist/test/chat/page/home/ChatMessageItem.vue.js +75 -83
  50. package/dist/test/chat/page/home/ChatMessageItem2.vue.js +351 -0
  51. package/dist/test/chat/page/home/Home.vue.js +29 -9
  52. package/dist/test/chat/page/home/HomeHeader.vue.js +8 -4
  53. package/dist/test/chat/page/home/InputChat.vue.js +58 -37
  54. package/dist/test/components/chat/call/Calling.vue.js +117 -71
  55. package/dist/test/components/chat/common/tab/TabBase.vue.js +1 -0
  56. package/dist/test/components/chat/common/tabs/TabBase.vue.js +92 -0
  57. package/dist/test/components/chat/customer/Avatar.vue.js +23 -4
  58. package/dist/test/components/chat/layout/mobile/Footer.vue.js +6 -1
  59. package/dist/test/components/common/drawer/DrawerBaseCustom.vue.js +1 -0
  60. package/dist/test/components/common/select/SelectBase.vue.js +139 -0
  61. package/dist/test/components/ui/select/Select.vue.js +49 -0
  62. package/dist/test/components/ui/select/SelectContent.vue.js +98 -0
  63. package/dist/test/components/ui/select/SelectGroup.vue.js +37 -0
  64. package/dist/test/components/ui/select/SelectItem.vue.js +86 -0
  65. package/dist/test/components/ui/select/SelectItemText.vue.js +37 -0
  66. package/dist/test/components/ui/select/SelectLabel.vue.js +40 -0
  67. package/dist/test/components/ui/select/SelectScrollDownButton.vue.js +58 -0
  68. package/dist/test/components/ui/select/SelectScrollUpButton.vue.js +58 -0
  69. package/dist/test/components/ui/select/SelectSeparator.vue.js +39 -0
  70. package/dist/test/components/ui/select/SelectTrigger.vue.js +76 -0
  71. package/dist/test/components/ui/select/SelectValue.vue.js +37 -0
  72. package/dist/test/components/ui/select/index.js +11 -0
  73. package/dist/test/components/ui/tabs/Tabs.vue.js +54 -0
  74. package/dist/test/components/ui/tabs/TabsContent.vue.js +44 -0
  75. package/dist/test/components/ui/tabs/TabsList.vue.js +44 -0
  76. package/dist/test/components/ui/tabs/TabsTrigger.vue.js +45 -0
  77. package/dist/test/components/ui/tabs/index.js +4 -0
  78. package/dist/test/composable/useDigibot.js +3 -3
  79. package/dist/test/composable/useInitData.js +23 -14
  80. package/dist/test/composable/useListConversations.js +51 -33
  81. package/dist/test/composable/useListentEvent.js +45 -0
  82. package/dist/test/composable/usePlivo.js +6 -1
  83. package/dist/test/constant/color.js +4 -2
  84. package/dist/test/plugins/axios-gci.js +1 -1
  85. package/dist/test/utils/chat/auth.js +1 -1
  86. package/dist/test/utils/chat/cache.js +63 -0
  87. package/dist/test/utils/chat/call.js +2 -3
  88. package/dist/test/utils/chat/conversation.js +9 -2
  89. package/dist/test/utils/chat/page-error.js +25 -0
  90. package/dist/test/utils/chat/user.js +7 -2
  91. package/dist/test/utils/string-helper.js +13 -0
  92. package/dist/test/views/NotTenantPhone.vue.js +99 -0
  93. package/dist/types/chat/global.d.ts +6 -5
  94. package/dist/types/conversation.d.ts +2 -0
  95. package/dist/utils/chat/auth.d.ts +1 -1
  96. package/dist/utils/chat/cache.d.ts +7 -0
  97. package/dist/utils/chat/conversation.d.ts +2 -0
  98. package/dist/utils/chat/page-error.d.ts +4 -0
  99. package/dist/utils/chat/user.d.ts +3 -0
  100. package/dist/utils/string-helper.d.ts +1 -0
  101. package/dist/views/NotTenantPhone.vue.d.ts +9 -0
  102. package/package.json +3 -2
  103. package/dist/components/layout/Blank.vue.d.ts +0 -9
  104. package/dist/components/layout/Default.vue.d.ts +0 -9
  105. package/dist/composable/useError.d.ts +0 -4
  106. package/dist/composable/useModalConfirm.d.ts +0 -5
  107. package/dist/test/components/ListenEvent.vue.js +0 -45
  108. package/dist/test/components/layout/Blank.vue.js +0 -19
  109. package/dist/test/components/layout/Default.vue.js +0 -21
  110. package/dist/test/components/modal/Confirm.vue.js +0 -164
  111. package/dist/test/composable/useError.js +0 -10
  112. package/dist/test/composable/useModalConfirm.js +0 -39
  113. /package/dist/{components/ListenEvent.vue.d.ts → assets/icons/IconUser.vue.d.ts} +0 -0
  114. /package/dist/components/{modal/Confirm.vue.d.ts → common/select/SelectBase.vue.d.ts} +0 -0
@@ -0,0 +1,63 @@
1
+ import { dataProfile } from '../../utils/chat/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
+ }
@@ -1,7 +1,6 @@
1
1
  import axios from '../../plugins/axios';
2
2
  import { dataProfile } from '../../utils/chat/auth';
3
- import { useError } from '../../composable/useError';
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
- showError('We’re having trouble connecting the call. Please try again in a moment');
158
+ showPageError('We’re having trouble connecting the call. Please try again in a moment');
160
159
  }
161
160
  };
@@ -11,6 +11,13 @@ export const getConversation = async (param) => {
11
11
  });
12
12
  return res;
13
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
+ };
14
21
  export const publicTopicConversationUpdate = async (data) => {
15
22
  const res = await getCountUnread({
16
23
  conversation_id: data.infoUser?.conversation_id ?? 0,
@@ -42,7 +49,7 @@ export const publicTopicConversationUpdate = async (data) => {
42
49
  status: 1,
43
50
  color: dataProfile.value?.color ?? '',
44
51
  is_call: dataProfile.value?.color ?? '',
45
- is_unknown: data.infoUser?.is_unknown ?? 0,
52
+ is_unknown: data.is_unknown,
46
53
  };
47
54
  publishMessage(`${TOPIC_HOME[0] + Number(data.infoUser?.id)}`, JSON.stringify(dataMessageForReceiver));
48
55
  const dataMessageMyself = {
@@ -58,7 +65,7 @@ export const publicTopicConversationUpdate = async (data) => {
58
65
  unread_count: 0,
59
66
  status: 1,
60
67
  color: data.infoUser?.color,
61
- is_unknown: data.infoUser?.is_unknown ?? 0,
68
+ is_unknown: data.is_unknown,
62
69
  };
63
70
  publishMessage(`${TOPIC_HOME[0] + Number(dataProfile.value?.id)}`, JSON.stringify(dataMessageMyself));
64
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("YYYY");
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("YYYY") : curYear;
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
+ }
@@ -0,0 +1,99 @@
1
+ const tryAgain = () => {
2
+ if (props.isLib) {
3
+ emit('tryAgain');
4
+ }
5
+ else {
6
+ window.location.href = '/';
7
+ }
8
+ };
9
+ const props = withDefaults(defineProps(), {});
10
+ const emit = defineEmits();
11
+ debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
12
+ const __VLS_defaults = {};
13
+ const __VLS_ctx = {
14
+ ...{},
15
+ ...{},
16
+ ...{},
17
+ ...{},
18
+ ...{},
19
+ };
20
+ let __VLS_elements;
21
+ let __VLS_components;
22
+ let __VLS_directives;
23
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
24
+ ...{ class: "flex flex-col items-center justify-center w-full h-full py-10 text-center" },
25
+ });
26
+ __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
27
+ ...{ class: "w-24 h-24 flex items-center justify-center rounded-full bg-gray-100" },
28
+ });
29
+ __VLS_asFunctionalElement(__VLS_elements.svg, __VLS_elements.svg)({
30
+ xmlns: "http://www.w3.org/2000/svg",
31
+ ...{ class: "w-10 h-10 text-gray-400" },
32
+ fill: "none",
33
+ viewBox: "0 0 24 24",
34
+ 'stroke-width': "1.5",
35
+ stroke: "currentColor",
36
+ });
37
+ __VLS_asFunctionalElement(__VLS_elements.path)({
38
+ 'stroke-linecap': "round",
39
+ 'stroke-linejoin': "round",
40
+ d: "\u004d\u0032\u002e\u0032\u0035\u0020\u0036\u002e\u0037\u0035\u0063\u0030\u0020\u0038\u002e\u0032\u0038\u0034\u0020\u0036\u002e\u0037\u0031\u0036\u0020\u0031\u0035\u0020\u0031\u0035\u0020\u0031\u0035\u0068\u0031\u002e\u0035\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0061\u0032\u002e\u0032\u0035\u0020\u0032\u002e\u0032\u0035\u0020\u0030\u0020\u0030\u0020\u0030\u0020\u0032\u002e\u0032\u0035\u002d\u0032\u002e\u0032\u0035\u0076\u002d\u0032\u002e\u0030\u0037\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0063\u0030\u002d\u002e\u0035\u0031\u0036\u002d\u002e\u0033\u0035\u0031\u002d\u002e\u0039\u0036\u0036\u002d\u002e\u0038\u0035\u0032\u002d\u0031\u002e\u0030\u0039\u0031\u006c\u002d\u0034\u002e\u0034\u0032\u0033\u002d\u0031\u002e\u0031\u0030\u0036\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0061\u0031\u002e\u0031\u0032\u0035\u0020\u0031\u002e\u0031\u0032\u0035\u0020\u0030\u0020\u0030\u0020\u0030\u002d\u0031\u002e\u0031\u0037\u0033\u002e\u0034\u0031\u0037\u006c\u002d\u002e\u0039\u0037\u0020\u0031\u002e\u0032\u0039\u0033\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0063\u002d\u002e\u0032\u0036\u0035\u002e\u0033\u0035\u0033\u002d\u002e\u0037\u0033\u0039\u002e\u0035\u0030\u0032\u002d\u0031\u002e\u0031\u0035\u0033\u002e\u0033\u0032\u0036\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0061\u0031\u0032\u002e\u0030\u0033\u0035\u0020\u0031\u0032\u002e\u0030\u0033\u0035\u0020\u0030\u0020\u0030\u0020\u0031\u002d\u0035\u002e\u0033\u0034\u0038\u002d\u0035\u002e\u0033\u0034\u0038\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0063\u002d\u002e\u0031\u0037\u0036\u002d\u002e\u0034\u0031\u0034\u002d\u002e\u0030\u0032\u0037\u002d\u002e\u0038\u0038\u0038\u002e\u0033\u0032\u0036\u002d\u0031\u002e\u0031\u0035\u0033\u006c\u0031\u002e\u0032\u0039\u0033\u002d\u002e\u0039\u0037\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0063\u002e\u0033\u0039\u002d\u002e\u0032\u0039\u0033\u002e\u0035\u0036\u0033\u002d\u002e\u0037\u0039\u0035\u002e\u0034\u0031\u0037\u002d\u0031\u002e\u0031\u0037\u0033\u004c\u0036\u002e\u0036\u0036\u0020\u0033\u002e\u0031\u0030\u0032\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0041\u0031\u002e\u0031\u0032\u0035\u0020\u0031\u002e\u0031\u0032\u0035\u0020\u0030\u0020\u0030\u0020\u0030\u0020\u0035\u002e\u0035\u0036\u0039\u0020\u0032\u002e\u0032\u0035\u0048\u0033\u002e\u0035\u000a\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0041\u0031\u002e\u0032\u0035\u0020\u0031\u002e\u0032\u0035\u0020\u0030\u0020\u0030\u0020\u0030\u0020\u0032\u002e\u0032\u0035\u0020\u0033\u002e\u0035\u0076\u0033\u002e\u0032\u0035\u007a",
41
+ });
42
+ __VLS_asFunctionalElement(__VLS_elements.h2, __VLS_elements.h2)({
43
+ ...{ class: "mt-4 text-3xl font-semibold text-gray-700" },
44
+ });
45
+ __VLS_asFunctionalElement(__VLS_elements.p, __VLS_elements.p)({
46
+ ...{ class: "mt-1 text-xl text-chat-haze-500 max-w-[700px]" },
47
+ });
48
+ __VLS_asFunctionalElement(__VLS_elements.button, __VLS_elements.button)({
49
+ ...{ onClick: (...[$event]) => {
50
+ __VLS_ctx.tryAgain();
51
+ // @ts-ignore
52
+ [tryAgain,];
53
+ } },
54
+ ...{ class: "mt-6 px-4 py-2 rounded-xl h-14 w-[150px] bg-chat-primary text-white text-lg font-semibold hover:bg-blue-700 transition" },
55
+ });
56
+ /** @type {__VLS_StyleScopedClasses['flex']} */ ;
57
+ /** @type {__VLS_StyleScopedClasses['flex-col']} */ ;
58
+ /** @type {__VLS_StyleScopedClasses['items-center']} */ ;
59
+ /** @type {__VLS_StyleScopedClasses['justify-center']} */ ;
60
+ /** @type {__VLS_StyleScopedClasses['w-full']} */ ;
61
+ /** @type {__VLS_StyleScopedClasses['h-full']} */ ;
62
+ /** @type {__VLS_StyleScopedClasses['py-10']} */ ;
63
+ /** @type {__VLS_StyleScopedClasses['text-center']} */ ;
64
+ /** @type {__VLS_StyleScopedClasses['w-24']} */ ;
65
+ /** @type {__VLS_StyleScopedClasses['h-24']} */ ;
66
+ /** @type {__VLS_StyleScopedClasses['flex']} */ ;
67
+ /** @type {__VLS_StyleScopedClasses['items-center']} */ ;
68
+ /** @type {__VLS_StyleScopedClasses['justify-center']} */ ;
69
+ /** @type {__VLS_StyleScopedClasses['rounded-full']} */ ;
70
+ /** @type {__VLS_StyleScopedClasses['bg-gray-100']} */ ;
71
+ /** @type {__VLS_StyleScopedClasses['w-10']} */ ;
72
+ /** @type {__VLS_StyleScopedClasses['h-10']} */ ;
73
+ /** @type {__VLS_StyleScopedClasses['text-gray-400']} */ ;
74
+ /** @type {__VLS_StyleScopedClasses['mt-4']} */ ;
75
+ /** @type {__VLS_StyleScopedClasses['text-3xl']} */ ;
76
+ /** @type {__VLS_StyleScopedClasses['font-semibold']} */ ;
77
+ /** @type {__VLS_StyleScopedClasses['text-gray-700']} */ ;
78
+ /** @type {__VLS_StyleScopedClasses['mt-1']} */ ;
79
+ /** @type {__VLS_StyleScopedClasses['text-xl']} */ ;
80
+ /** @type {__VLS_StyleScopedClasses['text-chat-haze-500']} */ ;
81
+ /** @type {__VLS_StyleScopedClasses['max-w-[700px]']} */ ;
82
+ /** @type {__VLS_StyleScopedClasses['mt-6']} */ ;
83
+ /** @type {__VLS_StyleScopedClasses['px-4']} */ ;
84
+ /** @type {__VLS_StyleScopedClasses['py-2']} */ ;
85
+ /** @type {__VLS_StyleScopedClasses['rounded-xl']} */ ;
86
+ /** @type {__VLS_StyleScopedClasses['h-14']} */ ;
87
+ /** @type {__VLS_StyleScopedClasses['w-[150px]']} */ ;
88
+ /** @type {__VLS_StyleScopedClasses['bg-chat-primary']} */ ;
89
+ /** @type {__VLS_StyleScopedClasses['text-white']} */ ;
90
+ /** @type {__VLS_StyleScopedClasses['text-lg']} */ ;
91
+ /** @type {__VLS_StyleScopedClasses['font-semibold']} */ ;
92
+ /** @type {__VLS_StyleScopedClasses['hover:bg-blue-700']} */ ;
93
+ /** @type {__VLS_StyleScopedClasses['transition']} */ ;
94
+ const __VLS_export = (await import('vue')).defineComponent({
95
+ __typeEmits: {},
96
+ __typeProps: {},
97
+ props: {},
98
+ });
99
+ export default {};
@@ -10,19 +10,20 @@ export type GoChatProps = {
10
10
  };
11
11
  export interface GoChatInstance {
12
12
  unreadCount: number;
13
- getUserRemote: () => (IResUser | null);
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: ((data: IResUser) => Promise<void>);
24
- endCall: (() => void);
25
- answer: (() => Promise<void>);
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';
@@ -12,9 +12,11 @@ export type IConversation = {
12
12
  status: number;
13
13
  color: string;
14
14
  is_unknown: number;
15
+ customer_id?: number;
15
16
  };
16
17
  export type IParamGetConversation = {
17
18
  page?: number;
18
19
  search?: string;
19
20
  is_unknown?: number;
21
+ phone?: string;
20
22
  };
@@ -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 checkTenantPhone: () => Promise<any>;
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,7 @@
1
+ export declare function setCache(key: string, data: any, ttlMs?: number): void;
2
+ export declare function getCache<T = any>(key: string): {
3
+ data: T | null;
4
+ needReload?: boolean;
5
+ };
6
+ export declare function clearCache(key: string): void;
7
+ export declare function removeOldestCache(limit: number, prefix: string): void;
@@ -2,9 +2,11 @@ import type { IConversation, IParamGetConversation } from '../../types/conversat
2
2
  import type { DataWithMetaResponse } from '../../types/global';
3
3
  import type { IResUser } from '../../types/message';
4
4
  export declare const getConversation: (param: IParamGetConversation) => Promise<DataWithMetaResponse<IConversation[]>>;
5
+ export declare const getConversationView: (id: any) => Promise<IConversation>;
5
6
  export declare const publicTopicConversationUpdate: (data: {
6
7
  infoUser: IResUser | null;
7
8
  isSendImg?: boolean;
8
9
  message?: string;
9
10
  isCall?: string;
11
+ is_unknown: number;
10
12
  }) => Promise<void>;
@@ -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;
@@ -1 +1,2 @@
1
1
  export declare const phoneNumberFormat: (phone: string, halfShowType?: number) => string;
2
+ export declare function phoneNumberFormatInput(input: string): string;
@@ -0,0 +1,9 @@
1
+ type Props = {
2
+ isLib: boolean;
3
+ };
4
+ declare const _default: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
5
+ tryAgain: () => any;
6
+ }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
7
+ onTryAgain?: (() => any) | undefined;
8
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
9
+ export default _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phonghq/go-chat",
3
- "version": "1.0.42",
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": "^24.10.1",
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
- };
@@ -1,4 +0,0 @@
1
- export declare const goChatError: import("vue").Ref<string, string>;
2
- export declare function useError(): {
3
- showError: (error: string) => void;
4
- };
@@ -1,5 +0,0 @@
1
- import type { ConfirmPayloadPromise, ConfirmPayload } from '../types/chat/promise';
2
- export declare function useModalConfirm(): {
3
- setHandleConfirm: (callback: (data: ConfirmPayloadPromise) => void) => void;
4
- modalConfirm: (data: ConfirmPayload) => Promise<any>;
5
- };
@@ -1,45 +0,0 @@
1
- /// <reference types="C:/phonghq/go-chat-v2/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
- import { onMounted, onBeforeUnmount } from 'vue';
3
- import { useDebounce } from '../utils/debounce';
4
- // import { useGeneralStore } from '@/stores/general'
5
- // const deviceType = computed({
6
- // set(value: any) {
7
- // return useGeneralStore().deviceResponsive = value
8
- // },
9
- // get() {
10
- // return useGeneralStore().deviceResponsive
11
- // }
12
- // })
13
- // const getDeviceType = () => {
14
- // const width = window.innerWidth
15
- // if (width < 767) {
16
- // return 'mobile'
17
- // } else if (width < 1023) {
18
- // return 'tablet'
19
- // } else {
20
- // return 'window'
21
- // }
22
- // }
23
- const updateDeviceType = useDebounce(() => {
24
- // const newType = getDeviceType()
25
- // if (deviceType.value !== newType) {
26
- // deviceType.value = newType
27
- // }
28
- }, 500);
29
- onMounted(() => {
30
- updateDeviceType();
31
- window.addEventListener('resize', updateDeviceType);
32
- });
33
- onBeforeUnmount(() => {
34
- window.removeEventListener('resize', updateDeviceType);
35
- });
36
- debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
37
- const __VLS_ctx = {
38
- ...{},
39
- ...{},
40
- };
41
- let __VLS_elements;
42
- let __VLS_components;
43
- let __VLS_directives;
44
- const __VLS_export = (await import('vue')).defineComponent({});
45
- export default {};
@@ -1,19 +0,0 @@
1
- /// <reference types="C:/phonghq/go-chat-v2/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
- debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
3
- const __VLS_ctx = {
4
- ...{},
5
- ...{},
6
- };
7
- let __VLS_elements;
8
- let __VLS_components;
9
- let __VLS_directives;
10
- __VLS_asFunctionalElement(__VLS_elements.main, __VLS_elements.main)({
11
- ...{ class: "main" },
12
- });
13
- var __VLS_0 = {};
14
- /** @type {__VLS_StyleScopedClasses['main']} */ ;
15
- // @ts-ignore
16
- var __VLS_1 = __VLS_0;
17
- const __VLS_base = (await import('vue')).defineComponent({});
18
- const __VLS_export = {};
19
- export default {};
@@ -1,21 +0,0 @@
1
- /// <reference types="C:/phonghq/go-chat-v2/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
2
- // COMPONENT
3
- debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
4
- const __VLS_ctx = {};
5
- let __VLS_elements;
6
- let __VLS_components;
7
- let __VLS_directives;
8
- __VLS_asFunctionalElement(__VLS_elements.main, __VLS_elements.main)({
9
- ...{ class: "main" },
10
- });
11
- __VLS_asFunctionalElement(__VLS_elements.div, __VLS_elements.div)({
12
- ...{ class: "container" },
13
- });
14
- var __VLS_0 = {};
15
- /** @type {__VLS_StyleScopedClasses['main']} */ ;
16
- /** @type {__VLS_StyleScopedClasses['container']} */ ;
17
- // @ts-ignore
18
- var __VLS_1 = __VLS_0;
19
- const __VLS_base = (await import('vue')).defineComponent({});
20
- const __VLS_export = {};
21
- export default {};