This commit is contained in:
root
2025-11-13 19:04:05 +03:00
commit 240d0aba5f
75129 changed files with 11118122 additions and 0 deletions

View File

@@ -0,0 +1,123 @@
/* eslint-disable */
this.BX = this.BX || {};
(function (exports,main_core,main_core_events,ui_vue3_vuex,im_v2_const,im_v2_application_core,vote_store_vote,vote_provider_pull) {
'use strict';
const VOTES_COUNT_TO_LOAD = 50;
var _visibleVotes = /*#__PURE__*/babelHelpers.classPrivateFieldLooseKey("visibleVotes");
var _shouldLoadVotes = /*#__PURE__*/babelHelpers.classPrivateFieldLooseKey("shouldLoadVotes");
var _startIndexToLoadVotes = /*#__PURE__*/babelHelpers.classPrivateFieldLooseKey("startIndexToLoadVotes");
var _subscribeOnEvents = /*#__PURE__*/babelHelpers.classPrivateFieldLooseKey("subscribeOnEvents");
var _onMessageIsVisible = /*#__PURE__*/babelHelpers.classPrivateFieldLooseKey("onMessageIsVisible");
var _prepareToLoadVotes = /*#__PURE__*/babelHelpers.classPrivateFieldLooseKey("prepareToLoadVotes");
class VoteApplication extends main_core_events.EventEmitter {
static init() {
return VoteApplication.getInstance();
}
static getInstance() {
if (!VoteApplication.instance) {
VoteApplication.instance = new VoteApplication();
}
return VoteApplication.instance;
}
constructor() {
super();
Object.defineProperty(this, _prepareToLoadVotes, {
value: _prepareToLoadVotes2
});
Object.defineProperty(this, _onMessageIsVisible, {
value: _onMessageIsVisible2
});
Object.defineProperty(this, _subscribeOnEvents, {
value: _subscribeOnEvents2
});
Object.defineProperty(this, _visibleVotes, {
writable: true,
value: []
});
Object.defineProperty(this, _shouldLoadVotes, {
writable: true,
value: true
});
Object.defineProperty(this, _startIndexToLoadVotes, {
writable: true,
value: 0
});
this.setEventNamespace('BX.VOTE.APPLICATION');
this.createStore();
this.initPull();
babelHelpers.classPrivateFieldLooseBase(this, _subscribeOnEvents)[_subscribeOnEvents]();
}
handleLoadError(entityIds) {
babelHelpers.classPrivateFieldLooseBase(this, _visibleVotes)[_visibleVotes] = babelHelpers.classPrivateFieldLooseBase(this, _visibleVotes)[_visibleVotes].filter(id => !entityIds.includes(id));
babelHelpers.classPrivateFieldLooseBase(this, _startIndexToLoadVotes)[_startIndexToLoadVotes] = 0;
}
createStore() {
this.store = ui_vue3_vuex.createStore({
modules: {
vote: {
namespaced: true,
...vote_store_vote.VoteModel
}
}
});
}
getStore() {
return this.store;
}
initPull() {
this.pullClient = BX.PULL;
if (!this.pullClient) {
return;
}
this.pullClient.subscribe(new vote_provider_pull.VotePullHandler({
store: this.store
}));
}
static canCreateVoteInChat(currentChatType) {
const availableChatTypes = [im_v2_const.ChatType.chat, im_v2_const.ChatType.open, im_v2_const.ChatType.general, im_v2_const.ChatType.call, im_v2_const.ChatType.crm, im_v2_const.ChatType.sonetGroup, im_v2_const.ChatType.calendar, im_v2_const.ChatType.tasks, im_v2_const.ChatType.mail, im_v2_const.ChatType.generalChannel, im_v2_const.ChatType.channel, im_v2_const.ChatType.openChannel, im_v2_const.ChatType.collab];
return availableChatTypes.includes(currentChatType);
}
}
function _subscribeOnEvents2() {
main_core_events.EventEmitter.subscribe('vote-message-batch', babelHelpers.classPrivateFieldLooseBase(this, _onMessageIsVisible)[_onMessageIsVisible].bind(this));
}
function _onMessageIsVisible2(event) {
const {
messageId
} = event.getData();
if (babelHelpers.classPrivateFieldLooseBase(this, _visibleVotes)[_visibleVotes].includes(messageId)) {
return;
}
babelHelpers.classPrivateFieldLooseBase(this, _visibleVotes)[_visibleVotes].push(messageId);
if (!babelHelpers.classPrivateFieldLooseBase(this, _shouldLoadVotes)[_shouldLoadVotes]) {
return;
}
main_core.Runtime.debounce(() => babelHelpers.classPrivateFieldLooseBase(this, _prepareToLoadVotes)[_prepareToLoadVotes]())();
babelHelpers.classPrivateFieldLooseBase(this, _shouldLoadVotes)[_shouldLoadVotes] = false;
}
function _prepareToLoadVotes2() {
const entityIds = babelHelpers.classPrivateFieldLooseBase(this, _visibleVotes)[_visibleVotes].slice(babelHelpers.classPrivateFieldLooseBase(this, _startIndexToLoadVotes)[_startIndexToLoadVotes], babelHelpers.classPrivateFieldLooseBase(this, _visibleVotes)[_visibleVotes].length);
const requestCount = Math.ceil(entityIds.length / VOTES_COUNT_TO_LOAD);
babelHelpers.classPrivateFieldLooseBase(this, _startIndexToLoadVotes)[_startIndexToLoadVotes] = babelHelpers.classPrivateFieldLooseBase(this, _visibleVotes)[_visibleVotes].length;
babelHelpers.classPrivateFieldLooseBase(this, _shouldLoadVotes)[_shouldLoadVotes] = true;
for (let i = 0; i < requestCount; i++) {
const startIndex = i * VOTES_COUNT_TO_LOAD;
const batchOfEntities = entityIds.slice(startIndex, Math.min(startIndex + VOTES_COUNT_TO_LOAD, entityIds.length));
const voteIds = batchOfEntities.map(entityId => {
const {
componentParams
} = im_v2_application_core.Core.getStore().getters['messages/getById'](entityId);
return componentParams.id;
});
this.emit('loadVotes', {
entityIds: batchOfEntities,
voteIds
});
}
}
exports.VoteApplication = VoteApplication;
}((this.BX.Vote = this.BX.Vote || {}),BX,BX.Event,BX.Vue3.Vuex,BX.Messenger.v2.Const,BX.Messenger.v2.Application,BX.Vote.Store,BX.Vote.Service));
//# sourceMappingURL=vote.bundle.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1 @@
{"version":3,"file":"vote.bundle.map.js","names":["this","BX","exports","main_core","main_core_events","ui_vue3_vuex","im_v2_const","im_v2_application_core","vote_store_vote","vote_provider_pull","VOTES_COUNT_TO_LOAD","_visibleVotes","babelHelpers","classPrivateFieldLooseKey","_shouldLoadVotes","_startIndexToLoadVotes","_subscribeOnEvents","_onMessageIsVisible","_prepareToLoadVotes","VoteApplication","EventEmitter","init","getInstance","instance","constructor","super","Object","defineProperty","value","_prepareToLoadVotes2","_onMessageIsVisible2","_subscribeOnEvents2","writable","setEventNamespace","createStore","initPull","classPrivateFieldLooseBase","handleLoadError","entityIds","filter","id","includes","store","modules","vote","namespaced","VoteModel","getStore","pullClient","PULL","subscribe","VotePullHandler","canCreateVoteInChat","currentChatType","availableChatTypes","ChatType","chat","open","general","call","crm","sonetGroup","calendar","tasks","mail","generalChannel","channel","openChannel","collab","bind","event","messageId","getData","push","Runtime","debounce","slice","length","requestCount","Math","ceil","i","startIndex","batchOfEntities","min","voteIds","map","entityId","componentParams","Core","getters","emit","Vote","Event","Vue3","Vuex","Messenger","v2","Const","Application","Store","Service"],"sources":["vote.bundle.js"],"mappings":"AACAA,KAAKC,GAAKD,KAAKC,IAAM,CAAC,GACrB,SAAUC,EAAQC,EAAUC,EAAiBC,EAAaC,EAAYC,EAAuBC,EAAgBC,GAC7G,aAEA,MAAMC,EAAsB,GAC5B,IAAIC,EAA6BC,aAAaC,0BAA0B,gBACxE,IAAIC,EAAgCF,aAAaC,0BAA0B,mBAC3E,IAAIE,EAAsCH,aAAaC,0BAA0B,yBACjF,IAAIG,EAAkCJ,aAAaC,0BAA0B,qBAC7E,IAAII,EAAmCL,aAAaC,0BAA0B,sBAC9E,IAAIK,EAAmCN,aAAaC,0BAA0B,sBAC9E,MAAMM,UAAwBf,EAAiBgB,aAC7C,WAAOC,GACL,OAAOF,EAAgBG,aACzB,CACA,kBAAOA,GACL,IAAKH,EAAgBI,SAAU,CAC7BJ,EAAgBI,SAAW,IAAIJ,CACjC,CACA,OAAOA,EAAgBI,QACzB,CACA,WAAAC,GACEC,QACAC,OAAOC,eAAe3B,KAAMkB,EAAqB,CAC/CU,MAAOC,IAETH,OAAOC,eAAe3B,KAAMiB,EAAqB,CAC/CW,MAAOE,IAETJ,OAAOC,eAAe3B,KAAMgB,EAAoB,CAC9CY,MAAOG,IAETL,OAAOC,eAAe3B,KAAMW,EAAe,CACzCqB,SAAU,KACVJ,MAAO,KAETF,OAAOC,eAAe3B,KAAMc,EAAkB,CAC5CkB,SAAU,KACVJ,MAAO,OAETF,OAAOC,eAAe3B,KAAMe,EAAwB,CAClDiB,SAAU,KACVJ,MAAO,IAET5B,KAAKiC,kBAAkB,uBACvBjC,KAAKkC,cACLlC,KAAKmC,WACLvB,aAAawB,2BAA2BpC,KAAMgB,GAA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,o){"use strict";const n=50;var c=babelHelpers.classPrivateFieldLooseKey("visibleVotes");var b=babelHelpers.classPrivateFieldLooseKey("shouldLoadVotes");var h=babelHelpers.classPrivateFieldLooseKey("startIndexToLoadVotes");var p=babelHelpers.classPrivateFieldLooseKey("subscribeOnEvents");var d=babelHelpers.classPrivateFieldLooseKey("onMessageIsVisible");var u=babelHelpers.classPrivateFieldLooseKey("prepareToLoadVotes");class v extends t.EventEmitter{static init(){return v.getInstance()}static getInstance(){if(!v.instance){v.instance=new v}return v.instance}constructor(){super();Object.defineProperty(this,u,{value:L});Object.defineProperty(this,d,{value:B});Object.defineProperty(this,p,{value:P});Object.defineProperty(this,c,{writable:true,value:[]});Object.defineProperty(this,b,{writable:true,value:true});Object.defineProperty(this,h,{writable:true,value:0});this.setEventNamespace("BX.VOTE.APPLICATION");this.createStore();this.initPull();babelHelpers.classPrivateFieldLooseBase(this,p)[p]()}handleLoadError(e){babelHelpers.classPrivateFieldLooseBase(this,c)[c]=babelHelpers.classPrivateFieldLooseBase(this,c)[c].filter((s=>!e.includes(s)));babelHelpers.classPrivateFieldLooseBase(this,h)[h]=0}createStore(){this.store=a.createStore({modules:{vote:{namespaced:true,...r.VoteModel}}})}getStore(){return this.store}initPull(){this.pullClient=BX.PULL;if(!this.pullClient){return}this.pullClient.subscribe(new o.VotePullHandler({store:this.store}))}static canCreateVoteInChat(e){const s=[l.ChatType.chat,l.ChatType.open,l.ChatType.general,l.ChatType.call,l.ChatType.crm,l.ChatType.sonetGroup,l.ChatType.calendar,l.ChatType.tasks,l.ChatType.mail,l.ChatType.generalChannel,l.ChatType.channel,l.ChatType.openChannel,l.ChatType.collab];return s.includes(e)}}function P(){t.EventEmitter.subscribe("vote-message-batch",babelHelpers.classPrivateFieldLooseBase(this,d)[d].bind(this))}function B(e){const{messageId:t}=e.getData();if(babelHelpers.classPrivateFieldLooseBase(this,c)[c].includes(t)){return}babelHelpers.classPrivateFieldLooseBase(this,c)[c].push(t);if(!babelHelpers.classPrivateFieldLooseBase(this,b)[b]){return}s.Runtime.debounce((()=>babelHelpers.classPrivateFieldLooseBase(this,u)[u]()))();babelHelpers.classPrivateFieldLooseBase(this,b)[b]=false}function L(){const e=babelHelpers.classPrivateFieldLooseBase(this,c)[c].slice(babelHelpers.classPrivateFieldLooseBase(this,h)[h],babelHelpers.classPrivateFieldLooseBase(this,c)[c].length);const s=Math.ceil(e.length/n);babelHelpers.classPrivateFieldLooseBase(this,h)[h]=babelHelpers.classPrivateFieldLooseBase(this,c)[c].length;babelHelpers.classPrivateFieldLooseBase(this,b)[b]=true;for(let t=0;t<s;t++){const s=t*n;const a=e.slice(s,Math.min(s+n,e.length));const l=a.map((e=>{const{componentParams:s}=i.Core.getStore().getters["messages/getById"](e);return s.id}));this.emit("loadVotes",{entityIds:a,voteIds:l})}}e.VoteApplication=v})(this.BX.Vote=this.BX.Vote||{},BX,BX.Event,BX.Vue3.Vuex,BX.Messenger.v2.Const,BX.Messenger.v2.Application,BX.Vote.Store,BX.Vote.Service);
//# sourceMappingURL=vote.bundle.map.js