@everymatrix/blog-article-details 1.99.38 → 1.99.39
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-article-details/blog-article-details.entry.js +1 -1
- package/dist/blog-article-details/blog-article-details.esm.js +1 -1
- package/dist/cjs/blog-article-details.cjs.entry.js +47 -2
- package/dist/cjs/blog-article-details.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/blog-article-details/blog-article-details.css +22 -0
- package/dist/collection/components/blog-article-details/blog-article-details.js +61 -2
- package/dist/collection/utils/locale.utils.js +7 -0
- package/dist/esm/blog-article-details.entry.js +47 -2
- package/dist/esm/blog-article-details.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/blog-article-details/blog-article-details.d.ts +7 -0
- package/dist/types/components.d.ts +8 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,h as i}from"./index-39cf8680.js";const e={en:{error:"Error",home:"Home",blog:"Blog",backToBlog:"Back to blog",moreArticles:"More articles",previousArticle:"Previous article",nextArticle:"Next article"},ro:{error:"Error",home:"Home",blog:"Blog",backToBlog:"Back to blog",moreArticles:"More articles",previousArticle:"Previous article",nextArticle:"Next article"},fr:{error:"Error",home:"Home",blog:"Blog",backToBlog:"Back to blog",moreArticles:"More articles",previousArticle:"Previous article",nextArticle:"Next article"},ar:{error:"Error",home:"Home",blog:"Blog",backToBlog:"Back to blog",moreArticles:"More articles",previousArticle:"Previous article",nextArticle:"Next article"},hr:{error:"Error",home:"Home",blog:"Blog",backToBlog:"Back to blog",moreArticles:"More articles",previousArticle:"Previous article",nextArticle:"Next article"},"pt-br":{error:"Error",home:"Home",blog:"Blog",backToBlog:"Back to blog",moreArticles:"More articles",previousArticle:"Previous article",nextArticle:"Next article"},"es-mx":{error:"Error",home:"Home",blog:"Blog",backToBlog:"Back to blog",moreArticles:"More articles",previousArticle:"Previous article",nextArticle:"Next article"}},n=(t,i)=>e[void 0!==i&&i in e?i:"en"][t],o="__WIDGET_GLOBAL_STYLE_CACHE__";function r(t,i){if(t){const e=document.createElement("style");e.innerHTML=i,t.appendChild(e)}}function s(t,i){if(!t||!i)return;const e=new URL(i);fetch(e.href).then((t=>t.text())).then((i=>{const e=document.createElement("style");e.innerHTML=i,t&&t.appendChild(e)})).catch((t=>{console.error("There was an error while trying to load client styling from URL",t)}))}function l(t){return t.includes("android")}const a=()=>{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"},h=class{constructor(e){t(this,e),this.articleRequest=0,this.neighboursRequest=0,this.renderContentConditionally=t=>t&&(!t.includes("<bannermatrix-banner")||this.bannerMatrixReady)?i("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.showBreadcrumb=!1,this.hideCategory="",this.showContent=!0,this.showMoreArticles=!1,this.showBackButton=!1,this.postId=void 0,this.postSlug=void 0,this.postCustomPath=void 0,this.intlDateTimeFormat="",this.hasErrors=!1,this.isLoading=!0,this.bannerMatrixReady=!1,this.device="mobile",this.categories=[],this.neighbours={}}handleBannerReady(){this.bannerMatrixReady=!0}watchEndpoint(t,i){t!==i&&(this.cmsEndpoint&&this.language&&(this.postCustomPath||this.postSlug||this.postId)?this.getBlogArticleDetails():(this.articleRequest++,this.categories=[],this.neighbours={}))}handleMoreArticlesChange(){this.neighboursRequest++,this.neighbours={},this.showMoreArticles&&!this.isLoading&&this.blogData&&this.fetchMoreArticles(this.articleRequest)}handleClientStylingChange(t,i){t!==i&&r(this.stylingContainer,this.clientStyling)}handleClientStylingChangeURL(t,i){t!==i&&this.clientStylingUrl&&s(this.stylingContainer,this.clientStylingUrl)}connectedCallback(){this.cmsEndpoint&&this.language&&(this.postCustomPath||this.postSlug||this.postId)&&this.getBlogArticleDetails()}getBlogArticleDetails(){if(!this.postId&&!this.postSlug&&!this.postCustomPath)throw this.hasErrors=!0,new Error("postId, postSlug or postCustomPath parameter has to be provided!");const t=++this.articleRequest;this.categories=[],this.neighbours={},this.neighboursRequest++,this.hasErrors=!1,this.isLoading=!0;let i=new URL(`${this.cmsEndpoint}/${this.language}/blog-posts${this.postCustomPath?"":"/"+(this.postSlug||this.postId)}`);i.searchParams.append("env",this.cmsEnv),i.searchParams.append("userRoles",this.userRoles),i.searchParams.append("device",a()),this.postCustomPath&&i.searchParams.append("customURL",this.postCustomPath),this.fetchCategories(t),fetch(i.href).then((t=>{if(t.status>=300)throw new Error("There was an error while fetching the data");return t.json()})).then((i=>{if(t===this.articleRequest){if(i.count>=1&&this.postCustomPath){let t=new Date(i.items[0].publishingDate),e=0;for(let n=1;n<i.items.length;n++){const o=new Date(i.items[n].publishingDate);t.getTime()<o.getTime()&&(t=o,e=n)}this.blogData=i.items[e]}else this.blogData=i;this.showMoreArticles&&this.fetchMoreArticles(t)}})).catch((i=>{t===this.articleRequest&&(this.hasErrors=!0,console.log("Error",i))})).finally((()=>{t===this.articleRequest&&(this.isLoading=!1)}))}async fetchMoreArticles(t){var i,e,n,o,r;if(!(this.cmsEndpoint&&this.language&&this.blogData&&this.showMoreArticles))return;const s=++this.neighboursRequest,l=null===(i=this.blogData)||void 0===i?void 0:i.postID,h=(null===(e=this.blogData)||void 0===e?void 0:e.customPath)||(null===(n=this.blogData)||void 0===n?void 0:n.slug)||this.postCustomPath||this.postSlug,c=[],d=new URL(`${this.cmsEndpoint}/${this.language}/blog-posts`);d.searchParams.set("per_page","20"),d.searchParams.set("env",this.cmsEnv),d.searchParams.set("userRoles",this.userRoles),d.searchParams.set("device",a());try{for(let i=1;this.showMoreArticles&&s===this.neighboursRequest&&t===this.articleRequest;i++){d.searchParams.set("page",String(i));const e=await fetch(d.href);if(!e.ok)throw new Error("Failed to fetch adjacent articles");const n=await e.json();if(!this.showMoreArticles||s!==this.neighboursRequest||t!==this.articleRequest)return;if(!Array.isArray(null==n?void 0:n.items))return;c.push(...n.items.filter((t=>"string"==typeof((null==t?void 0:t.customPath)||(null==t?void 0:t.slug))&&(t.customPath||t.slug))));const a=c.findIndex((t=>null!=l&&t.postID===l||h&&(t.customPath||t.slug)===h));if(a>=0&&(a<c.length-1||!(null===(o=n.pages)||void 0===o?void 0:o.next)))return void(this.neighbours={previous:c[a+1],next:c[a-1]});if(!(null===(r=n.pages)||void 0===r?void 0:r.next))return}}catch(t){console.error("Error fetching adjacent articles",t)}}async fetchCategories(t){try{const i=await fetch(`${this.cmsEndpoint}/${this.language}/blog-posts/category`);if(!i.ok)throw new Error("Failed to fetch categories");const e=await i.json();if(t===this.articleRequest){const t=this.hideCategory.split(",").map((t=>t.trim().toLowerCase())).filter(Boolean),i=Array.isArray(e)?e.filter((i=>"string"==typeof(null==i?void 0:i.name)&&i.name&&"string"==typeof i.slug&&i.slug&&!t.includes(i.name.toLowerCase()))):[];this.categories=i}}catch(i){t===this.articleRequest&&(this.categories=[])}}handleClientStyling(){void 0===window.emMessageBus?(this.clientStyling&&r(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&s(this.stylingContainer,this.clientStylingUrl)):this.stylingSubscription=function(t,i,e,n=!1){if(!window.emMessageBus)return;if(!("adoptedStyleSheets"in Document.prototype)||!n)return function(t,i){const e=document.createElement("style");return window.emMessageBus.subscribe(i,(i=>{t&&(e.innerHTML=i,t.appendChild(e))}))}(t,i);window[o]||(window[o]={});const r=(e=function(t,i){return window.emMessageBus.subscribe(i,(e=>{if(!t)return;const n=t.getRootNode(),r=window[o];let s=r[i]&&r[i].sheet;s?r[i].refCount=r[i].refCount+1:(s=new CSSStyleSheet,s.replaceSync(e),r[i]={sheet:s,refCount:1});const l=n.adoptedStyleSheets||[];l.includes(s)||(n.adoptedStyleSheets=[...l,s])}))}(t,i)).unsubscribe.bind(e);return e.unsubscribe=()=>{if(window[o][i]){const t=window[o][i];t.refCount>1?t.refCount=t.refCount-1:delete window[o][i]}r()},e}(this.stylingContainer,`${this.mbSource}.Style`,this.stylingSubscription,!0)}componentDidLoad(){this.detectAndAlertDeviceType(),this.handleClientStyling()}disconnectedCallback(){this.articleRequest++,this.neighboursRequest++,this.stylingSubscription&&this.stylingSubscription.unsubscribe()}detectAndAlertDeviceType(){this.device=((t=!1)=>{if("undefined"==typeof window||"undefined"==typeof navigator)return"desktop";const i=navigator.userAgent.toLowerCase(),e=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,e))return"mobile";if(function(t,i){return l(t)&&!t.includes("mobile")&&!t.includes("mobi")&&i>599}(i,e))return"tablet";if(t){if(e<=599)return"mobile";if(e<=1099)return"tablet"}return"desktop"})()}parseDate(t){const i=new Date(t);if(i instanceof Date&&!Number.isNaN(i.getTime()))return i;const[e,n,o]=t.trim().split("/").map(Number);return new Date(o,n-1,e)}formatDate(t){const i=this.parseDate(t);return new Intl.DateTimeFormat(this.intlDateTimeFormat||"en-GB",{day:"numeric",month:"short",year:"numeric"}).format(i)}setImage(t){var i,e;return null===(e=null===(i=null==t?void 0:t.sources)||void 0===i?void 0:i["mobile"===this.device?0:"tablet"===this.device?1:2])||void 0===e?void 0:e.pictureSource}render(){var t,e,o,r,s,l,a;if(this.hasErrors)return i("div",{class:"BlogArticleDetails"},i("div",{class:"Title"},n("error",this.language)));const h=`/${encodeURIComponent(this.language)}`,c=!this.isLoading&&Array.isArray(null===(t=this.blogData)||void 0===t?void 0:t.blogCategory)?this.blogData.blogCategory.map((t=>this.categories.find((i=>i.slug===t)))).filter(Boolean):[],d=c[0],p=null===(e=this.blogData)||void 0===e?void 0:e.image,u=this.setImage(p),{previous:g,next:f}=this.neighbours;return i("div",{ref:t=>this.stylingContainer=t},!this.isLoading&&i("div",{class:"DetailsContainer"},this.showBackButton&&i("a",{class:"BackButton",href:`${h}/blog`},"← ",n("backToBlog",this.language)),i("div",{class:"DetailsHeadWrapper"},this.showPublishingDate&&this.blogData.publishingDate&&i("time",{class:"BlogDate",dateTime:this.blogData.publishingDate},this.formatDate(this.blogData.publishingDate)),this.showImage&&i("div",{class:`BlogBanner ${this.device}`},u?i("img",{src:u,alt:(null==p?void 0:p.alt)||""}):(null===(r=null===(o=this.blogData.video)||void 0===o?void 0:o.sources)||void 0===r?void 0:r[this.device])?i("video",{src:this.blogData.video.sources[this.device],controls:!0}):null)),i("div",{class:"DetailsBodyWrapper"},this.showTitle&&i("div",{class:"BlogTitle"},null===(s=this.blogData)||void 0===s?void 0:s.title),this.showBreadcrumb&&i("nav",{class:"breadcrumb","aria-label":"Breadcrumb"},i("a",{href:h},n("home",this.language)),i("span",{"aria-hidden":"true"},"›"),i("a",{href:`${h}/blog`},n("blog",this.language)),i("span",{"aria-hidden":"true"},"›"),d&&[i("a",{href:`${h}/blog/category/${encodeURIComponent(d.slug)}`},d.name),i("span",{"aria-hidden":"true"},"›")],i("span",{"aria-current":"page"},null===(l=this.blogData)||void 0===l?void 0:l.title)),c.length>0&&i("div",{class:"BlogCategoryPills"},c.map((t=>i("a",{class:"BlogCategoryLink",href:`${h}/blog/category/${encodeURIComponent(t.slug)}`},t.name)))),this.showContent&&this.renderContentConditionally(null===(a=this.blogData)||void 0===a?void 0:a.content)),this.showMoreArticles&&(g||f)&&i("nav",{class:"AdjacentPosts","aria-label":n("moreArticles",this.language)},g&&i("a",{href:`${h}/blog/${encodeURIComponent(g.customPath||g.slug||"")}`,rel:"prev"},"← ",n("previousArticle",this.language),": ",g.title||g.customPath||g.slug),f&&i("a",{href:`${h}/blog/${encodeURIComponent(f.customPath||f.slug||"")}`,rel:"next"},n("nextArticle",this.language),": ",f.title||f.customPath||f.slug," →"))))}static get watchers(){return{postId:["watchEndpoint"],postSlug:["watchEndpoint"],postCustomPath:["watchEndpoint"],cmsEndpoint:["watchEndpoint"],language:["watchEndpoint"],cmsEnv:["watchEndpoint"],userRoles:["watchEndpoint"],showMoreArticles:["handleMoreArticlesChange"],clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingChangeURL"]}}};h.style=":host {\n display: block;\n}\n\n.breadcrumb {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 0.5rem;\n max-width: 1300px;\n margin-bottom: 30px;\n}\n.breadcrumb a {\n color: inherit;\n}\n\n.DetailsContainer {\n background-color: #07072A;\n position: relative;\n color: #fff;\n display: flex;\n flex-direction: column;\n}\n.DetailsContainer .BlogBanner img {\n display: block;\n width: 100%;\n height: 400px;\n object-fit: cover;\n}\n.DetailsContainer .DetailsHeadWrapper {\n position: relative;\n}\n.DetailsContainer .DetailsBodyWrapper {\n padding: 30px;\n}\n.DetailsContainer .BlogDate {\n font-size: 12px;\n border-radius: 5px 5px 0 0;\n padding: 10px;\n width: fit-content;\n text-align: center;\n background-color: #0D0D4D;\n z-index: 1;\n text-wrap: nowrap;\n position: absolute;\n bottom: 0;\n left: 30px;\n}\n.DetailsContainer .BlogTitle {\n font-size: 24px;\n}\n.DetailsContainer .BlogCategoryPills {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n}\n.DetailsContainer .BlogCategoryLink {\n position: relative;\n z-index: 3;\n padding: 4px 12px;\n border: 1px solid currentColor;\n border-radius: 999px;\n color: inherit;\n font-size: 12px;\n text-decoration: none;\n}\n.DetailsContainer .BlogContent {\n font-size: 14px;\n}\n.DetailsContainer .BlogContent p:last-child {\n margin-bottom: 0;\n}\n\n.BackButton {\n position: absolute;\n top: 30px;\n left: 30px;\n z-index: 2;\n display: inline-flex;\n justify-content: center;\n align-items: center;\n box-sizing: border-box;\n min-width: 100px;\n height: 32px;\n padding: 0 12px;\n border: none;\n border-radius: 5px;\n background: var(--emw--color-primary, #524e52);\n color: var(--emw--color-typography-contrast, #fff);\n font: inherit;\n text-decoration: none;\n text-align: center;\n white-space: nowrap;\n cursor: pointer;\n transition: all 0.1s linear;\n}\n\n.DetailsContainer:not(:has(.BlogBanner img, .BlogBanner video)) .BackButton {\n position: static;\n align-self: flex-start;\n margin: 30px 30px 16px;\n}\n.DetailsContainer:not(:has(.BlogBanner img, .BlogBanner video)) .BlogDate {\n position: static;\n display: block;\n margin-left: 30px;\n}\n.DetailsContainer:not(:has(.BlogBanner img, .BlogBanner video)) .BlogBanner {\n display: none;\n}\n\n.AdjacentPosts {\n display: flex;\n flex-wrap: wrap;\n justify-content: space-between;\n gap: 20px;\n padding: 30px;\n}\n.AdjacentPosts a {\n flex: 1 1 250px;\n}\n\n.AdjacentPosts a {\n color: var(--emw--color-primary, #fff);\n font: inherit;\n text-decoration: underline;\n}\n\n.BackButton:focus-visible,\n.AdjacentPosts a:focus-visible {\n outline: 2px solid var(--emw--color-primary, #fff);\n outline-offset: 3px;\n}\n\n@container (max-width: 475px) {\n .DetailsContainer {\n font-size: 12px;\n }\n}";export{h as blog_article_details}
|
|
1
|
+
import{r as t,h as e}from"./index-39cf8680.js";const i={en:{error:"Error",home:"Home",blog:"Blog",backToBlog:"Back to blog",moreArticles:"More articles",relatedArticles:"Related articles",previousArticle:"Previous article",nextArticle:"Next article"},ro:{error:"Error",home:"Home",blog:"Blog",backToBlog:"Back to blog",moreArticles:"More articles",relatedArticles:"Related articles",previousArticle:"Previous article",nextArticle:"Next article"},fr:{error:"Error",home:"Home",blog:"Blog",backToBlog:"Back to blog",moreArticles:"More articles",relatedArticles:"Related articles",previousArticle:"Previous article",nextArticle:"Next article"},ar:{error:"Error",home:"Home",blog:"Blog",backToBlog:"Back to blog",moreArticles:"More articles",relatedArticles:"Related articles",previousArticle:"Previous article",nextArticle:"Next article"},hr:{error:"Error",home:"Home",blog:"Blog",backToBlog:"Back to blog",moreArticles:"More articles",relatedArticles:"Related articles",previousArticle:"Previous article",nextArticle:"Next article"},"pt-br":{error:"Error",home:"Home",blog:"Blog",backToBlog:"Back to blog",moreArticles:"More articles",relatedArticles:"Related articles",previousArticle:"Previous article",nextArticle:"Next article"},"es-mx":{error:"Error",home:"Home",blog:"Blog",backToBlog:"Back to blog",moreArticles:"More articles",relatedArticles:"Related articles",previousArticle:"Previous article",nextArticle:"Next article"}},n=(t,e)=>i[void 0!==e&&e in i?e:"en"][t],o="__WIDGET_GLOBAL_STYLE_CACHE__";function r(t,e){if(t){const i=document.createElement("style");i.innerHTML=e,t.appendChild(i)}}function s(t,e){if(!t||!e)return;const i=new URL(e);fetch(i.href).then((t=>t.text())).then((e=>{const i=document.createElement("style");i.innerHTML=e,t&&t.appendChild(i)})).catch((t=>{console.error("There was an error while trying to load client styling from URL",t)}))}function l(t){return t.includes("android")}const a=()=>{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"},h=class{constructor(i){t(this,i),this.articleRequest=0,this.neighboursRequest=0,this.renderContentConditionally=t=>t&&(!t.includes("<bannermatrix-banner")||this.bannerMatrixReady)?e("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.showBreadcrumb=!1,this.hideCategory="",this.showContent=!0,this.showMoreArticles=!1,this.showRelatedArticles=!1,this.showBackButton=!1,this.postId=void 0,this.postSlug=void 0,this.postCustomPath=void 0,this.intlDateTimeFormat="",this.hasErrors=!1,this.isLoading=!0,this.bannerMatrixReady=!1,this.device="mobile",this.categories=[],this.neighbours={},this.relatedPosts=[]}handleBannerReady(){this.bannerMatrixReady=!0}watchEndpoint(t,e){t!==e&&(this.cmsEndpoint&&this.language&&(this.postCustomPath||this.postSlug||this.postId)?this.getBlogArticleDetails():(this.articleRequest++,this.categories=[],this.neighbours={},this.relatedPosts=[]))}handleRelatedArticlesChange(){this.relatedPosts=[],this.showRelatedArticles&&!this.isLoading&&this.blogData&&this.fetchRelatedArticles(this.articleRequest)}handleMoreArticlesChange(){this.neighboursRequest++,this.neighbours={},this.showMoreArticles&&!this.isLoading&&this.blogData&&this.fetchMoreArticles(this.articleRequest)}handleClientStylingChange(t,e){t!==e&&r(this.stylingContainer,this.clientStyling)}handleClientStylingChangeURL(t,e){t!==e&&this.clientStylingUrl&&s(this.stylingContainer,this.clientStylingUrl)}connectedCallback(){this.cmsEndpoint&&this.language&&(this.postCustomPath||this.postSlug||this.postId)&&this.getBlogArticleDetails()}getBlogArticleDetails(){if(!this.postId&&!this.postSlug&&!this.postCustomPath)throw this.hasErrors=!0,new Error("postId, postSlug or postCustomPath parameter has to be provided!");const t=++this.articleRequest;this.categories=[],this.neighbours={},this.neighboursRequest++,this.hasErrors=!1,this.isLoading=!0;let e=new URL(`${this.cmsEndpoint}/${this.language}/blog-posts${this.postCustomPath?"":"/"+(this.postSlug||this.postId)}`);e.searchParams.append("env",this.cmsEnv),e.searchParams.append("userRoles",this.userRoles),e.searchParams.append("device",a()),this.postCustomPath&&e.searchParams.append("customURL",this.postCustomPath),this.fetchCategories(t),fetch(e.href).then((t=>{if(t.status>=300)throw new Error("There was an error while fetching the data");return t.json()})).then((e=>{if(t===this.articleRequest){if(e.count>=1&&this.postCustomPath){let t=new Date(e.items[0].publishingDate),i=0;for(let n=1;n<e.items.length;n++){const o=new Date(e.items[n].publishingDate);t.getTime()<o.getTime()&&(t=o,i=n)}this.blogData=e.items[i]}else this.blogData=e;this.showMoreArticles&&this.fetchMoreArticles(t),this.showRelatedArticles&&this.fetchRelatedArticles(t)}})).catch((e=>{t===this.articleRequest&&(this.hasErrors=!0,console.log("Error",e))})).finally((()=>{t===this.articleRequest&&(this.isLoading=!1)}))}async fetchMoreArticles(t){var e,i,n,o,r;if(!(this.cmsEndpoint&&this.language&&this.blogData&&this.showMoreArticles))return;const s=++this.neighboursRequest,l=null===(e=this.blogData)||void 0===e?void 0:e.postID,h=(null===(i=this.blogData)||void 0===i?void 0:i.customPath)||(null===(n=this.blogData)||void 0===n?void 0:n.slug)||this.postCustomPath||this.postSlug,c=[],d=new URL(`${this.cmsEndpoint}/${this.language}/blog-posts`);d.searchParams.set("per_page","20"),d.searchParams.set("env",this.cmsEnv),d.searchParams.set("userRoles",this.userRoles),d.searchParams.set("device",a());try{for(let e=1;this.showMoreArticles&&s===this.neighboursRequest&&t===this.articleRequest;e++){d.searchParams.set("page",String(e));const i=await fetch(d.href);if(!i.ok)throw new Error("Failed to fetch adjacent articles");const n=await i.json();if(!this.showMoreArticles||s!==this.neighboursRequest||t!==this.articleRequest)return;if(!Array.isArray(null==n?void 0:n.items))return;c.push(...n.items.filter((t=>"string"==typeof((null==t?void 0:t.customPath)||(null==t?void 0:t.slug))&&(t.customPath||t.slug))));const a=c.findIndex((t=>null!=l&&t.postID===l||h&&(t.customPath||t.slug)===h));if(a>=0&&(a<c.length-1||!(null===(o=n.pages)||void 0===o?void 0:o.next)))return void(this.neighbours={previous:c[a+1],next:c[a-1]});if(!(null===(r=n.pages)||void 0===r?void 0:r.next))return}}catch(t){console.error("Error fetching adjacent articles",t)}}async fetchRelatedArticles(t){var e,i;const n=null===(i=null===(e=this.blogData)||void 0===e?void 0:e.blogCategory)||void 0===i?void 0:i[0];if(!this.cmsEndpoint||!this.language||!n)return;const o=this.blogData.postID,r=new URL(`${this.cmsEndpoint}/${this.language}/blog-posts`);r.searchParams.set("category",n),r.searchParams.set("per_page","5"),r.searchParams.set("env",this.cmsEnv),r.searchParams.set("userRoles",this.userRoles),r.searchParams.set("device",a());try{const e=await fetch(r.href);if(!e.ok)throw new Error("Failed to fetch related articles");const i=await e.json();if(!this.showRelatedArticles||t!==this.articleRequest||!Array.isArray(null==i?void 0:i.items))return;this.relatedPosts=i.items.filter((t=>t.postID!==o&&(t.customPath||t.slug))).slice(0,4)}catch(t){console.error("Error fetching related articles",t)}}async fetchCategories(t){try{const e=await fetch(`${this.cmsEndpoint}/${this.language}/blog-posts/category`);if(!e.ok)throw new Error("Failed to fetch categories");const i=await e.json();if(t===this.articleRequest){const t=this.hideCategory.split(",").map((t=>t.trim().toLowerCase())).filter(Boolean),e=Array.isArray(i)?i.filter((e=>"string"==typeof(null==e?void 0:e.name)&&e.name&&"string"==typeof e.slug&&e.slug&&!t.includes(e.name.toLowerCase()))):[];this.categories=e}}catch(e){t===this.articleRequest&&(this.categories=[])}}handleClientStyling(){void 0===window.emMessageBus?(this.clientStyling&&r(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&s(this.stylingContainer,this.clientStylingUrl)):this.stylingSubscription=function(t,e,i,n=!1){if(!window.emMessageBus)return;if(!("adoptedStyleSheets"in Document.prototype)||!n)return function(t,e){const i=document.createElement("style");return window.emMessageBus.subscribe(e,(e=>{t&&(i.innerHTML=e,t.appendChild(i))}))}(t,e);window[o]||(window[o]={});const r=(i=function(t,e){return window.emMessageBus.subscribe(e,(i=>{if(!t)return;const n=t.getRootNode(),r=window[o];let s=r[e]&&r[e].sheet;s?r[e].refCount=r[e].refCount+1:(s=new CSSStyleSheet,s.replaceSync(i),r[e]={sheet:s,refCount:1});const l=n.adoptedStyleSheets||[];l.includes(s)||(n.adoptedStyleSheets=[...l,s])}))}(t,e)).unsubscribe.bind(i);return i.unsubscribe=()=>{if(window[o][e]){const t=window[o][e];t.refCount>1?t.refCount=t.refCount-1:delete window[o][e]}r()},i}(this.stylingContainer,`${this.mbSource}.Style`,this.stylingSubscription,!0)}componentDidLoad(){this.detectAndAlertDeviceType(),this.handleClientStyling()}disconnectedCallback(){this.articleRequest++,this.neighboursRequest++,this.stylingSubscription&&this.stylingSubscription.unsubscribe()}detectAndAlertDeviceType(){this.device=((t=!1)=>{if("undefined"==typeof window||"undefined"==typeof navigator)return"desktop";const e=navigator.userAgent.toLowerCase(),i=window.innerWidth;if(function(t){return!!t.includes("ipad")||t.includes("macintosh")&&navigator.maxTouchPoints>0}(e))return"tablet";if(function(t){return t.includes("iphone")||t.includes("ipod")}(e))return"mobile";if(function(t,e){return l(t)&&(t.includes("mobile")||t.includes("mobi")||e<=599)}(e,i))return"mobile";if(function(t,e){return l(t)&&!t.includes("mobile")&&!t.includes("mobi")&&e>599}(e,i))return"tablet";if(t){if(i<=599)return"mobile";if(i<=1099)return"tablet"}return"desktop"})()}parseDate(t){const e=new Date(t);if(e instanceof Date&&!Number.isNaN(e.getTime()))return e;const[i,n,o]=t.trim().split("/").map(Number);return new Date(o,n-1,i)}formatDate(t){const e=this.parseDate(t);return new Intl.DateTimeFormat(this.intlDateTimeFormat||"en-GB",{day:"numeric",month:"short",year:"numeric"}).format(e)}setImage(t){var e,i;return null===(i=null===(e=null==t?void 0:t.sources)||void 0===e?void 0:e["mobile"===this.device?0:"tablet"===this.device?1:2])||void 0===i?void 0:i.pictureSource}render(){var t,i,o,r,s,l,a;if(this.hasErrors)return e("div",{class:"BlogArticleDetails"},e("div",{class:"Title"},n("error",this.language)));const h=`/${encodeURIComponent(this.language)}`,c=!this.isLoading&&Array.isArray(null===(t=this.blogData)||void 0===t?void 0:t.blogCategory)?this.blogData.blogCategory.map((t=>this.categories.find((e=>e.slug===t)))).filter(Boolean):[],d=c[0],p=null===(i=this.blogData)||void 0===i?void 0:i.image,g=this.setImage(p),{previous:u,next:f}=this.neighbours;return e("div",{ref:t=>this.stylingContainer=t},!this.isLoading&&e("div",{class:"DetailsContainer"},this.showBackButton&&e("a",{class:"BackButton",href:`${h}/blog`},"← ",n("backToBlog",this.language)),e("div",{class:"DetailsHeadWrapper"},this.showPublishingDate&&this.blogData.publishingDate&&e("time",{class:"BlogDate",dateTime:this.blogData.publishingDate},this.formatDate(this.blogData.publishingDate)),this.showImage&&e("div",{class:`BlogBanner ${this.device}`},g?e("img",{src:g,alt:(null==p?void 0:p.alt)||""}):(null===(r=null===(o=this.blogData.video)||void 0===o?void 0:o.sources)||void 0===r?void 0:r[this.device])?e("video",{src:this.blogData.video.sources[this.device],controls:!0}):null)),e("div",{class:"DetailsBodyWrapper"},this.showTitle&&e("div",{class:"BlogTitle"},null===(s=this.blogData)||void 0===s?void 0:s.title),this.showBreadcrumb&&e("nav",{class:"breadcrumb","aria-label":"Breadcrumb"},e("a",{href:h},n("home",this.language)),e("span",{"aria-hidden":"true"},"›"),e("a",{href:`${h}/blog`},n("blog",this.language)),e("span",{"aria-hidden":"true"},"›"),d&&[e("a",{href:`${h}/blog/category/${encodeURIComponent(d.slug)}`},d.name),e("span",{"aria-hidden":"true"},"›")],e("span",{"aria-current":"page"},null===(l=this.blogData)||void 0===l?void 0:l.title)),c.length>0&&e("div",{class:"BlogCategoryPills"},c.map((t=>e("a",{class:"BlogCategoryLink",href:`${h}/blog/category/${encodeURIComponent(t.slug)}`},t.name)))),this.showContent&&this.renderContentConditionally(null===(a=this.blogData)||void 0===a?void 0:a.content)),this.showRelatedArticles&&this.relatedPosts.length>0&&e("nav",{class:"RelatedPosts","aria-label":n("relatedArticles",this.language)},e("h2",{class:"RelatedPostsTitle"},n("relatedArticles",this.language)),e("ul",{class:"RelatedPostsList"},this.relatedPosts.map((t=>e("li",null,e("a",{href:`${h}/blog/${encodeURIComponent(t.customPath||t.slug||"")}`},t.title||t.customPath||t.slug)))))),this.showMoreArticles&&(u||f)&&e("nav",{class:"AdjacentPosts","aria-label":n("moreArticles",this.language)},u&&e("a",{href:`${h}/blog/${encodeURIComponent(u.customPath||u.slug||"")}`,rel:"prev"},"← ",n("previousArticle",this.language),": ",u.title||u.customPath||u.slug),f&&e("a",{href:`${h}/blog/${encodeURIComponent(f.customPath||f.slug||"")}`,rel:"next"},n("nextArticle",this.language),": ",f.title||f.customPath||f.slug," →"))))}static get watchers(){return{postId:["watchEndpoint"],postSlug:["watchEndpoint"],postCustomPath:["watchEndpoint"],cmsEndpoint:["watchEndpoint"],language:["watchEndpoint"],cmsEnv:["watchEndpoint"],userRoles:["watchEndpoint"],showRelatedArticles:["handleRelatedArticlesChange"],showMoreArticles:["handleMoreArticlesChange"],clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingChangeURL"]}}};h.style=":host {\n display: block;\n}\n\n.breadcrumb {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 0.5rem;\n max-width: 1300px;\n margin-bottom: 30px;\n}\n.breadcrumb a {\n color: inherit;\n}\n\n.DetailsContainer {\n background-color: #07072A;\n position: relative;\n color: #fff;\n display: flex;\n flex-direction: column;\n}\n.DetailsContainer .BlogBanner img {\n display: block;\n width: 100%;\n height: 400px;\n object-fit: cover;\n}\n.DetailsContainer .DetailsHeadWrapper {\n position: relative;\n}\n.DetailsContainer .DetailsBodyWrapper {\n padding: 30px;\n}\n.DetailsContainer .BlogDate {\n font-size: 12px;\n border-radius: 5px 5px 0 0;\n padding: 10px;\n width: fit-content;\n text-align: center;\n background-color: #0D0D4D;\n z-index: 1;\n text-wrap: nowrap;\n position: absolute;\n bottom: 0;\n left: 30px;\n}\n.DetailsContainer .BlogTitle {\n font-size: 24px;\n}\n.DetailsContainer .BlogCategoryPills {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n}\n.DetailsContainer .BlogCategoryLink {\n position: relative;\n z-index: 3;\n padding: 4px 12px;\n border: 1px solid currentColor;\n border-radius: 999px;\n color: inherit;\n font-size: 12px;\n text-decoration: none;\n}\n.DetailsContainer .BlogContent {\n font-size: 14px;\n}\n.DetailsContainer .BlogContent p:last-child {\n margin-bottom: 0;\n}\n\n.BackButton {\n position: absolute;\n top: 30px;\n left: 30px;\n z-index: 2;\n display: inline-flex;\n justify-content: center;\n align-items: center;\n box-sizing: border-box;\n min-width: 100px;\n height: 32px;\n padding: 0 12px;\n border: none;\n border-radius: 5px;\n background: var(--emw--color-primary, #524e52);\n color: var(--emw--color-typography-contrast, #fff);\n font: inherit;\n text-decoration: none;\n text-align: center;\n white-space: nowrap;\n cursor: pointer;\n transition: all 0.1s linear;\n}\n\n.DetailsContainer:not(:has(.BlogBanner img, .BlogBanner video)) .BackButton {\n position: static;\n align-self: flex-start;\n margin: 30px 30px 16px;\n}\n.DetailsContainer:not(:has(.BlogBanner img, .BlogBanner video)) .BlogDate {\n position: static;\n display: block;\n margin-left: 30px;\n}\n.DetailsContainer:not(:has(.BlogBanner img, .BlogBanner video)) .BlogBanner {\n display: none;\n}\n\n.AdjacentPosts {\n display: flex;\n flex-wrap: wrap;\n justify-content: space-between;\n gap: 20px;\n padding: 30px;\n}\n.AdjacentPosts a {\n flex: 1 1 250px;\n}\n.AdjacentPosts a[rel=next] {\n margin-left: auto;\n text-align: right;\n}\n\n.RelatedPosts {\n padding: 30px 30px 0;\n}\n\n.RelatedPostsTitle {\n margin: 0 0 12px;\n font-size: 1.25em;\n}\n\n.RelatedPostsList {\n display: grid;\n gap: 8px;\n margin: 0;\n padding-left: 20px;\n}\n\n.RelatedPosts a,\n.AdjacentPosts a {\n color: var(--emw--color-primary, #fff);\n font: inherit;\n text-decoration: underline;\n}\n\n.BackButton:focus-visible,\n.RelatedPosts a:focus-visible,\n.AdjacentPosts a:focus-visible {\n outline: 2px solid var(--emw--color-primary, #fff);\n outline-offset: 3px;\n}\n\n@container (max-width: 475px) {\n .DetailsContainer {\n font-size: 12px;\n }\n}";export{h as blog_article_details}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t,b as e}from"./index-39cf8680.js";export{s as setNonce}from"./index-39cf8680.js";import{g as n}from"./app-globals-0f993ce5.js";(()=>{const e=import.meta.url,
|
|
1
|
+
import{p as t,b as e}from"./index-39cf8680.js";export{s as setNonce}from"./index-39cf8680.js";import{g as n}from"./app-globals-0f993ce5.js";(()=>{const e=import.meta.url,s={};return""!==e&&(s.resourcesUrl=new URL(".",e).href),t(s)})().then((async t=>(await n(),e([["blog-article-details",[[1,"blog-article-details",{cmsEndpoint:[513,"cms-endpoint"],language:[513],userRoles:[513,"user-roles"],cmsEnv:[513,"cms-env"],mbSource:[1,"mb-source"],clientStyling:[513,"client-styling"],clientStylingUrl:[513,"client-styling-url"],showPublishingDate:[516,"show-publishing-date"],showImage:[516,"show-image"],showTitle:[516,"show-title"],showBreadcrumb:[516,"show-breadcrumb"],hideCategory:[513,"hide-category"],showContent:[516,"show-content"],showMoreArticles:[516,"show-more-articles"],showRelatedArticles:[516,"show-related-articles"],showBackButton:[516,"show-back-button"],postId:[513,"post-id"],postSlug:[513,"post-slug"],postCustomPath:[513,"post-custom-path"],intlDateTimeFormat:[1,"intl-date-time-format"],hasErrors:[32],isLoading:[32],bannerMatrixReady:[32],device:[32],categories:[32],neighbours:[32],relatedPosts:[32]},[[8,"BannerMatrixReady","handleBannerReady"]],{postId:["watchEndpoint"],postSlug:["watchEndpoint"],postCustomPath:["watchEndpoint"],cmsEndpoint:["watchEndpoint"],language:["watchEndpoint"],cmsEnv:["watchEndpoint"],userRoles:["watchEndpoint"],showRelatedArticles:["handleRelatedArticlesChange"],showMoreArticles:["handleMoreArticlesChange"],clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingChangeURL"]}]]]],t))));
|
|
@@ -12,6 +12,7 @@ const TRANSLATIONS = {
|
|
|
12
12
|
blog: 'Blog',
|
|
13
13
|
backToBlog: 'Back to blog',
|
|
14
14
|
moreArticles: 'More articles',
|
|
15
|
+
relatedArticles: 'Related articles',
|
|
15
16
|
previousArticle: 'Previous article',
|
|
16
17
|
nextArticle: 'Next article',
|
|
17
18
|
},
|
|
@@ -21,6 +22,7 @@ const TRANSLATIONS = {
|
|
|
21
22
|
blog: 'Blog',
|
|
22
23
|
backToBlog: 'Back to blog',
|
|
23
24
|
moreArticles: 'More articles',
|
|
25
|
+
relatedArticles: 'Related articles',
|
|
24
26
|
previousArticle: 'Previous article',
|
|
25
27
|
nextArticle: 'Next article',
|
|
26
28
|
},
|
|
@@ -30,6 +32,7 @@ const TRANSLATIONS = {
|
|
|
30
32
|
blog: 'Blog',
|
|
31
33
|
backToBlog: 'Back to blog',
|
|
32
34
|
moreArticles: 'More articles',
|
|
35
|
+
relatedArticles: 'Related articles',
|
|
33
36
|
previousArticle: 'Previous article',
|
|
34
37
|
nextArticle: 'Next article',
|
|
35
38
|
},
|
|
@@ -39,6 +42,7 @@ const TRANSLATIONS = {
|
|
|
39
42
|
blog: 'Blog',
|
|
40
43
|
backToBlog: 'Back to blog',
|
|
41
44
|
moreArticles: 'More articles',
|
|
45
|
+
relatedArticles: 'Related articles',
|
|
42
46
|
previousArticle: 'Previous article',
|
|
43
47
|
nextArticle: 'Next article',
|
|
44
48
|
},
|
|
@@ -48,6 +52,7 @@ const TRANSLATIONS = {
|
|
|
48
52
|
blog: 'Blog',
|
|
49
53
|
backToBlog: 'Back to blog',
|
|
50
54
|
moreArticles: 'More articles',
|
|
55
|
+
relatedArticles: 'Related articles',
|
|
51
56
|
previousArticle: 'Previous article',
|
|
52
57
|
nextArticle: 'Next article',
|
|
53
58
|
},
|
|
@@ -57,6 +62,7 @@ const TRANSLATIONS = {
|
|
|
57
62
|
blog: 'Blog',
|
|
58
63
|
backToBlog: 'Back to blog',
|
|
59
64
|
moreArticles: 'More articles',
|
|
65
|
+
relatedArticles: 'Related articles',
|
|
60
66
|
previousArticle: 'Previous article',
|
|
61
67
|
nextArticle: 'Next article',
|
|
62
68
|
},
|
|
@@ -66,6 +72,7 @@ const TRANSLATIONS = {
|
|
|
66
72
|
blog: 'Blog',
|
|
67
73
|
backToBlog: 'Back to blog',
|
|
68
74
|
moreArticles: 'More articles',
|
|
75
|
+
relatedArticles: 'Related articles',
|
|
69
76
|
previousArticle: 'Previous article',
|
|
70
77
|
nextArticle: 'Next article',
|
|
71
78
|
}
|
|
@@ -280,7 +287,7 @@ const getDevicePlatform = () => {
|
|
|
280
287
|
return 'mtWeb';
|
|
281
288
|
};
|
|
282
289
|
|
|
283
|
-
const blogArticleDetailsCss = ":host {\n display: block;\n}\n\n.breadcrumb {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 0.5rem;\n max-width: 1300px;\n margin-bottom: 30px;\n}\n.breadcrumb a {\n color: inherit;\n}\n\n.DetailsContainer {\n background-color: #07072A;\n position: relative;\n color: #fff;\n display: flex;\n flex-direction: column;\n}\n.DetailsContainer .BlogBanner img {\n display: block;\n width: 100%;\n height: 400px;\n object-fit: cover;\n}\n.DetailsContainer .DetailsHeadWrapper {\n position: relative;\n}\n.DetailsContainer .DetailsBodyWrapper {\n padding: 30px;\n}\n.DetailsContainer .BlogDate {\n font-size: 12px;\n border-radius: 5px 5px 0 0;\n padding: 10px;\n width: fit-content;\n text-align: center;\n background-color: #0D0D4D;\n z-index: 1;\n text-wrap: nowrap;\n position: absolute;\n bottom: 0;\n left: 30px;\n}\n.DetailsContainer .BlogTitle {\n font-size: 24px;\n}\n.DetailsContainer .BlogCategoryPills {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n}\n.DetailsContainer .BlogCategoryLink {\n position: relative;\n z-index: 3;\n padding: 4px 12px;\n border: 1px solid currentColor;\n border-radius: 999px;\n color: inherit;\n font-size: 12px;\n text-decoration: none;\n}\n.DetailsContainer .BlogContent {\n font-size: 14px;\n}\n.DetailsContainer .BlogContent p:last-child {\n margin-bottom: 0;\n}\n\n.BackButton {\n position: absolute;\n top: 30px;\n left: 30px;\n z-index: 2;\n display: inline-flex;\n justify-content: center;\n align-items: center;\n box-sizing: border-box;\n min-width: 100px;\n height: 32px;\n padding: 0 12px;\n border: none;\n border-radius: 5px;\n background: var(--emw--color-primary, #524e52);\n color: var(--emw--color-typography-contrast, #fff);\n font: inherit;\n text-decoration: none;\n text-align: center;\n white-space: nowrap;\n cursor: pointer;\n transition: all 0.1s linear;\n}\n\n.DetailsContainer:not(:has(.BlogBanner img, .BlogBanner video)) .BackButton {\n position: static;\n align-self: flex-start;\n margin: 30px 30px 16px;\n}\n.DetailsContainer:not(:has(.BlogBanner img, .BlogBanner video)) .BlogDate {\n position: static;\n display: block;\n margin-left: 30px;\n}\n.DetailsContainer:not(:has(.BlogBanner img, .BlogBanner video)) .BlogBanner {\n display: none;\n}\n\n.AdjacentPosts {\n display: flex;\n flex-wrap: wrap;\n justify-content: space-between;\n gap: 20px;\n padding: 30px;\n}\n.AdjacentPosts a {\n flex: 1 1 250px;\n}\n\n.AdjacentPosts a {\n color: var(--emw--color-primary, #fff);\n font: inherit;\n text-decoration: underline;\n}\n\n.BackButton:focus-visible,\n.AdjacentPosts a:focus-visible {\n outline: 2px solid var(--emw--color-primary, #fff);\n outline-offset: 3px;\n}\n\n@container (max-width: 475px) {\n .DetailsContainer {\n font-size: 12px;\n }\n}";
|
|
290
|
+
const blogArticleDetailsCss = ":host {\n display: block;\n}\n\n.breadcrumb {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 0.5rem;\n max-width: 1300px;\n margin-bottom: 30px;\n}\n.breadcrumb a {\n color: inherit;\n}\n\n.DetailsContainer {\n background-color: #07072A;\n position: relative;\n color: #fff;\n display: flex;\n flex-direction: column;\n}\n.DetailsContainer .BlogBanner img {\n display: block;\n width: 100%;\n height: 400px;\n object-fit: cover;\n}\n.DetailsContainer .DetailsHeadWrapper {\n position: relative;\n}\n.DetailsContainer .DetailsBodyWrapper {\n padding: 30px;\n}\n.DetailsContainer .BlogDate {\n font-size: 12px;\n border-radius: 5px 5px 0 0;\n padding: 10px;\n width: fit-content;\n text-align: center;\n background-color: #0D0D4D;\n z-index: 1;\n text-wrap: nowrap;\n position: absolute;\n bottom: 0;\n left: 30px;\n}\n.DetailsContainer .BlogTitle {\n font-size: 24px;\n}\n.DetailsContainer .BlogCategoryPills {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n}\n.DetailsContainer .BlogCategoryLink {\n position: relative;\n z-index: 3;\n padding: 4px 12px;\n border: 1px solid currentColor;\n border-radius: 999px;\n color: inherit;\n font-size: 12px;\n text-decoration: none;\n}\n.DetailsContainer .BlogContent {\n font-size: 14px;\n}\n.DetailsContainer .BlogContent p:last-child {\n margin-bottom: 0;\n}\n\n.BackButton {\n position: absolute;\n top: 30px;\n left: 30px;\n z-index: 2;\n display: inline-flex;\n justify-content: center;\n align-items: center;\n box-sizing: border-box;\n min-width: 100px;\n height: 32px;\n padding: 0 12px;\n border: none;\n border-radius: 5px;\n background: var(--emw--color-primary, #524e52);\n color: var(--emw--color-typography-contrast, #fff);\n font: inherit;\n text-decoration: none;\n text-align: center;\n white-space: nowrap;\n cursor: pointer;\n transition: all 0.1s linear;\n}\n\n.DetailsContainer:not(:has(.BlogBanner img, .BlogBanner video)) .BackButton {\n position: static;\n align-self: flex-start;\n margin: 30px 30px 16px;\n}\n.DetailsContainer:not(:has(.BlogBanner img, .BlogBanner video)) .BlogDate {\n position: static;\n display: block;\n margin-left: 30px;\n}\n.DetailsContainer:not(:has(.BlogBanner img, .BlogBanner video)) .BlogBanner {\n display: none;\n}\n\n.AdjacentPosts {\n display: flex;\n flex-wrap: wrap;\n justify-content: space-between;\n gap: 20px;\n padding: 30px;\n}\n.AdjacentPosts a {\n flex: 1 1 250px;\n}\n.AdjacentPosts a[rel=next] {\n margin-left: auto;\n text-align: right;\n}\n\n.RelatedPosts {\n padding: 30px 30px 0;\n}\n\n.RelatedPostsTitle {\n margin: 0 0 12px;\n font-size: 1.25em;\n}\n\n.RelatedPostsList {\n display: grid;\n gap: 8px;\n margin: 0;\n padding-left: 20px;\n}\n\n.RelatedPosts a,\n.AdjacentPosts a {\n color: var(--emw--color-primary, #fff);\n font: inherit;\n text-decoration: underline;\n}\n\n.BackButton:focus-visible,\n.RelatedPosts a:focus-visible,\n.AdjacentPosts a:focus-visible {\n outline: 2px solid var(--emw--color-primary, #fff);\n outline-offset: 3px;\n}\n\n@container (max-width: 475px) {\n .DetailsContainer {\n font-size: 12px;\n }\n}";
|
|
284
291
|
const BlogArticleDetailsStyle0 = blogArticleDetailsCss;
|
|
285
292
|
|
|
286
293
|
const BlogArticleDetails = class {
|
|
@@ -311,6 +318,7 @@ const BlogArticleDetails = class {
|
|
|
311
318
|
this.hideCategory = '';
|
|
312
319
|
this.showContent = true;
|
|
313
320
|
this.showMoreArticles = false;
|
|
321
|
+
this.showRelatedArticles = false;
|
|
314
322
|
this.showBackButton = false;
|
|
315
323
|
this.postId = undefined;
|
|
316
324
|
this.postSlug = undefined;
|
|
@@ -322,6 +330,7 @@ const BlogArticleDetails = class {
|
|
|
322
330
|
this.device = 'mobile';
|
|
323
331
|
this.categories = [];
|
|
324
332
|
this.neighbours = {};
|
|
333
|
+
this.relatedPosts = [];
|
|
325
334
|
}
|
|
326
335
|
// Rerender when bannermatrix has finished loaded. Issue when bannermatrix passed as content from CMS.
|
|
327
336
|
handleBannerReady() {
|
|
@@ -337,8 +346,14 @@ const BlogArticleDetails = class {
|
|
|
337
346
|
this.articleRequest++;
|
|
338
347
|
this.categories = [];
|
|
339
348
|
this.neighbours = {};
|
|
349
|
+
this.relatedPosts = [];
|
|
340
350
|
}
|
|
341
351
|
}
|
|
352
|
+
handleRelatedArticlesChange() {
|
|
353
|
+
this.relatedPosts = [];
|
|
354
|
+
if (this.showRelatedArticles && !this.isLoading && this.blogData)
|
|
355
|
+
this.fetchRelatedArticles(this.articleRequest);
|
|
356
|
+
}
|
|
342
357
|
handleMoreArticlesChange() {
|
|
343
358
|
this.neighboursRequest++;
|
|
344
359
|
this.neighbours = {};
|
|
@@ -407,6 +422,8 @@ const BlogArticleDetails = class {
|
|
|
407
422
|
}
|
|
408
423
|
if (this.showMoreArticles)
|
|
409
424
|
this.fetchMoreArticles(request);
|
|
425
|
+
if (this.showRelatedArticles)
|
|
426
|
+
this.fetchRelatedArticles(request);
|
|
410
427
|
})
|
|
411
428
|
.catch((err) => {
|
|
412
429
|
if (request !== this.articleRequest)
|
|
@@ -457,6 +474,33 @@ const BlogArticleDetails = class {
|
|
|
457
474
|
console.error('Error fetching adjacent articles', error);
|
|
458
475
|
}
|
|
459
476
|
}
|
|
477
|
+
async fetchRelatedArticles(articleRequest) {
|
|
478
|
+
var _a, _b;
|
|
479
|
+
const category = (_b = (_a = this.blogData) === null || _a === void 0 ? void 0 : _a.blogCategory) === null || _b === void 0 ? void 0 : _b[0];
|
|
480
|
+
if (!this.cmsEndpoint || !this.language || !category)
|
|
481
|
+
return;
|
|
482
|
+
const currentId = this.blogData.postID;
|
|
483
|
+
const url = new URL(`${this.cmsEndpoint}/${this.language}/blog-posts`);
|
|
484
|
+
url.searchParams.set('category', category);
|
|
485
|
+
url.searchParams.set('per_page', '5');
|
|
486
|
+
url.searchParams.set('env', this.cmsEnv);
|
|
487
|
+
url.searchParams.set('userRoles', this.userRoles);
|
|
488
|
+
url.searchParams.set('device', getDevicePlatform());
|
|
489
|
+
try {
|
|
490
|
+
const response = await fetch(url.href);
|
|
491
|
+
if (!response.ok)
|
|
492
|
+
throw new Error('Failed to fetch related articles');
|
|
493
|
+
const data = await response.json();
|
|
494
|
+
if (!this.showRelatedArticles || articleRequest !== this.articleRequest || !Array.isArray(data === null || data === void 0 ? void 0 : data.items))
|
|
495
|
+
return;
|
|
496
|
+
this.relatedPosts = data.items
|
|
497
|
+
.filter(post => post.postID !== currentId && (post.customPath || post.slug))
|
|
498
|
+
.slice(0, 4);
|
|
499
|
+
}
|
|
500
|
+
catch (error) {
|
|
501
|
+
console.error('Error fetching related articles', error);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
460
504
|
async fetchCategories(request) {
|
|
461
505
|
try {
|
|
462
506
|
const response = await fetch(`${this.cmsEndpoint}/${this.language}/blog-posts/category`);
|
|
@@ -538,7 +582,7 @@ const BlogArticleDetails = class {
|
|
|
538
582
|
index.h("div", { class: "BlogTitle" }, (_e = this.blogData) === null || _e === void 0 ? void 0 : _e.title), this.showBreadcrumb && (index.h("nav", { class: "breadcrumb", "aria-label": "Breadcrumb" }, index.h("a", { href: homeUrl }, translate('home', this.language)), index.h("span", { "aria-hidden": "true" }, "\u203A"), index.h("a", { href: `${homeUrl}/blog` }, translate('blog', this.language)), index.h("span", { "aria-hidden": "true" }, "\u203A"), primaryCategory && [
|
|
539
583
|
index.h("a", { href: `${homeUrl}/blog/category/${encodeURIComponent(primaryCategory.slug)}` }, primaryCategory.name),
|
|
540
584
|
index.h("span", { "aria-hidden": "true" }, "\u203A"),
|
|
541
|
-
], index.h("span", { "aria-current": "page" }, (_f = this.blogData) === null || _f === void 0 ? void 0 : _f.title))), categories.length > 0 && (index.h("div", { class: "BlogCategoryPills" }, categories.map(category => (index.h("a", { class: "BlogCategoryLink", href: `${homeUrl}/blog/category/${encodeURIComponent(category.slug)}` }, category.name))))), this.showContent && this.renderContentConditionally((_g = this.blogData) === null || _g === void 0 ? void 0 : _g.content)), this.showMoreArticles && (previous || next) && (index.h("nav", { class: "AdjacentPosts", "aria-label": translate('moreArticles', this.language) }, previous && index.h("a", { href: `${homeUrl}/blog/${encodeURIComponent(previous.customPath || previous.slug || '')}`, rel: "prev" }, "\u2190 ", translate('previousArticle', this.language), ": ", previous.title || previous.customPath || previous.slug), next && index.h("a", { href: `${homeUrl}/blog/${encodeURIComponent(next.customPath || next.slug || '')}`, rel: "next" }, translate('nextArticle', this.language), ": ", next.title || next.customPath || next.slug, " \u2192")))))));
|
|
585
|
+
], index.h("span", { "aria-current": "page" }, (_f = this.blogData) === null || _f === void 0 ? void 0 : _f.title))), categories.length > 0 && (index.h("div", { class: "BlogCategoryPills" }, categories.map(category => (index.h("a", { class: "BlogCategoryLink", href: `${homeUrl}/blog/category/${encodeURIComponent(category.slug)}` }, category.name))))), this.showContent && this.renderContentConditionally((_g = this.blogData) === null || _g === void 0 ? void 0 : _g.content)), this.showRelatedArticles && this.relatedPosts.length > 0 && (index.h("nav", { class: "RelatedPosts", "aria-label": translate('relatedArticles', this.language) }, index.h("h2", { class: "RelatedPostsTitle" }, translate('relatedArticles', this.language)), index.h("ul", { class: "RelatedPostsList" }, this.relatedPosts.map(post => (index.h("li", null, index.h("a", { href: `${homeUrl}/blog/${encodeURIComponent(post.customPath || post.slug || '')}` }, post.title || post.customPath || post.slug))))))), this.showMoreArticles && (previous || next) && (index.h("nav", { class: "AdjacentPosts", "aria-label": translate('moreArticles', this.language) }, previous && index.h("a", { href: `${homeUrl}/blog/${encodeURIComponent(previous.customPath || previous.slug || '')}`, rel: "prev" }, "\u2190 ", translate('previousArticle', this.language), ": ", previous.title || previous.customPath || previous.slug), next && index.h("a", { href: `${homeUrl}/blog/${encodeURIComponent(next.customPath || next.slug || '')}`, rel: "next" }, translate('nextArticle', this.language), ": ", next.title || next.customPath || next.slug, " \u2192")))))));
|
|
542
586
|
}
|
|
543
587
|
static get watchers() { return {
|
|
544
588
|
"postId": ["watchEndpoint"],
|
|
@@ -548,6 +592,7 @@ const BlogArticleDetails = class {
|
|
|
548
592
|
"language": ["watchEndpoint"],
|
|
549
593
|
"cmsEnv": ["watchEndpoint"],
|
|
550
594
|
"userRoles": ["watchEndpoint"],
|
|
595
|
+
"showRelatedArticles": ["handleRelatedArticlesChange"],
|
|
551
596
|
"showMoreArticles": ["handleMoreArticlesChange"],
|
|
552
597
|
"clientStyling": ["handleClientStylingChange"],
|
|
553
598
|
"clientStylingUrl": ["handleClientStylingChangeURL"]
|
|
@@ -19,7 +19,7 @@ var patchBrowser = () => {
|
|
|
19
19
|
|
|
20
20
|
patchBrowser().then(async (options) => {
|
|
21
21
|
await appGlobals.globalScripts();
|
|
22
|
-
return index.bootstrapLazy([["blog-article-details.cjs",[[1,"blog-article-details",{"cmsEndpoint":[513,"cms-endpoint"],"language":[513],"userRoles":[513,"user-roles"],"cmsEnv":[513,"cms-env"],"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"showPublishingDate":[516,"show-publishing-date"],"showImage":[516,"show-image"],"showTitle":[516,"show-title"],"showBreadcrumb":[516,"show-breadcrumb"],"hideCategory":[513,"hide-category"],"showContent":[516,"show-content"],"showMoreArticles":[516,"show-more-articles"],"showBackButton":[516,"show-back-button"],"postId":[513,"post-id"],"postSlug":[513,"post-slug"],"postCustomPath":[513,"post-custom-path"],"intlDateTimeFormat":[1,"intl-date-time-format"],"hasErrors":[32],"isLoading":[32],"bannerMatrixReady":[32],"device":[32],"categories":[32],"neighbours":[32]},[[8,"BannerMatrixReady","handleBannerReady"]],{"postId":["watchEndpoint"],"postSlug":["watchEndpoint"],"postCustomPath":["watchEndpoint"],"cmsEndpoint":["watchEndpoint"],"language":["watchEndpoint"],"cmsEnv":["watchEndpoint"],"userRoles":["watchEndpoint"],"showMoreArticles":["handleMoreArticlesChange"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"]}]]]], options);
|
|
22
|
+
return index.bootstrapLazy([["blog-article-details.cjs",[[1,"blog-article-details",{"cmsEndpoint":[513,"cms-endpoint"],"language":[513],"userRoles":[513,"user-roles"],"cmsEnv":[513,"cms-env"],"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"showPublishingDate":[516,"show-publishing-date"],"showImage":[516,"show-image"],"showTitle":[516,"show-title"],"showBreadcrumb":[516,"show-breadcrumb"],"hideCategory":[513,"hide-category"],"showContent":[516,"show-content"],"showMoreArticles":[516,"show-more-articles"],"showRelatedArticles":[516,"show-related-articles"],"showBackButton":[516,"show-back-button"],"postId":[513,"post-id"],"postSlug":[513,"post-slug"],"postCustomPath":[513,"post-custom-path"],"intlDateTimeFormat":[1,"intl-date-time-format"],"hasErrors":[32],"isLoading":[32],"bannerMatrixReady":[32],"device":[32],"categories":[32],"neighbours":[32],"relatedPosts":[32]},[[8,"BannerMatrixReady","handleBannerReady"]],{"postId":["watchEndpoint"],"postSlug":["watchEndpoint"],"postCustomPath":["watchEndpoint"],"cmsEndpoint":["watchEndpoint"],"language":["watchEndpoint"],"cmsEnv":["watchEndpoint"],"userRoles":["watchEndpoint"],"showRelatedArticles":["handleRelatedArticlesChange"],"showMoreArticles":["handleMoreArticlesChange"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"]}]]]], options);
|
|
23
23
|
});
|
|
24
24
|
|
|
25
25
|
exports.setNonce = index.setNonce;
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -8,7 +8,7 @@ const appGlobals = require('./app-globals-3a1e7e63.js');
|
|
|
8
8
|
const defineCustomElements = async (win, options) => {
|
|
9
9
|
if (typeof window === 'undefined') return undefined;
|
|
10
10
|
await appGlobals.globalScripts();
|
|
11
|
-
return index.bootstrapLazy([["blog-article-details.cjs",[[1,"blog-article-details",{"cmsEndpoint":[513,"cms-endpoint"],"language":[513],"userRoles":[513,"user-roles"],"cmsEnv":[513,"cms-env"],"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"showPublishingDate":[516,"show-publishing-date"],"showImage":[516,"show-image"],"showTitle":[516,"show-title"],"showBreadcrumb":[516,"show-breadcrumb"],"hideCategory":[513,"hide-category"],"showContent":[516,"show-content"],"showMoreArticles":[516,"show-more-articles"],"showBackButton":[516,"show-back-button"],"postId":[513,"post-id"],"postSlug":[513,"post-slug"],"postCustomPath":[513,"post-custom-path"],"intlDateTimeFormat":[1,"intl-date-time-format"],"hasErrors":[32],"isLoading":[32],"bannerMatrixReady":[32],"device":[32],"categories":[32],"neighbours":[32]},[[8,"BannerMatrixReady","handleBannerReady"]],{"postId":["watchEndpoint"],"postSlug":["watchEndpoint"],"postCustomPath":["watchEndpoint"],"cmsEndpoint":["watchEndpoint"],"language":["watchEndpoint"],"cmsEnv":["watchEndpoint"],"userRoles":["watchEndpoint"],"showMoreArticles":["handleMoreArticlesChange"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"]}]]]], options);
|
|
11
|
+
return index.bootstrapLazy([["blog-article-details.cjs",[[1,"blog-article-details",{"cmsEndpoint":[513,"cms-endpoint"],"language":[513],"userRoles":[513,"user-roles"],"cmsEnv":[513,"cms-env"],"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"showPublishingDate":[516,"show-publishing-date"],"showImage":[516,"show-image"],"showTitle":[516,"show-title"],"showBreadcrumb":[516,"show-breadcrumb"],"hideCategory":[513,"hide-category"],"showContent":[516,"show-content"],"showMoreArticles":[516,"show-more-articles"],"showRelatedArticles":[516,"show-related-articles"],"showBackButton":[516,"show-back-button"],"postId":[513,"post-id"],"postSlug":[513,"post-slug"],"postCustomPath":[513,"post-custom-path"],"intlDateTimeFormat":[1,"intl-date-time-format"],"hasErrors":[32],"isLoading":[32],"bannerMatrixReady":[32],"device":[32],"categories":[32],"neighbours":[32],"relatedPosts":[32]},[[8,"BannerMatrixReady","handleBannerReady"]],{"postId":["watchEndpoint"],"postSlug":["watchEndpoint"],"postCustomPath":["watchEndpoint"],"cmsEndpoint":["watchEndpoint"],"language":["watchEndpoint"],"cmsEnv":["watchEndpoint"],"userRoles":["watchEndpoint"],"showRelatedArticles":["handleRelatedArticlesChange"],"showMoreArticles":["handleMoreArticlesChange"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"]}]]]], options);
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
exports.setNonce = index.setNonce;
|
|
@@ -119,7 +119,28 @@
|
|
|
119
119
|
.AdjacentPosts a {
|
|
120
120
|
flex: 1 1 250px;
|
|
121
121
|
}
|
|
122
|
+
.AdjacentPosts a[rel=next] {
|
|
123
|
+
margin-left: auto;
|
|
124
|
+
text-align: right;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.RelatedPosts {
|
|
128
|
+
padding: 30px 30px 0;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.RelatedPostsTitle {
|
|
132
|
+
margin: 0 0 12px;
|
|
133
|
+
font-size: 1.25em;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.RelatedPostsList {
|
|
137
|
+
display: grid;
|
|
138
|
+
gap: 8px;
|
|
139
|
+
margin: 0;
|
|
140
|
+
padding-left: 20px;
|
|
141
|
+
}
|
|
122
142
|
|
|
143
|
+
.RelatedPosts a,
|
|
123
144
|
.AdjacentPosts a {
|
|
124
145
|
color: var(--emw--color-primary, #fff);
|
|
125
146
|
font: inherit;
|
|
@@ -127,6 +148,7 @@
|
|
|
127
148
|
}
|
|
128
149
|
|
|
129
150
|
.BackButton:focus-visible,
|
|
151
|
+
.RelatedPosts a:focus-visible,
|
|
130
152
|
.AdjacentPosts a:focus-visible {
|
|
131
153
|
outline: 2px solid var(--emw--color-primary, #fff);
|
|
132
154
|
outline-offset: 3px;
|
|
@@ -29,6 +29,7 @@ export class BlogArticleDetails {
|
|
|
29
29
|
this.hideCategory = '';
|
|
30
30
|
this.showContent = true;
|
|
31
31
|
this.showMoreArticles = false;
|
|
32
|
+
this.showRelatedArticles = false;
|
|
32
33
|
this.showBackButton = false;
|
|
33
34
|
this.postId = undefined;
|
|
34
35
|
this.postSlug = undefined;
|
|
@@ -40,6 +41,7 @@ export class BlogArticleDetails {
|
|
|
40
41
|
this.device = 'mobile';
|
|
41
42
|
this.categories = [];
|
|
42
43
|
this.neighbours = {};
|
|
44
|
+
this.relatedPosts = [];
|
|
43
45
|
}
|
|
44
46
|
// Rerender when bannermatrix has finished loaded. Issue when bannermatrix passed as content from CMS.
|
|
45
47
|
handleBannerReady() {
|
|
@@ -55,8 +57,14 @@ export class BlogArticleDetails {
|
|
|
55
57
|
this.articleRequest++;
|
|
56
58
|
this.categories = [];
|
|
57
59
|
this.neighbours = {};
|
|
60
|
+
this.relatedPosts = [];
|
|
58
61
|
}
|
|
59
62
|
}
|
|
63
|
+
handleRelatedArticlesChange() {
|
|
64
|
+
this.relatedPosts = [];
|
|
65
|
+
if (this.showRelatedArticles && !this.isLoading && this.blogData)
|
|
66
|
+
this.fetchRelatedArticles(this.articleRequest);
|
|
67
|
+
}
|
|
60
68
|
handleMoreArticlesChange() {
|
|
61
69
|
this.neighboursRequest++;
|
|
62
70
|
this.neighbours = {};
|
|
@@ -126,6 +134,8 @@ export class BlogArticleDetails {
|
|
|
126
134
|
;
|
|
127
135
|
if (this.showMoreArticles)
|
|
128
136
|
this.fetchMoreArticles(request);
|
|
137
|
+
if (this.showRelatedArticles)
|
|
138
|
+
this.fetchRelatedArticles(request);
|
|
129
139
|
})
|
|
130
140
|
.catch((err) => {
|
|
131
141
|
if (request !== this.articleRequest)
|
|
@@ -176,6 +186,33 @@ export class BlogArticleDetails {
|
|
|
176
186
|
console.error('Error fetching adjacent articles', error);
|
|
177
187
|
}
|
|
178
188
|
}
|
|
189
|
+
async fetchRelatedArticles(articleRequest) {
|
|
190
|
+
var _a, _b;
|
|
191
|
+
const category = (_b = (_a = this.blogData) === null || _a === void 0 ? void 0 : _a.blogCategory) === null || _b === void 0 ? void 0 : _b[0];
|
|
192
|
+
if (!this.cmsEndpoint || !this.language || !category)
|
|
193
|
+
return;
|
|
194
|
+
const currentId = this.blogData.postID;
|
|
195
|
+
const url = new URL(`${this.cmsEndpoint}/${this.language}/blog-posts`);
|
|
196
|
+
url.searchParams.set('category', category);
|
|
197
|
+
url.searchParams.set('per_page', '5');
|
|
198
|
+
url.searchParams.set('env', this.cmsEnv);
|
|
199
|
+
url.searchParams.set('userRoles', this.userRoles);
|
|
200
|
+
url.searchParams.set('device', getDevicePlatform());
|
|
201
|
+
try {
|
|
202
|
+
const response = await fetch(url.href);
|
|
203
|
+
if (!response.ok)
|
|
204
|
+
throw new Error('Failed to fetch related articles');
|
|
205
|
+
const data = await response.json();
|
|
206
|
+
if (!this.showRelatedArticles || articleRequest !== this.articleRequest || !Array.isArray(data === null || data === void 0 ? void 0 : data.items))
|
|
207
|
+
return;
|
|
208
|
+
this.relatedPosts = data.items
|
|
209
|
+
.filter(post => post.postID !== currentId && (post.customPath || post.slug))
|
|
210
|
+
.slice(0, 4);
|
|
211
|
+
}
|
|
212
|
+
catch (error) {
|
|
213
|
+
console.error('Error fetching related articles', error);
|
|
214
|
+
}
|
|
215
|
+
}
|
|
179
216
|
async fetchCategories(request) {
|
|
180
217
|
try {
|
|
181
218
|
const response = await fetch(`${this.cmsEndpoint}/${this.language}/blog-posts/category`);
|
|
@@ -257,7 +294,7 @@ export class BlogArticleDetails {
|
|
|
257
294
|
h("div", { class: "BlogTitle" }, (_e = this.blogData) === null || _e === void 0 ? void 0 : _e.title), this.showBreadcrumb && (h("nav", { class: "breadcrumb", "aria-label": "Breadcrumb" }, h("a", { href: homeUrl }, translate('home', this.language)), h("span", { "aria-hidden": "true" }, "\u203A"), h("a", { href: `${homeUrl}/blog` }, translate('blog', this.language)), h("span", { "aria-hidden": "true" }, "\u203A"), primaryCategory && [
|
|
258
295
|
h("a", { href: `${homeUrl}/blog/category/${encodeURIComponent(primaryCategory.slug)}` }, primaryCategory.name),
|
|
259
296
|
h("span", { "aria-hidden": "true" }, "\u203A"),
|
|
260
|
-
], h("span", { "aria-current": "page" }, (_f = this.blogData) === null || _f === void 0 ? void 0 : _f.title))), categories.length > 0 && (h("div", { class: "BlogCategoryPills" }, categories.map(category => (h("a", { class: "BlogCategoryLink", href: `${homeUrl}/blog/category/${encodeURIComponent(category.slug)}` }, category.name))))), this.showContent && this.renderContentConditionally((_g = this.blogData) === null || _g === void 0 ? void 0 : _g.content)), this.showMoreArticles && (previous || next) && (h("nav", { class: "AdjacentPosts", "aria-label": translate('moreArticles', this.language) }, previous && h("a", { href: `${homeUrl}/blog/${encodeURIComponent(previous.customPath || previous.slug || '')}`, rel: "prev" }, "\u2190 ", translate('previousArticle', this.language), ": ", previous.title || previous.customPath || previous.slug), next && h("a", { href: `${homeUrl}/blog/${encodeURIComponent(next.customPath || next.slug || '')}`, rel: "next" }, translate('nextArticle', this.language), ": ", next.title || next.customPath || next.slug, " \u2192")))))));
|
|
297
|
+
], h("span", { "aria-current": "page" }, (_f = this.blogData) === null || _f === void 0 ? void 0 : _f.title))), categories.length > 0 && (h("div", { class: "BlogCategoryPills" }, categories.map(category => (h("a", { class: "BlogCategoryLink", href: `${homeUrl}/blog/category/${encodeURIComponent(category.slug)}` }, category.name))))), this.showContent && this.renderContentConditionally((_g = this.blogData) === null || _g === void 0 ? void 0 : _g.content)), this.showRelatedArticles && this.relatedPosts.length > 0 && (h("nav", { class: "RelatedPosts", "aria-label": translate('relatedArticles', this.language) }, h("h2", { class: "RelatedPostsTitle" }, translate('relatedArticles', this.language)), h("ul", { class: "RelatedPostsList" }, this.relatedPosts.map(post => (h("li", null, h("a", { href: `${homeUrl}/blog/${encodeURIComponent(post.customPath || post.slug || '')}` }, post.title || post.customPath || post.slug))))))), this.showMoreArticles && (previous || next) && (h("nav", { class: "AdjacentPosts", "aria-label": translate('moreArticles', this.language) }, previous && h("a", { href: `${homeUrl}/blog/${encodeURIComponent(previous.customPath || previous.slug || '')}`, rel: "prev" }, "\u2190 ", translate('previousArticle', this.language), ": ", previous.title || previous.customPath || previous.slug), next && h("a", { href: `${homeUrl}/blog/${encodeURIComponent(next.customPath || next.slug || '')}`, rel: "next" }, translate('nextArticle', this.language), ": ", next.title || next.customPath || next.slug, " \u2192")))))));
|
|
261
298
|
}
|
|
262
299
|
static get is() { return "blog-article-details"; }
|
|
263
300
|
static get encapsulation() { return "shadow"; }
|
|
@@ -523,6 +560,24 @@ export class BlogArticleDetails {
|
|
|
523
560
|
"reflect": true,
|
|
524
561
|
"defaultValue": "false"
|
|
525
562
|
},
|
|
563
|
+
"showRelatedArticles": {
|
|
564
|
+
"type": "boolean",
|
|
565
|
+
"mutable": false,
|
|
566
|
+
"complexType": {
|
|
567
|
+
"original": "boolean",
|
|
568
|
+
"resolved": "boolean",
|
|
569
|
+
"references": {}
|
|
570
|
+
},
|
|
571
|
+
"required": false,
|
|
572
|
+
"optional": false,
|
|
573
|
+
"docs": {
|
|
574
|
+
"tags": [],
|
|
575
|
+
"text": "Display up to four other articles from the same category."
|
|
576
|
+
},
|
|
577
|
+
"attribute": "show-related-articles",
|
|
578
|
+
"reflect": true,
|
|
579
|
+
"defaultValue": "false"
|
|
580
|
+
},
|
|
526
581
|
"showBackButton": {
|
|
527
582
|
"type": "boolean",
|
|
528
583
|
"mutable": false,
|
|
@@ -619,7 +674,8 @@ export class BlogArticleDetails {
|
|
|
619
674
|
"bannerMatrixReady": {},
|
|
620
675
|
"device": {},
|
|
621
676
|
"categories": {},
|
|
622
|
-
"neighbours": {}
|
|
677
|
+
"neighbours": {},
|
|
678
|
+
"relatedPosts": {}
|
|
623
679
|
};
|
|
624
680
|
}
|
|
625
681
|
static get watchers() {
|
|
@@ -644,6 +700,9 @@ export class BlogArticleDetails {
|
|
|
644
700
|
}, {
|
|
645
701
|
"propName": "userRoles",
|
|
646
702
|
"methodName": "watchEndpoint"
|
|
703
|
+
}, {
|
|
704
|
+
"propName": "showRelatedArticles",
|
|
705
|
+
"methodName": "handleRelatedArticlesChange"
|
|
647
706
|
}, {
|
|
648
707
|
"propName": "showMoreArticles",
|
|
649
708
|
"methodName": "handleMoreArticlesChange"
|
|
@@ -6,6 +6,7 @@ const TRANSLATIONS = {
|
|
|
6
6
|
blog: 'Blog',
|
|
7
7
|
backToBlog: 'Back to blog',
|
|
8
8
|
moreArticles: 'More articles',
|
|
9
|
+
relatedArticles: 'Related articles',
|
|
9
10
|
previousArticle: 'Previous article',
|
|
10
11
|
nextArticle: 'Next article',
|
|
11
12
|
},
|
|
@@ -15,6 +16,7 @@ const TRANSLATIONS = {
|
|
|
15
16
|
blog: 'Blog',
|
|
16
17
|
backToBlog: 'Back to blog',
|
|
17
18
|
moreArticles: 'More articles',
|
|
19
|
+
relatedArticles: 'Related articles',
|
|
18
20
|
previousArticle: 'Previous article',
|
|
19
21
|
nextArticle: 'Next article',
|
|
20
22
|
},
|
|
@@ -24,6 +26,7 @@ const TRANSLATIONS = {
|
|
|
24
26
|
blog: 'Blog',
|
|
25
27
|
backToBlog: 'Back to blog',
|
|
26
28
|
moreArticles: 'More articles',
|
|
29
|
+
relatedArticles: 'Related articles',
|
|
27
30
|
previousArticle: 'Previous article',
|
|
28
31
|
nextArticle: 'Next article',
|
|
29
32
|
},
|
|
@@ -33,6 +36,7 @@ const TRANSLATIONS = {
|
|
|
33
36
|
blog: 'Blog',
|
|
34
37
|
backToBlog: 'Back to blog',
|
|
35
38
|
moreArticles: 'More articles',
|
|
39
|
+
relatedArticles: 'Related articles',
|
|
36
40
|
previousArticle: 'Previous article',
|
|
37
41
|
nextArticle: 'Next article',
|
|
38
42
|
},
|
|
@@ -42,6 +46,7 @@ const TRANSLATIONS = {
|
|
|
42
46
|
blog: 'Blog',
|
|
43
47
|
backToBlog: 'Back to blog',
|
|
44
48
|
moreArticles: 'More articles',
|
|
49
|
+
relatedArticles: 'Related articles',
|
|
45
50
|
previousArticle: 'Previous article',
|
|
46
51
|
nextArticle: 'Next article',
|
|
47
52
|
},
|
|
@@ -51,6 +56,7 @@ const TRANSLATIONS = {
|
|
|
51
56
|
blog: 'Blog',
|
|
52
57
|
backToBlog: 'Back to blog',
|
|
53
58
|
moreArticles: 'More articles',
|
|
59
|
+
relatedArticles: 'Related articles',
|
|
54
60
|
previousArticle: 'Previous article',
|
|
55
61
|
nextArticle: 'Next article',
|
|
56
62
|
},
|
|
@@ -60,6 +66,7 @@ const TRANSLATIONS = {
|
|
|
60
66
|
blog: 'Blog',
|
|
61
67
|
backToBlog: 'Back to blog',
|
|
62
68
|
moreArticles: 'More articles',
|
|
69
|
+
relatedArticles: 'Related articles',
|
|
63
70
|
previousArticle: 'Previous article',
|
|
64
71
|
nextArticle: 'Next article',
|
|
65
72
|
}
|
|
@@ -8,6 +8,7 @@ const TRANSLATIONS = {
|
|
|
8
8
|
blog: 'Blog',
|
|
9
9
|
backToBlog: 'Back to blog',
|
|
10
10
|
moreArticles: 'More articles',
|
|
11
|
+
relatedArticles: 'Related articles',
|
|
11
12
|
previousArticle: 'Previous article',
|
|
12
13
|
nextArticle: 'Next article',
|
|
13
14
|
},
|
|
@@ -17,6 +18,7 @@ const TRANSLATIONS = {
|
|
|
17
18
|
blog: 'Blog',
|
|
18
19
|
backToBlog: 'Back to blog',
|
|
19
20
|
moreArticles: 'More articles',
|
|
21
|
+
relatedArticles: 'Related articles',
|
|
20
22
|
previousArticle: 'Previous article',
|
|
21
23
|
nextArticle: 'Next article',
|
|
22
24
|
},
|
|
@@ -26,6 +28,7 @@ const TRANSLATIONS = {
|
|
|
26
28
|
blog: 'Blog',
|
|
27
29
|
backToBlog: 'Back to blog',
|
|
28
30
|
moreArticles: 'More articles',
|
|
31
|
+
relatedArticles: 'Related articles',
|
|
29
32
|
previousArticle: 'Previous article',
|
|
30
33
|
nextArticle: 'Next article',
|
|
31
34
|
},
|
|
@@ -35,6 +38,7 @@ const TRANSLATIONS = {
|
|
|
35
38
|
blog: 'Blog',
|
|
36
39
|
backToBlog: 'Back to blog',
|
|
37
40
|
moreArticles: 'More articles',
|
|
41
|
+
relatedArticles: 'Related articles',
|
|
38
42
|
previousArticle: 'Previous article',
|
|
39
43
|
nextArticle: 'Next article',
|
|
40
44
|
},
|
|
@@ -44,6 +48,7 @@ const TRANSLATIONS = {
|
|
|
44
48
|
blog: 'Blog',
|
|
45
49
|
backToBlog: 'Back to blog',
|
|
46
50
|
moreArticles: 'More articles',
|
|
51
|
+
relatedArticles: 'Related articles',
|
|
47
52
|
previousArticle: 'Previous article',
|
|
48
53
|
nextArticle: 'Next article',
|
|
49
54
|
},
|
|
@@ -53,6 +58,7 @@ const TRANSLATIONS = {
|
|
|
53
58
|
blog: 'Blog',
|
|
54
59
|
backToBlog: 'Back to blog',
|
|
55
60
|
moreArticles: 'More articles',
|
|
61
|
+
relatedArticles: 'Related articles',
|
|
56
62
|
previousArticle: 'Previous article',
|
|
57
63
|
nextArticle: 'Next article',
|
|
58
64
|
},
|
|
@@ -62,6 +68,7 @@ const TRANSLATIONS = {
|
|
|
62
68
|
blog: 'Blog',
|
|
63
69
|
backToBlog: 'Back to blog',
|
|
64
70
|
moreArticles: 'More articles',
|
|
71
|
+
relatedArticles: 'Related articles',
|
|
65
72
|
previousArticle: 'Previous article',
|
|
66
73
|
nextArticle: 'Next article',
|
|
67
74
|
}
|
|
@@ -276,7 +283,7 @@ const getDevicePlatform = () => {
|
|
|
276
283
|
return 'mtWeb';
|
|
277
284
|
};
|
|
278
285
|
|
|
279
|
-
const blogArticleDetailsCss = ":host {\n display: block;\n}\n\n.breadcrumb {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 0.5rem;\n max-width: 1300px;\n margin-bottom: 30px;\n}\n.breadcrumb a {\n color: inherit;\n}\n\n.DetailsContainer {\n background-color: #07072A;\n position: relative;\n color: #fff;\n display: flex;\n flex-direction: column;\n}\n.DetailsContainer .BlogBanner img {\n display: block;\n width: 100%;\n height: 400px;\n object-fit: cover;\n}\n.DetailsContainer .DetailsHeadWrapper {\n position: relative;\n}\n.DetailsContainer .DetailsBodyWrapper {\n padding: 30px;\n}\n.DetailsContainer .BlogDate {\n font-size: 12px;\n border-radius: 5px 5px 0 0;\n padding: 10px;\n width: fit-content;\n text-align: center;\n background-color: #0D0D4D;\n z-index: 1;\n text-wrap: nowrap;\n position: absolute;\n bottom: 0;\n left: 30px;\n}\n.DetailsContainer .BlogTitle {\n font-size: 24px;\n}\n.DetailsContainer .BlogCategoryPills {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n}\n.DetailsContainer .BlogCategoryLink {\n position: relative;\n z-index: 3;\n padding: 4px 12px;\n border: 1px solid currentColor;\n border-radius: 999px;\n color: inherit;\n font-size: 12px;\n text-decoration: none;\n}\n.DetailsContainer .BlogContent {\n font-size: 14px;\n}\n.DetailsContainer .BlogContent p:last-child {\n margin-bottom: 0;\n}\n\n.BackButton {\n position: absolute;\n top: 30px;\n left: 30px;\n z-index: 2;\n display: inline-flex;\n justify-content: center;\n align-items: center;\n box-sizing: border-box;\n min-width: 100px;\n height: 32px;\n padding: 0 12px;\n border: none;\n border-radius: 5px;\n background: var(--emw--color-primary, #524e52);\n color: var(--emw--color-typography-contrast, #fff);\n font: inherit;\n text-decoration: none;\n text-align: center;\n white-space: nowrap;\n cursor: pointer;\n transition: all 0.1s linear;\n}\n\n.DetailsContainer:not(:has(.BlogBanner img, .BlogBanner video)) .BackButton {\n position: static;\n align-self: flex-start;\n margin: 30px 30px 16px;\n}\n.DetailsContainer:not(:has(.BlogBanner img, .BlogBanner video)) .BlogDate {\n position: static;\n display: block;\n margin-left: 30px;\n}\n.DetailsContainer:not(:has(.BlogBanner img, .BlogBanner video)) .BlogBanner {\n display: none;\n}\n\n.AdjacentPosts {\n display: flex;\n flex-wrap: wrap;\n justify-content: space-between;\n gap: 20px;\n padding: 30px;\n}\n.AdjacentPosts a {\n flex: 1 1 250px;\n}\n\n.AdjacentPosts a {\n color: var(--emw--color-primary, #fff);\n font: inherit;\n text-decoration: underline;\n}\n\n.BackButton:focus-visible,\n.AdjacentPosts a:focus-visible {\n outline: 2px solid var(--emw--color-primary, #fff);\n outline-offset: 3px;\n}\n\n@container (max-width: 475px) {\n .DetailsContainer {\n font-size: 12px;\n }\n}";
|
|
286
|
+
const blogArticleDetailsCss = ":host {\n display: block;\n}\n\n.breadcrumb {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n gap: 0.5rem;\n max-width: 1300px;\n margin-bottom: 30px;\n}\n.breadcrumb a {\n color: inherit;\n}\n\n.DetailsContainer {\n background-color: #07072A;\n position: relative;\n color: #fff;\n display: flex;\n flex-direction: column;\n}\n.DetailsContainer .BlogBanner img {\n display: block;\n width: 100%;\n height: 400px;\n object-fit: cover;\n}\n.DetailsContainer .DetailsHeadWrapper {\n position: relative;\n}\n.DetailsContainer .DetailsBodyWrapper {\n padding: 30px;\n}\n.DetailsContainer .BlogDate {\n font-size: 12px;\n border-radius: 5px 5px 0 0;\n padding: 10px;\n width: fit-content;\n text-align: center;\n background-color: #0D0D4D;\n z-index: 1;\n text-wrap: nowrap;\n position: absolute;\n bottom: 0;\n left: 30px;\n}\n.DetailsContainer .BlogTitle {\n font-size: 24px;\n}\n.DetailsContainer .BlogCategoryPills {\n display: flex;\n flex-wrap: wrap;\n gap: 8px;\n}\n.DetailsContainer .BlogCategoryLink {\n position: relative;\n z-index: 3;\n padding: 4px 12px;\n border: 1px solid currentColor;\n border-radius: 999px;\n color: inherit;\n font-size: 12px;\n text-decoration: none;\n}\n.DetailsContainer .BlogContent {\n font-size: 14px;\n}\n.DetailsContainer .BlogContent p:last-child {\n margin-bottom: 0;\n}\n\n.BackButton {\n position: absolute;\n top: 30px;\n left: 30px;\n z-index: 2;\n display: inline-flex;\n justify-content: center;\n align-items: center;\n box-sizing: border-box;\n min-width: 100px;\n height: 32px;\n padding: 0 12px;\n border: none;\n border-radius: 5px;\n background: var(--emw--color-primary, #524e52);\n color: var(--emw--color-typography-contrast, #fff);\n font: inherit;\n text-decoration: none;\n text-align: center;\n white-space: nowrap;\n cursor: pointer;\n transition: all 0.1s linear;\n}\n\n.DetailsContainer:not(:has(.BlogBanner img, .BlogBanner video)) .BackButton {\n position: static;\n align-self: flex-start;\n margin: 30px 30px 16px;\n}\n.DetailsContainer:not(:has(.BlogBanner img, .BlogBanner video)) .BlogDate {\n position: static;\n display: block;\n margin-left: 30px;\n}\n.DetailsContainer:not(:has(.BlogBanner img, .BlogBanner video)) .BlogBanner {\n display: none;\n}\n\n.AdjacentPosts {\n display: flex;\n flex-wrap: wrap;\n justify-content: space-between;\n gap: 20px;\n padding: 30px;\n}\n.AdjacentPosts a {\n flex: 1 1 250px;\n}\n.AdjacentPosts a[rel=next] {\n margin-left: auto;\n text-align: right;\n}\n\n.RelatedPosts {\n padding: 30px 30px 0;\n}\n\n.RelatedPostsTitle {\n margin: 0 0 12px;\n font-size: 1.25em;\n}\n\n.RelatedPostsList {\n display: grid;\n gap: 8px;\n margin: 0;\n padding-left: 20px;\n}\n\n.RelatedPosts a,\n.AdjacentPosts a {\n color: var(--emw--color-primary, #fff);\n font: inherit;\n text-decoration: underline;\n}\n\n.BackButton:focus-visible,\n.RelatedPosts a:focus-visible,\n.AdjacentPosts a:focus-visible {\n outline: 2px solid var(--emw--color-primary, #fff);\n outline-offset: 3px;\n}\n\n@container (max-width: 475px) {\n .DetailsContainer {\n font-size: 12px;\n }\n}";
|
|
280
287
|
const BlogArticleDetailsStyle0 = blogArticleDetailsCss;
|
|
281
288
|
|
|
282
289
|
const BlogArticleDetails = class {
|
|
@@ -307,6 +314,7 @@ const BlogArticleDetails = class {
|
|
|
307
314
|
this.hideCategory = '';
|
|
308
315
|
this.showContent = true;
|
|
309
316
|
this.showMoreArticles = false;
|
|
317
|
+
this.showRelatedArticles = false;
|
|
310
318
|
this.showBackButton = false;
|
|
311
319
|
this.postId = undefined;
|
|
312
320
|
this.postSlug = undefined;
|
|
@@ -318,6 +326,7 @@ const BlogArticleDetails = class {
|
|
|
318
326
|
this.device = 'mobile';
|
|
319
327
|
this.categories = [];
|
|
320
328
|
this.neighbours = {};
|
|
329
|
+
this.relatedPosts = [];
|
|
321
330
|
}
|
|
322
331
|
// Rerender when bannermatrix has finished loaded. Issue when bannermatrix passed as content from CMS.
|
|
323
332
|
handleBannerReady() {
|
|
@@ -333,8 +342,14 @@ const BlogArticleDetails = class {
|
|
|
333
342
|
this.articleRequest++;
|
|
334
343
|
this.categories = [];
|
|
335
344
|
this.neighbours = {};
|
|
345
|
+
this.relatedPosts = [];
|
|
336
346
|
}
|
|
337
347
|
}
|
|
348
|
+
handleRelatedArticlesChange() {
|
|
349
|
+
this.relatedPosts = [];
|
|
350
|
+
if (this.showRelatedArticles && !this.isLoading && this.blogData)
|
|
351
|
+
this.fetchRelatedArticles(this.articleRequest);
|
|
352
|
+
}
|
|
338
353
|
handleMoreArticlesChange() {
|
|
339
354
|
this.neighboursRequest++;
|
|
340
355
|
this.neighbours = {};
|
|
@@ -403,6 +418,8 @@ const BlogArticleDetails = class {
|
|
|
403
418
|
}
|
|
404
419
|
if (this.showMoreArticles)
|
|
405
420
|
this.fetchMoreArticles(request);
|
|
421
|
+
if (this.showRelatedArticles)
|
|
422
|
+
this.fetchRelatedArticles(request);
|
|
406
423
|
})
|
|
407
424
|
.catch((err) => {
|
|
408
425
|
if (request !== this.articleRequest)
|
|
@@ -453,6 +470,33 @@ const BlogArticleDetails = class {
|
|
|
453
470
|
console.error('Error fetching adjacent articles', error);
|
|
454
471
|
}
|
|
455
472
|
}
|
|
473
|
+
async fetchRelatedArticles(articleRequest) {
|
|
474
|
+
var _a, _b;
|
|
475
|
+
const category = (_b = (_a = this.blogData) === null || _a === void 0 ? void 0 : _a.blogCategory) === null || _b === void 0 ? void 0 : _b[0];
|
|
476
|
+
if (!this.cmsEndpoint || !this.language || !category)
|
|
477
|
+
return;
|
|
478
|
+
const currentId = this.blogData.postID;
|
|
479
|
+
const url = new URL(`${this.cmsEndpoint}/${this.language}/blog-posts`);
|
|
480
|
+
url.searchParams.set('category', category);
|
|
481
|
+
url.searchParams.set('per_page', '5');
|
|
482
|
+
url.searchParams.set('env', this.cmsEnv);
|
|
483
|
+
url.searchParams.set('userRoles', this.userRoles);
|
|
484
|
+
url.searchParams.set('device', getDevicePlatform());
|
|
485
|
+
try {
|
|
486
|
+
const response = await fetch(url.href);
|
|
487
|
+
if (!response.ok)
|
|
488
|
+
throw new Error('Failed to fetch related articles');
|
|
489
|
+
const data = await response.json();
|
|
490
|
+
if (!this.showRelatedArticles || articleRequest !== this.articleRequest || !Array.isArray(data === null || data === void 0 ? void 0 : data.items))
|
|
491
|
+
return;
|
|
492
|
+
this.relatedPosts = data.items
|
|
493
|
+
.filter(post => post.postID !== currentId && (post.customPath || post.slug))
|
|
494
|
+
.slice(0, 4);
|
|
495
|
+
}
|
|
496
|
+
catch (error) {
|
|
497
|
+
console.error('Error fetching related articles', error);
|
|
498
|
+
}
|
|
499
|
+
}
|
|
456
500
|
async fetchCategories(request) {
|
|
457
501
|
try {
|
|
458
502
|
const response = await fetch(`${this.cmsEndpoint}/${this.language}/blog-posts/category`);
|
|
@@ -534,7 +578,7 @@ const BlogArticleDetails = class {
|
|
|
534
578
|
h("div", { class: "BlogTitle" }, (_e = this.blogData) === null || _e === void 0 ? void 0 : _e.title), this.showBreadcrumb && (h("nav", { class: "breadcrumb", "aria-label": "Breadcrumb" }, h("a", { href: homeUrl }, translate('home', this.language)), h("span", { "aria-hidden": "true" }, "\u203A"), h("a", { href: `${homeUrl}/blog` }, translate('blog', this.language)), h("span", { "aria-hidden": "true" }, "\u203A"), primaryCategory && [
|
|
535
579
|
h("a", { href: `${homeUrl}/blog/category/${encodeURIComponent(primaryCategory.slug)}` }, primaryCategory.name),
|
|
536
580
|
h("span", { "aria-hidden": "true" }, "\u203A"),
|
|
537
|
-
], h("span", { "aria-current": "page" }, (_f = this.blogData) === null || _f === void 0 ? void 0 : _f.title))), categories.length > 0 && (h("div", { class: "BlogCategoryPills" }, categories.map(category => (h("a", { class: "BlogCategoryLink", href: `${homeUrl}/blog/category/${encodeURIComponent(category.slug)}` }, category.name))))), this.showContent && this.renderContentConditionally((_g = this.blogData) === null || _g === void 0 ? void 0 : _g.content)), this.showMoreArticles && (previous || next) && (h("nav", { class: "AdjacentPosts", "aria-label": translate('moreArticles', this.language) }, previous && h("a", { href: `${homeUrl}/blog/${encodeURIComponent(previous.customPath || previous.slug || '')}`, rel: "prev" }, "\u2190 ", translate('previousArticle', this.language), ": ", previous.title || previous.customPath || previous.slug), next && h("a", { href: `${homeUrl}/blog/${encodeURIComponent(next.customPath || next.slug || '')}`, rel: "next" }, translate('nextArticle', this.language), ": ", next.title || next.customPath || next.slug, " \u2192")))))));
|
|
581
|
+
], h("span", { "aria-current": "page" }, (_f = this.blogData) === null || _f === void 0 ? void 0 : _f.title))), categories.length > 0 && (h("div", { class: "BlogCategoryPills" }, categories.map(category => (h("a", { class: "BlogCategoryLink", href: `${homeUrl}/blog/category/${encodeURIComponent(category.slug)}` }, category.name))))), this.showContent && this.renderContentConditionally((_g = this.blogData) === null || _g === void 0 ? void 0 : _g.content)), this.showRelatedArticles && this.relatedPosts.length > 0 && (h("nav", { class: "RelatedPosts", "aria-label": translate('relatedArticles', this.language) }, h("h2", { class: "RelatedPostsTitle" }, translate('relatedArticles', this.language)), h("ul", { class: "RelatedPostsList" }, this.relatedPosts.map(post => (h("li", null, h("a", { href: `${homeUrl}/blog/${encodeURIComponent(post.customPath || post.slug || '')}` }, post.title || post.customPath || post.slug))))))), this.showMoreArticles && (previous || next) && (h("nav", { class: "AdjacentPosts", "aria-label": translate('moreArticles', this.language) }, previous && h("a", { href: `${homeUrl}/blog/${encodeURIComponent(previous.customPath || previous.slug || '')}`, rel: "prev" }, "\u2190 ", translate('previousArticle', this.language), ": ", previous.title || previous.customPath || previous.slug), next && h("a", { href: `${homeUrl}/blog/${encodeURIComponent(next.customPath || next.slug || '')}`, rel: "next" }, translate('nextArticle', this.language), ": ", next.title || next.customPath || next.slug, " \u2192")))))));
|
|
538
582
|
}
|
|
539
583
|
static get watchers() { return {
|
|
540
584
|
"postId": ["watchEndpoint"],
|
|
@@ -544,6 +588,7 @@ const BlogArticleDetails = class {
|
|
|
544
588
|
"language": ["watchEndpoint"],
|
|
545
589
|
"cmsEnv": ["watchEndpoint"],
|
|
546
590
|
"userRoles": ["watchEndpoint"],
|
|
591
|
+
"showRelatedArticles": ["handleRelatedArticlesChange"],
|
|
547
592
|
"showMoreArticles": ["handleMoreArticlesChange"],
|
|
548
593
|
"clientStyling": ["handleClientStylingChange"],
|
|
549
594
|
"clientStylingUrl": ["handleClientStylingChangeURL"]
|
|
@@ -16,5 +16,5 @@ var patchBrowser = () => {
|
|
|
16
16
|
|
|
17
17
|
patchBrowser().then(async (options) => {
|
|
18
18
|
await globalScripts();
|
|
19
|
-
return bootstrapLazy([["blog-article-details",[[1,"blog-article-details",{"cmsEndpoint":[513,"cms-endpoint"],"language":[513],"userRoles":[513,"user-roles"],"cmsEnv":[513,"cms-env"],"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"showPublishingDate":[516,"show-publishing-date"],"showImage":[516,"show-image"],"showTitle":[516,"show-title"],"showBreadcrumb":[516,"show-breadcrumb"],"hideCategory":[513,"hide-category"],"showContent":[516,"show-content"],"showMoreArticles":[516,"show-more-articles"],"showBackButton":[516,"show-back-button"],"postId":[513,"post-id"],"postSlug":[513,"post-slug"],"postCustomPath":[513,"post-custom-path"],"intlDateTimeFormat":[1,"intl-date-time-format"],"hasErrors":[32],"isLoading":[32],"bannerMatrixReady":[32],"device":[32],"categories":[32],"neighbours":[32]},[[8,"BannerMatrixReady","handleBannerReady"]],{"postId":["watchEndpoint"],"postSlug":["watchEndpoint"],"postCustomPath":["watchEndpoint"],"cmsEndpoint":["watchEndpoint"],"language":["watchEndpoint"],"cmsEnv":["watchEndpoint"],"userRoles":["watchEndpoint"],"showMoreArticles":["handleMoreArticlesChange"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"]}]]]], options);
|
|
19
|
+
return bootstrapLazy([["blog-article-details",[[1,"blog-article-details",{"cmsEndpoint":[513,"cms-endpoint"],"language":[513],"userRoles":[513,"user-roles"],"cmsEnv":[513,"cms-env"],"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"showPublishingDate":[516,"show-publishing-date"],"showImage":[516,"show-image"],"showTitle":[516,"show-title"],"showBreadcrumb":[516,"show-breadcrumb"],"hideCategory":[513,"hide-category"],"showContent":[516,"show-content"],"showMoreArticles":[516,"show-more-articles"],"showRelatedArticles":[516,"show-related-articles"],"showBackButton":[516,"show-back-button"],"postId":[513,"post-id"],"postSlug":[513,"post-slug"],"postCustomPath":[513,"post-custom-path"],"intlDateTimeFormat":[1,"intl-date-time-format"],"hasErrors":[32],"isLoading":[32],"bannerMatrixReady":[32],"device":[32],"categories":[32],"neighbours":[32],"relatedPosts":[32]},[[8,"BannerMatrixReady","handleBannerReady"]],{"postId":["watchEndpoint"],"postSlug":["watchEndpoint"],"postCustomPath":["watchEndpoint"],"cmsEndpoint":["watchEndpoint"],"language":["watchEndpoint"],"cmsEnv":["watchEndpoint"],"userRoles":["watchEndpoint"],"showRelatedArticles":["handleRelatedArticlesChange"],"showMoreArticles":["handleMoreArticlesChange"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"]}]]]], options);
|
|
20
20
|
});
|
package/dist/esm/loader.js
CHANGED
|
@@ -5,7 +5,7 @@ import { g as globalScripts } from './app-globals-0f993ce5.js';
|
|
|
5
5
|
const defineCustomElements = async (win, options) => {
|
|
6
6
|
if (typeof window === 'undefined') return undefined;
|
|
7
7
|
await globalScripts();
|
|
8
|
-
return bootstrapLazy([["blog-article-details",[[1,"blog-article-details",{"cmsEndpoint":[513,"cms-endpoint"],"language":[513],"userRoles":[513,"user-roles"],"cmsEnv":[513,"cms-env"],"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"showPublishingDate":[516,"show-publishing-date"],"showImage":[516,"show-image"],"showTitle":[516,"show-title"],"showBreadcrumb":[516,"show-breadcrumb"],"hideCategory":[513,"hide-category"],"showContent":[516,"show-content"],"showMoreArticles":[516,"show-more-articles"],"showBackButton":[516,"show-back-button"],"postId":[513,"post-id"],"postSlug":[513,"post-slug"],"postCustomPath":[513,"post-custom-path"],"intlDateTimeFormat":[1,"intl-date-time-format"],"hasErrors":[32],"isLoading":[32],"bannerMatrixReady":[32],"device":[32],"categories":[32],"neighbours":[32]},[[8,"BannerMatrixReady","handleBannerReady"]],{"postId":["watchEndpoint"],"postSlug":["watchEndpoint"],"postCustomPath":["watchEndpoint"],"cmsEndpoint":["watchEndpoint"],"language":["watchEndpoint"],"cmsEnv":["watchEndpoint"],"userRoles":["watchEndpoint"],"showMoreArticles":["handleMoreArticlesChange"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"]}]]]], options);
|
|
8
|
+
return bootstrapLazy([["blog-article-details",[[1,"blog-article-details",{"cmsEndpoint":[513,"cms-endpoint"],"language":[513],"userRoles":[513,"user-roles"],"cmsEnv":[513,"cms-env"],"mbSource":[1,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"showPublishingDate":[516,"show-publishing-date"],"showImage":[516,"show-image"],"showTitle":[516,"show-title"],"showBreadcrumb":[516,"show-breadcrumb"],"hideCategory":[513,"hide-category"],"showContent":[516,"show-content"],"showMoreArticles":[516,"show-more-articles"],"showRelatedArticles":[516,"show-related-articles"],"showBackButton":[516,"show-back-button"],"postId":[513,"post-id"],"postSlug":[513,"post-slug"],"postCustomPath":[513,"post-custom-path"],"intlDateTimeFormat":[1,"intl-date-time-format"],"hasErrors":[32],"isLoading":[32],"bannerMatrixReady":[32],"device":[32],"categories":[32],"neighbours":[32],"relatedPosts":[32]},[[8,"BannerMatrixReady","handleBannerReady"]],{"postId":["watchEndpoint"],"postSlug":["watchEndpoint"],"postCustomPath":["watchEndpoint"],"cmsEndpoint":["watchEndpoint"],"language":["watchEndpoint"],"cmsEnv":["watchEndpoint"],"userRoles":["watchEndpoint"],"showRelatedArticles":["handleRelatedArticlesChange"],"showMoreArticles":["handleMoreArticlesChange"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingChangeURL"]}]]]], options);
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export { defineCustomElements };
|
|
@@ -56,6 +56,10 @@ export declare class BlogArticleDetails {
|
|
|
56
56
|
* Display previous and next article links.
|
|
57
57
|
*/
|
|
58
58
|
showMoreArticles: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Display up to four other articles from the same category.
|
|
61
|
+
*/
|
|
62
|
+
showRelatedArticles: boolean;
|
|
59
63
|
/**
|
|
60
64
|
* Display the Back to blog link.
|
|
61
65
|
*/
|
|
@@ -82,8 +86,10 @@ export declare class BlogArticleDetails {
|
|
|
82
86
|
device: Device;
|
|
83
87
|
private categories;
|
|
84
88
|
private neighbours;
|
|
89
|
+
private relatedPosts;
|
|
85
90
|
handleBannerReady(): void;
|
|
86
91
|
watchEndpoint(newValue: string, oldValue: string): void;
|
|
92
|
+
handleRelatedArticlesChange(): void;
|
|
87
93
|
handleMoreArticlesChange(): void;
|
|
88
94
|
handleClientStylingChange(newValue: string, oldValue: string): void;
|
|
89
95
|
handleClientStylingChangeURL(newValue: string, oldValue: string): void;
|
|
@@ -95,6 +101,7 @@ export declare class BlogArticleDetails {
|
|
|
95
101
|
connectedCallback(): void;
|
|
96
102
|
getBlogArticleDetails(): void;
|
|
97
103
|
private fetchMoreArticles;
|
|
104
|
+
private fetchRelatedArticles;
|
|
98
105
|
private fetchCategories;
|
|
99
106
|
handleClientStyling(): void;
|
|
100
107
|
componentDidLoad(): void;
|
|
@@ -75,6 +75,10 @@ export namespace Components {
|
|
|
75
75
|
* Property used to display the publishing date
|
|
76
76
|
*/
|
|
77
77
|
"showPublishingDate": boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Display up to four other articles from the same category.
|
|
80
|
+
*/
|
|
81
|
+
"showRelatedArticles": boolean;
|
|
78
82
|
/**
|
|
79
83
|
* Property used to display the image
|
|
80
84
|
*/
|
|
@@ -166,6 +170,10 @@ declare namespace LocalJSX {
|
|
|
166
170
|
* Property used to display the publishing date
|
|
167
171
|
*/
|
|
168
172
|
"showPublishingDate"?: boolean;
|
|
173
|
+
/**
|
|
174
|
+
* Display up to four other articles from the same category.
|
|
175
|
+
*/
|
|
176
|
+
"showRelatedArticles"?: boolean;
|
|
169
177
|
/**
|
|
170
178
|
* Property used to display the image
|
|
171
179
|
*/
|