183 lines
7.5 KiB
JavaScript
183 lines
7.5 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 + Words + CustomMessage + UserSelector + popupinvite)();
|
|
}
|
|
const ImageUpload = () => "./image-upload/index.js";
|
|
const VideoUpload = () => "./video-upload/index.js";
|
|
const Words = () => "./words/index.js";
|
|
const EmojiPickerDialog = () => "./emoji-picker/emoji-picker-dialog.js";
|
|
const UserSelector = () => "./user-selector/index.js";
|
|
const CustomMessage = () => "./evaluate/CustomMessage.js";
|
|
const popupinvite = () => "./evaluate/popupinvite.js";
|
|
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
__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 popupinviteRef = common_vendor.ref(null);
|
|
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 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(featureConfig).InputQuickReplies
|
|
}, common_vendor.unref(featureConfig).InputQuickReplies ? {
|
|
k: common_vendor.o$1(handleSwiperDotShow)
|
|
} : {}, {
|
|
l: common_vendor.unref(featureConfig).InputCustomMessage
|
|
}, common_vendor.unref(featureConfig).InputCustomMessage ? {
|
|
m: common_vendor.o$1(handleSwiperDotShow)
|
|
} : {}), {
|
|
n: common_vendor.sr(userSelectorRef, "d01919ac-7", {
|
|
"k": "userSelectorRef"
|
|
}),
|
|
o: common_vendor.o$1(onUserSelectorSubmit),
|
|
p: common_vendor.o$1(onUserSelectorCancel),
|
|
q: common_vendor.p({
|
|
type: common_vendor.unref(selectorShowType),
|
|
currentConversation: common_vendor.unref(currentConversation),
|
|
isGroup: common_vendor.unref(isGroup)
|
|
}),
|
|
r: common_vendor.sr(popupinviteRef, "d01919ac-8", {
|
|
"k": "popupinviteRef"
|
|
})
|
|
});
|
|
};
|
|
}
|
|
});
|
|
wx.createComponent(_sfc_main);
|
|
//# sourceMappingURL=../../../../../.sourcemap/mp-weixin/TUIKit/components/TUIChat/message-input-toolbar/index.js.map
|