@everymatrix/blog-articles-grid 1.13.15 → 1.13.16
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.
- package/dist/blog-articles-grid/blog-articles-grid.esm.js +1 -1
- package/dist/blog-articles-grid/p-ce775053.entry.js +1 -0
- package/dist/cjs/blog-articles-grid.cjs.js +1 -1
- package/dist/cjs/blog-articles-grid_2.cjs.entry.js +60 -36
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/blog-articles-grid/blog-articles-grid.js +70 -23
- package/dist/collection/utils/locale.utils.js +1 -1
- package/dist/collection/utils/utils.js +27 -0
- package/dist/components/blog-articles-grid.js +63 -23
- package/dist/components/helper-pagination2.js +13 -28
- package/dist/esm/blog-articles-grid.js +1 -1
- package/dist/esm/blog-articles-grid_2.entry.js +60 -36
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/blog-articles-grid/blog-articles-grid.d.ts +24 -16
- package/dist/types/components.d.ts +16 -0
- package/dist/types/utils/utils.d.ts +2 -0
- package/package.json +1 -1
- package/dist/blog-articles-grid/p-341b0ae5.entry.js +0 -1
- /package/dist/types/Users/{sebastian.strulea/Documents/work → user/workspace/everymatrix}/widgets-stencil/packages/blog-articles-grid/.stencil/packages/blog-articles-grid/stencil.config.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as e,b as t}from"./p-ed2f13d0.js";(()=>{const t=import.meta.url,n={};return""!==t&&(n.resourcesUrl=new URL(".",t).href),e(n)})().then((e=>t([["p-
|
|
1
|
+
import{p as e,b as t}from"./p-ed2f13d0.js";(()=>{const t=import.meta.url,n={};return""!==t&&(n.resourcesUrl=new URL(".",t).href),e(n)})().then((e=>t([["p-ce775053",[[1,"blog-articles-grid",{cmsEndpoint:[513,"cms-endpoint"],language:[513],handleClick:[513,"handle-click"],clientStyling:[513,"client-styling"],clientStylingUrl:[513,"client-styling-url"],showPublishingDate:[516,"show-publishing-date"],showImage:[516,"show-image"],showTitle:[516,"show-title"],showContent:[516,"show-content"],showButton:[516,"show-button"],usePostmessage:[516,"use-postmessage"],postMessageEvent:[513,"post-message-event"],blogsLimit:[514,"blogs-limit"],paginationActive:[516,"pagination-active"],arrowsActive:[516,"arrows-active"],secondaryArrowsActive:[516,"secondary-arrows-active"],numberedNavActive:[516,"numbered-nav-active"],userRoles:[513,"user-roles"],cmsStage:[513,"cms-stage"],paginationBlogList:[32],currentPage:[32],hasErrors:[32],limitStylingAppends:[32],isLoading:[32],bannerMatrixReady:[32],nextPage:[32],previousPage:[32],device:[32]},[[8,"BannerMatrixReady","handleBannerReady"],[0,"hpPageChange","hpPageChange"]]],[1,"helper-pagination",{firstPage:[1540,"first-page"],previousPage:[1540,"previous-page"],offset:[1538],limit:[1538],total:[1538],language:[1537],clientStyling:[1537,"client-styling"],clientStylingUrlContent:[1537,"client-styling-url-content"],arrowsActive:[1540,"arrows-active"],secondaryArrowsActive:[1540,"secondary-arrows-active"],numberedNavActive:[1540,"numbered-nav-active"],offsetInt:[32],lastPage:[32],limitInt:[32],totalInt:[32],pagesArray:[32],endInt:[32],limitStylingAppends:[32]}]]]],e)));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,c as i,h as n}from"./p-ed2f13d0.js";const e=["ro","en","fr","ar","hu"],s={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:"Read more"}},o=(t,i)=>{const n=i;return s[void 0!==n&&e.includes(n)?n:"en"][t]},r=class{constructor(e){t(this,e),this.articleActionButton=i(this,"articleActionButton",7),this.language="en",this.clientStyling="",this.clientStylingUrl="",this.showPublishingDate=!0,this.showImage=!0,this.showTitle=!0,this.showContent=!0,this.showButton=!0,this.postMessageEvent="articleActionButton",this.userRoles="everyone",this.cmsStage="stage",this.paginationBlogList={offset:0},this.currentPage=0,this.hasErrors=!1,this.limitStylingAppends=!1,this.isLoading=!0,this.bannerMatrixReady=!1,this.nextPage="",this.previousPage="",this.device="",this.defaultStyling="\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.setClientStyling=()=>{let t=document.createElement("style");t.innerHTML=this.clientStyling,this.stylingContainer.prepend(t)},this.setClientStylingURL=()=>{let t=new URL(this.clientStylingUrl),i=document.createElement("style");fetch(t.href).then((t=>t.text())).then((t=>{i.innerHTML=t,setTimeout((()=>{this.stylingContainer.prepend(i)}),1)})).catch((t=>{console.log("error ",t)}))},this.renderContentConditionally=t=>{if(t)return-1!==t.indexOf("<bannermatrix-banner")?this.bannerMatrixReady?n("div",{class:"BlogContent",innerHTML:t}):null:n("div",{class:"BlogContent",innerHTML:t})}}getArticleId(t){this.articleActionButton.emit({postId:t}),this.usePostmessage&&window.postMessage({type:this.postMessageEvent,postId:t})}handleBannerReady(){this.bannerMatrixReady=!0}watchEndpoint(t,i){t&&t!=i&&this.cmsEndpoint&&this.getBlogArticleGrid()}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.currentPage+1>this.lastPage?this.nextPage=null:this.currentPage<0?this.previousPage=null:this.getBlogArticleGrid()}handleAction(t){this.getArticleId(t)}connectedCallback(){this.cmsEndpoint&&this.language&&this.getBlogArticleGrid()}componentDidLoad(){window.postMessage({type:"BlogArticlesGridLoaded"},window.location.href),this.device=function(){const t=navigator.userAgent.toLowerCase(),i=screen.availWidth,n=screen.availHeight;if(t.includes("iphone"))return"mobile";if(t.includes("android")){if(n>i&&i<800)return"mobile";if(i>n&&n<800)return"tablet"}return"desktop"}()}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){const n=t.indexOf(i);return-1!==n&&(t.splice(n,1),t.unshift(i)),t}getBlogArticleGrid(){this.isLoading=!0;let t=new URL(`${this.cmsEndpoint}/${this.language}/blog-posts`);t.searchParams.append("per_page",JSON.stringify(this.blogsLimit)),t.searchParams.append("page",JSON.stringify(this.currentPage+1)),t.searchParams.append("env",this.cmsStage),t.searchParams.append("userRoles",this.userRoles),t.searchParams.append("platform",(()=>{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)return"PC"===t?"dk":"mtWeb"})()),fetch(t.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=>{this.lastPage=+t.pages.last.slice(t.pages.last.lastIndexOf("=")+1);let i=t.items;this.nextPage=t.pages.next,this.previousPage=t.pages.previous;const n=this.findLatestFeatured(i);this.blogData=this.sortArticlesByDate(i),this.blogData=this.moveLatestFeatureToStart(i,n),this.blogData.items=i.map((t=>Object.assign(Object.assign({},t),{publishingDate:new Date(t.publishingDate).toLocaleDateString()}))),this.isLoading=!1})).catch((t=>{this.hasErrors=!0,console.log("Error",t)})).finally((()=>this.isLoading=!1))}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}formatDateToYearMonthDay(t){let i=new Date(t),n=i.getFullYear(),e=String(i.getMonth()+1).padStart(2,"0");return`${String(i.getDate()).padStart(2,"0")}-${e}-${n}`}render(){var t,i;return this.hasErrors?n("div",{class:"BlogArticleDetails"},n("div",{class:"Title"},o("error",this.language))):n("div",{ref:t=>this.stylingContainer=t},n("div",{class:"BlogGridPaginationWrapper"},1==this.paginationActive&&n("helper-pagination",{"next-page":this.nextPage,"prev-page":this.previousPage,offset:this.paginationBlogList.offset,limit:this.blogsLimit,total:null===(i=null===(t=this.blogData)||void 0===t?void 0:t.items)||void 0===i?void 0:i.length,language:this.language,"client-styling":this.clientStyling||this.defaultStyling,"arrows-active":this.arrowsActive||!1,"secondary-arrows-active":this.secondaryArrowsActive||!1,"numbered-nav-active":this.numberedNavActive||!1})),!this.isLoading&&n("div",{class:`GridContainerWrapper BlogPage-${this.currentPage}`},this.blogData.map((t=>{var i,e;return n("div",{class:"GridContainer"},this.showPublishingDate&&n("div",{class:"BlogDate"},this.formatDateToYearMonthDay(null==t?void 0:t.publishingDate)),this.showImage&&n("div",{class:"BlogBanner"},(null===(i=t.image)||void 0===i?void 0:i.src)?n("img",{src:t.image.src,alt:t.image.src}):(null===(e=t.video)||void 0===e?void 0:e.sources[this.device])?n("video",{src:t.video.sources[this.device],controls:!0}):n("h1",{style:{color:"white"}},"No Image")),this.showTitle&&n("div",{class:"BlogTitle"},null==t?void 0:t.title),this.showContent&&this.renderContentConditionally(null==t?void 0:t.content),this.showButton&&n("div",{class:"BlogLink"},n("button",{onClick:()=>this.handleAction(null==t?void 0:t.postID)},o("readmore",this.language))))}))))}static get watchers(){return{cmsEndpoint:["watchEndpoint"],language:["watchEndpoint"]}}};r.style=":host {\n display: block;\n}\n\n.GridContainerWrapper {\n display: grid;\n}\n\n.GridContainer {\n margin: auto;\n width: 100%;\n height: 280px;\n border-radius: 15px;\n background-color: #07072A;\n margin-bottom: 20px;\n display: grid;\n gap: 30px;\n grid-template-rows: 1fr 4fr 1fr 1fr;\n grid-template-columns: 30px 1fr 1fr 30px;\n}\n.GridContainer .BlogBanner {\n grid-column: 1/3;\n grid-row: 1/5;\n}\n.GridContainer .BlogBanner img {\n border-radius: 5px 0 0 5px;\n width: 100%;\n height: 280px;\n}\n.GridContainer .BlogDate {\n font-size: 12px;\n border-radius: 5px 5px 0 0;\n padding: 10px;\n width: fit-content;\n text-align: center;\n color: #FFFFFF;\n background-color: #0D0D4D;\n grid-column: 2/2;\n grid-row: 4/4;\n z-index: 1;\n}\n.GridContainer .BlogTitle {\n font-size: 24px;\n color: #FFF;\n margin-top: 20px;\n grid-column: 3/5;\n}\n.GridContainer .BlogContent {\n font-size: 14px;\n color: #FFF;\n width: 90%;\n max-height: 80px;\n overflow: hidden;\n text-overflow: ellipsis;\n grid-column: 3/5;\n}\n.GridContainer .BlogLink {\n grid-column: 3/5;\n color: #FFF;\n}\n.GridContainer .BlogLink button {\n font-size: 14px;\n border: none;\n padding: 0;\n background: none;\n color: #D0046C;\n cursor: pointer;\n}\n\n@container (max-width: 475px) {\n .GridContainerWrapper {\n display: grid;\n }\n\n .GridContainer {\n margin: auto;\n width: 100%;\n min-height: 400px;\n gap: 10%;\n padding-bottom: 30px;\n border-radius: 5px;\n background-color: #07072A;\n margin-bottom: 20px;\n display: grid;\n grid-template-rows: repeat(auto-fit, minmax(50px, 1fr));\n grid-template-rows: auto auto auto 50px;\n grid-template-columns: 15px auto auto 15px;\n gap: 10px;\n }\n .GridContainer .BlogBanner {\n grid-column: 1/5;\n grid-row: 1/3;\n margin: 0;\n }\n .GridContainer .BlogBanner img {\n width: 100%;\n height: 232px;\n border-radius: 5px 5px 0 0;\n }\n .GridContainer .BlogDate {\n grid-column: 2/3;\n grid-row: 2/3;\n font-size: 12px;\n border-radius: 5px 5px 0 0;\n padding: 10px;\n width: fit-content;\n text-align: center;\n color: #FFFFFF;\n background-color: #0D0D4D;\n z-index: 1;\n }\n .GridContainer .BlogTitle {\n grid-column: 2/4;\n font-size: 24px;\n color: #FFF;\n }\n .GridContainer .BlogContent {\n grid-column: 2/4;\n font-size: 14px;\n color: #FFF;\n }\n .GridContainer .BlogLink {\n grid-column: 2/4;\n color: #FFF;\n cursor: pointer;\n }\n .GridContainer .BlogLink button {\n font-size: 14px;\n border: none;\n background: none;\n color: #D0046C;\n cursor: pointer;\n }\n}";const a=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)),h=["ro","en"],l={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"}},d=(t,i)=>{const n=i;return l[void 0!==n&&h.includes(n)?n:"en"][t]},c=class{constructor(n){t(this,n),this.hpPageChange=i(this,"hpPageChange",7),this.firstPage=!1,this.previousPage=!1,this.offset=0,this.limit=1,this.total=1,this.language="en",this.clientStyling="",this.clientStylingUrlContent="",this.pagesArray=[],this.endInt=0,this.userAgent=window.navigator.userAgent,this.currentPage=1,this.limitStylingAppends=!1,this.navigateTo=t=>{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,this.hpPageChange.emit({offset:this.offsetInt,limit:this.limitInt,total:this.totalInt})},this.paginationNavigation=(t,i)=>{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,this.hpPageChange.emit({offset:this.offsetInt,limit:this.limitInt,total:this.totalInt})},this.setClientStyling=()=>{let t=document.createElement("style");t.innerHTML=this.clientStyling,this.stylingContainer.prepend(t)},this.setClientStylingURL=()=>{let t=document.createElement("style");setTimeout((()=>{t.innerHTML=this.clientStylingUrlContent,this.stylingContainer.prepend(t)}),1)}}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("..."))}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrlContent&&this.setClientStylingURL(),this.limitStylingAppends=!0)}render(){let t=n("ul",{class:"PaginationArea"},this.pagesArray.map(((t,i)=>n("li",{class:"PaginationItem"+(t===this.currentPage?" ActiveItem":" ")+" "+(a(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.previousPage,onClick:this.navigateTo.bind(this,"firstPage")},n("span",{class:"NavigationButton"},d("firstPage",this.language)),n("span",{class:"NavigationIcon"})),e=n("div",{class:"LeftItems"},this.secondaryArrowsActive&&i,n("button",{disabled:!this.previousPage,onClick:this.navigateTo.bind(this,"previousPage")},n("span",{class:"NavigationButton"},d("previousPage",this.language)),n("span",{class:"NavigationIcon"})));a(this.userAgent)&&(e=n("div",{class:"LeftItems"},n("button",{disabled:!this.previousPage,onClick:this.navigateTo.bind(this,"previousPage")},n("span",{class:"NavigationButton"},d("previousPage",this.language)),n("span",{class:"NavigationIcon"}))));let s=n("button",{disabled:!this.lastPage,onClick:this.navigateTo.bind(this,"lastPage")},n("span",{class:"NavigationButton"},d("lastPage",this.language)),n("span",{class:"NavigationIcon"})),o=n("div",{class:"RightItems"},n("button",{disabled:!this.lastPage,onClick:this.navigateTo.bind(this,"nextPage")},n("span",{class:"NavigationButton"},d("nextPage",this.language)),n("span",{class:"NavigationIcon"})),this.secondaryArrowsActive&&s);return a(this.userAgent)&&(o=n("div",{class:"RightItems"},n("button",{disabled:!this.lastPage,onClick:this.navigateTo.bind(this,"nextPage")},n("span",{class:"NavigationButton"},d("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)}};c.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{r as blog_articles_grid,c as helper_pagination}
|
|
@@ -15,5 +15,5 @@ const patchBrowser = () => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
patchBrowser().then(options => {
|
|
18
|
-
return index.bootstrapLazy([["blog-articles-grid_2.cjs",[[1,"blog-articles-grid",{"cmsEndpoint":[
|
|
18
|
+
return index.bootstrapLazy([["blog-articles-grid_2.cjs",[[1,"blog-articles-grid",{"cmsEndpoint":[513,"cms-endpoint"],"language":[513],"handleClick":[513,"handle-click"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"showPublishingDate":[516,"show-publishing-date"],"showImage":[516,"show-image"],"showTitle":[516,"show-title"],"showContent":[516,"show-content"],"showButton":[516,"show-button"],"usePostmessage":[516,"use-postmessage"],"postMessageEvent":[513,"post-message-event"],"blogsLimit":[514,"blogs-limit"],"paginationActive":[516,"pagination-active"],"arrowsActive":[516,"arrows-active"],"secondaryArrowsActive":[516,"secondary-arrows-active"],"numberedNavActive":[516,"numbered-nav-active"],"userRoles":[513,"user-roles"],"cmsStage":[513,"cms-stage"],"paginationBlogList":[32],"currentPage":[32],"hasErrors":[32],"limitStylingAppends":[32],"isLoading":[32],"bannerMatrixReady":[32],"nextPage":[32],"previousPage":[32],"device":[32]},[[8,"BannerMatrixReady","handleBannerReady"],[0,"hpPageChange","hpPageChange"]]],[1,"helper-pagination",{"firstPage":[1540,"first-page"],"previousPage":[1540,"previous-page"],"offset":[1538],"limit":[1538],"total":[1538],"language":[1537],"clientStyling":[1537,"client-styling"],"clientStylingUrlContent":[1537,"client-styling-url-content"],"arrowsActive":[1540,"arrows-active"],"secondaryArrowsActive":[1540,"secondary-arrows-active"],"numberedNavActive":[1540,"numbered-nav-active"],"offsetInt":[32],"lastPage":[32],"limitInt":[32],"totalInt":[32],"pagesArray":[32],"endInt":[32],"limitStylingAppends":[32]}]]]], options);
|
|
19
19
|
});
|
|
@@ -24,7 +24,7 @@ const TRANSLATIONS$1 = {
|
|
|
24
24
|
readmore: 'Read more',
|
|
25
25
|
},
|
|
26
26
|
hu: {
|
|
27
|
-
error: '
|
|
27
|
+
error: 'خطأ',
|
|
28
28
|
readmore: 'Read more',
|
|
29
29
|
}
|
|
30
30
|
};
|
|
@@ -50,6 +50,33 @@ function checkDeviceType() {
|
|
|
50
50
|
}
|
|
51
51
|
return 'desktop';
|
|
52
52
|
}
|
|
53
|
+
const getDevice = () => {
|
|
54
|
+
let userAgent = window.navigator.userAgent;
|
|
55
|
+
if (userAgent.toLowerCase().match(/android/i)) {
|
|
56
|
+
return 'Android';
|
|
57
|
+
}
|
|
58
|
+
if (userAgent.toLowerCase().match(/iphone/i)) {
|
|
59
|
+
return 'iPhone';
|
|
60
|
+
}
|
|
61
|
+
if (userAgent.toLowerCase().match(/ipad|ipod/i)) {
|
|
62
|
+
return 'iPad';
|
|
63
|
+
}
|
|
64
|
+
return 'PC';
|
|
65
|
+
};
|
|
66
|
+
const getDevicePlatform = () => {
|
|
67
|
+
const device = getDevice();
|
|
68
|
+
if (device) {
|
|
69
|
+
if (device === 'PC') {
|
|
70
|
+
return 'dk';
|
|
71
|
+
}
|
|
72
|
+
else if (device === 'iPad' || device === 'iPhone') {
|
|
73
|
+
return 'mtWeb';
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
return 'mtWeb';
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
53
80
|
|
|
54
81
|
const blogArticlesGridCss = ":host {\n display: block;\n}\n\n.GridContainerWrapper {\n display: grid;\n}\n\n.GridContainer {\n margin: auto;\n width: 100%;\n height: 280px;\n border-radius: 15px;\n background-color: #07072A;\n margin-bottom: 20px;\n display: grid;\n gap: 30px;\n grid-template-rows: 1fr 4fr 1fr 1fr;\n grid-template-columns: 30px 1fr 1fr 30px;\n}\n.GridContainer .BlogBanner {\n grid-column: 1/3;\n grid-row: 1/5;\n}\n.GridContainer .BlogBanner img {\n border-radius: 5px 0 0 5px;\n width: 100%;\n height: 280px;\n}\n.GridContainer .BlogDate {\n font-size: 12px;\n border-radius: 5px 5px 0 0;\n padding: 10px;\n width: fit-content;\n text-align: center;\n color: #FFFFFF;\n background-color: #0D0D4D;\n grid-column: 2/2;\n grid-row: 4/4;\n z-index: 1;\n}\n.GridContainer .BlogTitle {\n font-size: 24px;\n color: #FFF;\n margin-top: 20px;\n grid-column: 3/5;\n}\n.GridContainer .BlogContent {\n font-size: 14px;\n color: #FFF;\n width: 90%;\n max-height: 80px;\n overflow: hidden;\n text-overflow: ellipsis;\n grid-column: 3/5;\n}\n.GridContainer .BlogLink {\n grid-column: 3/5;\n color: #FFF;\n}\n.GridContainer .BlogLink button {\n font-size: 14px;\n border: none;\n padding: 0;\n background: none;\n color: #D0046C;\n cursor: pointer;\n}\n\n@container (max-width: 475px) {\n .GridContainerWrapper {\n display: grid;\n }\n\n .GridContainer {\n margin: auto;\n width: 100%;\n min-height: 400px;\n gap: 10%;\n padding-bottom: 30px;\n border-radius: 5px;\n background-color: #07072A;\n margin-bottom: 20px;\n display: grid;\n grid-template-rows: repeat(auto-fit, minmax(50px, 1fr));\n grid-template-rows: auto auto auto 50px;\n grid-template-columns: 15px auto auto 15px;\n gap: 10px;\n }\n .GridContainer .BlogBanner {\n grid-column: 1/5;\n grid-row: 1/3;\n margin: 0;\n }\n .GridContainer .BlogBanner img {\n width: 100%;\n height: 232px;\n border-radius: 5px 5px 0 0;\n }\n .GridContainer .BlogDate {\n grid-column: 2/3;\n grid-row: 2/3;\n font-size: 12px;\n border-radius: 5px 5px 0 0;\n padding: 10px;\n width: fit-content;\n text-align: center;\n color: #FFFFFF;\n background-color: #0D0D4D;\n z-index: 1;\n }\n .GridContainer .BlogTitle {\n grid-column: 2/4;\n font-size: 24px;\n color: #FFF;\n }\n .GridContainer .BlogContent {\n grid-column: 2/4;\n font-size: 14px;\n color: #FFF;\n }\n .GridContainer .BlogLink {\n grid-column: 2/4;\n color: #FFF;\n cursor: pointer;\n }\n .GridContainer .BlogLink button {\n font-size: 14px;\n border: none;\n background: none;\n color: #D0046C;\n cursor: pointer;\n }\n}";
|
|
55
82
|
|
|
@@ -74,25 +101,33 @@ const BlogArticlesGrid = class {
|
|
|
74
101
|
*/
|
|
75
102
|
this.showPublishingDate = true;
|
|
76
103
|
/**
|
|
77
|
-
|
|
78
|
-
|
|
104
|
+
* Property used to display the image
|
|
105
|
+
*/
|
|
79
106
|
this.showImage = true;
|
|
80
107
|
/**
|
|
81
|
-
|
|
82
|
-
|
|
108
|
+
* Property used to display the image
|
|
109
|
+
*/
|
|
83
110
|
this.showTitle = true;
|
|
84
111
|
/**
|
|
85
|
-
|
|
86
|
-
|
|
112
|
+
* Property used to display the description
|
|
113
|
+
*/
|
|
87
114
|
this.showContent = true;
|
|
88
115
|
/**
|
|
89
|
-
|
|
90
|
-
|
|
116
|
+
* Property used to display the button
|
|
117
|
+
*/
|
|
91
118
|
this.showButton = true;
|
|
92
119
|
/**
|
|
93
|
-
|
|
94
|
-
|
|
120
|
+
* Event name to be sent when the button is clicked
|
|
121
|
+
*/
|
|
95
122
|
this.postMessageEvent = 'articleActionButton';
|
|
123
|
+
/**
|
|
124
|
+
* User roles
|
|
125
|
+
*/
|
|
126
|
+
this.userRoles = 'everyone';
|
|
127
|
+
/**
|
|
128
|
+
* CMS Endpoint stage
|
|
129
|
+
*/
|
|
130
|
+
this.cmsStage = 'stage';
|
|
96
131
|
this.paginationBlogList = {
|
|
97
132
|
offset: 0
|
|
98
133
|
};
|
|
@@ -256,6 +291,9 @@ const BlogArticlesGrid = class {
|
|
|
256
291
|
let url = new URL(`${this.cmsEndpoint}/${this.language}/blog-posts`);
|
|
257
292
|
url.searchParams.append('per_page', JSON.stringify(this.blogsLimit));
|
|
258
293
|
url.searchParams.append('page', JSON.stringify(this.currentPage + 1));
|
|
294
|
+
url.searchParams.append('env', this.cmsStage);
|
|
295
|
+
url.searchParams.append('userRoles', this.userRoles);
|
|
296
|
+
url.searchParams.append('platform', getDevicePlatform());
|
|
259
297
|
fetch(url.href)
|
|
260
298
|
.then((res) => {
|
|
261
299
|
if (res.status >= 300) {
|
|
@@ -337,7 +375,7 @@ const isMobile = (userAgent) => {
|
|
|
337
375
|
};
|
|
338
376
|
|
|
339
377
|
const DEFAULT_LANGUAGE = 'en';
|
|
340
|
-
const SUPPORTED_LANGUAGES = ['ro', 'en'
|
|
378
|
+
const SUPPORTED_LANGUAGES = ['ro', 'en'];
|
|
341
379
|
const TRANSLATIONS = {
|
|
342
380
|
en: {
|
|
343
381
|
firstPage: 'First',
|
|
@@ -362,12 +400,6 @@ const TRANSLATIONS = {
|
|
|
362
400
|
previousPage: 'Previous',
|
|
363
401
|
nextPage: 'Next',
|
|
364
402
|
lastPage: 'Last'
|
|
365
|
-
},
|
|
366
|
-
hu: {
|
|
367
|
-
firstPage: 'First',
|
|
368
|
-
previousPage: 'Previous',
|
|
369
|
-
nextPage: 'Következő',
|
|
370
|
-
lastPage: 'Last'
|
|
371
403
|
}
|
|
372
404
|
};
|
|
373
405
|
const translate = (key, customLang) => {
|
|
@@ -382,13 +414,13 @@ const HelperPagination = class {
|
|
|
382
414
|
index.registerInstance(this, hostRef);
|
|
383
415
|
this.hpPageChange = index.createEvent(this, "hpPageChange", 7);
|
|
384
416
|
/**
|
|
385
|
-
*
|
|
417
|
+
* First page boolean value - determines if the page is disabled or active
|
|
386
418
|
*/
|
|
387
|
-
this.
|
|
419
|
+
this.firstPage = false;
|
|
388
420
|
/**
|
|
389
|
-
* Previous page
|
|
421
|
+
* Previous page boolean value - determines if the page is disabled or active
|
|
390
422
|
*/
|
|
391
|
-
this.
|
|
423
|
+
this.previousPage = false;
|
|
392
424
|
/**
|
|
393
425
|
* The received offset
|
|
394
426
|
*/
|
|
@@ -413,14 +445,6 @@ const HelperPagination = class {
|
|
|
413
445
|
* Client custom styling via url content
|
|
414
446
|
*/
|
|
415
447
|
this.clientStylingUrlContent = '';
|
|
416
|
-
/**
|
|
417
|
-
* Component working variable for last page
|
|
418
|
-
*/
|
|
419
|
-
this.lastPage = false;
|
|
420
|
-
/**
|
|
421
|
-
* Component working variable for prvious page
|
|
422
|
-
*/
|
|
423
|
-
this.previousPage = false;
|
|
424
448
|
/**
|
|
425
449
|
* In component working variable for the array of pages
|
|
426
450
|
*/
|
|
@@ -547,20 +571,20 @@ const HelperPagination = class {
|
|
|
547
571
|
/**
|
|
548
572
|
* Left navigation area
|
|
549
573
|
*/
|
|
550
|
-
let buttonSecondaryLeftSide = index.h("button", { disabled: this.
|
|
551
|
-
let buttonsLeftSide = index.h("div", { class: "LeftItems" }, this.secondaryArrowsActive && buttonSecondaryLeftSide, index.h("button", { disabled: this.
|
|
574
|
+
let buttonSecondaryLeftSide = index.h("button", { disabled: !this.previousPage, onClick: this.navigateTo.bind(this, 'firstPage') }, index.h("span", { class: "NavigationButton" }, translate('firstPage', this.language)), index.h("span", { class: "NavigationIcon" }));
|
|
575
|
+
let buttonsLeftSide = index.h("div", { class: "LeftItems" }, this.secondaryArrowsActive && buttonSecondaryLeftSide, index.h("button", { disabled: !this.previousPage ? true : false, onClick: this.navigateTo.bind(this, 'previousPage') }, index.h("span", { class: "NavigationButton" }, translate('previousPage', this.language)), index.h("span", { class: "NavigationIcon" })));
|
|
552
576
|
if (isMobile(this.userAgent)) {
|
|
553
577
|
buttonsLeftSide =
|
|
554
|
-
index.h("div", { class: "LeftItems" }, index.h("button", { disabled: this.
|
|
578
|
+
index.h("div", { class: "LeftItems" }, index.h("button", { disabled: !this.previousPage ? true : false, onClick: this.navigateTo.bind(this, 'previousPage') }, index.h("span", { class: "NavigationButton" }, translate('previousPage', this.language)), index.h("span", { class: "NavigationIcon" })));
|
|
555
579
|
}
|
|
556
580
|
/**
|
|
557
581
|
* Right navigation area
|
|
558
582
|
*/
|
|
559
|
-
let buttonSecondaryRightSide = index.h("button", { disabled: this.
|
|
560
|
-
let buttonsRightSide = index.h("div", { class: "RightItems" }, index.h("button", { disabled: this.
|
|
583
|
+
let buttonSecondaryRightSide = index.h("button", { disabled: !this.lastPage ? true : false, onClick: this.navigateTo.bind(this, 'lastPage') }, index.h("span", { class: "NavigationButton" }, translate('lastPage', this.language)), index.h("span", { class: "NavigationIcon" }));
|
|
584
|
+
let buttonsRightSide = index.h("div", { class: "RightItems" }, index.h("button", { disabled: !this.lastPage ? true : false, onClick: this.navigateTo.bind(this, 'nextPage') }, index.h("span", { class: "NavigationButton" }, translate('nextPage', this.language)), index.h("span", { class: "NavigationIcon" })), this.secondaryArrowsActive && buttonSecondaryRightSide);
|
|
561
585
|
if (isMobile(this.userAgent)) {
|
|
562
586
|
buttonsRightSide =
|
|
563
|
-
index.h("div", { class: "RightItems" }, index.h("button", { disabled: this.
|
|
587
|
+
index.h("div", { class: "RightItems" }, index.h("button", { disabled: !this.lastPage ? true : false, onClick: this.navigateTo.bind(this, 'nextPage') }, index.h("span", { class: "NavigationButton" }, translate('nextPage', this.language)), index.h("span", { class: "NavigationIcon" })));
|
|
564
588
|
}
|
|
565
589
|
return (index.h("div", { id: "PaginationContainer", ref: el => this.stylingContainer = el }, this.arrowsActive && buttonsLeftSide, this.numberedNavActive && navigationArea, this.arrowsActive && buttonsRightSide));
|
|
566
590
|
}
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -14,7 +14,7 @@ const patchEsm = () => {
|
|
|
14
14
|
const defineCustomElements = (win, options) => {
|
|
15
15
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
16
16
|
return patchEsm().then(() => {
|
|
17
|
-
return index.bootstrapLazy([["blog-articles-grid_2.cjs",[[1,"blog-articles-grid",{"cmsEndpoint":[
|
|
17
|
+
return index.bootstrapLazy([["blog-articles-grid_2.cjs",[[1,"blog-articles-grid",{"cmsEndpoint":[513,"cms-endpoint"],"language":[513],"handleClick":[513,"handle-click"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"showPublishingDate":[516,"show-publishing-date"],"showImage":[516,"show-image"],"showTitle":[516,"show-title"],"showContent":[516,"show-content"],"showButton":[516,"show-button"],"usePostmessage":[516,"use-postmessage"],"postMessageEvent":[513,"post-message-event"],"blogsLimit":[514,"blogs-limit"],"paginationActive":[516,"pagination-active"],"arrowsActive":[516,"arrows-active"],"secondaryArrowsActive":[516,"secondary-arrows-active"],"numberedNavActive":[516,"numbered-nav-active"],"userRoles":[513,"user-roles"],"cmsStage":[513,"cms-stage"],"paginationBlogList":[32],"currentPage":[32],"hasErrors":[32],"limitStylingAppends":[32],"isLoading":[32],"bannerMatrixReady":[32],"nextPage":[32],"previousPage":[32],"device":[32]},[[8,"BannerMatrixReady","handleBannerReady"],[0,"hpPageChange","hpPageChange"]]],[1,"helper-pagination",{"firstPage":[1540,"first-page"],"previousPage":[1540,"previous-page"],"offset":[1538],"limit":[1538],"total":[1538],"language":[1537],"clientStyling":[1537,"client-styling"],"clientStylingUrlContent":[1537,"client-styling-url-content"],"arrowsActive":[1540,"arrows-active"],"secondaryArrowsActive":[1540,"secondary-arrows-active"],"numberedNavActive":[1540,"numbered-nav-active"],"offsetInt":[32],"lastPage":[32],"limitInt":[32],"totalInt":[32],"pagesArray":[32],"endInt":[32],"limitStylingAppends":[32]}]]]], options);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Component, Prop, State, Event, Watch, h, Listen } from '@stencil/core';
|
|
2
2
|
import { translate } from '../../utils/locale.utils';
|
|
3
|
-
import { checkDeviceType } from '../../utils/utils';
|
|
3
|
+
import { checkDeviceType, getDevicePlatform } from '../../utils/utils';
|
|
4
4
|
import '@everymatrix/helper-pagination';
|
|
5
5
|
export class BlogArticlesGrid {
|
|
6
6
|
constructor() {
|
|
@@ -21,25 +21,33 @@ export class BlogArticlesGrid {
|
|
|
21
21
|
*/
|
|
22
22
|
this.showPublishingDate = true;
|
|
23
23
|
/**
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
* Property used to display the image
|
|
25
|
+
*/
|
|
26
26
|
this.showImage = true;
|
|
27
27
|
/**
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
* Property used to display the image
|
|
29
|
+
*/
|
|
30
30
|
this.showTitle = true;
|
|
31
31
|
/**
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
* Property used to display the description
|
|
33
|
+
*/
|
|
34
34
|
this.showContent = true;
|
|
35
35
|
/**
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
* Property used to display the button
|
|
37
|
+
*/
|
|
38
38
|
this.showButton = true;
|
|
39
39
|
/**
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
* Event name to be sent when the button is clicked
|
|
41
|
+
*/
|
|
42
42
|
this.postMessageEvent = 'articleActionButton';
|
|
43
|
+
/**
|
|
44
|
+
* User roles
|
|
45
|
+
*/
|
|
46
|
+
this.userRoles = 'everyone';
|
|
47
|
+
/**
|
|
48
|
+
* CMS Endpoint stage
|
|
49
|
+
*/
|
|
50
|
+
this.cmsStage = 'stage';
|
|
43
51
|
this.paginationBlogList = {
|
|
44
52
|
offset: 0
|
|
45
53
|
};
|
|
@@ -203,6 +211,9 @@ export class BlogArticlesGrid {
|
|
|
203
211
|
let url = new URL(`${this.cmsEndpoint}/${this.language}/blog-posts`);
|
|
204
212
|
url.searchParams.append('per_page', JSON.stringify(this.blogsLimit));
|
|
205
213
|
url.searchParams.append('page', JSON.stringify(this.currentPage + 1));
|
|
214
|
+
url.searchParams.append('env', this.cmsStage);
|
|
215
|
+
url.searchParams.append('userRoles', this.userRoles);
|
|
216
|
+
url.searchParams.append('platform', getDevicePlatform());
|
|
206
217
|
fetch(url.href)
|
|
207
218
|
.then((res) => {
|
|
208
219
|
if (res.status >= 300) {
|
|
@@ -296,7 +307,7 @@ export class BlogArticlesGrid {
|
|
|
296
307
|
"text": "Endpoint URL for the source of data"
|
|
297
308
|
},
|
|
298
309
|
"attribute": "cms-endpoint",
|
|
299
|
-
"reflect":
|
|
310
|
+
"reflect": true
|
|
300
311
|
},
|
|
301
312
|
"language": {
|
|
302
313
|
"type": "string",
|
|
@@ -313,7 +324,7 @@ export class BlogArticlesGrid {
|
|
|
313
324
|
"text": "Language of the widget"
|
|
314
325
|
},
|
|
315
326
|
"attribute": "language",
|
|
316
|
-
"reflect":
|
|
327
|
+
"reflect": true,
|
|
317
328
|
"defaultValue": "'en'"
|
|
318
329
|
},
|
|
319
330
|
"handleClick": {
|
|
@@ -331,7 +342,7 @@ export class BlogArticlesGrid {
|
|
|
331
342
|
"text": "Handle when you click on shome more button"
|
|
332
343
|
},
|
|
333
344
|
"attribute": "handle-click",
|
|
334
|
-
"reflect":
|
|
345
|
+
"reflect": true
|
|
335
346
|
},
|
|
336
347
|
"clientStyling": {
|
|
337
348
|
"type": "string",
|
|
@@ -348,7 +359,7 @@ export class BlogArticlesGrid {
|
|
|
348
359
|
"text": "Client custom styling via string"
|
|
349
360
|
},
|
|
350
361
|
"attribute": "client-styling",
|
|
351
|
-
"reflect":
|
|
362
|
+
"reflect": true,
|
|
352
363
|
"defaultValue": "''"
|
|
353
364
|
},
|
|
354
365
|
"clientStylingUrl": {
|
|
@@ -366,7 +377,7 @@ export class BlogArticlesGrid {
|
|
|
366
377
|
"text": "Client custom styling via url"
|
|
367
378
|
},
|
|
368
379
|
"attribute": "client-styling-url",
|
|
369
|
-
"reflect":
|
|
380
|
+
"reflect": true,
|
|
370
381
|
"defaultValue": "''"
|
|
371
382
|
},
|
|
372
383
|
"showPublishingDate": {
|
|
@@ -384,7 +395,7 @@ export class BlogArticlesGrid {
|
|
|
384
395
|
"text": "Property used to display the publishing date"
|
|
385
396
|
},
|
|
386
397
|
"attribute": "show-publishing-date",
|
|
387
|
-
"reflect":
|
|
398
|
+
"reflect": true,
|
|
388
399
|
"defaultValue": "true"
|
|
389
400
|
},
|
|
390
401
|
"showImage": {
|
|
@@ -402,7 +413,7 @@ export class BlogArticlesGrid {
|
|
|
402
413
|
"text": "Property used to display the image"
|
|
403
414
|
},
|
|
404
415
|
"attribute": "show-image",
|
|
405
|
-
"reflect":
|
|
416
|
+
"reflect": true,
|
|
406
417
|
"defaultValue": "true"
|
|
407
418
|
},
|
|
408
419
|
"showTitle": {
|
|
@@ -420,7 +431,7 @@ export class BlogArticlesGrid {
|
|
|
420
431
|
"text": "Property used to display the image"
|
|
421
432
|
},
|
|
422
433
|
"attribute": "show-title",
|
|
423
|
-
"reflect":
|
|
434
|
+
"reflect": true,
|
|
424
435
|
"defaultValue": "true"
|
|
425
436
|
},
|
|
426
437
|
"showContent": {
|
|
@@ -438,7 +449,7 @@ export class BlogArticlesGrid {
|
|
|
438
449
|
"text": "Property used to display the description"
|
|
439
450
|
},
|
|
440
451
|
"attribute": "show-content",
|
|
441
|
-
"reflect":
|
|
452
|
+
"reflect": true,
|
|
442
453
|
"defaultValue": "true"
|
|
443
454
|
},
|
|
444
455
|
"showButton": {
|
|
@@ -456,7 +467,7 @@ export class BlogArticlesGrid {
|
|
|
456
467
|
"text": "Property used to display the button"
|
|
457
468
|
},
|
|
458
469
|
"attribute": "show-button",
|
|
459
|
-
"reflect":
|
|
470
|
+
"reflect": true,
|
|
460
471
|
"defaultValue": "true"
|
|
461
472
|
},
|
|
462
473
|
"usePostmessage": {
|
|
@@ -474,7 +485,7 @@ export class BlogArticlesGrid {
|
|
|
474
485
|
"text": "Use postMessage event to communicate"
|
|
475
486
|
},
|
|
476
487
|
"attribute": "use-postmessage",
|
|
477
|
-
"reflect":
|
|
488
|
+
"reflect": true
|
|
478
489
|
},
|
|
479
490
|
"postMessageEvent": {
|
|
480
491
|
"type": "string",
|
|
@@ -491,7 +502,7 @@ export class BlogArticlesGrid {
|
|
|
491
502
|
"text": "Event name to be sent when the button is clicked"
|
|
492
503
|
},
|
|
493
504
|
"attribute": "post-message-event",
|
|
494
|
-
"reflect":
|
|
505
|
+
"reflect": true,
|
|
495
506
|
"defaultValue": "'articleActionButton'"
|
|
496
507
|
},
|
|
497
508
|
"blogsLimit": {
|
|
@@ -578,6 +589,42 @@ export class BlogArticlesGrid {
|
|
|
578
589
|
},
|
|
579
590
|
"attribute": "numbered-nav-active",
|
|
580
591
|
"reflect": true
|
|
592
|
+
},
|
|
593
|
+
"userRoles": {
|
|
594
|
+
"type": "string",
|
|
595
|
+
"mutable": false,
|
|
596
|
+
"complexType": {
|
|
597
|
+
"original": "string",
|
|
598
|
+
"resolved": "string",
|
|
599
|
+
"references": {}
|
|
600
|
+
},
|
|
601
|
+
"required": false,
|
|
602
|
+
"optional": false,
|
|
603
|
+
"docs": {
|
|
604
|
+
"tags": [],
|
|
605
|
+
"text": "User roles"
|
|
606
|
+
},
|
|
607
|
+
"attribute": "user-roles",
|
|
608
|
+
"reflect": true,
|
|
609
|
+
"defaultValue": "'everyone'"
|
|
610
|
+
},
|
|
611
|
+
"cmsStage": {
|
|
612
|
+
"type": "string",
|
|
613
|
+
"mutable": false,
|
|
614
|
+
"complexType": {
|
|
615
|
+
"original": "string",
|
|
616
|
+
"resolved": "string",
|
|
617
|
+
"references": {}
|
|
618
|
+
},
|
|
619
|
+
"required": false,
|
|
620
|
+
"optional": false,
|
|
621
|
+
"docs": {
|
|
622
|
+
"tags": [],
|
|
623
|
+
"text": "CMS Endpoint stage"
|
|
624
|
+
},
|
|
625
|
+
"attribute": "cms-stage",
|
|
626
|
+
"reflect": true,
|
|
627
|
+
"defaultValue": "'stage'"
|
|
581
628
|
}
|
|
582
629
|
}; }
|
|
583
630
|
static get states() { return {
|
|
@@ -15,3 +15,30 @@ export function checkDeviceType() {
|
|
|
15
15
|
}
|
|
16
16
|
return 'desktop';
|
|
17
17
|
}
|
|
18
|
+
export const getDevice = () => {
|
|
19
|
+
let userAgent = window.navigator.userAgent;
|
|
20
|
+
if (userAgent.toLowerCase().match(/android/i)) {
|
|
21
|
+
return 'Android';
|
|
22
|
+
}
|
|
23
|
+
if (userAgent.toLowerCase().match(/iphone/i)) {
|
|
24
|
+
return 'iPhone';
|
|
25
|
+
}
|
|
26
|
+
if (userAgent.toLowerCase().match(/ipad|ipod/i)) {
|
|
27
|
+
return 'iPad';
|
|
28
|
+
}
|
|
29
|
+
return 'PC';
|
|
30
|
+
};
|
|
31
|
+
export const getDevicePlatform = () => {
|
|
32
|
+
const device = getDevice();
|
|
33
|
+
if (device) {
|
|
34
|
+
if (device === 'PC') {
|
|
35
|
+
return 'dk';
|
|
36
|
+
}
|
|
37
|
+
else if (device === 'iPad' || device === 'iPhone') {
|
|
38
|
+
return 'mtWeb';
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
return 'mtWeb';
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
};
|
|
@@ -21,7 +21,7 @@ const TRANSLATIONS = {
|
|
|
21
21
|
readmore: 'Read more',
|
|
22
22
|
},
|
|
23
23
|
hu: {
|
|
24
|
-
error: '
|
|
24
|
+
error: 'خطأ',
|
|
25
25
|
readmore: 'Read more',
|
|
26
26
|
}
|
|
27
27
|
};
|
|
@@ -47,6 +47,33 @@ function checkDeviceType() {
|
|
|
47
47
|
}
|
|
48
48
|
return 'desktop';
|
|
49
49
|
}
|
|
50
|
+
const getDevice = () => {
|
|
51
|
+
let userAgent = window.navigator.userAgent;
|
|
52
|
+
if (userAgent.toLowerCase().match(/android/i)) {
|
|
53
|
+
return 'Android';
|
|
54
|
+
}
|
|
55
|
+
if (userAgent.toLowerCase().match(/iphone/i)) {
|
|
56
|
+
return 'iPhone';
|
|
57
|
+
}
|
|
58
|
+
if (userAgent.toLowerCase().match(/ipad|ipod/i)) {
|
|
59
|
+
return 'iPad';
|
|
60
|
+
}
|
|
61
|
+
return 'PC';
|
|
62
|
+
};
|
|
63
|
+
const getDevicePlatform = () => {
|
|
64
|
+
const device = getDevice();
|
|
65
|
+
if (device) {
|
|
66
|
+
if (device === 'PC') {
|
|
67
|
+
return 'dk';
|
|
68
|
+
}
|
|
69
|
+
else if (device === 'iPad' || device === 'iPhone') {
|
|
70
|
+
return 'mtWeb';
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
return 'mtWeb';
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
50
77
|
|
|
51
78
|
const blogArticlesGridCss = ":host {\n display: block;\n}\n\n.GridContainerWrapper {\n display: grid;\n}\n\n.GridContainer {\n margin: auto;\n width: 100%;\n height: 280px;\n border-radius: 15px;\n background-color: #07072A;\n margin-bottom: 20px;\n display: grid;\n gap: 30px;\n grid-template-rows: 1fr 4fr 1fr 1fr;\n grid-template-columns: 30px 1fr 1fr 30px;\n}\n.GridContainer .BlogBanner {\n grid-column: 1/3;\n grid-row: 1/5;\n}\n.GridContainer .BlogBanner img {\n border-radius: 5px 0 0 5px;\n width: 100%;\n height: 280px;\n}\n.GridContainer .BlogDate {\n font-size: 12px;\n border-radius: 5px 5px 0 0;\n padding: 10px;\n width: fit-content;\n text-align: center;\n color: #FFFFFF;\n background-color: #0D0D4D;\n grid-column: 2/2;\n grid-row: 4/4;\n z-index: 1;\n}\n.GridContainer .BlogTitle {\n font-size: 24px;\n color: #FFF;\n margin-top: 20px;\n grid-column: 3/5;\n}\n.GridContainer .BlogContent {\n font-size: 14px;\n color: #FFF;\n width: 90%;\n max-height: 80px;\n overflow: hidden;\n text-overflow: ellipsis;\n grid-column: 3/5;\n}\n.GridContainer .BlogLink {\n grid-column: 3/5;\n color: #FFF;\n}\n.GridContainer .BlogLink button {\n font-size: 14px;\n border: none;\n padding: 0;\n background: none;\n color: #D0046C;\n cursor: pointer;\n}\n\n@container (max-width: 475px) {\n .GridContainerWrapper {\n display: grid;\n }\n\n .GridContainer {\n margin: auto;\n width: 100%;\n min-height: 400px;\n gap: 10%;\n padding-bottom: 30px;\n border-radius: 5px;\n background-color: #07072A;\n margin-bottom: 20px;\n display: grid;\n grid-template-rows: repeat(auto-fit, minmax(50px, 1fr));\n grid-template-rows: auto auto auto 50px;\n grid-template-columns: 15px auto auto 15px;\n gap: 10px;\n }\n .GridContainer .BlogBanner {\n grid-column: 1/5;\n grid-row: 1/3;\n margin: 0;\n }\n .GridContainer .BlogBanner img {\n width: 100%;\n height: 232px;\n border-radius: 5px 5px 0 0;\n }\n .GridContainer .BlogDate {\n grid-column: 2/3;\n grid-row: 2/3;\n font-size: 12px;\n border-radius: 5px 5px 0 0;\n padding: 10px;\n width: fit-content;\n text-align: center;\n color: #FFFFFF;\n background-color: #0D0D4D;\n z-index: 1;\n }\n .GridContainer .BlogTitle {\n grid-column: 2/4;\n font-size: 24px;\n color: #FFF;\n }\n .GridContainer .BlogContent {\n grid-column: 2/4;\n font-size: 14px;\n color: #FFF;\n }\n .GridContainer .BlogLink {\n grid-column: 2/4;\n color: #FFF;\n cursor: pointer;\n }\n .GridContainer .BlogLink button {\n font-size: 14px;\n border: none;\n background: none;\n color: #D0046C;\n cursor: pointer;\n }\n}";
|
|
52
79
|
|
|
@@ -73,25 +100,33 @@ const BlogArticlesGrid$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
|
73
100
|
*/
|
|
74
101
|
this.showPublishingDate = true;
|
|
75
102
|
/**
|
|
76
|
-
|
|
77
|
-
|
|
103
|
+
* Property used to display the image
|
|
104
|
+
*/
|
|
78
105
|
this.showImage = true;
|
|
79
106
|
/**
|
|
80
|
-
|
|
81
|
-
|
|
107
|
+
* Property used to display the image
|
|
108
|
+
*/
|
|
82
109
|
this.showTitle = true;
|
|
83
110
|
/**
|
|
84
|
-
|
|
85
|
-
|
|
111
|
+
* Property used to display the description
|
|
112
|
+
*/
|
|
86
113
|
this.showContent = true;
|
|
87
114
|
/**
|
|
88
|
-
|
|
89
|
-
|
|
115
|
+
* Property used to display the button
|
|
116
|
+
*/
|
|
90
117
|
this.showButton = true;
|
|
91
118
|
/**
|
|
92
|
-
|
|
93
|
-
|
|
119
|
+
* Event name to be sent when the button is clicked
|
|
120
|
+
*/
|
|
94
121
|
this.postMessageEvent = 'articleActionButton';
|
|
122
|
+
/**
|
|
123
|
+
* User roles
|
|
124
|
+
*/
|
|
125
|
+
this.userRoles = 'everyone';
|
|
126
|
+
/**
|
|
127
|
+
* CMS Endpoint stage
|
|
128
|
+
*/
|
|
129
|
+
this.cmsStage = 'stage';
|
|
95
130
|
this.paginationBlogList = {
|
|
96
131
|
offset: 0
|
|
97
132
|
};
|
|
@@ -255,6 +290,9 @@ const BlogArticlesGrid$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
|
255
290
|
let url = new URL(`${this.cmsEndpoint}/${this.language}/blog-posts`);
|
|
256
291
|
url.searchParams.append('per_page', JSON.stringify(this.blogsLimit));
|
|
257
292
|
url.searchParams.append('page', JSON.stringify(this.currentPage + 1));
|
|
293
|
+
url.searchParams.append('env', this.cmsStage);
|
|
294
|
+
url.searchParams.append('userRoles', this.userRoles);
|
|
295
|
+
url.searchParams.append('platform', getDevicePlatform());
|
|
258
296
|
fetch(url.href)
|
|
259
297
|
.then((res) => {
|
|
260
298
|
if (res.status >= 300) {
|
|
@@ -321,23 +359,25 @@ const BlogArticlesGrid$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLEl
|
|
|
321
359
|
}; }
|
|
322
360
|
static get style() { return blogArticlesGridCss; }
|
|
323
361
|
}, [1, "blog-articles-grid", {
|
|
324
|
-
"cmsEndpoint": [
|
|
325
|
-
"language": [
|
|
326
|
-
"handleClick": [
|
|
327
|
-
"clientStyling": [
|
|
328
|
-
"clientStylingUrl": [
|
|
329
|
-
"showPublishingDate": [
|
|
330
|
-
"showImage": [
|
|
331
|
-
"showTitle": [
|
|
332
|
-
"showContent": [
|
|
333
|
-
"showButton": [
|
|
334
|
-
"usePostmessage": [
|
|
335
|
-
"postMessageEvent": [
|
|
362
|
+
"cmsEndpoint": [513, "cms-endpoint"],
|
|
363
|
+
"language": [513],
|
|
364
|
+
"handleClick": [513, "handle-click"],
|
|
365
|
+
"clientStyling": [513, "client-styling"],
|
|
366
|
+
"clientStylingUrl": [513, "client-styling-url"],
|
|
367
|
+
"showPublishingDate": [516, "show-publishing-date"],
|
|
368
|
+
"showImage": [516, "show-image"],
|
|
369
|
+
"showTitle": [516, "show-title"],
|
|
370
|
+
"showContent": [516, "show-content"],
|
|
371
|
+
"showButton": [516, "show-button"],
|
|
372
|
+
"usePostmessage": [516, "use-postmessage"],
|
|
373
|
+
"postMessageEvent": [513, "post-message-event"],
|
|
336
374
|
"blogsLimit": [514, "blogs-limit"],
|
|
337
375
|
"paginationActive": [516, "pagination-active"],
|
|
338
376
|
"arrowsActive": [516, "arrows-active"],
|
|
339
377
|
"secondaryArrowsActive": [516, "secondary-arrows-active"],
|
|
340
378
|
"numberedNavActive": [516, "numbered-nav-active"],
|
|
379
|
+
"userRoles": [513, "user-roles"],
|
|
380
|
+
"cmsStage": [513, "cms-stage"],
|
|
341
381
|
"paginationBlogList": [32],
|
|
342
382
|
"currentPage": [32],
|
|
343
383
|
"hasErrors": [32],
|
|
@@ -14,7 +14,7 @@ const isMobile = (userAgent) => {
|
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
const DEFAULT_LANGUAGE = 'en';
|
|
17
|
-
const SUPPORTED_LANGUAGES = ['ro', 'en'
|
|
17
|
+
const SUPPORTED_LANGUAGES = ['ro', 'en'];
|
|
18
18
|
const TRANSLATIONS = {
|
|
19
19
|
en: {
|
|
20
20
|
firstPage: 'First',
|
|
@@ -39,12 +39,6 @@ const TRANSLATIONS = {
|
|
|
39
39
|
previousPage: 'Previous',
|
|
40
40
|
nextPage: 'Next',
|
|
41
41
|
lastPage: 'Last'
|
|
42
|
-
},
|
|
43
|
-
hu: {
|
|
44
|
-
firstPage: 'First',
|
|
45
|
-
previousPage: 'Previous',
|
|
46
|
-
nextPage: 'Következő',
|
|
47
|
-
lastPage: 'Last'
|
|
48
42
|
}
|
|
49
43
|
};
|
|
50
44
|
const translate = (key, customLang) => {
|
|
@@ -61,13 +55,13 @@ const HelperPagination = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
61
55
|
this.__attachShadow();
|
|
62
56
|
this.hpPageChange = createEvent(this, "hpPageChange", 7);
|
|
63
57
|
/**
|
|
64
|
-
*
|
|
58
|
+
* First page boolean value - determines if the page is disabled or active
|
|
65
59
|
*/
|
|
66
|
-
this.
|
|
60
|
+
this.firstPage = false;
|
|
67
61
|
/**
|
|
68
|
-
* Previous page
|
|
62
|
+
* Previous page boolean value - determines if the page is disabled or active
|
|
69
63
|
*/
|
|
70
|
-
this.
|
|
64
|
+
this.previousPage = false;
|
|
71
65
|
/**
|
|
72
66
|
* The received offset
|
|
73
67
|
*/
|
|
@@ -92,14 +86,6 @@ const HelperPagination = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
92
86
|
* Client custom styling via url content
|
|
93
87
|
*/
|
|
94
88
|
this.clientStylingUrlContent = '';
|
|
95
|
-
/**
|
|
96
|
-
* Component working variable for last page
|
|
97
|
-
*/
|
|
98
|
-
this.lastPage = false;
|
|
99
|
-
/**
|
|
100
|
-
* Component working variable for prvious page
|
|
101
|
-
*/
|
|
102
|
-
this.previousPage = false;
|
|
103
89
|
/**
|
|
104
90
|
* In component working variable for the array of pages
|
|
105
91
|
*/
|
|
@@ -226,27 +212,27 @@ const HelperPagination = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
226
212
|
/**
|
|
227
213
|
* Left navigation area
|
|
228
214
|
*/
|
|
229
|
-
let buttonSecondaryLeftSide = h("button", { disabled: this.
|
|
230
|
-
let buttonsLeftSide = h("div", { class: "LeftItems" }, this.secondaryArrowsActive && buttonSecondaryLeftSide, h("button", { disabled: this.
|
|
215
|
+
let buttonSecondaryLeftSide = h("button", { disabled: !this.previousPage, onClick: this.navigateTo.bind(this, 'firstPage') }, h("span", { class: "NavigationButton" }, translate('firstPage', this.language)), h("span", { class: "NavigationIcon" }));
|
|
216
|
+
let buttonsLeftSide = h("div", { class: "LeftItems" }, this.secondaryArrowsActive && buttonSecondaryLeftSide, h("button", { disabled: !this.previousPage ? true : false, onClick: this.navigateTo.bind(this, 'previousPage') }, h("span", { class: "NavigationButton" }, translate('previousPage', this.language)), h("span", { class: "NavigationIcon" })));
|
|
231
217
|
if (isMobile(this.userAgent)) {
|
|
232
218
|
buttonsLeftSide =
|
|
233
|
-
h("div", { class: "LeftItems" }, h("button", { disabled: this.
|
|
219
|
+
h("div", { class: "LeftItems" }, h("button", { disabled: !this.previousPage ? true : false, onClick: this.navigateTo.bind(this, 'previousPage') }, h("span", { class: "NavigationButton" }, translate('previousPage', this.language)), h("span", { class: "NavigationIcon" })));
|
|
234
220
|
}
|
|
235
221
|
/**
|
|
236
222
|
* Right navigation area
|
|
237
223
|
*/
|
|
238
|
-
let buttonSecondaryRightSide = h("button", { disabled: this.
|
|
239
|
-
let buttonsRightSide = h("div", { class: "RightItems" }, h("button", { disabled: this.
|
|
224
|
+
let buttonSecondaryRightSide = h("button", { disabled: !this.lastPage ? true : false, onClick: this.navigateTo.bind(this, 'lastPage') }, h("span", { class: "NavigationButton" }, translate('lastPage', this.language)), h("span", { class: "NavigationIcon" }));
|
|
225
|
+
let buttonsRightSide = h("div", { class: "RightItems" }, h("button", { disabled: !this.lastPage ? true : false, onClick: this.navigateTo.bind(this, 'nextPage') }, h("span", { class: "NavigationButton" }, translate('nextPage', this.language)), h("span", { class: "NavigationIcon" })), this.secondaryArrowsActive && buttonSecondaryRightSide);
|
|
240
226
|
if (isMobile(this.userAgent)) {
|
|
241
227
|
buttonsRightSide =
|
|
242
|
-
h("div", { class: "RightItems" }, h("button", { disabled: this.
|
|
228
|
+
h("div", { class: "RightItems" }, h("button", { disabled: !this.lastPage ? true : false, onClick: this.navigateTo.bind(this, 'nextPage') }, h("span", { class: "NavigationButton" }, translate('nextPage', this.language)), h("span", { class: "NavigationIcon" })));
|
|
243
229
|
}
|
|
244
230
|
return (h("div", { id: "PaginationContainer", ref: el => this.stylingContainer = el }, this.arrowsActive && buttonsLeftSide, this.numberedNavActive && navigationArea, this.arrowsActive && buttonsRightSide));
|
|
245
231
|
}
|
|
246
232
|
static get style() { return helperPaginationCss; }
|
|
247
233
|
}, [1, "helper-pagination", {
|
|
248
|
-
"
|
|
249
|
-
"
|
|
234
|
+
"firstPage": [1540, "first-page"],
|
|
235
|
+
"previousPage": [1540, "previous-page"],
|
|
250
236
|
"offset": [1538],
|
|
251
237
|
"limit": [1538],
|
|
252
238
|
"total": [1538],
|
|
@@ -258,7 +244,6 @@ const HelperPagination = /*@__PURE__*/ proxyCustomElement(class extends HTMLElem
|
|
|
258
244
|
"numberedNavActive": [1540, "numbered-nav-active"],
|
|
259
245
|
"offsetInt": [32],
|
|
260
246
|
"lastPage": [32],
|
|
261
|
-
"previousPage": [32],
|
|
262
247
|
"limitInt": [32],
|
|
263
248
|
"totalInt": [32],
|
|
264
249
|
"pagesArray": [32],
|
|
@@ -13,5 +13,5 @@ const patchBrowser = () => {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
patchBrowser().then(options => {
|
|
16
|
-
return bootstrapLazy([["blog-articles-grid_2",[[1,"blog-articles-grid",{"cmsEndpoint":[
|
|
16
|
+
return bootstrapLazy([["blog-articles-grid_2",[[1,"blog-articles-grid",{"cmsEndpoint":[513,"cms-endpoint"],"language":[513],"handleClick":[513,"handle-click"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"showPublishingDate":[516,"show-publishing-date"],"showImage":[516,"show-image"],"showTitle":[516,"show-title"],"showContent":[516,"show-content"],"showButton":[516,"show-button"],"usePostmessage":[516,"use-postmessage"],"postMessageEvent":[513,"post-message-event"],"blogsLimit":[514,"blogs-limit"],"paginationActive":[516,"pagination-active"],"arrowsActive":[516,"arrows-active"],"secondaryArrowsActive":[516,"secondary-arrows-active"],"numberedNavActive":[516,"numbered-nav-active"],"userRoles":[513,"user-roles"],"cmsStage":[513,"cms-stage"],"paginationBlogList":[32],"currentPage":[32],"hasErrors":[32],"limitStylingAppends":[32],"isLoading":[32],"bannerMatrixReady":[32],"nextPage":[32],"previousPage":[32],"device":[32]},[[8,"BannerMatrixReady","handleBannerReady"],[0,"hpPageChange","hpPageChange"]]],[1,"helper-pagination",{"firstPage":[1540,"first-page"],"previousPage":[1540,"previous-page"],"offset":[1538],"limit":[1538],"total":[1538],"language":[1537],"clientStyling":[1537,"client-styling"],"clientStylingUrlContent":[1537,"client-styling-url-content"],"arrowsActive":[1540,"arrows-active"],"secondaryArrowsActive":[1540,"secondary-arrows-active"],"numberedNavActive":[1540,"numbered-nav-active"],"offsetInt":[32],"lastPage":[32],"limitInt":[32],"totalInt":[32],"pagesArray":[32],"endInt":[32],"limitStylingAppends":[32]}]]]], options);
|
|
17
17
|
});
|
|
@@ -20,7 +20,7 @@ const TRANSLATIONS$1 = {
|
|
|
20
20
|
readmore: 'Read more',
|
|
21
21
|
},
|
|
22
22
|
hu: {
|
|
23
|
-
error: '
|
|
23
|
+
error: 'خطأ',
|
|
24
24
|
readmore: 'Read more',
|
|
25
25
|
}
|
|
26
26
|
};
|
|
@@ -46,6 +46,33 @@ function checkDeviceType() {
|
|
|
46
46
|
}
|
|
47
47
|
return 'desktop';
|
|
48
48
|
}
|
|
49
|
+
const getDevice = () => {
|
|
50
|
+
let userAgent = window.navigator.userAgent;
|
|
51
|
+
if (userAgent.toLowerCase().match(/android/i)) {
|
|
52
|
+
return 'Android';
|
|
53
|
+
}
|
|
54
|
+
if (userAgent.toLowerCase().match(/iphone/i)) {
|
|
55
|
+
return 'iPhone';
|
|
56
|
+
}
|
|
57
|
+
if (userAgent.toLowerCase().match(/ipad|ipod/i)) {
|
|
58
|
+
return 'iPad';
|
|
59
|
+
}
|
|
60
|
+
return 'PC';
|
|
61
|
+
};
|
|
62
|
+
const getDevicePlatform = () => {
|
|
63
|
+
const device = getDevice();
|
|
64
|
+
if (device) {
|
|
65
|
+
if (device === 'PC') {
|
|
66
|
+
return 'dk';
|
|
67
|
+
}
|
|
68
|
+
else if (device === 'iPad' || device === 'iPhone') {
|
|
69
|
+
return 'mtWeb';
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
return 'mtWeb';
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
};
|
|
49
76
|
|
|
50
77
|
const blogArticlesGridCss = ":host {\n display: block;\n}\n\n.GridContainerWrapper {\n display: grid;\n}\n\n.GridContainer {\n margin: auto;\n width: 100%;\n height: 280px;\n border-radius: 15px;\n background-color: #07072A;\n margin-bottom: 20px;\n display: grid;\n gap: 30px;\n grid-template-rows: 1fr 4fr 1fr 1fr;\n grid-template-columns: 30px 1fr 1fr 30px;\n}\n.GridContainer .BlogBanner {\n grid-column: 1/3;\n grid-row: 1/5;\n}\n.GridContainer .BlogBanner img {\n border-radius: 5px 0 0 5px;\n width: 100%;\n height: 280px;\n}\n.GridContainer .BlogDate {\n font-size: 12px;\n border-radius: 5px 5px 0 0;\n padding: 10px;\n width: fit-content;\n text-align: center;\n color: #FFFFFF;\n background-color: #0D0D4D;\n grid-column: 2/2;\n grid-row: 4/4;\n z-index: 1;\n}\n.GridContainer .BlogTitle {\n font-size: 24px;\n color: #FFF;\n margin-top: 20px;\n grid-column: 3/5;\n}\n.GridContainer .BlogContent {\n font-size: 14px;\n color: #FFF;\n width: 90%;\n max-height: 80px;\n overflow: hidden;\n text-overflow: ellipsis;\n grid-column: 3/5;\n}\n.GridContainer .BlogLink {\n grid-column: 3/5;\n color: #FFF;\n}\n.GridContainer .BlogLink button {\n font-size: 14px;\n border: none;\n padding: 0;\n background: none;\n color: #D0046C;\n cursor: pointer;\n}\n\n@container (max-width: 475px) {\n .GridContainerWrapper {\n display: grid;\n }\n\n .GridContainer {\n margin: auto;\n width: 100%;\n min-height: 400px;\n gap: 10%;\n padding-bottom: 30px;\n border-radius: 5px;\n background-color: #07072A;\n margin-bottom: 20px;\n display: grid;\n grid-template-rows: repeat(auto-fit, minmax(50px, 1fr));\n grid-template-rows: auto auto auto 50px;\n grid-template-columns: 15px auto auto 15px;\n gap: 10px;\n }\n .GridContainer .BlogBanner {\n grid-column: 1/5;\n grid-row: 1/3;\n margin: 0;\n }\n .GridContainer .BlogBanner img {\n width: 100%;\n height: 232px;\n border-radius: 5px 5px 0 0;\n }\n .GridContainer .BlogDate {\n grid-column: 2/3;\n grid-row: 2/3;\n font-size: 12px;\n border-radius: 5px 5px 0 0;\n padding: 10px;\n width: fit-content;\n text-align: center;\n color: #FFFFFF;\n background-color: #0D0D4D;\n z-index: 1;\n }\n .GridContainer .BlogTitle {\n grid-column: 2/4;\n font-size: 24px;\n color: #FFF;\n }\n .GridContainer .BlogContent {\n grid-column: 2/4;\n font-size: 14px;\n color: #FFF;\n }\n .GridContainer .BlogLink {\n grid-column: 2/4;\n color: #FFF;\n cursor: pointer;\n }\n .GridContainer .BlogLink button {\n font-size: 14px;\n border: none;\n background: none;\n color: #D0046C;\n cursor: pointer;\n }\n}";
|
|
51
78
|
|
|
@@ -70,25 +97,33 @@ const BlogArticlesGrid = class {
|
|
|
70
97
|
*/
|
|
71
98
|
this.showPublishingDate = true;
|
|
72
99
|
/**
|
|
73
|
-
|
|
74
|
-
|
|
100
|
+
* Property used to display the image
|
|
101
|
+
*/
|
|
75
102
|
this.showImage = true;
|
|
76
103
|
/**
|
|
77
|
-
|
|
78
|
-
|
|
104
|
+
* Property used to display the image
|
|
105
|
+
*/
|
|
79
106
|
this.showTitle = true;
|
|
80
107
|
/**
|
|
81
|
-
|
|
82
|
-
|
|
108
|
+
* Property used to display the description
|
|
109
|
+
*/
|
|
83
110
|
this.showContent = true;
|
|
84
111
|
/**
|
|
85
|
-
|
|
86
|
-
|
|
112
|
+
* Property used to display the button
|
|
113
|
+
*/
|
|
87
114
|
this.showButton = true;
|
|
88
115
|
/**
|
|
89
|
-
|
|
90
|
-
|
|
116
|
+
* Event name to be sent when the button is clicked
|
|
117
|
+
*/
|
|
91
118
|
this.postMessageEvent = 'articleActionButton';
|
|
119
|
+
/**
|
|
120
|
+
* User roles
|
|
121
|
+
*/
|
|
122
|
+
this.userRoles = 'everyone';
|
|
123
|
+
/**
|
|
124
|
+
* CMS Endpoint stage
|
|
125
|
+
*/
|
|
126
|
+
this.cmsStage = 'stage';
|
|
92
127
|
this.paginationBlogList = {
|
|
93
128
|
offset: 0
|
|
94
129
|
};
|
|
@@ -252,6 +287,9 @@ const BlogArticlesGrid = class {
|
|
|
252
287
|
let url = new URL(`${this.cmsEndpoint}/${this.language}/blog-posts`);
|
|
253
288
|
url.searchParams.append('per_page', JSON.stringify(this.blogsLimit));
|
|
254
289
|
url.searchParams.append('page', JSON.stringify(this.currentPage + 1));
|
|
290
|
+
url.searchParams.append('env', this.cmsStage);
|
|
291
|
+
url.searchParams.append('userRoles', this.userRoles);
|
|
292
|
+
url.searchParams.append('platform', getDevicePlatform());
|
|
255
293
|
fetch(url.href)
|
|
256
294
|
.then((res) => {
|
|
257
295
|
if (res.status >= 300) {
|
|
@@ -333,7 +371,7 @@ const isMobile = (userAgent) => {
|
|
|
333
371
|
};
|
|
334
372
|
|
|
335
373
|
const DEFAULT_LANGUAGE = 'en';
|
|
336
|
-
const SUPPORTED_LANGUAGES = ['ro', 'en'
|
|
374
|
+
const SUPPORTED_LANGUAGES = ['ro', 'en'];
|
|
337
375
|
const TRANSLATIONS = {
|
|
338
376
|
en: {
|
|
339
377
|
firstPage: 'First',
|
|
@@ -358,12 +396,6 @@ const TRANSLATIONS = {
|
|
|
358
396
|
previousPage: 'Previous',
|
|
359
397
|
nextPage: 'Next',
|
|
360
398
|
lastPage: 'Last'
|
|
361
|
-
},
|
|
362
|
-
hu: {
|
|
363
|
-
firstPage: 'First',
|
|
364
|
-
previousPage: 'Previous',
|
|
365
|
-
nextPage: 'Következő',
|
|
366
|
-
lastPage: 'Last'
|
|
367
399
|
}
|
|
368
400
|
};
|
|
369
401
|
const translate = (key, customLang) => {
|
|
@@ -378,13 +410,13 @@ const HelperPagination = class {
|
|
|
378
410
|
registerInstance(this, hostRef);
|
|
379
411
|
this.hpPageChange = createEvent(this, "hpPageChange", 7);
|
|
380
412
|
/**
|
|
381
|
-
*
|
|
413
|
+
* First page boolean value - determines if the page is disabled or active
|
|
382
414
|
*/
|
|
383
|
-
this.
|
|
415
|
+
this.firstPage = false;
|
|
384
416
|
/**
|
|
385
|
-
* Previous page
|
|
417
|
+
* Previous page boolean value - determines if the page is disabled or active
|
|
386
418
|
*/
|
|
387
|
-
this.
|
|
419
|
+
this.previousPage = false;
|
|
388
420
|
/**
|
|
389
421
|
* The received offset
|
|
390
422
|
*/
|
|
@@ -409,14 +441,6 @@ const HelperPagination = class {
|
|
|
409
441
|
* Client custom styling via url content
|
|
410
442
|
*/
|
|
411
443
|
this.clientStylingUrlContent = '';
|
|
412
|
-
/**
|
|
413
|
-
* Component working variable for last page
|
|
414
|
-
*/
|
|
415
|
-
this.lastPage = false;
|
|
416
|
-
/**
|
|
417
|
-
* Component working variable for prvious page
|
|
418
|
-
*/
|
|
419
|
-
this.previousPage = false;
|
|
420
444
|
/**
|
|
421
445
|
* In component working variable for the array of pages
|
|
422
446
|
*/
|
|
@@ -543,20 +567,20 @@ const HelperPagination = class {
|
|
|
543
567
|
/**
|
|
544
568
|
* Left navigation area
|
|
545
569
|
*/
|
|
546
|
-
let buttonSecondaryLeftSide = h("button", { disabled: this.
|
|
547
|
-
let buttonsLeftSide = h("div", { class: "LeftItems" }, this.secondaryArrowsActive && buttonSecondaryLeftSide, h("button", { disabled: this.
|
|
570
|
+
let buttonSecondaryLeftSide = h("button", { disabled: !this.previousPage, onClick: this.navigateTo.bind(this, 'firstPage') }, h("span", { class: "NavigationButton" }, translate('firstPage', this.language)), h("span", { class: "NavigationIcon" }));
|
|
571
|
+
let buttonsLeftSide = h("div", { class: "LeftItems" }, this.secondaryArrowsActive && buttonSecondaryLeftSide, h("button", { disabled: !this.previousPage ? true : false, onClick: this.navigateTo.bind(this, 'previousPage') }, h("span", { class: "NavigationButton" }, translate('previousPage', this.language)), h("span", { class: "NavigationIcon" })));
|
|
548
572
|
if (isMobile(this.userAgent)) {
|
|
549
573
|
buttonsLeftSide =
|
|
550
|
-
h("div", { class: "LeftItems" }, h("button", { disabled: this.
|
|
574
|
+
h("div", { class: "LeftItems" }, h("button", { disabled: !this.previousPage ? true : false, onClick: this.navigateTo.bind(this, 'previousPage') }, h("span", { class: "NavigationButton" }, translate('previousPage', this.language)), h("span", { class: "NavigationIcon" })));
|
|
551
575
|
}
|
|
552
576
|
/**
|
|
553
577
|
* Right navigation area
|
|
554
578
|
*/
|
|
555
|
-
let buttonSecondaryRightSide = h("button", { disabled: this.
|
|
556
|
-
let buttonsRightSide = h("div", { class: "RightItems" }, h("button", { disabled: this.
|
|
579
|
+
let buttonSecondaryRightSide = h("button", { disabled: !this.lastPage ? true : false, onClick: this.navigateTo.bind(this, 'lastPage') }, h("span", { class: "NavigationButton" }, translate('lastPage', this.language)), h("span", { class: "NavigationIcon" }));
|
|
580
|
+
let buttonsRightSide = h("div", { class: "RightItems" }, h("button", { disabled: !this.lastPage ? true : false, onClick: this.navigateTo.bind(this, 'nextPage') }, h("span", { class: "NavigationButton" }, translate('nextPage', this.language)), h("span", { class: "NavigationIcon" })), this.secondaryArrowsActive && buttonSecondaryRightSide);
|
|
557
581
|
if (isMobile(this.userAgent)) {
|
|
558
582
|
buttonsRightSide =
|
|
559
|
-
h("div", { class: "RightItems" }, h("button", { disabled: this.
|
|
583
|
+
h("div", { class: "RightItems" }, h("button", { disabled: !this.lastPage ? true : false, onClick: this.navigateTo.bind(this, 'nextPage') }, h("span", { class: "NavigationButton" }, translate('nextPage', this.language)), h("span", { class: "NavigationIcon" })));
|
|
560
584
|
}
|
|
561
585
|
return (h("div", { id: "PaginationContainer", ref: el => this.stylingContainer = el }, this.arrowsActive && buttonsLeftSide, this.numberedNavActive && navigationArea, this.arrowsActive && buttonsRightSide));
|
|
562
586
|
}
|
package/dist/esm/loader.js
CHANGED
|
@@ -10,7 +10,7 @@ const patchEsm = () => {
|
|
|
10
10
|
const defineCustomElements = (win, options) => {
|
|
11
11
|
if (typeof window === 'undefined') return Promise.resolve();
|
|
12
12
|
return patchEsm().then(() => {
|
|
13
|
-
return bootstrapLazy([["blog-articles-grid_2",[[1,"blog-articles-grid",{"cmsEndpoint":[
|
|
13
|
+
return bootstrapLazy([["blog-articles-grid_2",[[1,"blog-articles-grid",{"cmsEndpoint":[513,"cms-endpoint"],"language":[513],"handleClick":[513,"handle-click"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"showPublishingDate":[516,"show-publishing-date"],"showImage":[516,"show-image"],"showTitle":[516,"show-title"],"showContent":[516,"show-content"],"showButton":[516,"show-button"],"usePostmessage":[516,"use-postmessage"],"postMessageEvent":[513,"post-message-event"],"blogsLimit":[514,"blogs-limit"],"paginationActive":[516,"pagination-active"],"arrowsActive":[516,"arrows-active"],"secondaryArrowsActive":[516,"secondary-arrows-active"],"numberedNavActive":[516,"numbered-nav-active"],"userRoles":[513,"user-roles"],"cmsStage":[513,"cms-stage"],"paginationBlogList":[32],"currentPage":[32],"hasErrors":[32],"limitStylingAppends":[32],"isLoading":[32],"bannerMatrixReady":[32],"nextPage":[32],"previousPage":[32],"device":[32]},[[8,"BannerMatrixReady","handleBannerReady"],[0,"hpPageChange","hpPageChange"]]],[1,"helper-pagination",{"firstPage":[1540,"first-page"],"previousPage":[1540,"previous-page"],"offset":[1538],"limit":[1538],"total":[1538],"language":[1537],"clientStyling":[1537,"client-styling"],"clientStylingUrlContent":[1537,"client-styling-url-content"],"arrowsActive":[1540,"arrows-active"],"secondaryArrowsActive":[1540,"secondary-arrows-active"],"numberedNavActive":[1540,"numbered-nav-active"],"offsetInt":[32],"lastPage":[32],"limitInt":[32],"totalInt":[32],"pagesArray":[32],"endInt":[32],"limitStylingAppends":[32]}]]]], options);
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -2,8 +2,8 @@ import { EventEmitter } from '../../stencil-public-runtime';
|
|
|
2
2
|
import '@everymatrix/helper-pagination';
|
|
3
3
|
export declare class BlogArticlesGrid {
|
|
4
4
|
/**
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
* Endpoint URL for the source of data
|
|
6
|
+
*/
|
|
7
7
|
cmsEndpoint: string;
|
|
8
8
|
/**
|
|
9
9
|
* Language of the widget
|
|
@@ -26,32 +26,32 @@ export declare class BlogArticlesGrid {
|
|
|
26
26
|
*/
|
|
27
27
|
showPublishingDate: boolean;
|
|
28
28
|
/**
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
* Property used to display the image
|
|
30
|
+
*/
|
|
31
31
|
showImage: boolean;
|
|
32
32
|
/**
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
* Property used to display the image
|
|
34
|
+
*/
|
|
35
35
|
showTitle: boolean;
|
|
36
36
|
/**
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
* Property used to display the description
|
|
38
|
+
*/
|
|
39
39
|
showContent: boolean;
|
|
40
40
|
/**
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
* Property used to display the button
|
|
42
|
+
*/
|
|
43
43
|
showButton: boolean;
|
|
44
44
|
/**
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
* Use postMessage event to communicate
|
|
46
|
+
*/
|
|
47
47
|
usePostmessage: boolean;
|
|
48
48
|
/**
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
* Event name to be sent when the button is clicked
|
|
50
|
+
*/
|
|
51
51
|
postMessageEvent: string;
|
|
52
52
|
/**
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
* Customize pagination: Activate pagination numbered navigation
|
|
54
|
+
*/
|
|
55
55
|
blogsLimit: number;
|
|
56
56
|
/**
|
|
57
57
|
* Customize pagination: Activate pagination
|
|
@@ -69,6 +69,14 @@ export declare class BlogArticlesGrid {
|
|
|
69
69
|
* Customize pagination: Activate pagination numbered navigation
|
|
70
70
|
*/
|
|
71
71
|
numberedNavActive: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* User roles
|
|
74
|
+
*/
|
|
75
|
+
userRoles: string;
|
|
76
|
+
/**
|
|
77
|
+
* CMS Endpoint stage
|
|
78
|
+
*/
|
|
79
|
+
cmsStage: string;
|
|
72
80
|
articleActionButton: EventEmitter<Object>;
|
|
73
81
|
getArticleId(postId: number): void;
|
|
74
82
|
paginationBlogList: any;
|
|
@@ -27,6 +27,10 @@ export namespace Components {
|
|
|
27
27
|
* Endpoint URL for the source of data
|
|
28
28
|
*/
|
|
29
29
|
"cmsEndpoint": string;
|
|
30
|
+
/**
|
|
31
|
+
* CMS Endpoint stage
|
|
32
|
+
*/
|
|
33
|
+
"cmsStage": string;
|
|
30
34
|
/**
|
|
31
35
|
* Handle when you click on shome more button
|
|
32
36
|
*/
|
|
@@ -75,6 +79,10 @@ export namespace Components {
|
|
|
75
79
|
* Use postMessage event to communicate
|
|
76
80
|
*/
|
|
77
81
|
"usePostmessage": boolean;
|
|
82
|
+
/**
|
|
83
|
+
* User roles
|
|
84
|
+
*/
|
|
85
|
+
"userRoles": string;
|
|
78
86
|
}
|
|
79
87
|
}
|
|
80
88
|
declare global {
|
|
@@ -110,6 +118,10 @@ declare namespace LocalJSX {
|
|
|
110
118
|
* Endpoint URL for the source of data
|
|
111
119
|
*/
|
|
112
120
|
"cmsEndpoint"?: string;
|
|
121
|
+
/**
|
|
122
|
+
* CMS Endpoint stage
|
|
123
|
+
*/
|
|
124
|
+
"cmsStage"?: string;
|
|
113
125
|
/**
|
|
114
126
|
* Handle when you click on shome more button
|
|
115
127
|
*/
|
|
@@ -159,6 +171,10 @@ declare namespace LocalJSX {
|
|
|
159
171
|
* Use postMessage event to communicate
|
|
160
172
|
*/
|
|
161
173
|
"usePostmessage": boolean;
|
|
174
|
+
/**
|
|
175
|
+
* User roles
|
|
176
|
+
*/
|
|
177
|
+
"userRoles"?: string;
|
|
162
178
|
}
|
|
163
179
|
interface IntrinsicElements {
|
|
164
180
|
"blog-articles-grid": BlogArticlesGrid;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,c as i,h as n}from"./p-ed2f13d0.js";const e=["ro","en","fr","ar","hu"],s={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:"Error",readmore:"Read more"}},o=(t,i)=>{const n=i;return s[void 0!==n&&e.includes(n)?n:"en"][t]},r=class{constructor(e){t(this,e),this.articleActionButton=i(this,"articleActionButton",7),this.language="en",this.clientStyling="",this.clientStylingUrl="",this.showPublishingDate=!0,this.showImage=!0,this.showTitle=!0,this.showContent=!0,this.showButton=!0,this.postMessageEvent="articleActionButton",this.paginationBlogList={offset:0},this.currentPage=0,this.hasErrors=!1,this.limitStylingAppends=!1,this.isLoading=!0,this.bannerMatrixReady=!1,this.nextPage="",this.previousPage="",this.device="",this.defaultStyling="\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.setClientStyling=()=>{let t=document.createElement("style");t.innerHTML=this.clientStyling,this.stylingContainer.prepend(t)},this.setClientStylingURL=()=>{let t=new URL(this.clientStylingUrl),i=document.createElement("style");fetch(t.href).then((t=>t.text())).then((t=>{i.innerHTML=t,setTimeout((()=>{this.stylingContainer.prepend(i)}),1)})).catch((t=>{console.log("error ",t)}))},this.renderContentConditionally=t=>{if(t)return-1!==t.indexOf("<bannermatrix-banner")?this.bannerMatrixReady?n("div",{class:"BlogContent",innerHTML:t}):null:n("div",{class:"BlogContent",innerHTML:t})}}getArticleId(t){this.articleActionButton.emit({postId:t}),this.usePostmessage&&window.postMessage({type:this.postMessageEvent,postId:t})}handleBannerReady(){this.bannerMatrixReady=!0}watchEndpoint(t,i){t&&t!=i&&this.cmsEndpoint&&this.getBlogArticleGrid()}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.currentPage+1>this.lastPage?this.nextPage=null:this.currentPage<0?this.previousPage=null:this.getBlogArticleGrid()}handleAction(t){this.getArticleId(t)}connectedCallback(){this.cmsEndpoint&&this.language&&this.getBlogArticleGrid()}componentDidLoad(){window.postMessage({type:"BlogArticlesGridLoaded"},window.location.href),this.device=function(){const t=navigator.userAgent.toLowerCase(),i=screen.availWidth,n=screen.availHeight;if(t.includes("iphone"))return"mobile";if(t.includes("android")){if(n>i&&i<800)return"mobile";if(i>n&&n<800)return"tablet"}return"desktop"}()}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){const n=t.indexOf(i);return-1!==n&&(t.splice(n,1),t.unshift(i)),t}getBlogArticleGrid(){this.isLoading=!0;let t=new URL(`${this.cmsEndpoint}/${this.language}/blog-posts`);t.searchParams.append("per_page",JSON.stringify(this.blogsLimit)),t.searchParams.append("page",JSON.stringify(this.currentPage+1)),fetch(t.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=>{this.lastPage=+t.pages.last.slice(t.pages.last.lastIndexOf("=")+1);let i=t.items;this.nextPage=t.pages.next,this.previousPage=t.pages.previous;const n=this.findLatestFeatured(i);this.blogData=this.sortArticlesByDate(i),this.blogData=this.moveLatestFeatureToStart(i,n),this.blogData.items=i.map((t=>Object.assign(Object.assign({},t),{publishingDate:new Date(t.publishingDate).toLocaleDateString()}))),this.isLoading=!1})).catch((t=>{this.hasErrors=!0,console.log("Error",t)})).finally((()=>this.isLoading=!1))}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}formatDateToYearMonthDay(t){let i=new Date(t),n=i.getFullYear(),e=String(i.getMonth()+1).padStart(2,"0");return`${String(i.getDate()).padStart(2,"0")}-${e}-${n}`}render(){var t,i;return this.hasErrors?n("div",{class:"BlogArticleDetails"},n("div",{class:"Title"},o("error",this.language))):n("div",{ref:t=>this.stylingContainer=t},n("div",{class:"BlogGridPaginationWrapper"},1==this.paginationActive&&n("helper-pagination",{"next-page":this.nextPage,"prev-page":this.previousPage,offset:this.paginationBlogList.offset,limit:this.blogsLimit,total:null===(i=null===(t=this.blogData)||void 0===t?void 0:t.items)||void 0===i?void 0:i.length,language:this.language,"client-styling":this.clientStyling||this.defaultStyling,"arrows-active":this.arrowsActive||!1,"secondary-arrows-active":this.secondaryArrowsActive||!1,"numbered-nav-active":this.numberedNavActive||!1})),!this.isLoading&&n("div",{class:`GridContainerWrapper BlogPage-${this.currentPage}`},this.blogData.map((t=>{var i,e;return n("div",{class:"GridContainer"},this.showPublishingDate&&n("div",{class:"BlogDate"},this.formatDateToYearMonthDay(null==t?void 0:t.publishingDate)),this.showImage&&n("div",{class:"BlogBanner"},(null===(i=t.image)||void 0===i?void 0:i.src)?n("img",{src:t.image.src,alt:t.image.src}):(null===(e=t.video)||void 0===e?void 0:e.sources[this.device])?n("video",{src:t.video.sources[this.device],controls:!0}):n("h1",{style:{color:"white"}},"No Image")),this.showTitle&&n("div",{class:"BlogTitle"},null==t?void 0:t.title),this.showContent&&this.renderContentConditionally(null==t?void 0:t.content),this.showButton&&n("div",{class:"BlogLink"},n("button",{onClick:()=>this.handleAction(null==t?void 0:t.postID)},o("readmore",this.language))))}))))}static get watchers(){return{cmsEndpoint:["watchEndpoint"],language:["watchEndpoint"]}}};r.style=":host {\n display: block;\n}\n\n.GridContainerWrapper {\n display: grid;\n}\n\n.GridContainer {\n margin: auto;\n width: 100%;\n height: 280px;\n border-radius: 15px;\n background-color: #07072A;\n margin-bottom: 20px;\n display: grid;\n gap: 30px;\n grid-template-rows: 1fr 4fr 1fr 1fr;\n grid-template-columns: 30px 1fr 1fr 30px;\n}\n.GridContainer .BlogBanner {\n grid-column: 1/3;\n grid-row: 1/5;\n}\n.GridContainer .BlogBanner img {\n border-radius: 5px 0 0 5px;\n width: 100%;\n height: 280px;\n}\n.GridContainer .BlogDate {\n font-size: 12px;\n border-radius: 5px 5px 0 0;\n padding: 10px;\n width: fit-content;\n text-align: center;\n color: #FFFFFF;\n background-color: #0D0D4D;\n grid-column: 2/2;\n grid-row: 4/4;\n z-index: 1;\n}\n.GridContainer .BlogTitle {\n font-size: 24px;\n color: #FFF;\n margin-top: 20px;\n grid-column: 3/5;\n}\n.GridContainer .BlogContent {\n font-size: 14px;\n color: #FFF;\n width: 90%;\n max-height: 80px;\n overflow: hidden;\n text-overflow: ellipsis;\n grid-column: 3/5;\n}\n.GridContainer .BlogLink {\n grid-column: 3/5;\n color: #FFF;\n}\n.GridContainer .BlogLink button {\n font-size: 14px;\n border: none;\n padding: 0;\n background: none;\n color: #D0046C;\n cursor: pointer;\n}\n\n@container (max-width: 475px) {\n .GridContainerWrapper {\n display: grid;\n }\n\n .GridContainer {\n margin: auto;\n width: 100%;\n min-height: 400px;\n gap: 10%;\n padding-bottom: 30px;\n border-radius: 5px;\n background-color: #07072A;\n margin-bottom: 20px;\n display: grid;\n grid-template-rows: repeat(auto-fit, minmax(50px, 1fr));\n grid-template-rows: auto auto auto 50px;\n grid-template-columns: 15px auto auto 15px;\n gap: 10px;\n }\n .GridContainer .BlogBanner {\n grid-column: 1/5;\n grid-row: 1/3;\n margin: 0;\n }\n .GridContainer .BlogBanner img {\n width: 100%;\n height: 232px;\n border-radius: 5px 5px 0 0;\n }\n .GridContainer .BlogDate {\n grid-column: 2/3;\n grid-row: 2/3;\n font-size: 12px;\n border-radius: 5px 5px 0 0;\n padding: 10px;\n width: fit-content;\n text-align: center;\n color: #FFFFFF;\n background-color: #0D0D4D;\n z-index: 1;\n }\n .GridContainer .BlogTitle {\n grid-column: 2/4;\n font-size: 24px;\n color: #FFF;\n }\n .GridContainer .BlogContent {\n grid-column: 2/4;\n font-size: 14px;\n color: #FFF;\n }\n .GridContainer .BlogLink {\n grid-column: 2/4;\n color: #FFF;\n cursor: pointer;\n }\n .GridContainer .BlogLink button {\n font-size: 14px;\n border: none;\n background: none;\n color: #D0046C;\n cursor: pointer;\n }\n}";const a=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)),h=["ro","en","hu"],l={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"}},d=(t,i)=>{const n=i;return l[void 0!==n&&h.includes(n)?n:"en"][t]},c=class{constructor(n){t(this,n),this.hpPageChange=i(this,"hpPageChange",7),this.nextPage="",this.prevPage="",this.offset=0,this.limit=1,this.total=1,this.language="en",this.clientStyling="",this.clientStylingUrlContent="",this.lastPage=!1,this.previousPage=!1,this.pagesArray=[],this.endInt=0,this.userAgent=window.navigator.userAgent,this.currentPage=1,this.limitStylingAppends=!1,this.navigateTo=t=>{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,this.hpPageChange.emit({offset:this.offsetInt,limit:this.limitInt,total:this.totalInt})},this.paginationNavigation=(t,i)=>{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,this.hpPageChange.emit({offset:this.offsetInt,limit:this.limitInt,total:this.totalInt})},this.setClientStyling=()=>{let t=document.createElement("style");t.innerHTML=this.clientStyling,this.stylingContainer.prepend(t)},this.setClientStylingURL=()=>{let t=document.createElement("style");setTimeout((()=>{t.innerHTML=this.clientStylingUrlContent,this.stylingContainer.prepend(t)}),1)}}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("..."))}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrlContent&&this.setClientStylingURL(),this.limitStylingAppends=!0)}render(){let t=n("ul",{class:"PaginationArea"},this.pagesArray.map(((t,i)=>n("li",{class:"PaginationItem"+(t===this.currentPage?" ActiveItem":" ")+" "+(a(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"},d("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"},d("previousPage",this.language)),n("span",{class:"NavigationIcon"})));a(this.userAgent)&&(e=n("div",{class:"LeftItems"},n("button",{disabled:!this.prevPage,onClick:this.navigateTo.bind(this,"previousPage")},n("span",{class:"NavigationButton"},d("previousPage",this.language)),n("span",{class:"NavigationIcon"}))));let s=n("button",{disabled:!this.nextPage,onClick:this.navigateTo.bind(this,"lastPage")},n("span",{class:"NavigationButton"},d("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"},d("nextPage",this.language)),n("span",{class:"NavigationIcon"})),this.secondaryArrowsActive&&s);return a(this.userAgent)&&(o=n("div",{class:"RightItems"},n("button",{disabled:!this.nextPage,onClick:this.navigateTo.bind(this,"nextPage")},n("span",{class:"NavigationButton"},d("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)}};c.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{r as blog_articles_grid,c as helper_pagination}
|