298 lines
13 KiB
JavaScript
298 lines
13 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../../../common/vendor.js");
|
|
require("../../../adapter-vue.js");
|
|
const TUIKit_components_TUIChat_config = require("../config.js");
|
|
const TUIKit_utils_enableSampleTaskStatus = require("../../../utils/enableSampleTaskStatus.js");
|
|
const TUIKit_components_TUIChat_offlinePushInfoManager_index = require("../offlinePushInfoManager/index.js");
|
|
const TUIKit_components_TUIChat_offlinePushInfoManager_const = require("../offlinePushInfoManager/const.js");
|
|
if (!Math) {
|
|
(EmojiPickerDialog + ImageUpload + VideoUpload + ToolbarItemContainer + Evaluate + Words + CustomMessage + UserSelector)();
|
|
}
|
|
const ImageUpload = () => "./image-upload/index.js";
|
|
const VideoUpload = () => "./video-upload/index.js";
|
|
const Evaluate = () => "./evaluate/index.js";
|
|
const Words = () => "./words/index.js";
|
|
const ToolbarItemContainer = () => "./toolbar-item-container/index.js";
|
|
const EmojiPickerDialog = () => "./emoji-picker/emoji-picker-dialog.js";
|
|
const UserSelector = () => "./user-selector/index.js";
|
|
const CustomMessage = () => "./evaluate/CustomMessage.js";
|
|
const __default__ = {
|
|
options: {
|
|
styleIsolation: "shared"
|
|
}
|
|
};
|
|
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
...__default__,
|
|
__name: "index",
|
|
props: {
|
|
displayType: {}
|
|
},
|
|
setup(__props) {
|
|
const props = __props;
|
|
const currentConversation = common_vendor.ref();
|
|
const isGroup = common_vendor.ref(false);
|
|
const selectorShowType = common_vendor.ref("");
|
|
const userSelectorRef = common_vendor.ref();
|
|
const currentUserSelectorExtension = common_vendor.ref();
|
|
const currentExtensionList = common_vendor.ref([]);
|
|
const isSwiperIndicatorDotsEnable = common_vendor.ref(false);
|
|
const featureConfig = TUIKit_components_TUIChat_config.ChatConfig.getFeatureConfig();
|
|
const neededCountFirstPage = common_vendor.ref(8);
|
|
const slicePos = common_vendor.ref(0);
|
|
const computeToolbarPaging = () => {
|
|
if (featureConfig.InputImage && featureConfig.InputVideo) {
|
|
neededCountFirstPage.value -= 4;
|
|
} else if (featureConfig.InputImage || featureConfig.InputVideo) {
|
|
neededCountFirstPage.value -= 2;
|
|
}
|
|
slicePos.value = neededCountFirstPage.value;
|
|
neededCountFirstPage.value -= currentExtensionList.value.length;
|
|
if (neededCountFirstPage.value === 1) {
|
|
isSwiperIndicatorDotsEnable.value = featureConfig.InputEvaluation && featureConfig.InputQuickReplies;
|
|
} else if (neededCountFirstPage.value < 1) {
|
|
isSwiperIndicatorDotsEnable.value = featureConfig.InputEvaluation || featureConfig.InputQuickReplies;
|
|
}
|
|
};
|
|
common_vendor.onMounted(() => {
|
|
common_vendor.Jt.watch(common_vendor.o.CUSTOM, {
|
|
activeConversation: onActiveConversationUpdate
|
|
});
|
|
});
|
|
common_vendor.onUnmounted(() => {
|
|
common_vendor.Jt.unwatch(common_vendor.o.CUSTOM, {
|
|
activeConversation: onActiveConversationUpdate
|
|
});
|
|
});
|
|
const onActiveConversationUpdate = (conversationID) => {
|
|
var _a;
|
|
if (!conversationID) {
|
|
return;
|
|
}
|
|
if (conversationID !== ((_a = currentConversation.value) == null ? void 0 : _a.conversationID)) {
|
|
getExtensionList();
|
|
computeToolbarPaging();
|
|
currentConversation.value = common_vendor.Jt.getData(common_vendor.o.CONV, "currentConversation");
|
|
isGroup.value = conversationID.startsWith(common_vendor.qt.TYPES.CONV_GROUP);
|
|
}
|
|
};
|
|
const getExtensionList = () => {
|
|
const chatType = TUIKit_components_TUIChat_config.ChatConfig.getChatType();
|
|
const params = { chatType };
|
|
if (chatType === common_vendor.E.TUIChat.TYPE.CUSTOMER_SERVICE) {
|
|
params.filterVoice = true;
|
|
params.filterVideo = true;
|
|
TUIKit_utils_enableSampleTaskStatus.enableSampleTaskStatus("customerService");
|
|
}
|
|
currentExtensionList.value = [
|
|
...common_vendor.R.getExtensionList(common_vendor.E.TUIChat.EXTENSION.INPUT_MORE.EXT_ID, params)
|
|
].filter((extension) => {
|
|
var _a;
|
|
if (((_a = extension == null ? void 0 : extension.data) == null ? void 0 : _a.name) === "search") {
|
|
return featureConfig.MessageSearch;
|
|
}
|
|
return true;
|
|
});
|
|
reportExtension(currentExtensionList.value);
|
|
};
|
|
function reportExtension(extensionList) {
|
|
extensionList.forEach((extension) => {
|
|
var _a;
|
|
const _name = (_a = extension == null ? void 0 : extension.data) == null ? void 0 : _a.name;
|
|
if (_name === "voiceCall") {
|
|
common_vendor.ss.reportFeature(203, "voice-call");
|
|
} else if (_name === "videoCall") {
|
|
common_vendor.ss.reportFeature(203, "video-call");
|
|
} else if (_name === "quickRoom") {
|
|
common_vendor.ss.reportFeature(204);
|
|
}
|
|
});
|
|
}
|
|
const onExtensionClick = (extension) => {
|
|
var _a, _b, _c;
|
|
const extensionModel = currentExtensionList.value.find(
|
|
(targetExtension) => {
|
|
var _a2, _b2;
|
|
return ((_a2 = targetExtension == null ? void 0 : targetExtension.data) == null ? void 0 : _a2.name) === ((_b2 = extension == null ? void 0 : extension.data) == null ? void 0 : _b2.name);
|
|
}
|
|
);
|
|
switch ((_a = extensionModel == null ? void 0 : extensionModel.data) == null ? void 0 : _a.name) {
|
|
case "voiceCall":
|
|
onCallExtensionClicked(extensionModel, 1);
|
|
break;
|
|
case "videoCall":
|
|
onCallExtensionClicked(extensionModel, 2);
|
|
break;
|
|
case "search":
|
|
(_c = (_b = extensionModel == null ? void 0 : extensionModel.listener) == null ? void 0 : _b.onClicked) == null ? void 0 : _c.call(_b);
|
|
break;
|
|
}
|
|
};
|
|
const onCallExtensionClicked = (extension, callType) => {
|
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
selectorShowType.value = (_a = extension == null ? void 0 : extension.data) == null ? void 0 : _a.name;
|
|
if (((_b = currentConversation == null ? void 0 : currentConversation.value) == null ? void 0 : _b.type) === common_vendor.qt.TYPES.CONV_C2C) {
|
|
(_f = (_c = extension == null ? void 0 : extension.listener) == null ? void 0 : _c.onClicked) == null ? void 0 : _f.call(_c, {
|
|
userIDList: [(_e = (_d = currentConversation == null ? void 0 : currentConversation.value) == null ? void 0 : _d.conversationID) == null ? void 0 : _e.slice(3)],
|
|
type: callType,
|
|
callParams: {
|
|
offlinePushInfo: TUIKit_components_TUIChat_offlinePushInfoManager_index.OfflinePushInfoManager.getOfflinePushInfo(TUIKit_components_TUIChat_offlinePushInfoManager_const.PUSH_SCENE.CALL)
|
|
}
|
|
});
|
|
} else if (isGroup.value) {
|
|
currentUserSelectorExtension.value = extension;
|
|
((_g = userSelectorRef == null ? void 0 : userSelectorRef.value) == null ? void 0 : _g.toggleShow) && userSelectorRef.value.toggleShow(true);
|
|
}
|
|
};
|
|
const genExtensionIcon = (extension) => {
|
|
return extension == null ? void 0 : extension.icon;
|
|
};
|
|
const genExtensionText = (extension) => {
|
|
return extension == null ? void 0 : extension.text;
|
|
};
|
|
const onUserSelectorSubmit = (selectedInfo) => {
|
|
var _a, _b, _c;
|
|
(_c = (_b = (_a = currentUserSelectorExtension.value) == null ? void 0 : _a.listener) == null ? void 0 : _b.onClicked) == null ? void 0 : _c.call(_b, {
|
|
...selectedInfo,
|
|
callParams: {
|
|
offlinePushInfo: TUIKit_components_TUIChat_offlinePushInfoManager_index.OfflinePushInfoManager.getOfflinePushInfo(TUIKit_components_TUIChat_offlinePushInfoManager_const.PUSH_SCENE.CALL)
|
|
}
|
|
});
|
|
currentUserSelectorExtension.value = null;
|
|
};
|
|
const onUserSelectorCancel = () => {
|
|
currentUserSelectorExtension.value = null;
|
|
};
|
|
const handleSwiperDotShow = (showStatus) => {
|
|
isSwiperIndicatorDotsEnable.value = neededCountFirstPage.value <= 1 && !showStatus;
|
|
};
|
|
return (_ctx, _cache) => {
|
|
return common_vendor.e({
|
|
a: props.displayType === "emojiPicker"
|
|
}, props.displayType === "emojiPicker" ? {} : common_vendor.e({
|
|
b: common_vendor.unref(featureConfig).InputImage
|
|
}, common_vendor.unref(featureConfig).InputImage ? {
|
|
c: common_vendor.p({
|
|
imageSourceType: "camera"
|
|
})
|
|
} : {}, {
|
|
d: common_vendor.unref(featureConfig).InputImage
|
|
}, common_vendor.unref(featureConfig).InputImage ? {
|
|
e: common_vendor.p({
|
|
imageSourceType: "album"
|
|
})
|
|
} : {}, {
|
|
f: common_vendor.unref(featureConfig).InputVideo
|
|
}, common_vendor.unref(featureConfig).InputVideo ? {
|
|
g: common_vendor.p({
|
|
videoSourceType: "album"
|
|
})
|
|
} : {}, {
|
|
h: common_vendor.unref(featureConfig).InputVideo
|
|
}, common_vendor.unref(featureConfig).InputVideo ? {
|
|
i: common_vendor.p({
|
|
videoSourceType: "camera"
|
|
})
|
|
} : {}, {
|
|
j: common_vendor.unref(currentExtensionList).length > 0
|
|
}, common_vendor.unref(currentExtensionList).length > 0 ? {
|
|
k: common_vendor.f(common_vendor.unref(currentExtensionList).slice(0, common_vendor.unref(slicePos)), (extension, index, i0) => {
|
|
return common_vendor.e({
|
|
a: extension
|
|
}, extension ? {
|
|
b: common_vendor.o$1(($event) => onExtensionClick(extension), index),
|
|
c: "76f68da4-5-" + i0,
|
|
d: common_vendor.p({
|
|
iconFile: genExtensionIcon(extension),
|
|
title: genExtensionText(extension),
|
|
iconWidth: "25px",
|
|
iconHeight: "25px",
|
|
needDialog: false
|
|
})
|
|
} : {}, {
|
|
e: index
|
|
});
|
|
})
|
|
} : {}, {
|
|
l: common_vendor.unref(neededCountFirstPage) === 1
|
|
}, common_vendor.unref(neededCountFirstPage) === 1 ? common_vendor.e({
|
|
m: common_vendor.unref(featureConfig).InputEvaluation
|
|
}, common_vendor.unref(featureConfig).InputEvaluation ? {
|
|
n: common_vendor.o$1(handleSwiperDotShow)
|
|
} : common_vendor.unref(featureConfig).InputQuickReplies ? {
|
|
p: common_vendor.o$1(handleSwiperDotShow)
|
|
} : {}, {
|
|
o: common_vendor.unref(featureConfig).InputQuickReplies,
|
|
q: common_vendor.unref(featureConfig).InputCustomMessage
|
|
}, common_vendor.unref(featureConfig).InputCustomMessage ? {
|
|
r: common_vendor.o$1(handleSwiperDotShow)
|
|
} : {}) : {}, {
|
|
s: common_vendor.unref(neededCountFirstPage) > 1
|
|
}, common_vendor.unref(neededCountFirstPage) > 1 ? common_vendor.e({
|
|
t: common_vendor.unref(featureConfig).InputEvaluation
|
|
}, common_vendor.unref(featureConfig).InputEvaluation ? {
|
|
v: common_vendor.o$1(handleSwiperDotShow)
|
|
} : {}, {
|
|
w: common_vendor.unref(featureConfig).InputQuickReplies
|
|
}, common_vendor.unref(featureConfig).InputQuickReplies ? {
|
|
x: common_vendor.o$1(handleSwiperDotShow)
|
|
} : {}, {
|
|
y: common_vendor.unref(featureConfig).InputCustomMessage
|
|
}, common_vendor.unref(featureConfig).InputCustomMessage ? {
|
|
z: common_vendor.o$1(handleSwiperDotShow)
|
|
} : {}) : {}, {
|
|
A: common_vendor.unref(neededCountFirstPage) <= 1
|
|
}, common_vendor.unref(neededCountFirstPage) <= 1 ? common_vendor.e({
|
|
B: common_vendor.f(common_vendor.unref(currentExtensionList).slice(common_vendor.unref(slicePos)), (extension, index, i0) => {
|
|
return common_vendor.e({
|
|
a: extension
|
|
}, extension ? {
|
|
b: common_vendor.o$1(($event) => onExtensionClick(extension), index),
|
|
c: "76f68da4-12-" + i0,
|
|
d: common_vendor.p({
|
|
iconFile: genExtensionIcon(extension),
|
|
title: genExtensionText(extension),
|
|
iconWidth: "25px",
|
|
iconHeight: "25px",
|
|
needDialog: false
|
|
})
|
|
} : {}, {
|
|
e: index
|
|
});
|
|
}),
|
|
C: common_vendor.unref(neededCountFirstPage) === 1
|
|
}, common_vendor.unref(neededCountFirstPage) === 1 ? common_vendor.e({
|
|
D: common_vendor.unref(featureConfig).InputQuickReplies
|
|
}, common_vendor.unref(featureConfig).InputQuickReplies ? {
|
|
E: common_vendor.o$1(handleSwiperDotShow)
|
|
} : {}) : common_vendor.e({
|
|
F: common_vendor.unref(featureConfig).InputEvaluation
|
|
}, common_vendor.unref(featureConfig).InputEvaluation ? {
|
|
G: common_vendor.o$1(handleSwiperDotShow)
|
|
} : {}, {
|
|
H: common_vendor.unref(featureConfig).InputQuickReplies
|
|
}, common_vendor.unref(featureConfig).InputQuickReplies ? {
|
|
I: common_vendor.o$1(handleSwiperDotShow)
|
|
} : {}, {
|
|
J: common_vendor.unref(featureConfig).InputCustomMessage
|
|
}, common_vendor.unref(featureConfig).InputCustomMessage ? {
|
|
K: common_vendor.o$1(handleSwiperDotShow)
|
|
} : {})) : {}, {
|
|
L: common_vendor.unref(isSwiperIndicatorDotsEnable)
|
|
}), {
|
|
M: common_vendor.sr(userSelectorRef, "76f68da4-17", {
|
|
"k": "userSelectorRef"
|
|
}),
|
|
N: common_vendor.o$1(onUserSelectorSubmit),
|
|
O: common_vendor.o$1(onUserSelectorCancel),
|
|
P: common_vendor.p({
|
|
type: common_vendor.unref(selectorShowType),
|
|
currentConversation: common_vendor.unref(currentConversation),
|
|
isGroup: common_vendor.unref(isGroup)
|
|
})
|
|
});
|
|
};
|
|
}
|
|
});
|
|
wx.createComponent(_sfc_main);
|
|
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/TUIKit/components/TUIChat/message-input-toolbar/index.js.map
|