@phonghq/go-chat 1.0.63 → 1.0.65
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/components/chat/call/Calling.vue.js +6 -1
- package/dist/composable/usePlivo.js +19 -18
- package/dist/go-chat.es.js +2346 -2362
- package/dist/go-chat.umd.js +11 -11
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="C:/phonghq/go-chat-v2/node_modules/.vue-global-types/vue_3.5_0.d.ts" />
|
|
2
|
-
import { computed, onMounted, onUnmounted, ref } from 'vue';
|
|
2
|
+
import { computed, onBeforeUnmount, onMounted, onUnmounted, ref } from 'vue';
|
|
3
3
|
import IconPhone from '../../../assets/icons/call/IconPhone.vue';
|
|
4
4
|
import { dataProfile } from '../../../utils/chat/store/auth';
|
|
5
5
|
import IconPhoneCancel from '../../../assets/icons/call/IconPhoneCancel.vue';
|
|
@@ -93,7 +93,12 @@ onMounted(async () => {
|
|
|
93
93
|
showPageError('We’re having trouble connecting the call. Please try again in a moment');
|
|
94
94
|
}
|
|
95
95
|
});
|
|
96
|
+
onBeforeUnmount(() => {
|
|
97
|
+
console.log('ssssssssssssssssssssssss');
|
|
98
|
+
plivoRemoveCallBack();
|
|
99
|
+
});
|
|
96
100
|
onUnmounted(() => {
|
|
101
|
+
console.log('ssssssssssssssssssssssss');
|
|
97
102
|
if (timer)
|
|
98
103
|
clearInterval(timer);
|
|
99
104
|
if (timeOut)
|
|
@@ -19,23 +19,15 @@ export function usePlivo(callback) {
|
|
|
19
19
|
try {
|
|
20
20
|
if (!plivoBrowserSdk) {
|
|
21
21
|
plivoBrowserSdk = new window.Plivo(options);
|
|
22
|
-
plivoBrowserSdk?.client?.on?.('onCallAnswered',
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
plivoBrowserSdk
|
|
26
|
-
plivoBrowserSdk.client.on('onCallFailed', (data, callInfo) => {
|
|
27
|
-
handleCallFailed(data, callInfo);
|
|
28
|
-
});
|
|
29
|
-
plivoBrowserSdk.client.on('onIncomingCallCanceled', (callInfo) => {
|
|
30
|
-
handleIncomingCallCanceled(callInfo);
|
|
31
|
-
});
|
|
22
|
+
plivoBrowserSdk?.client?.on?.('onCallAnswered', handleCallAnswered);
|
|
23
|
+
plivoBrowserSdk?.client?.on?.('onCallTerminated', handleCallTerminated);
|
|
24
|
+
plivoBrowserSdk.client.on('onCallFailed', handleCallFailed);
|
|
25
|
+
plivoBrowserSdk.client.on('onIncomingCallCanceled', handleIncomingCallCanceled);
|
|
32
26
|
// plivoBrowserSdk.client.on('onCalling', (data: any) => console.log('onCallFailed', data))
|
|
33
|
-
plivoBrowserSdk?.client?.on?.('onIncomingCall',
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
plivoBrowserSdk
|
|
37
|
-
plivoBrowserSdk.client.on('onMediaPermission', (e) => handleMediaPermission(e));
|
|
38
|
-
plivoBrowserSdk?.client?.on?.('onLoginFailed', (e) => handleLoginFailed(e));
|
|
27
|
+
plivoBrowserSdk?.client?.on?.('onIncomingCall', handleIncomingCall);
|
|
28
|
+
plivoBrowserSdk.client.on('onCallRemoteRinging', handleCallRemoteRinging);
|
|
29
|
+
plivoBrowserSdk.client.on('onMediaPermission', handleMediaPermission);
|
|
30
|
+
plivoBrowserSdk?.client?.on?.('onLoginFailed', handleLoginFailed);
|
|
39
31
|
}
|
|
40
32
|
if (!data.isRefresh) {
|
|
41
33
|
const payload = JSON.parse(atob(data.token.split('.')[1]));
|
|
@@ -59,7 +51,7 @@ export function usePlivo(callback) {
|
|
|
59
51
|
const handleLoginFailed = (e) => {
|
|
60
52
|
console.log('Login failed', e);
|
|
61
53
|
};
|
|
62
|
-
const handleIncomingCall = async (call) => {
|
|
54
|
+
const handleIncomingCall = async (callerID, extraHeaders, call) => {
|
|
63
55
|
try {
|
|
64
56
|
const data = {
|
|
65
57
|
phone: _getPhone(call.src)
|
|
@@ -177,10 +169,19 @@ export function usePlivo(callback) {
|
|
|
177
169
|
return res;
|
|
178
170
|
};
|
|
179
171
|
const plivoRemoveCallBack = () => {
|
|
172
|
+
plivoBrowserSdk?.client?.off?.('onCallAnswered', handleCallAnswered);
|
|
173
|
+
plivoBrowserSdk?.client?.off?.('onCallTerminated', handleCallTerminated);
|
|
174
|
+
plivoBrowserSdk.client.off('onCallFailed', handleCallFailed);
|
|
175
|
+
plivoBrowserSdk.client.off('onIncomingCallCanceled', handleIncomingCallCanceled);
|
|
176
|
+
// plivoBrowserSdk.client.on('onCalling', (data: any) => console.log('onCallFailed', data))
|
|
177
|
+
plivoBrowserSdk?.client?.off?.('onIncomingCall', handleIncomingCall);
|
|
178
|
+
plivoBrowserSdk.client.off('onCallRemoteRinging', handleCallRemoteRinging);
|
|
179
|
+
plivoBrowserSdk.client.off('onMediaPermission', handleMediaPermission);
|
|
180
|
+
plivoBrowserSdk?.client?.off?.('onLoginFailed', handleLoginFailed);
|
|
180
181
|
plivoBrowserSdk = null;
|
|
181
182
|
};
|
|
182
183
|
const sleep = () => {
|
|
183
|
-
return new Promise(resolve => setTimeout(resolve, 2000));
|
|
184
|
+
return new Promise((resolve) => setTimeout(resolve, 2000));
|
|
184
185
|
};
|
|
185
186
|
return {
|
|
186
187
|
plivoLogin,
|