File manager - Edit - /home/c14075/dragmet-ural.ru/www/bitrix/js/im/v2/provider/pull/dist/registry.bundle.min.js
Back
this.BX=this.BX||{};this.BX.Messenger=this.BX.Messenger||{};this.BX.Messenger.v2=this.BX.Messenger.v2||{};this.BX.Messenger.v2.Provider=this.BX.Messenger.v2.Provider||{};(function(e,s,t,a,d,i,r){"use strict";class n{static create(e={}){return new this(e)}constructor(e={}){if(typeof e.controller==="object"&&e.controller){this.controller=e.controller}if(typeof e.store==="object"&&e.store){this.store=e.store}this.option=typeof e.store==="object"&&e.store?e.store:{};if(!(typeof this.option.handlingDialog==="object"&&this.option.handlingDialog&&this.option.handlingDialog.chatId&&this.option.handlingDialog.dialogId)){this.option.handlingDialog=false}}getModuleId(){return"im"}getSubscriptionType(){return s.PullClient.SubscriptionType.Server}skipExecute(e,s={}){if(!s.optionImportant){if(this.option.skip){i.Logger.info("Pull: command skipped while loading messages",e);return true}if(!this.option.handlingDialog){return false}}if(typeof e.chatId!=="undefined"||typeof e.dialogId!=="undefined"){if(typeof e.chatId!=="undefined"&&parseInt(e.chatId)===parseInt(this.option.handlingDialog.chatId)){return false}if(typeof e.dialogId!=="undefined"&&e.dialogId.toString()===this.option.handlingDialog.dialogId.toString()){return false}return true}return false}handleMessage(e,s){this.handleMessageAdd(e,s)}handleMessageChat(e,s){this.handleMessageAdd(e,s)}handleMessageAdd(e,s){i.Logger.warn("handleMessageAdd",e);if(this.skipExecute(e,s)){return false}if(e.lines){return false}let a=this.store.state.messages.collection[e.chatId];if(!a){a=[]}const n=a.find((s=>{if(e.message.templateId&&s.id===e.message.templateId){return true}return s.id===e.message.id}));if(n&&e.message.push){return false}if(e.chat&&e.chat[e.chatId]){const s=this.store.getters["dialogues/getByChatId"](e.chatId);if(!s){const s={...e.chat[e.chatId],dialogId:e.dialogId};this.store.dispatch("dialogues/set",s)}else{this.store.dispatch("dialogues/update",{dialogId:e.dialogId,fields:e.chat[e.chatId]})}}if(e.users){const{users:s,dialogues:t}=this.prepareUsersForModels(e.users);this.store.dispatch("dialogues/set",t);this.store.dispatch("users/set",s)}if(e.files){const s=t.BuilderModel.convertToArray(e.files);s.forEach((t=>{if(s.length===1&&e.message.templateFileId&&this.store.state.files.index[e.chatId]&&this.store.state.files.index[e.chatId][e.message.templateFileId]){this.store.dispatch("files/update",{id:e.message.templateFileId,chatId:e.chatId,fields:t}).then((()=>{d.EventEmitter.emit(r.EventType.dialog.scrollToBottom,{chatId:e.chatId,cancelIfScrollChange:true})}))}else{this.store.dispatch("files/set",t)}}))}if(n){i.Logger.warn("New message pull handler: we already have this message",e.message);this.store.dispatch("messages/update",{id:n.id,chatId:n.chatId,fields:{...e.message,sending:false,error:false}}).then((()=>{if(!e.message.push){d.EventEmitter.emit(r.EventType.dialog.scrollToBottom,{chatId:n.chatId,cancelIfScrollChange:e.message.senderId!==this.controller.getUserId()})}}))}else if(this.store.getters["dialogues/areUnreadMessagesLoaded"](e.dialogId)){i.Logger.warn("New message pull handler: we dont have this message",e.message);this.store.dispatch("messages/setAfter",{...e.message,unread:true}).then((()=>{if(!e.message.push){d.EventEmitter.emit(r.EventType.dialog.newMessage,{chatId:e.message.chatId,messageId:e.message.id})}}))}this.store.dispatch("dialogues/stopWriting",{dialogId:e.dialogId,userId:e.message.senderId});if(e.message.senderId===this.controller.getUserId()){if(this.store.state.dialogues.collection[e.dialogId]&&this.store.state.dialogues.collection[e.dialogId].counter!==0){this.controller.restClient.callMethod("im.dialog.read",{dialog_id:e.dialogId}).then((()=>{this.store.dispatch("messages/readMessages",{chatId:e.chatId}).then((s=>{d.EventEmitter.emit(r.EventType.dialog.scrollToBottom,{chatId:e.chatId,cancelIfScrollChange:false});this.store.dispatch("dialogues/update",{dialogId:e.dialogId,fields:{counter:0}})}))}))}}else if(e.message.senderId!==this.controller.getUserId()){this.store.dispatch("dialogues/update",{dialogId:e.dialogId,fields:{counter:e.counter}})}this.store.dispatch("dialogues/update",{dialogId:e.dialogId,fields:{lastMessageId:e.message.id}});this.store.dispatch("dialogues/increaseMessageCounter",{dialogId:e.dialogId,count:1})}handleMessageUpdate(e,s,t){this.execMessageUpdateOrDelete(e,s,t)}handleMessageDelete(e,s,t){this.execMessageUpdateOrDelete(e,s,t)}execMessageUpdateOrDelete(e,s,t){if(this.skipExecute(e,s)){return false}this.store.dispatch("dialogues/stopWriting",{dialogId:e.dialogId,userId:e.senderId});this.store.dispatch("messages/update",{id:e.id,chatId:e.chatId,fields:{text:t==="messageUpdate"?e.text:"",textOriginal:t==="messageUpdate"?e.textOriginal:"",params:e.params,blink:true}}).then((()=>{d.EventEmitter.emit(r.EventType.dialog.scrollToBottom,{chatId:e.chatId,cancelIfScrollChange:true})}))}handleMessageDeleteComplete(e,s){if(this.skipExecute(e,s)){return false}this.store.dispatch("messages/delete",{id:e.id,chatId:e.chatId});this.store.dispatch("dialogues/stopWriting",{dialogId:e.dialogId,userId:e.senderId})}handleMessageLike(e,s){if(this.skipExecute(e,s)){return false}this.store.dispatch("messages/update",{id:e.id,chatId:e.chatId,fields:{params:{LIKE:e.users}}})}handleChatOwner(e,s){if(this.skipExecute(e,s)){return false}this.store.dispatch("dialogues/update",{dialogId:e.dialogId,fields:{ownerId:e.userId}})}handleChatManagers(e,s){if(this.skipExecute(e,s)){return false}this.store.dispatch("dialogues/update",{dialogId:e.dialogId,fields:{managerList:e.list}})}handleChatUpdateParams(e,s){if(this.skipExecute(e,s)){return false}this.store.dispatch("dialogues/update",{dialogId:e.dialogId,fields:e.params})}handleChatUserAdd(e,s){if(this.skipExecute(e,s)){return false}if(e.users){const{users:s,dialogues:t}=this.prepareUsersForModels(e.users);this.store.dispatch("dialogues/set",t);this.store.dispatch("users/set",s)}this.store.dispatch("dialogues/update",{dialogId:e.dialogId,fields:{userCounter:e.userCount}})}handleChatUserLeave(e,s){this.handleChatUserAdd(e,s)}handleMessageParamsUpdate(e,s){if(this.skipExecute(e,s)){return false}this.store.dispatch("messages/update",{id:e.id,chatId:e.chatId,fields:{params:e.params}}).then((()=>{d.EventEmitter.emit(r.EventType.dialog.scrollToBottom,{chatId:e.chatId,cancelIfScrollChange:true})}))}handleStartWriting(e,s){if(this.skipExecute(e,s)){return false}const{dialogId:t,userId:a,userName:d}=e;this.store.dispatch("dialogues/startWriting",{dialogId:t,userId:a,userName:d})}handleReadMessage(e,s){if(this.skipExecute(e,s)){return false}this.store.dispatch("messages/readMessages",{chatId:e.chatId,readId:e.lastId}).then((()=>{this.store.dispatch("dialogues/update",{dialogId:e.dialogId,fields:{counter:e.counter}})}))}handleReadMessageChat(e,s){this.handleReadMessage(e,s)}handleReadMessageOpponent(e,s){this.execReadMessageOpponent(e,s)}handleReadMessageChatOpponent(e,s){this.execReadMessageOpponent(e,s)}execReadMessageOpponent(e,s){if(this.skipExecute(e,s)){return false}this.store.dispatch("dialogues/addToReadList",{dialogId:e.dialogId,userId:e.userId,userName:e.userName,messageId:e.lastId,date:e.date})}handleUnreadMessage(e,s){if(this.skipExecute(e,s)){return false}this.store.dispatch("dialogues/update",{dialogId:e.dialogId,fields:{counter:e.counter}})}handleUnreadMessageChat(e,s){this.handleUnreadMessage(e,s)}handleUnreadMessageOpponent(e,s){this.execUnreadMessageOpponent(e,s)}handleUnreadMessageChatOpponent(e,s){this.execUnreadMessageOpponent(e,s)}execUnreadMessageOpponent(e,s){if(this.skipExecute(e,s)){return false}this.store.dispatch("dialogues/removeFromReadList",{dialogId:e.dialogId,userId:e.userId})}handleFileUpload(e,s){if(this.skipExecute(e,s)){return false}this.store.dispatch("files/set",t.BuilderModel.convertToArray({file:e.fileParams})).then((()=>{d.EventEmitter.emit(r.EventType.dialog.scrollToBottom,{cancelIfScrollChange:true})}))}handleChatMuteNotify(e){if(e.muted){this.store.dispatch("dialogues/mute",{dialogId:e.dialogId});return true}this.store.dispatch("dialogues/unmute",{dialogId:e.dialogId})}handleUserInvite(e){if(!e.invited){this.store.dispatch("users/update",{id:e.userId,fields:e.user})}}handleChatRename(e){const s=this.store.getters["dialogues/getByChatId"](e.chatId);if(!s){return false}this.store.dispatch("dialogues/update",{dialogId:s.dialogId,fields:{name:e.name}})}handleChatAvatar(e){const s=this.store.getters["dialogues/getByChatId"](e.chatId);if(!s){return false}this.store.dispatch("dialogues/update",{dialogId:s.dialogId,fields:{avatar:e.avatar}})}prepareUsersForModels(e){const s=t.BuilderModel.convertToArray(e).map((e=>({dialogId:e.id,avatar:e.avatar,color:e.color,name:e.name,type:r.ChatTypes.user})));return{users:t.BuilderModel.convertToArray(e),dialogues:s}}}class o{static create(e={}){return new this(e)}getModuleId(){return"im"}constructor(e){this.controller=e.controller;this.store=e.store;this.application=e.application}handleMessage(e){this.handleMessageAdd(e)}handleMessageChat(e){this.handleMessageAdd(e)}handleMessageAdd(e){if(e.lines){return false}const s=this.store.state.application.common.userId;if(s&&e.userInChat[e.chatId]&&!e.userInChat[e.chatId].includes(s)){return false}i.Logger.warn("RecentPullHandler: handleMessageAdd",e);const t={id:e.dialogId,message:{id:e.message.id,text:e.message.textOriginal,date:e.message.date,senderId:e.message.senderId,withFile:!a.Type.isUndefined(e.message.params["FILE_ID"]),withAttach:!a.Type.isUndefined(e.message.params["ATTACH"])}};const d=this.store.getters["recent/get"](e.dialogId);if(d){t.options={birthdayPlaceholder:false};this.store.dispatch("recent/like",{id:e.dialogId,liked:false})}const{senderId:r}=e.message;const n=this.store.state.users;if(n!=null&&n.botList[r]&&n.botList[r].type==="human"){const{text:s}=e.message;setTimeout((()=>{this.store.dispatch("recent/set",t)}),this.getWaitTimeForHumanBot(s));return}this.store.dispatch("recent/set",t)}handleMessageUpdate(e,s,t){const d=this.store.getters["recent/get"](e.dialogId);if(!d||d.message.id!==e.id){return false}i.Logger.warn("RecentPullHandler: handleMessageUpdate",e,t);let r=e.textOriginal;if(t==="messageDelete"){r=a.Loc.getMessage("IM_PULL_RECENT_MESSAGE_DELETED")}this.store.dispatch("recent/update",{id:e.dialogId,fields:{message:{id:e.id,text:r,date:d.message.date,status:d.message.status,senderId:e.senderId}}})}handleMessageDelete(e,s,t){this.handleMessageUpdate(e,s,t)}handleReadMessageOpponent(e){i.Logger.warn("RecentPullHandler: handleReadMessageOpponent",e);const s=this.store.getters["recent/get"](e.dialogId);const t=Number.parseInt(e.lastId,10);if(!s||s.message.id!==t){return false}this.store.dispatch("recent/update",{id:e.dialogId,fields:{message:{...s.message,status:r.MessageStatus.delivered}}})}handleReadMessageChatOpponent(e){this.handleReadMessageOpponent(e)}handleUnreadMessageOpponent(e){i.Logger.warn("RecentPullHandler: handleUnreadMessageOpponent",e);const s=this.store.getters["recent/get"](e.dialogId);if(!s){return false}this.store.dispatch("recent/update",{id:e.dialogId,fields:{message:{...s.message,status:r.MessageStatus.received}}})}handleMessageLike(e){i.Logger.warn("RecentPullHandler: handleMessageLike",e);const s=this.store.getters["recent/get"](e.dialogId);if(!s){return false}const t=BX.MessengerProxy.getCurrentDialogId();if(t===e.dialogId){return false}const a=this.store.state.application.common.userId;const d=a===e.senderId;const r=s.message.senderId===a;if(d||!r){return false}this.store.dispatch("recent/like",{id:e.dialogId,messageId:e.id,liked:e.set})}handleChatPin(e){i.Logger.warn("RecentPullHandler: handleChatPin",e);const s=this.store.getters["recent/get"](e.dialogId);if(!s){return false}this.store.dispatch("recent/pin",{id:e.dialogId,action:e.active})}handleChatUnread(e){i.Logger.warn("RecentPullHandler: handleChatUnread",e);const s=this.store.getters["recent/get"](e.dialogId);if(!s){return false}this.store.dispatch("recent/unread",{id:e.dialogId,action:e.active})}handleChatHide(e){i.Logger.warn("RecentPullHandler: handleChatHide",e);const s=this.store.getters["recent/get"](e.dialogId);if(!s){return false}this.store.dispatch("recent/delete",{id:e.dialogId})}handleChatUserLeave(e){i.Logger.warn("RecentPullHandler: handleChatUserLeave",e);const s=this.store.getters["recent/get"](e.dialogId);if(!s){return false}const t=this.store.state.application.common.userId;if(t!==e.userId){return false}this.store.dispatch("recent/delete",{id:e.dialogId})}handleUserInvite(e){var s;i.Logger.warn("RecentPullHandler: handleUserInvite",e);this.store.dispatch("recent/set",{id:e.user.id,invited:(s=e.invited)!=null?s:false});this.store.dispatch("users/set",e.user);this.store.dispatch("dialogues/set",{dialogId:e.user.id,title:e.user.name,type:r.ChatTypes.user,avatar:e.user.avatar,color:e.user.color})}parseUserMention(e){const s=/\[user=(\d+)]\[\/user]/gi.exec(e);if(!s){return}const t=s[1];console.warn("FOUND USER MENTION",t);const a=this.store.getters["users/get"](t);if(!a){console.warn("NO SUCH USER, NEED REQUEST FOR -",t);d.EventEmitter.emit(r.EventType.recent.requestUser,{userId:t})}}getWaitTimeForHumanBot(e){const s=1e3;const t=300;const a=5e3;let d=e.split(" ").length*t+s;if(d>a){d=a}return d}}e.ImBasePullHandler=n;e.RecentPullHandler=o})(this.BX.Messenger.v2.Provider.Pull=this.BX.Messenger.v2.Provider.Pull||{},BX,BX.Vue3.Vuex,BX,BX.Event,BX.Messenger.v2.Lib,BX.Messenger.v2.Const); //# sourceMappingURL=registry.bundle.map.js
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.28 |
proxy
|
phpinfo
|
Settings