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AAOtH,GAAG,mBAAmB,KACzBsH,EAAOC,MAAM,WAAWpC,SACpBrF,EAAE,kBAAkBoC,QACpBpC,EAAE,QAAQU,SAAS,cAEvBsG,GAAQ,EAAK,GACf,G","sources":["webpack://@sazka/web/./js/app/tickets/views/lp-win-ticket-partials/win-ticket-articles.ts","webpack://@sazka/web/./js/app/tickets/views/_winning-tickets.ts","webpack://@sazka/web/../../libs/design-system/src/loader/loader.ts","webpack://@sazka/web/../../libs/utils/debounce.ts","webpack://@sazka/web/../../libs/utils/document-ready.ts","webpack://@sazka/web/../../libs/utils/sazka-alert.ts"],"sourcesContent":["import { debounce } from \"@sazka/utils/debounce\";\r\nimport { scrollToAnimated } from \"../../../shared/components/scroll-to-animated\";\r\nimport { sazkaAlert } from \"@sazka/utils/sazka-alert\";\r\nimport { Loader } from \"@sazka/design-system/src/loader/loader\";\r\nimport { ResponsiveUtils } from \"@sazka/utils/responsive-utils\";\r\n\r\nexport class TicketArticles {\r\n root: JQuery = null;\r\n startingIndex = 0;\r\n page = -1;\r\n isRelated = false;\r\n nextAvailable = true;\r\n history = [];\r\n\r\n constructor(rootInit: JQuery) {\r\n this.root = rootInit;\r\n this.isRelated = this.root.hasClass(\"lp-win-ticket-articles-related\");\r\n }\r\n\r\n public init() {\r\n this.loadPage();\r\n\r\n $(window).on(\"resize\", () => {\r\n debounce(() => {\r\n this.loadFromHistory(true);\r\n }, 200);\r\n });\r\n\r\n $(\"#ticket-articles-load-next\").on(\"click\", (e) => {\r\n if ($(e.currentTarget).hasClass(\"loading\")) {\r\n e.preventDefault();\r\n } else {\r\n if (this.history[this.page + 1]) {\r\n this.page++;\r\n this.loadFromHistory();\r\n } else {\r\n this.loadPage();\r\n }\r\n }\r\n });\r\n\r\n $(\"#ticket-articles-load-prev\").on(\"click\", () => {\r\n this.page--;\r\n this.loadFromHistory();\r\n });\r\n\r\n $(\"#ticket-articles-load-home\").on(\"click\", () => {\r\n this.page = 0;\r\n this.loadFromHistory();\r\n });\r\n }\r\n\r\n public loadPage() {\r\n $(\"#ticket-articles-load-next\").addClass(\"loading\");\r\n if (!this.isRelated) {\r\n Loader.show(500);\r\n }\r\n this.page++;\r\n $.ajax({\r\n type: \"POST\",\r\n contentType: \"application/json; charset=utf-8\",\r\n dataType: \"json\",\r\n url: \"/api/ticket-article\",\r\n data: JSON.stringify({\r\n pageSize: this.getPageSizeByResolution(this.page),\r\n startingIndex: this.startingIndex,\r\n relatedTo: this.isRelated ? environment.nodeId.toString() : null,\r\n }),\r\n success: (result) => this.loadSuccess(result),\r\n error: this.loadError,\r\n });\r\n }\r\n\r\n public loadSuccess(result) {\r\n Loader.hide();\r\n $(\"#ticket-articles-load-next\").removeClass(\"loading\");\r\n const animate = this.history.length;\r\n\r\n if (result.articles) {\r\n let html = \"\";\r\n for (let i = 0; i < result.articles.length; i++) {\r\n result.articles[i].html = this.markup(result.articles[i], this.page == 0 && i == 0);\r\n html += result.articles[i].html;\r\n }\r\n\r\n this.startingIndex += result.articles.length;\r\n\r\n this.history[this.page] = {\r\n current: result.articles.length ? JSON.parse(JSON.stringify(result.articles)) : [],\r\n };\r\n\r\n this.root.html(html);\r\n this.nextAvailable = result.nextAvailable;\r\n\r\n this.history[this.page].nextAvailable = this.nextAvailable;\r\n\r\n if (animate) {\r\n scrollToAnimated(\".ticket-office\", -30);\r\n }\r\n\r\n this.updatePager();\r\n }\r\n }\r\n\r\n public loadFromHistory(dontAnimate = true) {\r\n const items = JSON.parse(JSON.stringify(this.history[this.page].current));\r\n\r\n let html = \"\";\r\n for (const element of items) {\r\n html += element.html;\r\n }\r\n if (items?.length) {\r\n this.root.html(html);\r\n }\r\n this.nextAvailable = this.history[this.page].nextAvailable;\r\n this.updatePager();\r\n if (!dontAnimate) {\r\n scrollToAnimated(\"#ticket-articles\", -30);\r\n }\r\n }\r\n\r\n public loadError() {\r\n this.page--;\r\n Loader.hide();\r\n $(\"#ticket-articles-load-next\").removeClass(\"loading\");\r\n sazkaAlert(\r\n \"Nastal problĂ©m\",\r\n \"Omlouváme se, ale došlo k problĂ©mu pĹ™i naÄŤĂtánĂ ÄŤlánku. Zkuste to prosĂm pozdÄ›ji.\"\r\n );\r\n }\r\n\r\n public markup(item, isFirst) {\r\n return `\r\n <div class=\"ticket-article-preview${isFirst ? \" double\" : \"\"}\">\r\n <a href=\"${item.url}\" class=\"content\">\r\n ${\r\n item.winLabel\r\n ? `\r\n <span class=\"card-tag\">\r\n <span class=\"tag-inner\">${item.winLabel}</span>\r\n </span>`\r\n : \"\"\r\n }\r\n <div class=\"inner\">\r\n <img src=\"${item.imageUrl}\" class=\"image\" data-object-fit alt=\"${item.title}\">\r\n <div class=\"ticket-preview\"><span class=\"bg\" style=\"background-color: ${\r\n item.bgColor\r\n };\"></span><img src=\"${item.ticketImageUrl}\" alt=\"Náhled vĂ˝hernĂho losu\"/></div>\r\n <div class=\"article-content\">${item.title}\r\n <div class=\"article-perex\">${item.perex}</div>\r\n </div>\r\n\r\n </div>\r\n </a>\r\n </div>`;\r\n }\r\n\r\n public getPageSizeByResolution(page) {\r\n const isFirst = page == 0;\r\n if (ResponsiveUtils.breakpointUp(\"lg\")) {\r\n return this.isRelated ? 5 : isFirst ? 9 : 10;\r\n } else if (ResponsiveUtils.breakpointUp(\"md\")) {\r\n return this.isRelated ? 4 : isFirst ? 7 : 8;\r\n } else if (ResponsiveUtils.breakpointUp(\"sm2\")) {\r\n return this.isRelated ? 3 : isFirst ? 5 : 6;\r\n } else if (ResponsiveUtils.breakpointUp(\"sm\")) {\r\n return this.isRelated ? 2 : isFirst ? 5 : 6;\r\n } else {\r\n return 3;\r\n }\r\n }\r\n\r\n public updatePager() {\r\n const home = $(\"#ticket-articles-load-home\");\r\n const prev = $(\"#ticket-articles-load-prev\");\r\n const next = $(\"#ticket-articles-load-next\");\r\n\r\n if (this.page == 0) {\r\n home.addClass(\"d-none\");\r\n prev.addClass(\"d-none\");\r\n } else if (this.page == 1) {\r\n home.addClass(\"d-none\");\r\n prev.removeClass(\"d-none\");\r\n } else {\r\n home.removeClass(\"d-none\");\r\n prev.removeClass(\"d-none\");\r\n }\r\n\r\n if (this.nextAvailable) {\r\n next.removeClass(\"d-none\");\r\n } else {\r\n next.addClass(\"d-none\");\r\n }\r\n }\r\n}\r\n","import { TicketArticles } from \"./lp-win-ticket-partials/win-ticket-articles\";\r\n\r\n$(() => {\r\n const ticketArticlesRoot = $(\"#ticket-articles\");\r\n if (ticketArticlesRoot.length) {\r\n const ticketArticles = new TicketArticles(ticketArticlesRoot);\r\n ticketArticles.init();\r\n }\r\n});\r\n","import { documentReady } from \"@sazka/utils/document-ready\";\r\n\r\ndeclare const environment: any;\r\ntype ColorVariant = \"yellow\" | \"blue\";\r\n\r\n/**\r\n * Loader tells user, he has to wait for some ajax operation\r\n */\r\nexport class Loader {\r\n private static showTimeout: number;\r\n private static hideTimeout: number;\r\n private static lockNumber = 0;\r\n public static get isShown() {\r\n return this.lockNumber > 0;\r\n }\r\n\r\n static {\r\n // loader from backend\r\n if (document.body) {\r\n this.showLoaderFromBackend();\r\n } else {\r\n documentReady(() => {\r\n this.showLoaderFromBackend();\r\n });\r\n }\r\n }\r\n\r\n static showLoaderFromBackend() {\r\n if (document.body.classList.contains(\"loader\")) {\r\n this.lockNumber++;\r\n }\r\n }\r\n\r\n /**\r\n * Shows loader after some time in miliseconds\r\n * This is to reduce flickering when ajax actions are super-fast\r\n *\r\n * @param showLoaderIn Time in miliseconds, after which, loaded will be shown\r\n * @param text Title (waiting message) displayed in loader\r\n */\r\n static show(showLoaderIn = 30, text?: string, aboveAll = false, color: ColorVariant = \"yellow\") {\r\n this.clearTimeout();\r\n this.lockNumber++;\r\n\r\n this.showTimeout = window.setTimeout(() => {\r\n this.showNow(text, aboveAll, true, color);\r\n }, showLoaderIn);\r\n }\r\n\r\n /**\r\n * Shows loader right away\r\n * @param text Title (waiting message) displayed in loader\r\n */\r\n static showNow(text?: string, aboveAll = false, counted = false, color: ColorVariant = \"yellow\") {\r\n if (!counted) {\r\n this.lockNumber++;\r\n }\r\n\r\n if (!environment.isEditMode) {\r\n const loader = document.getElementById(\"loader\");\r\n\r\n if (!loader) return;\r\n\r\n if (aboveAll) {\r\n loader.classList.add(\"loader--above-all\");\r\n } else {\r\n loader.classList.remove(\"loader--above-all\");\r\n }\r\n if (text) {\r\n loader.querySelector(\".loader__text\").textContent = text;\r\n loader.classList.add(\"loader--with-text\");\r\n } else {\r\n loader.querySelector(\".loader__text\").textContent = \"\";\r\n loader.classList.remove(\"loader--with-text\");\r\n }\r\n\r\n if (color === \"blue\") {\r\n loader.classList.add(\"loader--blue\");\r\n }\r\n\r\n document.body.classList.add(\"loader\", \"loader--fade-in\");\r\n this.clearTimeout();\r\n }\r\n }\r\n\r\n /**\r\n * Shows loader after delay with z-index of 9999\r\n * @param text Title (waiting message) displayed in loader\r\n */\r\n static showAboveAll(showLoaderIn = 30, text?: string) {\r\n this.show(showLoaderIn, text, true);\r\n }\r\n\r\n /**\r\n * Shows loader right away with z-index of 9999\r\n * @param text Title (waiting message) displayed in loader\r\n */\r\n static showNowAboveAll(text?: string) {\r\n this.showNow(text, true);\r\n }\r\n\r\n /**\r\n * Hides loader\r\n */\r\n static hide() {\r\n this.lockNumber--;\r\n if (this.lockNumber > 0) return;\r\n\r\n this.clearTimeout();\r\n document.body.classList.remove(\"loader--fade-in\");\r\n this.hideTimeout = window.setTimeout(() => {\r\n document.body.classList.remove(\"loader\");\r\n const loader = document.getElementById(\"loader\");\r\n loader.querySelector(\".loader__text\").textContent = \"\";\r\n loader.classList.remove(\"loader--with-text\");\r\n }, 150);\r\n }\r\n\r\n private static clearTimeout() {\r\n if (this.showTimeout) {\r\n clearTimeout(this.showTimeout);\r\n this.showTimeout = null;\r\n }\r\n if (this.hideTimeout) {\r\n clearTimeout(this.hideTimeout);\r\n this.hideTimeout = null;\r\n }\r\n }\r\n}\r\n","/**\r\n * Debounce function - use like this:\r\n * var handler = debounce(function(){ do the work}, 100);\r\n * $(window).scroll(handler);\r\n * @param func callback function\r\n * @param wait time in milliseconds to wait\r\n * @param immediate\r\n */\r\n\r\ntype CallbackFunction = (...args: any[]) => any;\r\n\r\nexport function debounce<T extends CallbackFunction>(func: T, wait: number, immediate = false) {\r\n let timeout: number | null;\r\n\r\n return function (this: ThisParameterType<T>, ...args: Parameters<T>) {\r\n /* eslint-disable @typescript-eslint/no-this-alias */\r\n const context = this;\r\n const later = function () {\r\n timeout = null;\r\n if (!immediate) func.apply(context, args);\r\n };\r\n const callNow = immediate && !timeout;\r\n clearTimeout(timeout as number);\r\n timeout = window.setTimeout(later, wait);\r\n if (callNow) func.apply(context, args);\r\n };\r\n}\r\n","/**\r\n * Vanila JS variant to jQuery $(() => {}).\r\n * @param {callback} callback\r\n * @example - documentReady(() => {}).\r\n * This function is binding to document.ready\r\n * */\r\nexport function documentReady(callback: () => void) {\r\n if (document.readyState !== \"loading\") {\r\n return callback();\r\n } else {\r\n document.addEventListener(\"DOMContentLoaded\", callback);\r\n }\r\n}\r\n","/**\r\n * @deprecated Use showAlert a DS component\r\n */\r\nexport const sazkaAlert = (\r\n title: string,\r\n text: string = null,\r\n linkText: string = null,\r\n link: string = null,\r\n buttonText = \"OK\",\r\n customHtml = \"\",\r\n hasExtraButton = true,\r\n errorCode?: number\r\n): Promise<boolean> => {\r\n return new Promise((resolve) => {\r\n const heading = $(\r\n `<h2 class=\"sazka-alert__title\" style=\"visibility:hidden; display:inline-block;\">${title}</h2>`\r\n );\r\n $(\"body\").append(heading);\r\n const maxWidth = Math.max(heading.width(), 300);\r\n heading.remove();\r\n\r\n const template = `\r\n <div class=\"modal fade sazka-alert\" tabindex=\"-1\" role=\"dialog\" aria-hidden=\"true\">\r\n <div class=\"modal-dialog modal-dialog-centered\">\r\n <div class=\"modal-content modal-content--without-close\">\r\n ${errorCode ? `<span class='sazka-alert__ecode'>ecode: ${errorCode}</span>` : \"\"}\r\n <h2 class=\"sazka-alert__title\">${title}</h2>\r\n ${text ? `<p class=\"sazka-alert__text\" style=\"max-width: ${maxWidth}px;\">${text}</p>` : \"\"}\r\n <div class=\"sazka-alert__button-group\">\r\n ${linkText ? `<a class=\"btn btn-primary sazka-alert--btn\" href=\"${link}\">${linkText}</a>` : \"\"}\r\n ${\r\n hasExtraButton\r\n ? `<button type=\"button\" class=\"btn ${\r\n linkText ? \"btn-outline-primary\" : \"btn-primary\"\r\n }\" data-dismiss=\"modal\">${buttonText}</button>`\r\n : \"\"\r\n }\r\n </div>\r\n ${customHtml}\r\n </div>\r\n </div>\r\n </div>`;\r\n\r\n const $modal = $(template);\r\n $(\"body\").append($modal);\r\n $modal.modal(\"show\");\r\n $modal.find(\".sazka-alert--btn\").on(\"click\", () => {\r\n resolve(false);\r\n $modal.modal(\"hide\");\r\n });\r\n $modal.on(\"hidden.bs.modal\", () => {\r\n $modal.modal(\"dispose\").remove();\r\n if ($(\".modal:visible\").length) {\r\n $(\"body\").addClass(\"modal-open\");\r\n }\r\n resolve(true);\r\n });\r\n });\r\n};\r\n"],"names":["TicketArticles","constructor","rootInit","_defineProperty","this","root","isRelated","hasClass","init","loadPage","$","window","on","debounce","loadFromHistory","e","currentTarget","preventDefault","history","page","addClass","Loader","show","ajax","type","contentType","dataType","url","data","JSON","stringify","pageSize","getPageSizeByResolution","startingIndex","relatedTo","environment","nodeId","toString","success","result","loadSuccess","error","loadError","hide","removeClass","animate","length","articles","html","i","markup","current","parse","nextAvailable","scrollToAnimated","updatePager","dontAnimate","items","element","sazkaAlert","item","isFirst","winLabel","imageUrl","title","bgColor","ticketImageUrl","perex","ResponsiveUtils","breakpointUp","home","prev","next","ticketArticlesRoot","ticketArticles","isShown","lockNumber","showLoaderFromBackend","document","body","classList","contains","showLoaderIn","text","aboveAll","color","clearTimeout","showTimeout","setTimeout","showNow","counted","isEditMode","loader","getElementById","add","remove","querySelector","textContent","showAboveAll","showNowAboveAll","hideTimeout","_Loader","documentReady","func","wait","immediate","timeout","args","context","later","apply","callNow","callback","readyState","addEventListener","linkText","link","buttonText","customHtml","hasExtraButton","errorCode","Promise","resolve","heading","append","maxWidth","Math","max","width","template","$modal","modal","find"],"sourceRoot":""}