@phonghq/go-chat 1.0.18 → 1.0.20

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,7 +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
+ const callStatus = computed(() => callingRef.value?.callStatus ?? null);
106
106
  const responsiveObserver = ref('tablet');
107
107
  const appChatRef = ref();
108
108
  const callingRef = ref(null);
@@ -144,22 +144,18 @@ const getResponsiveObserver = useDebounce(() => {
144
144
  }
145
145
  }
146
146
  }, 50);
147
- const getUserRemote = () => {
148
- return callingRef.value?.userRemoter ?? null;
149
- };
150
- const startCall = () => {
151
- return callingRef.value?.answer ?? undefined;
152
- };
153
- const endCall = () => {
154
- return callingRef.value?.endCall;
155
- };
156
147
  initPage({ props: props, response: props.response });
157
148
  let __VLS_exposed;
158
149
  defineExpose({
159
150
  unreadCount,
160
- getUserRemote,
161
- startCall,
162
- endCall,
151
+ callStatus,
152
+ getUserRemote: () => {
153
+ return callingRef.value?.userRemoter ?? null;
154
+ },
155
+ startCall: async () => {
156
+ await callingRef.value?.answer();
157
+ },
158
+ endCall: () => callingRef.value?.endCall()
163
159
  });
164
160
  debugger; /* PartiallyEnd: #3632/scriptSetup.vue */
165
161
  const __VLS_defaults = {
@@ -1,10 +1,19 @@
1
- export var PLIVO_CALL_STATUS;
2
- (function (PLIVO_CALL_STATUS) {
3
- PLIVO_CALL_STATUS["CONNECTING"] = "Connecting...";
4
- PLIVO_CALL_STATUS["CALLING"] = "calling";
5
- PLIVO_CALL_STATUS["RINGING"] = "ringing";
6
- PLIVO_CALL_STATUS["CONNECT_FAILED"] = "failed";
7
- PLIVO_CALL_STATUS["CALL_START"] = "in-progress";
8
- PLIVO_CALL_STATUS["CALL_END"] = "completed";
9
- PLIVO_CALL_STATUS["NO_ANSWER"] = "no-answer";
10
- })(PLIVO_CALL_STATUS || (PLIVO_CALL_STATUS = {}));
1
+ // export const enum PLIVO_CALL_STATUS {
2
+ // CONNECTING = 'Connecting...',
3
+ // CALLING = 'calling',
4
+ // RINGING = 'ringing',
5
+ // CONNECT_FAILED = 'failed',
6
+ // CALL_START = 'in-progress',
7
+ // CALL_END = 'completed',
8
+ // NO_ANSWER = 'no-answer'
9
+ // }
10
+ export const PLIVO_CALL_STATUS = {
11
+ CONNECTING: 'Connecting...',
12
+ CALLING: 'calling',
13
+ RINGING: 'ringing',
14
+ CONNECT_FAILED: 'failed',
15
+ CALL_START: 'in-progress',
16
+ CALL_END: 'completed',
17
+ NO_ANSWER: 'no-answer'
18
+ };
19
+ // export type PlivoCallStatusType = typeof PLIVO_CALL_STATUS_LIST;
@@ -2,12 +2,13 @@ export type IResCall = {
2
2
  from: string;
3
3
  to: string;
4
4
  };
5
- export declare const enum PLIVO_CALL_STATUS {
6
- CONNECTING = "Connecting...",
7
- CALLING = "calling",
8
- RINGING = "ringing",
9
- CONNECT_FAILED = "failed",
10
- CALL_START = "in-progress",
11
- CALL_END = "completed",
12
- NO_ANSWER = "no-answer"
13
- }
5
+ export declare const PLIVO_CALL_STATUS: {
6
+ readonly CONNECTING: "Connecting...";
7
+ readonly CALLING: "calling";
8
+ readonly RINGING: "ringing";
9
+ readonly CONNECT_FAILED: "failed";
10
+ readonly CALL_START: "in-progress";
11
+ readonly CALL_END: "completed";
12
+ readonly NO_ANSWER: "no-answer";
13
+ };
14
+ export type PlivoCallStatusType = (typeof PLIVO_CALL_STATUS)[keyof typeof PLIVO_CALL_STATUS];
@@ -1,6 +1,6 @@
1
1
  import type { ComputedRef, Ref } from 'vue';
2
2
  import type { IResUser } from '../../types/message';
3
- import type { PLIVO_CALL_STATUS } from '../../types/call';
3
+ import type { PlivoCallStatusType } from '../../types/call';
4
4
  export type GoChatProps = {
5
5
  token?: string;
6
6
  id?: string;
@@ -11,12 +11,13 @@ export type GoChatProps = {
11
11
  export interface GoChatInstance {
12
12
  unreadCount: ComputedRef<number>;
13
13
  getUserRemote: () => (IResUser | null);
14
- startCall: any;
14
+ callStatus: ComputedRef<PlivoCallStatusType | null>;
15
+ startCall: (() => Promise<void>) | undefined;
15
16
  endCall: (() => void) | undefined;
16
17
  }
17
18
  export interface CallInstance {
18
19
  userRemoter: Ref<IResUser | null>;
19
- callStatus: Ref<PLIVO_CALL_STATUS | null>;
20
+ callStatus: Ref<PlivoCallStatusType | null>;
20
21
  startCall: ((data: IResUser) => Promise<void>);
21
22
  endCall: (() => void);
22
23
  answer: (() => Promise<void>);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phonghq/go-chat",
3
- "version": "1.0.18",
3
+ "version": "1.0.20",
4
4
  "private": false,
5
5
  "files": [
6
6
  "dist"