jiuyiUniapp/jiuyi/node_modules/easemob-websdk/thread/thread.js

1 line
10 KiB
JavaScript
Raw Normal View History

2024-12-18 15:46:27 +08:00
"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 T},createChatThread:function(){return d},destroyChatThread:function(){return l},getChatThreadDetail:function(){return j},getChatThreadLastMessage:function(){return g},getChatThreadMembers:function(){return f},getChatThreads:function(){return y},getJoinedChatThreads:function(){return I},joinChatThread:function(){return p},leaveChatThread:function(){return u},removeChatThreadMember:function(){return m}}),a(1539),a(8674),a(2526),a(1817),a(2165),a(6992),a(8783),a(3948),a(8309),a(2222),a(9554),a(4747),a(9753);var r=a(5531),n=a(7252),o=a(4024),c=a(3246),i=a(4363),s=function(e,t,a,r){return new(a||(a=Promise))((function(n,o){function c(e){try{s(r.next(e))}catch(e){o(e)}}function i(e){try{s(r.throw(e))}catch(e){o(e)}}function s(e){var t;e.done?n(e.value):(t=e.value,t instanceof a?t:new a((function(e){e(t)}))).then(c,i)}s((r=r.apply(e,t||[])).next())}))},h=function(e,t){var a,r,n,o,c={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:i(0),throw:i(1),return:i(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function i(o){return function(i){return function(o){if(a)throw new TypeError("Generator is already executing.");for(;c;)try{if(a=1,r&&(n=2&o[0]?r.return:o[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,o[1])).done)return n;switch(r=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return c.label++,{value:o[1],done:!1};case 5:c.label++,r=o[1],o=[0];continue;case 7:o=c.ops.pop(),c.trys.pop();continue;default:if(!((n=(n=c.trys).length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){c=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){c.label=o[1];break}if(6===o[0]&&c.label<n[1]){c.label=n[1],n=o;break}if(n&&c.label<n[2]){c.label=n[2],c.ops.push(o);break}n[2]&&c.ops.pop(),c.trys.pop();continue}o=t.call(e,c)}catch(e){o=[6,e],r=0}finally{a=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,i])}}};function d(e){if("string"!=typeof e.name||""===e.name)throw Error("Invalid parameter name: ".concat(e.name));if("string"!=typeof e.messageId||""===e.messageId)throw Error("Invalid parameter messageId: ".concat(e.messageId));if("string"!=typeof e.parentId||""===e.parentId)throw Error("Invalid parameter parentId: ".concat(e.parentId));if(!c.XZ.call(this)){var t=n.Z.create({type:r.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var a=this.context,i=a.orgName,s=a.appName,h=a.accessToken,d=a.jid,p={name:e.name,msg_id:e.messageId,group_id:e.parentId,owner:this.user},u={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(s,"/thread?resource=").concat(d.clientResource),type:"POST",dataType:"json",data:JSON.stringify(p),headers:{Authorization:"Bearer "+h,"Content-Type":"application/json"}};return o.hj.call(this,u).then((function(e){var t=e.data.thread_id;return e.data={chatThreadId:t},e}))}function p(e){if("string"!=typeof e.chatThreadId||""===e.chatThreadId)throw Error("Invalid parameter chatThreadId: ".concat(e.chatThreadId));if(!c.XZ.call(this)){var t=n.Z.create({type:r.E.REST_PARAMS_STATUS,message:"appkey or token error"});return Promise.reject(t)}var a=this.context,i=a.orgName,s=a.appName,h=a.accessToken,d=a.jid,p={url:"".concat(this.apiUrl,"/").concat(i,"/").concat(s,"/thread/").concat(e.chatThreadId,"/user/").concat(this.user,"/join?resource=").concat(d.clientResource),type:"POST",dataType:"json",headers:{Authorization:"Bearer "+h,"Content-Type":"application/json"}};return o.hj.call(this,p).then((function(e){var t=e.data.detail;return t.messageId=t.msgId,t.parentId=t.groupId,delete t.msgId,delete t.groupId,e}))}function u(e){return s(this,void 0,void 0,(function(){var t,a,i,s,d,p,u;return h(this,(function(h){switch(h.label){case 0:if("string"!=t