@phonghq/go-chat 1.0.15 → 1.0.16

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.
@@ -102,6 +102,7 @@ const responsiveRender = computed(() => {
102
102
  });
103
103
  const list = computed(() => chatListRef.value?.listConversations ?? []);
104
104
  const unreadCount = computed(() => list.value?.reduce((total, cur) => total + (cur?.unread_count ?? 0), 0) ?? 0);
105
+ const userRemote = computed(() => callingRef.value?.userRemoter ?? null);
105
106
  const responsiveObserver = ref('tablet');
106
107
  const appChatRef = ref();
107
108
  const callingRef = ref(null);
@@ -145,7 +146,14 @@ const getResponsiveObserver = useDebounce(() => {
145
146
  }, 50);
146
147
  initPage({ props: props, response: props.response });
147
148
  let __VLS_exposed;
148
- defineExpose({ unreadCount });
149
+ defineExpose({
150
+ unreadCount,
151
+ userRemoter: callingRef.value?.userRemoter ?? null,
152
+ callStatus: callingRef.value?.callStatus ?? null,
153
+ callLabel: callingRef.value?.label ?? '',
154
+ startCall: callingRef.value?.answer,
155
+ endCall: callingRef.value?.endCall,
156
+ });
149
157
  debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
150
158
  const __VLS_defaults = {
151
159
  response: 'tablet'
@@ -49,6 +49,7 @@ const STATUS_LABEL = computed(() => {
49
49
  [PLIVO_CALL_STATUS.NO_ANSWER]: 'No Answer'
50
50
  };
51
51
  });
52
+ const label = computed(() => STATUS_LABEL.value[callStatus.value] ?? '');
52
53
  const callStatus = ref(PLIVO_CALL_STATUS.CONNECTING);
53
54
  const duration = ref('00:00');
54
55
  const drawerVisible = ref(false);
@@ -125,7 +126,7 @@ const startCall = async (data) => {
125
126
  callStatus.value = PLIVO_CALL_STATUS.CONNECT_FAILED;
126
127
  }
127
128
  };
128
- const answer = async (message) => {
129
+ const answer = async () => {
129
130
  try {
130
131
  await plivoCallAnswer();
131
132
  }
@@ -208,7 +209,7 @@ const handleAfterClose = () => {
208
209
  record_link.value = '';
209
210
  uuidEnd = '';
210
211
  };
211
- const __VLS_exposed = { startCall, endCall };
212
+ const __VLS_exposed = { startCall, endCall, userRemoter, callStatus, answer, label };
212
213
  defineExpose(__VLS_exposed);
213
214
  debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
214
215
  const __VLS_defaults = {};
@@ -1,4 +1,6 @@
1
- import { ComputedRef } from 'vue';
1
+ import type { ComputedRef } from 'vue';
2
+ import type { IResUser } from '../../types/message';
3
+ import type { PLIVO_CALL_STATUS } from '../../types/call';
2
4
  export type GoChatProps = {
3
5
  token?: string;
4
6
  id?: string;
@@ -8,5 +10,10 @@ export type GoChatProps = {
8
10
  };
9
11
  export interface GoChatInstance {
10
12
  unreadCount: ComputedRef<number>;
13
+ userRemoter: IResUser | null;
14
+ callStatus: PLIVO_CALL_STATUS | null;
15
+ startCall: (() => Promise<void>) | undefined;
16
+ endCall: (() => void) | undefined;
17
+ callLabel: string;
11
18
  }
12
19
  export type PAGE_RESPONSE = 'mobile' | 'tablet';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phonghq/go-chat",
3
- "version": "1.0.15",
3
+ "version": "1.0.16",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist"