mdm-im-v3 2.1.0 → 2.1.3

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.
Files changed (27) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +50 -1
  3. package/dist/{FilePreview-dpnc9m3Z.js → FilePreview-CJdqlDs0.js} +2 -2
  4. package/dist/core.es.js +2 -2
  5. package/dist/{index-D5S79LNp.js → index-BLdSVjT-.js} +682 -332
  6. package/dist/{index-CsaYx_7b.js → index-CrMTFmHU.js} +2 -2
  7. package/dist/{index-CNxeqkio.js → index-VIcWin6Y.js} +68 -54
  8. package/dist/index.es.js +1 -1
  9. package/dist/style/index.css +1 -1
  10. package/dist-h5/{ChatHistoryH5-BhrGF5WR.js → ChatHistoryH5-BeCSVzKZ.js} +2 -2
  11. package/dist-h5/{ChatPageH5-B3azJu7O.js → ChatPageH5-GUblGkKv.js} +12 -7
  12. package/dist-h5/{ChatSettingsH5-CFr9Bn69.js → ChatSettingsH5-wyQ01zjO.js} +3 -2
  13. package/dist-h5/{CreateGroupH5-a16jkObH.js → CreateGroupH5-CCtTCnLG.js} +2 -2
  14. package/dist-h5/{GroupAnnouncementH5-B-Qfzoy2.js → GroupAnnouncementH5-BYN-HzX0.js} +1 -1
  15. package/dist-h5/{GroupInfoDialogH5-BHLKs62Z.js → GroupInfoDialogH5-DDjYHm7i.js} +1 -1
  16. package/dist-h5/{GroupMembersH5-D_f1RFjO.js → GroupMembersH5-DUWs89a3.js} +1 -1
  17. package/dist-h5/{GroupNoticeH5-46ZjBe92.js → GroupNoticeH5-C6hNtZzy.js} +1 -1
  18. package/dist-h5/{MemberDetailH5-B7nlr8ZT.js → MemberDetailH5-BZlExAgj.js} +16 -3
  19. package/dist-h5/{SearchPageH5-hYxNItvz.js → SearchPageH5-CjBq_40x.js} +2 -2
  20. package/dist-h5/{SelectMembersH5-DQIfX_w4.js → SelectMembersH5-BSLarLGK.js} +2 -2
  21. package/dist-h5/{imChat-Bfl2JS8Q.js → imChat-CdmqPGQ6.js} +40 -7
  22. package/dist-h5/index.es.js +2 -2
  23. package/dist-h5/{indexH5-CUQe-Ize.js → indexH5-CCseQmQb.js} +9 -4
  24. package/dist-h5/{indexH5-DAnvVyZ1.js → indexH5-DikfbMIK.js} +524 -166
  25. package/dist-h5/style/index-h5.css +1 -1
  26. package/package.json +72 -71
  27. package/dist-h5/request-CK8gkCRf.js +0 -44
@@ -1,5 +1,38 @@
1
1
  import { ElMessage } from "element-plus";
2
- import { r as requestInstance } from "./request-CK8gkCRf.js";
2
+ import { u as useChatStore, Z as imSessionScope, _ as IMSessionChangedError, $ as requestInstance } from "./indexH5-DikfbMIK.js";
3
+ async function withTenantDirectory(commonUrl, request) {
4
+ var _a, _b, _c;
5
+ const store = useChatStore();
6
+ const scope = imSessionScope(store);
7
+ const result = await request;
8
+ if (imSessionScope(store) !== scope) throw new IMSessionChangedError();
9
+ if (Number(store.imIdentityVersion) !== 2 || ((_a = result == null ? void 0 : result.data) == null ? void 0 : _a.code) !== 200) return result;
10
+ const contacts = [];
11
+ const walk = (value) => {
12
+ if (!value || typeof value !== "object") return;
13
+ if (!Array.isArray(value) && typeof value.loginCode === "string" && value.loginCode) contacts.push(value);
14
+ for (const child of Object.values(value)) if (typeof child === "object") walk(child);
15
+ };
16
+ walk(result.data.data);
17
+ const refs = [...new Set(contacts.map((item) => item.loginCode))];
18
+ const mapped = /* @__PURE__ */ new Map();
19
+ for (let offset = 0; offset < refs.length; offset += 100) {
20
+ const reply = await requestInstance.post(`${commonUrl}/api/v1/openim/resolveTargets`, { loginCodes: refs.slice(offset, offset + 100) });
21
+ if (imSessionScope(store) !== scope) throw new IMSessionChangedError();
22
+ if (((_b = reply == null ? void 0 : reply.data) == null ? void 0 : _b.code) !== 200) throw new Error(((_c = reply == null ? void 0 : reply.data) == null ? void 0 : _c.msg) || "人员 IM 身份解析失败");
23
+ for (const item of reply.data.data.targets || []) mapped.set(item.reference, item.imUserID);
24
+ }
25
+ for (const item of contacts) {
26
+ const id = mapped.get(item.loginCode);
27
+ if (!id) throw new Error("人员 IM 身份缺失");
28
+ item.businessLoginCode = item.loginCode;
29
+ item.businessUserID = item.userID;
30
+ item.imUserID = id;
31
+ item.loginCode = id;
32
+ item.userID = id;
33
+ }
34
+ return result;
35
+ }
3
36
  const CHUNK_MAX_SIZE = 20 * 1024 * 1024;
4
37
  const TARGET_CHUNK_SIZE = 20 * 1024 * 1024;
5
38
  const LARGE_FILE_THRESHOLD = 20 * 1024 * 1024;
@@ -724,21 +757,21 @@ const searchChatLogs = (commonUrl, params) => {
724
757
  return requestInstance.post(`${commonUrl}/api/v1/openim/iMSearchMsg2`, params);
725
758
  };
726
759
  const getUserInfoByLoginCode = (commonUrl, loginCode) => {
727
- return requestInstance.post(`${commonUrl}/api/v1/openim/getOpenIMUserInfoByLoginCode`, {
760
+ return withTenantDirectory(commonUrl, requestInstance.post(`${commonUrl}/api/v1/openim/getOpenIMUserInfoByLoginCode`, {
728
761
  loginCode
729
- });
762
+ }));
730
763
  };
731
764
  const searchOpenIMUsers = (commonUrl, params) => {
732
- return requestInstance.post(`${commonUrl}/api/v1/openim/searchOpenIMUsers`, params);
765
+ return withTenantDirectory(commonUrl, requestInstance.post(`${commonUrl}/api/v1/openim/searchOpenIMUsers`, params));
733
766
  };
734
767
  const queryUserAddressBook = (commonUrl, params = {}) => {
735
- return requestInstance.post(`${commonUrl}/api/v1/communication/queryUserAddressBook`, params);
768
+ return withTenantDirectory(commonUrl, requestInstance.post(`${commonUrl}/api/v1/communication/queryUserAddressBook`, params));
736
769
  };
737
770
  const queryUsersByDept = (commonUrl, params = {}) => {
738
- return requestInstance.post(`${commonUrl}/api/v1/communication/queryUsersByDept`, params);
771
+ return withTenantDirectory(commonUrl, requestInstance.post(`${commonUrl}/api/v1/communication/queryUsersByDept`, params));
739
772
  };
740
773
  const searchUsersByDept = (commonUrl, params = {}) => {
741
- return requestInstance.post(`${commonUrl}/api/v1/communication/searchUsersByDept`, params);
774
+ return withTenantDirectory(commonUrl, requestInstance.post(`${commonUrl}/api/v1/communication/searchUsersByDept`, params));
742
775
  };
743
776
  export {
744
777
  queryUsersByDept as a,
@@ -1,4 +1,4 @@
1
- import { _ } from "./indexH5-DAnvVyZ1.js";
1
+ import { a0 } from "./indexH5-DikfbMIK.js";
2
2
  export {
3
- _ as mdmImV3H5
3
+ a0 as mdmImV3H5
4
4
  };
@@ -1,11 +1,10 @@
1
1
  import { computed, ref, watch, onBeforeUnmount, openBlock, createElementBlock, createVNode, unref, withCtx, createElementVNode, withModifiers, createTextVNode, toDisplayString, createCommentVNode, Fragment, renderList, createBlock, normalizeClass, normalizeStyle, inject, provide, onMounted, nextTick } from "vue";
2
2
  import { useRouter } from "vue-router";
3
3
  import { NavBar, Icon, Badge, PullRefresh, SwipeCell, Loading, Empty, Button, ActionSheet, Cell, showDialog, showToast } from "vant";
4
- import { u as useChatStore, I as IM_CVS_TYPE, g as getGroupAvatarBg, i as isDefaultAvatar, a as getAvatarBg, b as getAvatarText, c as cloneDeep, d as getConversationBurnSetting, e as useMessage, f as useUsers, h as useConversations, j as useMsgList, m as mittBus, k as IM_LOGIN_STATUS, p as preserveBurnInEx, l as IM_LOGIN_PLATFORM, s as sleep, n as handleUrl } from "./indexH5-DAnvVyZ1.js";
4
+ import { u as useChatStore, I as IM_CVS_TYPE, g as getGroupAvatarBg, i as isDefaultAvatar, a as getAvatarBg, b as getAvatarText, c as cloneDeep, d as getConversationBurnSetting, e as useMessage, f as useUsers, h as useConversations, j as useMsgList, m as mittBus, k as IM_LOGIN_STATUS, p as preserveBurnInEx, l as IM_LOGIN_PLATFORM, s as sleep, n as handleUrl } from "./indexH5-DikfbMIK.js";
5
5
  import "element-plus";
6
- import "./request-CK8gkCRf.js";
7
6
  import { d as defaultAvatar } from "./default_avatar-BE2kit_X.js";
8
- import { J as JoinGroupDialogH5, G as GroupInfoDialogH5 } from "./GroupInfoDialogH5-BHLKs62Z.js";
7
+ import { J as JoinGroupDialogH5, G as GroupInfoDialogH5 } from "./GroupInfoDialogH5-DDjYHm7i.js";
9
8
  const _hoisted_1 = { class: "chat-list-h5" };
10
9
  const _hoisted_2 = { key: 0 };
11
10
  const _hoisted_3 = { style: { "display": "flex", "align-items": "center", "gap": "20px" } };
@@ -620,7 +619,7 @@ const _sfc_main = {
620
619
  provide("loadMessageCount", pageCount);
621
620
  }
622
621
  const chatMessage = useChatStore();
623
- const { initIMSDK, waitForSyncFinish } = useMessage();
622
+ const { initIMSDK, waitForSyncFinish, publishUnreadCount } = useMessage();
624
623
  const baseUrl = computed(() => chatMessage.getBaseUrl);
625
624
  const localUser = computed(() => chatMessage.getUserInfo);
626
625
  computed(() => chatMessage.getLoginStatus);
@@ -937,6 +936,7 @@ const _sfc_main = {
937
936
  await nextTick();
938
937
  initMessagePage();
939
938
  }
939
+ publishUnreadCount("init");
940
940
  };
941
941
  const handleGroupApplicationAdded = (data) => {
942
942
  if (!(data == null ? void 0 : data.groupID)) return;
@@ -989,6 +989,11 @@ const _sfc_main = {
989
989
  }
990
990
  chatMessage.setUserInfo({
991
991
  userID: obj.loginCode || props.baseConfig.loginCode,
992
+ imIdentityVersion: obj.imIdentityVersion || 1,
993
+ imUserID: obj.imUserID || "",
994
+ tenantID: obj.tenantID || "",
995
+ businessUserID: obj.businessUserID || "",
996
+ loginCode: obj.loginCode || "",
992
997
  nickname: obj.userName || props.baseConfig.userName,
993
998
  apiUrl: obj.apiUrl || props.baseConfig.apiUrl,
994
999
  wsUrl: ((_a = obj.apiUrl) == null ? void 0 : _a.replace(/^http/, "ws")) || ((_b = props.baseConfig.apiUrl) == null ? void 0 : _b.replace(/^http/, "ws")),