Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/im/provider/pull/dist/ |
Upload File : |
this.BX=this.BX||{};this.BX.Messenger=this.BX.Messenger||{};this.BX.Messenger.Provider=this.BX.Messenger.Provider||{};(function(e,t,s,i,a,r){"use strict";function n(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.push.apply(s,i)}return s}function o(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?n(Object(s),!0).forEach((function(t){babelHelpers.defineProperty(e,t,s[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):n(Object(s)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}))}return e}var l=function(){babelHelpers.createClass(e,null,[{key:"create",value:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return new this(t)}}]);function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};babelHelpers.classCallCheck(this,e);if(babelHelpers["typeof"](t.controller)==="object"&&t.controller){this.controller=t.controller}if(babelHelpers["typeof"](t.store)==="object"&&t.store){this.store=t.store}this.option=babelHelpers["typeof"](t.store)==="object"&&t.store?t.store:{};if(!(babelHelpers["typeof"](this.option.handlingDialog)==="object"&&this.option.handlingDialog&&this.option.handlingDialog.chatId&&this.option.handlingDialog.dialogId)){this.option.handlingDialog=false}}babelHelpers.createClass(e,[{key:"getModuleId",value:function e(){return"im"}},{key:"getSubscriptionType",value:function e(){return r.PullClient.SubscriptionType.Server}},{key:"skipExecute",value:function e(t){var s=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};if(!s.optionImportant){if(this.option.skip){i.Logger.info("Pull: command skipped while loading messages",t);return true}if(!this.option.handlingDialog){return false}}if(typeof t.chatId!=="undefined"||typeof t.dialogId!=="undefined"){if(typeof t.chatId!=="undefined"&&parseInt(t.chatId)===parseInt(this.option.handlingDialog.chatId)){return false}if(typeof t.dialogId!=="undefined"&&t.dialogId.toString()===this.option.handlingDialog.dialogId.toString()){return false}return true}return false}},{key:"handleMessage",value:function e(t,s){this.handleMessageAdd(t,s)}},{key:"handleMessageChat",value:function e(t,s){this.handleMessageAdd(t,s)}},{key:"handleMessageAdd",value:function e(r,n){var l=this;i.Logger.warn("handleMessageAdd",r);if(this.skipExecute(r,n)){return false}var d=this.store.state.messages.collection[r.chatId];if(!d){d=[]}var c=d.find((function(e){if(r.message.templateId&&e.id===r.message.templateId){return true}return e.id===r.message.id}));if(c&&r.message.push){return false}if(r.chat&&r.chat[r.chatId]){var u=this.store.getters["dialogues/getByChatId"](r.chatId);if(!u){var h=Object.assign({},r.chat[r.chatId],{dialogId:r.dialogId});this.store.dispatch("dialogues/set",h)}else{this.store.dispatch("dialogues/update",{dialogId:r.dialogId,fields:r.chat[r.chatId]})}}if(r.users){this.store.dispatch("users/set",t.VuexBuilderModel.convertToArray(r.users))}if(r.files){var f=this.controller.application.prepareFilesBeforeSave(t.VuexBuilderModel.convertToArray(r.files));f.forEach((function(e){if(f.length===1&&r.message.templateFileId&&l.store.state.files.index[r.chatId]&&l.store.state.files.index[r.chatId][r.message.templateFileId]){l.store.dispatch("files/update",{id:r.message.templateFileId,chatId:r.chatId,fields:e}).then((function(){a.EventEmitter.emit(s.EventType.dialog.scrollToBottom,{chatId:r.chatId,cancelIfScrollChange:true})}))}else{l.store.dispatch("files/set",e)}}))}if(c){i.Logger.warn("New message pull handler: we already have this message",r.message);this.store.dispatch("messages/update",{id:c.id,chatId:c.chatId,fields:o(o({},r.message),{},{sending:false,error:false})}).then((function(){if(!r.message.push){a.EventEmitter.emit(s.EventType.dialog.scrollToBottom,{chatId:c.chatId,cancelIfScrollChange:r.message.senderId!==l.controller.application.getUserId()})}}))}else if(this.controller.application.isUnreadMessagesLoaded()){i.Logger.warn("New message pull handler: we dont have this message",r.message);this.store.dispatch("messages/setAfter",o(o({},r.message),{},{unread:true})).then((function(){if(!r.message.push){a.EventEmitter.emit(s.EventType.dialog.newMessage,{chatId:r.message.chatId,messageId:r.message.id})}}))}this.controller.application.stopOpponentWriting({dialogId:r.dialogId,userId:r.message.senderId});if(r.message.senderId===this.controller.application.getUserId()){if(this.store.state.dialogues.collection[r.dialogId]&&this.store.state.dialogues.collection[r.dialogId].counter!==0){this.controller.restClient.callMethod("im.dialog.read",{dialog_id:r.dialogId}).then((function(){l.store.dispatch("messages/readMessages",{chatId:r.chatId}).then((function(e){a.EventEmitter.emit(s.EventType.dialog.scrollToBottom,{chatId:r.chatId,cancelIfScrollChange:false});l.store.dispatch("dialogues/update",{dialogId:r.dialogId,fields:{counter:0}})}))}))}}else if(r.message.senderId!==this.controller.application.getUserId()){this.store.dispatch("dialogues/increaseCounter",{dialogId:r.dialogId,count:1})}this.store.dispatch("dialogues/update",{dialogId:r.dialogId,fields:{lastMessageId:r.message.id}});this.store.dispatch("dialogues/increaseMessageCounter",{dialogId:r.dialogId,count:1})}},{key:"handleMessageUpdate",value:function e(t,s,i){this.execMessageUpdateOrDelete(t,s,i)}},{key:"handleMessageDelete",value:function e(t,s,i){this.execMessageUpdateOrDelete(t,s,i)}},{key:"execMessageUpdateOrDelete",value:function e(t,i,r){if(this.skipExecute(t,i)){return false}this.controller.application.stopOpponentWriting({dialogId:t.dialogId,userId:t.senderId});var n={params:t.params,blink:true};if(r==="messageUpdate"){if(typeof t.textLegacy!=="undefined"){n.textLegacy=t.textLegacy}if(typeof t.text!=="undefined"){n.text=t.text}}this.store.dispatch("messages/update",{id:t.id,chatId:t.chatId,fields:n}).then((function(){a.EventEmitter.emit(s.EventType.dialog.scrollToBottom,{chatId:t.chatId,cancelIfScrollChange:true})}))}},{key:"handleMessageDeleteComplete",value:function e(t,s){if(this.skipExecute(t,s)){return false}this.store.dispatch("messages/delete",{id:t.id,chatId:t.chatId});this.controller.application.stopOpponentWriting({dialogId:t.dialogId,userId:t.senderId,action:false})}},{key:"handleMessageLike",value:function e(t,s){if(this.skipExecute(t,s)){return false}this.store.dispatch("messages/update",{id:t.id,chatId:t.chatId,fields:{params:{LIKE:t.users}}})}},{key:"handleChatOwner",value:function e(t,s){if(this.skipExecute(t,s)){return false}this.store.dispatch("dialogues/update",{dialogId:t.dialogId,fields:{ownerId:t.userId}})}},{key:"handleChatManagers",value:function e(t,s){if(this.skipExecute(t,s)){return false}this.store.dispatch("dialogues/update",{dialogId:t.dialogId,fields:{managerList:t.list}})}},{key:"handleChatUpdateParams",value:function e(t,s){if(this.skipExecute(t,s)){return false}this.store.dispatch("dialogues/update",{dialogId:t.dialogId,fields:t.params})}},{key:"handleChatUserAdd",value:function e(t,s){if(this.skipExecute(t,s)){return false}this.store.dispatch("dialogues/update",{dialogId:t.dialogId,fields:{userCounter:t.userCount}})}},{key:"handleChatUserLeave",value:function e(t,s){if(this.skipExecute(t,s)){return false}this.store.dispatch("dialogues/update",{dialogId:t.dialogId,fields:{userCounter:t.userCount}})}},{key:"handleMessageParamsUpdate",value:function e(t,i){if(this.skipExecute(t,i)){return false}this.store.dispatch("messages/update",{id:t.id,chatId:t.chatId,fields:{params:t.params}}).then((function(){a.EventEmitter.emit(s.EventType.dialog.scrollToBottom,{chatId:t.chatId,cancelIfScrollChange:true})}))}},{key:"handleStartWriting",value:function e(t,s){if(this.skipExecute(t,s)){return false}this.controller.application.startOpponentWriting(t)}},{key:"handleReadMessage",value:function e(t,s){var i=this;if(this.skipExecute(t,s)){return false}this.store.dispatch("messages/readMessages",{chatId:t.chatId,readId:t.lastId}).then((function(e){i.store.dispatch("dialogues/update",{dialogId:t.dialogId,fields:{counter:t.counter}})}))}},{key:"handleReadMessageChat",value:function e(t,s){this.handleReadMessage(t,s)}},{key:"handleReadMessageOpponent",value:function e(t,s){this.execReadMessageOpponent(t,s)}},{key:"handleReadMessageChatOpponent",value:function e(t,s){this.execReadMessageOpponent(t,s)}},{key:"execReadMessageOpponent",value:function e(t,s){if(this.skipExecute(t,s)){return false}this.store.dispatch("dialogues/updateReaded",{dialogId:t.dialogId,userId:t.userId,userName:t.userName,messageId:t.lastId,date:t.date,action:true})}},{key:"handleUnreadMessageOpponent",value:function e(t,s){this.execUnreadMessageOpponent(t,s)}},{key:"handleUnreadMessageChatOpponent",value:function e(t,s){this.execUnreadMessageOpponent(t,s)}},{key:"execUnreadMessageOpponent",value:function e(t,s){if(this.skipExecute(t,s)){return false}this.store.dispatch("dialogues/updateReaded",{dialogId:t.dialogId,userId:t.userId,action:false})}},{key:"handleFileUpload",value:function e(i,r){if(this.skipExecute(i,r)){return false}this.store.dispatch("files/set",this.controller.application.prepareFilesBeforeSave(t.VuexBuilderModel.convertToArray({file:i.fileParams}))).then((function(){a.EventEmitter.emit(s.EventType.dialog.scrollToBottom,{cancelIfScrollChange:true})}))}},{key:"handleChatMuteNotify",value:function e(t,s){var i=this.store.getters["dialogues/get"](t.dialogId);if(!i){return false}var a=i.muteList;var r=[];var n=this.store.state.application.common.userId;if(t.mute){r=[].concat(babelHelpers.toConsumableArray(a),[n])}else{r=a.filter((function(e){return e!==n}))}this.store.dispatch("dialogues/update",{dialogId:t.dialogId,fields:{muteList:r}})}},{key:"handleUserInvite",value:function e(t,s){if(!t.invited){this.store.dispatch("users/update",{id:t.userId,fields:t.user})}}}]);return e}();function d(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.push.apply(s,i)}return s}function c(e){for(var t=1;t<arguments.length;t++){var s=null!=arguments[t]?arguments[t]:{};t%2?d(Object(s),!0).forEach((function(t){babelHelpers.defineProperty(e,t,s[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):d(Object(s)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,t))}))}return e}var u=function(){babelHelpers.createClass(e,null,[{key:"create",value:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return new this(t)}}]);function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};babelHelpers.classCallCheck(this,e);if(babelHelpers["typeof"](t.application)==="object"&&t.application){this.application=t.application}if(babelHelpers["typeof"](t.controller)==="object"&&t.controller){this.controller=t.controller}if(babelHelpers["typeof"](t.store)==="object"&&t.store){this.store=t.store}this.option=babelHelpers["typeof"](t.store)==="object"&&t.store?t.store:{}}babelHelpers.createClass(e,[{key:"getModuleId",value:function e(){return"im"}},{key:"getSubscriptionType",value:function e(){return r.PullClient.SubscriptionType.Server}},{key:"handleChatUserAdd",value:function e(t){if(t.dialogId!==this.store.state.application.dialog.dialogId){return false}var s=Object.values(t.users).map((function(e){return c(c({},e),{},{lastActivityDate:new Date})}));this.store.commit("conference/common",{userCount:t.userCount});this.store.dispatch("users/set",s);this.store.dispatch("conference/setUsers",{users:s.map((function(e){return e.id}))})}},{key:"handleChatUserLeave",value:function e(t){if(t.dialogId!==this.store.state.application.dialog.dialogId){return false}if(t.userId===this.controller.getUserId()){this.application.kickFromCall()}this.store.commit("conference/common",{userCount:t.userCount});this.store.dispatch("conference/removeUsers",{users:[t.userId]})}},{key:"handleCallUserNameUpdate",value:function e(t){var s=this.store.getters["users/get"](t.userId);if(!s){this.store.dispatch("users/set",{id:t.userId,lastActivityDate:new Date})}this.store.dispatch("users/update",{id:t.userId,fields:{name:t.name,lastActivityDate:new Date}})}},{key:"handleVideoconfShareUpdate",value:function e(t){if(t.dialogId===this.store.state.application.dialog.dialogId){this.store.dispatch("dialogues/update",{dialogId:t.dialogId,fields:{public:{code:t.newCode,link:t.newLink}}});this.application.changeVideoconfUrl(t.newLink)}}},{key:"handleMessageChat",value:function e(t){this.application.sendNewMessageNotify(t)}},{key:"handleChatRename",value:function e(t){if(t.chatId!==this.application.getChatId()){return false}this.store.dispatch("conference/setConferenceTitle",{conferenceTitle:t.name})}},{key:"handleConferenceUpdate",value:function e(t){if(t.chatId!==this.application.getChatId()){return false}if(t.isBroadcast!==""){this.store.dispatch("conference/setBroadcastMode",{broadcastMode:t.isBroadcast})}if(t.presenters.length>0){this.store.dispatch("conference/setPresenters",{presenters:t.presenters,replace:true})}}}]);return e}();function h(e,t){var s=typeof Symbol!=="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(!s){if(Array.isArray(e)||(s=f(e))||t&&e&&typeof e.length==="number"){if(s)e=s;var i=0;var a=function e(){};return{s:a,n:function t(){if(i>=e.length)return{done:true};return{done:false,value:e[i++]}},e:function e(t){throw t},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var r=true,n=false,o;return{s:function t(){s=s.call(e)},n:function e(){var t=s.next();r=t.done;return t},e:function e(t){n=true;o=t},f:function e(){try{if(!r&&s["return"]!=null)s["return"]()}finally{if(n)throw o}}}}function f(e,t){if(!e)return;if(typeof e==="string")return p(e,t);var s=Object.prototype.toString.call(e).slice(8,-1);if(s==="Object"&&e.constructor)s=e.constructor.name;if(s==="Map"||s==="Set")return Array.from(e);if(s==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s))return p(e,t)}function p(e,t){if(t==null||t>e.length)t=e.length;for(var s=0,i=new Array(t);s<t;s++)i[s]=e[s];return i}var g=function(){babelHelpers.createClass(e,null,[{key:"create",value:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};return new this(t)}}]);function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};babelHelpers.classCallCheck(this,e);if(babelHelpers["typeof"](t.application)==="object"&&t.application){this.application=t.application}if(babelHelpers["typeof"](t.controller)==="object"&&t.controller){this.controller=t.controller}if(babelHelpers["typeof"](t.store)==="object"&&t.store){this.store=t.store}this.option=babelHelpers["typeof"](t.store)==="object"&&t.store?t.store:{}}babelHelpers.createClass(e,[{key:"getModuleId",value:function e(){return"im"}},{key:"getSubscriptionType",value:function e(){return r.PullClient.SubscriptionType.Server}},{key:"handleNotifyAdd",value:function e(t,s){if(s.server_time_ago>30||t.onlyFlash===true){return false}var i=this.store.getters["users/get"](t.userId);if(!i){var a=[];a.push({id:t.userId,avatar:t.userAvatar,color:t.userColor,name:t.userName});this.store.dispatch("users/set",a)}this.store.dispatch("notifications/add",{data:t});this.store.dispatch("notifications/setCounter",{unreadTotal:t.counter});this.store.dispatch("recent/update",{id:"notify",fields:{message:{id:t.id,text:t.text,date:t.date},counter:t.counter}})}},{key:"handleNotifyReadAll",value:function e(t){this.store.dispatch("notifications/readAll");this.store.dispatch("notifications/setCounter",{unreadTotal:0});this.store.dispatch("recent/update",{id:"notify",fields:{counter:0}})}},{key:"handleNotifyConfirm",value:function e(t,s){if(s.server_time_ago>30){return false}this.store.dispatch("notifications/delete",{id:t.id});this.store.dispatch("notifications/setCounter",{unreadTotal:t.counter});this.updateRecentListOnDelete(t.counter)}},{key:"handleNotifyRead",value:function e(t,s){var i=this;if(s.server_time_ago>30){return false}t.list.forEach((function(e){i.store.dispatch("notifications/read",{ids:[e],action:true})}));this.store.dispatch("notifications/setCounter",{unreadTotal:t.counter});this.store.dispatch("recent/update",{id:"notify",fields:{counter:t.counter}})}},{key:"handleNotifyUnread",value:function e(t,s){var i=this;if(s.server_time_ago>30){return false}t.list.forEach((function(e){i.store.dispatch("notifications/read",{ids:[e],action:false})}));this.store.dispatch("notifications/setCounter",{unreadTotal:t.counter});this.store.dispatch("recent/update",{id:"notify",fields:{counter:t.counter}})}},{key:"handleNotifyDelete",value:function e(t,s){var i=this;if(s.server_time_ago>30){return false}var a=Object.keys(t.id).map((function(e){return parseInt(e,10)}));a.forEach((function(e){i.store.dispatch("notifications/delete",{id:e})}));this.updateRecentListOnDelete(t.counter);this.store.dispatch("notifications/setCounter",{unreadTotal:t.counter})}},{key:"updateRecentListOnDelete",value:function e(t){var s;var i=this.getLatest();if(i!==null){s={id:i.id,text:i.text,date:i.date}}else{var a=this.store.getters["recent/get"]("notify");if(a===false){return}s=a.element.message;s.text=this.controller.localize["IM_NOTIFICATIONS_DELETED_ITEM_STUB"]}this.store.dispatch("recent/update",{id:"notify",fields:{message:s,counter:t}})}},{key:"getLatest",value:function e(){var t={id:0};var s=h(this.store.state.notifications.collection),i;try{for(s.s();!(i=s.n()).done;){var a=i.value;if(a.id>t.id){t=a}}}catch(e){s.e(e)}finally{s.f()}if(t.id===0){return null}return t}}]);return e}(); /** * Bitrix Messenger * Bundle pull command handlers * * @package bitrix * @subpackage im * @copyright 2001-2019 Bitrix */e.ImBasePullHandler=l;e.ImCallPullHandler=u;e.ImNotificationsPullHandler=g})(this.BX.Messenger.Provider.Pull=this.BX.Messenger.Provider.Pull||{},BX,BX.Messenger.Const,BX.Messenger.Lib,BX.Event,BX); //# sourceMappingURL=registry.bundle.map.js