@tencentcloud/roomkit-web-vue3
Version:
<h1 align="center"> TUIRoomKit</h1> Conference (TUIRoomKit) is a product suitable for multi-person audio and video conversation scenarios such as business meetings, webinars, and online education. By integrating this product, you can add room management,
207 lines (206 loc) • 5.82 kB
JavaScript
"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const pinia = require("pinia");
const common = require("../utils/common.js");
const render = require("../constants/render.js");
const utils = require("../utils/utils.js");
const environment = require("../utils/environment.js");
function getDefaultLayout() {
if (environment.isMobile) {
return environment.isWeChat ? render.LAYOUT.SIX_EQUAL_POINTS : render.LAYOUT.LARGE_SMALL_WINDOW;
}
return render.LAYOUT.NINE_EQUAL_POINTS;
}
const useBasicStore = pinia.defineStore("basic", {
state: () => ({
sdkAppId: 0,
userId: "",
userSig: "",
userName: "",
avatarUrl: "",
useStringRoomId: false,
roomId: "",
roomMode: "FreeSpeech",
isSidebarOpen: false,
layout: getDefaultLayout(),
showSettingDialog: false,
showApplyUserList: false,
activeSettingTab: "audio",
isLocalStreamMirror: true,
isFrontCamera: true,
sidebarName: "",
masterUserId: "",
localQuality: 0,
networkInfo: {
userId: "",
downLoss: 0,
quality: 0,
upLoss: 0,
delay: 0
},
lang: common.getLanguage(),
defaultTheme: "dark",
isSupportSwitchTheme: true,
showHeaderTool: true,
shareLink: "",
isRoomLinkVisible: !environment.isElectron && !environment.isWeChat,
isSchemeLinkVisible: !environment.isMobile,
isShowScreenShareAntiFraud: false,
isCheckMessageLimitLink: false,
isExperiencedAI: false,
componentConfig: {
SwitchTheme: {
visible: true
},
InviteControl: {
visible: true
},
RoomLink: {
visible: true
}
},
scene: "default",
showRoomTool: true
}),
getters: {},
actions: {
setSdkAppId(sdkAppId) {
this.sdkAppId = sdkAppId;
},
setUserId(userId) {
this.userId = userId;
},
setUserSig(userSig) {
this.userSig = userSig;
},
setUserName(userName) {
this.userName = userName;
},
setAvatarUrl(avatarUrl) {
this.avatarUrl = avatarUrl;
},
setRoomId(roomId) {
this.roomId = roomId;
this.useStringRoomId = typeof roomId === "string";
},
setSidebarOpenStatus(isOpen) {
this.isSidebarOpen = isOpen;
},
setSidebarName(name) {
this.sidebarName = name;
},
setLayout(layout) {
this.layout = layout;
},
setShowSettingDialog(show) {
this.showSettingDialog = show;
},
setShowApplyUserList(show) {
this.showApplyUserList = show;
},
setActiveSettingTab(tabName) {
this.activeSettingTab = tabName;
},
setIsLocalStreamMirror(mirror) {
this.isLocalStreamMirror = mirror;
},
setIsFrontCamera(isFront) {
this.isFrontCamera = isFront;
},
setDefaultTheme(defaultTheme) {
this.defaultTheme = defaultTheme;
},
setIsSupportSwitchTheme(isSupportSwitchTheme) {
this.isSupportSwitchTheme = isSupportSwitchTheme;
},
setShowHeaderTool(showHeaderTool) {
this.showHeaderTool = showHeaderTool;
},
setShareLink(shareLink) {
this.shareLink = shareLink;
},
setIsRoomLinkVisible(isRoomLinkVisible) {
this.isRoomLinkVisible = isRoomLinkVisible;
},
setIsSchemeLinkVisible(isSchemeLinkVisible) {
this.isSchemeLinkVisible = isSchemeLinkVisible;
},
setIsShowScreenShareAntiFraud(isShowScreenShareAntiFraud) {
this.isShowScreenShareAntiFraud = isShowScreenShareAntiFraud;
},
setIsExperiencedAI(isExperiencedAI) {
this.isExperiencedAI = isExperiencedAI;
},
setIsCheckMessageLimitLink(isCheckMessageLimitLink) {
this.isCheckMessageLimitLink = isCheckMessageLimitLink;
},
setBasicInfo(infoObj) {
if (!infoObj) {
return;
}
const {
sdkAppId,
userId,
userSig,
userName,
avatarUrl,
roomId,
theme,
showHeaderTool
} = infoObj;
sdkAppId && this.setSdkAppId(sdkAppId);
userId && this.setUserId(userId);
userSig && this.setUserSig(userSig);
userName && this.setUserName(userName);
avatarUrl && this.setAvatarUrl(avatarUrl);
roomId && this.setRoomId(roomId);
theme && !utils.isUndefined(theme.defaultTheme) && this.setDefaultTheme(theme.defaultTheme);
theme && !utils.isUndefined(theme.isSupportSwitchTheme) && this.setIsSupportSwitchTheme(theme.isSupportSwitchTheme);
!utils.isUndefined(showHeaderTool) && this.setShowHeaderTool(showHeaderTool);
},
setMasterUserId(userId) {
this.masterUserId = userId;
},
setLocalQuality(userNetworkList) {
const localUser = userNetworkList.find(
(item) => item.userId === this.userId
);
this.localQuality = localUser.quality;
},
setNetworkInfo(networkInfo) {
if (networkInfo.userId === this.userId) {
this.networkInfo = networkInfo;
}
},
setLang(lang) {
this.lang = lang;
},
setScene(scene) {
this.scene = scene;
},
setShowRoomTool(isShow) {
this.showRoomTool = isShow;
},
reset() {
this.isSidebarOpen = false;
this.layout = getDefaultLayout();
this.showSettingDialog = false;
this.activeSettingTab = "audio";
this.isLocalStreamMirror = true;
this.sidebarName = "";
this.masterUserId = "";
this.localQuality = 0;
this.roomId = "";
this.useStringRoomId = false;
this.roomMode = "FreeSpeech";
this.showApplyUserList = false;
this.isFrontCamera = true;
this.showHeaderTool = true;
this.shareLink = "";
this.showRoomTool = false;
this.isExperiencedAI = false;
this.isCheckMessageLimitLink = false;
}
}
});
exports.useBasicStore = useBasicStore;