isdata-customer-sdk 0.1.62 → 0.1.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -30846,6 +30846,7 @@ class ChatClientMgr {
30846
30846
  this.chatType = params.chatType || 0;
30847
30847
  this.singleChatID = params.singleChatID || "";
30848
30848
  this.chartOrigin = params.chartOrigin;
30849
+ console.log("ChatClientMgr init:", this.actionKey);
30849
30850
  // this.charAIs = {};
30850
30851
  }
30851
30852
  makeKey(key) {
@@ -30890,10 +30891,10 @@ class ChatClientMgr {
30890
30891
  }
30891
30892
  return [];
30892
30893
  });
30893
- this.handler.addChatListener(this.makeKey(`sdata_get_test_user_sig`), data => {
30894
+ this.handler.addChatListener(this.makeKey(`sdata_get_test_user_sig`), async data => {
30894
30895
  let sdkAppID = data.SDKAppID;
30895
30896
  let userID = data.userID;
30896
- let sigIDObject = this.handler.genTestUserSig({
30897
+ let sigIDObject = await this.handler.genTestUserSig({
30897
30898
  SDKAppID: sdkAppID,
30898
30899
  userID: userID
30899
30900
  });
@@ -30926,7 +30927,16 @@ class ChatClientMgr {
30926
30927
  });
30927
30928
  }
30928
30929
  getChatTypeKey(type) {
30929
- return type == 1 ? "IM_SINGLE_MODE" : "IM_MULTIPLE_MODE";
30930
+ switch (type) {
30931
+ case 0:
30932
+ return "IM_MULTIPLE_MODE";
30933
+ case 1:
30934
+ return "IM_SINGLE_MODE";
30935
+ case 2:
30936
+ return "IM_EMBED_MODE";
30937
+ default:
30938
+ return "IM_MULTIPLE_MODE";
30939
+ }
30930
30940
  }
30931
30941
  async initChatAIs() {
30932
30942
  this.chatAIClient = await this.handler.getChatClient({
@@ -30944,12 +30954,19 @@ class ChatClientMgr {
30944
30954
  robot.chatID = robotKey;
30945
30955
  let userSig = await this.handler.getPortalUserSig(robotKey, this.imType, this.groupID);
30946
30956
  if (!userSig) {
30947
- let sigIDObject = this.handler.genTestUserSig({
30957
+ let sigIDObject = await this.handler.genTestUserSig({
30948
30958
  SDKAppID: this.appSKID,
30949
30959
  userID: robotKey
30950
30960
  });
30951
30961
  userSig = sigIDObject.userSig;
30952
- await this.handler.addIMMapping(robotKey, this.imType, userSig, this.groupID);
30962
+ if (userSig) {
30963
+ await this.chatAIClient.login({
30964
+ userID: robotKey,
30965
+ userSig: userSig
30966
+ });
30967
+ await this.chatAIClient.logout();
30968
+ await this.handler.addIMMapping(robotKey, this.imType, userSig, this.groupID);
30969
+ }
30953
30970
  }
30954
30971
  robot.userSig = userSig;
30955
30972
  this.chatAIClient.charAIs[robotKey] = {