easemob-websdk 4.8.1 → 4.9.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/CHANGELOG.md +10 -0
- package/Easemob-chat.d.ts +80 -9
- package/Easemob-chat.js +1 -1
- package/chatroom/chatroom.d.ts +1 -1
- package/chatroom/chatroom.js +1 -1
- package/contact/contact.d.ts +4 -4
- package/contact/contact.js +1 -1
- package/group/group.js +1 -1
- package/localCache/localCache.js +1 -1
- package/message/index.d.ts +14 -0
- 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 +35 -2
- package/types/eventHandler.d.ts +12 -1
- package/types/silentModeApi.d.ts +19 -0
- package/uniApp/Easemob-chat.js +1 -1
package/package.json
CHANGED
package/presence/presence.js
CHANGED
|
@@ -1 +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 l},subscribePresence:function(){return p},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),s=t(3246),a=t(7252),o=t(5531),c=t(7360),i=function(e,r,t,n){return new(t||(t=Promise))((function(s,a){function o(e){try{i(n.next(e))}catch(e){a(e)}}function c(e){try{i(n.throw(e))}catch(e){a(e)}}function i(e){var r;e.done?s(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,s,a,o={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return a={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function c(a){return function(c){return function(a){if(t)throw new TypeError("Generator is already executing.");for(;o;)try{if(t=1,n&&(s=2&a[0]?n.return:a[0]?n.throw||((s=n.return)&&s.call(n),0):n.next)&&!(s=s.call(n,a[1])).done)return s;switch(n=0,s&&(a=[2&a[0],s.value]),a[0]){case 0:case 1:s=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,n=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((s=(s=o.trys).length>0&&s[s.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!s||a[1]>s[0]&&a[1]<s[3])){o.label=a[1];break}if(6===a[0]&&o.label<s[1]){o.label=s[1],s=a;break}if(s&&o.label<s[2]){o.label=s[2],o.ops.push(a);break}s[2]&&o.ops.pop(),o.trys.pop();continue}a=r.call(e,o)}catch(e){a=[6,e],n=0}finally{t=s=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}};function l(e){return i(this,void 0,void 0,(function(){var r,t,i,l,p,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 s.XZ.call(this)?(t=this.context,i=t.accessToken,l=t.orgName,p=t.appName,f=t.userId,h=this.context.jid.clientResource,d={ext:e.description},y={url:"".concat(this.apiUrl,"/").concat(l,"/").concat(p,"/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=a.Z.create({type:o.E.REST_PARAMS_STATUS,message:"appkey or token error"}),[2,Promise.reject(r)]);case 1:return u.sent(),[2]}}))}))}function p(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(!s.XZ.call(this)){var r=a.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,l=t.userId,p=t.accessToken,f={usernames:e.usernames},h={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(u,"/users/").concat(l,"/presence/").concat(e.expiry),type:"POST",dataType:"json",data:JSON.stringify(f),headers:{Authorization:"Bearer "+p,"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,l,p,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 s.XZ.call(this)?(t=this.context,i=t.orgName,l=t.appName,p=t.userId,f=t.accessToken,h={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(l,"/users/").concat(p,"/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=a.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(!s.XZ.call(this)){var r=a.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,l=t.userId,p=t.accessToken,f={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(u,"/users/").concat(l,"/presence/sublist?pageNum=").concat(e.pageNum,"&pageSize=").concat(e.pageSize),type:"GET",dataType:"json",headers:{Authorization:"Bearer "+p,"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(!s.XZ.call(this)){var r=a.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,l=i.appName,p=i.userId,f=i.accessToken,h={url:"".concat(this.apiUrl,"/").concat(u,"/").concat(l,"/users/").concat(p,"/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}))}},3246:function(e,r,t){t.d(r,{H7:function(){return l},XZ:function(){return i},_W:function(){return u}}),t(7941),t(9554),t(1539),t(4747),t(6699),t(2023);var n=t(5531),s=t(7252),a=t(7360);function o(){var e=this.context.appName,r=this.context.orgName;return!(!e||!r)||(this.onError&&this.onError({type:n.E.WEBIM_CONNCTION_AUTH_ERROR,message:"appName or orgName is illegal"}),!1)}function c(){var e,r=this.context.accessToken;if(!r){var t=s.Z.create({type:n.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 i(){return c.call(this)&&o.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 l(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")?s.Z.create({type:n.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")?s.Z.create({type:n.E.MAX_LIMIT,message:a}):a.includes("is not Legal")?s.Z.create({type:n.E.REQUEST_PARAMETER_ERROR,message:a}):a.includes("Failed to update userMetadata. Concurrent updates not allowed")?s.Z.create({type:n.E.OPERATION_NOT_ALLOWED,message:a}):s.Z.create({type:n.E.WEBIM_CONNCTION_AJAX_ERROR,message:a})})),t}}},function(e){return 3770,e(e.s=3770)}])}));
|
package/silent/silent.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";!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 f},getSilentModeForConversations:function(){return d},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);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,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:s.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(u)}var l=this.context,f=l.accessToken,d=l.orgName,h=l.appName,m=l.userId,y={};switch(r){case 0:y={type:e.options.remindType};break;case 1:y={ignoreDuration:e.options.duration};break;case 2:var g=e.options;c=g.startTime,p=g.endTime,y={ignoreInterval:"".concat(c.hours,":").concat(c.minutes,"-").concat(p.hours,":").concat(p.minutes)}}var T={url:"".concat(this.apiUrl,"/").concat(d,"/").concat(h,"/users/").concat(m,"/notification/user/").concat(m),type:"PUT",dataType:"json",data:JSON.stringify(y),headers:{Authorization:"Bearer "+f,"Content-Type":"application/json"},success:e.success,error:e.error};return i.kg.debug("Call setSilentModeForAll:",e),o.hj.call(this,T)}function p(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,p=t.orgName,u=t.appName,l=t.userId,f={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 i.kg.debug("Call getSilentModeForAll:",e),o.hj.call(this,f)}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:s.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(u)}var l=this.context,f=l.accessToken,d=l.orgName,h=l.appName,m=l.userId,y="chatgroup",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)}}"singleChat"===e.type&&(y="user");var v={url:"".concat(this.apiUrl,"/").concat(d,"/").concat(h,"/users/").concat(m,"/notification/").concat(y,"/").concat(e.conversationId),type:"PUT",dataType:"json",data:JSON.stringify(g),headers:{Authorization:"Bearer "+f,"Content-Type":"application/json"},success:e.success,error:e.error};return i.kg.debug("Call setSilentModeForConversation:",e),o.hj.call(this,v)}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,p=t.orgName,u=t.appName,l=t.userId,f="chatgroup";"singleChat"===e.type&&(f="user");var d={url:"".concat(this.apiUrl,"/").concat(p,"/").concat(u,"/users/").concat(l,"/notification/").concat(f,"/").concat(e.conversationId),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,d)}function f(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,p=t.orgName,u=t.appName,l=t.userId,f="chatgroup";"singleChat"===e.type&&(f="user");var d={url:"".concat(this.apiUrl,"/").concat(p,"/").concat(u,"/users/").concat(l,"/notification/").concat(f,"/").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,d)}function d(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,p=t.orgName,u=t.appName,l=t.userId,f=[],d=[];e.conversationList.forEach((function(e){"singleChat"===e.type?f.push(e.id):d.push(e.id)}));var h=f.length?f.join(","):"",m=d.length?d.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 i.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:s.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,f=c.userId,d={url:"".concat(this.apiUrl,"/").concat(u,"/").concat(l,"/users/").concat(f,"/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 i.kg.debug("Call setPushPerformLanguage:",e),o.hj.call(this,d)}function m(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,p=t.orgName,u=t.appName,l=t.userId,f={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 i.kg.debug("Call getPushPerformLanguage:",e),o.hj.call(this,f)}},3246:function(e,r,t){t.d(r,{H7:function(){return p},XZ:function(){return i},_W:function(){return c}}),t(7941),t(9554),t(1539),t(4747),t(6699),t(2023);var o=t(5531),n=t(7252);function a(){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 s(){var e;if(!this.context.accessToken){var r=n.Z.create({type:o.E.WEBIM_CONNCTION_TOKEN_NOT_ASSIGN_ERROR,message:"token not assign error"});return this.onError&&this.onError(r),null===(e=this.eventHandler)||void 0===e||e.dispatch("onError",r),!1}return!0}function i(){return s.call(this)&&a.call(this)}function c(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 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)}])}));
|
package/thread/thread.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";!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 d},XZ:function(){return s},_W:function(){return i}}),a(7941),a(9554),a(1539),a(4747),a(6699),a(2023);var r=a(5531),n=a(7252);function o(){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 c(){var e;if(!this.context.accessToken){var t=n.Z.create({type:r.E.WEBIM_CONNCTION_TOKEN_NOT_ASSIGN_ERROR,message:"token not assign error"});return this.onError&&this.onError(t),null===(e=this.eventHandler)||void 0===e||e.dispatch("onError",t),!1}return!0}function s(){return c.call(this)&&o.call(this)}function i(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 d(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 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 +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 c},translateMessage:function(){return u}}),r(1539),r(8674),r(2222),r(9753);var a=r(3246),s=r(5531),n=r(7252),o=r(7360),i=r(4024);function c(){if(!a.XZ.call(this)){var e=n.Z.create({type:s.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(e)}var t=this.context,r=t.orgName,c=t.appName,u=t.accessToken,l={url:"".concat(this.apiUrl,"/").concat(r,"/").concat(c,"/users/").concat(this.user,"/translate/support/language"),dataType:"json",type:"GET",headers:{Authorization:"Bearer "+u}};return o.kg.debug("Call getSupportedLanguages"),i.hj.call(this,l)}function u(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=n.Z.create({type:s.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var r=this.context,c=r.orgName,u=r.appName,l=r.accessToken,p="".concat(this.apiUrl,"/").concat(c,"/").concat(u,"/users/").concat(this.user,"/translate"),d={text:e.text,to:e.languages},f={url:p,dataType:"json",type:"POST",data:JSON.stringify(d),headers:{Authorization:"Bearer "+l}};return o.kg.debug("Call translateMessage"),i.hj.call(this,f)}},3246:function(e,t,r){r.d(t,{H7:function(){return l},XZ:function(){return c},_W:function(){return u}}),r(7941),r(9554),r(1539),r(4747),r(6699),r(2023);var a=r(5531),s=r(7252),n=r(7360);function o(){var e=this.context.appName,t=this.context.orgName;return!(!e||!t)||(this.onError&&this.onError({type:a.E.WEBIM_CONNCTION_AUTH_ERROR,message:"appName or orgName is illegal"}),!1)}function i(){var e,t=this.context.accessToken;if(!t){var r=s.Z.create({type:a.E.WEBIM_CONNCTION_TOKEN_NOT_ASSIGN_ERROR,message:"token not assign error"});return n.kg.debug("token not assign error",t),this.onError&&this.onError(r),null===(e=this.eventHandler)||void 0===e||e.dispatch("onError",r),!1}return!0}function c(){return i.call(this)&&o.call(this)}function u(e){var t=e.data,r=e.type;return{data:{status:Object.keys(t.errorKeys).length>0?"fail":"success",errorKeys:t.errorKeys,successKeys:t.successKeys},type:r}}function l(e){var t=e.data,r=void 0;return Object.keys(t.errorKeys).length>0&&Object.keys(t.errorKeys).forEach((function(e){var n=t.errorKeys[e];r=n.includes("is not part of you")?s.Z.create({type:a.E.NO_PERMISSION,message:n}):n.includes("size of metadata for this single chatroom exceeds the user defined limit")||n.includes("total size of chatroom metadata for this app exceeds the user defined limit")||n.includes("is exceeding maximum limit")?s.Z.create({type:a.E.MAX_LIMIT,message:n}):n.includes("is not Legal")?s.Z.create({type:a.E.REQUEST_PARAMETER_ERROR,message:n}):n.includes("Failed to update userMetadata. Concurrent updates not allowed")?s.Z.create({type:a.E.OPERATION_NOT_ALLOWED,message:n}):s.Z.create({type:a.E.WEBIM_CONNCTION_AJAX_ERROR,message:n})})),r}}},function(e){return 70,e(e.s=70)}])}));
|
package/types/common.d.ts
CHANGED
package/types/engineCore.d.ts
CHANGED
|
@@ -61,6 +61,7 @@ interface PresenceMsg {
|
|
|
61
61
|
kicked?: string;
|
|
62
62
|
groupName?: string;
|
|
63
63
|
detail?: GroupModifyInfo;
|
|
64
|
+
ext?: string;
|
|
64
65
|
}
|
|
65
66
|
interface SendMsgResult {
|
|
66
67
|
/** The local ID of the message. */
|
|
@@ -75,7 +76,10 @@ declare type multiDeviceEventType =
|
|
|
75
76
|
| 'chatThreadDestroy'
|
|
76
77
|
| 'chatThreadJoin'
|
|
77
78
|
| 'chatThreadLeave'
|
|
78
|
-
| 'chatThreadNameUpdate'
|
|
79
|
+
| 'chatThreadNameUpdate'
|
|
80
|
+
| 'setSilentModeForUser'
|
|
81
|
+
| 'removeSilentModeForConversation'
|
|
82
|
+
| 'setSilentModeForConversation';
|
|
79
83
|
interface ThreadMultiDeviceInfo {
|
|
80
84
|
/** Event name of thread multi device event. */
|
|
81
85
|
operation: multiDeviceEventType;
|
|
@@ -130,11 +134,37 @@ interface ConversationChangedInfo {
|
|
|
130
134
|
timestamp: number;
|
|
131
135
|
}
|
|
132
136
|
|
|
137
|
+
interface NotificationConMultiDeviceInfo {
|
|
138
|
+
operation:
|
|
139
|
+
| 'setSilentModeForConversation'
|
|
140
|
+
| 'removeSilentModeForConversation';
|
|
141
|
+
resource: string;
|
|
142
|
+
conversationId: string;
|
|
143
|
+
type: 'singleChat' | 'groupChat';
|
|
144
|
+
data: {
|
|
145
|
+
type?: 'AT' | 'NONE' | 'ALL';
|
|
146
|
+
ignoreDuration?: number;
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
interface NotificationUserMultiDeviceInfo {
|
|
150
|
+
operation: 'setSilentModeForUser';
|
|
151
|
+
resource: string;
|
|
152
|
+
// user: string;
|
|
153
|
+
data: {
|
|
154
|
+
ignoreInterval: string;
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
type NotificationMultiDeviceInfo =
|
|
159
|
+
| NotificationConMultiDeviceInfo
|
|
160
|
+
| NotificationUserMultiDeviceInfo;
|
|
161
|
+
|
|
133
162
|
declare type MultiDeviceEvent =
|
|
134
163
|
| ThreadMultiDeviceInfo
|
|
135
164
|
| ConversationChangedInfo
|
|
136
165
|
| RoamingDeleteMultiDeviceInfo
|
|
137
|
-
| GroupMemberAttributesUpdateMultiDeviceInfo
|
|
166
|
+
| GroupMemberAttributesUpdateMultiDeviceInfo
|
|
167
|
+
| NotificationMultiDeviceInfo;
|
|
138
168
|
|
|
139
169
|
export type {
|
|
140
170
|
OnPresenceMsgType,
|
|
@@ -146,4 +176,7 @@ export type {
|
|
|
146
176
|
ConversationChangedInfo,
|
|
147
177
|
RoamingDeleteMultiDeviceInfo,
|
|
148
178
|
GroupMemberAttributesUpdateMultiDeviceInfo,
|
|
179
|
+
NotificationMultiDeviceInfo,
|
|
180
|
+
NotificationUserMultiDeviceInfo,
|
|
181
|
+
NotificationConMultiDeviceInfo,
|
|
149
182
|
};
|
package/types/eventHandler.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
ContactMsgBody,
|
|
17
17
|
ModifiedEventMessage,
|
|
18
18
|
MessageBody,
|
|
19
|
+
ChatType,
|
|
19
20
|
} from '../types/message';
|
|
20
21
|
import { PresenceMsg, MultiDeviceEvent } from './engineCore';
|
|
21
22
|
import { ErrorEvent } from './error';
|
|
@@ -181,6 +182,8 @@ export interface ChatroomEvent {
|
|
|
181
182
|
memberCount?: number;
|
|
182
183
|
/** The extension fields. */
|
|
183
184
|
ext?: string;
|
|
185
|
+
/** The reason for the event. */
|
|
186
|
+
reason?: string;
|
|
184
187
|
}
|
|
185
188
|
export interface GroupEvent {
|
|
186
189
|
/** The type of operation. <br/>
|
|
@@ -247,16 +250,20 @@ export interface GroupEvent {
|
|
|
247
250
|
id: string;
|
|
248
251
|
/** Message sender. */
|
|
249
252
|
from: string;
|
|
253
|
+
/** The userId of a group event. */
|
|
254
|
+
userId?: string;
|
|
250
255
|
/** The name of a group. */
|
|
251
256
|
name?: string;
|
|
252
257
|
/** The modified group info. */
|
|
253
258
|
detail?: GroupModifyInfo;
|
|
254
259
|
/** The member count. */
|
|
255
260
|
memberCount?: number;
|
|
261
|
+
/** The reason for the event. */
|
|
262
|
+
reason?: string;
|
|
256
263
|
}
|
|
257
264
|
interface MessagePinEvent {
|
|
258
265
|
/** The conversation type. */
|
|
259
|
-
conversationType:
|
|
266
|
+
conversationType: ChatType;
|
|
260
267
|
/** The conversation ID. */
|
|
261
268
|
conversationId: string;
|
|
262
269
|
/** The ID of the message that is pinned or unpinned. */
|
|
@@ -363,6 +370,10 @@ interface EventHandlerType {
|
|
|
363
370
|
onChatroomEvent?: (eventData: ChatroomEvent) => void;
|
|
364
371
|
/** The callback to receive a pin message event. */
|
|
365
372
|
onMessagePinEvent?: (eventData: MessagePinEvent) => void;
|
|
373
|
+
/** Occurs when the SDK starts pulling offline messages from the server. */
|
|
374
|
+
onOfflineMessageSyncStart?: () => void;
|
|
375
|
+
/** Occurs when the SDK finishes pulling offline messages from the server.*/
|
|
376
|
+
onOfflineMessageSyncFinish?: () => void;
|
|
366
377
|
}
|
|
367
378
|
interface ListenParameters {
|
|
368
379
|
onOpened?: () => void;
|
package/types/silentModeApi.d.ts
CHANGED
|
@@ -66,6 +66,23 @@ interface SilentModeInterval {
|
|
|
66
66
|
/** End time interval. */
|
|
67
67
|
endTime: Interval;
|
|
68
68
|
}
|
|
69
|
+
|
|
70
|
+
interface ConversationWithRemindType {
|
|
71
|
+
/** Conversation id. */
|
|
72
|
+
conversationId: string;
|
|
73
|
+
/** Conversation type. */
|
|
74
|
+
type: 'singleChat' | 'groupChat';
|
|
75
|
+
/** Silent mode type. */
|
|
76
|
+
remindType: SILENTMODETYPE;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
interface GetSilentModeRemindTypeConversationsResult {
|
|
80
|
+
/** The cursor that specifies where to start to get data. */
|
|
81
|
+
cursor: string;
|
|
82
|
+
/** conversations with remind type. */
|
|
83
|
+
conversations: ConversationWithRemindType[];
|
|
84
|
+
}
|
|
85
|
+
|
|
69
86
|
export declare type Interval = {
|
|
70
87
|
/** Hours. */
|
|
71
88
|
hours: number;
|
|
@@ -87,4 +104,6 @@ export type {
|
|
|
87
104
|
SilentModeRemindType,
|
|
88
105
|
SilentModeDuration,
|
|
89
106
|
SilentModeInterval,
|
|
107
|
+
GetSilentModeRemindTypeConversationsResult,
|
|
108
|
+
ConversationWithRemindType,
|
|
90
109
|
};
|