easemob-websdk 4.9.0 → 4.9.1
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/CHANGELOG.md +5 -0
- package/Easemob-chat.d.ts +30 -1
- package/Easemob-chat.js +1 -1
- package/chatroom/chatroom.js +1 -1
- package/contact/contact.d.ts +10 -0
- package/contact/contact.js +1 -1
- package/group/group.js +1 -1
- package/localCache/localCache.js +1 -1
- package/miniCore/miniCore.js +1 -1
- package/miniProgram/Easemob-chat.js +1 -1
- package/package.json +1 -1
- package/presence/presence.js +1 -1
- package/silent/silent.js +1 -1
- package/thread/thread.js +1 -1
- package/translation/translation.js +1 -1
- package/types/common.d.ts +2 -0
- package/types/engineCore.d.ts +12 -1
- package/types/eventHandler.d.ts +4 -0
- package/uniApp/Easemob-chat.js +1 -1
package/package.json
CHANGED
package/presence/presence.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.websdk=r():e.websdk=r()}(self,(function(){return(self.webpackChunkwebsdk=self.webpackChunkwebsdk||[]).push([[962],{3770:function(e,r,t){t.r(r),t.d(r,{getPresenceStatus:function(){return y},getSubscribedPresenceList:function(){return h},getSubscribedPresencelist:function(){return d},publishPresence:function(){return
|
|
1
|
+
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.websdk=r():e.websdk=r()}(self,(function(){return(self.webpackChunkwebsdk=self.webpackChunkwebsdk||[]).push([[962],{3770:function(e,r,t){t.r(r),t.d(r,{getPresenceStatus:function(){return y},getSubscribedPresenceList:function(){return h},getSubscribedPresencelist:function(){return d},publishPresence:function(){return p},subscribePresence:function(){return l},unsubscribePresence:function(){return f}}),t(1539),t(8674),t(2526),t(1817),t(2165),t(6992),t(8783),t(3948),t(2222),t(9753);var n=t(4024),a=t(3246),s=t(7252),o=t(5531),c=t(7360),i=function(e,r,t,n){return new(t||(t=Promise))((function(a,s){function o(e){try{i(n.next(e))}catch(e){s(e)}}function c(e){try{i(n.throw(e))}catch(e){s(e)}}function i(e){var r;e.done?a(e.value):(r=e.value,r instanceof t?r:new t((function(e){e(r)}))).then(o,c)}i((n=n.apply(e,r||[])).next())}))},u=function(e,r){var t,n,a,s,o={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return s={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function c(s){return function(c){return function(s){if(t)throw new TypeError("Generator is already executing.");for(;o;)try{if(t=1,n&&(a=2&s[0]?n.return:s[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,s[1])).done)return a;switch(n=0,a&&(s=[2&s[0],a.value]),s[0]){case 0:case 1:a=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!((a=(a=o.trys).length>0&&a[a.length-1])||6!==s[0]&&2!==s[0])){o=0;continue}if(3===s[0]&&(!a||s[1]>a[0]&&s[1]<a[3])){o.label=s[1];break}if(6===s[0]&&o.label<a[1]){o.label=a[1],a=s;break}if(a&&o.label<a[2]){o.label=a[2],o.ops.push(s);break}a[2]&&o.ops.pop(),o.trys.pop();continue}s=r.call(e,o)}catch(e){s=[6,e],n=0}finally{t=a=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}};function p(e){return i(this,void 0,void 0,(function(){var r,t,i,p,l,f,h,d,y;return u(this,(function(u){switch(u.label){case 0:if("string"!=typeof e.description)throw Error('Invalid parameter: "description"');return a.XZ.call(this)?(t=this.context,i=t.accessToken,p=t.orgName,l=t.appName,f=t.userId,h=this.context.jid.clientResource,d={ext:e.description},y={url:"".concat(this.apiUrl,"/").concat(p,"/").concat(l,"/users/").concat(f,"/presence/").concat(h,"/1"),type:"POST",dataType:"json",data:JSON.stringify(d),headers:{Authorization:"Bearer "+i,"Content-Type":"application/json"},success:e.success,error:e.error},c.kg.debug("Call publishPresence:",e),[4,n.hj.call(this,y)]):(r=s.Z.create({type:o.E.REST_PARAMS_STATUS,message:"appkey or token error"}),[2,Promise.reject(r)]);case 1:return u.sent(),[2]}}))}))}function l(e){if(!Array.isArray(e.usernames))throw Error('Invalid parameter: "usernames"');if(!e.usernames.length)throw Error('"usernames" can not be empty');if("number"!=typeof e.expiry)throw Error('Invalid parameter: "expiry"');if(!a.XZ.call(this)){var r=s.Z.create({type:o.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(r)}var t=this.context,i=t.orgName,u=t.appName,p=t.userId,l=t.accessToken,f={usernames:e.usernames},h={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(u,"/users/").concat(p,"/presence/").concat(e.expiry),type:"POST",dataType:"json",data:JSON.stringify(f),headers:{Authorization:"Bearer "+l,"Content-Type":"application/json"},success:e.success,error:e.error};return c.kg.debug("Call subscribePresence:",e),n.hj.call(this,h).then((function(e){return e.data={result:null==e?void 0:e.result},e}))}function f(e){return i(this,void 0,void 0,(function(){var r,t,i,p,l,f,h;return u(this,(function(u){switch(u.label){case 0:if(!Array.isArray(e.usernames))throw Error('Invalid parameter: "usernames"');if(!e.usernames.length)throw Error('"usernames" can not be empty');return a.XZ.call(this)?(t=this.context,i=t.orgName,p=t.appName,l=t.userId,f=t.accessToken,h={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(p,"/users/").concat(l,"/presence"),type:"DELETE",dataType:"json",data:JSON.stringify(e.usernames),headers:{Authorization:"Bearer "+f,"Content-Type":"application/json"},success:e.success,error:e.error},c.kg.debug("Call unsubscribePresence:",e),[4,n.hj.call(this,h)]):(r=s.Z.create({type:o.E.REST_PARAMS_STATUS,message:"appkey or token error"}),[2,Promise.reject(r)]);case 1:return u.sent(),[2]}}))}))}function h(e){if("number"!=typeof e.pageNum||"number"!=typeof e.pageSize)throw Error('Invalid parameter: "pageNum or pageSize"');if(e.pageNum<0||e.pageSize<0)throw Error('"pageNum" should >= 0 and "pageSize" should >= 0');if(!a.XZ.call(this)){var r=s.Z.create({type:o.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(r)}var t=this.context,i=t.orgName,u=t.appName,p=t.userId,l=t.accessToken,f={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(u,"/users/").concat(p,"/presence/sublist?pageNum=").concat(e.pageNum,"&pageSize=").concat(e.pageSize),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+l,"Content-Type":"application/json"},success:e.success,error:e.error};return c.kg.debug("Call getSubscribedPresenceList:",e),n.hj.call(this,f).then((function(e){return e.data={result:null==e?void 0:e.result},e}))}var d=h;function y(e){if(!Array.isArray(e.usernames))throw Error('Invalid parameter: "usernames"');if(!e.usernames.length)throw Error('"usernames" can not be empty');if(!a.XZ.call(this)){var r=s.Z.create({type:o.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(r)}var t={usernames:e.usernames},i=this.context,u=i.orgName,p=i.appName,l=i.userId,f=i.accessToken,h={url:"".concat(this.apiUrl,"/").concat(u,"/").concat(p,"/users/").concat(l,"/presence"),type:"POST",dataType:"json",data:JSON.stringify(t),headers:{Authorization:"Bearer "+f,"Content-Type":"application/json"},success:e.success,error:e.error};return c.kg.debug("Call getPresenceStatus:",e),n.hj.call(this,h).then((function(e){return e.data={result:null==e?void 0:e.result},e}))}}},function(e){return 3770,e(e.s=3770)}])}));
|
package/silent/silent.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.websdk=r():e.websdk=r()}(self,(function(){return(self.webpackChunkwebsdk=self.webpackChunkwebsdk||[]).push([[883],{1735:function(e,r,t){t.r(r),t.d(r,{clearRemindTypeForConversation:function(){return l},getPushPerformLanguage:function(){return h},getSilentModeForAll:function(){return u},getSilentModeForConversation:function(){return d},getSilentModeForConversations:function(){return f},getSilentModeRemindTypeConversations:function(){return y},setPushPerformLanguage:function(){return m},setSilentModeForAll:function(){return c},setSilentModeForConversation:function(){return p}}),t(7941),t(1539),t(8674),t(2222),t(9753),t(9554),t(4747),t(9600),t(1249);var o=t(4024),n=t(3246),a=t(7252),s=t(5531),i=t(7360);function c(e){if(!(e.options instanceof Object))throw Error('Invalid parameter: "options"');var r=e.options.paramType;if("number"!=typeof r||r<0||r>2)throw Error('Invalid parameter: "options of paramType"');if(0===r){if("string"!=typeof e.options.remindType)throw Error('Invalid parameter: "options of remindType"')}else if(1===r){if("number"!=typeof e.options.duration)throw Error('Invalid parameter: "options of duration"')}else if(2===r){var t=e.options,c=t.startTime,u=t.endTime;if(!(c instanceof Object&&Object.keys(c).length))throw Error('Invalid parameter: "options of startTime"');if(!c.hours||"number"!=typeof c.hours||!c.minutes||"number"!=typeof c.minutes)throw Error('Invalid parameter: "options of startTime of hours or minutes"');if(!(u instanceof Object&&Object.keys(u).length))throw Error('Invalid parameter: "options of endTime"');if(!u.hours||"number"!=typeof u.hours||!u.minutes||"number"!=typeof u.minutes)throw Error('Invalid parameter: "options of endTime of hours or minutes"')}if(!n.XZ.call(this)){var p=a.Z.create({type:s.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(p)}var l=this.context,d=l.accessToken,f=l.orgName,m=l.appName,h=l.userId,y=l.jid,g={};switch(r){case 0:g={type:e.options.remindType};break;case 1:g={ignoreDuration:e.options.duration};break;case 2:var T=e.options;c=T.startTime,u=T.endTime,g={ignoreInterval:"".concat(c.hours,":").concat(c.minutes,"-").concat(u.hours,":").concat(u.minutes)}}var v={url:"".concat(this.apiUrl,"/").concat(f,"/").concat(m,"/users/").concat(h,"/notification/user/").concat(h,"?resource=").concat(y.clientResource),type:"PUT",dataType:"json",data:JSON.stringify(g),headers:{Authorization:"Bearer "+d,"Content-Type":"application/json"},success:e.success,error:e.error};return i.kg.debug("Call setSilentModeForAll:",e),o.hj.call(this,v)}function u(e){if(!n.XZ.call(this)){var r=a.Z.create({type:s.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(r)}var t=this.context,c=t.accessToken,u=t.orgName,p=t.appName,l=t.userId,d={url:"".concat(this.apiUrl,"/").concat(u,"/").concat(p,"/users/").concat(l,"/notification/user/").concat(l),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+c,"Content-Type":"application/json"},success:null==e?void 0:e.success,error:null==e?void 0:e.error};return i.kg.debug("Call getSilentModeForAll:",e),o.hj.call(this,d)}function p(e){if("string"!=typeof e.conversationId||!e.conversationId)throw Error('Invalid parameter: "conversationId"');if("string"!=typeof e.type||!e.type)throw Error('Invalid parameter: "type"');if(!(e.options instanceof Object))throw Error('Invalid parameter: "options"');var r=e.options.paramType;if("number"!=typeof r||r<0||r>2)throw Error('Invalid parameter: "options of paramType"');if(0===r){if("string"!=typeof e.options.remindType)throw Error('Invalid parameter: "options of remindType"')}else if(1===r){if("number"!=typeof e.options.duration)throw Error('Invalid parameter: "options of duration"')}else if(2===r){var t=e.options,c=t.startTime,u=t.endTime;if(!(c instanceof Object&&Object.keys(c).length))throw Error('Invalid parameter: "options of startTime"');if(!c.hours||"number"!=typeof c.hours||!c.minutes||"number"!=typeof c.minutes)throw Error('Invalid parameter: "options of startTime of hours or minutes"');if(!(u instanceof Object&&Object.keys(u).length))throw Error('Invalid parameter: "options of endTime"');if(!u.hours||"number"!=typeof u.hours||!u.minutes||"number"!=typeof u.minutes)throw Error('Invalid parameter: "options of endTime of hours or minutes"')}if(!n.XZ.call(this)){var p=a.Z.create({type:s.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(p)}var l=this.context,d=l.accessToken,f=l.orgName,m=l.appName,h=l.userId,y=l.jid,g="chatgroup",T={};switch(r){case 0:T={type:e.options.remindType};break;case 1:T={ignoreDuration:e.options.duration};break;case 2:var v=e.options;c=v.startTime,u=v.endTime,T={ignoreInterval:"".concat(c.hours,":").concat(c.minutes,"-").concat(u.hours,":").concat(u.minutes)}}"singleChat"===e.type&&(g="user");var E={url:"".concat(this.apiUrl,"/").concat(f,"/").concat(m,"/users/").concat(h,"/notification/").concat(g,"/").concat(e.conversationId,"?resource=").concat(y.clientResource),type:"PUT",dataType:"json",data:JSON.stringify(T),headers:{Authorization:"Bearer "+d,"Content-Type":"application/json"},success:e.success,error:e.error};return i.kg.debug("Call setSilentModeForConversation:",e),o.hj.call(this,E)}function l(e){if("string"!=typeof e.conversationId||!e.conversationId)throw Error('Invalid parameter: "conversationId"');if("string"!=typeof e.type||!e.type)throw Error('Invalid parameter: "type"');if(!n.XZ.call(this)){var r=a.Z.create({type:s.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(r)}var t=this.context,c=t.accessToken,u=t.orgName,p=t.appName,l=t.userId,d=t.jid,f="chatgroup";"singleChat"===e.type&&(f="user");var m={url:"".concat(this.apiUrl,"/").concat(u,"/").concat(p,"/users/").concat(l,"/notification/").concat(f,"/").concat(e.conversationId,"?resource=").concat(d.clientResource),type:"PUT",dataType:"json",data:JSON.stringify({type:"DEFAULT"}),headers:{Authorization:"Bearer "+c,"Content-Type":"application/json"},success:e.success,error:e.error};return i.kg.debug("Call clearRemindTypeForConversation:",e),o.hj.call(this,m)}function d(e){if("string"!=typeof e.conversationId||!e.conversationId)throw Error('Invalid parameter: "conversationId"');if("string"!=typeof e.type||!e.type)throw Error('Invalid parameter: "type"');if(!n.XZ.call(this)){var r=a.Z.create({type:s.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(r)}var t=this.context,c=t.accessToken,u=t.orgName,p=t.appName,l=t.userId,d="chatgroup";"singleChat"===e.type&&(d="user");var f={url:"".concat(this.apiUrl,"/").concat(u,"/").concat(p,"/users/").concat(l,"/notification/").concat(d,"/").concat(e.conversationId),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+c,"Content-Type":"application/json"},success:e.success,error:e.error};return i.kg.debug("Call getSilentModeForConversation:",e),o.hj.call(this,f)}function f(e){if(!Array.isArray(e.conversationList))throw Error('Invalid parameter: "conversationList"');if(!n.XZ.call(this)){var r=a.Z.create({type:s.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(r)}var t=this.context,c=t.accessToken,u=t.orgName,p=t.appName,l=t.userId,d=[],f=[];e.conversationList.forEach((function(e){"singleChat"===e.type?d.push(e.id):f.push(e.id)}));var m=d.length?d.join(","):"",h=f.length?f.join(","):"",y={url:"".concat(this.apiUrl,"/").concat(u,"/").concat(p,"/users/").concat(l,"/notification?user=").concat(m,"&group=").concat(h),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+c,"Content-Type":"application/json"},success:e.success,error:e.error};return i.kg.debug("Call getSilentModeForConversations:",e),o.hj.call(this,y)}function m(e){if("string"!=typeof e.language||!e.language)throw Error('Invalid parameter: "language"');if(!n.XZ.call(this)){var r=a.Z.create({type:s.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(r)}var t={translationLanguage:e.language},c=this.context,u=c.accessToken,p=c.orgName,l=c.appName,d=c.userId,f={url:"".concat(this.apiUrl,"/").concat(p,"/").concat(l,"/users/").concat(d,"/notification/language"),type:"PUT",dataType:"json",data:JSON.stringify(t),headers:{Authorization:"Bearer "+u,"Content-Type":"application/json"},success:e.success,error:e.error};return i.kg.debug("Call setPushPerformLanguage:",e),o.hj.call(this,f)}function h(e){if(!n.XZ.call(this)){var r=a.Z.create({type:s.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(r)}var t=this.context,c=t.accessToken,u=t.orgName,p=t.appName,l=t.userId,d={url:"".concat(this.apiUrl,"/").concat(u,"/").concat(p,"/users/").concat(l,"/notification/language"),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+c,"Content-Type":"application/json"},success:null==e?void 0:e.success,error:null==e?void 0:e.error};return i.kg.debug("Call getPushPerformLanguage:",e),o.hj.call(this,d)}function y(e){if(!n.XZ.call(this)){var r=a.Z.create({type:s.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(r)}if("number"!=typeof e.pageSize)throw Error('Invalid parameter: "pageSize"');var t=this.context,c=t.accessToken,u=t.orgName,p=t.appName,l=t.userId,d={limit:e.pageSize||10,cursor:e.cursor};e.cursor||delete d.cursor;var f={url:"".concat(this.apiUrl,"/").concat(u,"/").concat(p,"/users/").concat(l,"/notification/mute/type"),type:"GET",dataType:"json",data:d,headers:{Authorization:"Bearer "+c,"Content-Type":"application/json"}};return i.kg.debug("Call getSilentModeRemindTypeConversations:",e),o.hj.call(this,f).then((function(e){return e.data?{data:{conversations:e.data.map((function(e){return"user"in e?{conversationId:e.user,type:"singleChat",remindType:e.value}:{conversationId:e.group,type:"groupChat",remindType:e.value}})),cursor:e.cursor},type:e.type}:e}))}},3246:function(e,r,t){t.d(r,{H7:function(){return p},XZ:function(){return c},_W:function(){return u}}),t(7941),t(9554),t(1539),t(4747),t(6699),t(2023);var o=t(5531),n=t(7252),a=t(7360);function s(){var e=this.context.appName,r=this.context.orgName;return!(!e||!r)||(this.onError&&this.onError({type:o.E.WEBIM_CONNCTION_AUTH_ERROR,message:"appName or orgName is illegal"}),!1)}function i(){var e,r=this.context.accessToken;if(!r){var t=n.Z.create({type:o.E.WEBIM_CONNCTION_TOKEN_NOT_ASSIGN_ERROR,message:"token not assign error"});return a.kg.debug("token not assign error",r),this.onError&&this.onError(t),null===(e=this.eventHandler)||void 0===e||e.dispatch("onError",t),!1}return!0}function c(){return i.call(this)&&s.call(this)}function u(e){var r=e.data,t=e.type;return{data:{status:Object.keys(r.errorKeys).length>0?"fail":"success",errorKeys:r.errorKeys,successKeys:r.successKeys},type:t}}function p(e){var r=e.data,t=void 0;return Object.keys(r.errorKeys).length>0&&Object.keys(r.errorKeys).forEach((function(e){var a=r.errorKeys[e];t=a.includes("is not part of you")?n.Z.create({type:o.E.NO_PERMISSION,message:a}):a.includes("size of metadata for this single chatroom exceeds the user defined limit")||a.includes("total size of chatroom metadata for this app exceeds the user defined limit")||a.includes("is exceeding maximum limit")?n.Z.create({type:o.E.MAX_LIMIT,message:a}):a.includes("is not Legal")?n.Z.create({type:o.E.REQUEST_PARAMETER_ERROR,message:a}):a.includes("Failed to update userMetadata. Concurrent updates not allowed")?n.Z.create({type:o.E.OPERATION_NOT_ALLOWED,message:a}):n.Z.create({type:o.E.WEBIM_CONNCTION_AJAX_ERROR,message:a})})),t}}},function(e){return 1735,e(e.s=1735)}])}));
|
|
1
|
+
!function(e,r){"object"==typeof exports&&"object"==typeof module?module.exports=r():"function"==typeof define&&define.amd?define([],r):"object"==typeof exports?exports.websdk=r():e.websdk=r()}(self,(function(){return(self.webpackChunkwebsdk=self.webpackChunkwebsdk||[]).push([[883],{1735:function(e,r,t){t.r(r),t.d(r,{clearRemindTypeForConversation:function(){return l},getPushPerformLanguage:function(){return m},getSilentModeForAll:function(){return p},getSilentModeForConversation:function(){return d},getSilentModeForConversations:function(){return f},getSilentModeRemindTypeConversations:function(){return y},setPushPerformLanguage:function(){return h},setSilentModeForAll:function(){return c},setSilentModeForConversation:function(){return u}}),t(7941),t(1539),t(8674),t(2222),t(9753),t(9554),t(4747),t(9600),t(1249);var o=t(4024),n=t(3246),a=t(7252),i=t(5531),s=t(7360);function c(e){if(!(e.options instanceof Object))throw Error('Invalid parameter: "options"');var r=e.options.paramType;if("number"!=typeof r||r<0||r>2)throw Error('Invalid parameter: "options of paramType"');if(0===r){if("string"!=typeof e.options.remindType)throw Error('Invalid parameter: "options of remindType"')}else if(1===r){if("number"!=typeof e.options.duration)throw Error('Invalid parameter: "options of duration"')}else if(2===r){var t=e.options,c=t.startTime,p=t.endTime;if(!(c instanceof Object&&Object.keys(c).length))throw Error('Invalid parameter: "options of startTime"');if(!c.hours||"number"!=typeof c.hours||!c.minutes||"number"!=typeof c.minutes)throw Error('Invalid parameter: "options of startTime of hours or minutes"');if(!(p instanceof Object&&Object.keys(p).length))throw Error('Invalid parameter: "options of endTime"');if(!p.hours||"number"!=typeof p.hours||!p.minutes||"number"!=typeof p.minutes)throw Error('Invalid parameter: "options of endTime of hours or minutes"')}if(!n.XZ.call(this)){var u=a.Z.create({type:i.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(u)}var l=this.context,d=l.accessToken,f=l.orgName,h=l.appName,m=l.userId,y=l.jid,g={};switch(r){case 0:g={type:e.options.remindType};break;case 1:g={ignoreDuration:e.options.duration};break;case 2:var T=e.options;c=T.startTime,p=T.endTime,g={ignoreInterval:"".concat(c.hours,":").concat(c.minutes,"-").concat(p.hours,":").concat(p.minutes)}}var v={url:"".concat(this.apiUrl,"/").concat(f,"/").concat(h,"/users/").concat(m,"/notification/user/").concat(m,"?resource=").concat(y.clientResource),type:"PUT",dataType:"json",data:JSON.stringify(g),headers:{Authorization:"Bearer "+d,"Content-Type":"application/json"},success:e.success,error:e.error};return s.kg.debug("Call setSilentModeForAll:",e),o.hj.call(this,v)}function p(e){if(!n.XZ.call(this)){var r=a.Z.create({type:i.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(r)}var t=this.context,c=t.accessToken,p=t.orgName,u=t.appName,l=t.userId,d={url:"".concat(this.apiUrl,"/").concat(p,"/").concat(u,"/users/").concat(l,"/notification/user/").concat(l),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+c,"Content-Type":"application/json"},success:null==e?void 0:e.success,error:null==e?void 0:e.error};return s.kg.debug("Call getSilentModeForAll:",e),o.hj.call(this,d)}function u(e){if("string"!=typeof e.conversationId||!e.conversationId)throw Error('Invalid parameter: "conversationId"');if("string"!=typeof e.type||!e.type)throw Error('Invalid parameter: "type"');if(!(e.options instanceof Object))throw Error('Invalid parameter: "options"');var r=e.options.paramType;if("number"!=typeof r||r<0||r>2)throw Error('Invalid parameter: "options of paramType"');if(0===r){if("string"!=typeof e.options.remindType)throw Error('Invalid parameter: "options of remindType"')}else if(1===r){if("number"!=typeof e.options.duration)throw Error('Invalid parameter: "options of duration"')}else if(2===r){var t=e.options,c=t.startTime,p=t.endTime;if(!(c instanceof Object&&Object.keys(c).length))throw Error('Invalid parameter: "options of startTime"');if(!c.hours||"number"!=typeof c.hours||!c.minutes||"number"!=typeof c.minutes)throw Error('Invalid parameter: "options of startTime of hours or minutes"');if(!(p instanceof Object&&Object.keys(p).length))throw Error('Invalid parameter: "options of endTime"');if(!p.hours||"number"!=typeof p.hours||!p.minutes||"number"!=typeof p.minutes)throw Error('Invalid parameter: "options of endTime of hours or minutes"')}if(!n.XZ.call(this)){var u=a.Z.create({type:i.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(u)}var l=this.context,d=l.accessToken,f=l.orgName,h=l.appName,m=l.userId,y=l.jid,g="chatgroup",T={};switch(r){case 0:T={type:e.options.remindType};break;case 1:T={ignoreDuration:e.options.duration};break;case 2:var v=e.options;c=v.startTime,p=v.endTime,T={ignoreInterval:"".concat(c.hours,":").concat(c.minutes,"-").concat(p.hours,":").concat(p.minutes)}}"singleChat"===e.type&&(g="user");var S={url:"".concat(this.apiUrl,"/").concat(f,"/").concat(h,"/users/").concat(m,"/notification/").concat(g,"/").concat(e.conversationId,"?resource=").concat(y.clientResource),type:"PUT",dataType:"json",data:JSON.stringify(T),headers:{Authorization:"Bearer "+d,"Content-Type":"application/json"},success:e.success,error:e.error};return s.kg.debug("Call setSilentModeForConversation:",e),o.hj.call(this,S)}function l(e){if("string"!=typeof e.conversationId||!e.conversationId)throw Error('Invalid parameter: "conversationId"');if("string"!=typeof e.type||!e.type)throw Error('Invalid parameter: "type"');if(!n.XZ.call(this)){var r=a.Z.create({type:i.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(r)}var t=this.context,c=t.accessToken,p=t.orgName,u=t.appName,l=t.userId,d=t.jid,f="chatgroup";"singleChat"===e.type&&(f="user");var h={url:"".concat(this.apiUrl,"/").concat(p,"/").concat(u,"/users/").concat(l,"/notification/").concat(f,"/").concat(e.conversationId,"?resource=").concat(d.clientResource),type:"PUT",dataType:"json",data:JSON.stringify({type:"DEFAULT"}),headers:{Authorization:"Bearer "+c,"Content-Type":"application/json"},success:e.success,error:e.error};return s.kg.debug("Call clearRemindTypeForConversation:",e),o.hj.call(this,h)}function d(e){if("string"!=typeof e.conversationId||!e.conversationId)throw Error('Invalid parameter: "conversationId"');if("string"!=typeof e.type||!e.type)throw Error('Invalid parameter: "type"');if(!n.XZ.call(this)){var r=a.Z.create({type:i.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(r)}var t=this.context,c=t.accessToken,p=t.orgName,u=t.appName,l=t.userId,d="chatgroup";"singleChat"===e.type&&(d="user");var f={url:"".concat(this.apiUrl,"/").concat(p,"/").concat(u,"/users/").concat(l,"/notification/").concat(d,"/").concat(e.conversationId),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+c,"Content-Type":"application/json"},success:e.success,error:e.error};return s.kg.debug("Call getSilentModeForConversation:",e),o.hj.call(this,f)}function f(e){if(!Array.isArray(e.conversationList))throw Error('Invalid parameter: "conversationList"');if(!n.XZ.call(this)){var r=a.Z.create({type:i.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(r)}var t=this.context,c=t.accessToken,p=t.orgName,u=t.appName,l=t.userId,d=[],f=[];e.conversationList.forEach((function(e){"singleChat"===e.type?d.push(e.id):f.push(e.id)}));var h=d.length?d.join(","):"",m=f.length?f.join(","):"",y={url:"".concat(this.apiUrl,"/").concat(p,"/").concat(u,"/users/").concat(l,"/notification?user=").concat(h,"&group=").concat(m),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+c,"Content-Type":"application/json"},success:e.success,error:e.error};return s.kg.debug("Call getSilentModeForConversations:",e),o.hj.call(this,y)}function h(e){if("string"!=typeof e.language||!e.language)throw Error('Invalid parameter: "language"');if(!n.XZ.call(this)){var r=a.Z.create({type:i.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(r)}var t={translationLanguage:e.language},c=this.context,p=c.accessToken,u=c.orgName,l=c.appName,d=c.userId,f={url:"".concat(this.apiUrl,"/").concat(u,"/").concat(l,"/users/").concat(d,"/notification/language"),type:"PUT",dataType:"json",data:JSON.stringify(t),headers:{Authorization:"Bearer "+p,"Content-Type":"application/json"},success:e.success,error:e.error};return s.kg.debug("Call setPushPerformLanguage:",e),o.hj.call(this,f)}function m(e){if(!n.XZ.call(this)){var r=a.Z.create({type:i.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(r)}var t=this.context,c=t.accessToken,p=t.orgName,u=t.appName,l=t.userId,d={url:"".concat(this.apiUrl,"/").concat(p,"/").concat(u,"/users/").concat(l,"/notification/language"),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+c,"Content-Type":"application/json"},success:null==e?void 0:e.success,error:null==e?void 0:e.error};return s.kg.debug("Call getPushPerformLanguage:",e),o.hj.call(this,d)}function y(e){if(!n.XZ.call(this)){var r=a.Z.create({type:i.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(r)}if("number"!=typeof e.pageSize)throw Error('Invalid parameter: "pageSize"');var t=this.context,c=t.accessToken,p=t.orgName,u=t.appName,l=t.userId,d={limit:e.pageSize||10,cursor:e.cursor};e.cursor||delete d.cursor;var f={url:"".concat(this.apiUrl,"/").concat(p,"/").concat(u,"/users/").concat(l,"/notification/mute/type"),type:"GET",dataType:"json",data:d,headers:{Authorization:"Bearer "+c,"Content-Type":"application/json"}};return s.kg.debug("Call getSilentModeRemindTypeConversations:",e),o.hj.call(this,f).then((function(e){return e.data?{data:{conversations:e.data.map((function(e){return"user"in e?{conversationId:e.user,type:"singleChat",remindType:e.value}:{conversationId:e.group,type:"groupChat",remindType:e.value}})),cursor:e.cursor},type:e.type}:e}))}}},function(e){return 1735,e(e.s=1735)}])}));
|
package/thread/thread.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([[90],{7384:function(e,t,a){a.r(t),a.d(t,{changeChatThreadName:function(){return f},createChatThread:function(){return h},destroyChatThread:function(){return l},getChatThreadDetail:function(){return v},getChatThreadLastMessage:function(){return g},getChatThreadMembers:function(){return T},getChatThreads:function(){return I},getJoinedChatThreads:function(){return y},joinChatThread:function(){return u},leaveChatThread:function(){return p},removeChatThreadMember:function(){return m}}),a(1539),a(8674),a(2526),a(1817),a(2165),a(6992),a(8783),a(3948),a(8309),a(2222),a(9554),a(4747),a(9753);var r=a(5531),n=a(7252),o=a(4024),c=a(3246),s=a(4363),i=function(e,t,a,r){return new(a||(a=Promise))((function(n,o){function c(e){try{i(r.next(e))}catch(e){o(e)}}function s(e){try{i(r.throw(e))}catch(e){o(e)}}function i(e){var t;e.done?n(e.value):(t=e.value,t instanceof a?t:new a((function(e){e(t)}))).then(c,s)}i((r=r.apply(e,t||[])).next())}))},d=function(e,t){var a,r,n,o,c={label:0,sent:function(){if(1&n[0])throw n[1];return n[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(a)throw new TypeError("Generator is already executing.");for(;c;)try{if(a=1,r&&(n=2&o[0]?r.return:o[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,o[1])).done)return n;switch(r=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return c.label++,{value:o[1],done:!1};case 5:c.label++,r=o[1],o=[0];continue;case 7:o=c.ops.pop(),c.trys.pop();continue;default:if(!((n=(n=c.trys).length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){c.label=o[1];break}if(6===o[0]&&c.label<n[1]){c.label=n[1],n=o;break}if(n&&c.label<n[2]){c.label=n[2],c.ops.push(o);break}n[2]&&c.ops.pop(),c.trys.pop();continue}o=t.call(e,c)}catch(e){o=[6,e],r=0}finally{a=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};function h(e){if("string"!=typeof e.name||""===e.name)throw Error("Invalid parameter name: ".concat(e.name));if("string"!=typeof e.messageId||""===e.messageId)throw Error("Invalid parameter messageId: ".concat(e.messageId));if("string"!=typeof e.parentId||""===e.parentId)throw Error("Invalid parameter parentId: ".concat(e.parentId));if(!c.XZ.call(this)){var t=n.Z.create({type:r.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var a=this.context,s=a.orgName,i=a.appName,d=a.accessToken,h=a.jid,u={name:e.name,msg_id:e.messageId,group_id:e.parentId,owner:this.user},p={url:"".concat(this.apiUrl,"/").concat(s,"/").concat(i,"/thread?resource=").concat(h.clientResource),type:"POST",dataType:"json",data:JSON.stringify(u),headers:{Authorization:"Bearer "+d,"Content-Type":"application/json"}};return o.hj.call(this,p).then((function(e){var t=e.data.thread_id;return e.data={chatThreadId:t},e}))}function u(e){if("string"!=typeof e.chatThreadId||""===e.chatThreadId)throw Error("Invalid parameter chatThreadId: ".concat(e.chatThreadId));if(!c.XZ.call(this)){var t=n.Z.create({type:r.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var a=this.context,s=a.orgName,i=a.appName,d=a.accessToken,h=a.jid,u={url:"".concat(this.apiUrl,"/").concat(s,"/").concat(i,"/thread/").concat(e.chatThreadId,"/user/").concat(this.user,"/join?resource=").concat(h.clientResource),type:"POST",dataType:"json",headers:{Authorization:"Bearer "+d,"Content-Type":"application/json"}};return o.hj.call(this,u).then((function(e){var t=e.data.detail;return t.messageId=t.msgId,t.parentId=t.groupId,delete t.msgId,delete t.groupId,e}))}function p(e){return i(this,void 0,void 0,(function(){var t,a,s,i,h,u,p;return d(this,(function(d){switch(d.label){case 0:if("string"!=typeof e.chatThreadId||""===e.chatThreadId)throw Error("Invalid parameter chatThreadId: ".concat(e.chatThreadId));return c.XZ.call(this)?(a=this.context,s=a.orgName,i=a.appName,h=a.accessToken,u=a.jid,p={url:"".concat(this.apiUrl,"/").concat(s,"/").concat(i,"/thread/").concat(e.chatThreadId,"/user/").concat(this.user,"/quit?resource=").concat(u.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+h,"Content-Type":"application/json"}},[4,o.hj.call(this,p)]):(t=n.Z.create({type:r.E.REST_PARAMS_STATUS,message:"appkey or token error"}),[2,Promise.reject(t)]);case 1:return d.sent(),[2]}}))}))}function l(e){return i(this,void 0,void 0,(function(){var t,a,s,i,h,u,p;return d(this,(function(d){switch(d.label){case 0:if("string"!=typeof e.chatThreadId||""===e.chatThreadId)throw Error("Invalid parameter chatThreadId: ".concat(e.chatThreadId));return c.XZ.call(this)?(a=this.context,s=a.orgName,i=a.appName,h=a.accessToken,u=a.jid,p={url:"".concat(this.apiUrl,"/").concat(s,"/").concat(i,"/thread/").concat(e.chatThreadId,"?resource=").concat(u.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+h,"Content-Type":"application/json"}},[4,o.hj.call(this,p)]):(t=n.Z.create({type:r.E.REST_PARAMS_STATUS,message:"appkey or token error"}),[2,Promise.reject(t)]);case 1:return d.sent(),[2]}}))}))}function f(e){if("string"!=typeof e.chatThreadId||""===e.chatThreadId)throw Error("Invalid parameter chatThreadId: ".concat(e.chatThreadId));if("string"!=typeof e.name||""===e.name)throw Error("Invalid parameter name: ".concat(e.name));if(!c.XZ.call(this)){var t=n.Z.create({type:r.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var a=this.context,s=a.orgName,i=a.appName,d=a.accessToken,h=a.jid,u={name:e.name},p={url:"".concat(this.apiUrl,"/").concat(s,"/").concat(i,"/thread/").concat(e.chatThreadId,"?resource=").concat(h.clientResource),type:"PUT",dataType:"json",data:JSON.stringify(u),headers:{Authorization:"Bearer "+d,"Content-Type":"application/json"}};return o.hj.call(this,p)}function T(e){if("string"!=typeof e.chatThreadId||""===e.chatThreadId)throw Error("Invalid parameter chatThreadId: ".concat(e.chatThreadId));if(!c.XZ.call(this)){var t=n.Z.create({type:r.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var a=this.context,s=a.orgName,i=a.appName,d=a.accessToken,h={limit:e.pageSize||20,cursor:e.cursor||""},u={url:"".concat(this.apiUrl,"/").concat(s,"/").concat(i,"/thread/").concat(e.chatThreadId,"/users"),type:"GET",dataType:"json",data:h,headers:{Authorization:"Bearer "+d,"Content-Type":"application/json"}};return o.hj.call(this,u)}function m(e){if("string"!=typeof e.chatThreadId||""===e.chatThreadId)throw Error("Invalid parameter chatThreadId: ".concat(e.chatThreadId));if("string"!=typeof e.username||""===e.username)throw Error("Invalid parameter username: ".concat(e.username));if(!c.XZ.call(this)){var t=n.Z.create({type:r.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var a=this.context,s=a.orgName,i=a.appName,d=a.accessToken,h=a.jid,u={url:"".concat(this.apiUrl,"/").concat(s,"/").concat(i,"/thread/").concat(e.chatThreadId,"/users/").concat(e.username,"?resource=").concat(h.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+d,"Content-Type":"application/json"}};return o.hj.call(this,u)}function y(e){if(!c.XZ.call(this)){var t=n.Z.create({type:r.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var a=this.context,s=a.orgName,i=a.appName,d=a.accessToken,h={limit:e.pageSize||20,cursor:e.cursor||""},u={url:e.parentId?"".concat(this.apiUrl,"/").concat(s,"/").concat(i,"/threads/chatgroups/").concat(e.parentId,"/user/").concat(this.user):"".concat(this.apiUrl,"/").concat(s,"/").concat(i,"/threads/user/").concat(this.user),type:"GET",dataType:"json",data:h,headers:{Authorization:"Bearer "+d,"Content-Type":"application/json"}};return o.hj.call(this,u).then((function(e){var t=e.entities;return null==t||t.forEach((function(e){e.parentId=e.groupId,e.messageId=e.msgId,delete e.groupId,delete e.msgId})),e}))}function I(e){if("string"!=typeof e.parentId||""===e.parentId)throw Error("Invalid parameter parentId: ".concat(e.parentId));if(!c.XZ.call(this)){var t=n.Z.create({type:r.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var a=this.context,s=a.orgName,i=a.appName,d=a.accessToken,h={cursor:e.cursor||"",limit:e.pageSize||20},u={url:"".concat(this.apiUrl,"/").concat(s,"/").concat(i,"/threads/chatgroups/").concat(e.parentId),type:"GET",dataType:"json",data:h,headers:{Authorization:"Bearer "+d,"Content-Type":"application/json"}};return o.hj.call(this,u).then((function(e){var t=e.entities;return null==t||t.forEach((function(e){e.parentId=e.groupId,e.messageId=e.msgId,delete e.groupId,delete e.msgId})),e}))}function g(e){var t=this;if(!Array.isArray(e.chatThreadIds))throw Error("Invalid parameter chatThreadIds: ".concat(e.chatThreadIds));if(!c.XZ.call(this)){var a=n.Z.create({type:r.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(a)}var s=this.context,i=s.orgName,d=s.appName,h=s.accessToken,u={threadIds:e.chatThreadIds},p={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(d,"/thread/message"),type:"POST",dataType:"json",data:JSON.stringify(u),headers:{Authorization:"Bearer "+h,"Content-Type":"application/json"}};return o.hj.call(this,p).then((function(e){return E.call(t,e)}))}function E(e){var t=this,a=e.entities;return null==a||a.forEach((function(e){e.chatThreadId=e.thread_id,e.last_message&&"{}"!==JSON.stringify(e.last_message)?e.lastMessage=s.w.call(t,e.last_message):e.lastMessage=e.last_message,delete e.thread_id,delete e.last_message})),e}function v(e){if("string"!=typeof e.chatThreadId||""===e.chatThreadId)throw Error("Invalid parameter chatThreadId: ".concat(e.chatThreadId));if(!c.XZ.call(this)){var t=n.Z.create({type:r.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var a=this.context,s=a.orgName,i=a.appName,d=a.accessToken,h={url:"".concat(this.apiUrl,"/").concat(s,"/").concat(i,"/thread/").concat(e.chatThreadId),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+d,"Content-Type":"application/json"}};return o.hj.call(this,h).then((function(e){return e.data.affiliationsCount=e.data.affiliations_count,e.data.messageId=e.data.msgId,e.data.parentId=e.data.groupId,delete e.data.affiliations_count,delete e.data.msgId,delete e.data.groupId,e}))}},3246:function(e,t,a){a.d(t,{H7:function(){return h},XZ:function(){return i},_W:function(){return d}}),a(7941),a(9554),a(1539),a(4747),a(6699),a(2023);var r=a(5531),n=a(7252),o=a(7360);function c(){var e=this.context.appName,t=this.context.orgName;return!(!e||!t)||(this.onError&&this.onError({type:r.E.WEBIM_CONNCTION_AUTH_ERROR,message:"appName or orgName is illegal"}),!1)}function s(){var e,t=this.context.accessToken;if(!t){var a=n.Z.create({type:r.E.WEBIM_CONNCTION_TOKEN_NOT_ASSIGN_ERROR,message:"token not assign error"});return o.kg.debug("token not assign error",t),this.onError&&this.onError(a),null===(e=this.eventHandler)||void 0===e||e.dispatch("onError",a),!1}return!0}function i(){return s.call(this)&&c.call(this)}function d(e){var t=e.data,a=e.type;return{data:{status:Object.keys(t.errorKeys).length>0?"fail":"success",errorKeys:t.errorKeys,successKeys:t.successKeys},type:a}}function h(e){var t=e.data,a=void 0;return Object.keys(t.errorKeys).length>0&&Object.keys(t.errorKeys).forEach((function(e){var o=t.errorKeys[e];a=o.includes("is not part of you")?n.Z.create({type:r.E.NO_PERMISSION,message:o}):o.includes("size of metadata for this single chatroom exceeds the user defined limit")||o.includes("total size of chatroom metadata for this app exceeds the user defined limit")||o.includes("is exceeding maximum limit")?n.Z.create({type:r.E.MAX_LIMIT,message:o}):o.includes("is not Legal")?n.Z.create({type:r.E.REQUEST_PARAMETER_ERROR,message:o}):o.includes("Failed to update userMetadata. Concurrent updates not allowed")?n.Z.create({type:r.E.OPERATION_NOT_ALLOWED,message:o}):n.Z.create({type:r.E.WEBIM_CONNCTION_AJAX_ERROR,message:o})})),a}}},function(e){return 7384,e(e.s=7384)}])}));
|
|
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([[90],{7384:function(e,t,a){a.r(t),a.d(t,{changeChatThreadName:function(){return T},createChatThread:function(){return d},destroyChatThread:function(){return l},getChatThreadDetail:function(){return j},getChatThreadLastMessage:function(){return g},getChatThreadMembers:function(){return f},getChatThreads:function(){return y},getJoinedChatThreads:function(){return I},joinChatThread:function(){return p},leaveChatThread:function(){return u},removeChatThreadMember:function(){return m}}),a(1539),a(8674),a(2526),a(1817),a(2165),a(6992),a(8783),a(3948),a(8309),a(2222),a(9554),a(4747),a(9753);var r=a(5531),n=a(7252),o=a(4024),c=a(3246),i=a(4363),s=function(e,t,a,r){return new(a||(a=Promise))((function(n,o){function c(e){try{s(r.next(e))}catch(e){o(e)}}function i(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?n(e.value):(t=e.value,t instanceof a?t:new a((function(e){e(t)}))).then(c,i)}s((r=r.apply(e,t||[])).next())}))},h=function(e,t){var a,r,n,o,c={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(o){return function(i){return function(o){if(a)throw new TypeError("Generator is already executing.");for(;c;)try{if(a=1,r&&(n=2&o[0]?r.return:o[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,o[1])).done)return n;switch(r=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return c.label++,{value:o[1],done:!1};case 5:c.label++,r=o[1],o=[0];continue;case 7:o=c.ops.pop(),c.trys.pop();continue;default:if(!((n=(n=c.trys).length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){c.label=o[1];break}if(6===o[0]&&c.label<n[1]){c.label=n[1],n=o;break}if(n&&c.label<n[2]){c.label=n[2],c.ops.push(o);break}n[2]&&c.ops.pop(),c.trys.pop();continue}o=t.call(e,c)}catch(e){o=[6,e],r=0}finally{a=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,i])}}};function d(e){if("string"!=typeof e.name||""===e.name)throw Error("Invalid parameter name: ".concat(e.name));if("string"!=typeof e.messageId||""===e.messageId)throw Error("Invalid parameter messageId: ".concat(e.messageId));if("string"!=typeof e.parentId||""===e.parentId)throw Error("Invalid parameter parentId: ".concat(e.parentId));if(!c.XZ.call(this)){var t=n.Z.create({type:r.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var a=this.context,i=a.orgName,s=a.appName,h=a.accessToken,d=a.jid,p={name:e.name,msg_id:e.messageId,group_id:e.parentId,owner:this.user},u={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(s,"/thread?resource=").concat(d.clientResource),type:"POST",dataType:"json",data:JSON.stringify(p),headers:{Authorization:"Bearer "+h,"Content-Type":"application/json"}};return o.hj.call(this,u).then((function(e){var t=e.data.thread_id;return e.data={chatThreadId:t},e}))}function p(e){if("string"!=typeof e.chatThreadId||""===e.chatThreadId)throw Error("Invalid parameter chatThreadId: ".concat(e.chatThreadId));if(!c.XZ.call(this)){var t=n.Z.create({type:r.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var a=this.context,i=a.orgName,s=a.appName,h=a.accessToken,d=a.jid,p={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(s,"/thread/").concat(e.chatThreadId,"/user/").concat(this.user,"/join?resource=").concat(d.clientResource),type:"POST",dataType:"json",headers:{Authorization:"Bearer "+h,"Content-Type":"application/json"}};return o.hj.call(this,p).then((function(e){var t=e.data.detail;return t.messageId=t.msgId,t.parentId=t.groupId,delete t.msgId,delete t.groupId,e}))}function u(e){return s(this,void 0,void 0,(function(){var t,a,i,s,d,p,u;return h(this,(function(h){switch(h.label){case 0:if("string"!=typeof e.chatThreadId||""===e.chatThreadId)throw Error("Invalid parameter chatThreadId: ".concat(e.chatThreadId));return c.XZ.call(this)?(a=this.context,i=a.orgName,s=a.appName,d=a.accessToken,p=a.jid,u={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(s,"/thread/").concat(e.chatThreadId,"/user/").concat(this.user,"/quit?resource=").concat(p.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+d,"Content-Type":"application/json"}},[4,o.hj.call(this,u)]):(t=n.Z.create({type:r.E.REST_PARAMS_STATUS,message:"appkey or token error"}),[2,Promise.reject(t)]);case 1:return h.sent(),[2]}}))}))}function l(e){return s(this,void 0,void 0,(function(){var t,a,i,s,d,p,u;return h(this,(function(h){switch(h.label){case 0:if("string"!=typeof e.chatThreadId||""===e.chatThreadId)throw Error("Invalid parameter chatThreadId: ".concat(e.chatThreadId));return c.XZ.call(this)?(a=this.context,i=a.orgName,s=a.appName,d=a.accessToken,p=a.jid,u={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(s,"/thread/").concat(e.chatThreadId,"?resource=").concat(p.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+d,"Content-Type":"application/json"}},[4,o.hj.call(this,u)]):(t=n.Z.create({type:r.E.REST_PARAMS_STATUS,message:"appkey or token error"}),[2,Promise.reject(t)]);case 1:return h.sent(),[2]}}))}))}function T(e){if("string"!=typeof e.chatThreadId||""===e.chatThreadId)throw Error("Invalid parameter chatThreadId: ".concat(e.chatThreadId));if("string"!=typeof e.name||""===e.name)throw Error("Invalid parameter name: ".concat(e.name));if(!c.XZ.call(this)){var t=n.Z.create({type:r.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var a=this.context,i=a.orgName,s=a.appName,h=a.accessToken,d=a.jid,p={name:e.name},u={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(s,"/thread/").concat(e.chatThreadId,"?resource=").concat(d.clientResource),type:"PUT",dataType:"json",data:JSON.stringify(p),headers:{Authorization:"Bearer "+h,"Content-Type":"application/json"}};return o.hj.call(this,u)}function f(e){if("string"!=typeof e.chatThreadId||""===e.chatThreadId)throw Error("Invalid parameter chatThreadId: ".concat(e.chatThreadId));if(!c.XZ.call(this)){var t=n.Z.create({type:r.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var a=this.context,i=a.orgName,s=a.appName,h=a.accessToken,d={limit:e.pageSize||20,cursor:e.cursor||""},p={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(s,"/thread/").concat(e.chatThreadId,"/users"),type:"GET",dataType:"json",data:d,headers:{Authorization:"Bearer "+h,"Content-Type":"application/json"}};return o.hj.call(this,p)}function m(e){if("string"!=typeof e.chatThreadId||""===e.chatThreadId)throw Error("Invalid parameter chatThreadId: ".concat(e.chatThreadId));if("string"!=typeof e.username||""===e.username)throw Error("Invalid parameter username: ".concat(e.username));if(!c.XZ.call(this)){var t=n.Z.create({type:r.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var a=this.context,i=a.orgName,s=a.appName,h=a.accessToken,d=a.jid,p={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(s,"/thread/").concat(e.chatThreadId,"/users/").concat(e.username,"?resource=").concat(d.clientResource),type:"DELETE",dataType:"json",headers:{Authorization:"Bearer "+h,"Content-Type":"application/json"}};return o.hj.call(this,p)}function I(e){if(!c.XZ.call(this)){var t=n.Z.create({type:r.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var a=this.context,i=a.orgName,s=a.appName,h=a.accessToken,d={limit:e.pageSize||20,cursor:e.cursor||""},p={url:e.parentId?"".concat(this.apiUrl,"/").concat(i,"/").concat(s,"/threads/chatgroups/").concat(e.parentId,"/user/").concat(this.user):"".concat(this.apiUrl,"/").concat(i,"/").concat(s,"/threads/user/").concat(this.user),type:"GET",dataType:"json",data:d,headers:{Authorization:"Bearer "+h,"Content-Type":"application/json"}};return o.hj.call(this,p).then((function(e){var t=e.entities;return null==t||t.forEach((function(e){e.parentId=e.groupId,e.messageId=e.msgId,delete e.groupId,delete e.msgId})),e}))}function y(e){if("string"!=typeof e.parentId||""===e.parentId)throw Error("Invalid parameter parentId: ".concat(e.parentId));if(!c.XZ.call(this)){var t=n.Z.create({type:r.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var a=this.context,i=a.orgName,s=a.appName,h=a.accessToken,d={cursor:e.cursor||"",limit:e.pageSize||20},p={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(s,"/threads/chatgroups/").concat(e.parentId),type:"GET",dataType:"json",data:d,headers:{Authorization:"Bearer "+h,"Content-Type":"application/json"}};return o.hj.call(this,p).then((function(e){var t=e.entities;return null==t||t.forEach((function(e){e.parentId=e.groupId,e.messageId=e.msgId,delete e.groupId,delete e.msgId})),e}))}function g(e){var t=this;if(!Array.isArray(e.chatThreadIds))throw Error("Invalid parameter chatThreadIds: ".concat(e.chatThreadIds));if(!c.XZ.call(this)){var a=n.Z.create({type:r.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(a)}var i=this.context,s=i.orgName,h=i.appName,d=i.accessToken,p={threadIds:e.chatThreadIds},u={url:"".concat(this.apiUrl,"/").concat(s,"/").concat(h,"/thread/message"),type:"POST",dataType:"json",data:JSON.stringify(p),headers:{Authorization:"Bearer "+d,"Content-Type":"application/json"}};return o.hj.call(this,u).then((function(e){return S.call(t,e)}))}function S(e){var t=this,a=e.entities;return null==a||a.forEach((function(e){e.chatThreadId=e.thread_id,e.last_message&&"{}"!==JSON.stringify(e.last_message)?e.lastMessage=i.w.call(t,e.last_message):e.lastMessage=e.last_message,delete e.thread_id,delete e.last_message})),e}function j(e){if("string"!=typeof e.chatThreadId||""===e.chatThreadId)throw Error("Invalid parameter chatThreadId: ".concat(e.chatThreadId));if(!c.XZ.call(this)){var t=n.Z.create({type:r.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var a=this.context,i=a.orgName,s=a.appName,h=a.accessToken,d={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(s,"/thread/").concat(e.chatThreadId),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+h,"Content-Type":"application/json"}};return o.hj.call(this,d).then((function(e){return e.data.affiliationsCount=e.data.affiliations_count,e.data.messageId=e.data.msgId,e.data.parentId=e.data.groupId,delete e.data.affiliations_count,delete e.data.msgId,delete e.data.groupId,e}))}}},function(e){return 7384,e(e.s=7384)}])}));
|
|
@@ -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([[33],{70:function(e,t,r){r.r(t),r.d(t,{getSupportedLanguages:function(){return
|
|
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([[33],{70:function(e,t,r){r.r(t),r.d(t,{getSupportedLanguages:function(){return u},translateMessage:function(){return i}}),r(1539),r(8674),r(2222),r(9753);var a=r(3246),n=r(5531),s=r(7252),o=r(7360),c=r(4024);function u(){if(!a.XZ.call(this)){var e=s.Z.create({type:n.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(e)}var t=this.context,r=t.orgName,u=t.appName,i=t.accessToken,p={url:"".concat(this.apiUrl,"/").concat(r,"/").concat(u,"/users/").concat(this.user,"/translate/support/language"),dataType:"json",type:"GET",headers:{Authorization:"Bearer "+i}};return o.kg.debug("Call getSupportedLanguages"),c.hj.call(this,p)}function i(e){if("string"!=typeof e.text||""===e.text)throw Error('Invalid parameter: "text"');if(!Array.isArray(e.languages))throw Error('Invalid parameter: "language"');if(!a.XZ.call(this)){var t=s.Z.create({type:n.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,u=r.orgName,i=r.appName,p=r.accessToken,l="".concat(this.apiUrl,"/").concat(u,"/").concat(i,"/users/").concat(this.user,"/translate"),g={text:e.text,to:e.languages},f={url:l,dataType:"json",type:"POST",data:JSON.stringify(g),headers:{Authorization:"Bearer "+p}};return o.kg.debug("Call translateMessage"),c.hj.call(this,f)}}},function(e){return 70,e(e.s=70)}])}));
|
package/types/common.d.ts
CHANGED
package/types/engineCore.d.ts
CHANGED
|
@@ -58,6 +58,7 @@ interface PresenceMsg {
|
|
|
58
58
|
gid?: string;
|
|
59
59
|
owner?: string;
|
|
60
60
|
reason?: string;
|
|
61
|
+
announcement?: string;
|
|
61
62
|
kicked?: string;
|
|
62
63
|
groupName?: string;
|
|
63
64
|
detail?: GroupModifyInfo;
|
|
@@ -135,22 +136,32 @@ interface ConversationChangedInfo {
|
|
|
135
136
|
}
|
|
136
137
|
|
|
137
138
|
interface NotificationConMultiDeviceInfo {
|
|
139
|
+
/** The multi-device conversation event. */
|
|
138
140
|
operation:
|
|
139
141
|
| 'setSilentModeForConversation'
|
|
140
142
|
| 'removeSilentModeForConversation';
|
|
143
|
+
/** The client resource. */
|
|
141
144
|
resource: string;
|
|
145
|
+
/** The conversation ID. */
|
|
142
146
|
conversationId: string;
|
|
147
|
+
/** The conversation type. */
|
|
143
148
|
type: 'singleChat' | 'groupChat';
|
|
149
|
+
/** The silent mode type. */
|
|
144
150
|
data: {
|
|
151
|
+
/** The silent mode type. */
|
|
145
152
|
type?: 'AT' | 'NONE' | 'ALL';
|
|
153
|
+
/** The silent mode duration. */
|
|
146
154
|
ignoreDuration?: number;
|
|
147
155
|
};
|
|
148
156
|
}
|
|
149
157
|
interface NotificationUserMultiDeviceInfo {
|
|
158
|
+
/** The multi-device conversation event. */
|
|
150
159
|
operation: 'setSilentModeForUser';
|
|
160
|
+
/** The client resource. */
|
|
151
161
|
resource: string;
|
|
152
|
-
|
|
162
|
+
/** The silent mode type. */
|
|
153
163
|
data: {
|
|
164
|
+
/** Silent mode interval. */
|
|
154
165
|
ignoreInterval: string;
|
|
155
166
|
};
|
|
156
167
|
}
|
package/types/eventHandler.d.ts
CHANGED
|
@@ -184,6 +184,8 @@ export interface ChatroomEvent {
|
|
|
184
184
|
ext?: string;
|
|
185
185
|
/** The reason for the event. */
|
|
186
186
|
reason?: string;
|
|
187
|
+
/** The updated announcement. */
|
|
188
|
+
announcement?: string;
|
|
187
189
|
}
|
|
188
190
|
export interface GroupEvent {
|
|
189
191
|
/** The type of operation. <br/>
|
|
@@ -260,6 +262,8 @@ export interface GroupEvent {
|
|
|
260
262
|
memberCount?: number;
|
|
261
263
|
/** The reason for the event. */
|
|
262
264
|
reason?: string;
|
|
265
|
+
/** The updated announcement. */
|
|
266
|
+
announcement?: string;
|
|
263
267
|
}
|
|
264
268
|
interface MessagePinEvent {
|
|
265
269
|
/** The conversation type. */
|