UNPKG

@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,

98 lines (97 loc) 3.66 kB
import { defineComponent, ref, computed, createElementBlock, createCommentVNode, unref, openBlock, normalizeClass, createElementVNode, createVNode, toDisplayString } from "vue"; import TUICore, { TUIConstants } from "@tencentcloud/tui-core"; import TUIChatEngine from "@tencentcloud/chat-uikit-engine"; import "../../../adapter-vue.mjs"; import { JSONToObject } from "../../../utils/type-check.mjs"; import Icon from "../../../components/common/Icon.vue.mjs"; import callVideoSVG from "../../../assets/icon/call-video.svg.mjs"; import callVoiceSVG from "../../../assets/icon/call-voice.svg.mjs"; import OfflinePushInfoManager from "../../../components/TUIChat/offlinePushInfoManager/index.mjs"; import { PUSH_SCENE } from "../../../components/TUIChat/offlinePushInfoManager/const.mjs"; const _hoisted_1 = { class: "call-content" }; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "message-call-c2c", props: { message: { type: Object, default: () => ({}) }, signalingInfo: { type: Object, default: () => ({}) }, customContent: { type: Object, default: () => ({}) } }, setup(__props) { const props = __props; const TYPES = ref(TUIChatEngine.TYPES); const isCallMessage = computed(() => props.signalingInfo != null); const callInfo = computed(() => { var _a, _b; const callType = (_b = JSONToObject((_a = props.signalingInfo) == null ? void 0 : _a.data)) == null ? void 0 : _b.call_type; switch (callType) { case 1: return { type: 1, icon: callVoiceSVG }; case 2: return { type: 2, icon: callVideoSVG }; } return { type: 0, icon: "" }; }); const conversationType = computed(() => { var _a; return (_a = props.message) == null ? void 0 : _a.conversationType; }); const custom = computed(() => { var _a; return (_a = props.customContent) == null ? void 0 : _a.custom; }); const callAgain = () => { var _a, _b, _c, _d; if (conversationType.value === TUIChatEngine.TYPES.CONV_C2C) { const userID = ((_a = props.message) == null ? void 0 : _a.flow) === "out" ? (_b = props.message) == null ? void 0 : _b.to : (_c = props.message) == null ? void 0 : _c.from; TUICore.callService({ serviceName: TUIConstants.TUICalling.SERVICE.NAME, method: TUIConstants.TUICalling.SERVICE.METHOD.START_CALL, params: { userIDList: [userID], type: (_d = callInfo == null ? void 0 : callInfo.value) == null ? void 0 : _d.type, callParams: { offlinePushInfo: OfflinePushInfoManager.getOfflinePushInfo(PUSH_SCENE.CALL) } } }); } }; return (_ctx, _cache) => { return unref(isCallMessage) && unref(conversationType) === unref(TYPES).CONV_C2C ? (openBlock(), createElementBlock("div", { key: 0, class: normalizeClass(["call", ["call-" + unref(conversationType), __props.message.flow === "out" && "call-reverse"]]), onClick: callAgain }, [ createElementVNode("div", { class: normalizeClass(["icon", __props.message.flow === "out" && unref(callInfo).type === 2 && "icon-reverse"]) }, [ createVNode(Icon, { file: unref(callInfo).icon }, null, 8, ["file"]) ], 2), createElementVNode("span", _hoisted_1, toDisplayString(unref(custom)), 1) ], 2)) : createCommentVNode("", true); }; } }); export { _sfc_main as default };