{"version":3,"sources":["webpack:///../WCC.UI/App/components/statistics/survey/model.ts","webpack:///../WCC.UI/App/components/topic/comments/comments.html?aaa6","webpack:///../WCC.UI/App/components/topic/comments/comments.scss?9df6","webpack:///../WCC.UI/App/components/topic/comments/comments.ts","webpack:///../WCC.UI/App/managers/ideation.ts","webpack:///../WCC.UI/App/managers/pager.ts","webpack:///../WCC.UI/App/managers/topic/votes.ts","webpack:///../WCC.UI/App/models/threadVote.ts","webpack:///../WCC.UI/App/webpack/runtime/htmlExposer.js","webpack:///../WCC.UI/App/components/topic/comments/comments.scss","webpack:///../WCC.UI/App/components/topic/comments/comments.html"],"names":["SurveyStatisticsModel","constructor","config","isSpecialItem","isSurveyStatistics","ready","ko","observable","this","topicId","TopicId","unwrap","filterData","FilterData","default","theme","Theme","reset","content","expose","__esModule","api","module","i","options","exports","locals","discussionId","settings","components","preload","TopicCommentsVM","info","managers","storage","effects","itemsInViewPort","observableArray","labels","syncComments","pager","sync","getItemTemplate","item","TopicThread","getViewPortTracker","pureComputed","read","includes","write","value","push","remove","flattenComputed","view","CommentsView","all","todoMode","is","unread","filters","searchString","pluck","f","extend","rateLimit","timeout","method","peopleTagsIDs","currentUser","m","person","currentUserId","c","personId","topicManager","get","SimpleTopicManager","topicLoaded","loading","topic","isIdeation","t","surveyStat","SurveyStatisticsManager","stat","ideationManager","IdeationManager","ideationReady","isReady","isRankingStage","isRatingStage","isVotingStage","commentHeader","undefined","commentsManager","CommentsManager","commentsLoaded","allPagesLoaded","removedCommentsIDs","deferred","doneCommentsIDs","allComments","comments","filter","comment","_comment$id","id","_comment$id2","isInToDoList","sortBy","_comment$createDate","createDate","Date","pinnedComments","isPinned","sortedComments","_comment$vote","randomIdx","vote","getTime","showShowAllItems","ItemsPager","items","pinnedItems","showAllItems","newComments","newItems","lastComment","last","pagesCount","pagesCountToShow","newCommentsCount","mapSingle","length","newCommentsCountStr","count","LoadNewComment","LoadNewComments","replace","toString","hasNewComments","noComments","showNothingToDoMessage","scrolledToTheBottom","allowToShowNextPage","grid","rendering","hasPagesToShow","nextPageSpinnerShown","shouldShouldKeepOrder","surveyStatistics","gridItems","userInstance","topicInstance","filtersInstance","isSurvey","surveyStatInstance","isModerator","surveyShowSummaryBox","pages","some","p","choiceQuestions","rankQuestions","isActive","Grid","source","offset","threshold","keepOrder","not","shouldAutoSyncComments","checkIfShouldAutoSyncComments","commentsAreReloaded","checkIfCommentsReloaded","register","subscribe","afterSyncActions","update","areCommentsReloaded","showNextPage","_commentsManager","loadMore","manager","currentRemovedCommentsIDs","isDeleted","map","_c$id","currentDoneCommentsIDs","_c$id2","applyBindingsToNode","element","every","checkIfNewCommentsContainUserComment","postedById","checkIfAllCommentsBelongToUser","__decorate","injectable","__param","inject","wccModules","componentConfig","componentInfo","managersContext","_ref","user","CurrentUserManager","isRegularUser","u","isRegular","TopicManager","stage","ideationStage","upvotesCount","ideationUpvotes","downvotesCount","ideationDownvotes","votesManager","TopicVotesManager","loadingVotes","votes","personUpvotes","v","personDownvotes","usedUpvotes","reduce","r","availableUpvotes","usedDownvotes","availableDownvotes","hasUpvotes","hasDownvotes","enums","IdeationStages","IdeaRating","isDoneVoting","managerConfig","withEffects","syncQueue","TasksQueueManager","extraItemsToShow","allItems","trackArrayChanges","showAllItemsMode","pageSize","firstItem","first","splitByIdx","strictComputed","indexOf","getNewItems","pagedItems","splitIdx","idx","Math","ceil","itemsCountToShow","extraCommentsCount","onArrayChange","add","grabNew","run","Promise","resolve","pickedItems","syncOrder","_","clone","slice","concat","inc","uniq","forEach","action","dispose","sortedItems","intersection","difference","topicsService","CollectionDataSource","load","bind","mapper","jsonVote","ThreadVote","list","busy","requestsProcessed","updating","withEffect","events","replyAdded","on","onLocalReplyAdded","replyUpdated","onLocalReplyUpdated","replyDeleted","onLocalReplyDeleted","queries","toArray","WCCEntity","json","super","createField","threadId","linkedThreadId","system","SystemHelpers","html","getTemplatesAndResources","node","document","head","appendChild","___CSS_LOADER_API_IMPORT___"],"mappings":"sJAQA,2D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4B,IAE9BxQ,KAAK,CAAC7B,EAAOC,EAAI,saAAua,KAEhcD,EAAOG,QAAUA,G,sHCHjBH,EAAOG,QAFI","file":"170.4f13b1e5988570cc9043.js","sourcesContent":["import { Observable, SubscribableOrNullableValue } from 'knockout';\r\n\r\nexport interface SurveyStatisticsConfig {\r\n TopicId?: SubscribableOrNullableValue\r\n FilterData?: any\r\n Theme?: string\r\n}\r\n\r\nexport default class SurveyStatisticsModel {\r\n isSpecialItem = true;\r\n isSurveyStatistics = true;\r\n\r\n ready = ko.observable(false);\r\n\r\n topicId: Observable\r\n filterData: Observable\r\n theme: Observable\r\n\r\n constructor(config: SurveyStatisticsConfig = {}) {\r\n this.topicId = ko.observable(config.TopicId).unwrap();\r\n this.filterData = ko.observable(config.FilterData).default(null);\r\n\r\n this.theme = ko.observable(config.Theme).default('classic');\r\n }\r\n\r\n reset() {\r\n this.ready(false);\r\n }\r\n}","define([\n \"!!../../../../node_modules/html-loader/dist/cjs.js??ref--26-1!./comments.html\", \n \"!../../../webpack/runtime/htmlExposer.js\"], function (content, expose) {\n content = content.__esModule ? content.default : content;\n expose(content);\n return content;\n });","var api = require(\"!../../../../node_modules/style-loader/dist/runtime/injectStylesIntoStyleTag.js\");\n var content = require(\"!!../../../../node_modules/css-loader/dist/cjs.js!../../../../node_modules/sass-loader/dist/cjs.js!./comments.scss\");\n\n content = content.__esModule ? content.default : content;\n\n if (typeof content === 'string') {\n content = [[module.id, content, '']];\n }\n\nvar options = {};\n\noptions.insert = \"head\";\noptions.singleton = false;\n\nvar update = api(content, options);\n\n\n\nmodule.exports = content.locals || {};","import { Grid } from 'components/grid/grid';\r\nimport SurveyStatisticsModel from 'components/statistics/survey/model';\r\nimport CommentsView from 'enums/comments/views';\r\nimport { wccModules } from 'enums/wccModules';\r\nimport { inject, injectable } from 'inversify';\r\nimport { ObservableArray, Subscribable } from 'knockout';\r\nimport { ManagersContext } from 'managers/context';\r\nimport IdeationManager from 'managers/ideation';\r\nimport { IWCCStorageManager } from 'managers/iStorage';\r\nimport ItemsPager from 'managers/pager';\r\nimport SimpleTopicManager from 'managers/simpleTopic';\r\nimport SurveyStatisticsManager from 'managers/statistics/survey';\r\nimport CommentsManager from 'managers/topic/comments';\r\nimport { EffectsContainer } from 'mixins/withEffects';\r\nimport { TopicThread } from 'models/topicThread';\r\nimport { CommentVMHeader } from '../comment/comment';\r\nimport './comments.html';\r\nimport { TopicCommentsVMConfig } from './comments.interfaces';\r\nimport './comments.scss';\r\n\r\nconst { discussionId } = settings;\r\n\r\ntype CommentsGridItem = TopicThread | SurveyStatisticsModel\r\n\r\ncomponents.preload('grid-new', 'topic-comment', 'survey-statistics');\r\n\r\n@injectable()\r\nexport default class TopicCommentsVM {\r\n private itemsInViewPort = ko.observableArray();\r\n\r\n private topicId: Subscribable\r\n private view: Subscribable\r\n private currentUserId: Subscribable\r\n\r\n private pager: ItemsPager\r\n\r\n private allComments: Subscribable>\r\n private comments: ObservableArray\r\n private newComments: Subscribable>\r\n\r\n labels = labels;\r\n \r\n todoMode: Subscribable\r\n\r\n commentHeader: Subscribable\r\n lastComment: Subscribable\r\n newCommentsCountStr: Subscribable\r\n\r\n hasNewComments: Subscribable\r\n showNothingToDoMessage: Subscribable\r\n scrolledToTheBottom: Subscribable\r\n nextPageSpinnerShown: Subscribable\r\n\r\n grid: Grid\r\n\r\n ready: Subscribable\r\n loading: Subscribable\r\n\r\n constructor(\r\n @inject(wccModules.componentConfig) config: TopicCommentsVMConfig,\r\n @inject(wccModules.componentInfo) info: ko.components.ComponentInfo,\r\n @inject(wccModules.managersContext) managers: ManagersContext,\r\n @inject(wccModules.storage) storage: IWCCStorageManager,\r\n @inject(wccModules.effects) effects: EffectsContainer\r\n ) {\r\n this.topicId = ko.flattenComputed(config.topicId);\r\n this.view = ko.flattenComputed(config.view, CommentsView.all);\r\n this.todoMode = this.view.is(CommentsView.unread);\r\n\r\n const filters = ko.flattenComputed(config.filters);\r\n const searchString = filters.pluck(f => f.searchString, '').extend({ rateLimit: { timeout: 500, method: \"notifyWhenChangesStop\" } });\r\n const peopleTagsIDs = filters.pluck(f => f.peopleTagsIDs(), []).extend({ rateLimit: { timeout: 500, method: \"notifyWhenChangesStop\" } });\r\n\r\n const currentUserManager = managers.currentUser(discussionId);\r\n const currentUser = currentUserManager.pluck(m => m.person);\r\n this.currentUserId = currentUser.pluck(c => c.personId);\r\n\r\n const topicManager = storage.get(SimpleTopicManager, { topicId: this.topicId });\r\n const topicLoaded = topicManager.pluck(m => !m.loading(), false);\r\n const topic = topicManager.pluck(m => m.topic);\r\n const isIdeation = topic.pluck(t => t.isIdeation(), false);\r\n\r\n const surveyStatManager = storage.get(SurveyStatisticsManager, { topicId: this.topicId });\r\n const surveyStat = surveyStatManager.pluck(m => m.stat);\r\n\r\n const ideationManager = storage.get(IdeationManager, { topicId: this.topicId });\r\n const ideationReady = ideationManager.pluck(m => m.isReady, false);\r\n const isRankingStage = ideationManager.pluck(m => m.isRatingStage, false);\r\n const isVotingStage = ideationManager.pluck(m => m.isVotingStage, false);\r\n\r\n this.commentHeader = topic.pluck(topic => topic.isIdeation() ? 'title' : undefined);\r\n\r\n const commentsManager = storage.get(CommentsManager, { topicId: this.topicId, view: this.view, searchString, peopleTagsIDs });\r\n const commentsLoaded = commentsManager.pluck(m => !m.loading(), false);\r\n const allPagesLoaded = commentsManager.pluck(m => m.allPagesLoaded, false);\r\n\r\n const removedCommentsIDs = ko.observableArray().extend({ deferred: true });\r\n const doneCommentsIDs = ko.observableArray().extend({ deferred: true });\r\n\r\n this.allComments = commentsManager\r\n .pluck(m => m.comments, [])\r\n .filter(comment => !removedCommentsIDs().includes(comment.id() ?? ''))\r\n .filter(comment => !doneCommentsIDs().includes(comment.id() ?? '') || comment.isInToDoList())\r\n .sortBy(comment => -(comment.createDate() ?? new Date()))\r\n .extend({ rateLimit: 0 });\r\n\r\n const pinnedComments = this.allComments.filter(comment => comment.isPinned()).extend({ deferred: true });\r\n\r\n const sortedComments = this.allComments\r\n .filter(comment => !comment.isPinned())\r\n .sortBy(comment => {\r\n if (isRankingStage()) { // in ideation ranking stage\r\n if (isVotingStage())\r\n return comment.randomIdx(); //during voting we randomly sort ideas to prevent biased votes\r\n else\r\n return -(comment.vote() ?? 0); //once voting is done we sort ideas by final vote value\r\n }\r\n\r\n return -comment.createDate().getTime();\r\n });\r\n\r\n const showShowAllItems = ko.pureComputed(() => this.todoMode() || isIdeation() && isRankingStage());\r\n \r\n this.pager = new ItemsPager({\r\n items: sortedComments,\r\n pinnedItems: pinnedComments,\r\n showAllItems: showShowAllItems\r\n });\r\n\r\n this.comments = this.pager.items; \r\n this.newComments = this.pager.newItems;\r\n this.lastComment = this.comments.last();\r\n\r\n const pagesCount = this.pager.pagesCount;\r\n const pagesCountToShow = this.pager.pagesCountToShow;\r\n\r\n const newCommentsCount = this.pager.newItems.mapSingle(items => items.length).extend({ deferred: true });\r\n this.newCommentsCountStr = newCommentsCount.mapSingle(count => (count === 1 ? labels.LoadNewComment : labels.LoadNewComments).replace('{0}', count.toString()));\r\n\r\n this.hasNewComments = newCommentsCount.is(count => count > 0);\r\n const noComments = ko.pureComputed(() => this.allComments().length === 0);\r\n\r\n this.showNothingToDoMessage = ko.pureComputed(() => this.todoMode() && noComments());\r\n this.scrolledToTheBottom = this.lastComment.pluck(comment => this.itemsInViewPort().includes(comment), false);\r\n const allowToShowNextPage = ko.pureComputed(() => !this.grid.rendering() && this.scrolledToTheBottom());\r\n const hasPagesToShow = ko.pureComputed(() => pagesCountToShow() < pagesCount());\r\n this.nextPageSpinnerShown = ko.pureComputed(() => !this.grid.rendering() && (!allPagesLoaded() || hasPagesToShow()));\r\n\r\n const shouldShouldKeepOrder = ko.pureComputed(() => isRankingStage());\r\n\r\n const surveyStatistics = new SurveyStatisticsModel({ TopicId: this.topicId });\r\n\r\n const gridItems = ko.pureComputed(() => {\r\n const userInstance = currentUser();\r\n const topicInstance = topic();\r\n const filtersInstance = filters();\r\n\r\n if (userInstance != undefined && topicInstance != undefined) {\r\n if (topicInstance.isSurvey()) {\r\n const surveyStatInstance = surveyStat();\r\n\r\n if (surveyStatInstance != undefined) {\r\n const surveyStatisticsNeeded = (userInstance.isModerator() || (topicInstance.surveyShowSummaryBox() && this.comments().length > 0)) &&\r\n surveyStatInstance.pages().some(p => p.choiceQuestions().length > 0 || p.rankQuestions().length > 0) &&\r\n this.view() == CommentsView.all &&\r\n this.comments().length > 0 &&\r\n (filtersInstance == undefined || !filtersInstance.isActive());\r\n\r\n if (surveyStatisticsNeeded)\r\n return [surveyStatistics, ...this.comments()];\r\n }\r\n }\r\n }\r\n\r\n return this.comments();\r\n });\r\n\r\n this.grid = new Grid({\r\n source: gridItems,\r\n offset: 5,\r\n threshold: 100,\r\n keepOrder: shouldShouldKeepOrder\r\n });\r\n\r\n this.ready = ko.pureComputed(() => this.currentUserId() != undefined && topicLoaded() && commentsLoaded() && ideationReady());\r\n this.loading = this.ready.not();\r\n\r\n const shouldAutoSyncComments = ko.pureComputed(() => this.checkIfShouldAutoSyncComments());\r\n const commentsAreReloaded = ko.pureComputed(() => this.checkIfCommentsReloaded());\r\n\r\n effects.register([\r\n pinnedComments.subscribe(() => this.pager.afterSyncActions.push(() => this.grid.update(true)))\r\n ]);\r\n\r\n effects.register(() => {\r\n if (shouldAutoSyncComments())\r\n this.pager.sync();\r\n }, [this.allComments]);\r\n\r\n effects.register((areCommentsReloaded) => {\r\n if (areCommentsReloaded)\r\n this.pager.reset();\r\n }, [commentsAreReloaded]);\r\n\r\n effects.register((allowToShowNextPage, pagesCount) => {\r\n if (allowToShowNextPage && pagesCountToShow() < pagesCount)\r\n this.pager.showNextPage();\r\n }, [allowToShowNextPage, this.pager.pagesCount]);\r\n\r\n effects.register((pagesCountToShow, pagesCount) => {\r\n if (pagesCountToShow >= pagesCount - 1)\r\n commentsManager()?.loadMore();\r\n }, [pagesCountToShow, pagesCount]);\r\n\r\n effects.register((manager, todoMode) => {\r\n removedCommentsIDs([]);\r\n doneCommentsIDs([]);\r\n\r\n if (manager != undefined) {\r\n const currentRemovedComments = manager.comments().filter(comment => comment.isDeleted());\r\n const currentRemovedCommentsIDs = currentRemovedComments.map(c => c.id() ?? '');\r\n\r\n removedCommentsIDs(currentRemovedCommentsIDs);\r\n\r\n if (todoMode) {\r\n const currentDoneComments = manager.comments().filter(comment => !comment.isInToDoList());\r\n const currentDoneCommentsIDs = currentDoneComments.map(c => c.id() ?? '');\r\n\r\n doneCommentsIDs(currentDoneCommentsIDs);\r\n }\r\n }\r\n }, [commentsManager, this.todoMode]);\r\n\r\n ko.applyBindingsToNode(info.element, {\r\n 'css': {\r\n 'topic__comments': true\r\n }\r\n });\r\n }\r\n\r\n syncComments = () => {\r\n this.pager.sync();\r\n }\r\n\r\n getItemTemplate = (item: CommentsGridItem) => {\r\n if (item instanceof TopicThread)\r\n return 'wcc-components-topic-comments-item-comment';\r\n else if (item instanceof SurveyStatisticsModel)\r\n return 'wcc-components-topic-comments-item-surveystat';\r\n }\r\n\r\n getViewPortTracker = (item: CommentsGridItem) => {\r\n return ko.pureComputed({\r\n read: () => this.itemsInViewPort().includes(item),\r\n\r\n write: value => {\r\n if (value) {\r\n if (!this.itemsInViewPort().includes(item))\r\n this.itemsInViewPort.push(item);\r\n } else {\r\n this.itemsInViewPort.remove(item);\r\n }\r\n }\r\n });\r\n }\r\n\r\n private checkIfCommentsReloaded() {\r\n return this.comments().length === 0 ||\r\n this.comments().every(comment => !this.allComments().includes(comment));\r\n }\r\n\r\n private checkIfNewCommentsContainUserComment() {\r\n return this.newComments().length > 0 &&\r\n this.currentUserId() != undefined &&\r\n this.newComments().some(comment => comment.postedById() == this.currentUserId());\r\n }\r\n\r\n private checkIfAllCommentsBelongToUser() {\r\n return this.allComments().length > 0 &&\r\n this.comments().length > 0 &&\r\n this.currentUserId() != undefined &&\r\n this.comments().every(comment => comment.postedById() == this.currentUserId());\r\n }\r\n\r\n private checkIfShouldAutoSyncComments() {\r\n return this.checkIfCommentsReloaded() || !this.todoMode() && (this.checkIfNewCommentsContainUserComment() || this.checkIfAllCommentsBelongToUser());\r\n }\r\n}","import { wccModules } from 'enums/wccModules';\r\nimport { inject, injectable } from 'inversify';\r\nimport { PureComputed, Subscribable } from 'knockout';\r\nimport { CurrentUserManager } from 'managers/currentUser';\r\nimport { IWCCStorageManager } from 'managers/iStorage';\r\nimport { TopicManager } from 'managers/topic';\r\nimport TopicVotesManager from './topic/votes';\r\n\r\nexport interface TopicVotesManagerConfig {\r\n topicId: string\r\n}\r\n\r\n@injectable()\r\nexport default class IdeationManager {\r\n stage: Subscribable\r\n\r\n availableUpvotes: Subscribable\r\n availableDownvotes: Subscribable\r\n\r\n hasUpvotes: Subscribable\r\n hasDownvotes: Subscribable\r\n\r\n isIdeation: Subscribable\r\n isRatingStage: Subscribable\r\n isVotingStage: Subscribable\r\n isDoneVoting: Subscribable\r\n\r\n isReady: Subscribable\r\n\r\n constructor(\r\n @inject(wccModules.managerConfig) { topicId }: TopicVotesManagerConfig,\r\n @inject(wccModules.storage) storage: IWCCStorageManager\r\n ) {\r\n const userManager = storage.get(CurrentUserManager, { discussionId: settings.discussionId });\r\n const user = userManager.pluck(m => m.person);\r\n const isRegularUser = user.pluck(u => u.isRegular, false);\r\n\r\n const topicManager = storage.get(TopicManager, { topicId });\r\n const topic = topicManager.pluck(m => m.topic);\r\n this.isIdeation = topic.pluck(t => t.isIdeation, false);\r\n this.stage = topic.pluck(t => t.ideationStage, 0);\r\n const upvotesCount = topic.pluck(t => t.ideationUpvotes, 0);\r\n const downvotesCount = topic.pluck(t => t.ideationDownvotes, 0);\r\n\r\n const votesManager = storage.get(TopicVotesManager, { topicId: topicId });\r\n const loadingVotes = votesManager.pluck(m => m.loading, true);\r\n const votes = votesManager.pluck(m => m.votes, []);\r\n\r\n const personUpvotes = votes.filter(v => v.value() > 0);\r\n const personDownvotes = votes.filter(v => v.value() < 0);\r\n\r\n const usedUpvotes = personUpvotes.reduce((r, v) => r + v.value(), () => 0);\r\n this.availableUpvotes = ko.pureComputed(() => isRegularUser() ? upvotesCount() - usedUpvotes() : 0);\r\n\r\n const usedDownvotes = personDownvotes.reduce((r, v) => r - v.value(), () => 0);\r\n this.availableDownvotes = ko.pureComputed(() => isRegularUser() ? downvotesCount() - usedDownvotes() : 0);\r\n\r\n this.hasUpvotes = this.availableUpvotes.is(count => count > 0);\r\n this.hasDownvotes = this.availableDownvotes.is(count => count > 0);\r\n\r\n this.isRatingStage = ko.pureComputed(() => this.stage() === enums.IdeationStages.IdeaRating.value);\r\n this.isDoneVoting = this.availableUpvotes.is(0);\r\n\r\n this.isVotingStage = ko.pureComputed(() => this.isIdeation() && isRegularUser() && this.isRatingStage() && !this.isDoneVoting());\r\n\r\n this.isReady = ko.pureComputed(() => !this.isIdeation() || user() != undefined && topic() != undefined && !loadingVotes());\r\n } \r\n}","import { Subscribable, SubscribableOrNullableValue } from 'knockout';\r\nimport { withEffects } from 'mixins/withEffects';\r\nimport TasksQueueManager from './tasksQueue';\r\n\r\nexport interface ItemsPagerConfig {\r\n items: SubscribableOrNullableValue>\r\n pinnedItems?: SubscribableOrNullableValue>\r\n pageSize?: SubscribableOrNullableValue\r\n\r\n showAllItems?: SubscribableOrNullableValue\r\n}\r\n\r\nexport default class ItemsPager {\r\n private effects = withEffects();\r\n private syncQueue = new TasksQueueManager();\r\n\r\n //amount of items we added to the beginning\r\n //allows to not recalculate pages boundaries\r\n private extraItemsToShow = ko.observable(0);\r\n\r\n private allItems: Subscribable>\r\n private pinnedItems: Subscribable>\r\n private pagedItems: Subscribable>\r\n\r\n private splitByIdx: Subscribable;\r\n private itemsCountToShow: Subscribable;\r\n\r\n private showAllItemsMode: Subscribable\r\n\r\n afterSyncActions = ko.observableArray();\r\n items = ko.observableArray()\r\n \r\n pagesCount: Subscribable\r\n pagesCountToShow = ko.observable(1);\r\n\r\n newItems: Subscribable>\r\n\r\n constructor(config: ItemsPagerConfig) {\r\n this.allItems = ko.flattenComputed(config.items, []);\r\n this.pinnedItems = ko.flattenComputed(config.pinnedItems, []).extend({ trackArrayChanges: true });\r\n this.showAllItemsMode = ko.flattenComputed(config.showAllItems, false);\r\n\r\n const pageSize = ko.flattenComputed(config.pageSize, 10);\r\n const firstItem = this.items.first();\r\n\r\n this.splitByIdx = ko.strictComputed((allItems, firstItem) => {\r\n if (firstItem != undefined)\r\n return allItems.indexOf(firstItem);\r\n }, [this.allItems, firstItem]);\r\n\r\n this.newItems = ko.pureComputed(() => this.getNewItems()); \r\n\r\n this.pagedItems = ko.strictComputed((allItems, splitIdx) => {\r\n if (splitIdx != undefined)\r\n return allItems.filter((item, idx) => idx >= splitIdx);\r\n\r\n return allItems;\r\n }, [this.allItems, this.splitByIdx]);\r\n\r\n this.pagesCount = ko.strictComputed((items, pageSize) => Math.ceil(items.length / pageSize), [this.pagedItems, pageSize]);\r\n\r\n this.itemsCountToShow = ko.strictComputed((pagesCount, pageSize, extraCommentsCount) => {\r\n return pagesCount * pageSize + extraCommentsCount;\r\n }, [this.pagesCountToShow, pageSize, this.extraItemsToShow]);\r\n\r\n this.effects.register(() => {\r\n this.sync(false);\r\n }, [this.pagesCountToShow]);\r\n\r\n this.effects.register([\r\n this.pinnedItems.onArrayChange({ add: () => this.sync(false), remove: () => this.sync(false) }),\r\n this.showAllItemsMode.subscribe(() => this.sync(false))\r\n ]);\r\n\r\n this.effects.register(showAllItemsMode => {\r\n if (showAllItemsMode)\r\n return this.allItems.subscribe(() => this.sync(false));\r\n }, [this.showAllItemsMode]);\r\n\r\n //this.effects.register([\r\n // ko.computed(() => console.log('pagesCount', this.pagesCount())),\r\n // ko.computed(() => console.log('pagesCountToShow', this.pagesCountToShow())),\r\n // ko.computed(() => console.log('itemsCountToShow', this.itemsCountToShow())),\r\n // ko.computed(() => console.log('extraItemsToShow', this.extraItemsToShow())),\r\n // ko.computed(() => console.log('items', this.items()))\r\n //]);\r\n }\r\n\r\n async sync(grabNew = true) {\r\n this.syncQueue.run(() => new Promise(resolve => {\r\n this.syncOrder();\r\n\r\n let pickedItems: Array;\r\n\r\n if (this.showAllItemsMode()) {\r\n pickedItems = _.clone(this.allItems());\r\n } else {\r\n const pagedItems = this.pagedItems().slice(0, this.itemsCountToShow());\r\n\r\n if (grabNew) {\r\n const newItems = this.newItems();\r\n pickedItems = newItems.concat(pagedItems);\r\n\r\n this.extraItemsToShow.inc(newItems.length);\r\n } else {\r\n pickedItems = pagedItems;\r\n }\r\n }\r\n\r\n const pinnedItems = this.pinnedItems();\r\n\r\n if (pinnedItems.length > 0)\r\n pickedItems = _.uniq(pinnedItems.concat(pickedItems));\r\n\r\n this.items(pickedItems);\r\n\r\n this.afterSyncActions().forEach(action => action());\r\n this.afterSyncActions([]);\r\n\r\n resolve();\r\n })); \r\n }\r\n\r\n showNextPage() {\r\n if (this.pagesCountToShow() < this.pagesCount())\r\n this.pagesCountToShow.inc(); \r\n }\r\n\r\n reset() {\r\n this.extraItemsToShow(0);\r\n this.pagesCountToShow(1);\r\n this.sync(false);\r\n }\r\n\r\n dispose() {\r\n this.effects.dispose();\r\n }\r\n\r\n private syncOrder() {\r\n const sortedItems = _(this.allItems()).intersection(this.items());\r\n\r\n this.items(sortedItems);\r\n }\r\n\r\n private getNewItems() {\r\n if (!this.showAllItemsMode()) {\r\n const splitIdx = this.splitByIdx();\r\n\r\n if (splitIdx != undefined)\r\n return this.allItems().filter((comment, idx) => idx < splitIdx);\r\n\r\n return [];\r\n }\r\n\r\n return _(this.allItems()).difference(this.items());\r\n }\r\n}","import { wccModules } from 'enums/wccModules';\r\nimport { inject, injectable } from 'inversify';\r\nimport { PureComputed, Subscribable } from 'knockout';\r\nimport { CollectionDataSource } from 'managers/datasources/collection';\r\nimport events from 'managers/events';\r\nimport IdeationManager from 'managers/ideation';\r\nimport { IWCCStorageManager } from 'managers/iStorage';\r\nimport { withEffect } from 'mixins/withEffect';\r\nimport { EffectsContainer } from 'mixins/withEffects';\r\nimport ThreadVote, { JSONThreadVote } from 'models/threadVote';\r\nimport { TopicsService } from 'services/topics';\r\n\r\nexport interface TopicVotesManagerConfig {\r\n topicId: string\r\n}\r\n\r\n@injectable()\r\nexport default class TopicVotesManager {\r\n private topicId: string\r\n private source: CollectionDataSource\r\n\r\n votes: Subscribable>\r\n\r\n loading: PureComputed\r\n updating: PureComputed\r\n\r\n constructor(\r\n @inject(wccModules.managerConfig) { topicId }: TopicVotesManagerConfig,\r\n @inject(wccModules.storage) storage: IWCCStorageManager,\r\n @inject(wccModules.topicsService) private topicsService: TopicsService,\r\n @inject(wccModules.effects) effects: EffectsContainer,\r\n ) {\r\n this.topicId = topicId;\r\n\r\n this.source = effects.register(new CollectionDataSource({\r\n load: this.load.bind(this),\r\n mapper: jsonVote => new ThreadVote(jsonVote)\r\n }));\r\n\r\n this.votes = this.source.list; \r\n\r\n this.loading = ko.pureComputed(() => this.source.busy() && this.source.requestsProcessed() === 0);\r\n this.updating = ko.pureComputed(() => this.source.busy() && this.source.requestsProcessed() > 0);\r\n\r\n const ideationManager = storage.get(IdeationManager, { topicId: topicId });\r\n const isVotingStage = ideationManager.pluck(m => m.isVotingStage, false);\r\n\r\n //we're inside voting stage so any replies changes require votes update\r\n effects.register(isVotingStage => {\r\n if (isVotingStage) {\r\n return withEffect([\r\n events.replyAdded.on(this.onLocalReplyAdded.bind(this)),\r\n events.replyUpdated.on(this.onLocalReplyUpdated.bind(this)),\r\n events.replyDeleted.on(this.onLocalReplyDeleted.bind(this))\r\n ]);\r\n }\r\n }, [isVotingStage]);\r\n }\r\n\r\n update() {\r\n this.source.load();\r\n }\r\n\r\n private load() {\r\n return this.topicsService.queries.votes(this.topicId).toArray();\r\n }\r\n\r\n private onLocalReplyAdded(topicId: string) {\r\n if (this.topicId == topicId)\r\n this.update();\r\n }\r\n\r\n private onLocalReplyUpdated(topicId: string) {\r\n if (this.topicId == topicId)\r\n this.update();\r\n }\r\n\r\n private onLocalReplyDeleted(topicId: string) {\r\n if (this.topicId == topicId)\r\n this.update();\r\n }\r\n}","import { Observable } from 'knockout';\r\nimport WCCEntity from './entity';\r\n\r\nexport interface JSONThreadVote {\r\n PersonId: string,\r\n ThreadId: string,\r\n VoteValue: number,\r\n LinkedThreadId: string\r\n}\r\n\r\nexport default class ThreadVote extends WCCEntity {\r\n personId: Observable\r\n threadId: Observable\r\n value: Observable\r\n linkedThreadId: Observable\r\n\r\n constructor(json: JSONThreadVote) {\r\n super();\r\n\r\n this.personId = this.createField(json, 'PersonId');\r\n this.threadId = this.createField(json, 'ThreadId');\r\n this.value = this.createField(json, 'VoteValue', 0);\r\n this.linkedThreadId = this.createField(json, 'LinkedThreadId');\r\n }\r\n}","define(function () {\r\n const system = require('helpers/system').SystemHelpers;\r\n\r\n return function (html) {\r\n system.getTemplatesAndResources(html)\r\n .forEach(function (node) { document.head.appendChild(node) });\r\n }\r\n});","// Imports\nvar ___CSS_LOADER_API_IMPORT___ = require(\"../../../../node_modules/css-loader/dist/runtime/api.js\");\nexports = ___CSS_LOADER_API_IMPORT___(false);\n// Module\nexports.push([module.id, \".topic__comments{display:block}.topic__comments__new-count{padding:10px;margin-bottom:10px;background-color:#dd5454;border:1px solid #f16c6c;color:#fff;text-align:center;cursor:pointer}.topic__comments__message{padding:50px 0;text-align:center;font-size:21px;color:#c6c6c6;text-shadow:0 0 3px #262626}.topic__comments__message .glyphicons{font-size:80px;margin-bottom:5px}.topic__comments__page-spinner{margin-top:20px}\", \"\"]);\n// Exports\nmodule.exports = exports;\n","// Module\nvar code = \"\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\\r\\n\";\n// Exports\nmodule.exports = code;"],"sourceRoot":""}