Socket
Socket
Sign inDemoInstall

@tencentcloud/call-uikit-wechat

Package Overview
Dependencies
Maintainers
14
Versions
93
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@tencentcloud/call-uikit-wechat - npm Package Compare versions

Comparing version 3.3.1 to 3.3.2

src/Components/assets/streamInfo/networkStatus.svg

2

package.json
{
"name": "@tencentcloud/call-uikit-wechat",
"version": "3.3.1",
"version": "3.3.2",
"main": "./tuicall-uikit-vue.umd.js",

@@ -5,0 +5,0 @@ "module": "./tuicall-uikit-vue.es.js",

@@ -35,3 +35,3 @@ const Trigger = ['click','hover'] as const;

default: 300,
}
},
};

@@ -30,2 +30,6 @@ export const StreamInfoProps = {

},
showNetWorkStatus: {
type: Boolean,
default: false,
}
};

@@ -5,2 +5,3 @@ export * from './useCallerUserInfoContext';

export * from './useTip';
export * from './useNetWorkStatus';
export * from './usePlayer';

@@ -7,0 +8,0 @@ export * from './useUserInfoContextExcludeVolume';

@@ -17,3 +17,3 @@ import {

} from './TUICallService/index';
const Version = '3.3.1'; // basic-demo 原来上报使用
const Version = '3.3.2'; // basic-demo 原来上报使用

@@ -20,0 +20,0 @@ // 输出产物

@@ -36,2 +36,5 @@ import { TUICore, TUILogin, TUIConstants, ExtensionInfo } from '@tencentcloud/tui-core';

LayoutMode,
DEFAULT_BLUR_LEVEL,
NETWORK_QUALITY_THRESHOLD,
DeviceType,
} from '../const/index';

@@ -46,3 +49,3 @@ // @ts-ignore

import { VALIDATE_PARAMS, avoidRepeatedCall, paramValidate } from '../utils/validate/index';
import { handleRepeatedCallError, handleNoDevicePermissionError, formatTime, performanceNow } from '../utils/common-utils';
import { handleRepeatedCallError, handleNoDevicePermissionError, formatTime, performanceNow, isUndefined } from '../utils/common-utils';
import {

@@ -57,2 +60,3 @@ getMyProfile,

updateStoreBasedOnGroupAttributes,
updateRoomIdAndRoomIdType,
} from './utils';

@@ -69,4 +73,3 @@ import timer from '../utils/timer';

uiDesign.setTUIStore(TUIStore);
const version = '3.3.1';
const version = '3.3.2';
export { TUIGlobal, TUIStore, uiDesign };

@@ -312,3 +315,8 @@

public async accept() {
if (TUIStore.getData(StoreName.CALL, NAME.CALL_STATUS) === CallStatus.CONNECTED) return; // avoid double click when application stuck, especially for miniProgram
const callStatus = TUIStore.getData(StoreName.CALL, NAME.CALL_STATUS);
this._tuiCallEngine?.reportLog?.({
name: 'TUICallKit.accept.start',
data: { callStatus },
});
if (callStatus === CallStatus.CONNECTED) return; // avoid double click when application stuck, especially for miniProgram
try {

@@ -333,2 +341,7 @@ const response = await this._tuiCallEngine.accept();

} catch (error) {
this._tuiCallEngine?.reportLog?.({
name: 'TUICallKit.accept.fail',
level: 'error',
error,
});
if (handleRepeatedCallError(error)) return;

@@ -494,2 +507,4 @@ this._noDevicePermissionToast(error, CallMediaType.AUDIO);

this._tuiCallEngine.on(TUICallEvent.MESSAGE_SENT_BY_ME, this._messageSentByMe, this);
// @ts-ignore
TUICallEvent.ON_USER_NETWORK_QUALITY_CHANGED && this._tuiCallEngine.on(TUICallEvent.ON_USER_NETWORK_QUALITY_CHANGED, this._handleNetworkQuality, this); // 用户网络质量
this._tuiCallEngine.on(TUICallEvent.CALL_END, this._handleCallingEnd, this); // 主被叫在通话结束时, 收到的通话结束事件

@@ -514,2 +529,4 @@ // @ts-ignore

this._tuiCallEngine.off(TUICallEvent.MESSAGE_SENT_BY_ME, this._messageSentByMe);
// @ts-ignore
TUICallEvent.ON_USER_NETWORK_QUALITY_CHANGED && this._tuiCallEngine.off(TUICallEvent.ON_USER_NETWORK_QUALITY_CHANGED, this._handleNetworkQuality, this);
this._tuiCallEngine.off(TUICallEvent.CALL_END, this._handleCallingEnd);

@@ -535,3 +552,3 @@ // @ts-ignore

console.log(`${NAME.PREFIX}onCallReceived event data: ${JSON.stringify(event)}.`);
const { sponsor = '', isFromGroup, callMediaType, inviteData = {}, calleeIdList = [], groupID = '' } = this._analyzeEventData(event);
const { sponsor = '', isFromGroup, callMediaType, inviteData = {}, calleeIdList = [], groupID = '', roomID, strRoomID } = this._analyzeEventData(event);
const currentUserInfo: IUserInfo = TUIStore.getData(StoreName.CALL, NAME.LOCAL_USER_INFO);

@@ -553,2 +570,3 @@ const remoteUserIdList: string[] = [sponsor, ...calleeIdList.filter((userId: string) => userId !== currentUserInfo.userId)];

updateStoreParams = { ...updateStoreParams, [NAME.PUSHER]: pusher };
updateRoomIdAndRoomIdType(TUIStore, roomID, strRoomID);
TUIStore.updateStore(updateStoreParams, StoreName.CALL);

@@ -708,2 +726,21 @@ this._executeExternalBeforeCalling();

}
private _handleNetworkQuality(event) {
const { networkQualityList = [] } = this._analyzeEventData(event);
TUIStore.update(StoreName.CALL, NAME.NETWORK_STATUS, networkQualityList);
const isGroup = TUIStore.getData(StoreName.CALL, NAME.IS_GROUP);
const localUserInfo = TUIStore.getData(StoreName.CALL, NAME.LOCAL_USER_INFO);
const remoteUserInfoList = TUIStore.getData(StoreName.CALL, NAME.REMOTE_USER_INFO_LIST);
if(!isGroup) {
const isRemoteNetworkPoor = networkQualityList.find(user => remoteUserInfoList[0]?.userId === user?.userId && user?.quality >= NETWORK_QUALITY_THRESHOLD);
if(isRemoteNetworkPoor) {
TUIStore.update(StoreName.CALL, NAME.CALL_TIPS, t(CallTips.THE_OTHER_USER_NETWORK_IS_POOR_DURING_THE_CURRENT_CALL));
return;
};
const isLocalNetworkPoor = networkQualityList.find(user => localUserInfo?.userId === user?.userId && user?.quality >= NETWORK_QUALITY_THRESHOLD);
if(isLocalNetworkPoor) {
TUIStore.update(StoreName.CALL, NAME.CALL_TIPS, t(CallTips.THE_NETWORK_IS_POOR_DURING_YOUR_CURRENT_CALL));
return;
}
}
}
// ==========================【 miniProgram 私有事件】==========================

@@ -823,3 +860,3 @@ private _handleUserUpdate(event: any): void {

TUIStore.update(StoreName.CALL, NAME.IS_CLICKABLE, true);
TUIStore.update(StoreName.CALL, NAME.ROOM_ID, response.roomID);
updateRoomIdAndRoomIdType(TUIStore, response?.roomID, response?.strRoomID);
const callMediaType = TUIStore.getData(StoreName.CALL, NAME.CALL_MEDIA_TYPE);

@@ -840,15 +877,2 @@ this._callTUIService({ message: response?.data?.message });

}
private _resetCurrentDevice() {
// 挂断后,重置当前摄像头,麦克风和扬声器为默认设备
const { cameraList, microphoneList, speakerList } = TUIStore.getData(StoreName.CALL, NAME.DEVICE_LIST);
TUIStore.update(
StoreName.CALL,
NAME.DEVICE_LIST,
{ microphoneList, cameraList, speakerList,
currentCamera: cameraList?.[0] || {},
currentMicrophone: microphoneList?.[0] || {},
currentSpeaker: speakerList?.[0] || {}
},
);
}
private _resetCallStore() {

@@ -899,3 +923,2 @@ const oldStatusStr = generateStatusChangeText(TUIStore);

TUIStore.update(StoreName.CALL, NAME.REMOTE_USER_INFO_EXCLUDE_VOLUMN_LIST, []);
this._resetCurrentDevice();
const newStatusStr = generateStatusChangeText(TUIStore);

@@ -1096,3 +1119,8 @@ if (oldStatusStr !== newStatusStr) {

if (extensionID === TUIConstants.TUIChat.EXTENSION.INPUT_MORE.EXT_ID) {
const list = [];
this._tuiCallEngine?.reportLog?.({ name: 'TUICallKit.onGetExtension', data: { extensionID, params } });
if (isUndefined(params)) return [];
// room and customer_service ChatType not show audio and video icon.
if ([TUIConstants.TUIChat.TYPE.ROOM, TUIConstants.TUIChat.TYPE.CUSTOMER_SERVICE].includes(params.chatType)) return [];
let list = [];
const audioCallExtension: ExtensionInfo = {

@@ -1120,8 +1148,9 @@ weight: 1000,

};
if (!params?.filterVoice) {
list.push(audioCallExtension);
if (params?.chatType) {
list = [audioCallExtension, videoCallExtension];
} else {
!params?.filterVoice && list.push(audioCallExtension);
!params?.filterVideo && list.push(videoCallExtension);
}
if (!params?.filterVideo) {
list.push(videoCallExtension);
}
return list;

@@ -1128,0 +1157,0 @@ }

@@ -1,2 +0,2 @@

import { NAME, StoreName, CallStatus, StatusChange, CallMediaType, CallType } from '../const/index';
import { NAME, StoreName, CallStatus, StatusChange, CallMediaType, CallType, ROOM_ID_TYPE } from '../const/index';
import { IUserInfo } from '../interface/ICallService';

@@ -184,1 +184,16 @@ import { ITUIStore } from '../interface/ITUIStore';

}
/**
* update roomId and roomIdType
* @param {ITUIStore} TUIStore TUIStore instance
* @param {number} roomId number roomId
* @param {string} strRoomId string roomId
*/
export function updateRoomIdAndRoomIdType(TUIStore: ITUIStore, roomId, strRoomId) {
if (roomId === 0 && strRoomId) { // use strRoomID
TUIStore.update(StoreName.CALL, NAME.ROOM_ID, strRoomId);
TUIStore.update(StoreName.CALL, NAME.ROOM_ID_TYPE, ROOM_ID_TYPE.STRING_ROOM_ID);
} else {
TUIStore.update(StoreName.CALL, NAME.ROOM_ID, roomId);
TUIStore.update(StoreName.CALL, NAME.ROOM_ID_TYPE, ROOM_ID_TYPE.NUMBER_ROOM_ID);
}
}

@@ -119,2 +119,3 @@ /**

SwitchCamera = 'switchCamera',
InviteUser = 'inviteUser',
}

@@ -121,0 +122,0 @@

@@ -5,6 +5,2 @@ export * from './call';

// import { keys } from 'ts-transformer-keys';
// import { ICallStore } from '../interface/store';
// console.warn('--> ', keys<ICallStore>())
export const CALL_DATA_KEY: any = {

@@ -34,2 +30,3 @@ CALL_STATUS: 'callStatus',

SHOW_PERMISSION_TIP: 'SHOW_PERMISSION_TIP',
NETWORK_STATUS: 'NetWorkStatus',
GROUP_ID: 'groupID',

@@ -78,2 +75,4 @@ ROOM_ID: 'roomID',

export const MAX_NUMBER_ROOM_ID = 2147483647;
export const DEFAULT_BLUR_LEVEL = 3;
export const NETWORK_QUALITY_THRESHOLD = 4;
export enum PLATFORM {

@@ -91,1 +90,7 @@ // eslint-disable-next-line no-unused-vars

};
export enum ROOM_ID_TYPE {
// eslint-disable-next-line no-unused-vars
NUMBER_ROOM_ID = 1,
// eslint-disable-next-line no-unused-vars
STRING_ROOM_ID = 2,
};

@@ -102,1 +102,6 @@ import { CallStatus, CallRole } from '../const/index';

}
export interface INetWorkQuality {
userId: string;
quality: number
}
import { CallStatus, CallRole, CallMediaType, VideoDisplayMode, VideoResolution, TDeviceList, CameraPosition, ICustomUIConfig } from '../const/index';
import { IUserInfo } from './index';
import { IUserInfo, INetWorkQuality } from './index';

@@ -29,5 +29,6 @@ export interface IToastInfo {

showPermissionTip: boolean; // 设备权限弹窗是否展示(如果有麦克风权限为 false,如果没有麦克风也没有摄像头权限为 true)
netWorkQualityList: Array<INetWorkQuality>; // 通话中用户的网络状态
deviceList: TDeviceList;
groupID: string;
roomID: number;
roomID: number | string;
roomIdType: number;

@@ -34,0 +35,0 @@ cameraPosition: CameraPosition; // 前置或后置,值为front, back

@@ -49,2 +49,12 @@ import { StoreName } from '../const/index';

/**
* 获取 store 中的上一个状态
* @function
* @param {StoreName} storeName store 名称
* @param {String} key 需要获取的 key
* @private
*/
getPrevData(storeName: StoreName, key: string): any;
/**
* 获取 store 中的数据

@@ -51,0 +61,0 @@ * @function

@@ -63,2 +63,5 @@ export const en = {

"Supports a maximum of 9 people for simultaneous calls": "Supports a maximum of 9 people for simultaneous calls",
'you': '(you)',
"The network is poor during your current call": "The network is poor during your current call",
"The other user network is poor during the current call": "The other party's network is poor during the current call",
// 待废弃文案

@@ -65,0 +68,0 @@ 'Those involved': 'Those involved in the call are',

@@ -25,2 +25,4 @@ import { TUIStore } from '../CallService/index';

EXIST_GROUP_CALL: 'exist group call',
THE_NETWORK_IS_POOR_DURING_YOUR_CURRENT_CALL: 'The network is poor during your current call',
THE_OTHER_USER_NETWORK_IS_POOR_DURING_THE_CURRENT_CALL: 'The other user network is poor during the current call',
};

@@ -27,0 +29,0 @@

@@ -57,2 +57,5 @@ export const ja_JP = {

"Supports a maximum of 9 people for simultaneous calls": "最大で9人まで同時通話が可能です",
'you': '(あなた)',
"The network is poor during your current call": "現在の通話で、あなたのネットワークは不良です",
"The other user network is poor during the current call": "現在の通話で、相手側のネットワークが不良です",
// 待废弃文案

@@ -59,0 +62,0 @@ 'timeout': 'タイムアウト',

@@ -63,2 +63,5 @@ export const zh = {

"Supports a maximum of 9 people for simultaneous calls": "最多支持9人同时通话",
'you': '(你)',
"The network is poor during your current call": "当前通话你的网络不佳",
"The other user network is poor during the current call": "当前通话对方网络不佳",
// 待废弃文案

@@ -65,0 +68,0 @@ 'timeout': '超时',

@@ -1,4 +0,5 @@

import { CallStatus, CallRole, CallMediaType, VideoDisplayMode, VideoResolution, CameraPosition, LayoutMode } from '../const/index';
import { CallStatus, CallRole, CallMediaType, VideoDisplayMode, VideoResolution, CameraPosition, LayoutMode, NAME } from '../const/index';
import { ICallStore } from '../interface/ICallStore';
import { getLanguage } from '../utils/common-utils';
import { deepClone } from "../utils/index";

@@ -26,2 +27,3 @@ export default class CallStore {

showPermissionTip: false,
netWorkQualityList: [], // 显示网络状态差的提示
groupID: '',

@@ -51,8 +53,10 @@ roomID: 0,

};
public store: ICallStore = Object.assign({}, this.defaultStore);;
public store: ICallStore = deepClone(this.defaultStore);
public prevStore: ICallStore = deepClone(this.defaultStore);
public update(key: keyof ICallStore, data: any): void {
switch (key) {
// case 'callTips':
// break;
case NAME.CALL_TIPS:
const preData = this.getData(key);
(this.prevStore[key] as any) = preData;
default:

@@ -64,2 +68,7 @@ // resolve "Type 'any' is not assignable to type 'never'.ts", ref: https://github.com/microsoft/TypeScript/issues/31663

public getPrevData(key: string | undefined): any {
if (!key) return this.prevStore;
return this.prevStore[key as keyof ICallStore];
}
public getData(key: string | undefined): any {

@@ -66,0 +75,0 @@ if (!key) return this.store;

@@ -107,2 +107,12 @@ import { ITUIStore, IOptions, Task } from '../interface/ITUIStore';

/**
* 获取 Store 的上一个状态值
* @param {StoreName} storeName store 名称
* @param {string} key 待获取的 key
* @returns {Any}
*/
getPrevData(storeName: StoreName, key: string) {
return this.storeMap[storeName]?.getPrevData(key);
}
/**
* 获取 Store 数据

@@ -109,0 +119,0 @@ * @param {StoreName} storeName store 名称

@@ -20,2 +20,7 @@ import { NAME } from '../../const/index';

// throw new Error(`previous ${name}() is ongoing, please avoid repeated calls`);
this?.getTUICallEngineInstance()?.reportLog?.({
name: 'TUICallKit.avoidRepeatedCall.fail',
data: { name },
error: `previous ${name}() is ongoing`,
});
return;

@@ -22,0 +27,0 @@ }

@@ -43,2 +43,7 @@ import { NAME, MAX_NUMBER_ROOM_ID, VideoResolution, VideoDisplayMode } from "../../const/index";

},
strRoomID: {
required: false,
rules: [NAME.STRING],
allowEmpty: true,
},
userData: {

@@ -78,2 +83,7 @@ required: false,

},
strRoomID: {
required: false,
rules: [NAME.STRING],
allowEmpty: true,
},
timeout: {

@@ -112,2 +122,7 @@ required: false,

},
strRoomID: {
required: false,
rules: [NAME.STRING],
allowEmpty: true,
},
},

@@ -114,0 +129,0 @@ inviteUser: {

@@ -30,2 +30,6 @@ export declare const StreamInfoProps: {

};
showNetWorkStatus: {
type: BooleanConstructor;
default: boolean;
};
};

@@ -6,2 +6,3 @@ export * from './useCallerUserInfoContext';

export * from './useTip';
export * from './useNetWorkStatus';
export * from './usePlayer';

@@ -8,0 +9,0 @@ export * from './useUserInfoContextExcludeVolume';

@@ -74,2 +74,3 @@ import { ITUICallService, ICallParams, IGroupCallParams, ICallbackParam, ISelfInfoParams, IInviteUserParams, IJoinInGroupCallParams, IInitParams } from '../interface/ICallService';

private _messageSentByMe;
private _handleNetworkQuality;
private _handleUserVideoAvailable;

@@ -102,3 +103,2 @@ private _handleUserAudioAvailable;

private _updateCallStoreAfterCall;
private _resetCurrentDevice;
private _resetCallStore;

@@ -105,0 +105,0 @@ private _noDevicePermissionToast;

@@ -12,1 +12,8 @@ import { IUserInfo } from '../interface/ICallService';

export declare function updateStoreBasedOnGroupAttributes(groupAttributes: any, TUIStore: ITUIStore, that: any): Promise<void>;
/**
* update roomId and roomIdType
* @param {ITUIStore} TUIStore TUIStore instance
* @param {number} roomId number roomId
* @param {string} strRoomId string roomId
*/
export declare function updateRoomIdAndRoomIdType(TUIStore: ITUIStore, roomId: any, strRoomId: any): void;

@@ -107,3 +107,4 @@ /**

Microphone = "microphone",
SwitchCamera = "switchCamera"
SwitchCamera = "switchCamera",
InviteUser = "inviteUser"
}

@@ -110,0 +111,0 @@ export declare enum ButtonState {

@@ -10,2 +10,4 @@ export * from './call';

export declare const MAX_NUMBER_ROOM_ID = 2147483647;
export declare const DEFAULT_BLUR_LEVEL = 3;
export declare const NETWORK_QUALITY_THRESHOLD = 4;
export declare enum PLATFORM {

@@ -19,1 +21,5 @@ MAC = "mac",

}
export declare enum ROOM_ID_TYPE {
NUMBER_ROOM_ID = 1,
STRING_ROOM_ID = 2
}

@@ -97,2 +97,6 @@ import { CallStatus, CallRole } from '../const/index';

}
export interface INetWorkQuality {
userId: string;
quality: number;
}
export {};
import { CallStatus, CallRole, CallMediaType, VideoDisplayMode, VideoResolution, TDeviceList, CameraPosition, ICustomUIConfig } from '../const/index';
import { IUserInfo } from './index';
import { IUserInfo, INetWorkQuality } from './index';
export interface IToastInfo {

@@ -26,5 +26,6 @@ text: string;

showPermissionTip: boolean;
netWorkQualityList: Array<INetWorkQuality>;
deviceList: TDeviceList;
groupID: string;
roomID: number;
roomID: number | string;
roomIdType: number;

@@ -31,0 +32,0 @@ cameraPosition: CameraPosition;

@@ -42,2 +42,10 @@ import { StoreName } from '../const/index';

/**
* 获取 store 中的上一个状态
* @function
* @param {StoreName} storeName store 名称
* @param {String} key 需要获取的 key
* @private
*/
getPrevData(storeName: StoreName, key: string): any;
/**
* 获取 store 中的数据

@@ -44,0 +52,0 @@ * @function

@@ -58,2 +58,5 @@ export declare const en: {

"Supports a maximum of 9 people for simultaneous calls": string;
you: string;
"The network is poor during your current call": string;
"The other user network is poor during the current call": string;
'Those involved': string;

@@ -60,0 +63,0 @@ call: string;

@@ -52,2 +52,5 @@ export declare const ja_JP: {

"Supports a maximum of 9 people for simultaneous calls": string;
you: string;
"The network is poor during your current call": string;
"The other user network is poor during the current call": string;
timeout: string;

@@ -54,0 +57,0 @@ 'kick out': string;

@@ -58,2 +58,5 @@ export declare const zh: {

"Supports a maximum of 9 people for simultaneous calls": string;
you: string;
"The network is poor during your current call": string;
"The other user network is poor during the current call": string;
timeout: string;

@@ -60,0 +63,0 @@ 'kick out': string;

@@ -5,5 +5,7 @@ import { ICallStore } from '../interface/ICallStore';

store: ICallStore;
prevStore: ICallStore;
update(key: keyof ICallStore, data: any): void;
getPrevData(key: string | undefined): any;
getData(key: string | undefined): any;
reset(keyList?: Array<string>): void;
}

@@ -36,2 +36,9 @@ import { ITUIStore, IOptions, Task } from '../interface/ITUIStore';

/**
* 获取 Store 的上一个状态值
* @param {StoreName} storeName store 名称
* @param {string} key 待获取的 key
* @returns {Any}
*/
getPrevData(storeName: StoreName, key: string): any;
/**
* 获取 Store 数据

@@ -38,0 +45,0 @@ * @param {StoreName} storeName store 名称

@@ -42,2 +42,7 @@ import { VideoResolution, VideoDisplayMode } from "../../const/index";

};
strRoomID: {
required: boolean;
rules: any[];
allowEmpty: boolean;
};
userData: {

@@ -77,2 +82,7 @@ required: boolean;

};
strRoomID: {
required: boolean;
rules: any[];
allowEmpty: boolean;
};
timeout: {

@@ -111,2 +121,7 @@ required: boolean;

};
strRoomID: {
required: boolean;
rules: any[];
allowEmpty: boolean;
};
};

@@ -113,0 +128,0 @@ inviteUser: {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc