easemob-websdk 4.12.1 → 4.13.0
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/Easemob-chat.d.ts +28 -10
- package/Easemob-chat.js +1 -1
- package/chatroom/chatroom.d.ts +3 -3
- package/contact/contact.d.ts +7 -3
- package/contact/contact.js +1 -1
- package/message/audio.d.ts +4 -0
- package/message/cmd.d.ts +3 -0
- package/message/combine.d.ts +3 -0
- package/message/file.d.ts +3 -0
- package/message/img.d.ts +3 -0
- package/message/location.d.ts +3 -0
- package/message/video.d.ts +3 -0
- package/miniCore/miniCore.js +1 -1
- package/miniProgram/Easemob-chat.js +1 -1
- package/package.json +1 -1
- package/types/indexApi.d.ts +3 -3
- package/types/message.d.ts +10 -2
- package/uniApp/Easemob-chat.js +1 -1
- package/CHANGELOG.md +0 -302
- package/readme.md +0 -59
package/chatroom/chatroom.d.ts
CHANGED
|
@@ -72,11 +72,11 @@ export interface ChatroomApi {
|
|
|
72
72
|
/** The chat room ID. */
|
|
73
73
|
chatRoomId: string;
|
|
74
74
|
/** The chat room name. */
|
|
75
|
-
chatRoomName
|
|
75
|
+
chatRoomName?: string;
|
|
76
76
|
/** The description of the chat room. */
|
|
77
|
-
description
|
|
77
|
+
description?: string;
|
|
78
78
|
/** The maximum number of members in the chat room. */
|
|
79
|
-
maxusers
|
|
79
|
+
maxusers?: number;
|
|
80
80
|
}): Promise<AsyncResult<ChatRoomTypes.ModifyChatRoomResult>>;
|
|
81
81
|
|
|
82
82
|
/**
|
package/contact/contact.d.ts
CHANGED
|
@@ -271,11 +271,15 @@ export interface Contact {
|
|
|
271
271
|
}): Promise<IndexTypes.SendMsgResult>;
|
|
272
272
|
|
|
273
273
|
/**
|
|
274
|
-
* Modifies a message
|
|
274
|
+
* Modifies a message in the server.
|
|
275
275
|
*
|
|
276
|
-
*
|
|
276
|
+
* - Text message: Both the message body `msg` and extension information `ext` can be modified.
|
|
277
|
+
* - Custom message: The custom extension property field `customExts`, custom event type field `customEvent` , and message extension field `ext` can be modified.
|
|
278
|
+
* - Image/video/voice/file/location/combined message: Only the message extension field `ext` can be modified.
|
|
279
|
+
* - Command message: This type of message cannot be modified.
|
|
280
|
+
*
|
|
281
|
+
* The message recipient can listen for message changes via `onModifiedMessage`. Also, this callback applies in multi-device scenarios.
|
|
277
282
|
*
|
|
278
|
-
* Upon a message modification, the callback `onModifiedMessage` will be received by the message recipient(s) and in multi-device login scenarios.
|
|
279
283
|
*
|
|
280
284
|
* ```typescript
|
|
281
285
|
*
|
package/contact/contact.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.websdk=t():e.websdk=t()}(self,(function(){return(self.webpackChunkwebsdk=self.webpackChunkwebsdk||[]).push([[564],{7479:function(e,t,r){r.r(t),r.d(t,{acceptContactInvite:function(){return J},acceptInvitation:function(){return D},addContact:function(){return Z},addConversationMark:function(){return ge},addReaction:function(){return te},addToBlackList:function(){return H},addUsersToBlacklist:function(){return K},addUsersToBlocklist:function(){return V},declineContactInvite:function(){return F},declineInvitation:function(){return q},deleteAllMessagesAndConversations:function(){return Ie},deleteContact:function(){return X},deleteConversation:function(){return O},deleteReaction:function(){return re},deleteSession:function(){return R},fetchHistoryMessages:function(){return B},fetchUserInfoById:function(){return x},getAllContacts:function(){return he},getBlacklist:function(){return k},getBlocklist:function(){return E},getContacts:function(){return j},getContactsWithCursor:function(){return fe},getConversationlist:function(){return w},getHistoryMessages:function(){return L},getReactionDetail:function(){return oe},getReactionList:function(){return ne},getReactionlist:function(){return ae},getRoster:function(){return C},getSelfIdsOnOtherPlatform:function(){return Te},getServerConversations:function(){return ce},getServerConversationsByFilter:function(){return ye},getServerPinnedConversations:function(){return le},getServerPinnedMessages:function(){return je},getSessionList:function(){return N},getTokenExpireTimestamp:function(){return U},modifyMessage:function(){return ee},pinConversation:function(){return pe},pinMessage:function(){return Ee},recallMessage:function(){return $},removeConversationMark:function(){return ve},removeFromBlackList:function(){return W},removeHistoryMessages:function(){return se},removeRoster:function(){return G},removeUserFromBlackList:function(){return Q},removeUserFromBlocklist:function(){return Y},reportMessage:function(){return ie},setContactRemark:function(){return de},unbindPushToken:function(){return Se},unpinMessage:function(){return Ce},updateCurrentUserNick:function(){return z},updateOwnUserInfo:function(){return A},updateUserInfo:function(){return P},uploadPushToken:function(){return b},uploadToken:function(){return S}}),r(9601),r(1539),r(8674),r(2526),r(1817),r(2165),r(6992),r(8783),r(3948),r(9554),r(4747),r(2222),r(7941),r(6699),r(3710),r(9714),r(9600),r(5069),r(561),r(9753),r(8309),r(1249),r(7327);var n=r(3246),a=r(5531),o=r(7252),i=r(4024),s=r(9937),c=r(8161),u=r(4188),l=r.n(u),p=r(7360),d=r(1595),h=r(4363),f=r(7288),m=r(9743),g=r(6801),v=function(){return v=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},v.apply(this,arguments)},y=function(e,t,r,n){return new(r||(r=Promise))((function(a,o){function i(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,s)}c((n=n.apply(e,t||[])).next())}))},T=function(e,t){var r,n,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(a=2&o[0]?n.return:o[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,o[1])).done)return a;switch(n=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,n=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!((a=(a=i.trys).length>0&&a[a.length-1])||6!==o[0]&&2!==o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],n=0}finally{r=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},I={singleChat:"chat",chatRoom:"chatroom",groupChat:"groupchat"};function k(e){var t=n.XZ.call(this).error;if(t)return Promise.reject(t);var r=this.context,a=r.orgName,o=r.appName,s=r.accessToken,c={url:this.apiUrl+"/"+a+"/"+o+"/users/"+this.user+"/blocks/users",dataType:"json",type:"GET",headers:{Authorization:"Bearer "+s},success:function(t){var r={};t.data.forEach((function(e){r[e]={name:e}})),"function"==typeof(null==e?void 0:e.success)&&e.success(t)},error:function(t){"function"==typeof(null==e?void 0:e.error)&&e.error(t)}};return p.kg.debug("Call getBlocklist"),i.hj.call(this,c,d.fI.GET_BLACK_LIST)}var E=k,C=j;function j(e){var t=this,r=n.XZ.call(this).error;if(r)return Promise.reject(r);var a=this.context,o=a.orgName,s=a.appName,c=a.accessToken,u={url:this.apiUrl+"/"+o+"/"+s+"/users/"+this.user+"/contacts/users",dataType:"json",type:"GET",headers:{Authorization:"Bearer "+c},success:function(r){var n=[];r.data.forEach((function(e){n.push({name:e,subscription:"both",jid:t.context.jid})})),"function"==typeof(null==e?void 0:e.success)&&e.success(n)},error:function(t){"function"==typeof(null==e?void 0:e.error)&&e.error(t)}};return p.kg.debug("Call getContacts"),i.hj.call(this,u,d.fI.GET_CONTACTS)}function S(e){return p.kg.debug("Call uploadPushToken"),g.r.call(this,e)}var b=S;function N(e){var t=n.XZ.call(this).error;if(t)return Promise.reject(t);var r=this.context,a=r.orgName,o=r.appName,s=r.accessToken,c={url:"".concat(this.apiUrl,"/").concat(a,"/").concat(o,"/users/").concat(this.user,"/user_channels"),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"},success:e&&(null==e?void 0:e.success),error:e&&(null==e?void 0:e.error)};return p.kg.debug("Call getSessionList"),i.hj.call(this,c,d.fI.GET_SESSION_LIST)}function w(e){var t=this,r=n.XZ.call(this).error;if(r)return Promise.reject(r);var a=this.context,o=a.orgName,s=a.appName,c=a.accessToken,u=!!(e&&"number"==typeof e.pageNum&&"number"==typeof e.pageSize&&e.pageNum>0&&e.pageSize>0),l={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(s,"/users/").concat(this.user,"/user_channels").concat(u?"/page":""),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+c,"Content-Type":"application/json"},success:e&&(null==e?void 0:e.success),error:e&&(null==e?void 0:e.error)};return u&&(l.data={pageNum:e.pageNum,pageSize:e.pageSize}),p.kg.debug("Call getConversationlist"),i.hj.call(this,l,d.fI.GET_SESSION_LIST).then((function(e){return _.call(t,e)}))}function _(e){var t=this,r=e.data.channel_infos;return null==r||r.forEach((function(e){e.meta&&"{}"!==JSON.stringify(e.meta)?(e.meta.payload=JSON.parse(e.meta.payload),e.lastMessage=h.w.call(t,e.meta,{formatCustomExts:!1})):e.lastMessage=e.meta,delete e.meta})),e}function R(e){if(e&&"string"!=typeof e.channel)throw Error("Invalid parameter channel: ".concat(e.channel));if(e&&"singleChat"!==e.chatType&&"groupChat"!==e.chatType)throw Error("Invalid parameter chatType: ".concat(e.chatType));if(e&&"boolean"!=typeof e.deleteRoam)throw Error("Invalid parameter deleteRoam: ".concat(e.deleteRoam));var t=n.XZ.call(this).error;if(t)return Promise.reject(t);var r,a=this.context,o=a.orgName,s=a.appName,c=a.accessToken,u=a.jid;r="singleChat"===e.chatType?"chat":"groupChat";var l={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(s,"/user/").concat(this.user,"/user_channel?resource=").concat(u.clientResource),dataType:"json",type:"DELETE",data:JSON.stringify({channel:e.channel,type:r,delete_roam:e.deleteRoam}),headers:{Authorization:"Bearer "+c,"Content-Type":"application/json"},success:e.success,error:e.error};return p.kg.debug("Call deleteSession",e),i.hj.call(this,l,d.fI.DELETE_SESSION)}var O=R;function A(e,t){var r=n.XZ.call(this).error;if(r)return Promise.reject(r);var a=this.context,o=a.orgName,s=a.appName,c=a.accessToken,u=["nickname","avatarurl","mail","phone","gender","sign","birth","ext"],l={},h=i.P6.getEnvInfo();if("wx"===h.platform||"qq"===h.platform)if("string"==typeof e&&void 0!==t){if(!u.includes(e))throw new Error("illegal key, only these keys: nickname, avatarurl, mail, phone, gender, sign, birth, ext are allowed");l[e]=t}else{if("[object Object]"!==Object.prototype.toString.call(e))throw new Error("illegal params");u.forEach((function(t){u.includes(t)&&void 0!==e[t]&&(l[t]=e[t])}))}else if("string"==typeof e){if(!u.includes(e))throw new Error("illegal key, only these keys: nickname, avatarurl, mail, phone, gender, sign, birth, ext are allowed");l=e+"="+t}else{if("[object Object]"!==Object.prototype.toString.call(e))throw new Error("illegal params");var f=[];u.forEach((function(t){if(u.includes(t)&&void 0!==e[t]){var r=encodeURIComponent(t),n=encodeURIComponent(e[t]);f.push(r+"="+n)}})),l=f.join("&")}var m={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(s,"/metadata/user/").concat(this.user),type:"PUT",data:l,dataType:"json",headers:{Authorization:"Bearer "+c,"Content-Type":"application/x-www-form-urlencoded"}};return p.kg.debug("Call updateOwnUserInfo",e),i.hj.call(this,m,d.fI.UPDATE_USER_INFO)}var P=A;function x(e,t){var r=n.XZ.call(this).error;if(r)return Promise.reject(r);var a,o=this.context,s=o.orgName,c=o.appName,u=o.accessToken,l=[];if("string"==typeof e)l=[e];else{if("[object Array]"!==Object.prototype.toString.call(e))throw new Error("illegal params");l=e}a="string"==typeof t?[t]:t&&"[object Array]"===Object.prototype.toString.call(t)?t:["nickname","avatarurl","mail","phone","gender","sign","birth","ext"];var h={url:"".concat(this.apiUrl,"/").concat(s,"/").concat(c,"/metadata/user/get"),type:"POST",data:JSON.stringify({targets:l,properties:a}),dataType:"json",headers:{Authorization:"Bearer "+u,"Content-Type":"application/json"}};return p.kg.debug("Call fetchUserInfoById",e),i.hj.call(this,h,d.fI.GET_USER_INFO)}function z(e){var t=n.XZ.call(this).error;if(t)return Promise.reject(t);var r=this.context,a=r.orgName,o=r.appName,s=r.accessToken,c={url:"".concat(this.apiUrl,"/").concat(a,"/").concat(o,"/users/").concat(this.user),type:"PUT",dataType:"json",data:JSON.stringify({nickname:e}),headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"}};return p.kg.debug("Call updateCurrentUserNick",e),i.hj.call(this,c)}function U(e){if("string"!=typeof e||""===e)throw Error('Invalid parameter: "token"');var t=this.context,r=t.orgName,n=t.appName,a={url:"".concat(this.apiUrl,"/").concat(r,"/").concat(n,"/sdk/users/").concat(this.user,"/token/expires"),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+e,"Content-Type":"application/json"}};return p.kg.debug("Call getTokenExpireTimestamp",e),i.hj.call(this,a,d.fI.SDK_INTERNAL)}function B(e){var t=this;return new Promise((function(r,a){if(!e.queue)throw Error('Invalid parameter: "specified"');var o=n.XZ.call(t).error;if(o)return Promise.reject(o);(function e(t){var n=this,o=t.count||20;M.call(this,{count:o,isGroup:!!t.isGroup,queue:t.queue,start:t.start,format:t.format,success:function(a){if(a.msgs.length>=o||a.is_last){var i=a.msgs.splice(0,o).reverse();t.success&&t.success(i),r(i)}else e.call(n,v(v({},t),{start:null}))},fail:function(e){a(e),t.fail&&t.fail(e)}})}).call(t,e),p.kg.debug("Call fetchHistoryMessages",e)}))}function M(e){var t=this,r=e.queue,n=this.mr_cache[r]||(this.mr_cache[r]={msgs:[]}),s=this.context.userId,u=e.start||-1,p=e.count||20;if(n.msgs.length>=p||n.is_last)"function"==typeof e.success&&e.success(n);else{n&&n.next_key&&(u=n.next_key),e.start&&(u=e.start);var h={queue:r+(e.isGroup?"@conference.easemob.com":"@easemob.com"),start:u,end:-1},f=this.context,m=f.orgName,g=f.appName,v={url:"".concat(this.apiUrl,"/").concat(m,"/").concat(g,"/users/").concat(s,"/messageroaming"),dataType:"json",type:"POST",headers:{Authorization:"Bearer "+this.token,"Content-Type":"application/json"},data:JSON.stringify(h),success:function(r){return y(t,void 0,void 0,(function(){var t,a,o,i,s,u,p=this;return T(this,(function(d){switch(d.label){case 0:if(t=null==r?void 0:r.data,!r.data.msgs)return"function"==typeof e.success&&e.success(n),n.is_last=!0,n.next_key="",[2];a=t.msgs,o=a.length,n.is_last=t.is_last,n.next_key=t.next_key,i=function(t){return y(p,void 0,void 0,(function(){var r,n,a,o,i;return T(this,(function(s){switch(s.label){case 0:for(r=[],t=l().atob(t),n=0,a=t.length;n<a;++n)r.push(t.charCodeAt(n));return o=(o=this.context.root.lookup("easemob.pb.Meta")).decode(r),i={errorCode:0,reason:""},1!==o.ns?[3,2]:[4,c.Z.call(this,o,i,!0,e.format)];case 1:return[2,s.sent()];case 2:return[2]}}))}))},s=0,d.label=1;case 1:return s<o?[4,i(a[s].msg)]:[3,4];case 2:(u=d.sent())&&n.msgs.push(u),d.label=3;case 3:return s++,[3,1];case 4:return"function"==typeof e.success&&e.success(n),[2]}}))}))},error:function(e){if(e.error&&e.error_description){var r=o.Z.create({type:a.E.WEBIM_CONNCTION_AJAX_ERROR,message:"fetch history messages error",data:e});t.onError&&t.onError(r)}}};i.hj.call(this,v,d.fI.GET_HISTORY_MSG).catch((function(t){"function"==typeof e.fail&&e.fail(t)}))}}function L(e){var t=this;return new Promise((function(r,a){var o=e.targetId,s=e.cursor,u=void 0===s?-1:s,d=e.pageSize,h=void 0===d?20:d,f=e.chatType,m=e.searchDirection,g=e.searchOptions,v=void 0===g?{}:g,I=v.msgTypes,k=void 0===I?[]:I,E=v.startTime,C=void 0===E?null:E,j=v.endTime,S=void 0===j?null:j,b=v.from,N=void 0===b?null:b;if("string"!=typeof o||""===o)throw Error('"Invalid parameter": "targetId"');if(N&&"string"!=typeof N)throw Error('"Invalid parameter": "searchOptions.from"');if(k&&!Array.isArray(k))throw Error('"Invalid parameter": "searchOptions.msgTypes"');if(C&&"number"!=typeof C)throw Error('"Invalid parameter": "searchOptions.startTime"');if(S&&"number"!=typeof C)throw Error('"Invalid parameter": "searchOptions.endTime"');var w=n.XZ.call(t).error;if(w)return Promise.reject(w);var _=t.context,R=_.orgName,O=_.appName,A=_.userId,P="singleChat"===e.chatType?"@easemob.com":"@conference.easemob.com",x={queue:"".concat(o).concat(P),start:u,pull_number:h,is_positive:"down"===m,msgType:k.join(",")||"",end:-1,startTime:C,endTime:S,userId:"singleChat"===f?null:N},z={url:"".concat(t.apiUrl,"/").concat(R,"/").concat(O,"/users/").concat(A,"/messageroaming"),dataType:"json",type:"POST",headers:{Authorization:"Bearer "+t.token,"Content-Type":"application/json"},data:JSON.stringify(x),success:function(n){return y(t,void 0,void 0,(function(){var t,a,o,i,s,u,p,d,h=this;return T(this,(function(f){switch(f.label){case 0:t=null==n?void 0:n.data,a=t.msgs||[],o=function(e){return y(h,void 0,void 0,(function(){var t,r,n,a,o;return T(this,(function(i){switch(i.label){case 0:for(t=[],e=l().atob(e),r=0,n=e.length;r<n;++r)t.push(e.charCodeAt(r));return a=(a=this.context.root.lookup("easemob.pb.Meta")).decode(t),o={errorCode:0,reason:""},1!==a.ns?[3,2]:[4,c.Z.call(this,a,o,!0,!0)];case 1:return[2,i.sent()];case 2:return[2]}}))}))},i=[],s=0,f.label=1;case 1:return s<a.length?[4,o(a[s].msg)]:[3,4];case 2:(u=f.sent())&&i.push(u),f.label=3;case 3:return s++,[3,1];case 4:return t.msgs=i,p={cursor:t.next_key,messages:i,isLast:t.is_last},null===(d=e.success)||void 0===d||d.call(e,p),r(p),[2]}}))}))},error:e.fail};i.hj.call(t,z).catch((function(e){a(e)})),p.kg.debug("Call getHistoryMessages",e)}))}function Z(e,t){return y(this,void 0,void 0,(function(){var r,a,o,s,c,u,l;return T(this,(function(h){switch(h.label){case 0:if(r=n.XZ.call(this).error)return[2,Promise.reject(r)];if("string"!=typeof e||""===e)throw Error('"Invalid parameter": "to"');return p.kg.debug("Call addContact",e,t),a=this.context,o=a.orgName,s=a.appName,c=a.accessToken,u=a.jid,l={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(s,"/users/").concat(this.user,"/contacts/apply?resource=").concat(u.clientResource),type:"POST",dataType:"json",data:JSON.stringify({usernames:[e],reason:t}),headers:{Authorization:"Bearer "+c,"Content-Type":"application/json"}},[4,i.hj.call(this,l,d.fI.ROSTER_ADD)];case 1:return h.sent(),[2]}}))}))}var G=X;function X(e){return y(this,void 0,void 0,(function(){var t,r,a,o,s,c,u;return T(this,(function(l){switch(l.label){case 0:if(t=n.XZ.call(this).error)return[2,Promise.reject(t)];if("string"!=typeof e||""===e)throw Error('"Invalid parameter": "to"');return p.kg.debug("Call deleteContact",e),r=this.context,a=r.orgName,o=r.appName,s=r.accessToken,c=r.jid,u={url:"".concat(this.apiUrl,"/").concat(a,"/").concat(o,"/users/").concat(this.user,"/contacts/users/").concat(e,"?resource=").concat(c.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"}},[4,i.hj.call(this,u,d.fI.ROSTER_REMOVE)];case 1:return l.sent(),[2]}}))}))}function D(e){return y(this,void 0,void 0,(function(){var t,r,a,o,s,c,u;return T(this,(function(l){switch(l.label){case 0:if(t=n.XZ.call(this).error)return[2,Promise.reject(t)];if("string"!=typeof e||""===e)throw Error('"Invalid parameter": "to"');return p.kg.debug("Call acceptInvitation",e),r=this.context,a=r.orgName,o=r.appName,s=r.accessToken,c=r.jid,u={url:"".concat(this.apiUrl,"/").concat(a,"/").concat(o,"/users/").concat(this.user,"/contacts/accept/users/").concat(e,"?resource=").concat(c.clientResource),type:"POST",dataType:"json",headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"}},[4,i.hj.call(this,u,d.fI.ROSTER_ACCEPT)];case 1:return l.sent(),[2]}}))}))}var J=D;function q(e){return y(this,void 0,void 0,(function(){var t,r,a,o,s,c,u;return T(this,(function(l){switch(l.label){case 0:if(t=n.XZ.call(this).error)return[2,Promise.reject(t)];if("string"!=typeof e||""===e)throw Error('"Invalid parameter": "to"');return p.kg.debug("Call declineInvitation",e),r=this.context,a=r.orgName,o=r.appName,s=r.accessToken,c=r.jid,u={url:"".concat(this.apiUrl,"/").concat(a,"/").concat(o,"/users/").concat(this.user,"/contacts/decline/users/").concat(e,"?resource=").concat(c.clientResource),type:"POST",dataType:"json",headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"}},[4,i.hj.call(this,u,d.fI.ROSTER_DECLINE)];case 1:return l.sent(),[2]}}))}))}var F=q;function H(e){return y(this,void 0,void 0,(function(){var t,r,a,o,s,c,u,l,h;return T(this,(function(f){switch(f.label){case 0:if(t=n.XZ.call(this).error)return[2,Promise.reject(t)];if(r=e.name,a=[],"string"==typeof r){if(""===r)throw Error('"Invalid parameter": "name"');a=[r]}else{if(!Array.isArray(r))throw Error('"Invalid parameter": "name"');a=r}return p.kg.debug("Call addToBlockList",e),o=this.context,s=o.orgName,c=o.appName,u=o.accessToken,l=o.jid,h={url:"".concat(this.apiUrl,"/").concat(s,"/").concat(c,"/sdk/user/").concat(this.user,"/blocks?resource=").concat(l.clientResource),type:"POST",dataType:"json",data:JSON.stringify({usernames:a}),headers:{Authorization:"Bearer "+u,"Content-Type":"application/json"}},[4,i.hj.call(this,h,d.fI.ROSTER_BAN).then((function(e){return{type:e.type,data:{userIds:(null==e?void 0:e.data)||[]}}}))];case 1:return[2,f.sent()]}}))}))}var K=H,V=H;function W(e){return y(this,void 0,void 0,(function(){var t,r,a,o,s,c,u,l,h;return T(this,(function(f){switch(f.label){case 0:if(t=n.XZ.call(this).error)return[2,Promise.reject(t)];if(r=e.name,a=[],"string"==typeof r){if(""===r)throw Error('"Invalid parameter": "name"');a=[r]}else{if(!Array.isArray(r))throw Error('"Invalid parameter": "name"');a=r}return p.kg.debug("Call removeFromBlockList",e),o=this.context,s=o.orgName,c=o.appName,u=o.accessToken,l=o.jid,h={url:"".concat(this.apiUrl,"/").concat(s,"/").concat(c,"/sdk/user/").concat(this.user,"/blocks?resource=").concat(l.clientResource),type:"DELETE",dataType:"json",data:JSON.stringify({usernames:a}),headers:{Authorization:"Bearer "+u,"Content-Type":"application/json"}},[4,i.hj.call(this,h,d.fI.ROSTER_ALLOW)];case 1:return f.sent(),[2]}}))}))}var Q=W,Y=W;function $(e){var t=this,r=(null==e?void 0:e.ext)||"";if("string"!=typeof r)throw Error('"Invalid parameter": "ext"',r);var n=this.getUniqueId(),a={id:n,to:e.to};this._msgHash[n]=v({},a);var o="";void 0!==e.chatType?o=e.chatType:void 0!==e.type&&(o="chat"===e.type?"singleChat":e.type);var i={id:n,type:"recall",chatType:o,ackId:e.mid,to:e.to,isChatThread:e.isChatThread||!1,metaExt:r,success:function(r){return y(t,void 0,void 0,(function(){var t,n,a,i,s,c,u,l,p;return T(this,(function(d){switch(d.label){case 0:return d.trys.push([0,5,,6]),"singleChat"!==o&&"groupChat"!==o?[3,4]:[4,null===(a=null===(n=this._localCache)||void 0===n?void 0:n.getInstance())||void 0===a?void 0:a.removeMsgByServerMsgId(e.mid)];case 1:return d.sent(),[4,null===(s=null===(i=this._localCache)||void 0===i?void 0:i.getInstance())||void 0===s?void 0:s.getConversationLastMessage(e.to,o)];case 2:return t=d.sent(),[4,null===(u=null===(c=this._localCache)||void 0===c?void 0:c.getInstance())||void 0===u?void 0:u.updateLocalConversation((0,m.MQ)({conversationId:e.to,conversationType:o}),{lastMessageId:null==t?void 0:t.serverMsgId})];case 3:d.sent(),d.label=4;case 4:return null===(l=null==e?void 0:e.success)||void 0===l||l.call(e,r),[3,6];case 5:return d.sent(),null===(p=null==e?void 0:e.success)||void 0===p||p.call(e,r),[3,6];case 6:return[2]}}))}))},fail:e.fail};return p.kg.debug("Call recallMessage",e),this.mSync.send(i,this)}function ee(e){var t=e||{},r=t.messageId,n=t.modifiedMessage;if(p.kg.debug("Call modifyMessage",r,n),""===r)throw Error('Invalid parameter: "messageId"');if("txt"!==n.type)throw Error('Invalid parameter: "modifiedMessage.type"');return this.mSync.send(v({editMessageId:r},n))}function te(e){return y(this,void 0,void 0,(function(){var t,r,a,o,s,c,u,l,p;return T(this,(function(d){switch(d.label){case 0:if("string"!=typeof e.messageId||!e.messageId)throw Error("Invalid parameter messageId: ".concat(e.messageId));if("string"!=typeof e.reaction||!e.reaction)throw Error("Invalid parameter reaction: ".concat(e.reaction));return(t=n.XZ.call(this).error)?[2,Promise.reject(t)]:(r=this.context,a=r.orgName,o=r.appName,s=r.accessToken,c=e.reaction,u=e.messageId,l={msgId:u,message:c},p={url:"".concat(this.apiUrl,"/").concat(a,"/").concat(o,"/reaction/user/").concat(this.user),type:"POST",data:JSON.stringify(l),dataType:"json",headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"}},[4,i.hj.call(this,p)]);case 1:return d.sent(),[2]}}))}))}function re(e){return y(this,void 0,void 0,(function(){var t,r,a,o,s,c,u,l;return T(this,(function(p){switch(p.label){case 0:if("string"!=typeof e.reaction||!e.reaction)throw Error("Invalid parameter reactionId: ".concat(e.reaction));return(t=n.XZ.call(this).error)?[2,Promise.reject(t)]:(r=this.context,a=r.orgName,o=r.appName,s=r.accessToken,c=e.messageId,u=e.reaction,l={url:"".concat(this.apiUrl,"/").concat(a,"/").concat(o,"/reaction/user/").concat(this.user,"?msgId=").concat(c,"&message=").concat(u),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"}},[4,i.hj.call(this,l)]);case 1:return p.sent(),[2]}}))}))}function ne(e){if("string"!=typeof e.chatType||!e.chatType)throw Error("Invalid parameter chatType: ".concat(e.chatType));if(!e.messageId)throw Error("Invalid parameter messageId: ".concat(e.messageId));var t=n.XZ.call(this).error;if(t)return Promise.reject(t);var r=this.context,a=r.orgName,o=r.appName,s=r.accessToken,c=e.chatType,u=e.messageId,l={msgIdList:"string"==typeof u?[u]:u,msgType:"singleChat"===c?"chat":"groupchat",groupId:e.groupId||null},p={url:"".concat(this.apiUrl,"/").concat(a,"/").concat(o,"/reaction/user/").concat(this.user),type:"GET",data:l,dataType:"json",headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"}};return i.hj.call(this,p).then((function(e){var t=e.data;return null==t||t.forEach((function(e){null==e||e.reactionList.forEach((function(e){e.isAddedBySelf=e.state,delete e.state,delete e.reactionId}))})),e}))}var ae=ne;function oe(e){if("string"!=typeof e.reaction||!e.reaction)throw Error("Invalid parameter reaction: ".concat(e.reaction));if("string"!=typeof e.messageId||!e.messageId)throw Error("Invalid parameter messageId: ".concat(e.messageId));var t=n.XZ.call(this).error;if(t)return Promise.reject(t);var r=this.context,a=r.orgName,o=r.appName,s=r.accessToken,c=e.cursor,u=e.pageSize,l={msgId:e.messageId,message:e.reaction,currentPage:c||null,pageSize:u||20},p={url:"".concat(this.apiUrl,"/").concat(a,"/").concat(o,"/reaction/user/").concat(this.user,"/detail"),type:"GET",data:l,dataType:"json",headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"}};return i.hj.call(this,p).then((function(e){return e.data.isAddedBySelf=e.data.state,delete e.data.state,delete e.data.reactionId,e}))}function ie(e){return y(this,void 0,void 0,(function(){var t,r,a,o,s,c,u,l,p,d,h;return T(this,(function(f){switch(f.label){case 0:if("string"!=typeof e.reportType||!e.reportType)throw Error("Invalid parameter reportType: ".concat(e.reportType));if("string"!=typeof e.messageId||!e.messageId)throw Error("Invalid parameter messageId: ".concat(e.messageId));if("string"!=typeof e.reportReason||!e.reportReason)throw Error("Invalid parameter messageId: ".concat(e.reportReason));return(t=n.XZ.call(this).error)?[2,Promise.reject(t)]:(r=this.context,a=r.orgName,o=r.appName,s=r.accessToken,c=e.reportType,u=e.reportReason,l=e.messageId,p={username:this.user,reportType:c,reportReason:u},d="".concat(this.apiUrl,"/").concat(a,"/").concat(o,"/user/").concat(this.user,"/moderation/report/message/").concat(l),h={url:d,type:"POST",data:JSON.stringify(p),dataType:"json",headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"}},[4,i.hj.call(this,h)]);case 1:return f.sent(),[2]}}))}))}function se(e){var t;return y(this,void 0,void 0,(function(){var r,a,o,s,c,u,l,d,h;return T(this,(function(f){switch(f.label){case 0:if("string"!=typeof e.targetId||""===e.targetId)throw Error('"Invalid parameter targetId": '+e.targetId);if(!["singleChat","groupChat","chatRoom"].includes(e.chatType))throw Error('"Invalid parameter chatType": '+e.chatType);if(e.beforeTimeStamp&&("number"!=typeof e.beforeTimeStamp||e.beforeTimeStamp<0||(null===(t=e.beforeTimeStamp)||void 0===t?void 0:t.toString().length)>18))throw Error('"Invalid parameter beforeTimeStamp": '+e.beforeTimeStamp);if(e.messageIds&&!(Array.isArray(e.messageIds)&&e.messageIds.length>0&&e.messageIds.length<=20))throw Error('"Invalid parameter messageIds": '+e.messageIds);if(!e.messageIds&&!e.beforeTimeStamp)throw Error("messageIds or beforeTimeStamp field is required.");return(r=n.XZ.call(this).error)?[2,Promise.reject(r)]:(a=this.context,o=a.orgName,s=a.appName,c=a.userId,u="singleChat"===e.chatType?"userId":"groupId",l="singleChat"===e.chatType?"chat":"group",d=e.messageIds?"".concat(this.apiUrl,"/").concat(o,"/").concat(s,"/sdk/message/roaming/").concat(l,"/user/").concat(c,"?").concat(u,"=").concat(e.targetId,"&msgIdList=").concat(e.messageIds,"&resource=").concat(this.clientResource):"".concat(this.apiUrl,"/").concat(o,"/").concat(s,"/sdk/message/roaming/").concat(l,"/user/").concat(c,"/time?").concat(u,"=").concat(e.targetId,"&delTime=").concat(e.beforeTimeStamp,"&&resource=").concat(this.clientResource),h={url:d,dataType:"json",type:"DELETE",headers:{Authorization:"Bearer "+this.token,"Content-Type":"application/json"}},p.kg.debug("Call removeHistoryMessages",e),[4,i.hj.call(this,h)]);case 1:return f.sent(),[2]}}))}))}function ce(e){var t=this,r=n.XZ.call(this).error;if(r)return Promise.reject(r);if((null==e?void 0:e.pageSize)&&"number"!=typeof e.pageSize)throw Error("Invalid parameter pageSize: ".concat(e.pageSize));if((null==e?void 0:e.cursor)&&"string"!=typeof e.cursor)throw Error("Invalid parameter cursor: ".concat(e.cursor));var a=this.context,o=a.orgName,s=a.appName,c=a.accessToken,u={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(s,"/sdk/user/").concat(this.user,"/user_channels/list?"),type:"GET",dataType:"json",data:{limit:(null==e?void 0:e.pageSize)||20,cursor:(null==e?void 0:e.cursor)||"",need_mark:!0},headers:{Authorization:"Bearer "+c,"Content-Type":"application/json"}};return p.kg.debug("Call getServerConversations",e),new Promise((function(e,r){i.hj.call(t,u,d.fI.GET_SESSION_LIST).then((function(r){return y(t,void 0,void 0,(function(){var t,n,a=this;return T(this,(function(o){switch(o.label){case 0:return t=ue.call(this,r),this._localCache?(n=t.data.conversations.map((function(e){return y(a,void 0,void 0,(function(){var t,r,n,a;return T(this,(function(o){switch(o.label){case 0:return[4,null===(r=null===(t=this._localCache)||void 0===t?void 0:t.getInstance())||void 0===r?void 0:r.storeMessage(e.lastMessage,f.r.SUCCESS,!0)];case 1:return o.sent(),[4,null===(a=null===(n=this._localCache)||void 0===n?void 0:n.getInstance())||void 0===a?void 0:a.updateLocalConversation((0,m.MQ)({conversationId:e.conversationId,conversationType:e.conversationType}),{unReadCount:e.unReadCount})];case 2:return o.sent(),[2]}}))}))})),[4,Promise.all(n)]):[3,2];case 1:o.sent(),o.label=2;case 2:return e(t),[2]}}))}))})).catch((function(e){r(e)}))}))}function ue(e){var t=this,r=e.data,n=r.cursor,a=r.channel_infos,o=[];null==a||a.forEach((function(e){var r=null;(null==e?void 0:e.meta)&&"{}"!==JSON.stringify(e.meta)&&(e.meta.payload=JSON.parse(e.meta.payload),"delivery"!==(r=h.w.call(t,e.meta)).type&&"read"!==r.type&&"channel"!==r.type&&(r.chatType=h.U[r.chatType]));var n={conversationId:e.session_to,conversationType:"chat"===e.session_type?"singleChat":"groupChat",isPinned:e.is_top,pinnedTime:e.is_top?e.update_top_status_time:0,unReadCount:e.unread_num,lastMessage:r};e.marks&&(n.marks=e.marks.map((function(e){return s.Z[e]}))),o.push(n)}));var i={conversations:o,cursor:n||""};return{type:e.type,data:i}}function le(e){var t=this,r=n.XZ.call(this).error;if(r)return Promise.reject(r);if((null==e?void 0:e.pageSize)&&"number"!=typeof e.pageSize)throw Error("Invalid parameter pageSize: ".concat(e.pageSize));if((null==e?void 0:e.cursor)&&"string"!=typeof e.cursor)throw Error("Invalid parameter cursor: ".concat(e.cursor));var a=this.context,o=a.orgName,s=a.appName,c=a.accessToken,u={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(s,"/sdk/user/").concat(this.user,"/user_channels/list?"),type:"GET",dataType:"json",data:{limit:(null==e?void 0:e.pageSize)||20,cursor:(null==e?void 0:e.cursor)||"",is_top:!0,need_mark:!0},headers:{Authorization:"Bearer "+c,"Content-Type":"application/json"}};return p.kg.debug("Call getServerPinnedConversations",e),i.hj.call(this,u,d.fI.GET_SESSION_LIST).then((function(e){return ue.call(t,e)}))}function pe(e){return y(this,void 0,void 0,(function(){var t,r,a,o,s,c,u,l,h,f,m,g,v,y;return T(this,(function(T){if(t=n.XZ.call(this).error)return[2,Promise.reject(t)];if(r=e.conversationId,a=e.conversationType,o=e.isPinned,s="singleChat"===a?"chat":"groupChat","string"!=typeof r||""===r)throw Error("Invalid parameter conversationId: ".concat(r));if(!["singleChat","groupChat"].includes(a))throw Error("Invalid parameter conversationType: ".concat(a));if("boolean"!=typeof o)throw Error("Invalid parameter isPinned: ".concat(o));return c=this.context,u=c.orgName,l=c.appName,h=c.accessToken,f=c.jid,m={type:s,to:r},g=o?"":"type=".concat(s,"&to=").concat(r,"&"),v="".concat(this.apiUrl,"/").concat(u,"/").concat(l,"/sdk/user/").concat(this.user,"/user_channel/top?").concat(g,"resource=").concat(f.clientResource),y={url:v,type:o?"POST":"DELETE",dataType:"json",headers:{Authorization:"Bearer "+h,"Content-Type":"application/json"}},o&&(y.data=JSON.stringify(m)),p.kg.debug("Call pinConversation",e),[2,i.hj.call(this,y,d.fI.PIN_CONVERSATION).then((function(e){var t=e.type,r=e.data;return{type:t,data:{isPinned:r.is_top||!1,pinnedTime:r.is_top?r.update_top_status_time:0}}}))]}))}))}function de(e){return y(this,void 0,void 0,(function(){var t,r,a,o,s,c,u,l,h,f;return T(this,(function(m){switch(m.label){case 0:if(t=e.userId,r=e.remark,a=n.XZ.call(this).error)return[2,Promise.reject(a)];if("string"!=typeof t||""===t)throw Error('Invalid parameter: "userId"');if("string"!=typeof r)throw Error('Invalid parameter: "remark"');return p.kg.debug("Call setContactRemark",e),o=this.context,s=o.orgName,c=o.appName,u=o.accessToken,l=o.jid,h="".concat(this.apiUrl,"/").concat(s,"/").concat(c,"/users/").concat(this.context.userId,"/contacts/users/").concat(t,"?resource=").concat(l.clientResource),f={url:h,type:"PUT",data:JSON.stringify({remark:r}),dataType:"json",headers:{Authorization:"Bearer "+u,"Content-Type":"application/json"}},[4,i.hj.call(this,f,d.fI.ROSTER_SET_CONTACT_REMARK)];case 1:return m.sent(),[2]}}))}))}function he(){var e=n.XZ.call(this).error;if(e)return Promise.reject(e);var t=this.context,r=t.orgName,a=t.appName,o=t.accessToken,s={url:"".concat(this.apiUrl,"/").concat(r,"/").concat(a,"/users/").concat(this.user,"/contacts/users?needReturnRemark=true"),dataType:"json",type:"GET",headers:{Authorization:"Bearer "+o}};return p.kg.debug("Call getAllContacts"),i.hj.call(this,s,d.fI.ROSTER_GET_ALL_CONTACTS_REMARKS).then((function(e){var t=((null==e?void 0:e.entities)||[]).map((function(e){return{userId:e.username,remark:e.remark}}));return{type:e.type,data:t}}))}function fe(e){var t=n.XZ.call(this).error;if(t)return Promise.reject(t);p.kg.debug("Call getContactsWithCursor",e);var r=e||{},a=r.pageSize,o=void 0===a?20:a,s=r.cursor,c=void 0===s?"":s;if(o&&"number"!=typeof o)throw Error("Invalid parameter pageSize: ".concat(e.pageSize));var u=this.context,l=u.orgName,h=u.appName,f=u.accessToken,m={url:"".concat(this.apiUrl,"/").concat(l,"/").concat(h,"/users/").concat(this.user,"/contacts?needReturnRemark=true&limit=").concat(o,"&cursor=").concat(c),dataType:"json",type:"GET",headers:{Authorization:"Bearer "+f}};return i.hj.call(this,m,d.fI.ROSTER_GET_ALL_CONTACTS_REMARKS_FROM_SERVER_BY_PAGE).then((function(e){var t,r,n=(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.contacts)||[],a=(null===(r=null==e?void 0:e.data)||void 0===r?void 0:r.cursor)||"",o=n.map((function(e){return{userId:e.username,remark:e.remark}}));return{type:e.type,data:{cursor:a,contacts:o}}}))}function me(e){return y(this,void 0,void 0,(function(){var t,r,a,o,c,u,l,f,m,g,v,y,k,E,C;return T(this,(function(T){switch(T.label){case 0:if(t=n.XZ.call(this).error)return[2,Promise.reject(t)];if(p.kg.debug("Call markConversation",e),a=(r=e||{}).conversations,o=void 0===a?[]:a,c=r.mark,u=r.isMarked,!Array.isArray(o))throw Error("Invalid parameter conversations");if(l=o.map((function(e){if(!e.conversationId||!["singleChat","groupChat"].includes(e.conversationType))throw Error("Invalid parameter conversations");return{to:e.conversationId,type:I[e.conversationType]}})),"boolean"!=typeof u)throw Error("Invalid parameter isMarked: ".concat(u));if("number"!=typeof c)throw Error("Invalid parameter mark: ".concat(c));return f=this.context,m=f.orgName,g=f.appName,v=f.accessToken,y=f.userId,k=f.jid,E={mark:s.Z[c],targets:l},C={url:"".concat(this.apiUrl,"/").concat(m,"/").concat(g,"/sdk/user/").concat(y,"/user_channels/mark?resource=").concat(k.clientResource),dataType:"json",data:JSON.stringify(E),type:u?"Post":"Delete",headers:{Authorization:"Bearer "+v}},[4,i.hj.call(this,C,d.fI.MARK_CONVERSATION).then((function(e){var t,r=(null===(t=e.data)||void 0===t?void 0:t.ignore)||[];r&&Array.isArray(r)&&r.length>0&&p.kg.debug("markConversation has ignored conversations",r.map((function(e){return{conversationId:e.to,conversationType:h.U[e.type]}})))}))];case 1:return T.sent(),[2]}}))}))}function ge(e){return y(this,void 0,void 0,(function(){var t,r;return T(this,(function(n){return p.kg.debug("Call addConversationMark",e),t=e.conversations,r=e.mark,[2,me.call(this,{conversations:t,mark:r,isMarked:!0})]}))}))}function ve(e){return y(this,void 0,void 0,(function(){var t,r;return T(this,(function(n){return p.kg.debug("Call removeConversationMark",e),t=e.conversations,r=e.mark,[2,me.call(this,{conversations:t,mark:r,isMarked:!1})]}))}))}function ye(e){var t,r,a=this,o=n.XZ.call(this).error;if(o)return Promise.reject(o);if(p.kg.debug("Call getServerConversationsByFilter",e),(null==e?void 0:e.pageSize)&&"number"!=typeof e.pageSize)throw Error("Invalid parameter pageSize: ".concat(e.pageSize));if((null==e?void 0:e.cursor)&&"string"!=typeof e.cursor)throw Error("Invalid parameter cursor: ".concat(e.cursor));if("number"!=typeof(null===(t=null==e?void 0:e.filter)||void 0===t?void 0:t.mark))throw Error("Invalid parameter mark: ".concat(null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.mark));var c=this.context,u=c.orgName,l=c.appName,h=c.accessToken,f="".concat(this.apiUrl,"/").concat(u,"/").concat(l,"/sdk/user/").concat(this.user,"/user_channels/mark/search?"),m=e.pageSize,g=e.cursor,v=((null==e?void 0:e.filter)||{}).mark,y={url:f,type:"GET",dataType:"json",data:{limit:m||10,cursor:g||"",need_mark:!0,mark:s.Z[v]},headers:{Authorization:"Bearer "+h,"Content-Type":"application/json"}};return i.hj.call(this,y,d.fI.GET_SESSION_LIST).then((function(e){return ue.call(a,e)}))}function Te(){var e=n.XZ.call(this).error;if(e)return Promise.reject(e);p.kg.debug("Call getSelfIdsOnOtherPlatform");var t=this.context,r=t.orgName,a=t.appName,o=t.accessToken,s=t.userId,c=t.jid,u={url:"".concat(this.apiUrl,"/").concat(r,"/").concat(a,"/users/").concat(s,"/resources"),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+o,"Content-Type":"application/json"}};return i.hj.call(this,u,d.fI.USER_LOGGEDIN_OTHER_PLATFORM).then((function(e){var t,r=null===(t=e.data)||void 0===t?void 0:t.filter((function(e){return e.res!==c.clientResource})),n=null==r?void 0:r.map((function(e){return"".concat(s,"/").concat(e.res)}));return{type:e.type,data:n}}))}function Ie(){var e,t,r,a,o,s;return y(this,void 0,void 0,(function(){var c,u,l,h,f,m,g,v,y;return T(this,(function(T){switch(T.label){case 0:return(c=n.XZ.call(this).error)?[2,Promise.reject(c)]:(p.kg.debug("Call deleteAllMessagesAndConversations"),u=this.context,l=u.orgName,h=u.appName,f=u.accessToken,m=u.userId,g=u.jid,v="".concat(this.apiUrl,"/").concat(l,"/").concat(h,"/sdk/message/roaming/user/").concat(m,"/delete/all?resource=").concat(g.clientResource),y={url:v,type:"POST",dataType:"json",headers:{Authorization:"Bearer "+f,"Content-Type":"application/json"}},[4,i.hj.call(this,y,d.fI.REST_DELETE_MESSAGES_CONVERSATIONS)]);case 1:return T.sent(),null===(t=null===(e=this._localCache)||void 0===e?void 0:e.getInstance())||void 0===t||t.clearConversationMap(),[4,null===(a=null===(r=this._localCache)||void 0===r?void 0:r.getInstance())||void 0===a?void 0:a.clearStoreData("conversationList")];case 2:return T.sent(),[4,null===(s=null===(o=this._localCache)||void 0===o?void 0:o.getInstance())||void 0===s?void 0:s.clearStoreData("message")];case 3:return T.sent(),[2]}}))}))}function ke(e){return y(this,void 0,void 0,(function(){var t,r,a,o,s,c,u,l,h,f,m,g,v,y,k;return T(this,(function(T){switch(T.label){case 0:if(t=n.XZ.call(this).error)return[2,Promise.reject(t)];if(p.kg.debug("Call setMessagePinStatus",e),a=(r=e||{}).conversationId,o=void 0===a?"":a,s=r.conversationType,c=r.messageId,u=r.isPinned,"string"!=typeof o||""===o)throw Error("Invalid parameter conversationId");if("string"!=typeof c||""===c)throw Error("Invalid parameter messageId");if("boolean"!=typeof u)throw Error("Invalid parameter isPinned");return l=this.context,h=l.orgName,f=l.appName,m=l.accessToken,g=l.userId,v=l.jid,y={to:o,type:I[s],pin_msg_id:c},k={url:"".concat(this.apiUrl,"/").concat(h,"/").concat(f,"/sdk/user/").concat(g,"/user_channel/pin?resource=").concat(v.clientResource),dataType:"json",data:JSON.stringify(y),type:u?"Post":"Delete",headers:{Authorization:"Bearer "+m}},[4,i.hj.call(this,k,d.fI.REST_PIN_MESSAGE)];case 1:return T.sent(),[2]}}))}))}function Ee(e){return y(this,void 0,void 0,(function(){var t,r,n,a;return T(this,(function(o){return p.kg.debug("Call pinMessage",e),r=(t=e||{}).conversationType,n=t.conversationId,a=t.messageId,[2,ke.call(this,{conversationId:n,conversationType:r,messageId:a,isPinned:!0})]}))}))}function Ce(e){return y(this,void 0,void 0,(function(){var t,r,n,a;return T(this,(function(o){return p.kg.debug("Call unpinMessage",e),r=(t=e||{}).conversationType,n=t.conversationId,a=t.messageId,[2,ke.call(this,{conversationId:n,conversationType:r,messageId:a,isPinned:!1})]}))}))}function je(e){var t=this,r=n.XZ.call(this).error;if(r)return Promise.reject(r);p.kg.debug("Call getServerPinnedMessages",e);var a=e.conversationId,o=e.conversationType,s=e.pageSize,c=e.cursor;if("string"!=typeof a||""===a)throw Error("Invalid parameter conversationId");if(s&&"number"!=typeof s)throw Error("Invalid parameter pageSize: ".concat(s));if(c&&"string"!=typeof c)throw Error("Invalid parameter cursor: ".concat(c));var u=this.context,l=u.orgName,f=u.appName,m=u.accessToken,g={url:"".concat(this.apiUrl,"/").concat(l,"/").concat(f,"/sdk/user/").concat(this.user,"/user_channel/pin"),type:"GET",dataType:"json",data:{to:a,type:I[o],limit:s||10,cursor:c||""},headers:{Authorization:"Bearer "+m,"Content-Type":"application/json"}};return i.hj.call(this,g,d.fI.GET_SESSION_LIST).then((function(e){return{type:0,data:{list:e.data.msg_infos.map((function(e){e.message.payload=JSON.parse(e.message.payload);var r=e.message,n=e.pin_opt_at,a=e.pin_operator;return{message:h.w.call(t,r,{formatChatType:!0}),pinTime:n,operatorId:a}})),cursor:e.data.cursor||""}}}))}function Se(){var e=this;p.kg.debug("Call unbindPushToken");var t={deviceId:this.clientResource,deviceToken:"",notifierName:this.pushCertificateName};return g.r.call(this,t).then((function(t){return e.isRegisterPush=!1,t}))}},5069:function(e,t,r){var n=r(2109),a=r(1702),o=r(3157),i=a([].reverse),s=[1,2];n({target:"Array",proto:!0,forced:String(s)===String(s.reverse())},{reverse:function(){return o(this)&&(this.length=this.length),i(this)}})}},function(e){return 7479,e(e.s=7479)}])}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.websdk=t():e.websdk=t()}(self,(function(){return(self.webpackChunkwebsdk=self.webpackChunkwebsdk||[]).push([[564],{7479:function(e,t,r){r.r(t),r.d(t,{acceptContactInvite:function(){return J},acceptInvitation:function(){return D},addContact:function(){return Z},addConversationMark:function(){return ge},addReaction:function(){return te},addToBlackList:function(){return H},addUsersToBlacklist:function(){return K},addUsersToBlocklist:function(){return V},declineContactInvite:function(){return F},declineInvitation:function(){return q},deleteAllMessagesAndConversations:function(){return Ie},deleteContact:function(){return X},deleteConversation:function(){return O},deleteReaction:function(){return re},deleteSession:function(){return R},fetchHistoryMessages:function(){return B},fetchUserInfoById:function(){return x},getAllContacts:function(){return he},getBlacklist:function(){return k},getBlocklist:function(){return E},getContacts:function(){return j},getContactsWithCursor:function(){return fe},getConversationlist:function(){return w},getHistoryMessages:function(){return L},getReactionDetail:function(){return oe},getReactionList:function(){return ne},getReactionlist:function(){return ae},getRoster:function(){return C},getSelfIdsOnOtherPlatform:function(){return Te},getServerConversations:function(){return ce},getServerConversationsByFilter:function(){return ye},getServerPinnedConversations:function(){return le},getServerPinnedMessages:function(){return je},getSessionList:function(){return N},getTokenExpireTimestamp:function(){return U},modifyMessage:function(){return ee},pinConversation:function(){return pe},pinMessage:function(){return Ee},recallMessage:function(){return $},removeConversationMark:function(){return ve},removeFromBlackList:function(){return W},removeHistoryMessages:function(){return se},removeRoster:function(){return G},removeUserFromBlackList:function(){return Q},removeUserFromBlocklist:function(){return Y},reportMessage:function(){return ie},setContactRemark:function(){return de},unbindPushToken:function(){return Se},unpinMessage:function(){return Ce},updateCurrentUserNick:function(){return z},updateOwnUserInfo:function(){return A},updateUserInfo:function(){return P},uploadPushToken:function(){return b},uploadToken:function(){return S}}),r(9601),r(1539),r(8674),r(2526),r(1817),r(2165),r(6992),r(8783),r(3948),r(9554),r(4747),r(2222),r(7941),r(6699),r(3710),r(9714),r(9600),r(5069),r(561),r(9753),r(8309),r(1249),r(7327);var n=r(3246),a=r(5531),o=r(7252),i=r(4024),s=r(9937),c=r(8161),u=r(4188),l=r.n(u),p=r(7360),d=r(1595),h=r(4363),f=r(7288),m=r(9743),g=r(6801),v=function(){return v=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e},v.apply(this,arguments)},y=function(e,t,r,n){return new(r||(r=Promise))((function(a,o){function i(e){try{c(n.next(e))}catch(e){o(e)}}function s(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?a(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,s)}c((n=n.apply(e,t||[])).next())}))},T=function(e,t){var r,n,a,o,i={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;i;)try{if(r=1,n&&(a=2&o[0]?n.return:o[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,o[1])).done)return a;switch(n=0,a&&(o=[2&o[0],a.value]),o[0]){case 0:case 1:a=o;break;case 4:return i.label++,{value:o[1],done:!1};case 5:i.label++,n=o[1],o=[0];continue;case 7:o=i.ops.pop(),i.trys.pop();continue;default:if(!((a=(a=i.trys).length>0&&a[a.length-1])||6!==o[0]&&2!==o[0])){i=0;continue}if(3===o[0]&&(!a||o[1]>a[0]&&o[1]<a[3])){i.label=o[1];break}if(6===o[0]&&i.label<a[1]){i.label=a[1],a=o;break}if(a&&i.label<a[2]){i.label=a[2],i.ops.push(o);break}a[2]&&i.ops.pop(),i.trys.pop();continue}o=t.call(e,i)}catch(e){o=[6,e],n=0}finally{r=a=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}},I={singleChat:"chat",chatRoom:"chatroom",groupChat:"groupchat"};function k(e){var t=n.XZ.call(this).error;if(t)return Promise.reject(t);var r=this.context,a=r.orgName,o=r.appName,s=r.accessToken,c={url:this.apiUrl+"/"+a+"/"+o+"/users/"+this.user+"/blocks/users",dataType:"json",type:"GET",headers:{Authorization:"Bearer "+s},success:function(t){var r={};t.data.forEach((function(e){r[e]={name:e}})),"function"==typeof(null==e?void 0:e.success)&&e.success(t)},error:function(t){"function"==typeof(null==e?void 0:e.error)&&e.error(t)}};return p.kg.debug("Call getBlocklist"),i.hj.call(this,c,d.fI.GET_BLACK_LIST)}var E=k,C=j;function j(e){var t=this,r=n.XZ.call(this).error;if(r)return Promise.reject(r);var a=this.context,o=a.orgName,s=a.appName,c=a.accessToken,u={url:this.apiUrl+"/"+o+"/"+s+"/users/"+this.user+"/contacts/users",dataType:"json",type:"GET",headers:{Authorization:"Bearer "+c},success:function(r){var n=[];r.data.forEach((function(e){n.push({name:e,subscription:"both",jid:t.context.jid})})),"function"==typeof(null==e?void 0:e.success)&&e.success(n)},error:function(t){"function"==typeof(null==e?void 0:e.error)&&e.error(t)}};return p.kg.debug("Call getContacts"),i.hj.call(this,u,d.fI.GET_CONTACTS)}function S(e){return p.kg.debug("Call uploadPushToken"),g.r.call(this,e)}var b=S;function N(e){var t=n.XZ.call(this).error;if(t)return Promise.reject(t);var r=this.context,a=r.orgName,o=r.appName,s=r.accessToken,c={url:"".concat(this.apiUrl,"/").concat(a,"/").concat(o,"/users/").concat(this.user,"/user_channels"),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"},success:e&&(null==e?void 0:e.success),error:e&&(null==e?void 0:e.error)};return p.kg.debug("Call getSessionList"),i.hj.call(this,c,d.fI.GET_SESSION_LIST)}function w(e){var t=this,r=n.XZ.call(this).error;if(r)return Promise.reject(r);var a=this.context,o=a.orgName,s=a.appName,c=a.accessToken,u=!!(e&&"number"==typeof e.pageNum&&"number"==typeof e.pageSize&&e.pageNum>0&&e.pageSize>0),l={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(s,"/users/").concat(this.user,"/user_channels").concat(u?"/page":""),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+c,"Content-Type":"application/json"},success:e&&(null==e?void 0:e.success),error:e&&(null==e?void 0:e.error)};return u&&(l.data={pageNum:e.pageNum,pageSize:e.pageSize}),p.kg.debug("Call getConversationlist"),i.hj.call(this,l,d.fI.GET_SESSION_LIST).then((function(e){return _.call(t,e)}))}function _(e){var t=this,r=e.data.channel_infos;return null==r||r.forEach((function(e){e.meta&&"{}"!==JSON.stringify(e.meta)?(e.meta.payload=JSON.parse(e.meta.payload),e.lastMessage=h.w.call(t,e.meta,{formatCustomExts:!1})):e.lastMessage=e.meta,delete e.meta})),e}function R(e){if(e&&"string"!=typeof e.channel)throw Error("Invalid parameter channel: ".concat(e.channel));if(e&&"singleChat"!==e.chatType&&"groupChat"!==e.chatType)throw Error("Invalid parameter chatType: ".concat(e.chatType));if(e&&"boolean"!=typeof e.deleteRoam)throw Error("Invalid parameter deleteRoam: ".concat(e.deleteRoam));var t=n.XZ.call(this).error;if(t)return Promise.reject(t);var r,a=this.context,o=a.orgName,s=a.appName,c=a.accessToken,u=a.jid;r="singleChat"===e.chatType?"chat":"groupChat";var l={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(s,"/user/").concat(this.user,"/user_channel?resource=").concat(u.clientResource),dataType:"json",type:"DELETE",data:JSON.stringify({channel:e.channel,type:r,delete_roam:e.deleteRoam}),headers:{Authorization:"Bearer "+c,"Content-Type":"application/json"},success:e.success,error:e.error};return p.kg.debug("Call deleteSession",e),i.hj.call(this,l,d.fI.DELETE_SESSION)}var O=R;function A(e,t){var r=n.XZ.call(this).error;if(r)return Promise.reject(r);var a=this.context,o=a.orgName,s=a.appName,c=a.accessToken,u=["nickname","avatarurl","mail","phone","gender","sign","birth","ext"],l={},h=i.P6.getEnvInfo();if("wx"===h.platform||"qq"===h.platform)if("string"==typeof e&&void 0!==t){if(!u.includes(e))throw new Error("illegal key, only these keys: nickname, avatarurl, mail, phone, gender, sign, birth, ext are allowed");l[e]=t}else{if("[object Object]"!==Object.prototype.toString.call(e))throw new Error("illegal params");u.forEach((function(t){u.includes(t)&&void 0!==e[t]&&(l[t]=e[t])}))}else if("string"==typeof e){if(!u.includes(e))throw new Error("illegal key, only these keys: nickname, avatarurl, mail, phone, gender, sign, birth, ext are allowed");l=e+"="+t}else{if("[object Object]"!==Object.prototype.toString.call(e))throw new Error("illegal params");var f=[];u.forEach((function(t){if(u.includes(t)&&void 0!==e[t]){var r=encodeURIComponent(t),n=encodeURIComponent(e[t]);f.push(r+"="+n)}})),l=f.join("&")}var m={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(s,"/metadata/user/").concat(this.user),type:"PUT",data:l,dataType:"json",headers:{Authorization:"Bearer "+c,"Content-Type":"application/x-www-form-urlencoded"}};return p.kg.debug("Call updateOwnUserInfo",e),i.hj.call(this,m,d.fI.UPDATE_USER_INFO)}var P=A;function x(e,t){var r=n.XZ.call(this).error;if(r)return Promise.reject(r);var a,o=this.context,s=o.orgName,c=o.appName,u=o.accessToken,l=[];if("string"==typeof e)l=[e];else{if("[object Array]"!==Object.prototype.toString.call(e))throw new Error("illegal params");l=e}a="string"==typeof t?[t]:t&&"[object Array]"===Object.prototype.toString.call(t)?t:["nickname","avatarurl","mail","phone","gender","sign","birth","ext"];var h={url:"".concat(this.apiUrl,"/").concat(s,"/").concat(c,"/metadata/user/get"),type:"POST",data:JSON.stringify({targets:l,properties:a}),dataType:"json",headers:{Authorization:"Bearer "+u,"Content-Type":"application/json"}};return p.kg.debug("Call fetchUserInfoById",e),i.hj.call(this,h,d.fI.GET_USER_INFO)}function z(e){var t=n.XZ.call(this).error;if(t)return Promise.reject(t);var r=this.context,a=r.orgName,o=r.appName,s=r.accessToken,c={url:"".concat(this.apiUrl,"/").concat(a,"/").concat(o,"/users/").concat(this.user),type:"PUT",dataType:"json",data:JSON.stringify({nickname:e}),headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"}};return p.kg.debug("Call updateCurrentUserNick",e),i.hj.call(this,c)}function U(e){if("string"!=typeof e||""===e)throw Error('Invalid parameter: "token"');var t=this.context,r=t.orgName,n=t.appName,a={url:"".concat(this.apiUrl,"/").concat(r,"/").concat(n,"/sdk/users/").concat(this.user,"/token/expires"),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+e,"Content-Type":"application/json"}};return p.kg.debug("Call getTokenExpireTimestamp",e),i.hj.call(this,a,d.fI.SDK_INTERNAL)}function B(e){var t=this;return new Promise((function(r,a){if(!e.queue)throw Error('Invalid parameter: "specified"');var o=n.XZ.call(t).error;if(o)return Promise.reject(o);(function e(t){var n=this,o=t.count||20;M.call(this,{count:o,isGroup:!!t.isGroup,queue:t.queue,start:t.start,format:t.format,success:function(a){if(a.msgs.length>=o||a.is_last){var i=a.msgs.splice(0,o).reverse();t.success&&t.success(i),r(i)}else e.call(n,v(v({},t),{start:null}))},fail:function(e){a(e),t.fail&&t.fail(e)}})}).call(t,e),p.kg.debug("Call fetchHistoryMessages",e)}))}function M(e){var t=this,r=e.queue,n=this.mr_cache[r]||(this.mr_cache[r]={msgs:[]}),s=this.context.userId,u=e.start||-1,p=e.count||20;if(n.msgs.length>=p||n.is_last)"function"==typeof e.success&&e.success(n);else{n&&n.next_key&&(u=n.next_key),e.start&&(u=e.start);var h={queue:r+(e.isGroup?"@conference.easemob.com":"@easemob.com"),start:u,end:-1},f=this.context,m=f.orgName,g=f.appName,v={url:"".concat(this.apiUrl,"/").concat(m,"/").concat(g,"/users/").concat(s,"/messageroaming"),dataType:"json",type:"POST",headers:{Authorization:"Bearer "+this.token,"Content-Type":"application/json"},data:JSON.stringify(h),success:function(r){return y(t,void 0,void 0,(function(){var t,a,o,i,s,u,p=this;return T(this,(function(d){switch(d.label){case 0:if(t=null==r?void 0:r.data,!r.data.msgs)return"function"==typeof e.success&&e.success(n),n.is_last=!0,n.next_key="",[2];a=t.msgs,o=a.length,n.is_last=t.is_last,n.next_key=t.next_key,i=function(t){return y(p,void 0,void 0,(function(){var r,n,a,o,i;return T(this,(function(s){switch(s.label){case 0:for(r=[],t=l().atob(t),n=0,a=t.length;n<a;++n)r.push(t.charCodeAt(n));return o=(o=this.context.root.lookup("easemob.pb.Meta")).decode(r),i={errorCode:0,reason:""},1!==o.ns?[3,2]:[4,c.ZP.call(this,o,i,!0,e.format)];case 1:return[2,s.sent()];case 2:return[2]}}))}))},s=0,d.label=1;case 1:return s<o?[4,i(a[s].msg)]:[3,4];case 2:(u=d.sent())&&n.msgs.push(u),d.label=3;case 3:return s++,[3,1];case 4:return"function"==typeof e.success&&e.success(n),[2]}}))}))},error:function(e){if(e.error&&e.error_description){var r=o.Z.create({type:a.E.WEBIM_CONNCTION_AJAX_ERROR,message:"fetch history messages error",data:e});t.onError&&t.onError(r)}}};i.hj.call(this,v,d.fI.GET_HISTORY_MSG).catch((function(t){"function"==typeof e.fail&&e.fail(t)}))}}function L(e){var t=this;return new Promise((function(r,a){var o=e.targetId,s=e.cursor,u=void 0===s?-1:s,d=e.pageSize,h=void 0===d?20:d,f=e.chatType,m=e.searchDirection,g=e.searchOptions,v=void 0===g?{}:g,I=v.msgTypes,k=void 0===I?[]:I,E=v.startTime,C=void 0===E?null:E,j=v.endTime,S=void 0===j?null:j,b=v.from,N=void 0===b?null:b;if("string"!=typeof o||""===o)throw Error('"Invalid parameter": "targetId"');if(N&&"string"!=typeof N)throw Error('"Invalid parameter": "searchOptions.from"');if(k&&!Array.isArray(k))throw Error('"Invalid parameter": "searchOptions.msgTypes"');if(C&&"number"!=typeof C)throw Error('"Invalid parameter": "searchOptions.startTime"');if(S&&"number"!=typeof C)throw Error('"Invalid parameter": "searchOptions.endTime"');var w=n.XZ.call(t).error;if(w)return Promise.reject(w);var _=t.context,R=_.orgName,O=_.appName,A=_.userId,P="singleChat"===e.chatType?"@easemob.com":"@conference.easemob.com",x={queue:"".concat(o).concat(P),start:u,pull_number:h,is_positive:"down"===m,msgType:k.join(",")||"",end:-1,startTime:C,endTime:S,userId:"singleChat"===f?null:N},z={url:"".concat(t.apiUrl,"/").concat(R,"/").concat(O,"/users/").concat(A,"/messageroaming"),dataType:"json",type:"POST",headers:{Authorization:"Bearer "+t.token,"Content-Type":"application/json"},data:JSON.stringify(x),success:function(n){return y(t,void 0,void 0,(function(){var t,a,o,i,s,u,p,d,h=this;return T(this,(function(f){switch(f.label){case 0:t=null==n?void 0:n.data,a=t.msgs||[],o=function(e){return y(h,void 0,void 0,(function(){var t,r,n,a,o;return T(this,(function(i){switch(i.label){case 0:for(t=[],e=l().atob(e),r=0,n=e.length;r<n;++r)t.push(e.charCodeAt(r));return a=(a=this.context.root.lookup("easemob.pb.Meta")).decode(t),o={errorCode:0,reason:""},1!==a.ns?[3,2]:[4,c.ZP.call(this,a,o,!0,!0)];case 1:return[2,i.sent()];case 2:return[2]}}))}))},i=[],s=0,f.label=1;case 1:return s<a.length?[4,o(a[s].msg)]:[3,4];case 2:(u=f.sent())&&i.push(u),f.label=3;case 3:return s++,[3,1];case 4:return t.msgs=i,p={cursor:t.next_key,messages:i,isLast:t.is_last},null===(d=e.success)||void 0===d||d.call(e,p),r(p),[2]}}))}))},error:e.fail};i.hj.call(t,z).catch((function(e){a(e)})),p.kg.debug("Call getHistoryMessages",e)}))}function Z(e,t){return y(this,void 0,void 0,(function(){var r,a,o,s,c,u,l;return T(this,(function(h){switch(h.label){case 0:if(r=n.XZ.call(this).error)return[2,Promise.reject(r)];if("string"!=typeof e||""===e)throw Error('"Invalid parameter": "to"');return p.kg.debug("Call addContact",e,t),a=this.context,o=a.orgName,s=a.appName,c=a.accessToken,u=a.jid,l={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(s,"/users/").concat(this.user,"/contacts/apply?resource=").concat(u.clientResource),type:"POST",dataType:"json",data:JSON.stringify({usernames:[e],reason:t}),headers:{Authorization:"Bearer "+c,"Content-Type":"application/json"}},[4,i.hj.call(this,l,d.fI.ROSTER_ADD)];case 1:return h.sent(),[2]}}))}))}var G=X;function X(e){return y(this,void 0,void 0,(function(){var t,r,a,o,s,c,u;return T(this,(function(l){switch(l.label){case 0:if(t=n.XZ.call(this).error)return[2,Promise.reject(t)];if("string"!=typeof e||""===e)throw Error('"Invalid parameter": "to"');return p.kg.debug("Call deleteContact",e),r=this.context,a=r.orgName,o=r.appName,s=r.accessToken,c=r.jid,u={url:"".concat(this.apiUrl,"/").concat(a,"/").concat(o,"/users/").concat(this.user,"/contacts/users/").concat(e,"?resource=").concat(c.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"}},[4,i.hj.call(this,u,d.fI.ROSTER_REMOVE)];case 1:return l.sent(),[2]}}))}))}function D(e){return y(this,void 0,void 0,(function(){var t,r,a,o,s,c,u;return T(this,(function(l){switch(l.label){case 0:if(t=n.XZ.call(this).error)return[2,Promise.reject(t)];if("string"!=typeof e||""===e)throw Error('"Invalid parameter": "to"');return p.kg.debug("Call acceptInvitation",e),r=this.context,a=r.orgName,o=r.appName,s=r.accessToken,c=r.jid,u={url:"".concat(this.apiUrl,"/").concat(a,"/").concat(o,"/users/").concat(this.user,"/contacts/accept/users/").concat(e,"?resource=").concat(c.clientResource),type:"POST",dataType:"json",headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"}},[4,i.hj.call(this,u,d.fI.ROSTER_ACCEPT)];case 1:return l.sent(),[2]}}))}))}var J=D;function q(e){return y(this,void 0,void 0,(function(){var t,r,a,o,s,c,u;return T(this,(function(l){switch(l.label){case 0:if(t=n.XZ.call(this).error)return[2,Promise.reject(t)];if("string"!=typeof e||""===e)throw Error('"Invalid parameter": "to"');return p.kg.debug("Call declineInvitation",e),r=this.context,a=r.orgName,o=r.appName,s=r.accessToken,c=r.jid,u={url:"".concat(this.apiUrl,"/").concat(a,"/").concat(o,"/users/").concat(this.user,"/contacts/decline/users/").concat(e,"?resource=").concat(c.clientResource),type:"POST",dataType:"json",headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"}},[4,i.hj.call(this,u,d.fI.ROSTER_DECLINE)];case 1:return l.sent(),[2]}}))}))}var F=q;function H(e){return y(this,void 0,void 0,(function(){var t,r,a,o,s,c,u,l,h;return T(this,(function(f){switch(f.label){case 0:if(t=n.XZ.call(this).error)return[2,Promise.reject(t)];if(r=e.name,a=[],"string"==typeof r){if(""===r)throw Error('"Invalid parameter": "name"');a=[r]}else{if(!Array.isArray(r))throw Error('"Invalid parameter": "name"');a=r}return p.kg.debug("Call addToBlockList",e),o=this.context,s=o.orgName,c=o.appName,u=o.accessToken,l=o.jid,h={url:"".concat(this.apiUrl,"/").concat(s,"/").concat(c,"/sdk/user/").concat(this.user,"/blocks?resource=").concat(l.clientResource),type:"POST",dataType:"json",data:JSON.stringify({usernames:a}),headers:{Authorization:"Bearer "+u,"Content-Type":"application/json"}},[4,i.hj.call(this,h,d.fI.ROSTER_BAN).then((function(e){return{type:e.type,data:{userIds:(null==e?void 0:e.data)||[]}}}))];case 1:return[2,f.sent()]}}))}))}var K=H,V=H;function W(e){return y(this,void 0,void 0,(function(){var t,r,a,o,s,c,u,l,h;return T(this,(function(f){switch(f.label){case 0:if(t=n.XZ.call(this).error)return[2,Promise.reject(t)];if(r=e.name,a=[],"string"==typeof r){if(""===r)throw Error('"Invalid parameter": "name"');a=[r]}else{if(!Array.isArray(r))throw Error('"Invalid parameter": "name"');a=r}return p.kg.debug("Call removeFromBlockList",e),o=this.context,s=o.orgName,c=o.appName,u=o.accessToken,l=o.jid,h={url:"".concat(this.apiUrl,"/").concat(s,"/").concat(c,"/sdk/user/").concat(this.user,"/blocks?resource=").concat(l.clientResource),type:"DELETE",dataType:"json",data:JSON.stringify({usernames:a}),headers:{Authorization:"Bearer "+u,"Content-Type":"application/json"}},[4,i.hj.call(this,h,d.fI.ROSTER_ALLOW)];case 1:return f.sent(),[2]}}))}))}var Q=W,Y=W;function $(e){var t=this,r=(null==e?void 0:e.ext)||"";if("string"!=typeof r)throw Error('"Invalid parameter": "ext"',r);var n=this.getUniqueId(),a={id:n,to:e.to};this._msgHash[n]=v({},a);var o="";void 0!==e.chatType?o=e.chatType:void 0!==e.type&&(o="chat"===e.type?"singleChat":e.type);var i={id:n,type:"recall",chatType:o,ackId:e.mid,to:e.to,isChatThread:e.isChatThread||!1,metaExt:r,success:function(r){return y(t,void 0,void 0,(function(){var t,n,a,i,s,c,u,l,p;return T(this,(function(d){switch(d.label){case 0:return d.trys.push([0,5,,6]),"singleChat"!==o&&"groupChat"!==o?[3,4]:[4,null===(a=null===(n=this._localCache)||void 0===n?void 0:n.getInstance())||void 0===a?void 0:a.removeMsgByServerMsgId(e.mid)];case 1:return d.sent(),[4,null===(s=null===(i=this._localCache)||void 0===i?void 0:i.getInstance())||void 0===s?void 0:s.getConversationLastMessage(e.to,o)];case 2:return t=d.sent(),[4,null===(u=null===(c=this._localCache)||void 0===c?void 0:c.getInstance())||void 0===u?void 0:u.updateLocalConversation((0,m.MQ)({conversationId:e.to,conversationType:o}),{lastMessageId:null==t?void 0:t.serverMsgId})];case 3:d.sent(),d.label=4;case 4:return null===(l=null==e?void 0:e.success)||void 0===l||l.call(e,r),[3,6];case 5:return d.sent(),null===(p=null==e?void 0:e.success)||void 0===p||p.call(e,r),[3,6];case 6:return[2]}}))}))},fail:e.fail};return p.kg.debug("Call recallMessage",e),this.mSync.send(i,this)}function ee(e){var t=e||{},r=t.messageId,n=t.modifiedMessage;if(p.kg.debug("Call modifyMessage",r,n),""===r)throw Error('Invalid parameter: "messageId"');return this.mSync.send(v({editMessageId:r},n))}function te(e){return y(this,void 0,void 0,(function(){var t,r,a,o,s,c,u,l,p;return T(this,(function(d){switch(d.label){case 0:if("string"!=typeof e.messageId||!e.messageId)throw Error("Invalid parameter messageId: ".concat(e.messageId));if("string"!=typeof e.reaction||!e.reaction)throw Error("Invalid parameter reaction: ".concat(e.reaction));return(t=n.XZ.call(this).error)?[2,Promise.reject(t)]:(r=this.context,a=r.orgName,o=r.appName,s=r.accessToken,c=e.reaction,u=e.messageId,l={msgId:u,message:c},p={url:"".concat(this.apiUrl,"/").concat(a,"/").concat(o,"/reaction/user/").concat(this.user),type:"POST",data:JSON.stringify(l),dataType:"json",headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"}},[4,i.hj.call(this,p)]);case 1:return d.sent(),[2]}}))}))}function re(e){return y(this,void 0,void 0,(function(){var t,r,a,o,s,c,u,l;return T(this,(function(p){switch(p.label){case 0:if("string"!=typeof e.reaction||!e.reaction)throw Error("Invalid parameter reactionId: ".concat(e.reaction));return(t=n.XZ.call(this).error)?[2,Promise.reject(t)]:(r=this.context,a=r.orgName,o=r.appName,s=r.accessToken,c=e.messageId,u=e.reaction,l={url:"".concat(this.apiUrl,"/").concat(a,"/").concat(o,"/reaction/user/").concat(this.user,"?msgId=").concat(c,"&message=").concat(u),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"}},[4,i.hj.call(this,l)]);case 1:return p.sent(),[2]}}))}))}function ne(e){if("string"!=typeof e.chatType||!e.chatType)throw Error("Invalid parameter chatType: ".concat(e.chatType));if(!e.messageId)throw Error("Invalid parameter messageId: ".concat(e.messageId));var t=n.XZ.call(this).error;if(t)return Promise.reject(t);var r=this.context,a=r.orgName,o=r.appName,s=r.accessToken,c=e.chatType,u=e.messageId,l={msgIdList:"string"==typeof u?[u]:u,msgType:"singleChat"===c?"chat":"groupchat",groupId:e.groupId||null},p={url:"".concat(this.apiUrl,"/").concat(a,"/").concat(o,"/reaction/user/").concat(this.user),type:"GET",data:l,dataType:"json",headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"}};return i.hj.call(this,p).then((function(e){var t=e.data;return null==t||t.forEach((function(e){null==e||e.reactionList.forEach((function(e){e.isAddedBySelf=e.state,delete e.state,delete e.reactionId}))})),e}))}var ae=ne;function oe(e){if("string"!=typeof e.reaction||!e.reaction)throw Error("Invalid parameter reaction: ".concat(e.reaction));if("string"!=typeof e.messageId||!e.messageId)throw Error("Invalid parameter messageId: ".concat(e.messageId));var t=n.XZ.call(this).error;if(t)return Promise.reject(t);var r=this.context,a=r.orgName,o=r.appName,s=r.accessToken,c=e.cursor,u=e.pageSize,l={msgId:e.messageId,message:e.reaction,currentPage:c||null,pageSize:u||20},p={url:"".concat(this.apiUrl,"/").concat(a,"/").concat(o,"/reaction/user/").concat(this.user,"/detail"),type:"GET",data:l,dataType:"json",headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"}};return i.hj.call(this,p).then((function(e){return e.data.isAddedBySelf=e.data.state,delete e.data.state,delete e.data.reactionId,e}))}function ie(e){return y(this,void 0,void 0,(function(){var t,r,a,o,s,c,u,l,p,d,h;return T(this,(function(f){switch(f.label){case 0:if("string"!=typeof e.reportType||!e.reportType)throw Error("Invalid parameter reportType: ".concat(e.reportType));if("string"!=typeof e.messageId||!e.messageId)throw Error("Invalid parameter messageId: ".concat(e.messageId));if("string"!=typeof e.reportReason||!e.reportReason)throw Error("Invalid parameter messageId: ".concat(e.reportReason));return(t=n.XZ.call(this).error)?[2,Promise.reject(t)]:(r=this.context,a=r.orgName,o=r.appName,s=r.accessToken,c=e.reportType,u=e.reportReason,l=e.messageId,p={username:this.user,reportType:c,reportReason:u},d="".concat(this.apiUrl,"/").concat(a,"/").concat(o,"/user/").concat(this.user,"/moderation/report/message/").concat(l),h={url:d,type:"POST",data:JSON.stringify(p),dataType:"json",headers:{Authorization:"Bearer "+s,"Content-Type":"application/json"}},[4,i.hj.call(this,h)]);case 1:return f.sent(),[2]}}))}))}function se(e){var t;return y(this,void 0,void 0,(function(){var r,a,o,s,c,u,l,d,h;return T(this,(function(f){switch(f.label){case 0:if("string"!=typeof e.targetId||""===e.targetId)throw Error('"Invalid parameter targetId": '+e.targetId);if(!["singleChat","groupChat","chatRoom"].includes(e.chatType))throw Error('"Invalid parameter chatType": '+e.chatType);if(e.beforeTimeStamp&&("number"!=typeof e.beforeTimeStamp||e.beforeTimeStamp<0||(null===(t=e.beforeTimeStamp)||void 0===t?void 0:t.toString().length)>18))throw Error('"Invalid parameter beforeTimeStamp": '+e.beforeTimeStamp);if(e.messageIds&&!(Array.isArray(e.messageIds)&&e.messageIds.length>0&&e.messageIds.length<=20))throw Error('"Invalid parameter messageIds": '+e.messageIds);if(!e.messageIds&&!e.beforeTimeStamp)throw Error("messageIds or beforeTimeStamp field is required.");return(r=n.XZ.call(this).error)?[2,Promise.reject(r)]:(a=this.context,o=a.orgName,s=a.appName,c=a.userId,u="singleChat"===e.chatType?"userId":"groupId",l="singleChat"===e.chatType?"chat":"group",d=e.messageIds?"".concat(this.apiUrl,"/").concat(o,"/").concat(s,"/sdk/message/roaming/").concat(l,"/user/").concat(c,"?").concat(u,"=").concat(e.targetId,"&msgIdList=").concat(e.messageIds,"&resource=").concat(this.clientResource):"".concat(this.apiUrl,"/").concat(o,"/").concat(s,"/sdk/message/roaming/").concat(l,"/user/").concat(c,"/time?").concat(u,"=").concat(e.targetId,"&delTime=").concat(e.beforeTimeStamp,"&&resource=").concat(this.clientResource),h={url:d,dataType:"json",type:"DELETE",headers:{Authorization:"Bearer "+this.token,"Content-Type":"application/json"}},p.kg.debug("Call removeHistoryMessages",e),[4,i.hj.call(this,h)]);case 1:return f.sent(),[2]}}))}))}function ce(e){var t=this,r=n.XZ.call(this).error;if(r)return Promise.reject(r);if((null==e?void 0:e.pageSize)&&"number"!=typeof e.pageSize)throw Error("Invalid parameter pageSize: ".concat(e.pageSize));if((null==e?void 0:e.cursor)&&"string"!=typeof e.cursor)throw Error("Invalid parameter cursor: ".concat(e.cursor));var a=this.context,o=a.orgName,s=a.appName,c=a.accessToken,u={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(s,"/sdk/user/").concat(this.user,"/user_channels/list?"),type:"GET",dataType:"json",data:{limit:(null==e?void 0:e.pageSize)||20,cursor:(null==e?void 0:e.cursor)||"",need_mark:!0},headers:{Authorization:"Bearer "+c,"Content-Type":"application/json"}};return p.kg.debug("Call getServerConversations",e),new Promise((function(e,r){i.hj.call(t,u,d.fI.GET_SESSION_LIST).then((function(r){return y(t,void 0,void 0,(function(){var t,n,a=this;return T(this,(function(o){switch(o.label){case 0:return t=ue.call(this,r),this._localCache?(n=t.data.conversations.map((function(e){return y(a,void 0,void 0,(function(){var t,r,n,a;return T(this,(function(o){switch(o.label){case 0:return[4,null===(r=null===(t=this._localCache)||void 0===t?void 0:t.getInstance())||void 0===r?void 0:r.storeMessage(e.lastMessage,f.r.SUCCESS,!0)];case 1:return o.sent(),[4,null===(a=null===(n=this._localCache)||void 0===n?void 0:n.getInstance())||void 0===a?void 0:a.updateLocalConversation((0,m.MQ)({conversationId:e.conversationId,conversationType:e.conversationType}),{unReadCount:e.unReadCount})];case 2:return o.sent(),[2]}}))}))})),[4,Promise.all(n)]):[3,2];case 1:o.sent(),o.label=2;case 2:return e(t),[2]}}))}))})).catch((function(e){r(e)}))}))}function ue(e){var t=this,r=e.data,n=r.cursor,a=r.channel_infos,o=[];null==a||a.forEach((function(e){var r=null;(null==e?void 0:e.meta)&&"{}"!==JSON.stringify(e.meta)&&(e.meta.payload=JSON.parse(e.meta.payload),"delivery"!==(r=h.w.call(t,e.meta)).type&&"read"!==r.type&&"channel"!==r.type&&(r.chatType=h.U[r.chatType]));var n={conversationId:e.session_to,conversationType:"chat"===e.session_type?"singleChat":"groupChat",isPinned:e.is_top,pinnedTime:e.is_top?e.update_top_status_time:0,unReadCount:e.unread_num,lastMessage:r};e.marks&&(n.marks=e.marks.map((function(e){return s.Z[e]}))),o.push(n)}));var i={conversations:o,cursor:n||""};return{type:e.type,data:i}}function le(e){var t=this,r=n.XZ.call(this).error;if(r)return Promise.reject(r);if((null==e?void 0:e.pageSize)&&"number"!=typeof e.pageSize)throw Error("Invalid parameter pageSize: ".concat(e.pageSize));if((null==e?void 0:e.cursor)&&"string"!=typeof e.cursor)throw Error("Invalid parameter cursor: ".concat(e.cursor));var a=this.context,o=a.orgName,s=a.appName,c=a.accessToken,u={url:"".concat(this.apiUrl,"/").concat(o,"/").concat(s,"/sdk/user/").concat(this.user,"/user_channels/list?"),type:"GET",dataType:"json",data:{limit:(null==e?void 0:e.pageSize)||20,cursor:(null==e?void 0:e.cursor)||"",is_top:!0,need_mark:!0},headers:{Authorization:"Bearer "+c,"Content-Type":"application/json"}};return p.kg.debug("Call getServerPinnedConversations",e),i.hj.call(this,u,d.fI.GET_SESSION_LIST).then((function(e){return ue.call(t,e)}))}function pe(e){return y(this,void 0,void 0,(function(){var t,r,a,o,s,c,u,l,h,f,m,g,v,y;return T(this,(function(T){if(t=n.XZ.call(this).error)return[2,Promise.reject(t)];if(r=e.conversationId,a=e.conversationType,o=e.isPinned,s="singleChat"===a?"chat":"groupChat","string"!=typeof r||""===r)throw Error("Invalid parameter conversationId: ".concat(r));if(!["singleChat","groupChat"].includes(a))throw Error("Invalid parameter conversationType: ".concat(a));if("boolean"!=typeof o)throw Error("Invalid parameter isPinned: ".concat(o));return c=this.context,u=c.orgName,l=c.appName,h=c.accessToken,f=c.jid,m={type:s,to:r},g=o?"":"type=".concat(s,"&to=").concat(r,"&"),v="".concat(this.apiUrl,"/").concat(u,"/").concat(l,"/sdk/user/").concat(this.user,"/user_channel/top?").concat(g,"resource=").concat(f.clientResource),y={url:v,type:o?"POST":"DELETE",dataType:"json",headers:{Authorization:"Bearer "+h,"Content-Type":"application/json"}},o&&(y.data=JSON.stringify(m)),p.kg.debug("Call pinConversation",e),[2,i.hj.call(this,y,d.fI.PIN_CONVERSATION).then((function(e){var t=e.type,r=e.data;return{type:t,data:{isPinned:r.is_top||!1,pinnedTime:r.is_top?r.update_top_status_time:0}}}))]}))}))}function de(e){return y(this,void 0,void 0,(function(){var t,r,a,o,s,c,u,l,h,f;return T(this,(function(m){switch(m.label){case 0:if(t=e.userId,r=e.remark,a=n.XZ.call(this).error)return[2,Promise.reject(a)];if("string"!=typeof t||""===t)throw Error('Invalid parameter: "userId"');if("string"!=typeof r)throw Error('Invalid parameter: "remark"');return p.kg.debug("Call setContactRemark",e),o=this.context,s=o.orgName,c=o.appName,u=o.accessToken,l=o.jid,h="".concat(this.apiUrl,"/").concat(s,"/").concat(c,"/users/").concat(this.context.userId,"/contacts/users/").concat(t,"?resource=").concat(l.clientResource),f={url:h,type:"PUT",data:JSON.stringify({remark:r}),dataType:"json",headers:{Authorization:"Bearer "+u,"Content-Type":"application/json"}},[4,i.hj.call(this,f,d.fI.ROSTER_SET_CONTACT_REMARK)];case 1:return m.sent(),[2]}}))}))}function he(){var e=n.XZ.call(this).error;if(e)return Promise.reject(e);var t=this.context,r=t.orgName,a=t.appName,o=t.accessToken,s={url:"".concat(this.apiUrl,"/").concat(r,"/").concat(a,"/users/").concat(this.user,"/contacts/users?needReturnRemark=true"),dataType:"json",type:"GET",headers:{Authorization:"Bearer "+o}};return p.kg.debug("Call getAllContacts"),i.hj.call(this,s,d.fI.ROSTER_GET_ALL_CONTACTS_REMARKS).then((function(e){var t=((null==e?void 0:e.entities)||[]).map((function(e){return{userId:e.username,remark:e.remark}}));return{type:e.type,data:t}}))}function fe(e){var t=n.XZ.call(this).error;if(t)return Promise.reject(t);p.kg.debug("Call getContactsWithCursor",e);var r=e||{},a=r.pageSize,o=void 0===a?20:a,s=r.cursor,c=void 0===s?"":s;if(o&&"number"!=typeof o)throw Error("Invalid parameter pageSize: ".concat(e.pageSize));var u=this.context,l=u.orgName,h=u.appName,f=u.accessToken,m={url:"".concat(this.apiUrl,"/").concat(l,"/").concat(h,"/users/").concat(this.user,"/contacts?needReturnRemark=true&limit=").concat(o,"&cursor=").concat(c),dataType:"json",type:"GET",headers:{Authorization:"Bearer "+f}};return i.hj.call(this,m,d.fI.ROSTER_GET_ALL_CONTACTS_REMARKS_FROM_SERVER_BY_PAGE).then((function(e){var t,r,n=(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.contacts)||[],a=(null===(r=null==e?void 0:e.data)||void 0===r?void 0:r.cursor)||"",o=n.map((function(e){return{userId:e.username,remark:e.remark}}));return{type:e.type,data:{cursor:a,contacts:o}}}))}function me(e){return y(this,void 0,void 0,(function(){var t,r,a,o,c,u,l,f,m,g,v,y,k,E,C;return T(this,(function(T){switch(T.label){case 0:if(t=n.XZ.call(this).error)return[2,Promise.reject(t)];if(p.kg.debug("Call markConversation",e),a=(r=e||{}).conversations,o=void 0===a?[]:a,c=r.mark,u=r.isMarked,!Array.isArray(o))throw Error("Invalid parameter conversations");if(l=o.map((function(e){if(!e.conversationId||!["singleChat","groupChat"].includes(e.conversationType))throw Error("Invalid parameter conversations");return{to:e.conversationId,type:I[e.conversationType]}})),"boolean"!=typeof u)throw Error("Invalid parameter isMarked: ".concat(u));if("number"!=typeof c)throw Error("Invalid parameter mark: ".concat(c));return f=this.context,m=f.orgName,g=f.appName,v=f.accessToken,y=f.userId,k=f.jid,E={mark:s.Z[c],targets:l},C={url:"".concat(this.apiUrl,"/").concat(m,"/").concat(g,"/sdk/user/").concat(y,"/user_channels/mark?resource=").concat(k.clientResource),dataType:"json",data:JSON.stringify(E),type:u?"Post":"Delete",headers:{Authorization:"Bearer "+v}},[4,i.hj.call(this,C,d.fI.MARK_CONVERSATION).then((function(e){var t,r=(null===(t=e.data)||void 0===t?void 0:t.ignore)||[];r&&Array.isArray(r)&&r.length>0&&p.kg.debug("markConversation has ignored conversations",r.map((function(e){return{conversationId:e.to,conversationType:h.U[e.type]}})))}))];case 1:return T.sent(),[2]}}))}))}function ge(e){return y(this,void 0,void 0,(function(){var t,r;return T(this,(function(n){return p.kg.debug("Call addConversationMark",e),t=e.conversations,r=e.mark,[2,me.call(this,{conversations:t,mark:r,isMarked:!0})]}))}))}function ve(e){return y(this,void 0,void 0,(function(){var t,r;return T(this,(function(n){return p.kg.debug("Call removeConversationMark",e),t=e.conversations,r=e.mark,[2,me.call(this,{conversations:t,mark:r,isMarked:!1})]}))}))}function ye(e){var t,r,a=this,o=n.XZ.call(this).error;if(o)return Promise.reject(o);if(p.kg.debug("Call getServerConversationsByFilter",e),(null==e?void 0:e.pageSize)&&"number"!=typeof e.pageSize)throw Error("Invalid parameter pageSize: ".concat(e.pageSize));if((null==e?void 0:e.cursor)&&"string"!=typeof e.cursor)throw Error("Invalid parameter cursor: ".concat(e.cursor));if("number"!=typeof(null===(t=null==e?void 0:e.filter)||void 0===t?void 0:t.mark))throw Error("Invalid parameter mark: ".concat(null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.mark));var c=this.context,u=c.orgName,l=c.appName,h=c.accessToken,f="".concat(this.apiUrl,"/").concat(u,"/").concat(l,"/sdk/user/").concat(this.user,"/user_channels/mark/search?"),m=e.pageSize,g=e.cursor,v=((null==e?void 0:e.filter)||{}).mark,y={url:f,type:"GET",dataType:"json",data:{limit:m||10,cursor:g||"",need_mark:!0,mark:s.Z[v]},headers:{Authorization:"Bearer "+h,"Content-Type":"application/json"}};return i.hj.call(this,y,d.fI.GET_SESSION_LIST).then((function(e){return ue.call(a,e)}))}function Te(){var e=n.XZ.call(this).error;if(e)return Promise.reject(e);p.kg.debug("Call getSelfIdsOnOtherPlatform");var t=this.context,r=t.orgName,a=t.appName,o=t.accessToken,s=t.userId,c=t.jid,u={url:"".concat(this.apiUrl,"/").concat(r,"/").concat(a,"/users/").concat(s,"/resources"),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+o,"Content-Type":"application/json"}};return i.hj.call(this,u,d.fI.USER_LOGGEDIN_OTHER_PLATFORM).then((function(e){var t,r=null===(t=e.data)||void 0===t?void 0:t.filter((function(e){return e.res!==c.clientResource})),n=null==r?void 0:r.map((function(e){return"".concat(s,"/").concat(e.res)}));return{type:e.type,data:n}}))}function Ie(){var e,t,r,a,o,s;return y(this,void 0,void 0,(function(){var c,u,l,h,f,m,g,v,y;return T(this,(function(T){switch(T.label){case 0:return(c=n.XZ.call(this).error)?[2,Promise.reject(c)]:(p.kg.debug("Call deleteAllMessagesAndConversations"),u=this.context,l=u.orgName,h=u.appName,f=u.accessToken,m=u.userId,g=u.jid,v="".concat(this.apiUrl,"/").concat(l,"/").concat(h,"/sdk/message/roaming/user/").concat(m,"/delete/all?resource=").concat(g.clientResource),y={url:v,type:"POST",dataType:"json",headers:{Authorization:"Bearer "+f,"Content-Type":"application/json"}},[4,i.hj.call(this,y,d.fI.REST_DELETE_MESSAGES_CONVERSATIONS)]);case 1:return T.sent(),null===(t=null===(e=this._localCache)||void 0===e?void 0:e.getInstance())||void 0===t||t.clearConversationMap(),[4,null===(a=null===(r=this._localCache)||void 0===r?void 0:r.getInstance())||void 0===a?void 0:a.clearStoreData("conversationList")];case 2:return T.sent(),[4,null===(s=null===(o=this._localCache)||void 0===o?void 0:o.getInstance())||void 0===s?void 0:s.clearStoreData("message")];case 3:return T.sent(),[2]}}))}))}function ke(e){return y(this,void 0,void 0,(function(){var t,r,a,o,s,c,u,l,h,f,m,g,v,y,k;return T(this,(function(T){switch(T.label){case 0:if(t=n.XZ.call(this).error)return[2,Promise.reject(t)];if(p.kg.debug("Call setMessagePinStatus",e),a=(r=e||{}).conversationId,o=void 0===a?"":a,s=r.conversationType,c=r.messageId,u=r.isPinned,"string"!=typeof o||""===o)throw Error("Invalid parameter conversationId");if("string"!=typeof c||""===c)throw Error("Invalid parameter messageId");if("boolean"!=typeof u)throw Error("Invalid parameter isPinned");return l=this.context,h=l.orgName,f=l.appName,m=l.accessToken,g=l.userId,v=l.jid,y={to:o,type:I[s],pin_msg_id:c},k={url:"".concat(this.apiUrl,"/").concat(h,"/").concat(f,"/sdk/user/").concat(g,"/user_channel/pin?resource=").concat(v.clientResource),dataType:"json",data:JSON.stringify(y),type:u?"Post":"Delete",headers:{Authorization:"Bearer "+m}},[4,i.hj.call(this,k,d.fI.REST_PIN_MESSAGE)];case 1:return T.sent(),[2]}}))}))}function Ee(e){return y(this,void 0,void 0,(function(){var t,r,n,a;return T(this,(function(o){return p.kg.debug("Call pinMessage",e),r=(t=e||{}).conversationType,n=t.conversationId,a=t.messageId,[2,ke.call(this,{conversationId:n,conversationType:r,messageId:a,isPinned:!0})]}))}))}function Ce(e){return y(this,void 0,void 0,(function(){var t,r,n,a;return T(this,(function(o){return p.kg.debug("Call unpinMessage",e),r=(t=e||{}).conversationType,n=t.conversationId,a=t.messageId,[2,ke.call(this,{conversationId:n,conversationType:r,messageId:a,isPinned:!1})]}))}))}function je(e){var t=this,r=n.XZ.call(this).error;if(r)return Promise.reject(r);p.kg.debug("Call getServerPinnedMessages",e);var a=e.conversationId,o=e.conversationType,s=e.pageSize,c=e.cursor;if("string"!=typeof a||""===a)throw Error("Invalid parameter conversationId");if(s&&"number"!=typeof s)throw Error("Invalid parameter pageSize: ".concat(s));if(c&&"string"!=typeof c)throw Error("Invalid parameter cursor: ".concat(c));var u=this.context,l=u.orgName,f=u.appName,m=u.accessToken,g={url:"".concat(this.apiUrl,"/").concat(l,"/").concat(f,"/sdk/user/").concat(this.user,"/user_channel/pin"),type:"GET",dataType:"json",data:{to:a,type:I[o],limit:s||10,cursor:c||""},headers:{Authorization:"Bearer "+m,"Content-Type":"application/json"}};return i.hj.call(this,g,d.fI.GET_SESSION_LIST).then((function(e){return{type:0,data:{list:e.data.msg_infos.map((function(e){e.message.payload=JSON.parse(e.message.payload);var r=e.message,n=e.pin_opt_at,a=e.pin_operator;return{message:h.w.call(t,r,{formatChatType:!0}),pinTime:n,operatorId:a}})),cursor:e.data.cursor||""}}}))}function Se(){var e=this;p.kg.debug("Call unbindPushToken");var t={deviceId:this.clientResource,deviceToken:"",notifierName:this.pushCertificateName};return g.r.call(this,t).then((function(t){return e.isRegisterPush=!1,t}))}},5069:function(e,t,r){var n=r(2109),a=r(1702),o=r(3157),i=a([].reverse),s=[1,2];n({target:"Array",proto:!0,forced:String(s)===String(s.reverse())},{reverse:function(){return o(this)&&(this.length=this.length),i(this)}})}},function(e){return 7479,e(e.s=7479)}])}));
|
package/message/audio.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { ModifiedMsgInfo } from '../types/message';
|
|
1
2
|
type ChatType = 'singleChat' | 'groupChat' | 'chatRoom';
|
|
3
|
+
|
|
2
4
|
export interface AudioParameters {
|
|
3
5
|
/** The message type. */
|
|
4
6
|
type: 'audio';
|
|
@@ -101,6 +103,8 @@ export interface AudioMsgBody extends AudioMsgSetParameters {
|
|
|
101
103
|
isRead?: boolean;
|
|
102
104
|
/** Has the message been delivered (only single chat messages have this field). */
|
|
103
105
|
isDelivered?: boolean;
|
|
106
|
+
/** Message modified info. */
|
|
107
|
+
modifiedInfo?: ModifiedMsgInfo;
|
|
104
108
|
}
|
|
105
109
|
export interface CreateAudioMsgParameters {
|
|
106
110
|
/** The message type. */
|
package/message/cmd.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ModifiedMsgInfo } from '../types/message';
|
|
1
2
|
type ChatType = 'singleChat' | 'groupChat' | 'chatRoom';
|
|
2
3
|
export interface CmdParameters {
|
|
3
4
|
/** The message type. */
|
|
@@ -86,6 +87,8 @@ export interface CmdMsgBody {
|
|
|
86
87
|
isRead?: boolean;
|
|
87
88
|
/** Has the message been delivered (only single chat messages have this field). */
|
|
88
89
|
isDelivered?: boolean;
|
|
90
|
+
/** Message modified info. */
|
|
91
|
+
modifiedInfo?: ModifiedMsgInfo;
|
|
89
92
|
}
|
|
90
93
|
export interface CreateCmdMsgParameters {
|
|
91
94
|
/** The message type. */
|
package/message/combine.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
MessagePriority,
|
|
6
6
|
MessagesType,
|
|
7
7
|
ReadMsgBody,
|
|
8
|
+
ModifiedMsgInfo,
|
|
8
9
|
} from '../types/message';
|
|
9
10
|
export interface CombineParameters {
|
|
10
11
|
/** The message type. */
|
|
@@ -69,6 +70,8 @@ export interface CombineMsgBody {
|
|
|
69
70
|
isRead?: boolean;
|
|
70
71
|
/** Has the message been delivered (only single chat messages have this field). */
|
|
71
72
|
isDelivered?: boolean;
|
|
73
|
+
/** Message modified info. */
|
|
74
|
+
modifiedInfo?: ModifiedMsgInfo;
|
|
72
75
|
}
|
|
73
76
|
export interface CreateCombineMsgParameters {
|
|
74
77
|
/** The conversation type. */
|
package/message/file.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ModifiedMsgInfo } from '../types/message';
|
|
1
2
|
type ChatType = 'singleChat' | 'groupChat' | 'chatRoom';
|
|
2
3
|
export interface FileParameters {
|
|
3
4
|
/** The message type. */
|
|
@@ -96,6 +97,8 @@ export interface FileMsgBody extends CreateFileMsgParameters {
|
|
|
96
97
|
isRead?: boolean;
|
|
97
98
|
/** Has the message been delivered (only single chat messages have this field). */
|
|
98
99
|
isDelivered?: boolean;
|
|
100
|
+
/** Message modified info. */
|
|
101
|
+
modifiedInfo?: ModifiedMsgInfo;
|
|
99
102
|
}
|
|
100
103
|
export interface CreateFileMsgParameters {
|
|
101
104
|
/** The message type. */
|
package/message/img.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ModifiedMsgInfo } from '../types/message';
|
|
1
2
|
type ChatType = 'singleChat' | 'groupChat' | 'chatRoom';
|
|
2
3
|
export interface ImgParameters {
|
|
3
4
|
/** The message type. */
|
|
@@ -109,6 +110,8 @@ export interface ImgMsgBody extends CreateImgMsgParameters {
|
|
|
109
110
|
isRead?: boolean;
|
|
110
111
|
/** Has the message been delivered (only single chat messages have this field). */
|
|
111
112
|
isDelivered?: boolean;
|
|
113
|
+
/** Message modified info. */
|
|
114
|
+
modifiedInfo?: ModifiedMsgInfo;
|
|
112
115
|
}
|
|
113
116
|
export interface CreateImgMsgParameters {
|
|
114
117
|
/** The message type. */
|
package/message/location.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ModifiedMsgInfo } from '../types/message';
|
|
1
2
|
type ChatType = 'singleChat' | 'groupChat' | 'chatRoom';
|
|
2
3
|
export interface LocationParameters {
|
|
3
4
|
/** The message type. */
|
|
@@ -72,6 +73,8 @@ export interface LocationMsgBody extends CreateLocationMsgParameters {
|
|
|
72
73
|
isRead?: boolean;
|
|
73
74
|
/** Has the message been delivered (only single chat messages have this field). */
|
|
74
75
|
isDelivered?: boolean;
|
|
76
|
+
/** Message modified info. */
|
|
77
|
+
modifiedInfo?: ModifiedMsgInfo;
|
|
75
78
|
}
|
|
76
79
|
export interface CreateLocationMsgParameters {
|
|
77
80
|
/** The message type. */
|
package/message/video.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ModifiedMsgInfo } from '../types/message';
|
|
1
2
|
type ChatType = 'singleChat' | 'groupChat' | 'chatRoom';
|
|
2
3
|
export interface VideoParameters {
|
|
3
4
|
/** The message type. */
|
|
@@ -99,6 +100,8 @@ export interface VideoMsgBody extends VideoMsgSetParameters {
|
|
|
99
100
|
isRead?: boolean;
|
|
100
101
|
/** Has the message been delivered (only single chat messages have this field). */
|
|
101
102
|
isDelivered?: boolean;
|
|
103
|
+
/** Message modified info. */
|
|
104
|
+
modifiedInfo?: ModifiedMsgInfo;
|
|
102
105
|
}
|
|
103
106
|
export interface CreateVideoMsgParameters {
|
|
104
107
|
/** The message type. */
|