1 line
12 KiB
JavaScript
1 line
12 KiB
JavaScript
|
!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.chatT
|