24 lines
762 B
JavaScript
24 lines
762 B
JavaScript
"use strict";
|
|
const common_vendor = require("../../../common/vendor.js");
|
|
const TUIKit_index = require("../../index.js");
|
|
const initChat = (options) => {
|
|
TUIKit_index.TUIChatKit.init();
|
|
const { chat } = common_vendor.A.getContext();
|
|
if (options && options.conversationID && (chat == null ? void 0 : chat.isReady())) {
|
|
const { conversationID } = options;
|
|
if (!conversationID.startsWith("C2C") && !conversationID.startsWith("GROUP")) {
|
|
console.warn("conversationID from options is invalid.");
|
|
return;
|
|
}
|
|
common_vendor.Wt.switchConversation(conversationID);
|
|
}
|
|
};
|
|
const logout = (flag) => {
|
|
if (flag) {
|
|
return common_vendor.A.logout();
|
|
}
|
|
return Promise.resolve();
|
|
};
|
|
exports.initChat = initChat;
|
|
exports.logout = logout;
|