{"version":3,"file":"webinar-list.js","sources":["../../../../src/assets/scripts/webinar-list.entry.js"],"sourcesContent":["window.arjoWebinarListModule =\n window.arjoWebinarListModule ||\n (() => {\n const state = {\n isInitialized: false,\n elements: {},\n };\n\n const classNamePrefix = 'arjo-o-webinar-list';\n\n const setUp = () => {\n const elements = [...document.querySelectorAll(`.${classNamePrefix}`)];\n elements.forEach((element) => {\n const id = element.dataset.listId;\n\n let innerState = {\n domNode: element,\n filterByLv1Category: undefined,\n filterByLv2Category: undefined,\n filterByLv1Label: undefined,\n filterByLv2Label: undefined,\n data: [],\n };\n\n const setData = (data) => {\n innerState.data = [...data];\n };\n\n // get webinar url by country\n const getWebinarUrlByCountry = (webinar, country) => {\n if (!webinar.localUrls) {\n return webinar.url;\n }\n\n return (\n webinar.localUrls[`${country}-${country}`] ||\n webinar.localUrls[`${'en'}-${country}`] ||\n webinar.localUrls[`${webinar.languageCodes && webinar.languageCodes.filter((v) => v !== 'en' && v !== country)[0]}-${country}`]\n );\n };\n\n // get webinar url\n const getWebinarUrl = (webinar, element) => {\n if (!webinar.localUrls) {\n return webinar.url;\n }\n\n let language = element.parentElement.querySelector('.arjo-m-dropdown__options-input[name=\"language\"]:checked')?.value;\n let country = element.parentElement.querySelector('.arjo-m-dropdown__options-input[name=\"country\"]:checked')?.value;\n let newUrl;\n\n switch (true) {\n case !!language && !!country:\n newUrl = webinar.localUrls[`${language}-${country}`] || getWebinarUrlByCountry(webinar, country);\n break;\n case !!language && !country:\n newUrl = webinar.countryCodes && webinar.localUrls[`${language}-${webinar.countryCodes[0]}`];\n break;\n case !language && !!country:\n newUrl = getWebinarUrlByCountry(webinar, country);\n break;\n }\n\n return newUrl || webinar.url;\n };\n\n const createCardHtml = (webinar) => {\n /* webinar schemar\n {\n imageUrl: \"https://qbank.arjo.com/webassets/IMG_5487_Story Portrait.jpg\",\n headerText: \"Hygiene Care: Preventing conflict and improving care for people living with dementia\",\n bodyText: \"The steps in the hygiene process can be overwhelming to a patient or resident with dementia often leading to distressing behaviour and moments of conflict with caregivers. \",\n category: [\"Dementia\"],\n date: \"September 21 | 2021\",\n url: \"/int/academy/webinar/sem-scanner-technology-evaluating-economic-outcomes-in-pi-prevention/\",\n isPastWebinar: true,\n badge: \"Past Webinar\",\n \"video\": {\n \"videoId\": \"u279k1286d\",\n \"isPopover\": true,\n \"stillUrl\": \"https://qbank.arjo.com/webassets/IMG_5487_Story%20Portrait.jpg\"\n },\n cta: {\n text: \"Sign up to watch the webinar\",\n icon: \"/assets/images/icons.svg#arjo-ico-caret-outline-circle\",\n },\n };\n */\n const badgeContent = [];\n\n webinar.languageNames && badgeContent.push(...webinar.languageNames);\n\n // calculation url\n const webinarUrl = getWebinarUrl(webinar, element);\n // end calculation url\n\n const headLeftHtml = `