优化页面
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
"use strict";
|
||||
const common_vendor = require("../../../common/vendor.js");
|
||||
common_vendor.g() === "pc";
|
||||
common_vendor.g() === "h5";
|
||||
common_vendor.g() === "wechat";
|
||||
const isApp = common_vendor.g() === "app";
|
||||
exports.isApp = isApp;
|
||||
//# sourceMappingURL=../../../../.sourcemap/mp-weixin/TUIKit/tui-customer-service-plugin/utils/env.js.map
|
||||
@@ -1,56 +0,0 @@
|
||||
"use strict";
|
||||
const TUIKit_tuiCustomerServicePlugin_constant = require("../constant.js");
|
||||
function isJSON(str) {
|
||||
if (typeof str === "string") {
|
||||
try {
|
||||
const data = JSON.parse(str);
|
||||
if (data) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
function JSONToObject(str) {
|
||||
if (!isJSON(str)) {
|
||||
return str;
|
||||
}
|
||||
return JSON.parse(str);
|
||||
}
|
||||
function isCustomerServiceMessage(message) {
|
||||
var _a;
|
||||
const customerServicePayload = JSONToObject((_a = message == null ? void 0 : message.payload) == null ? void 0 : _a.data);
|
||||
return Number(customerServicePayload == null ? void 0 : customerServicePayload.customerServicePlugin) === 0 || Number(customerServicePayload == null ? void 0 : customerServicePayload.chatbotPlugin) === 1;
|
||||
}
|
||||
const isMessageRating = (message) => {
|
||||
var _a;
|
||||
const customerServicePayload = JSONToObject((_a = message == null ? void 0 : message.payload) == null ? void 0 : _a.data);
|
||||
return isCustomerServiceMessage(message) && customerServicePayload.src === TUIKit_tuiCustomerServicePlugin_constant.CUSTOM_MESSAGE_SRC.MENU;
|
||||
};
|
||||
const isMessageInvisible = (message) => {
|
||||
var _a, _b;
|
||||
const customerServicePayload = JSONToObject((_a = message == null ? void 0 : message.payload) == null ? void 0 : _a.data);
|
||||
const robotCommandArray = ["feedback", "updateBotStatus"];
|
||||
const whiteList = [
|
||||
TUIKit_tuiCustomerServicePlugin_constant.CUSTOM_MESSAGE_SRC.MENU,
|
||||
TUIKit_tuiCustomerServicePlugin_constant.CUSTOM_MESSAGE_SRC.BRANCH,
|
||||
TUIKit_tuiCustomerServicePlugin_constant.CUSTOM_MESSAGE_SRC.BRANCH_NUMBER,
|
||||
TUIKit_tuiCustomerServicePlugin_constant.CUSTOM_MESSAGE_SRC.FROM_INPUT,
|
||||
TUIKit_tuiCustomerServicePlugin_constant.CUSTOM_MESSAGE_SRC.PRODUCT_CARD,
|
||||
TUIKit_tuiCustomerServicePlugin_constant.CUSTOM_MESSAGE_SRC.ROBOT_MSG,
|
||||
TUIKit_tuiCustomerServicePlugin_constant.CUSTOM_MESSAGE_SRC.RICH_TEXT,
|
||||
TUIKit_tuiCustomerServicePlugin_constant.CUSTOM_MESSAGE_SRC.STREAM_TEXT
|
||||
];
|
||||
const isCustomerMessage = (message == null ? void 0 : message.type) === TUIKit_tuiCustomerServicePlugin_constant.TYPES.MSG_CUSTOM;
|
||||
const isCustomerInvisible = (customerServicePayload == null ? void 0 : customerServicePayload.src) && !whiteList.includes(customerServicePayload == null ? void 0 : customerServicePayload.src);
|
||||
const isRobot = (customerServicePayload == null ? void 0 : customerServicePayload.src) === TUIKit_tuiCustomerServicePlugin_constant.CUSTOM_MESSAGE_SRC.ROBOT && robotCommandArray.indexOf((_b = customerServicePayload == null ? void 0 : customerServicePayload.content) == null ? void 0 : _b.command) !== -1;
|
||||
return isCustomerMessage && (isCustomerInvisible || isRobot);
|
||||
};
|
||||
exports.JSONToObject = JSONToObject;
|
||||
exports.isCustomerServiceMessage = isCustomerServiceMessage;
|
||||
exports.isMessageInvisible = isMessageInvisible;
|
||||
exports.isMessageRating = isMessageRating;
|
||||
//# sourceMappingURL=../../../../.sourcemap/mp-weixin/TUIKit/tui-customer-service-plugin/utils/index.js.map
|
||||
Reference in New Issue
Block a user