{"version":3,"sources":["Pages/Search/SearchResult.js"],"names":["xhr","Dialog","SearchResult","previewDialog","previewContentTitle","previewContent","previewLink","notLoggedInDialog","notLoggedInLink","currentSubscription","isTeacher","maxFilesPerLesson","appInsights","searchId","searchServiceName","_previewContentTitle","_previewDialog","oncreated","_OnPreviewDialogCreation","bind","_notLoggedInDialog","_previewContent","_isTeacher","_accessLevel","_appInsights","_searchId","_searchServiceName","searchSelect","document","getElementById","options","selectedIndex","value","style","width","notLoggedInLinks","querySelectorAll","i","length","addEventListener","e","open","window","pageYOffset","documentElement","scrollTop","body","preventDefault","stopPropagation","previewlinks","_onPreviewClick","downloadButtons","_downloadClick","_downloadDialog","onbeforeshow","dialog","container","then","data","downloadCount","querySelector","textContent","parentNode","removeChild","downloadButton","_assetDownloadClickListener","target","method","JSON","stringify","dataset","assetId","close","location","linkEvent","returnValue","lessonId","id","searchRefinePageSizeElement","searchRefinePageIndexElement","form","facetSelection","deleteFacetValue","hideToMeCheckbox","searchRefinePageSizeParameters","searchRefinePageIndexParameters","m","searchDeleteFacetValueParameters","d","facetValueParameters","j","facetValueSelected","Array","submitButton","_onHideToMeCheckboxChange","checked","_curriculumSearchPostMethod","_onHideCoverChange","submit","onchange","onclick","pageindex","index","findIndex","existingValue","parentElement","name","splice","classList","contains","push","remove","includes","add","curriculumImgDiv","_onCurriculumImgClick","url","closest","assign","_previewContentContainer","messageToDispay","iconClass","loader","createElement","icon","setAttribute","appendChild","createTextNode","fc","firstChild","className","prefacediv","assetUrl","iframe","type","fileToPlay","playerControl","source","curriculumAccessLevel","undefined","sliderDivIndex","console","log","_clearPreviewContent","_createMessageDiv","assetid","attributes","_isDownloadAllowed","_checkWhetherHasAccess","assetName","score","trackEvent","SearchServiceName","SearchId","ClickedDocName","Rank","asset","extension","toLowerCase","encodedAssetUrl","encodeURIComponent","_createIframe","_createPrefaceDiv","img","_createPlayer","message","link","linkText","noPreviewClass","createAttribute","setAttributeNode","messageContainer","noPreviewTextClass","anchor","click"],"m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T,GAAiB,KAAjB;AACH;;AAED,4BAAIJ,SAASgC,aAAT,CAAuB,WAAvB,CAAJ,EACIhC,SAASgC,aAAT,CAAuB,WAAvB,EAAoC5B,KAApC,GAA4C,IAA5C;;AAEJ,6BAAKgE,2BAAL;AACH;;;kEAE6B;AAC1BpE,iCAASC,cAAT,CAAwB,YAAxB,EAAsCiJ,KAAtC;AACH;;;;;;oCAGI5K,Y","file":"SearchResult.js","sourcesContent":["import { xhr } from \"../../Components/Ajax.js\";\r\nimport { Dialog } from \"../../Components/Dialog.js\";\r\n\r\nclass SearchResult {\r\n //initializePreviewResources(\"preview-resources\", \"preview-content-title\", \".preview-link\");\r\n initializePreviewResources(previewDialog, previewContentTitle, previewContent, previewLink, notLoggedInDialog, notLoggedInLink, currentSubscription, isTeacher, maxFilesPerLesson, appInsights, searchId, searchServiceName) {\r\n\r\n this._previewContentTitle = previewContentTitle;\r\n this._previewDialog = new Dialog(previewDialog);\r\n this._previewDialog.oncreated = this._OnPreviewDialogCreation.bind(this);\r\n this._notLoggedInDialog = new Dialog(notLoggedInDialog);\r\n this._previewContent = previewContent;\r\n this._isTeacher = isTeacher;\r\n this._accessLevel = currentSubscription;\r\n this._appInsights = appInsights;\r\n this._searchId = searchId;\r\n this._searchServiceName = searchServiceName;\r\n\r\n var searchSelect = document.getElementById(\"search-select\");\r\n if (searchSelect.options[searchSelect.selectedIndex].value == \"lessonsOnly\") {\r\n searchSelect.style.width = \"100px\";\r\n }\r\n else if (searchSelect.options[searchSelect.selectedIndex].value == \"assetsOnly\") {\r\n searchSelect.style.width = \"115px\";\r\n } else {\r\n searchSelect.style.width = \"80px\";\r\n }\r\n\r\n var notLoggedInLinks = document.querySelectorAll(notLoggedInLink);\r\n if (notLoggedInLinks) {\r\n for (var i = 0; i < notLoggedInLinks.length; i++) {\r\n notLoggedInLinks[i].addEventListener('click', (function (e) {\r\n this._notLoggedInDialog.open();\r\n if (window.pageYOffset || document.documentElement.scrollTop != 0) {\r\n document.documentElement.scrollTop = 0;\r\n document.body.scrollTop = 0\r\n }\r\n e.preventDefault();\r\n e.stopPropagation();\r\n }).bind(this));\r\n }\r\n }\r\n\r\n var previewlinks = document.querySelectorAll(previewLink);\r\n if (previewlinks) {\r\n for (var i = 0; i < previewlinks.length; i++) {\r\n previewlinks[i].addEventListener('click', this._onPreviewClick.bind(this));\r\n }\r\n }\r\n\r\n let downloadButtons = document.querySelectorAll(`[class=\"resource-download-button\"]`);\r\n for (let i = 0; i < downloadButtons.length; i++) {\r\n downloadButtons[i].addEventListener('click', this._downloadClick.bind(this), false);\r\n }\r\n\r\n this._downloadDialog = new Dialog(\"trial-limit-download\");\r\n\r\n this._downloadDialog.onbeforeshow = (dialog, container) => {\r\n if (window.pageYOffset || document.documentElement.scrollTop != 0) {\r\n document.documentElement.scrollTop = 0;\r\n document.body.scrollTop = 0\r\n }\r\n xhr(\"/account/trial-download-limit\").then(data => {\r\n if (data.downloadCount > 0) {\r\n container.querySelector(`[id=\"remainingCount\"]`).textContent = data.downloadCount;\r\n }\r\n else {\r\n if (this._isTeacher === \"True\") {\r\n container.querySelector(`[id=\"trial-limit-download-description\"]`)\r\n .textContent = `During your trial on Disciplr, you are limited to downloading 10 lessons. You have already downloaded 10 resources! Contact your administrator to upgrade for unlimited printing and downloading!`;\r\n container.querySelector(`[id=\"dialog-download-button\"]`) !== null ? container.querySelector(`[id=\"dialog-download-button\"]`).parentNode.removeChild(container.querySelector(`[id=\"dialog-download-button\"]`)) : \"\";\r\n }\r\n else {\r\n container.querySelector(`[id=\"trial-limit-download-description\"]`)\r\n .textContent = `During your trial on Disciplr, you are limited to downloading 10 lessons. You have already downloaded 10 resources! Upgrade today for unlimited printing and downloading!`;\r\n container.querySelector(`[id=\"dialog-download-button\"]`).textContent = \"Upgrade Now\";\r\n }\r\n }\r\n });\r\n\r\n return true;\r\n }\r\n\r\n this._downloadDialog.oncreated = (dialog, container) => {\r\n let downloadButton = container.querySelector(`[id=\"dialog-download-button\"]`);\r\n downloadButton != null ? downloadButton.addEventListener('click', this._assetDownloadClickListener.bind(this), false) : \"\";\r\n }\r\n }\r\n\r\n _assetDownloadClickListener(e) {\r\n if (e.target.textContent === \"Download\") {\r\n const options = {\r\n method: \"POST\",\r\n data: JSON.stringify({ \"itemId\": e.target.dataset.assetId, \"type\": \"ResourceDownload\" })\r\n };\r\n xhr(\"/account/save-trial-limits\", options).then(data => {\r\n if (data === true) {\r\n this._downloadDialog.close();\r\n window.open(\"/asset/\" + e.target.dataset.assetId + \"/download\", '_blank');\r\n\r\n }\r\n });\r\n }\r\n else {\r\n window.location = \"/account/subscription\";\r\n }\r\n }\r\n\r\n _downloadClick(linkEvent) {\r\n if (linkEvent.preventDefault)\r\n linkEvent.preventDefault();\r\n linkEvent.returnValue = false;\r\n this._downloadDialog.open();\r\n document.getElementById(\"dialog-download-button\").dataset.lessonId = linkEvent.target.dataset.lessonId;\r\n document.getElementById('dialog-download-button').dataset.assetId = linkEvent.target.id;\r\n }\r\n\r\n initializeSearchResults(searchRefinePageSizeElement, searchRefinePageIndexElement, form, facetSelection, deleteFacetValue, hideToMeCheckbox) {\r\n\r\n let searchRefinePageSizeParameters = document.querySelectorAll(searchRefinePageSizeElement), i;\r\n let searchRefinePageIndexParameters = document.querySelectorAll(searchRefinePageIndexElement), m;\r\n let searchDeleteFacetValueParameters = document.querySelectorAll(deleteFacetValue), d;\r\n let facetValueParameters = document.querySelectorAll(facetSelection), j;\r\n\r\n\r\n let facetValueSelected = new Array();\r\n\r\n let submitButton = document.getElementById(form).querySelector(\"button[type='submit']\");\r\n\r\n if (document.querySelector(hideToMeCheckbox))\r\n document.querySelector(hideToMeCheckbox).addEventListener('change', this._onHideToMeCheckboxChange.bind(this));\r\n\r\n if (document.querySelector('#onlyLessons'))\r\n document.querySelector('#onlyLessons').addEventListener('change', (function (e) {\r\n if (e.target.checked) {\r\n e.target.value = true;\r\n } else {\r\n e.target.value = false;\r\n }\r\n\r\n document.querySelector('.pageindex').value = \"1\";\r\n this._curriculumSearchPostMethod();\r\n }).bind(this)\r\n );\r\n\r\n if (document.querySelector('#hideCoverImages'))\r\n document.querySelector('#hideCoverImages').addEventListener('change', this._onHideCoverChange.bind(this));\r\n\r\n if (document.querySelector('#clearFilters')) {\r\n document.querySelector('#clearFilters').addEventListener('click', function () {\r\n document.getElementById(\"facetValues\").value = '';\r\n document.querySelector('.pageindex').value = \"1\";\r\n document.getElementById(form).submit();\r\n });\r\n }\r\n\r\n\r\n for (i = 0; i < searchRefinePageSizeParameters.length; ++i) {\r\n\r\n searchRefinePageSizeParameters[i].onchange = (e) => {\r\n\r\n document.querySelector('.pageindex').value = \"1\";\r\n\r\n document.getElementById(\"facetValues\").value = facetValueSelected;\r\n document.getElementById(form).submit();\r\n };\r\n }\r\n\r\n for (m = 0; m < searchRefinePageIndexParameters.length; ++m) {\r\n\r\n searchRefinePageIndexParameters[m].onclick = (e) => {\r\n\r\n var value = e.target.dataset.pageindex;\r\n document.querySelector('.pageindex').value = value;\r\n\r\n document.getElementById(\"facetValues\").value = facetValueSelected;\r\n document.getElementById(form).submit();\r\n };\r\n }\r\n\r\n for (d = 0; d < searchDeleteFacetValueParameters.length; ++d) {\r\n searchDeleteFacetValueParameters[d].onclick = (e) => {\r\n let index = facetValueSelected.findIndex((existingValue) => existingValue == e.target.parentElement.name);\r\n facetValueSelected.splice(index, 1);\r\n document.querySelector('.pageindex').value = \"1\";\r\n if (document.querySelector('.pagesize'))\r\n document.querySelector('.pagesize').value = \"10\";\r\n document.getElementById(\"facetValues\").value = facetValueSelected;\r\n this._curriculumSearchPostMethod();\r\n };\r\n }\r\n\r\n for (j = 0; j < facetValueParameters.length; ++j) {\r\n\r\n if (facetValueParameters[j].classList.contains(\"selected\")) {\r\n facetValueSelected.push(facetValueParameters[j].name);\r\n }\r\n\r\n facetValueParameters[j].onclick = (e) => {\r\n document.querySelector('.pageindex').value = \"1\";\r\n if (document.querySelector('.pagesize'))\r\n document.querySelector('.pagesize').value = \"10\";\r\n\r\n if (e.target.classList.contains(\"selected\")) {\r\n let index = facetValueSelected.findIndex((existingValue) => existingValue == e.target.name);\r\n facetValueSelected.splice(index, 1);\r\n e.target.classList.remove(\"selected\")\r\n } else {\r\n if (e.target.name.includes(\"accessLevel\")) {\r\n for (var i = facetValueSelected.length - 1; i >= 0; i--) {\r\n if (facetValueSelected[i].includes(\"accessLevel\")) {\r\n facetValueSelected.splice(i, 1);\r\n }\r\n }\r\n facetValueSelected.push(e.target.name);\r\n e.target.classList.add(\"selected\")\r\n }\r\n else {\r\n facetValueSelected.push(e.target.name);\r\n e.target.classList.add(\"selected\")\r\n }\r\n }\r\n document.getElementById(\"facetValues\").value = facetValueSelected;\r\n this._curriculumSearchPostMethod();\r\n };\r\n }\r\n \r\n var curriculumImgDiv = document.querySelectorAll(\".curriculumImg\");\r\n for (let i = 0; i < curriculumImgDiv.length; i++){\r\n curriculumImgDiv[i].addEventListener('click', this._onCurriculumImgClick.bind(this))\r\n }\r\n }\r\n\r\n _onCurriculumImgClick(e) {\r\n var url = e.target.closest(\".curriculumImg\").dataset.url;\r\n if (url != null) \r\n window.location.assign(url);\r\n \r\n }\r\n\r\n _OnPreviewDialogCreation(dialog, container) {\r\n this._previewContentContainer = container.querySelector(this._previewContent);\r\n }\r\n\r\n _createMessageDiv(messageToDispay, iconClass) {\r\n var loader = document.createElement(\"div\");\r\n loader.classList.add(\"loader\");\r\n var icon = document.createElement(\"i\");\r\n icon.setAttribute(\"class\", iconClass);\r\n loader.appendChild(icon);\r\n loader.appendChild(document.createTextNode(messageToDispay));\r\n return loader;\r\n }\r\n\r\n _clearPreviewContent() {\r\n if (this._previewContentContainer) {\r\n var fc = this._previewContentContainer.firstChild;\r\n while (fc) {\r\n this._previewContentContainer.removeChild(fc);\r\n fc = this._previewContentContainer.firstChild;\r\n }\r\n }\r\n }\r\n\r\n _createPrefaceDiv(className) {\r\n var prefacediv = document.createElement(\"div\");\r\n prefacediv.setAttribute(\"id\", className);\r\n return prefacediv;\r\n }\r\n\r\n _createIframe(assetUrl) {\r\n var iframe = document.createElement(\"iframe\");\r\n iframe.setAttribute(\"src\", assetUrl);\r\n iframe.setAttribute(\"width\", \"100%\");\r\n iframe.setAttribute(\"height\", \"300px\");\r\n iframe.setAttribute(\"frameborder\", 0);\r\n iframe.setAttribute(\"scrolling\", \"no\");\r\n return iframe;\r\n }\r\n\r\n _createPlayer(type, fileToPlay) {\r\n var playerControl = document.createElement(type);\r\n playerControl.setAttribute(\"width\", \"100%\");\r\n playerControl.setAttribute(\"height\", \"300px\");\r\n playerControl.setAttribute(\"autobuffer\", \"\");\r\n playerControl.setAttribute(\"controls\", \"\");\r\n playerControl.setAttribute(\"controlslist\", \"nodownload\");\r\n playerControl.setAttribute(\"autoplay\", \"\");\r\n\r\n var source = document.createElement(\"source\");\r\n source.setAttribute(\"src\", fileToPlay);\r\n playerControl.appendChild(source);\r\n\r\n return playerControl;\r\n }\r\n\r\n _checkWhetherHasAccess(curriculumAccessLevel) {\r\n if (this._accessLevel == \"T1\" || this._accessLevel == \"T2\")\r\n return false;\r\n\r\n if (curriculumAccessLevel == \"L1\" || curriculumAccessLevel == undefined || curriculumAccessLevel == \"\" || curriculumAccessLevel == \"T2\")\r\n return true\r\n\r\n if (curriculumAccessLevel)\r\n return this._accessLevel >= curriculumAccessLevel;\r\n else\r\n return true;\r\n }\r\n\r\n _onPreviewClick(e) {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n var sliderDivIndex = 0;\r\n console.log(\"on preview click\");\r\n this._previewDialog.open();\r\n if (window.pageYOffset || document.documentElement.scrollTop != 0) {\r\n document.documentElement.scrollTop = 0;\r\n document.body.scrollTop = 0\r\n }\r\n\r\n this._clearPreviewContent();\r\n this._previewContentContainer.appendChild(this._createMessageDiv(\" Loading Preview Content\", \"fa fa- spinner fa- spin fa- fw\"));\r\n\r\n var assetid = e.target.attributes[\"asset-id\"].value;\r\n var curriculumAccessLevel = e.target.attributes[\"access-level\"].value;\r\n this._isDownloadAllowed = this._checkWhetherHasAccess(curriculumAccessLevel);\r\n\r\n var assetName = e.target.attributes[\"asset-name\"].value;\r\n var score = e.target.attributes[\"asset-score\"].value;\r\n this._appInsights.trackEvent('Click', {\r\n SearchServiceName: this._searchServiceName,\r\n SearchId: this._searchId,\r\n ClickedDocName: assetName,\r\n Rank: score\r\n });\r\n\r\n xhr(\"/asset/\" + assetid + \"/preview\", {})\r\n .then(asset => {\r\n document.getElementById(this._previewContentTitle).textContent = asset.name;\r\n document.getElementById(this._previewContentTitle).setAttribute(\"title\", asset.name);\r\n this._clearPreviewContent();\r\n\r\n switch (asset.extension.toLowerCase()) {\r\n case \"ppt\":\r\n case \"pptx\":\r\n case \"doc\":\r\n case \"docx\":\r\n\r\n var encodedAssetUrl = encodeURIComponent(asset.url);\r\n if (!this._isDownloadAllowed) {\r\n var iframe = this._createIframe(`https://docs.google.com/viewer?url=${encodedAssetUrl}&embedded=true`);\r\n this._previewContentContainer.appendChild(iframe);\r\n this._previewContentContainer.appendChild(this._createPrefaceDiv(\"preface-pdf\"));\r\n }\r\n else {\r\n var iframe = this._createIframe(`https://view.officeapps.live.com/op/embed.aspx?src=${encodedAssetUrl}&wdStartOn=1&wdPrint=0&wdEmbedCode=0`);\r\n this._previewContentContainer.appendChild(iframe);\r\n }\r\n break;\r\n case \"tif\":\r\n case \"jpg\":\r\n case \"jpeg\":\r\n case \"png\":\r\n case \"svg\":\r\n case \"gif\":\r\n var img = document.createElement(\"img\");\r\n img.setAttribute(\"src\", asset.url);\r\n img.setAttribute(\"style\", \"width:auto; height:auto; max-height:32rem;max-width:100%;\");\r\n this._previewContentContainer.appendChild(img);\r\n\r\n if (!this._isDownloadAllowed) {\r\n this._previewContentContainer.appendChild(this._createPrefaceDiv(\"preface-image\"));\r\n }\r\n break;\r\n\r\n case \"rtf\":\r\n case \"pdf\":\r\n var encodedAssetUrl = encodeURIComponent(asset.url);\r\n var iframe = this._createIframe(`https://docs.google.com/viewer?url=${encodedAssetUrl}&embedded=true`);\r\n this._previewContentContainer.appendChild(iframe);\r\n\r\n if (!this._isDownloadAllowed) {\r\n this._previewContentContainer.appendChild(this._createPrefaceDiv(\"preface-pdf\"));\r\n }\r\n break;\r\n\r\n case \"mp4\":\r\n case \"wmv\":\r\n case \"mkv\":\r\n case \"m4v\":\r\n case \"video\":\r\n case \"mpg\":\r\n case \"mpeg\":\r\n case \"mov\":\r\n\r\n if (asset.source == \"aws\") {\r\n this._previewContentContainer.appendChild(this._createPlayer(\"video\", asset.url));\r\n }\r\n else {\r\n var iframe = this._createIframe(`${asset.url}?autoPlay=true`);\r\n iframe.setAttribute(\"class\", \"sproutvideo-player\");\r\n this._previewContentContainer.appendChild(iframe);\r\n }\r\n break;\r\n\r\n case \"mp3\":\r\n case \"wav\":\r\n this._previewContentContainer.appendChild(this._createPlayer(\"audio\", asset.url));\r\n break;\r\n\r\n default:\r\n var message = '';\r\n var link = '';\r\n var linkText = '';\r\n if (!this._isDownloadAllowed) {\r\n message = 'No preview available for this resource. Please download to view or contact our Customer Care Team for assistance.';\r\n link = 'mailto:support@disciplr.com';\r\n linkText = ' contact our Customer Care Team';\r\n } else {\r\n message = 'No preview available for this resource. Please contact our Ministry Solutions Team for assistance.';\r\n link = 'mailto:ministrysolutions@disciplr.com';\r\n linkText = ' contact our Ministry Solutions Team';\r\n }\r\n\r\n var loader = document.createElement(\"div\");\r\n var noPreviewClass = document.createAttribute(\"class\");\r\n noPreviewClass.value = \"noPreviewContainer\";\r\n loader.setAttributeNode(noPreviewClass);\r\n var messageContainer = document.createElement(\"p\");\r\n var noPreviewTextClass = document.createAttribute(\"class\");\r\n noPreviewTextClass.value = \"noPreviewText\";\r\n messageContainer.setAttributeNode(noPreviewTextClass);\r\n messageContainer.appendChild(document.createTextNode(message));\r\n loader.appendChild(messageContainer);\r\n if (this._isTeacher != \"True\") {\r\n var anchor = document.createElement(\"a\");\r\n anchor.setAttribute(\"href\", link);\r\n anchor.appendChild(document.createTextNode(linkText));\r\n loader.appendChild(anchor);\r\n }\r\n this._previewContentContainer.appendChild(loader);\r\n break;\r\n }\r\n\r\n }, (xhr) => {\r\n this._clearPreviewContent();\r\n this._previewContentContainer.appendChild(this._createMessageDiv(\" Preview not available\", \"fa fa-meh-o\"));\r\n window.location = \"/spaces\";\r\n })\r\n .then(() => {\r\n\r\n });\r\n }\r\n\r\n _onHideToMeCheckboxChange(e) {\r\n if (e.target.checked) {\r\n e.target.value = true;\r\n } else {\r\n e.target.value = false;\r\n }\r\n document.querySelector('.pageindex').value = \"1\";\r\n if (document.querySelector('.pagesize'))\r\n document.querySelector('.pagesize').value = \"10\";\r\n this._curriculumSearchPostMethod();\r\n }\r\n\r\n _onHideCoverChange(e) {\r\n if (e.target.checked) {\r\n e.target.value = true;\r\n\r\n } else {\r\n e.target.value = false;\r\n }\r\n\r\n if (document.querySelector('.pagesize'))\r\n document.querySelector('.pagesize').value = \"10\";\r\n\r\n this._curriculumSearchPostMethod();\r\n }\r\n\r\n _curriculumSearchPostMethod() {\r\n document.getElementById(\"formSubmit\").click();\r\n }\r\n}\r\n\r\nexport { SearchResult };\r\n"]}