easemob-websdk 4.1.4-beta → 4.1.4-beta2
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 +118 -7
- package/Easemob-chat.js +1 -1
- package/chatroom/chatroom.js +1 -1
- package/contact/contact.js +1 -1
- package/group/group.d.ts +84 -6
- package/group/group.js +1 -1
- package/message/audio.d.ts +4 -0
- package/message/channel.d.ts +18 -0
- package/message/cmd.d.ts +4 -0
- package/message/custom.d.ts +4 -0
- package/message/delivery.d.ts +18 -0
- package/message/file.d.ts +4 -0
- package/message/img.d.ts +4 -0
- package/message/location.d.ts +4 -0
- package/message/read.d.ts +18 -0
- package/message/text.d.ts +4 -0
- package/message/video.d.ts +4 -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/readme.md +0 -4
- package/silent/silent.js +1 -1
- package/thread/thread.js +1 -1
- package/translation/translation.js +1 -1
- package/types/common.d.ts +2 -7
- package/types/engineCore.d.ts +40 -0
- package/types/error.d.ts +1 -1
- package/types/eventHandler.d.ts +169 -6
- package/types/groupApi.d.ts +56 -0
- package/types/message.ts +12 -0
- package/types/status.d.ts +331 -0
- package/uniApp/Easemob-chat.js +1 -1
- package/category/category.d.ts +0 -121
- package/category/category.js +0 -1
- package/channel/channel.d.ts +0 -346
- package/channel/channel.js +0 -1
- package/circleSdk/Easemob-chat.d.ts +0 -7899
- package/circleSdk/Easemob-chat.js +0 -1
- package/server/server.d.ts +0 -318
- package/server/server.js +0 -1
- package/types/categoryApi.d.ts +0 -50
- package/types/channelApi.d.ts +0 -162
- package/types/serverApi.d.ts +0 -123
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()}(this,(function(){return(this.webpackChunkwebsdk=this.webpackChunkwebsdk||[]).push([[962],{
|
|
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()}(this,(function(){return(this.webpackChunkwebsdk=this.webpackChunkwebsdk||[]).push([[962],{6369:function(e,r,t){t.r(r),t.d(r,{getPresenceStatus:function(){return y},getSubscribedPresenceList:function(){return f},getSubscribedPresencelist:function(){return d},publishPresence:function(){return l},subscribePresence:function(){return p},unsubscribePresence:function(){return h}}),t(900),t(3814),t(514),t(4201),t(6864),t(1685),t(2486),t(4261),t(7095),t(3529);var n=t(7551),s=t(1222),a=t(7480),o=t(3365),c=t(6916),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,h,f,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,h=t.userId,f=this.context.jid.clientResource,d={ext:e.description},y={url:"".concat(this.apiUrl,"/").concat(l,"/").concat(p,"/users/").concat(h,"/presence/").concat(f,"/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,h={usernames:e.usernames},f={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(u,"/users/").concat(l,"/presence/").concat(e.expiry),type:"POST",dataType:"json",data:JSON.stringify(h),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,f).then((function(e){return e.data={result:null==e?void 0:e.result},e}))}function h(e){return i(this,void 0,void 0,(function(){var r,t,i,l,p,h,f;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,h=t.accessToken,f={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(l,"/users/").concat(p,"/presence"),type:"DELETE",dataType:"json",data:JSON.stringify(e.usernames),headers:{Authorization:"Bearer "+h,"Content-Type":"application/json"},success:e.success,error:e.error},c.kg.debug("Call unsubscribePresence:",e),[4,n.hj.call(this,f)]):(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 f(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,h={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,h).then((function(e){return e.data={result:null==e?void 0:e.result},e}))}var d=f;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,h=i.accessToken,f={url:"".concat(this.apiUrl,"/").concat(u,"/").concat(l,"/users/").concat(p,"/presence"),type:"POST",dataType:"json",data:JSON.stringify(t),headers:{Authorization:"Bearer "+h,"Content-Type":"application/json"},success:e.success,error:e.error};return c.kg.debug("Call getPresenceStatus:",e),n.hj.call(this,f).then((function(e){return e.data={result:null==e?void 0:e.result},e}))}},1222:function(e,r,t){t.d(r,{H7:function(){return u},XZ:function(){return c},_W:function(){return i}}),t(3786),t(1362),t(900),t(7988),t(9889),t(6619);var n=t(3365),s=t(7480);function a(){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 o(){var e;if(!this.context.accessToken){var r=s.Z.create({type:n.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 c(){return o.call(this)&&a.call(this)}function i(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 u(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 6369,e(e.s=6369)}])}));
|
package/readme.md
CHANGED
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()}(this,(function(){return(this.webpackChunkwebsdk=this.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},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(4370),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,d=l.accessToken,f=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(f,"/").concat(h,"/users/").concat(m,"/notification/user/").concat(m),type:"PUT",dataType:"json",data:JSON.stringify(y),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,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,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 i.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:s.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="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(f,"/").concat(h,"/users/").concat(m,"/notification/").concat(y,"/").concat(e.conversationId),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 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,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:"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,f)}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,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 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,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 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,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 i.kg.debug("Call setPushPerformLanguage:",e),o.hj.call(this,f)}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,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 i.kg.debug("Call getPushPerformLanguage:",e),o.hj.call(this,d)}},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()}(this,(function(){return(this.webpackChunkwebsdk=this.webpackChunkwebsdk||[]).push([[883],{223: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},setPushPerformLanguage:function(){return h},setSilentModeForAll:function(){return c},setSilentModeForConversation:function(){return u}}),t(3786),t(900),t(3814),t(7095),t(3529),t(1362),t(7988),t(3535);var o=t(7551),n=t(1222),a=t(7480),s=t(3365),i=t(6916);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,d=l.accessToken,f=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(f,"/").concat(h,"/users/").concat(m,"/notification/user/").concat(m),type:"PUT",dataType:"json",data:JSON.stringify(y),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,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,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 i.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:s.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="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(f,"/").concat(h,"/users/").concat(m,"/notification/").concat(y,"/").concat(e.conversationId),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 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,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:"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,f)}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,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 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,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 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,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 i.kg.debug("Call setPushPerformLanguage:",e),o.hj.call(this,f)}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,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 i.kg.debug("Call getPushPerformLanguage:",e),o.hj.call(this,d)}},1222:function(e,r,t){t.d(r,{H7:function(){return p},XZ:function(){return i},_W:function(){return c}}),t(3786),t(1362),t(900),t(7988),t(9889),t(6619);var o=t(3365),n=t(7480);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 223,e(e.s=223)}])}));
|
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()}(this,(function(){return(this.webpackChunkwebsdk=this.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 E},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(4370),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){if(!Array.isArray(e.chatThreadIds))throw Error("Invalid parameter chatThreadIds: ".concat(e.chatThreadIds));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,d=a.appName,h=a.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 function(e){var t=e.entities;return null==t||t.forEach((function(e){e.chatThreadId=e.thread_id,e.last_message&&"{}"!==JSON.stringify(e.last_message)?e.lastMessage=(0,s.w)(e.last_message):e.lastMessage=e.last_message,delete e.thread_id,delete e.last_message})),e}(e)}))}function E(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()}(this,(function(){return(this.webpackChunkwebsdk=this.webpackChunkwebsdk||[]).push([[90],{318: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 E},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(900),a(3814),a(514),a(4201),a(6864),a(1685),a(2486),a(4261),a(8668),a(7095),a(1362),a(7988),a(3529);var r=a(3365),n=a(7480),o=a(7551),c=a(1222),s=a(2006),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){if(!Array.isArray(e.chatThreadIds))throw Error("Invalid parameter chatThreadIds: ".concat(e.chatThreadIds));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,d=a.appName,h=a.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 function(e){var t=e.entities;return null==t||t.forEach((function(e){e.chatThreadId=e.thread_id,e.last_message&&"{}"!==JSON.stringify(e.last_message)?e.lastMessage=(0,s.w)(e.last_message):e.lastMessage=e.last_message,delete e.thread_id,delete e.last_message})),e}(e)}))}function E(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}))}},1222:function(e,t,a){a.d(t,{H7:function(){return d},XZ:function(){return s},_W:function(){return i}}),a(3786),a(1362),a(900),a(7988),a(9889),a(6619);var r=a(3365),n=a(7480);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 318,e(e.s=318)}])}));
|
|
@@ -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()}(this,(function(){return(this.webpackChunkwebsdk=this.webpackChunkwebsdk||[]).push([[33],{
|
|
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()}(this,(function(){return(this.webpackChunkwebsdk=this.webpackChunkwebsdk||[]).push([[33],{606:function(e,t,r){r.r(t),r.d(t,{getSupportedLanguages:function(){return c},translateMessage:function(){return u}}),r(900),r(3814),r(7095),r(3529);var a=r(1222),s=r(3365),n=r(7480),o=r(6916),i=r(7551);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},h={url:p,dataType:"json",type:"POST",data:JSON.stringify(d),headers:{Authorization:"Bearer "+l}};return o.kg.debug("Call translateMessage"),i.hj.call(this,h)}},1222:function(e,t,r){r.d(t,{H7:function(){return u},XZ:function(){return i},_W:function(){return c}}),r(3786),r(1362),r(900),r(7988),r(9889),r(6619);var a=r(3365),s=r(7480);function n(){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 o(){var e;if(!this.context.accessToken){var t=s.Z.create({type:a.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 i(){return o.call(this)&&n.call(this)}function c(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 u(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 606,e(e.s=606)}])}));
|
package/types/common.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Code } from '
|
|
2
|
-
import ErrorEvent from '
|
|
1
|
+
import { Code } from './status';
|
|
2
|
+
import ErrorEvent from './error';
|
|
3
3
|
interface AsyncResult<T = any> {
|
|
4
4
|
/** Status of the request. */
|
|
5
5
|
type: Code;
|
|
@@ -45,10 +45,6 @@ interface EventData {
|
|
|
45
45
|
[key: string]: string;
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
|
-
interface OperationResult {
|
|
49
|
-
result: boolean;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
48
|
export type {
|
|
53
49
|
AsyncResult,
|
|
54
50
|
UserId,
|
|
@@ -57,5 +53,4 @@ export type {
|
|
|
57
53
|
ErrorEvent,
|
|
58
54
|
Jid,
|
|
59
55
|
EventData,
|
|
60
|
-
OperationResult,
|
|
61
56
|
};
|
package/types/engineCore.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { GroupId, UserId } from './common';
|
|
2
|
+
import { MemberAttributes } from './groupApi';
|
|
3
|
+
|
|
1
4
|
declare type OnPresenceMsgType =
|
|
2
5
|
| 'rmChatRoomMute'
|
|
3
6
|
| 'rmGroupMute'
|
|
@@ -69,15 +72,52 @@ declare type multiDeviceEventType =
|
|
|
69
72
|
| 'chatThreadLeave'
|
|
70
73
|
| 'chatThreadNameUpdate';
|
|
71
74
|
interface ThreadMultiDeviceInfo {
|
|
75
|
+
/** Event name of thread multi device event. */
|
|
72
76
|
operation: multiDeviceEventType;
|
|
77
|
+
/** The message thread ID. */
|
|
73
78
|
chatThreadId?: string;
|
|
79
|
+
/** The message thread name. */
|
|
74
80
|
chatThreadName?: string;
|
|
81
|
+
/** The ID of the parent message in the message thread. */
|
|
75
82
|
parentId?: string;
|
|
76
83
|
}
|
|
84
|
+
|
|
85
|
+
interface RoamingDeleteMultiDeviceInfo {
|
|
86
|
+
/** Event name of multi device event. */
|
|
87
|
+
operation: 'deleteRoaming';
|
|
88
|
+
/** The target user ID or group ID. */
|
|
89
|
+
conversationId: string;
|
|
90
|
+
/** The chat type. */
|
|
91
|
+
chatType: 'singleChat' | 'groupChat';
|
|
92
|
+
/** The client resource. */
|
|
93
|
+
resource: string;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
interface GroupMemberAttributesUpdateMultiDeviceInfo {
|
|
97
|
+
/**
|
|
98
|
+
* Custom attributes of a group member.
|
|
99
|
+
*/
|
|
100
|
+
attributes: MemberAttributes;
|
|
101
|
+
/** The user ID of the message sender. */
|
|
102
|
+
from: UserId;
|
|
103
|
+
/** The group ID. */
|
|
104
|
+
id: GroupId;
|
|
105
|
+
/** The name of the multi-device event. */
|
|
106
|
+
operation: 'memberAttributesUpdate';
|
|
107
|
+
/** The user ID of the group member whose custom attributes are set. */
|
|
108
|
+
userId: UserId;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
type MultiDeviceEvent =
|
|
112
|
+
| ThreadMultiDeviceInfo
|
|
113
|
+
| RoamingDeleteMultiDeviceInfo
|
|
114
|
+
| GroupMemberAttributesUpdateMultiDeviceInfo;
|
|
115
|
+
|
|
77
116
|
export type {
|
|
78
117
|
OnPresenceMsgType,
|
|
79
118
|
PresenceMsg,
|
|
80
119
|
SendMsgResult,
|
|
81
120
|
ThreadMultiDeviceInfo,
|
|
82
121
|
multiDeviceEventType,
|
|
122
|
+
MultiDeviceEvent,
|
|
83
123
|
};
|
package/types/error.d.ts
CHANGED
package/types/eventHandler.d.ts
CHANGED
|
@@ -13,13 +13,14 @@ import {
|
|
|
13
13
|
ReadMsgBody,
|
|
14
14
|
RecallMsgBody,
|
|
15
15
|
ContactMsgBody,
|
|
16
|
-
} from '
|
|
17
|
-
import { PresenceMsg,
|
|
16
|
+
} from '../types/message';
|
|
17
|
+
import { PresenceMsg, MultiDeviceEvent } from './engineCore';
|
|
18
18
|
import { ErrorEvent } from './error';
|
|
19
19
|
import { PresenceType } from './presenceApi';
|
|
20
20
|
import { ReactionMessage } from './reactionApi';
|
|
21
21
|
import { ThreadChangeInfo } from './threadApi';
|
|
22
22
|
import { EventData } from './common';
|
|
23
|
+
import { GroupModifyInfo } from './groupApi';
|
|
23
24
|
export declare type OnPresenceMsgType =
|
|
24
25
|
| 'rmChatRoomMute'
|
|
25
26
|
| 'rmGroupMute'
|
|
@@ -103,6 +104,7 @@ declare type Event =
|
|
|
103
104
|
| 'onTokenExpired'
|
|
104
105
|
| 'onContactInvited'
|
|
105
106
|
| 'onConnected'
|
|
107
|
+
| 'onReconnecting'
|
|
106
108
|
| 'onDisconnected'
|
|
107
109
|
| 'onGroupChange'
|
|
108
110
|
| 'onChatroomChange'
|
|
@@ -113,6 +115,133 @@ declare type Event =
|
|
|
113
115
|
| 'onMultiDeviceEvent'
|
|
114
116
|
| 'onGroupEvent'
|
|
115
117
|
| 'onChatroomEvent';
|
|
118
|
+
export interface ChatroomEvent {
|
|
119
|
+
/** The type of operation. <br/>
|
|
120
|
+
* destroy: Occurs when the chat room was destroyed.<br/>
|
|
121
|
+
* removeMember: Occurs when you are removed from a chat room or added to block list. Only the removed person receives this event.<br/>
|
|
122
|
+
* unblockMember: Occurs when being removed from the block list. Only the removed person receives this event.<br/>
|
|
123
|
+
* updateInfo: Occurs when modifying chat room. <br/>
|
|
124
|
+
* memberPresence: Occurs when someone joined the chat room. <br/>
|
|
125
|
+
* memberAbsence: Occurs when someone leaved the chat room. <br/>
|
|
126
|
+
* setAdmin: Occurs when being set as administrator. Only the person who is set to administrator can receive this event.<br/>
|
|
127
|
+
* removeAdmin: Occurs when you are removed as an administrator. Only the removed person can receive this event. <br/>
|
|
128
|
+
* muteMember: Occurs when you are muted. Only the person who is muted can receive this event. <br/>
|
|
129
|
+
* unmuteMember: Occurs when you are unmuted. Only the person who is unmuted can receive this event. <br/>
|
|
130
|
+
* updateAnnouncement: Occurs when the chat room announcement was updated. <br/>
|
|
131
|
+
* deleteAnnouncement: Occurs when the chat room announcement was deleted. <br/>
|
|
132
|
+
* uploadFile: Occurs when a shared file is uploaded. <br/>
|
|
133
|
+
* deleteFile: Occurs when a shared file is deleted. <br/>
|
|
134
|
+
* addUserToAllowlist: Occurs when being added to the allow list. <br/>
|
|
135
|
+
* removeAllowlistMember: Occurs when being removed from the allow list. <br/>
|
|
136
|
+
* muteAllMembers: Occurs when the chat room was set with a ban for all members. <br/>
|
|
137
|
+
* unmuteAllMembers: Occurs when the chat room lifted the ban. <br/>
|
|
138
|
+
* updateChatRoomAttributes: Occurs when the chat room attributes are updated. <br/>
|
|
139
|
+
* removeChatRoomAttributes: when the chat room attributes are deleted. <br/>
|
|
140
|
+
*/
|
|
141
|
+
operation:
|
|
142
|
+
| 'destroy'
|
|
143
|
+
| 'removeMember'
|
|
144
|
+
| 'unblockMember'
|
|
145
|
+
| 'updateInfo'
|
|
146
|
+
| 'memberPresence'
|
|
147
|
+
| 'memberAbsence'
|
|
148
|
+
| 'setAdmin'
|
|
149
|
+
| 'removeAdmin'
|
|
150
|
+
| 'muteMember'
|
|
151
|
+
| 'unmuteMember'
|
|
152
|
+
| 'updateAnnouncement'
|
|
153
|
+
| 'deleteAnnouncement'
|
|
154
|
+
| 'uploadFile'
|
|
155
|
+
| 'deleteFile'
|
|
156
|
+
| 'addUserToAllowlist'
|
|
157
|
+
| 'removeAllowlistMember'
|
|
158
|
+
| 'muteAllMembers'
|
|
159
|
+
| 'unmuteAllMembers'
|
|
160
|
+
| 'updateChatRoomAttributes'
|
|
161
|
+
| 'removeChatRoomAttributes';
|
|
162
|
+
/** The ID of a chatroom. */
|
|
163
|
+
id: string;
|
|
164
|
+
/** Message sender. */
|
|
165
|
+
from: string;
|
|
166
|
+
/** The name of a chatroom. */
|
|
167
|
+
name?: string;
|
|
168
|
+
/** ChatRoom Attributes. */
|
|
169
|
+
attributes?:
|
|
170
|
+
| Array<string>
|
|
171
|
+
| {
|
|
172
|
+
[key: string]: string;
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
export interface GroupEvent {
|
|
176
|
+
/** The type of operation. <br/>
|
|
177
|
+
* create: Occurs when the current user created a group on another device.<br/>
|
|
178
|
+
* destroy: Occurs when the group was destroyed.<br/>
|
|
179
|
+
* requestToJoin: Occurs when someone applied to join the group. Only the group owner and administrator will receive this event. <br/>
|
|
180
|
+
* acceptRequest: Occurs when your group adding application is approved. Only the person who applies for group will receive this event.<br/>
|
|
181
|
+
* joinPublicGroupDeclined: Occurs when your group adding application is refused. Only the person who applies for group will receive this event.<br/>
|
|
182
|
+
* inviteToJoin: Occurs when you receive an invitation to join a group. <br/>
|
|
183
|
+
* acceptInvite: Occurs when someone accepted your invitation to join the group. <br/>
|
|
184
|
+
* rejectInvite: Occurs when someone refused your invitation to join the group. <br/>
|
|
185
|
+
* removeMember: Occurs when you are removed from a group or added to block list. Only the removed person receives this event.<br/>
|
|
186
|
+
* unblockMember: Occurs when being removed from the block list. Only the removed person receives this event.<br/>
|
|
187
|
+
* updateInfo: Occurs when modifying group. <br/>
|
|
188
|
+
* memberPresence: Occurs when someone joined the group. <br/>
|
|
189
|
+
* memberAbsence: Occurs when someone leaved the group. <br/>
|
|
190
|
+
* directJoined: Occurs when you are directly pulled into the group and no consent is required. <br/>
|
|
191
|
+
* changeOwner: Occurs when transferring group. Only new and old group owners can receive this event. <br/>
|
|
192
|
+
* setAdmin: Occurs when being set as administrator. Only the person who is set to administrator can receive this event.<br/>
|
|
193
|
+
* removeAdmin: Occurs when you are removed as an administrator. Only the removed person can receive this event. <br/>
|
|
194
|
+
* muteMember: Occurs when you are muted. Only the person who is muted can receive this event. <br/>
|
|
195
|
+
* unmuteMember: Occurs when you are unmuted. Only the person who is unmuted can receive this event. <br/>
|
|
196
|
+
* updateAnnouncement: Occurs when the group announcement was updated. <br/>
|
|
197
|
+
* deleteAnnouncement: Occurs when the group announcement was deleted. <br/>
|
|
198
|
+
* uploadFile: Occurs when a shared file is uploaded. <br/>
|
|
199
|
+
* deleteFile: Occurs when a shared file is deleted. <br/>
|
|
200
|
+
* addUserToAllowlist: Occurs when being added to the allow list. <br/>
|
|
201
|
+
* removeAllowlistMember: Occurs when being removed from the allow list. <br/>
|
|
202
|
+
* muteAllMembers: Occurs when the group was set with a ban for all members. <br/>
|
|
203
|
+
* unmuteAllMembers: Occurs when the group lifted the ban. <br/>
|
|
204
|
+
* memberAttributesUpdate: Occurs when a custom attributes of a group member is updated. <br/>
|
|
205
|
+
*/
|
|
206
|
+
|
|
207
|
+
operation:
|
|
208
|
+
| 'create'
|
|
209
|
+
| 'destroy'
|
|
210
|
+
| 'requestToJoin'
|
|
211
|
+
| 'acceptRequest'
|
|
212
|
+
| 'joinPublicGroupDeclined'
|
|
213
|
+
| 'inviteToJoin'
|
|
214
|
+
| 'acceptInvite'
|
|
215
|
+
| 'rejectInvite'
|
|
216
|
+
| 'removeMember'
|
|
217
|
+
| 'unblockMember'
|
|
218
|
+
| 'updateInfo'
|
|
219
|
+
| 'memberPresence'
|
|
220
|
+
| 'memberAbsence'
|
|
221
|
+
| 'directJoined'
|
|
222
|
+
| 'changeOwner'
|
|
223
|
+
| 'setAdmin'
|
|
224
|
+
| 'removeAdmin'
|
|
225
|
+
| 'muteMember'
|
|
226
|
+
| 'unmuteMember'
|
|
227
|
+
| 'updateAnnouncement'
|
|
228
|
+
| 'deleteAnnouncement'
|
|
229
|
+
| 'uploadFile'
|
|
230
|
+
| 'deleteFile'
|
|
231
|
+
| 'addUserToAllowlist'
|
|
232
|
+
| 'removeAllowlistMember'
|
|
233
|
+
| 'muteAllMembers'
|
|
234
|
+
| 'unmuteAllMembers'
|
|
235
|
+
| 'memberAttributesUpdate';
|
|
236
|
+
/** The ID of a group. */
|
|
237
|
+
id: string;
|
|
238
|
+
/** Message sender. */
|
|
239
|
+
from: string;
|
|
240
|
+
/** The name of a group. */
|
|
241
|
+
name?: string;
|
|
242
|
+
/** The modified group info. */
|
|
243
|
+
detail?: GroupModifyInfo;
|
|
244
|
+
}
|
|
116
245
|
interface EventHandlerType {
|
|
117
246
|
/** The callback to receive a text message. */
|
|
118
247
|
onTextMessage?: (msg: TextMsgBody) => void;
|
|
@@ -164,6 +293,8 @@ interface EventHandlerType {
|
|
|
164
293
|
onContactInvited?: (msg: ContactMsgBody) => void;
|
|
165
294
|
/** The callback for successful connection. */
|
|
166
295
|
onConnected?: () => void;
|
|
296
|
+
/** The callback for reconnecting. */
|
|
297
|
+
onReconnecting?: () => void;
|
|
167
298
|
/** The callback for disconnected. */
|
|
168
299
|
onDisconnected?: () => void;
|
|
169
300
|
/** Occurs when the presence state of a subscribed user changes. */
|
|
@@ -173,13 +304,44 @@ interface EventHandlerType {
|
|
|
173
304
|
/** The callback to receive a reaction message. */
|
|
174
305
|
onReactionChange?: (msg: ReactionMessage) => void;
|
|
175
306
|
/** The callback to receive a multi device event. */
|
|
176
|
-
onMultiDeviceEvent?: (msg:
|
|
307
|
+
onMultiDeviceEvent?: (msg: MultiDeviceEvent) => void;
|
|
177
308
|
/** The callback to receive a group event. */
|
|
178
|
-
onGroupEvent?: (eventData:
|
|
309
|
+
onGroupEvent?: (eventData: GroupEvent) => void;
|
|
179
310
|
/** The callback to receive a chatroom event. */
|
|
180
|
-
onChatroomEvent?: (eventData:
|
|
311
|
+
onChatroomEvent?: (eventData: ChatroomEvent) => void;
|
|
312
|
+
}
|
|
313
|
+
interface ListenParameters {
|
|
314
|
+
onOpened?: () => void;
|
|
315
|
+
onPresence?: (msg: PresenceMsg) => void;
|
|
316
|
+
onTextMessage?: (msg: TextMsgBody) => void;
|
|
317
|
+
onPictureMessage?: (msg: ImgMsgBody) => void;
|
|
318
|
+
onAudioMessage?: (msg: AudioMsgBody) => void;
|
|
319
|
+
onVideoMessage?: (msg: VideoMsgBody) => void;
|
|
320
|
+
onFileMessage?: (msg: FileMsgBody) => void;
|
|
321
|
+
onLocationMessage?: (msg: LocationMsgBody) => void;
|
|
322
|
+
onCmdMessage?: (msg: CmdMsgBody) => void;
|
|
323
|
+
onCustomMessage?: (msg: CustomMsgBody) => void;
|
|
324
|
+
onReceivedMessage?: (msg: ReceivedMsgBody) => void;
|
|
325
|
+
onDeliveredMessage?: (msg: DeliveryMsgBody) => void;
|
|
326
|
+
onReadMessage?: (msg: ReadMsgBody) => void;
|
|
327
|
+
onRecallMessage?: (msg: RecallMsgBody) => void;
|
|
328
|
+
onChannelMessage?: (msg: ChannelMsgBody) => void;
|
|
329
|
+
onError?: (error: ErrorEvent) => void;
|
|
330
|
+
onOffline?: () => void;
|
|
331
|
+
onOnline?: () => void;
|
|
332
|
+
onStatisticMessage?: () => void;
|
|
333
|
+
onContactInvited?: (msg: ContactMsgBody) => void;
|
|
334
|
+
onContactAgreed?: (msg: ContactMsgBody) => void;
|
|
335
|
+
onContactRefuse?: (msg: ContactMsgBody) => void;
|
|
336
|
+
onContactDeleted?: (msg: ContactMsgBody) => void;
|
|
337
|
+
onContactAdded?: (msg: ContactMsgBody) => void;
|
|
338
|
+
onTokenWillExpire?: () => void;
|
|
339
|
+
onTokenExpired?: () => void;
|
|
340
|
+
onClosed?: () => void;
|
|
341
|
+
onPresenceStatusChange?: (msg: PresenceType[]) => void;
|
|
342
|
+
onGroupEvent?: (eventData: EventData) => void;
|
|
343
|
+
onChatroomEvent?: (eventData: ChatroomEvent) => void;
|
|
181
344
|
}
|
|
182
|
-
|
|
183
345
|
interface HandlerData {
|
|
184
346
|
[key: string]: EventHandlerType;
|
|
185
347
|
}
|
|
@@ -198,4 +360,5 @@ export type {
|
|
|
198
360
|
HandlerData,
|
|
199
361
|
EventHandler,
|
|
200
362
|
OnPresenceMsg,
|
|
363
|
+
ListenParameters,
|
|
201
364
|
};
|
package/types/groupApi.d.ts
CHANGED
|
@@ -124,6 +124,30 @@ interface InviteUsersToGroupResult {
|
|
|
124
124
|
/** The invitee ID. */
|
|
125
125
|
user: UserId;
|
|
126
126
|
}
|
|
127
|
+
|
|
128
|
+
interface GroupInfo {
|
|
129
|
+
/** The number of existing members. */
|
|
130
|
+
affiliationsCount?: number;
|
|
131
|
+
/** The group name. */
|
|
132
|
+
groupName: string;
|
|
133
|
+
/** The group ID. */
|
|
134
|
+
groupId: string;
|
|
135
|
+
/** The current user role in the group. */
|
|
136
|
+
role?: 'member' | 'admin' | 'owner';
|
|
137
|
+
/** Whether the group disabled. */
|
|
138
|
+
disabled: boolean;
|
|
139
|
+
/** Whether a user requires the approval from the group owner or admin to join the group. -`true`: Yes; -`false`: No. */
|
|
140
|
+
approval: boolean;
|
|
141
|
+
/** Whether to allow group members to invite others to join the group. */
|
|
142
|
+
allowInvites: boolean;
|
|
143
|
+
/** The group description. */
|
|
144
|
+
description: string;
|
|
145
|
+
/** The maximum number of group members. */
|
|
146
|
+
maxUsers: number;
|
|
147
|
+
/** Whether it is a public group. */
|
|
148
|
+
public: boolean;
|
|
149
|
+
}
|
|
150
|
+
|
|
127
151
|
interface RemoveGroupMemberResult {
|
|
128
152
|
/** The action. */
|
|
129
153
|
action: 'remove_member';
|
|
@@ -210,6 +234,34 @@ interface FetchGroupSharedFileListResult {
|
|
|
210
234
|
/** The Unix timestamp when the file is uploaded.*/
|
|
211
235
|
created: number;
|
|
212
236
|
}
|
|
237
|
+
interface GroupModifyInfo {
|
|
238
|
+
/** The name of a group. */
|
|
239
|
+
name?: string;
|
|
240
|
+
/** The description of a group. */
|
|
241
|
+
description?: string;
|
|
242
|
+
/** Whether it is a public group. -`true`: Yes; -`false`: No. Public group: the group that others can query by calling `listgroups`. */
|
|
243
|
+
public?: boolean;
|
|
244
|
+
/** Whether a user requires the approval from the group owner or admin to join the group. -`true`: Yes; -`false`: No. */
|
|
245
|
+
approval?: boolean;
|
|
246
|
+
/** Whether to allow group members to invite others to join the group. */
|
|
247
|
+
allowInvites?: boolean;
|
|
248
|
+
/** The maximum number of group members */
|
|
249
|
+
maxUsers?: number;
|
|
250
|
+
/** Whether the invitee needs to accept the invitation before joining the group.
|
|
251
|
+
- `true`: The invitee's consent is required. The default value is `true`.
|
|
252
|
+
- `false`: The invitee will be directly added to the group without confirmation.
|
|
253
|
+
*/
|
|
254
|
+
inviteNeedConfirm?: boolean;
|
|
255
|
+
/** Group detail extensions. */
|
|
256
|
+
ext?: string;
|
|
257
|
+
/** Last Modified Timestamp. */
|
|
258
|
+
lastModified?: number;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
type MemberAttributes = Record<string, string>;
|
|
262
|
+
|
|
263
|
+
type GetGroupMembersAttributesResult = Record<UserId, MemberAttributes>;
|
|
264
|
+
|
|
213
265
|
export type {
|
|
214
266
|
GroupRequestResult,
|
|
215
267
|
BaseGroupInfo,
|
|
@@ -232,4 +284,8 @@ export type {
|
|
|
232
284
|
UpdateGroupAnnouncementResult,
|
|
233
285
|
DeleteGroupSharedFileResult,
|
|
234
286
|
FetchGroupSharedFileListResult,
|
|
287
|
+
GroupInfo,
|
|
288
|
+
GroupModifyInfo,
|
|
289
|
+
MemberAttributes,
|
|
290
|
+
GetGroupMembersAttributesResult,
|
|
235
291
|
};
|