@everymatrix/blog-articles-grid 1.98.19 → 1.98.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import{r as t,c as i,h as n}from"./index-4af8e775.js";const e={en:{error:"Error",readmore:"Read more"},ro:{error:"Eroare",readmore:"Read more"},fr:{error:"Error",readmore:"Read more"},ar:{error:"خطأ",readmore:"Read more"},hu:{error:"خطأ",readmore:"Tovább olvasom"},hr:{error:"Greška",readmore:"Pročitaj više"},"pt-br":{error:"Erro",readmore:"Ler mais"},"es-mx":{error:"Error",readmore:"Leer más"}},s=(t,i)=>e[void 0!==i&&i in e?i:"en"][t],o="__WIDGET_GLOBAL_STYLE_CACHE__";function r(t,i){if(t){const n=document.createElement("style");n.innerHTML=i,t.appendChild(n)}}function a(t,i){if(!t||!i)return;const n=new URL(i);fetch(n.href).then((t=>t.text())).then((i=>{const n=document.createElement("style");n.innerHTML=i,t&&t.appendChild(n)})).catch((t=>{console.error("There was an error while trying to load client styling from URL",t)}))}function h(t,i,n,e=!1){if(!window.emMessageBus)return;if(!("adoptedStyleSheets"in Document.prototype)||!e)return n=function(t,i){const n=document.createElement("style");return window.emMessageBus.subscribe(i,(i=>{t&&(n.innerHTML=i,t.appendChild(n))}))}(t,i),n;window[o]||(window[o]={}),n=function(t,i){return window.emMessageBus.subscribe(i,(n=>{if(!t)return;const e=t.getRootNode(),s=window[o];let r=s[i]&&s[i].sheet;r?s[i].refCount=s[i].refCount+1:(r=new CSSStyleSheet,r.replaceSync(n),s[i]={sheet:r,refCount:1});const a=e.adoptedStyleSheets||[];a.includes(r)||(e.adoptedStyleSheets=[...a,r])}))}(t,i);const s=n.unsubscribe.bind(n);return n.unsubscribe=()=>{if(window[o][i]){const t=window[o][i];t.refCount>1?t.refCount=t.refCount-1:delete window[o][i]}s()},n}function l(t){return t.includes("android")}const d=class{constructor(e){t(this,e),this.articleActionButton=i(this,"articleActionButton",7),this.lastPage=1,this.isInitialized=!1,this.paginationDefaultStyling="\n div#PaginationContainer {\n justify-content: right;\n }\n .LeftItems button .NavigationButton {\n display: none;\n }\n .LeftItems button:after, .RightItems button:after {\n padding: 7px 12px;\n font-size: 18px;\n font-weight: 700;\n line-height: 46px;\n }\n .LeftItems button:after {\n content: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='1.2em' viewBox='0 0 320 512'%3E%3C!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --%3E%3Cpath d='M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l192 192c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256 246.6 86.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-192 192z'/%3E%3C/svg%3E\");\n }\n .RightItems button:after {\n content: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='1.2em' viewBox='0 0 320 512'%3E%3C!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --%3E%3Cpath d='M310.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L242.7 256 73.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z'/%3E%3C/svg%3E\");\n display: block;\n height: 38px;\n }\n div.LeftItems button, div.RightItems button {\n width: unset;\n height: 40px;\n background-color: #fff;\n color: #000;\n border: 1px solid #000;\n overflow: hidden;\n &:disabled {\n background-color: #989898;\n }\n }\n div.LeftItems button {\n min-width: 60px;\n border-radius: 20px 0 0 20px;\n border-right: 0;\n }\n div.RightItems button {\n display: flex;\n min-width: 100px;\n justify-content: space-evenly;\n align-items: center;\n border-radius: 0 20px 20px 0;\n text-transform: none;\n }\n .RightItems button .NavigationButton {\n padding: 12px 0 12px 12px;\n font-weight: 700;\n }",this.setImage=t=>{let i="";switch(this.device){case"mobile":i=t.sources[0].pictureSource;break;case"tablet":i=t.sources[1].pictureSource;break;case"desktop":i=t.sources[2].pictureSource}return i},this.renderContentConditionally=t=>t&&(!t.includes("<bannermatrix-banner")||this.bannerMatrixReady)?n("div",{class:"BlogContent",innerHTML:t}):null,this.cmsEndpoint=void 0,this.language="en",this.userRoles="everyone",this.cmsEnv="stage",this.mbSource=void 0,this.clientStyling="",this.clientStylingUrl="",this.showPublishingDate=!0,this.showImage=!0,this.showTitle=!0,this.showContent=!0,this.showButton=!0,this.hideError=!1,this.usePostmessage=void 0,this.postMessageEvent="",this.blogsLimit="0",this.paginationActive=void 0,this.arrowsActive=!0,this.secondaryArrowsActive=!1,this.numberedNavActive=!1,this.intlDateTimeFormat="",this.page="1",this.eventId=void 0,this.paginationBlogList={offset:0},this.currentPage=0,this.hasErrors=!1,this.isLoading=!0,this.bannerMatrixReady=!1,this.nextPage="",this.previousPage="",this.device="mobile",this.displayedBlogResponse=void 0,this.paginationBlogResponse=void 0,this.allBlogResponse=void 0,this.totalBlogs=0}getArticleId(t,i,n){var e;this.usePostmessage?window.postMessage({type:this.postMessageEvent,postId:t.toString(),slug:i,customPath:n}):null===(e=this.articleActionButton)||void 0===e||e.emit({postId:t.toString(),slug:i,customPath:n})}handleBannerReady(){this.bannerMatrixReady=!0}watchEndpoint(t,i){this.isInitialized&&(this.currentPage=parseInt(this.page)-1,(t||""===t)&&t!=i&&this.cmsEndpoint&&this.language&&this.getBlogArticleGrid())}handleClientStylingChange(t,i){t!==i&&r(this.stylingContainer,this.clientStyling)}handleClientStylingChangeURL(t,i){t!==i&&this.clientStylingUrl&&a(this.stylingContainer,this.clientStylingUrl)}hpPageChange(t){var i,n;this.paginationBlogList=t.detail,this.currentPage=Math.floor((null===(i=this.paginationBlogList)||void 0===i?void 0:i.offset)/(null===(n=this.paginationBlogList)||void 0===n?void 0:n.limit)),this.page&&(this.currentPage=this.currentPage+ +this.page-1),this.currentPage+1>this.lastPage?this.nextPage=null:this.currentPage<0?this.previousPage=null:(window.postMessage({type:"BlogArticlesGridActivePagination",currentPage:this.currentPage},window.location.href),this.getBlogArticleGrid(!0))}sortArticlesByDate(t){return t.sort(((t,i)=>t.publishingDate>i.publishingDate?-1:t.publishingDate<i.publishingDate?1:0)),t}findLatestFeatured(t){let i=t.filter((t=>t.isFeaturedPost));return 0===i.length?null:(i=this.sortArticlesByDate(i),i[0])}moveLatestFeatureToStart(t,i){if(!i)return t;const n=t.indexOf(i);return-1!==n&&(t.splice(n,1),t.unshift(i)),t}async fetchBlogPosts(t,i=!1){const n=new URL(`${this.cmsEndpoint}/${this.language}/blog-posts`);return n.searchParams.append("per_page",i?"300":this.blogsLimit),n.searchParams.append("page",`${t||this.currentPage+1}`),n.searchParams.append("env",this.cmsEnv),n.searchParams.append("userRoles",this.userRoles),n.searchParams.append("device",(()=>{const t=(()=>{let t=window.navigator.userAgent;return t.toLowerCase().match(/android/i)?"Android":t.toLowerCase().match(/iphone/i)?"iPhone":t.toLowerCase().match(/ipad|ipod/i)?"iPad":"PC"})();if(t){if("PC"===t)return"dk";if("iPad"===t||"iPhone"===t)return"mtWeb"}return"mtWeb"})()),fetch(n.href).then((t=>{if(t.status>=300)throw this.hasErrors=!0,new Error("There was an error while fetching the data");return t.json()})).then((t=>{let n=t.items;const e=this.findLatestFeatured(n);return n=this.sortArticlesByDate(n),n=this.moveLatestFeatureToStart(n,e),n=n.map((t=>Object.assign(Object.assign({},t),{publishingDate:new Date(t.publishingDate).toLocaleDateString()}))),t=Object.assign(Object.assign({},t),{items:n}),i?this.allBlogResponse=t:this.paginationBlogResponse=t,t})).catch((t=>(this.hasErrors=!0,console.log("Error",t),{})))}async getBlogArticleGrid(t=!1,i){var n,e,s,o,r,a,h;this.isLoading=!0;try{let l;if(this.eventId&&this.eventId.length>0){const o=(null===(n=this.allBlogResponse)||void 0===n?void 0:n.items)?this.allBlogResponse:await this.fetchBlogPosts(1,!0),r=o.items.filter((({eventIds:t})=>{var i;return t.includes(null!==(i=this.eventId)&&void 0!==i?i:"-")}));r.length?(l=Object.assign(Object.assign({},o),{items:r,total:Math.min(parseInt(this.blogsLimit),r.length)}),window.postMessage({type:"OP:blogReady",payload:{hasBlog:!0}},"*")):(window.postMessage({type:"OP:blogReady",payload:{hasBlog:!1}},"*"),l=(null===(s=null===(e=this.paginationBlogResponse)||void 0===e?void 0:e.items)||void 0===s?void 0:s.length)&&!t?this.paginationBlogResponse:await this.fetchBlogPosts(i))}else l=(null===(r=null===(o=this.paginationBlogResponse)||void 0===o?void 0:o.items)||void 0===r?void 0:r.length)&&!t?this.paginationBlogResponse:await this.fetchBlogPosts(i);this.displayedBlogResponse=l,this.totalBlogs=l.total,this.lastPage=+((null===(h=null===(a=l.pages.last)||void 0===a?void 0:a.match(/&page=(\d+)/))||void 0===h?void 0:h[1])||1),this.nextPage=l.pages.next,this.previousPage=l.pages.previous,this.isLoading=!1,this.hasErrors=!1}catch(t){this.hasErrors=!0,console.log("Error",t)}}componentWillLoad(){this.cmsEndpoint&&this.language&&this.blogsLimit&&(this.page?(this.currentPage=this.currentPage+ +this.page-1,this.getBlogArticleGrid(!1,+this.page)):this.getBlogArticleGrid())}handleClientStyling(){void 0===window.emMessageBus?(this.clientStyling&&r(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&a(this.stylingContainer,this.clientStylingUrl)):this.stylingSubscription=h(this.stylingContainer,`${this.mbSource}.Style`,this.stylingSubscription,!0)}componentDidLoad(){this.handleClientStyling(),this.isInitialized=!0,window.postMessage({type:"BlogArticlesGridLoaded"},window.location.href),this.device=((t=!1)=>{if("undefined"==typeof window||"undefined"==typeof navigator)return"desktop";const i=navigator.userAgent.toLowerCase(),n=window.innerWidth;if(function(t){return!!t.includes("ipad")||t.includes("macintosh")&&navigator.maxTouchPoints>0}(i))return"tablet";if(function(t){return t.includes("iphone")||t.includes("ipod")}(i))return"mobile";if(function(t,i){return l(t)&&(t.includes("mobile")||t.includes("mobi")||i<=599)}(i,n))return"mobile";if(function(t,i){return l(t)&&!t.includes("mobile")&&!t.includes("mobi")&&i>599}(i,n))return"tablet";if(t){if(n<=599)return"mobile";if(n<=1099)return"tablet"}return"desktop"})()}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}parseDate(t){const i=new Date(t);if(i instanceof Date&&!Number.isNaN(i.getTime()))return i;const[n,e,s]=t.trim().split("/").map(Number);return new Date(s,e-1,n)}formatDate(t){const i=this.parseDate(t);return new Intl.DateTimeFormat(this.intlDateTimeFormat).format(i)}render(){if(this.hasErrors)return n("div",{class:"BlogsContainer"},!this.hideError&&n("div",{class:"ErrorMessage"},s("error",this.language)));const t=[];for(let i=0;i<parseInt(this.blogsLimit);i++)t.push(n("div",{class:"GridContainer FeaturedPost Skeleton"},n("div",{class:"GridWrapper"},n("div",{class:"GridSector"},n("div",{class:"VisualContent LoadingImage"})),n("div",{class:"GridSector"},n("div",{class:"BlogTitle LoadingStripe LoadingSmallStripe"}),n("div",{class:"BlogDetails LoadingStripe LoadingMediumStripe"}),n("div",{class:"BlogLink LoadingStripe LoadingLongStripe"})))));const i=Boolean(this.paginationActive)&&this.totalBlogs>+this.blogsLimit,e=this.mbSource?void 0:this.clientStyling||this.paginationDefaultStyling;return n("div",{ref:t=>this.stylingContainer=t},n("div",{class:"BlogPageContainer"},n("div",{class:"BlogGridPaginationWrapper"},i&&n("helper-pagination",{"next-page":this.nextPage,"prev-page":this.previousPage,offset:this.paginationBlogList.offset,limit:parseInt(this.blogsLimit,10),total:this.totalBlogs,language:this.language,"mb-source":this.mbSource,"client-styling":e,"client-styling-url":this.clientStylingUrl,"arrows-active":this.arrowsActive,"secondary-arrows-active":this.secondaryArrowsActive,"numbered-nav-active":this.numberedNavActive})),!this.isLoading&&n("div",{class:`GridContainerWrapper BlogPage-${this.currentPage} ${this.device}`},this.displayedBlogResponse&&this.displayedBlogResponse.items.map((t=>{var i,e;return n("div",{key:t.postID,class:t.isFeaturedPost?"GridContainer FeaturedPost":"GridContainer"},n("div",{class:"GridWrapper"},n("div",{class:"GridSector"},this.showPublishingDate&&n("div",{class:"BlogDate"},this.formatDate(null==t?void 0:t.publishingDate)),this.showImage&&(null===(i=t.image)||void 0===i?void 0:i.src)?n("div",{class:"VisualContent",style:{background:`url(${this.setImage(t.image)}) no-repeat center center / cover`}}):(null===(e=t.video)||void 0===e?void 0:e.sources[this.device])?n("video",{class:"VisualContent",src:t.video.sources[this.device],controls:!0}):n("h1",{class:"VisualContent",style:{color:"#fff"}},"No Image")),n("div",{class:"GridSector"},this.showTitle&&n("div",{class:"BlogTitle"},null==t?void 0:t.title),this.showContent&&this.renderContentConditionally(null==t?void 0:t.descriptionPreview),this.showButton&&n("div",{class:"BlogLink"},n("button",{onClick:()=>this.getArticleId(null==t?void 0:t.postID,null==t?void 0:t.slug,null==t?void 0:t.customPath)},s("readmore",this.language))))))}))),this.isLoading&&n("div",{class:"GridContainerWrapper LoadingGrid"},t)))}static get watchers(){return{page:["watchEndpoint"],hasErrors:["watchEndpoint"],cmsEndpoint:["watchEndpoint"],language:["watchEndpoint"],cmsEnv:["watchEndpoint"],userRoles:["watchEndpoint"],blogsLimit:["watchEndpoint"],eventId:["watchEndpoint"],clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingChangeURL"]}}};d.style=":host {\n display: block;\n}\n\n.BlogPageContainer {\n background: #0A0A17;\n padding: 20px;\n}\n\n.GridContainerWrapper {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 20px;\n}\n\n.BlogPage-0 .GridContainer.FeaturedPost:first-child {\n width: 100%;\n flex-basis: auto;\n}\n\n.GridContainer {\n container-type: inline-size;\n container-name: article;\n border-radius: 15px;\n color: #000;\n overflow: hidden;\n}\n.GridContainer.FeaturedPost:first-child {\n grid-column: 1/-1;\n width: 100%;\n}\n.GridContainer .GridWrapper {\n display: flex;\n flex-direction: row;\n height: 280px;\n background: var(--emw--color-white, #FFFFFF);\n}\n.GridContainer .GridSector {\n flex-basis: 50%;\n position: relative;\n}\n.GridContainer .GridSector:first-of-type {\n height: 280px;\n display: flex;\n}\n.GridContainer .GridSector:last-of-type {\n padding: 20px 40px;\n display: flex;\n flex-direction: column;\n}\n.GridContainer .VisualContent {\n width: 100%;\n}\n.GridContainer .BlogDate {\n position: absolute;\n bottom: 0px;\n left: 30px;\n font-size: 12px;\n border-radius: 5px 5px 0 0;\n padding: 10px;\n width: fit-content;\n text-align: center;\n color: var(--emw--color-white, #FFFFFF);\n background-color: #CD0B5E;\n z-index: 1;\n}\n.GridContainer .BlogTitle {\n font-size: 24px;\n color: #000;\n padding-bottom: 10px;\n}\n.GridContainer .BlogContent {\n display: -webkit-box;\n font-size: 14px;\n line-height: 1.2em;\n -webkit-line-clamp: 6;\n color: #000;\n -webkit-box-orient: vertical;\n box-sizing: border-box;\n text-overflow: ellipsis;\n overflow: hidden;\n}\n.GridContainer .BlogLink {\n color: #000;\n position: absolute;\n bottom: 16px;\n}\n.GridContainer .BlogLink button {\n font-size: 14px;\n border: none;\n padding: 0;\n background: none;\n color: #22B04E;\n cursor: pointer;\n}\n\n@container article (max-width: 550px) {\n .GridContainer .GridWrapper {\n height: 380px;\n flex-direction: column;\n }\n .GridContainer .GridWrapper .GridSector:first-of-type {\n height: 120px;\n flex-shrink: 0;\n flex-basis: 150px;\n }\n .GridContainer .GridWrapper .GridSector:last-of-type {\n padding: 20px 20px 40px;\n }\n}\n.LoadingImage {\n width: 100%;\n height: 100%;\n background-color: var(--emw--color-gray-100, #E6E6E6);\n}\n\n.LoadingStripe {\n border: 1px solid var(--emw--color-white, #FFFFFF);\n height: 20%;\n background-color: var(--emw--color-gray-100, #E6E6E6);\n margin-bottom: 5px;\n}\n\n.LoadingSmallStripe {\n width: 40%;\n}\n\n.LoadingMediumStripe {\n width: 70%;\n}\n\n.BlogLink.LoadingLongStripe {\n position: static;\n width: 100%;\n}\n\n.GridContainerWrapper.LoadingGrid .GridSector {\n justify-content: space-around;\n}\n\n.GridContainerWrapper.LoadingGrid .LoadingImage, .GridContainerWrapper.LoadingGrid .LoadingStripe {\n animation: pulsatingLoader 2s ease-in-out 0s infinite reverse;\n -webkit-animation: pulsatingLoader 2s ease-in-out 0s infinite reverse;\n}\n\n@keyframes pulsatingLoader {\n 0% {\n opacity: 0.5;\n }\n 50% {\n opacity: 1;\n }\n 100% {\n opacity: 0.5;\n }\n}\n@-webkit-keyframes pulsatingLoader {\n 0% {\n opacity: 0.5;\n }\n 50% {\n opacity: 1;\n }\n 100% {\n opacity: 0.5;\n }\n}";const c=t=>!!(t.toLowerCase().match(/android/i)||t.toLowerCase().match(/blackberry|bb/i)||t.toLowerCase().match(/iphone|ipad|ipod/i)||t.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i)),g={en:{firstPage:"First",previousPage:"Previous",nextPage:"Next",lastPage:"Last"},ro:{firstPage:"Prima",previousPage:"Anterior",nextPage:"Urmatoarea",lastPage:"Ultima"},fr:{firstPage:"First",previousPage:"Previous",nextPage:"Next",lastPage:"Last"},ar:{firstPage:"First",previousPage:"Previous",nextPage:"Next",lastPage:"Last"},hu:{firstPage:"First",previousPage:"Previous",nextPage:"Következő",lastPage:"Last"},hr:{firstPage:"Prva",previousPage:"Prethodna",nextPage:"Slijedeća",lastPage:"Zadnja"}},p=(t,i)=>g[void 0!==i&&i in g?i:"en"][t],u=class{constructor(n){t(this,n),this.hpPageChange=i(this,"hpPageChange",7),this.userAgent=window.navigator.userAgent,this.currentPage=1,this.navigateTo=t=>{var i;switch(t){case"firstPage":this.offsetInt=0;break;case"lastPage":this.offsetInt=this.endInt*this.limitInt;break;case"previousPage":this.offsetInt-=this.limitInt;break;case"nextPage":this.offsetInt+=this.limitInt;break;case"fivePagesBack":this.offsetInt-=5*this.limitInt,this.offsetInt=this.offsetInt<=0?0:this.offsetInt;break;case"fivePagesForward":this.offsetInt+=5*this.limitInt,this.offsetInt=this.offsetInt/this.limitInt>=this.endInt?this.endInt*this.limitInt:this.offsetInt}this.previousPage=!!this.offsetInt,null===(i=this.hpPageChange)||void 0===i||i.emit({offset:this.offsetInt,limit:this.limitInt,total:this.totalInt})},this.paginationNavigation=(t,i)=>{var n;this.previousPage=!0,isNaN(t)?0===i&&this.currentPage<=4?this.navigateTo("firstPage"):0===i&&this.currentPage>4?this.navigateTo("fivePagesBack"):4===i&&this.endInt-this.currentPage>=2&&this.navigateTo("fivePagesForward"):1===t?(this.offsetInt=t-1,this.previousPage=!1):this.offsetInt=(t-1)*this.limitInt,null===(n=this.hpPageChange)||void 0===n||n.emit({offset:this.offsetInt,limit:this.limitInt,total:this.totalInt})},this.nextPage="",this.prevPage="",this.offset=0,this.limit=1,this.total=1,this.language="en",this.mbSource=void 0,this.clientStyling="",this.clientStylingUrl="",this.arrowsActive=!0,this.secondaryArrowsActive=!1,this.numberedNavActive=!1,this.offsetInt=0,this.lastPage=!1,this.previousPage=!1,this.limitInt=0,this.totalInt=0,this.pagesArray=[],this.endInt=0}handleClientStylingChange(t,i){t!==i&&r(this.stylingContainer,this.clientStyling)}handleClientStylingChangeURL(t,i){t!==i&&this.clientStylingUrl&&a(this.stylingContainer,this.clientStylingUrl)}componentWillRender(){this.offsetInt=this.offset,this.limitInt=this.limit,this.currentPage=this.offsetInt/this.limitInt+1,this.limitInt=this.limit,this.totalInt=this.total,this.endInt=Math.ceil(this.totalInt/this.limitInt)-1,this.lastPage=!(this.offsetInt>=this.endInt*this.limitInt),1==this.currentPage||2==this.currentPage?(this.pagesArray=Array.from({length:4},((t,i)=>i+1)),this.pagesArray.push("...")):this.currentPage>=3&&this.endInt-this.currentPage>=2?(this.pagesArray=Array.from({length:3},((t,i)=>this.currentPage+i-1)),this.pagesArray.push("..."),this.pagesArray.unshift("...")):this.endInt-this.currentPage<3&&(this.pagesArray=Array.from({length:4},((t,i)=>this.endInt-2+i)),this.pagesArray.unshift("..."))}handleClientStyling(){void 0===window.emMessageBus?(this.clientStyling&&r(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&a(this.stylingContainer,this.clientStylingUrl)):this.stylingSubscription=h(this.stylingContainer,`${this.mbSource}.Style`,this.stylingSubscription,!0)}componentDidLoad(){this.handleClientStyling()}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}render(){let t=n("ul",{class:"PaginationArea"},this.pagesArray.map(((t,i)=>n("li",{class:"PaginationItem"+(t===this.currentPage?" ActiveItem":" ")+" "+(c(this.userAgent)?"MobileButtons":"")},n("button",{disabled:t===this.currentPage,onClick:this.paginationNavigation.bind(this,t,i)},n("span",null,t)))))),i=n("button",{disabled:!this.prevPage,onClick:this.navigateTo.bind(this,"firstPage")},n("span",{class:"NavigationButton"},p("firstPage",this.language)),n("span",{class:"NavigationIcon"})),e=n("div",{class:"LeftItems"},this.secondaryArrowsActive&&i,n("button",{disabled:!this.prevPage,onClick:this.navigateTo.bind(this,"previousPage")},n("span",{class:"NavigationButton"},p("previousPage",this.language)),n("span",{class:"NavigationIcon"})));c(this.userAgent)&&(e=n("div",{class:"LeftItems"},n("button",{disabled:!this.prevPage,onClick:this.navigateTo.bind(this,"previousPage")},n("span",{class:"NavigationButton"},p("previousPage",this.language)),n("span",{class:"NavigationIcon"}))));let s=n("button",{disabled:!this.nextPage,onClick:this.navigateTo.bind(this,"lastPage")},n("span",{class:"NavigationButton"},p("lastPage",this.language)),n("span",{class:"NavigationIcon"})),o=n("div",{class:"RightItems"},n("button",{disabled:!this.nextPage,onClick:this.navigateTo.bind(this,"nextPage")},n("span",{class:"NavigationButton"},p("nextPage",this.language)),n("span",{class:"NavigationIcon"})),this.secondaryArrowsActive&&s);return c(this.userAgent)&&(o=n("div",{class:"RightItems"},n("button",{disabled:!this.nextPage,onClick:this.navigateTo.bind(this,"nextPage")},n("span",{class:"NavigationButton"},p("nextPage",this.language)),n("span",{class:"NavigationIcon"})))),n("div",{id:"PaginationContainer",ref:t=>this.stylingContainer=t},this.arrowsActive&&e,this.numberedNavActive&&t,this.arrowsActive&&o)}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingChangeURL"]}}};u.style='@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap");:host{display:block;font-family:"Roboto", sans-serif}#PaginationContainer{width:100%;margin:20px 0;display:inline-flex;justify-content:space-between;align-items:center}.LeftItems button:not(:first-child),.RightItems button:not(:last-child){margin:0 10px}.LeftItems button,.RightItems button{padding:0;background-color:#009993;border-color:#009993}.PaginationArea{display:inline-flex;gap:10px;list-style:none}.PaginationArea li{margin:0;padding:0}.PaginationArea li button{width:24px;height:24px;display:flex;border:0;padding:0;justify-content:center;align-items:center;background-color:transparent;color:#000;cursor:pointer;pointer-events:all}.PaginationItem.ActiveItem button{background:#009993;border-color:#009993;color:#fff}.PaginationItem.ActiveItem button:disabled{pointer-events:none;cursor:not-allowed}.PaginationItem button:hover,.PaginationItem button:active{background:#009993;border-color:#009993;color:#fff;opacity:0.8}button{width:100px;height:32px;border:1px solid #524e52;border-radius:5px;background:#524e52;color:#fff;font-size:14px;font:inherit;cursor:pointer;transition:all 0.1s linear;text-transform:uppercase;text-align:center;letter-spacing:0}button:hover,button:active{background:#004D4A;border-color:#004D4A}button:disabled{background-color:#ccc;border-color:#ccc;color:#fff;cursor:not-allowed}@media screen and (max-width: 720px){button{width:90px;font-size:14px}}@media screen and (max-width: 480px){button{width:70px;font-size:14px}.paginationArea{padding:5px}}@media screen and (max-width: 320px){button{width:58px;font-size:12px}.paginationArea{padding:5px;gap:5px}}@media (hover: none){.paginationItem button:hover{background:inherit;border-color:inherit;color:inherit;opacity:1}.paginationItem.activeItem button:hover{background:#009993;border-color:#009993;color:#fff}}';export{d as blog_articles_grid,u as helper_pagination}
1
+ import{r as t,c as i,h as n}from"./index-4af8e775.js";const e={en:{error:"Error",readmore:"Read more"},ro:{error:"Eroare",readmore:"Read more"},fr:{error:"Error",readmore:"Read more"},ar:{error:"خطأ",readmore:"Read more"},hu:{error:"خطأ",readmore:"Tovább olvasom"},hr:{error:"Greška",readmore:"Pročitaj više"},"pt-br":{error:"Erro",readmore:"Ler mais"},"es-mx":{error:"Error",readmore:"Leer más"}},s=(t,i)=>e[void 0!==i&&i in e?i:"en"][t],o="__WIDGET_GLOBAL_STYLE_CACHE__";function r(t,i){if(t){const n=document.createElement("style");n.innerHTML=i,t.appendChild(n)}}function a(t,i){if(!t||!i)return;const n=new URL(i);fetch(n.href).then((t=>t.text())).then((i=>{const n=document.createElement("style");n.innerHTML=i,t&&t.appendChild(n)})).catch((t=>{console.error("There was an error while trying to load client styling from URL",t)}))}function h(t,i,n,e=!1){if(!window.emMessageBus)return;if(!("adoptedStyleSheets"in Document.prototype)||!e)return n=function(t,i){const n=document.createElement("style");return window.emMessageBus.subscribe(i,(i=>{t&&(n.innerHTML=i,t.appendChild(n))}))}(t,i),n;window[o]||(window[o]={}),n=function(t,i){return window.emMessageBus.subscribe(i,(n=>{if(!t)return;const e=t.getRootNode(),s=window[o];let r=s[i]&&s[i].sheet;r?s[i].refCount=s[i].refCount+1:(r=new CSSStyleSheet,r.replaceSync(n),s[i]={sheet:r,refCount:1});const a=e.adoptedStyleSheets||[];a.includes(r)||(e.adoptedStyleSheets=[...a,r])}))}(t,i);const s=n.unsubscribe.bind(n);return n.unsubscribe=()=>{if(window[o][i]){const t=window[o][i];t.refCount>1?t.refCount=t.refCount-1:delete window[o][i]}s()},n}function d(t){return t.includes("android")}const l=class{constructor(e){t(this,e),this.articleActionButton=i(this,"articleActionButton",7),this.lastPage=1,this.isInitialized=!1,this.paginationDefaultStyling="\n div#PaginationContainer {\n justify-content: right;\n }\n .LeftItems button .NavigationButton {\n display: none;\n }\n .LeftItems button:after, .RightItems button:after {\n padding: 7px 12px;\n font-size: 18px;\n font-weight: 700;\n line-height: 46px;\n }\n .LeftItems button:after {\n content: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='1.2em' viewBox='0 0 320 512'%3E%3C!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --%3E%3Cpath d='M9.4 233.4c-12.5 12.5-12.5 32.8 0 45.3l192 192c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L77.3 256 246.6 86.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0l-192 192z'/%3E%3C/svg%3E\");\n }\n .RightItems button:after {\n content: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='1.2em' viewBox='0 0 320 512'%3E%3C!--! Font Awesome Free 6.4.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --%3E%3Cpath d='M310.6 233.4c12.5 12.5 12.5 32.8 0 45.3l-192 192c-12.5 12.5-32.8 12.5-45.3 0s-12.5-32.8 0-45.3L242.7 256 73.4 86.6c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0l192 192z'/%3E%3C/svg%3E\");\n display: block;\n height: 38px;\n }\n div.LeftItems button, div.RightItems button {\n width: unset;\n height: 40px;\n background-color: #fff;\n color: #000;\n border: 1px solid #000;\n overflow: hidden;\n &:disabled {\n background-color: #989898;\n }\n }\n div.LeftItems button {\n min-width: 60px;\n border-radius: 20px 0 0 20px;\n border-right: 0;\n }\n div.RightItems button {\n display: flex;\n min-width: 100px;\n justify-content: space-evenly;\n align-items: center;\n border-radius: 0 20px 20px 0;\n text-transform: none;\n }\n .RightItems button .NavigationButton {\n padding: 12px 0 12px 12px;\n font-weight: 700;\n }",this.renderContentConditionally=t=>t&&(!t.includes("<bannermatrix-banner")||this.bannerMatrixReady)?n("p",{class:"BlogContent",innerHTML:t}):null,this.cmsEndpoint=void 0,this.language="en",this.userRoles="everyone",this.cmsEnv="stage",this.mbSource=void 0,this.clientStyling="",this.clientStylingUrl="",this.showPublishingDate=!0,this.showImage=!0,this.showTitle=!0,this.showContent=!0,this.showButton=!0,this.hideError=!1,this.usePostmessage=void 0,this.postMessageEvent="",this.blogsLimit="0",this.paginationActive=void 0,this.arrowsActive=!0,this.secondaryArrowsActive=!1,this.numberedNavActive=!1,this.intlDateTimeFormat="",this.page="1",this.eventId=void 0,this.paginationBlogList={offset:0},this.currentPage=0,this.hasErrors=!1,this.isLoading=!0,this.bannerMatrixReady=!1,this.nextPage="",this.previousPage="",this.device="mobile",this.displayedBlogResponse=void 0,this.paginationBlogResponse=void 0,this.allBlogResponse=void 0,this.totalBlogs=0}getArticleId(t,i){var n;if(0!==t.button||t.metaKey||t.ctrlKey||t.shiftKey||t.altKey)return;const e={postId:i.postID.toString(),slug:i.slug,customPath:i.customPath};this.usePostmessage?(t.preventDefault(),window.postMessage(Object.assign({type:this.postMessageEvent},e))):null===(n=this.articleActionButton)||void 0===n||n.emit(e)}handleBannerReady(){this.bannerMatrixReady=!0}watchEndpoint(t,i){this.isInitialized&&(this.currentPage=parseInt(this.page)-1,(t||""===t)&&t!=i&&this.cmsEndpoint&&this.language&&this.getBlogArticleGrid())}handleClientStylingChange(t,i){t!==i&&r(this.stylingContainer,this.clientStyling)}handleClientStylingChangeURL(t,i){t!==i&&this.clientStylingUrl&&a(this.stylingContainer,this.clientStylingUrl)}hpPageChange(t){var i,n;this.paginationBlogList=t.detail,this.currentPage=Math.floor((null===(i=this.paginationBlogList)||void 0===i?void 0:i.offset)/(null===(n=this.paginationBlogList)||void 0===n?void 0:n.limit)),this.page&&(this.currentPage=this.currentPage+ +this.page-1),this.currentPage+1>this.lastPage?this.nextPage=null:this.currentPage<0?this.previousPage=null:(window.postMessage({type:"BlogArticlesGridActivePagination",currentPage:this.currentPage},window.location.href),this.getBlogArticleGrid(!0))}sortArticlesByDate(t){return t.sort(((t,i)=>t.publishingDate>i.publishingDate?-1:t.publishingDate<i.publishingDate?1:0)),t}findLatestFeatured(t){let i=t.filter((t=>t.isFeaturedPost));return 0===i.length?null:(i=this.sortArticlesByDate(i),i[0])}moveLatestFeatureToStart(t,i){if(!i)return t;const n=t.indexOf(i);return-1!==n&&(t.splice(n,1),t.unshift(i)),t}async fetchBlogPosts(t,i=!1){const n=new URL(`${this.cmsEndpoint}/${this.language}/blog-posts`);return n.searchParams.append("per_page",i?"300":this.blogsLimit),n.searchParams.append("page",`${t||this.currentPage+1}`),n.searchParams.append("env",this.cmsEnv),n.searchParams.append("userRoles",this.userRoles),n.searchParams.append("device",(()=>{const t=(()=>{let t=window.navigator.userAgent;return t.toLowerCase().match(/android/i)?"Android":t.toLowerCase().match(/iphone/i)?"iPhone":t.toLowerCase().match(/ipad|ipod/i)?"iPad":"PC"})();if(t){if("PC"===t)return"dk";if("iPad"===t||"iPhone"===t)return"mtWeb"}return"mtWeb"})()),fetch(n.href).then((t=>{if(t.status>=300)throw this.hasErrors=!0,new Error("There was an error while fetching the data");return t.json()})).then((t=>{let n=t.items;const e=this.findLatestFeatured(n);return n=this.sortArticlesByDate(n),n=this.moveLatestFeatureToStart(n,e),t=Object.assign(Object.assign({},t),{items:n}),i?this.allBlogResponse=t:this.paginationBlogResponse=t,t})).catch((t=>(this.hasErrors=!0,console.log("Error",t),{})))}async getBlogArticleGrid(t=!1,i){var n,e,s,o,r,a,h;this.isLoading=!0;try{let d;if(this.eventId&&this.eventId.length>0){const o=(null===(n=this.allBlogResponse)||void 0===n?void 0:n.items)?this.allBlogResponse:await this.fetchBlogPosts(1,!0),r=o.items.filter((({eventIds:t})=>{var i;return t.includes(null!==(i=this.eventId)&&void 0!==i?i:"-")}));r.length?(d=Object.assign(Object.assign({},o),{items:r,total:Math.min(parseInt(this.blogsLimit),r.length)}),window.postMessage({type:"OP:blogReady",payload:{hasBlog:!0}},"*")):(window.postMessage({type:"OP:blogReady",payload:{hasBlog:!1}},"*"),d=(null===(s=null===(e=this.paginationBlogResponse)||void 0===e?void 0:e.items)||void 0===s?void 0:s.length)&&!t?this.paginationBlogResponse:await this.fetchBlogPosts(i))}else d=(null===(r=null===(o=this.paginationBlogResponse)||void 0===o?void 0:o.items)||void 0===r?void 0:r.length)&&!t?this.paginationBlogResponse:await this.fetchBlogPosts(i);this.displayedBlogResponse=d,this.totalBlogs=d.total,this.lastPage=+((null===(h=null===(a=d.pages.last)||void 0===a?void 0:a.match(/&page=(\d+)/))||void 0===h?void 0:h[1])||1),this.nextPage=d.pages.next,this.previousPage=d.pages.previous,this.isLoading=!1,this.hasErrors=!1}catch(t){this.hasErrors=!0,console.log("Error",t)}}componentWillLoad(){this.cmsEndpoint&&this.language&&this.blogsLimit&&(this.page?(this.currentPage=this.currentPage+ +this.page-1,this.getBlogArticleGrid(!1,+this.page)):this.getBlogArticleGrid())}handleClientStyling(){void 0===window.emMessageBus?(this.clientStyling&&r(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&a(this.stylingContainer,this.clientStylingUrl)):this.stylingSubscription=h(this.stylingContainer,`${this.mbSource}.Style`,this.stylingSubscription,!0)}componentDidLoad(){this.handleClientStyling(),this.isInitialized=!0,window.postMessage({type:"BlogArticlesGridLoaded"},window.location.href),this.device=((t=!1)=>{if("undefined"==typeof window||"undefined"==typeof navigator)return"desktop";const i=navigator.userAgent.toLowerCase(),n=window.innerWidth;if(function(t){return!!t.includes("ipad")||t.includes("macintosh")&&navigator.maxTouchPoints>0}(i))return"tablet";if(function(t){return t.includes("iphone")||t.includes("ipod")}(i))return"mobile";if(function(t,i){return d(t)&&(t.includes("mobile")||t.includes("mobi")||i<=599)}(i,n))return"mobile";if(function(t,i){return d(t)&&!t.includes("mobile")&&!t.includes("mobi")&&i>599}(i,n))return"tablet";if(t){if(n<=599)return"mobile";if(n<=1099)return"tablet"}return"desktop"})()}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}setImage(t){var i,n;return(null===(n=null===(i=t.sources)||void 0===i?void 0:i["mobile"===this.device?0:"tablet"===this.device?1:2])||void 0===n?void 0:n.pictureSource)||t.src}parseDate(t){const i=new Date(t);if(i instanceof Date&&!Number.isNaN(i.getTime()))return i;const[n,e,s]=t.trim().split("/").map(Number);return new Date(s,e-1,n)}formatDate(t){const i=this.parseDate(t);return new Intl.DateTimeFormat(this.intlDateTimeFormat).format(i)}render(){if(this.hasErrors)return n("div",{class:"BlogsContainer"},!this.hideError&&n("div",{class:"ErrorMessage"},s("error",this.language)));const t=[];for(let i=0;i<parseInt(this.blogsLimit);i++)t.push(n("div",{class:"GridContainer FeaturedPost Skeleton"},n("div",{class:"GridWrapper"},n("div",{class:"GridSector"},n("div",{class:"VisualContent LoadingImage"})),n("div",{class:"GridSector"},n("div",{class:"BlogTitle LoadingStripe LoadingSmallStripe"}),n("div",{class:"BlogDetails LoadingStripe LoadingMediumStripe"}),n("div",{class:"BlogLink LoadingStripe LoadingLongStripe"})))));const i=Boolean(this.paginationActive)&&this.totalBlogs>+this.blogsLimit,e=this.mbSource?void 0:this.clientStyling||this.paginationDefaultStyling;return n("div",{ref:t=>this.stylingContainer=t},n("div",{class:"BlogPageContainer"},n("div",{class:"BlogGridPaginationWrapper"},i&&n("helper-pagination",{"next-page":this.nextPage,"prev-page":this.previousPage,offset:this.paginationBlogList.offset,limit:parseInt(this.blogsLimit,10),total:this.totalBlogs,language:this.language,"mb-source":this.mbSource,"client-styling":e,"client-styling-url":this.clientStylingUrl,"arrows-active":this.arrowsActive,"secondary-arrows-active":this.secondaryArrowsActive,"numbered-nav-active":this.numberedNavActive})),!this.isLoading&&n("div",{class:`GridContainerWrapper BlogPage-${this.currentPage} ${this.device}`},this.displayedBlogResponse&&this.displayedBlogResponse.items.map((t=>{var i,e;return n("a",{key:t.postID,class:t.isFeaturedPost?"BlogCardLink FeaturedPost":"BlogCardLink",href:`/${encodeURIComponent(this.language)}/blog/${encodeURIComponent(t.customPath||t.slug)}`,onClick:i=>this.getArticleId(i,t)},n("div",{class:t.isFeaturedPost?"GridContainer FeaturedPost":"GridContainer"},n("div",{class:"GridWrapper"},n("div",{class:"GridSector"},this.showPublishingDate&&n("div",{class:"BlogDate"},n("time",{dateTime:t.publishingDate},this.formatDate(t.publishingDate))),this.showImage&&(null===(i=t.image)||void 0===i?void 0:i.src)?n("img",{class:"VisualContent",src:this.setImage(t.image),alt:t.image.alt||t.title,width:"400",height:"225",loading:"lazy"}):(null===(e=t.video)||void 0===e?void 0:e.sources[this.device])?n("video",{class:"VisualContent",src:t.video.sources[this.device]}):n("span",{class:"VisualContent",style:{color:"#fff"}},"No Image")),n("div",{class:"GridSector"},this.showTitle&&n("h2",{class:"BlogTitle"},t.title),this.showContent&&this.renderContentConditionally(t.descriptionPreview),this.showButton&&n("span",{class:"BlogLink"},s("readmore",this.language))))))}))),this.isLoading&&n("div",{class:"GridContainerWrapper LoadingGrid"},t)))}static get watchers(){return{page:["watchEndpoint"],hasErrors:["watchEndpoint"],cmsEndpoint:["watchEndpoint"],language:["watchEndpoint"],cmsEnv:["watchEndpoint"],userRoles:["watchEndpoint"],blogsLimit:["watchEndpoint"],eventId:["watchEndpoint"],clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingChangeURL"]}}};l.style=":host {\n display: block;\n}\n\n.BlogPageContainer {\n background: #0A0A17;\n padding: 20px;\n}\n\n.GridContainerWrapper {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 20px;\n}\n\n.BlogCardLink {\n display: block;\n color: inherit;\n text-decoration: none;\n cursor: pointer;\n}\n.BlogCardLink .GridContainer {\n height: 100%;\n}\n.BlogCardLink > .GridContainer > .GridWrapper {\n height: 100%;\n}\n.BlogCardLink.FeaturedPost:first-child {\n grid-column: 1/-1;\n}\n\n.BlogPage-0 .GridContainer.FeaturedPost:first-child {\n width: 100%;\n flex-basis: auto;\n}\n\n.GridContainer {\n container-type: inline-size;\n container-name: article;\n border-radius: 15px;\n color: #000;\n overflow: hidden;\n}\n.GridContainer.FeaturedPost:first-child {\n grid-column: 1/-1;\n width: 100%;\n}\n.GridContainer .GridWrapper {\n display: flex;\n flex-direction: row;\n height: 280px;\n background: var(--emw--color-white, #FFFFFF);\n}\n.GridContainer .GridSector {\n flex-basis: 50%;\n position: relative;\n}\n.GridContainer .GridSector:first-of-type {\n height: 280px;\n display: flex;\n}\n.GridContainer .GridSector:last-of-type {\n padding: 20px 40px;\n display: flex;\n flex-direction: column;\n}\n.GridContainer .VisualContent {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: cover;\n}\n.GridContainer .BlogDate {\n position: absolute;\n bottom: 0px;\n left: 30px;\n font-size: 12px;\n border-radius: 5px 5px 0 0;\n padding: 10px;\n width: fit-content;\n text-align: center;\n color: var(--emw--color-white, #FFFFFF);\n background-color: #CD0B5E;\n z-index: 1;\n}\n.GridContainer .BlogTitle {\n margin: 0;\n font-size: 24px;\n font-weight: 400;\n color: #000;\n padding-bottom: 10px;\n}\n.GridContainer .BlogContent {\n margin: 0;\n display: -webkit-box;\n font-size: 14px;\n line-height: 1.2em;\n -webkit-line-clamp: 6;\n color: #000;\n -webkit-box-orient: vertical;\n box-sizing: border-box;\n text-overflow: ellipsis;\n overflow: hidden;\n}\n.GridContainer .BlogLink {\n color: #22B04E;\n font-size: 14px;\n position: absolute;\n bottom: 16px;\n padding-top: 2.5px;\n}\n\n@container article (max-width: 550px) {\n .GridContainer .GridWrapper {\n height: 380px;\n flex-direction: column;\n }\n .GridContainer .GridWrapper .GridSector:first-of-type {\n height: 120px;\n flex-shrink: 0;\n flex-basis: 150px;\n }\n .GridContainer .GridWrapper .GridSector:last-of-type {\n padding: 20px 20px 40px;\n }\n}\n.LoadingImage {\n width: 100%;\n height: 100%;\n background-color: var(--emw--color-gray-100, #E6E6E6);\n}\n\n.LoadingStripe {\n border: 1px solid var(--emw--color-white, #FFFFFF);\n height: 20%;\n background-color: var(--emw--color-gray-100, #E6E6E6);\n margin-bottom: 5px;\n}\n\n.LoadingSmallStripe {\n width: 40%;\n}\n\n.LoadingMediumStripe {\n width: 70%;\n}\n\n.BlogLink.LoadingLongStripe {\n position: static;\n width: 100%;\n}\n\n.GridContainerWrapper.LoadingGrid .GridSector {\n justify-content: space-around;\n}\n\n.GridContainerWrapper.LoadingGrid .LoadingImage, .GridContainerWrapper.LoadingGrid .LoadingStripe {\n animation: pulsatingLoader 2s ease-in-out 0s infinite reverse;\n -webkit-animation: pulsatingLoader 2s ease-in-out 0s infinite reverse;\n}\n\n@keyframes pulsatingLoader {\n 0% {\n opacity: 0.5;\n }\n 50% {\n opacity: 1;\n }\n 100% {\n opacity: 0.5;\n }\n}\n@-webkit-keyframes pulsatingLoader {\n 0% {\n opacity: 0.5;\n }\n 50% {\n opacity: 1;\n }\n 100% {\n opacity: 0.5;\n }\n}";const c=t=>!!(t.toLowerCase().match(/android/i)||t.toLowerCase().match(/blackberry|bb/i)||t.toLowerCase().match(/iphone|ipad|ipod/i)||t.toLowerCase().match(/windows phone|windows mobile|iemobile|wpdesktop/i)),g={en:{firstPage:"First",previousPage:"Previous",nextPage:"Next",lastPage:"Last"},ro:{firstPage:"Prima",previousPage:"Anterior",nextPage:"Urmatoarea",lastPage:"Ultima"},fr:{firstPage:"First",previousPage:"Previous",nextPage:"Next",lastPage:"Last"},ar:{firstPage:"First",previousPage:"Previous",nextPage:"Next",lastPage:"Last"},hu:{firstPage:"First",previousPage:"Previous",nextPage:"Következő",lastPage:"Last"},hr:{firstPage:"Prva",previousPage:"Prethodna",nextPage:"Slijedeća",lastPage:"Zadnja"}},p=(t,i)=>g[void 0!==i&&i in g?i:"en"][t],u=class{constructor(n){t(this,n),this.hpPageChange=i(this,"hpPageChange",7),this.userAgent=window.navigator.userAgent,this.currentPage=1,this.navigateTo=t=>{var i;switch(t){case"firstPage":this.offsetInt=0;break;case"lastPage":this.offsetInt=this.endInt*this.limitInt;break;case"previousPage":this.offsetInt-=this.limitInt;break;case"nextPage":this.offsetInt+=this.limitInt;break;case"fivePagesBack":this.offsetInt-=5*this.limitInt,this.offsetInt=this.offsetInt<=0?0:this.offsetInt;break;case"fivePagesForward":this.offsetInt+=5*this.limitInt,this.offsetInt=this.offsetInt/this.limitInt>=this.endInt?this.endInt*this.limitInt:this.offsetInt}this.previousPage=!!this.offsetInt,null===(i=this.hpPageChange)||void 0===i||i.emit({offset:this.offsetInt,limit:this.limitInt,total:this.totalInt})},this.paginationNavigation=(t,i)=>{var n;this.previousPage=!0,isNaN(t)?0===i&&this.currentPage<=4?this.navigateTo("firstPage"):0===i&&this.currentPage>4?this.navigateTo("fivePagesBack"):4===i&&this.endInt-this.currentPage>=2&&this.navigateTo("fivePagesForward"):1===t?(this.offsetInt=t-1,this.previousPage=!1):this.offsetInt=(t-1)*this.limitInt,null===(n=this.hpPageChange)||void 0===n||n.emit({offset:this.offsetInt,limit:this.limitInt,total:this.totalInt})},this.nextPage="",this.prevPage="",this.offset=0,this.limit=1,this.total=1,this.language="en",this.mbSource=void 0,this.clientStyling="",this.clientStylingUrl="",this.arrowsActive=!0,this.secondaryArrowsActive=!1,this.numberedNavActive=!1,this.offsetInt=0,this.lastPage=!1,this.previousPage=!1,this.limitInt=0,this.totalInt=0,this.pagesArray=[],this.endInt=0}handleClientStylingChange(t,i){t!==i&&r(this.stylingContainer,this.clientStyling)}handleClientStylingChangeURL(t,i){t!==i&&this.clientStylingUrl&&a(this.stylingContainer,this.clientStylingUrl)}componentWillRender(){this.offsetInt=this.offset,this.limitInt=this.limit,this.currentPage=this.offsetInt/this.limitInt+1,this.limitInt=this.limit,this.totalInt=this.total,this.endInt=Math.ceil(this.totalInt/this.limitInt)-1,this.lastPage=!(this.offsetInt>=this.endInt*this.limitInt),1==this.currentPage||2==this.currentPage?(this.pagesArray=Array.from({length:4},((t,i)=>i+1)),this.pagesArray.push("...")):this.currentPage>=3&&this.endInt-this.currentPage>=2?(this.pagesArray=Array.from({length:3},((t,i)=>this.currentPage+i-1)),this.pagesArray.push("..."),this.pagesArray.unshift("...")):this.endInt-this.currentPage<3&&(this.pagesArray=Array.from({length:4},((t,i)=>this.endInt-2+i)),this.pagesArray.unshift("..."))}handleClientStyling(){void 0===window.emMessageBus?(this.clientStyling&&r(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&a(this.stylingContainer,this.clientStylingUrl)):this.stylingSubscription=h(this.stylingContainer,`${this.mbSource}.Style`,this.stylingSubscription,!0)}componentDidLoad(){this.handleClientStyling()}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}render(){let t=n("ul",{class:"PaginationArea"},this.pagesArray.map(((t,i)=>n("li",{class:"PaginationItem"+(t===this.currentPage?" ActiveItem":" ")+" "+(c(this.userAgent)?"MobileButtons":"")},n("button",{disabled:t===this.currentPage,onClick:this.paginationNavigation.bind(this,t,i)},n("span",null,t)))))),i=n("button",{disabled:!this.prevPage,onClick:this.navigateTo.bind(this,"firstPage")},n("span",{class:"NavigationButton"},p("firstPage",this.language)),n("span",{class:"NavigationIcon"})),e=n("div",{class:"LeftItems"},this.secondaryArrowsActive&&i,n("button",{disabled:!this.prevPage,onClick:this.navigateTo.bind(this,"previousPage")},n("span",{class:"NavigationButton"},p("previousPage",this.language)),n("span",{class:"NavigationIcon"})));c(this.userAgent)&&(e=n("div",{class:"LeftItems"},n("button",{disabled:!this.prevPage,onClick:this.navigateTo.bind(this,"previousPage")},n("span",{class:"NavigationButton"},p("previousPage",this.language)),n("span",{class:"NavigationIcon"}))));let s=n("button",{disabled:!this.nextPage,onClick:this.navigateTo.bind(this,"lastPage")},n("span",{class:"NavigationButton"},p("lastPage",this.language)),n("span",{class:"NavigationIcon"})),o=n("div",{class:"RightItems"},n("button",{disabled:!this.nextPage,onClick:this.navigateTo.bind(this,"nextPage")},n("span",{class:"NavigationButton"},p("nextPage",this.language)),n("span",{class:"NavigationIcon"})),this.secondaryArrowsActive&&s);return c(this.userAgent)&&(o=n("div",{class:"RightItems"},n("button",{disabled:!this.nextPage,onClick:this.navigateTo.bind(this,"nextPage")},n("span",{class:"NavigationButton"},p("nextPage",this.language)),n("span",{class:"NavigationIcon"})))),n("div",{id:"PaginationContainer",ref:t=>this.stylingContainer=t},this.arrowsActive&&e,this.numberedNavActive&&t,this.arrowsActive&&o)}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingChangeURL"]}}};u.style='@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap");:host{display:block;font-family:"Roboto", sans-serif}#PaginationContainer{width:100%;margin:20px 0;display:inline-flex;justify-content:space-between;align-items:center}.LeftItems button:not(:first-child),.RightItems button:not(:last-child){margin:0 10px}.LeftItems button,.RightItems button{padding:0;background-color:#009993;border-color:#009993}.PaginationArea{display:inline-flex;gap:10px;list-style:none}.PaginationArea li{margin:0;padding:0}.PaginationArea li button{width:24px;height:24px;display:flex;border:0;padding:0;justify-content:center;align-items:center;background-color:transparent;color:#000;cursor:pointer;pointer-events:all}.PaginationItem.ActiveItem button{background:#009993;border-color:#009993;color:#fff}.PaginationItem.ActiveItem button:disabled{pointer-events:none;cursor:not-allowed}.PaginationItem button:hover,.PaginationItem button:active{background:#009993;border-color:#009993;color:#fff;opacity:0.8}button{width:100px;height:32px;border:1px solid #524e52;border-radius:5px;background:#524e52;color:#fff;font-size:14px;font:inherit;cursor:pointer;transition:all 0.1s linear;text-transform:uppercase;text-align:center;letter-spacing:0}button:hover,button:active{background:#004D4A;border-color:#004D4A}button:disabled{background-color:#ccc;border-color:#ccc;color:#fff;cursor:not-allowed}@media screen and (max-width: 720px){button{width:90px;font-size:14px}}@media screen and (max-width: 480px){button{width:70px;font-size:14px}.paginationArea{padding:5px}}@media screen and (max-width: 320px){button{width:58px;font-size:12px}.paginationArea{padding:5px;gap:5px}}@media (hover: none){.paginationItem button:hover{background:inherit;border-color:inherit;color:inherit;opacity:1}.paginationItem.activeItem button:hover{background:#009993;border-color:#009993;color:#fff}}';export{l as blog_articles_grid,u as helper_pagination}
@@ -249,7 +249,7 @@ const getDevicePlatform = () => {
249
249
  return 'mtWeb';
250
250
  };
251
251
 
252
- const blogArticlesGridCss = ":host {\n display: block;\n}\n\n.BlogPageContainer {\n background: #0A0A17;\n padding: 20px;\n}\n\n.GridContainerWrapper {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 20px;\n}\n\n.BlogPage-0 .GridContainer.FeaturedPost:first-child {\n width: 100%;\n flex-basis: auto;\n}\n\n.GridContainer {\n container-type: inline-size;\n container-name: article;\n border-radius: 15px;\n color: #000;\n overflow: hidden;\n}\n.GridContainer.FeaturedPost:first-child {\n grid-column: 1/-1;\n width: 100%;\n}\n.GridContainer .GridWrapper {\n display: flex;\n flex-direction: row;\n height: 280px;\n background: var(--emw--color-white, #FFFFFF);\n}\n.GridContainer .GridSector {\n flex-basis: 50%;\n position: relative;\n}\n.GridContainer .GridSector:first-of-type {\n height: 280px;\n display: flex;\n}\n.GridContainer .GridSector:last-of-type {\n padding: 20px 40px;\n display: flex;\n flex-direction: column;\n}\n.GridContainer .VisualContent {\n width: 100%;\n}\n.GridContainer .BlogDate {\n position: absolute;\n bottom: 0px;\n left: 30px;\n font-size: 12px;\n border-radius: 5px 5px 0 0;\n padding: 10px;\n width: fit-content;\n text-align: center;\n color: var(--emw--color-white, #FFFFFF);\n background-color: #CD0B5E;\n z-index: 1;\n}\n.GridContainer .BlogTitle {\n font-size: 24px;\n color: #000;\n padding-bottom: 10px;\n}\n.GridContainer .BlogContent {\n display: -webkit-box;\n font-size: 14px;\n line-height: 1.2em;\n -webkit-line-clamp: 6;\n color: #000;\n -webkit-box-orient: vertical;\n box-sizing: border-box;\n text-overflow: ellipsis;\n overflow: hidden;\n}\n.GridContainer .BlogLink {\n color: #000;\n position: absolute;\n bottom: 16px;\n}\n.GridContainer .BlogLink button {\n font-size: 14px;\n border: none;\n padding: 0;\n background: none;\n color: #22B04E;\n cursor: pointer;\n}\n\n@container article (max-width: 550px) {\n .GridContainer .GridWrapper {\n height: 380px;\n flex-direction: column;\n }\n .GridContainer .GridWrapper .GridSector:first-of-type {\n height: 120px;\n flex-shrink: 0;\n flex-basis: 150px;\n }\n .GridContainer .GridWrapper .GridSector:last-of-type {\n padding: 20px 20px 40px;\n }\n}\n.LoadingImage {\n width: 100%;\n height: 100%;\n background-color: var(--emw--color-gray-100, #E6E6E6);\n}\n\n.LoadingStripe {\n border: 1px solid var(--emw--color-white, #FFFFFF);\n height: 20%;\n background-color: var(--emw--color-gray-100, #E6E6E6);\n margin-bottom: 5px;\n}\n\n.LoadingSmallStripe {\n width: 40%;\n}\n\n.LoadingMediumStripe {\n width: 70%;\n}\n\n.BlogLink.LoadingLongStripe {\n position: static;\n width: 100%;\n}\n\n.GridContainerWrapper.LoadingGrid .GridSector {\n justify-content: space-around;\n}\n\n.GridContainerWrapper.LoadingGrid .LoadingImage, .GridContainerWrapper.LoadingGrid .LoadingStripe {\n animation: pulsatingLoader 2s ease-in-out 0s infinite reverse;\n -webkit-animation: pulsatingLoader 2s ease-in-out 0s infinite reverse;\n}\n\n@keyframes pulsatingLoader {\n 0% {\n opacity: 0.5;\n }\n 50% {\n opacity: 1;\n }\n 100% {\n opacity: 0.5;\n }\n}\n@-webkit-keyframes pulsatingLoader {\n 0% {\n opacity: 0.5;\n }\n 50% {\n opacity: 1;\n }\n 100% {\n opacity: 0.5;\n }\n}";
252
+ const blogArticlesGridCss = ":host {\n display: block;\n}\n\n.BlogPageContainer {\n background: #0A0A17;\n padding: 20px;\n}\n\n.GridContainerWrapper {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 20px;\n}\n\n.BlogCardLink {\n display: block;\n color: inherit;\n text-decoration: none;\n cursor: pointer;\n}\n.BlogCardLink .GridContainer {\n height: 100%;\n}\n.BlogCardLink > .GridContainer > .GridWrapper {\n height: 100%;\n}\n.BlogCardLink.FeaturedPost:first-child {\n grid-column: 1/-1;\n}\n\n.BlogPage-0 .GridContainer.FeaturedPost:first-child {\n width: 100%;\n flex-basis: auto;\n}\n\n.GridContainer {\n container-type: inline-size;\n container-name: article;\n border-radius: 15px;\n color: #000;\n overflow: hidden;\n}\n.GridContainer.FeaturedPost:first-child {\n grid-column: 1/-1;\n width: 100%;\n}\n.GridContainer .GridWrapper {\n display: flex;\n flex-direction: row;\n height: 280px;\n background: var(--emw--color-white, #FFFFFF);\n}\n.GridContainer .GridSector {\n flex-basis: 50%;\n position: relative;\n}\n.GridContainer .GridSector:first-of-type {\n height: 280px;\n display: flex;\n}\n.GridContainer .GridSector:last-of-type {\n padding: 20px 40px;\n display: flex;\n flex-direction: column;\n}\n.GridContainer .VisualContent {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: cover;\n}\n.GridContainer .BlogDate {\n position: absolute;\n bottom: 0px;\n left: 30px;\n font-size: 12px;\n border-radius: 5px 5px 0 0;\n padding: 10px;\n width: fit-content;\n text-align: center;\n color: var(--emw--color-white, #FFFFFF);\n background-color: #CD0B5E;\n z-index: 1;\n}\n.GridContainer .BlogTitle {\n margin: 0;\n font-size: 24px;\n font-weight: 400;\n color: #000;\n padding-bottom: 10px;\n}\n.GridContainer .BlogContent {\n margin: 0;\n display: -webkit-box;\n font-size: 14px;\n line-height: 1.2em;\n -webkit-line-clamp: 6;\n color: #000;\n -webkit-box-orient: vertical;\n box-sizing: border-box;\n text-overflow: ellipsis;\n overflow: hidden;\n}\n.GridContainer .BlogLink {\n color: #22B04E;\n font-size: 14px;\n position: absolute;\n bottom: 16px;\n padding-top: 2.5px;\n}\n\n@container article (max-width: 550px) {\n .GridContainer .GridWrapper {\n height: 380px;\n flex-direction: column;\n }\n .GridContainer .GridWrapper .GridSector:first-of-type {\n height: 120px;\n flex-shrink: 0;\n flex-basis: 150px;\n }\n .GridContainer .GridWrapper .GridSector:last-of-type {\n padding: 20px 20px 40px;\n }\n}\n.LoadingImage {\n width: 100%;\n height: 100%;\n background-color: var(--emw--color-gray-100, #E6E6E6);\n}\n\n.LoadingStripe {\n border: 1px solid var(--emw--color-white, #FFFFFF);\n height: 20%;\n background-color: var(--emw--color-gray-100, #E6E6E6);\n margin-bottom: 5px;\n}\n\n.LoadingSmallStripe {\n width: 40%;\n}\n\n.LoadingMediumStripe {\n width: 70%;\n}\n\n.BlogLink.LoadingLongStripe {\n position: static;\n width: 100%;\n}\n\n.GridContainerWrapper.LoadingGrid .GridSector {\n justify-content: space-around;\n}\n\n.GridContainerWrapper.LoadingGrid .LoadingImage, .GridContainerWrapper.LoadingGrid .LoadingStripe {\n animation: pulsatingLoader 2s ease-in-out 0s infinite reverse;\n -webkit-animation: pulsatingLoader 2s ease-in-out 0s infinite reverse;\n}\n\n@keyframes pulsatingLoader {\n 0% {\n opacity: 0.5;\n }\n 50% {\n opacity: 1;\n }\n 100% {\n opacity: 0.5;\n }\n}\n@-webkit-keyframes pulsatingLoader {\n 0% {\n opacity: 0.5;\n }\n 50% {\n opacity: 1;\n }\n 100% {\n opacity: 0.5;\n }\n}";
253
253
  const BlogArticlesGridStyle0 = blogArticlesGridCss;
254
254
 
255
255
  const BlogArticlesGrid = class {
@@ -307,27 +307,12 @@ const BlogArticlesGrid = class {
307
307
  padding: 12px 0 12px 12px;
308
308
  font-weight: 700;
309
309
  }`;
310
- this.setImage = (image) => {
311
- let source = '';
312
- switch (this.device) {
313
- case 'mobile':
314
- source = image.sources[0].pictureSource;
315
- break;
316
- case 'tablet':
317
- source = image.sources[1].pictureSource;
318
- break;
319
- case 'desktop':
320
- source = image.sources[2].pictureSource;
321
- break;
322
- }
323
- return source;
324
- };
325
310
  this.renderContentConditionally = (content) => {
326
311
  if (!content)
327
312
  return null;
328
313
  const hasBanner = content.includes('<bannermatrix-banner');
329
314
  if (!hasBanner || this.bannerMatrixReady) {
330
- return index.h("div", { class: "BlogContent", innerHTML: content });
315
+ return index.h("p", { class: "BlogContent", innerHTML: content });
331
316
  }
332
317
  return null;
333
318
  };
@@ -369,13 +354,17 @@ const BlogArticlesGrid = class {
369
354
  this.allBlogResponse = undefined;
370
355
  this.totalBlogs = 0;
371
356
  }
372
- getArticleId(postId, slug, customPath) {
357
+ getArticleId(event, post) {
373
358
  var _a;
359
+ if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)
360
+ return;
361
+ const detail = { postId: post.postID.toString(), slug: post.slug, customPath: post.customPath };
374
362
  if (this.usePostmessage) {
375
- window.postMessage({ type: this.postMessageEvent, postId: postId.toString(), slug, customPath });
363
+ event.preventDefault();
364
+ window.postMessage(Object.assign({ type: this.postMessageEvent }, detail));
376
365
  }
377
366
  else {
378
- (_a = this.articleActionButton) === null || _a === void 0 ? void 0 : _a.emit({ postId: postId.toString(), slug, customPath });
367
+ (_a = this.articleActionButton) === null || _a === void 0 ? void 0 : _a.emit(detail);
379
368
  }
380
369
  }
381
370
  // Rerender when bannermatrix has finished loaded. Issue when bannermatrix passed as content from CMS.
@@ -468,9 +457,6 @@ const BlogArticlesGrid = class {
468
457
  const latestFeatured = this.findLatestFeatured(items);
469
458
  items = this.sortArticlesByDate(items);
470
459
  items = this.moveLatestFeatureToStart(items, latestFeatured);
471
- items = items.map((item) => {
472
- return Object.assign(Object.assign({}, item), { publishingDate: new Date(item.publishingDate).toLocaleDateString() });
473
- });
474
460
  blogResponse = Object.assign(Object.assign({}, blogResponse), { items });
475
461
  if (allPosts) {
476
462
  this.allBlogResponse = blogResponse;
@@ -565,6 +551,11 @@ const BlogArticlesGrid = class {
565
551
  disconnectedCallback() {
566
552
  this.stylingSubscription && this.stylingSubscription.unsubscribe();
567
553
  }
554
+ setImage(image) {
555
+ var _a, _b;
556
+ const sourceIndex = this.device === 'mobile' ? 0 : this.device === 'tablet' ? 1 : 2;
557
+ return ((_b = (_a = image.sources) === null || _a === void 0 ? void 0 : _a[sourceIndex]) === null || _b === void 0 ? void 0 : _b.pictureSource) || image.src;
558
+ }
568
559
  parseDate(dateString) {
569
560
  const date = new Date(dateString);
570
561
  const isValidDate = date instanceof Date && !Number.isNaN(date.getTime());
@@ -593,11 +584,11 @@ const BlogArticlesGrid = class {
593
584
  return (index.h("div", { ref: el => this.stylingContainer = el }, index.h("div", { class: "BlogPageContainer" }, index.h("div", { class: "BlogGridPaginationWrapper" }, showPagination && index.h("helper-pagination", { "next-page": this.nextPage, "prev-page": this.previousPage, offset: this.paginationBlogList.offset, limit: parseInt(this.blogsLimit, 10), total: this.totalBlogs, language: this.language, "mb-source": this.mbSource, "client-styling": paginationClientStyling, "client-styling-url": this.clientStylingUrl, "arrows-active": this.arrowsActive, "secondary-arrows-active": this.secondaryArrowsActive, "numbered-nav-active": this.numberedNavActive })), (!this.isLoading) &&
594
585
  index.h("div", { class: `GridContainerWrapper BlogPage-${this.currentPage} ${this.device}` }, this.displayedBlogResponse && this.displayedBlogResponse.items.map((data) => {
595
586
  var _a, _b;
596
- return index.h("div", { key: data.postID, class: data.isFeaturedPost ? 'GridContainer FeaturedPost' : 'GridContainer' }, index.h("div", { class: "GridWrapper" }, index.h("div", { class: "GridSector" }, this.showPublishingDate &&
597
- index.h("div", { class: "BlogDate" }, this.formatDate(data === null || data === void 0 ? void 0 : data.publishingDate)), this.showImage && ((_a = data.image) === null || _a === void 0 ? void 0 : _a.src) ? (index.h("div", { class: "VisualContent", style: { background: `url(${this.setImage(data.image)}) no-repeat center center / cover` } })) : (((_b = data.video) === null || _b === void 0 ? void 0 : _b.sources[this.device]) ? (index.h("video", { class: "VisualContent", src: data.video.sources[this.device], controls: true })) : (index.h("h1", { class: "VisualContent", style: { color: "#fff" } }, "No Image")))), index.h("div", { class: "GridSector" }, this.showTitle &&
598
- index.h("div", { class: "BlogTitle" }, data === null || data === void 0 ? void 0 : data.title), this.showContent &&
599
- this.renderContentConditionally(data === null || data === void 0 ? void 0 : data.descriptionPreview), this.showButton &&
600
- index.h("div", { class: "BlogLink" }, index.h("button", { onClick: () => this.getArticleId(data === null || data === void 0 ? void 0 : data.postID, data === null || data === void 0 ? void 0 : data.slug, data === null || data === void 0 ? void 0 : data.customPath) }, translate$1('readmore', this.language))))));
587
+ return index.h("a", { key: data.postID, class: data.isFeaturedPost ? 'BlogCardLink FeaturedPost' : 'BlogCardLink', href: `/${encodeURIComponent(this.language)}/blog/${encodeURIComponent(data.customPath || data.slug)}`, onClick: event => this.getArticleId(event, data) }, index.h("div", { class: data.isFeaturedPost ? 'GridContainer FeaturedPost' : 'GridContainer' }, index.h("div", { class: "GridWrapper" }, index.h("div", { class: "GridSector" }, this.showPublishingDate &&
588
+ index.h("div", { class: "BlogDate" }, index.h("time", { dateTime: data.publishingDate }, this.formatDate(data.publishingDate))), this.showImage && ((_a = data.image) === null || _a === void 0 ? void 0 : _a.src) ? (index.h("img", { class: "VisualContent", src: this.setImage(data.image), alt: data.image.alt || data.title, width: "400", height: "225", loading: "lazy" })) : (((_b = data.video) === null || _b === void 0 ? void 0 : _b.sources[this.device]) ? (index.h("video", { class: "VisualContent", src: data.video.sources[this.device] })) : (index.h("span", { class: "VisualContent", style: { color: "#fff" } }, "No Image")))), index.h("div", { class: "GridSector" }, this.showTitle &&
589
+ index.h("h2", { class: "BlogTitle" }, data.title), this.showContent &&
590
+ this.renderContentConditionally(data.descriptionPreview), this.showButton &&
591
+ index.h("span", { class: "BlogLink" }, translate$1('readmore', this.language))))));
601
592
  })), (this.isLoading) &&
602
593
  index.h("div", { class: "GridContainerWrapper LoadingGrid" }, placeholderCards))));
603
594
  }
@@ -13,6 +13,22 @@
13
13
  gap: 20px;
14
14
  }
15
15
 
16
+ .BlogCardLink {
17
+ display: block;
18
+ color: inherit;
19
+ text-decoration: none;
20
+ cursor: pointer;
21
+ }
22
+ .BlogCardLink .GridContainer {
23
+ height: 100%;
24
+ }
25
+ .BlogCardLink > .GridContainer > .GridWrapper {
26
+ height: 100%;
27
+ }
28
+ .BlogCardLink.FeaturedPost:first-child {
29
+ grid-column: 1/-1;
30
+ }
31
+
16
32
  .BlogPage-0 .GridContainer.FeaturedPost:first-child {
17
33
  width: 100%;
18
34
  flex-basis: auto;
@@ -49,7 +65,10 @@
49
65
  flex-direction: column;
50
66
  }
51
67
  .GridContainer .VisualContent {
68
+ display: block;
52
69
  width: 100%;
70
+ height: 100%;
71
+ object-fit: cover;
53
72
  }
54
73
  .GridContainer .BlogDate {
55
74
  position: absolute;
@@ -65,11 +84,14 @@
65
84
  z-index: 1;
66
85
  }
67
86
  .GridContainer .BlogTitle {
87
+ margin: 0;
68
88
  font-size: 24px;
89
+ font-weight: 400;
69
90
  color: #000;
70
91
  padding-bottom: 10px;
71
92
  }
72
93
  .GridContainer .BlogContent {
94
+ margin: 0;
73
95
  display: -webkit-box;
74
96
  font-size: 14px;
75
97
  line-height: 1.2em;
@@ -81,17 +103,11 @@
81
103
  overflow: hidden;
82
104
  }
83
105
  .GridContainer .BlogLink {
84
- color: #000;
106
+ color: #22B04E;
107
+ font-size: 14px;
85
108
  position: absolute;
86
109
  bottom: 16px;
87
- }
88
- .GridContainer .BlogLink button {
89
- font-size: 14px;
90
- border: none;
91
- padding: 0;
92
- background: none;
93
- color: #22B04E;
94
- cursor: pointer;
110
+ padding-top: 2.5px;
95
111
  }
96
112
 
97
113
  @container article (max-width: 550px) {
@@ -56,27 +56,12 @@ export class BlogArticlesGrid {
56
56
  padding: 12px 0 12px 12px;
57
57
  font-weight: 700;
58
58
  }`;
59
- this.setImage = (image) => {
60
- let source = '';
61
- switch (this.device) {
62
- case 'mobile':
63
- source = image.sources[0].pictureSource;
64
- break;
65
- case 'tablet':
66
- source = image.sources[1].pictureSource;
67
- break;
68
- case 'desktop':
69
- source = image.sources[2].pictureSource;
70
- break;
71
- }
72
- return source;
73
- };
74
59
  this.renderContentConditionally = (content) => {
75
60
  if (!content)
76
61
  return null;
77
62
  const hasBanner = content.includes('<bannermatrix-banner');
78
63
  if (!hasBanner || this.bannerMatrixReady) {
79
- return h("div", { class: "BlogContent", innerHTML: content });
64
+ return h("p", { class: "BlogContent", innerHTML: content });
80
65
  }
81
66
  return null;
82
67
  };
@@ -118,13 +103,17 @@ export class BlogArticlesGrid {
118
103
  this.allBlogResponse = undefined;
119
104
  this.totalBlogs = 0;
120
105
  }
121
- getArticleId(postId, slug, customPath) {
106
+ getArticleId(event, post) {
122
107
  var _a;
108
+ if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)
109
+ return;
110
+ const detail = { postId: post.postID.toString(), slug: post.slug, customPath: post.customPath };
123
111
  if (this.usePostmessage) {
124
- window.postMessage({ type: this.postMessageEvent, postId: postId.toString(), slug, customPath });
112
+ event.preventDefault();
113
+ window.postMessage(Object.assign({ type: this.postMessageEvent }, detail));
125
114
  }
126
115
  else {
127
- (_a = this.articleActionButton) === null || _a === void 0 ? void 0 : _a.emit({ postId: postId.toString(), slug, customPath });
116
+ (_a = this.articleActionButton) === null || _a === void 0 ? void 0 : _a.emit(detail);
128
117
  }
129
118
  }
130
119
  // Rerender when bannermatrix has finished loaded. Issue when bannermatrix passed as content from CMS.
@@ -217,9 +206,6 @@ export class BlogArticlesGrid {
217
206
  const latestFeatured = this.findLatestFeatured(items);
218
207
  items = this.sortArticlesByDate(items);
219
208
  items = this.moveLatestFeatureToStart(items, latestFeatured);
220
- items = items.map((item) => {
221
- return Object.assign(Object.assign({}, item), { publishingDate: new Date(item.publishingDate).toLocaleDateString() });
222
- });
223
209
  blogResponse = Object.assign(Object.assign({}, blogResponse), { items });
224
210
  if (allPosts) {
225
211
  this.allBlogResponse = blogResponse;
@@ -314,6 +300,11 @@ export class BlogArticlesGrid {
314
300
  disconnectedCallback() {
315
301
  this.stylingSubscription && this.stylingSubscription.unsubscribe();
316
302
  }
303
+ setImage(image) {
304
+ var _a, _b;
305
+ const sourceIndex = this.device === 'mobile' ? 0 : this.device === 'tablet' ? 1 : 2;
306
+ return ((_b = (_a = image.sources) === null || _a === void 0 ? void 0 : _a[sourceIndex]) === null || _b === void 0 ? void 0 : _b.pictureSource) || image.src;
307
+ }
317
308
  parseDate(dateString) {
318
309
  const date = new Date(dateString);
319
310
  const isValidDate = date instanceof Date && !Number.isNaN(date.getTime());
@@ -342,11 +333,11 @@ export class BlogArticlesGrid {
342
333
  return (h("div", { ref: el => this.stylingContainer = el }, h("div", { class: "BlogPageContainer" }, h("div", { class: "BlogGridPaginationWrapper" }, showPagination && h("helper-pagination", { "next-page": this.nextPage, "prev-page": this.previousPage, offset: this.paginationBlogList.offset, limit: parseInt(this.blogsLimit, 10), total: this.totalBlogs, language: this.language, "mb-source": this.mbSource, "client-styling": paginationClientStyling, "client-styling-url": this.clientStylingUrl, "arrows-active": this.arrowsActive, "secondary-arrows-active": this.secondaryArrowsActive, "numbered-nav-active": this.numberedNavActive })), (!this.isLoading) &&
343
334
  h("div", { class: `GridContainerWrapper BlogPage-${this.currentPage} ${this.device}` }, this.displayedBlogResponse && this.displayedBlogResponse.items.map((data) => {
344
335
  var _a, _b;
345
- return h("div", { key: data.postID, class: data.isFeaturedPost ? 'GridContainer FeaturedPost' : 'GridContainer' }, h("div", { class: "GridWrapper" }, h("div", { class: "GridSector" }, this.showPublishingDate &&
346
- h("div", { class: "BlogDate" }, this.formatDate(data === null || data === void 0 ? void 0 : data.publishingDate)), this.showImage && ((_a = data.image) === null || _a === void 0 ? void 0 : _a.src) ? (h("div", { class: "VisualContent", style: { background: `url(${this.setImage(data.image)}) no-repeat center center / cover` } })) : (((_b = data.video) === null || _b === void 0 ? void 0 : _b.sources[this.device]) ? (h("video", { class: "VisualContent", src: data.video.sources[this.device], controls: true })) : (h("h1", { class: "VisualContent", style: { color: "#fff" } }, "No Image")))), h("div", { class: "GridSector" }, this.showTitle &&
347
- h("div", { class: "BlogTitle" }, data === null || data === void 0 ? void 0 : data.title), this.showContent &&
348
- this.renderContentConditionally(data === null || data === void 0 ? void 0 : data.descriptionPreview), this.showButton &&
349
- h("div", { class: "BlogLink" }, h("button", { onClick: () => this.getArticleId(data === null || data === void 0 ? void 0 : data.postID, data === null || data === void 0 ? void 0 : data.slug, data === null || data === void 0 ? void 0 : data.customPath) }, translate('readmore', this.language))))));
336
+ return h("a", { key: data.postID, class: data.isFeaturedPost ? 'BlogCardLink FeaturedPost' : 'BlogCardLink', href: `/${encodeURIComponent(this.language)}/blog/${encodeURIComponent(data.customPath || data.slug)}`, onClick: event => this.getArticleId(event, data) }, h("div", { class: data.isFeaturedPost ? 'GridContainer FeaturedPost' : 'GridContainer' }, h("div", { class: "GridWrapper" }, h("div", { class: "GridSector" }, this.showPublishingDate &&
337
+ h("div", { class: "BlogDate" }, h("time", { dateTime: data.publishingDate }, this.formatDate(data.publishingDate))), this.showImage && ((_a = data.image) === null || _a === void 0 ? void 0 : _a.src) ? (h("img", { class: "VisualContent", src: this.setImage(data.image), alt: data.image.alt || data.title, width: "400", height: "225", loading: "lazy" })) : (((_b = data.video) === null || _b === void 0 ? void 0 : _b.sources[this.device]) ? (h("video", { class: "VisualContent", src: data.video.sources[this.device] })) : (h("span", { class: "VisualContent", style: { color: "#fff" } }, "No Image")))), h("div", { class: "GridSector" }, this.showTitle &&
338
+ h("h2", { class: "BlogTitle" }, data.title), this.showContent &&
339
+ this.renderContentConditionally(data.descriptionPreview), this.showButton &&
340
+ h("span", { class: "BlogLink" }, translate('readmore', this.language))))));
350
341
  })), (this.isLoading) &&
351
342
  h("div", { class: "GridContainerWrapper LoadingGrid" }, placeholderCards))));
352
343
  }
@@ -572,7 +563,7 @@ export class BlogArticlesGrid {
572
563
  "optional": false,
573
564
  "docs": {
574
565
  "tags": [],
575
- "text": "Property used to display the button"
566
+ "text": "Property used to display the read-more label"
576
567
  },
577
568
  "attribute": "show-button",
578
569
  "reflect": true,
@@ -608,7 +599,7 @@ export class BlogArticlesGrid {
608
599
  "optional": false,
609
600
  "docs": {
610
601
  "tags": [],
611
- "text": "Use postMessage event to communicate"
602
+ "text": "Keep the host app's SPA navigation when enabled."
612
603
  },
613
604
  "attribute": "use-postmessage",
614
605
  "reflect": true
@@ -625,7 +616,7 @@ export class BlogArticlesGrid {
625
616
  "optional": false,
626
617
  "docs": {
627
618
  "tags": [],
628
- "text": "Event name to be sent when the button is clicked"
619
+ "text": "Event name sent to the host app on card activation"
629
620
  },
630
621
  "attribute": "post-message-event",
631
622
  "reflect": true,
@@ -803,9 +794,14 @@ export class BlogArticlesGrid {
803
794
  "text": ""
804
795
  },
805
796
  "complexType": {
806
- "original": "any",
807
- "resolved": "any",
808
- "references": {}
797
+ "original": "Object",
798
+ "resolved": "Object",
799
+ "references": {
800
+ "Object": {
801
+ "location": "global",
802
+ "id": "global::Object"
803
+ }
804
+ }
809
805
  }
810
806
  }];
811
807
  }
@@ -245,7 +245,7 @@ const getDevicePlatform = () => {
245
245
  return 'mtWeb';
246
246
  };
247
247
 
248
- const blogArticlesGridCss = ":host {\n display: block;\n}\n\n.BlogPageContainer {\n background: #0A0A17;\n padding: 20px;\n}\n\n.GridContainerWrapper {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 20px;\n}\n\n.BlogPage-0 .GridContainer.FeaturedPost:first-child {\n width: 100%;\n flex-basis: auto;\n}\n\n.GridContainer {\n container-type: inline-size;\n container-name: article;\n border-radius: 15px;\n color: #000;\n overflow: hidden;\n}\n.GridContainer.FeaturedPost:first-child {\n grid-column: 1/-1;\n width: 100%;\n}\n.GridContainer .GridWrapper {\n display: flex;\n flex-direction: row;\n height: 280px;\n background: var(--emw--color-white, #FFFFFF);\n}\n.GridContainer .GridSector {\n flex-basis: 50%;\n position: relative;\n}\n.GridContainer .GridSector:first-of-type {\n height: 280px;\n display: flex;\n}\n.GridContainer .GridSector:last-of-type {\n padding: 20px 40px;\n display: flex;\n flex-direction: column;\n}\n.GridContainer .VisualContent {\n width: 100%;\n}\n.GridContainer .BlogDate {\n position: absolute;\n bottom: 0px;\n left: 30px;\n font-size: 12px;\n border-radius: 5px 5px 0 0;\n padding: 10px;\n width: fit-content;\n text-align: center;\n color: var(--emw--color-white, #FFFFFF);\n background-color: #CD0B5E;\n z-index: 1;\n}\n.GridContainer .BlogTitle {\n font-size: 24px;\n color: #000;\n padding-bottom: 10px;\n}\n.GridContainer .BlogContent {\n display: -webkit-box;\n font-size: 14px;\n line-height: 1.2em;\n -webkit-line-clamp: 6;\n color: #000;\n -webkit-box-orient: vertical;\n box-sizing: border-box;\n text-overflow: ellipsis;\n overflow: hidden;\n}\n.GridContainer .BlogLink {\n color: #000;\n position: absolute;\n bottom: 16px;\n}\n.GridContainer .BlogLink button {\n font-size: 14px;\n border: none;\n padding: 0;\n background: none;\n color: #22B04E;\n cursor: pointer;\n}\n\n@container article (max-width: 550px) {\n .GridContainer .GridWrapper {\n height: 380px;\n flex-direction: column;\n }\n .GridContainer .GridWrapper .GridSector:first-of-type {\n height: 120px;\n flex-shrink: 0;\n flex-basis: 150px;\n }\n .GridContainer .GridWrapper .GridSector:last-of-type {\n padding: 20px 20px 40px;\n }\n}\n.LoadingImage {\n width: 100%;\n height: 100%;\n background-color: var(--emw--color-gray-100, #E6E6E6);\n}\n\n.LoadingStripe {\n border: 1px solid var(--emw--color-white, #FFFFFF);\n height: 20%;\n background-color: var(--emw--color-gray-100, #E6E6E6);\n margin-bottom: 5px;\n}\n\n.LoadingSmallStripe {\n width: 40%;\n}\n\n.LoadingMediumStripe {\n width: 70%;\n}\n\n.BlogLink.LoadingLongStripe {\n position: static;\n width: 100%;\n}\n\n.GridContainerWrapper.LoadingGrid .GridSector {\n justify-content: space-around;\n}\n\n.GridContainerWrapper.LoadingGrid .LoadingImage, .GridContainerWrapper.LoadingGrid .LoadingStripe {\n animation: pulsatingLoader 2s ease-in-out 0s infinite reverse;\n -webkit-animation: pulsatingLoader 2s ease-in-out 0s infinite reverse;\n}\n\n@keyframes pulsatingLoader {\n 0% {\n opacity: 0.5;\n }\n 50% {\n opacity: 1;\n }\n 100% {\n opacity: 0.5;\n }\n}\n@-webkit-keyframes pulsatingLoader {\n 0% {\n opacity: 0.5;\n }\n 50% {\n opacity: 1;\n }\n 100% {\n opacity: 0.5;\n }\n}";
248
+ const blogArticlesGridCss = ":host {\n display: block;\n}\n\n.BlogPageContainer {\n background: #0A0A17;\n padding: 20px;\n}\n\n.GridContainerWrapper {\n display: grid;\n grid-template-columns: 1fr 1fr;\n gap: 20px;\n}\n\n.BlogCardLink {\n display: block;\n color: inherit;\n text-decoration: none;\n cursor: pointer;\n}\n.BlogCardLink .GridContainer {\n height: 100%;\n}\n.BlogCardLink > .GridContainer > .GridWrapper {\n height: 100%;\n}\n.BlogCardLink.FeaturedPost:first-child {\n grid-column: 1/-1;\n}\n\n.BlogPage-0 .GridContainer.FeaturedPost:first-child {\n width: 100%;\n flex-basis: auto;\n}\n\n.GridContainer {\n container-type: inline-size;\n container-name: article;\n border-radius: 15px;\n color: #000;\n overflow: hidden;\n}\n.GridContainer.FeaturedPost:first-child {\n grid-column: 1/-1;\n width: 100%;\n}\n.GridContainer .GridWrapper {\n display: flex;\n flex-direction: row;\n height: 280px;\n background: var(--emw--color-white, #FFFFFF);\n}\n.GridContainer .GridSector {\n flex-basis: 50%;\n position: relative;\n}\n.GridContainer .GridSector:first-of-type {\n height: 280px;\n display: flex;\n}\n.GridContainer .GridSector:last-of-type {\n padding: 20px 40px;\n display: flex;\n flex-direction: column;\n}\n.GridContainer .VisualContent {\n display: block;\n width: 100%;\n height: 100%;\n object-fit: cover;\n}\n.GridContainer .BlogDate {\n position: absolute;\n bottom: 0px;\n left: 30px;\n font-size: 12px;\n border-radius: 5px 5px 0 0;\n padding: 10px;\n width: fit-content;\n text-align: center;\n color: var(--emw--color-white, #FFFFFF);\n background-color: #CD0B5E;\n z-index: 1;\n}\n.GridContainer .BlogTitle {\n margin: 0;\n font-size: 24px;\n font-weight: 400;\n color: #000;\n padding-bottom: 10px;\n}\n.GridContainer .BlogContent {\n margin: 0;\n display: -webkit-box;\n font-size: 14px;\n line-height: 1.2em;\n -webkit-line-clamp: 6;\n color: #000;\n -webkit-box-orient: vertical;\n box-sizing: border-box;\n text-overflow: ellipsis;\n overflow: hidden;\n}\n.GridContainer .BlogLink {\n color: #22B04E;\n font-size: 14px;\n position: absolute;\n bottom: 16px;\n padding-top: 2.5px;\n}\n\n@container article (max-width: 550px) {\n .GridContainer .GridWrapper {\n height: 380px;\n flex-direction: column;\n }\n .GridContainer .GridWrapper .GridSector:first-of-type {\n height: 120px;\n flex-shrink: 0;\n flex-basis: 150px;\n }\n .GridContainer .GridWrapper .GridSector:last-of-type {\n padding: 20px 20px 40px;\n }\n}\n.LoadingImage {\n width: 100%;\n height: 100%;\n background-color: var(--emw--color-gray-100, #E6E6E6);\n}\n\n.LoadingStripe {\n border: 1px solid var(--emw--color-white, #FFFFFF);\n height: 20%;\n background-color: var(--emw--color-gray-100, #E6E6E6);\n margin-bottom: 5px;\n}\n\n.LoadingSmallStripe {\n width: 40%;\n}\n\n.LoadingMediumStripe {\n width: 70%;\n}\n\n.BlogLink.LoadingLongStripe {\n position: static;\n width: 100%;\n}\n\n.GridContainerWrapper.LoadingGrid .GridSector {\n justify-content: space-around;\n}\n\n.GridContainerWrapper.LoadingGrid .LoadingImage, .GridContainerWrapper.LoadingGrid .LoadingStripe {\n animation: pulsatingLoader 2s ease-in-out 0s infinite reverse;\n -webkit-animation: pulsatingLoader 2s ease-in-out 0s infinite reverse;\n}\n\n@keyframes pulsatingLoader {\n 0% {\n opacity: 0.5;\n }\n 50% {\n opacity: 1;\n }\n 100% {\n opacity: 0.5;\n }\n}\n@-webkit-keyframes pulsatingLoader {\n 0% {\n opacity: 0.5;\n }\n 50% {\n opacity: 1;\n }\n 100% {\n opacity: 0.5;\n }\n}";
249
249
  const BlogArticlesGridStyle0 = blogArticlesGridCss;
250
250
 
251
251
  const BlogArticlesGrid = class {
@@ -303,27 +303,12 @@ const BlogArticlesGrid = class {
303
303
  padding: 12px 0 12px 12px;
304
304
  font-weight: 700;
305
305
  }`;
306
- this.setImage = (image) => {
307
- let source = '';
308
- switch (this.device) {
309
- case 'mobile':
310
- source = image.sources[0].pictureSource;
311
- break;
312
- case 'tablet':
313
- source = image.sources[1].pictureSource;
314
- break;
315
- case 'desktop':
316
- source = image.sources[2].pictureSource;
317
- break;
318
- }
319
- return source;
320
- };
321
306
  this.renderContentConditionally = (content) => {
322
307
  if (!content)
323
308
  return null;
324
309
  const hasBanner = content.includes('<bannermatrix-banner');
325
310
  if (!hasBanner || this.bannerMatrixReady) {
326
- return h("div", { class: "BlogContent", innerHTML: content });
311
+ return h("p", { class: "BlogContent", innerHTML: content });
327
312
  }
328
313
  return null;
329
314
  };
@@ -365,13 +350,17 @@ const BlogArticlesGrid = class {
365
350
  this.allBlogResponse = undefined;
366
351
  this.totalBlogs = 0;
367
352
  }
368
- getArticleId(postId, slug, customPath) {
353
+ getArticleId(event, post) {
369
354
  var _a;
355
+ if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey)
356
+ return;
357
+ const detail = { postId: post.postID.toString(), slug: post.slug, customPath: post.customPath };
370
358
  if (this.usePostmessage) {
371
- window.postMessage({ type: this.postMessageEvent, postId: postId.toString(), slug, customPath });
359
+ event.preventDefault();
360
+ window.postMessage(Object.assign({ type: this.postMessageEvent }, detail));
372
361
  }
373
362
  else {
374
- (_a = this.articleActionButton) === null || _a === void 0 ? void 0 : _a.emit({ postId: postId.toString(), slug, customPath });
363
+ (_a = this.articleActionButton) === null || _a === void 0 ? void 0 : _a.emit(detail);
375
364
  }
376
365
  }
377
366
  // Rerender when bannermatrix has finished loaded. Issue when bannermatrix passed as content from CMS.
@@ -464,9 +453,6 @@ const BlogArticlesGrid = class {
464
453
  const latestFeatured = this.findLatestFeatured(items);
465
454
  items = this.sortArticlesByDate(items);
466
455
  items = this.moveLatestFeatureToStart(items, latestFeatured);
467
- items = items.map((item) => {
468
- return Object.assign(Object.assign({}, item), { publishingDate: new Date(item.publishingDate).toLocaleDateString() });
469
- });
470
456
  blogResponse = Object.assign(Object.assign({}, blogResponse), { items });
471
457
  if (allPosts) {
472
458
  this.allBlogResponse = blogResponse;
@@ -561,6 +547,11 @@ const BlogArticlesGrid = class {
561
547
  disconnectedCallback() {
562
548
  this.stylingSubscription && this.stylingSubscription.unsubscribe();
563
549
  }
550
+ setImage(image) {
551
+ var _a, _b;
552
+ const sourceIndex = this.device === 'mobile' ? 0 : this.device === 'tablet' ? 1 : 2;
553
+ return ((_b = (_a = image.sources) === null || _a === void 0 ? void 0 : _a[sourceIndex]) === null || _b === void 0 ? void 0 : _b.pictureSource) || image.src;
554
+ }
564
555
  parseDate(dateString) {
565
556
  const date = new Date(dateString);
566
557
  const isValidDate = date instanceof Date && !Number.isNaN(date.getTime());
@@ -589,11 +580,11 @@ const BlogArticlesGrid = class {
589
580
  return (h("div", { ref: el => this.stylingContainer = el }, h("div", { class: "BlogPageContainer" }, h("div", { class: "BlogGridPaginationWrapper" }, showPagination && h("helper-pagination", { "next-page": this.nextPage, "prev-page": this.previousPage, offset: this.paginationBlogList.offset, limit: parseInt(this.blogsLimit, 10), total: this.totalBlogs, language: this.language, "mb-source": this.mbSource, "client-styling": paginationClientStyling, "client-styling-url": this.clientStylingUrl, "arrows-active": this.arrowsActive, "secondary-arrows-active": this.secondaryArrowsActive, "numbered-nav-active": this.numberedNavActive })), (!this.isLoading) &&
590
581
  h("div", { class: `GridContainerWrapper BlogPage-${this.currentPage} ${this.device}` }, this.displayedBlogResponse && this.displayedBlogResponse.items.map((data) => {
591
582
  var _a, _b;
592
- return h("div", { key: data.postID, class: data.isFeaturedPost ? 'GridContainer FeaturedPost' : 'GridContainer' }, h("div", { class: "GridWrapper" }, h("div", { class: "GridSector" }, this.showPublishingDate &&
593
- h("div", { class: "BlogDate" }, this.formatDate(data === null || data === void 0 ? void 0 : data.publishingDate)), this.showImage && ((_a = data.image) === null || _a === void 0 ? void 0 : _a.src) ? (h("div", { class: "VisualContent", style: { background: `url(${this.setImage(data.image)}) no-repeat center center / cover` } })) : (((_b = data.video) === null || _b === void 0 ? void 0 : _b.sources[this.device]) ? (h("video", { class: "VisualContent", src: data.video.sources[this.device], controls: true })) : (h("h1", { class: "VisualContent", style: { color: "#fff" } }, "No Image")))), h("div", { class: "GridSector" }, this.showTitle &&
594
- h("div", { class: "BlogTitle" }, data === null || data === void 0 ? void 0 : data.title), this.showContent &&
595
- this.renderContentConditionally(data === null || data === void 0 ? void 0 : data.descriptionPreview), this.showButton &&
596
- h("div", { class: "BlogLink" }, h("button", { onClick: () => this.getArticleId(data === null || data === void 0 ? void 0 : data.postID, data === null || data === void 0 ? void 0 : data.slug, data === null || data === void 0 ? void 0 : data.customPath) }, translate$1('readmore', this.language))))));
583
+ return h("a", { key: data.postID, class: data.isFeaturedPost ? 'BlogCardLink FeaturedPost' : 'BlogCardLink', href: `/${encodeURIComponent(this.language)}/blog/${encodeURIComponent(data.customPath || data.slug)}`, onClick: event => this.getArticleId(event, data) }, h("div", { class: data.isFeaturedPost ? 'GridContainer FeaturedPost' : 'GridContainer' }, h("div", { class: "GridWrapper" }, h("div", { class: "GridSector" }, this.showPublishingDate &&
584
+ h("div", { class: "BlogDate" }, h("time", { dateTime: data.publishingDate }, this.formatDate(data.publishingDate))), this.showImage && ((_a = data.image) === null || _a === void 0 ? void 0 : _a.src) ? (h("img", { class: "VisualContent", src: this.setImage(data.image), alt: data.image.alt || data.title, width: "400", height: "225", loading: "lazy" })) : (((_b = data.video) === null || _b === void 0 ? void 0 : _b.sources[this.device]) ? (h("video", { class: "VisualContent", src: data.video.sources[this.device] })) : (h("span", { class: "VisualContent", style: { color: "#fff" } }, "No Image")))), h("div", { class: "GridSector" }, this.showTitle &&
585
+ h("h2", { class: "BlogTitle" }, data.title), this.showContent &&
586
+ this.renderContentConditionally(data.descriptionPreview), this.showButton &&
587
+ h("span", { class: "BlogLink" }, translate$1('readmore', this.language))))));
597
588
  })), (this.isLoading) &&
598
589
  h("div", { class: "GridContainerWrapper LoadingGrid" }, placeholderCards))));
599
590
  }
@@ -48,20 +48,20 @@ export declare class BlogArticlesGrid {
48
48
  */
49
49
  showContent: boolean;
50
50
  /**
51
- * Property used to display the button
52
- */
51
+ * Property used to display the read-more label
52
+ */
53
53
  showButton: boolean;
54
54
  /**
55
55
  * Hide the error message when the request fails
56
56
  */
57
57
  hideError: boolean;
58
58
  /**
59
- * Use postMessage event to communicate
60
- */
59
+ * Keep the host app's SPA navigation when enabled.
60
+ */
61
61
  usePostmessage: boolean;
62
62
  /**
63
- * Event name to be sent when the button is clicked
64
- */
63
+ * Event name sent to the host app on card activation
64
+ */
65
65
  postMessageEvent: string;
66
66
  /**
67
67
  * Customize pagination: Activate pagination numbered navigation
@@ -95,8 +95,8 @@ export declare class BlogArticlesGrid {
95
95
  * Filter blog post list using eventId from Sport page
96
96
  */
97
97
  eventId?: string;
98
- articleActionButton: EventEmitter<Object> | undefined;
99
- getArticleId(postId: number, slug: string, customPath: string): void;
98
+ articleActionButton?: EventEmitter<Object>;
99
+ getArticleId(event: MouseEvent, post: BlogPost): void;
100
100
  paginationBlogList: any;
101
101
  currentPage: number;
102
102
  hasErrors: boolean;
@@ -128,7 +128,7 @@ export declare class BlogArticlesGrid {
128
128
  handleClientStyling(): void;
129
129
  componentDidLoad(): void;
130
130
  disconnectedCallback(): void;
131
- setImage: (image: any) => string;
131
+ setImage(image: BlogPost['image']): string;
132
132
  parseDate(dateString: string): Date;
133
133
  formatDate(dateString: string): string;
134
134
  renderContentConditionally: (content: string) => HTMLElement | null;
@@ -64,7 +64,7 @@ export namespace Components {
64
64
  */
65
65
  "paginationActive"?: boolean;
66
66
  /**
67
- * Event name to be sent when the button is clicked
67
+ * Event name sent to the host app on card activation
68
68
  */
69
69
  "postMessageEvent": string;
70
70
  /**
@@ -72,7 +72,7 @@ export namespace Components {
72
72
  */
73
73
  "secondaryArrowsActive": boolean;
74
74
  /**
75
- * Property used to display the button
75
+ * Property used to display the read-more label
76
76
  */
77
77
  "showButton": boolean;
78
78
  /**
@@ -92,7 +92,7 @@ export namespace Components {
92
92
  */
93
93
  "showTitle": boolean;
94
94
  /**
95
- * Use postMessage event to communicate
95
+ * Keep the host app's SPA navigation when enabled.
96
96
  */
97
97
  "usePostmessage": boolean;
98
98
  /**
@@ -107,7 +107,7 @@ export interface BlogArticlesGridCustomEvent<T> extends CustomEvent<T> {
107
107
  }
108
108
  declare global {
109
109
  interface HTMLBlogArticlesGridElementEventMap {
110
- "articleActionButton": any;
110
+ "articleActionButton": Object;
111
111
  }
112
112
  interface HTMLBlogArticlesGridElement extends Components.BlogArticlesGrid, HTMLStencilElement {
113
113
  addEventListener<K extends keyof HTMLBlogArticlesGridElementEventMap>(type: K, listener: (this: HTMLBlogArticlesGridElement, ev: BlogArticlesGridCustomEvent<HTMLBlogArticlesGridElementEventMap[K]>) => any, options?: boolean | AddEventListenerOptions): void;
@@ -177,7 +177,7 @@ declare namespace LocalJSX {
177
177
  * Customize pagination: Activate pagination numbered navigation
178
178
  */
179
179
  "numberedNavActive"?: boolean;
180
- "onArticleActionButton"?: (event: BlogArticlesGridCustomEvent<any>) => void;
180
+ "onArticleActionButton"?: (event: BlogArticlesGridCustomEvent<Object>) => void;
181
181
  /**
182
182
  * Page to particularly be opened on start
183
183
  */
@@ -187,7 +187,7 @@ declare namespace LocalJSX {
187
187
  */
188
188
  "paginationActive"?: boolean;
189
189
  /**
190
- * Event name to be sent when the button is clicked
190
+ * Event name sent to the host app on card activation
191
191
  */
192
192
  "postMessageEvent"?: string;
193
193
  /**
@@ -195,7 +195,7 @@ declare namespace LocalJSX {
195
195
  */
196
196
  "secondaryArrowsActive"?: boolean;
197
197
  /**
198
- * Property used to display the button
198
+ * Property used to display the read-more label
199
199
  */
200
200
  "showButton"?: boolean;
201
201
  /**
@@ -215,7 +215,7 @@ declare namespace LocalJSX {
215
215
  */
216
216
  "showTitle"?: boolean;
217
217
  /**
218
- * Use postMessage event to communicate
218
+ * Keep the host app's SPA navigation when enabled.
219
219
  */
220
220
  "usePostmessage": boolean;
221
221
  /**
@@ -22,6 +22,7 @@ export type BlogPost = {
22
22
  eventIds: string[];
23
23
  image: {
24
24
  src: string;
25
+ alt?: string;
25
26
  width: string;
26
27
  height: string;
27
28
  sources: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/blog-articles-grid",
3
- "version": "1.98.19",
3
+ "version": "1.98.21",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.js",
6
6
  "es2015": "./dist/esm/index.mjs",