@everymatrix/blog-article-details 1.27.2 → 1.27.4
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.esm.js +1 -1
- package/dist/blog-article-details/p-df1f1274.entry.js +1 -0
- package/dist/cjs/blog-article-details.cjs.entry.js +9 -10
- 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 +24 -29
- package/dist/collection/components/blog-article-details/blog-article-details.js +20 -31
- package/dist/components/blog-article-details.js +9 -11
- package/dist/esm/blog-article-details.entry.js +9 -10
- package/dist/esm/blog-article-details.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/Users/dragos.bodea/Documents/everymatrix-prjs/emfe-widgets/widgets-stencil/packages/blog-article-details/.stencil/packages/blog-article-details/stencil.config.d.ts +2 -0
- package/dist/types/components/blog-article-details/blog-article-details.d.ts +0 -4
- package/dist/types/components.d.ts +0 -8
- package/package.json +1 -1
- package/dist/blog-article-details/p-9d4b45aa.entry.js +0 -1
- package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/blog-article-details/.stencil/packages/blog-article-details/stencil.config.d.ts +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as t,b as e}from"./p-68e0210a.js";(()=>{const e=import.meta.url,s={};return""!==e&&(s.resourcesUrl=new URL(".",e).href),t(s)})().then((t=>e([["p-
|
|
1
|
+
import{p as t,b as e}from"./p-68e0210a.js";(()=>{const e=import.meta.url,s={};return""!==e&&(s.resourcesUrl=new URL(".",e).href),t(s)})().then((t=>e([["p-df1f1274",[[1,"blog-article-details",{cmsEndpoint:[513,"cms-endpoint"],language:[513],userRoles:[513,"user-roles"],cmsEnv:[513,"cms-env"],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"],postId:[514,"post-id"],postSlug:[513,"post-slug"],postCustomPath:[513,"post-custom-path"],intlDateTimeFormat:[1,"intl-date-time-format"],hasErrors:[32],limitStylingAppends:[32],isLoading:[32],bannerMatrixReady:[32],device:[32]},[[8,"BannerMatrixReady","handleBannerReady"]]]]]],t)));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,h as i}from"./p-68e0210a.js";const n=["ro","en","fr","ar","hr"],e={en:{error:"Error"},ro:{error:"Eroare"},fr:{error:"Error"},ar:{error:"خطأ"},hr:{error:"Greška"}};const s=class{constructor(n){t(this,n),this.language="en",this.userRoles="everyone",this.cmsEnv="stage",this.clientStyling="",this.clientStylingUrl="",this.showPublishingDate=!0,this.showImage=!0,this.showTitle=!0,this.showContent=!0,this.intlDateTimeFormat="",this.hasErrors=!1,this.limitStylingAppends=!1,this.isLoading=!0,this.bannerMatrixReady=!1,this.device="",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=>-1!==(null==t?void 0:t.indexOf("<bannermatrix-banner"))?this.bannerMatrixReady?i("div",{class:"BlogContent",innerHTML:t}):null:i("div",{class:"BlogContent",innerHTML:t}),this.setImage=t=>{let i="";switch(this.device){case"mobile":i=t.sources[0].pictureSource;break;case"tablet":i=t.sources[1].pictureSource;break;case"desktop":i=t.sources[2].pictureSource}return i}}handleBannerReady(){this.bannerMatrixReady=!0}watchEndpoint(t,i){t&&t!=i&&this.cmsEndpoint&&this.getBlogArticleDetails()}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!");this.isLoading=!0;let t=new URL(`${this.cmsEndpoint}/${this.language}/blog-posts${this.postCustomPath?"":"/"+this.postSlug||"/"+this.postId}`);t.searchParams.append("env",this.cmsEnv),t.searchParams.append("userRoles",this.userRoles),t.searchParams.append("device",(()=>{const t=(()=>{let t=window.navigator.userAgent;return t.toLowerCase().match(/android/i)?"Android":t.toLowerCase().match(/iphone/i)?"iPhone":t.toLowerCase().match(/ipad|ipod/i)?"iPad":"PC"})();if(t)return"PC"===t?"dk":"mtWeb"})()),this.postCustomPath&&t.searchParams.append("customURL",this.postCustomPath),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=>{if(t.count>1&&this.postCustomPath){let i=new Date(t.items[0].publishingDate),n=0;for(let e=1;e<t.items.length;e++){const s=new Date(t.items[e].publishingDate);i.getTime()<s.getTime()&&(i=s,n=e)}this.blogData=t.items[n]}else this.blogData=this.postCustomPath?t.items[0]:t;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)}componentDidLoad(){this.detectAndAlertDeviceType()}detectAndAlertDeviceType(){this.device=function(){const t=navigator.userAgent.toLowerCase();let i="";return i=t.includes("android")||t.includes("iphone")||t.includes("ipad")?function(){const t=screen.availWidth;return t<600?"mobile":t>=600&&t<1100?"tablet":void 0}():"desktop",i}()}formatDate(t){return new Intl.DateTimeFormat(this.intlDateTimeFormat||"en-GB").format(new Date(t))}render(){var t,s,o,r,a;return this.hasErrors?i("div",{class:"BlogArticleDetails"},i("div",{class:"Title"},(()=>{const t=this.language;return e[void 0!==t&&n.includes(t)?t:"en"].error})())):this.isLoading?void 0:i("div",{ref:t=>this.stylingContainer=t},i("div",{class:"DetailsContainer"},i("div",{class:"DetailsHeadWrapper"},this.showPublishingDate&&i("div",{class:"BlogDate"},this.formatDate(null===(t=this.blogData)||void 0===t?void 0:t.publishingDate)),this.showImage&&i("div",{class:"BlogBanner"},(null===(s=this.blogData.image)||void 0===s?void 0:s.src)?i("div",{style:{background:`url(${this.setImage(this.blogData.image)}) no-repeat center center / cover`}}):(null===(o=this.blogData.video)||void 0===o?void 0:o.sources[this.device])?i("video",{src:this.blogData.video.sources[this.device],controls:!0}):i("h1",{style:{color:"white"}},"No Image"))),i("div",{class:"DetailsBodyWrapper"},this.showTitle&&i("div",{class:"BlogTitle"},null===(r=this.blogData)||void 0===r?void 0:r.title),this.showContent&&this.renderContentConditionally(null===(a=this.blogData)||void 0===a?void 0:a.content))))}static get watchers(){return{postId:["watchEndpoint"],postSlug:["watchEndpoint"],postCustomPath:["watchEndpoint"],cmsEndpoint:["watchEndpoint"],language:["watchEndpoint"]}}};s.style=":host {\n display: block;\n}\n\n.DetailsContainer {\n background-color: #07072A;\n color: #fff;\n display: flex;\n flex-direction: column;\n}\n.DetailsContainer .BlogBanner div {\n height: 400px;\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 .BlogContent {\n font-size: 14px;\n}\n.DetailsContainer .BlogContent p:last-child {\n margin-bottom: 0;\n}\n\n@container (max-width: 475px) {\n .DetailsContainer {\n font-size: 12px;\n }\n}";export{s as blog_article_details}
|
|
@@ -71,7 +71,7 @@ const getDevicePlatform = () => {
|
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
73
|
|
|
74
|
-
const blogArticleDetailsCss = ":host {\n display: block;\n}\n\n.
|
|
74
|
+
const blogArticleDetailsCss = ":host {\n display: block;\n}\n\n.DetailsContainer {\n background-color: #07072A;\n color: #fff;\n display: flex;\n flex-direction: column;\n}\n.DetailsContainer .BlogBanner div {\n height: 400px;\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 .BlogContent {\n font-size: 14px;\n}\n.DetailsContainer .BlogContent p:last-child {\n margin-bottom: 0;\n}\n\n@container (max-width: 475px) {\n .DetailsContainer {\n font-size: 12px;\n }\n}";
|
|
75
75
|
|
|
76
76
|
const BlogArticleDetails = class {
|
|
77
77
|
constructor(hostRef) {
|
|
@@ -112,10 +112,6 @@ const BlogArticleDetails = class {
|
|
|
112
112
|
* Property used to display the description
|
|
113
113
|
*/
|
|
114
114
|
this.showContent = true;
|
|
115
|
-
/**
|
|
116
|
-
* Event name to be sent when the button is clicked
|
|
117
|
-
*/
|
|
118
|
-
this.postMessageEvent = 'articleActionButton';
|
|
119
115
|
/**
|
|
120
116
|
* Intl date format
|
|
121
117
|
*/
|
|
@@ -179,7 +175,7 @@ const BlogArticleDetails = class {
|
|
|
179
175
|
}
|
|
180
176
|
}
|
|
181
177
|
connectedCallback() {
|
|
182
|
-
if (this.cmsEndpoint && this.language) {
|
|
178
|
+
if (this.cmsEndpoint && this.language && (this.postCustomPath || this.postSlug || this.postId)) {
|
|
183
179
|
this.getBlogArticleDetails();
|
|
184
180
|
}
|
|
185
181
|
}
|
|
@@ -189,7 +185,7 @@ const BlogArticleDetails = class {
|
|
|
189
185
|
throw new Error('postId, postSlug or postCustomPath parameter has to be provided!');
|
|
190
186
|
}
|
|
191
187
|
this.isLoading = true;
|
|
192
|
-
let url = new URL(`${this.cmsEndpoint}/${this.language}/blog-posts${this.postCustomPath ? '' : this.postSlug || this.postId}`);
|
|
188
|
+
let url = new URL(`${this.cmsEndpoint}/${this.language}/blog-posts${this.postCustomPath ? '' : '/' + this.postSlug || '/' + this.postId}`);
|
|
193
189
|
url.searchParams.append('env', this.cmsEnv);
|
|
194
190
|
url.searchParams.append('userRoles', this.userRoles);
|
|
195
191
|
url.searchParams.append('device', getDevicePlatform());
|
|
@@ -257,12 +253,15 @@ const BlogArticleDetails = class {
|
|
|
257
253
|
return (index.h("div", { class: "BlogArticleDetails" }, index.h("div", { class: "Title" }, translate('error', this.language))));
|
|
258
254
|
}
|
|
259
255
|
if (!this.isLoading) {
|
|
260
|
-
return (index.h("div", { ref: el => this.stylingContainer = el }, index.h("div", { class: "
|
|
261
|
-
index.h("div", { class: "BlogDate" }, this.formatDate((_a = this.blogData) === null || _a === void 0 ? void 0 : _a.publishingDate)), this.showImage && (index.h("div", { class: "BlogBanner" }, ((_b = this.blogData.image) === null || _b === void 0 ? void 0 : _b.src) ? (index.h("
|
|
262
|
-
index.h("div", { class: "BlogTitle" }, (_d = this.blogData) === null || _d === void 0 ? void 0 : _d.title), this.showContent && this.renderContentConditionally((_e = this.blogData) === null || _e === void 0 ? void 0 : _e.content))));
|
|
256
|
+
return (index.h("div", { ref: el => this.stylingContainer = el }, index.h("div", { class: "DetailsContainer" }, index.h("div", { class: "DetailsHeadWrapper" }, this.showPublishingDate &&
|
|
257
|
+
index.h("div", { class: "BlogDate" }, this.formatDate((_a = this.blogData) === null || _a === void 0 ? void 0 : _a.publishingDate)), this.showImage && (index.h("div", { class: "BlogBanner" }, ((_b = this.blogData.image) === null || _b === void 0 ? void 0 : _b.src) ? (index.h("div", { style: { background: `url(${this.setImage(this.blogData.image)}) no-repeat center center / cover` } })) : (((_c = this.blogData.video) === null || _c === void 0 ? void 0 : _c.sources[this.device]) ? (index.h("video", { src: this.blogData.video.sources[this.device], controls: true })) : (index.h("h1", { style: { color: "white" } }, "No Image")))))), index.h("div", { class: "DetailsBodyWrapper" }, this.showTitle &&
|
|
258
|
+
index.h("div", { class: "BlogTitle" }, (_d = this.blogData) === null || _d === void 0 ? void 0 : _d.title), this.showContent && this.renderContentConditionally((_e = this.blogData) === null || _e === void 0 ? void 0 : _e.content)))));
|
|
263
259
|
}
|
|
264
260
|
}
|
|
265
261
|
static get watchers() { return {
|
|
262
|
+
"postId": ["watchEndpoint"],
|
|
263
|
+
"postSlug": ["watchEndpoint"],
|
|
264
|
+
"postCustomPath": ["watchEndpoint"],
|
|
266
265
|
"cmsEndpoint": ["watchEndpoint"],
|
|
267
266
|
"language": ["watchEndpoint"]
|
|
268
267
|
}; }
|
|
@@ -15,5 +15,5 @@ const patchBrowser = () => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
patchBrowser().then(options => {
|
|
18
|
-
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"],"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"],"
|
|
18
|
+
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"],"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"],"postId":[514,"post-id"],"postSlug":[513,"post-slug"],"postCustomPath":[513,"post-custom-path"],"intlDateTimeFormat":[1,"intl-date-time-format"],"hasErrors":[32],"limitStylingAppends":[32],"isLoading":[32],"bannerMatrixReady":[32],"device":[32]},[[8,"BannerMatrixReady","handleBannerReady"]]]]]], options);
|
|
19
19
|
});
|
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-article-details.cjs",[[1,"blog-article-details",{"cmsEndpoint":[513,"cms-endpoint"],"language":[513],"userRoles":[513,"user-roles"],"cmsEnv":[513,"cms-env"],"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"],"
|
|
17
|
+
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"],"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"],"postId":[514,"post-id"],"postSlug":[513,"post-slug"],"postCustomPath":[513,"post-custom-path"],"intlDateTimeFormat":[1,"intl-date-time-format"],"hasErrors":[32],"limitStylingAppends":[32],"isLoading":[32],"bannerMatrixReady":[32],"device":[32]},[[8,"BannerMatrixReady","handleBannerReady"]]]]]], options);
|
|
18
18
|
});
|
|
19
19
|
};
|
|
20
20
|
|
|
@@ -2,51 +2,46 @@
|
|
|
2
2
|
display: block;
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
-
.
|
|
6
|
-
overflow: auto;
|
|
7
|
-
margin: auto;
|
|
8
|
-
width: 100%;
|
|
9
|
-
padding-bottom: 30px;
|
|
5
|
+
.DetailsContainer {
|
|
10
6
|
background-color: #07072A;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
.
|
|
25
|
-
grid-column: 2/3;
|
|
26
|
-
grid-row: 2/3;
|
|
7
|
+
color: #fff;
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
}
|
|
11
|
+
.DetailsContainer .BlogBanner div {
|
|
12
|
+
height: 400px;
|
|
13
|
+
}
|
|
14
|
+
.DetailsContainer .DetailsHeadWrapper {
|
|
15
|
+
position: relative;
|
|
16
|
+
}
|
|
17
|
+
.DetailsContainer .DetailsBodyWrapper {
|
|
18
|
+
padding: 30px;
|
|
19
|
+
}
|
|
20
|
+
.DetailsContainer .BlogDate {
|
|
27
21
|
font-size: 12px;
|
|
28
22
|
border-radius: 5px 5px 0 0;
|
|
29
23
|
padding: 10px;
|
|
30
24
|
width: fit-content;
|
|
31
25
|
text-align: center;
|
|
32
|
-
color: #FFF;
|
|
33
26
|
background-color: #0D0D4D;
|
|
34
27
|
z-index: 1;
|
|
35
28
|
text-wrap: nowrap;
|
|
29
|
+
position: absolute;
|
|
30
|
+
bottom: 0;
|
|
31
|
+
left: 30px;
|
|
36
32
|
}
|
|
37
|
-
.
|
|
38
|
-
grid-column: 2/4;
|
|
33
|
+
.DetailsContainer .BlogTitle {
|
|
39
34
|
font-size: 24px;
|
|
40
|
-
color: #FFF;
|
|
41
35
|
}
|
|
42
|
-
.
|
|
43
|
-
grid-column: 2/4;
|
|
36
|
+
.DetailsContainer .BlogContent {
|
|
44
37
|
font-size: 14px;
|
|
45
|
-
|
|
38
|
+
}
|
|
39
|
+
.DetailsContainer .BlogContent p:last-child {
|
|
40
|
+
margin-bottom: 0;
|
|
46
41
|
}
|
|
47
42
|
|
|
48
43
|
@container (max-width: 475px) {
|
|
49
|
-
.
|
|
44
|
+
.DetailsContainer {
|
|
50
45
|
font-size: 12px;
|
|
51
46
|
}
|
|
52
47
|
}
|
|
@@ -39,10 +39,6 @@ export class BlogArticleDetails {
|
|
|
39
39
|
* Property used to display the description
|
|
40
40
|
*/
|
|
41
41
|
this.showContent = true;
|
|
42
|
-
/**
|
|
43
|
-
* Event name to be sent when the button is clicked
|
|
44
|
-
*/
|
|
45
|
-
this.postMessageEvent = 'articleActionButton';
|
|
46
42
|
/**
|
|
47
43
|
* Intl date format
|
|
48
44
|
*/
|
|
@@ -106,7 +102,7 @@ export class BlogArticleDetails {
|
|
|
106
102
|
}
|
|
107
103
|
}
|
|
108
104
|
connectedCallback() {
|
|
109
|
-
if (this.cmsEndpoint && this.language) {
|
|
105
|
+
if (this.cmsEndpoint && this.language && (this.postCustomPath || this.postSlug || this.postId)) {
|
|
110
106
|
this.getBlogArticleDetails();
|
|
111
107
|
}
|
|
112
108
|
}
|
|
@@ -116,7 +112,7 @@ export class BlogArticleDetails {
|
|
|
116
112
|
throw new Error('postId, postSlug or postCustomPath parameter has to be provided!');
|
|
117
113
|
}
|
|
118
114
|
this.isLoading = true;
|
|
119
|
-
let url = new URL(`${this.cmsEndpoint}/${this.language}/blog-posts${this.postCustomPath ? '' : this.postSlug || this.postId}`);
|
|
115
|
+
let url = new URL(`${this.cmsEndpoint}/${this.language}/blog-posts${this.postCustomPath ? '' : '/' + this.postSlug || '/' + this.postId}`);
|
|
120
116
|
url.searchParams.append('env', this.cmsEnv);
|
|
121
117
|
url.searchParams.append('userRoles', this.userRoles);
|
|
122
118
|
url.searchParams.append('device', getDevicePlatform());
|
|
@@ -187,13 +183,15 @@ export class BlogArticleDetails {
|
|
|
187
183
|
}
|
|
188
184
|
if (!this.isLoading) {
|
|
189
185
|
return (h("div", { ref: el => this.stylingContainer = el },
|
|
190
|
-
h("div", { class: "
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
186
|
+
h("div", { class: "DetailsContainer" },
|
|
187
|
+
h("div", { class: "DetailsHeadWrapper" },
|
|
188
|
+
this.showPublishingDate &&
|
|
189
|
+
h("div", { class: "BlogDate" }, this.formatDate((_a = this.blogData) === null || _a === void 0 ? void 0 : _a.publishingDate)),
|
|
190
|
+
this.showImage && (h("div", { class: "BlogBanner" }, ((_b = this.blogData.image) === null || _b === void 0 ? void 0 : _b.src) ? (h("div", { style: { background: `url(${this.setImage(this.blogData.image)}) no-repeat center center / cover` } })) : (((_c = this.blogData.video) === null || _c === void 0 ? void 0 : _c.sources[this.device]) ? (h("video", { src: this.blogData.video.sources[this.device], controls: true })) : (h("h1", { style: { color: "white" } }, "No Image")))))),
|
|
191
|
+
h("div", { class: "DetailsBodyWrapper" },
|
|
192
|
+
this.showTitle &&
|
|
193
|
+
h("div", { class: "BlogTitle" }, (_d = this.blogData) === null || _d === void 0 ? void 0 : _d.title),
|
|
194
|
+
this.showContent && this.renderContentConditionally((_e = this.blogData) === null || _e === void 0 ? void 0 : _e.content)))));
|
|
197
195
|
}
|
|
198
196
|
}
|
|
199
197
|
static get is() { return "blog-article-details"; }
|
|
@@ -384,24 +382,6 @@ export class BlogArticleDetails {
|
|
|
384
382
|
"reflect": true,
|
|
385
383
|
"defaultValue": "true"
|
|
386
384
|
},
|
|
387
|
-
"postMessageEvent": {
|
|
388
|
-
"type": "string",
|
|
389
|
-
"mutable": false,
|
|
390
|
-
"complexType": {
|
|
391
|
-
"original": "string",
|
|
392
|
-
"resolved": "string",
|
|
393
|
-
"references": {}
|
|
394
|
-
},
|
|
395
|
-
"required": false,
|
|
396
|
-
"optional": false,
|
|
397
|
-
"docs": {
|
|
398
|
-
"tags": [],
|
|
399
|
-
"text": "Event name to be sent when the button is clicked"
|
|
400
|
-
},
|
|
401
|
-
"attribute": "post-message-event",
|
|
402
|
-
"reflect": true,
|
|
403
|
-
"defaultValue": "'articleActionButton'"
|
|
404
|
-
},
|
|
405
385
|
"postId": {
|
|
406
386
|
"type": "number",
|
|
407
387
|
"mutable": false,
|
|
@@ -480,6 +460,15 @@ export class BlogArticleDetails {
|
|
|
480
460
|
"device": {}
|
|
481
461
|
}; }
|
|
482
462
|
static get watchers() { return [{
|
|
463
|
+
"propName": "postId",
|
|
464
|
+
"methodName": "watchEndpoint"
|
|
465
|
+
}, {
|
|
466
|
+
"propName": "postSlug",
|
|
467
|
+
"methodName": "watchEndpoint"
|
|
468
|
+
}, {
|
|
469
|
+
"propName": "postCustomPath",
|
|
470
|
+
"methodName": "watchEndpoint"
|
|
471
|
+
}, {
|
|
483
472
|
"propName": "cmsEndpoint",
|
|
484
473
|
"methodName": "watchEndpoint"
|
|
485
474
|
}, {
|
|
@@ -67,7 +67,7 @@ const getDevicePlatform = () => {
|
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
-
const blogArticleDetailsCss = ":host {\n display: block;\n}\n\n.
|
|
70
|
+
const blogArticleDetailsCss = ":host {\n display: block;\n}\n\n.DetailsContainer {\n background-color: #07072A;\n color: #fff;\n display: flex;\n flex-direction: column;\n}\n.DetailsContainer .BlogBanner div {\n height: 400px;\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 .BlogContent {\n font-size: 14px;\n}\n.DetailsContainer .BlogContent p:last-child {\n margin-bottom: 0;\n}\n\n@container (max-width: 475px) {\n .DetailsContainer {\n font-size: 12px;\n }\n}";
|
|
71
71
|
|
|
72
72
|
const BlogArticleDetails$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
73
73
|
constructor() {
|
|
@@ -110,10 +110,6 @@ const BlogArticleDetails$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
|
|
|
110
110
|
* Property used to display the description
|
|
111
111
|
*/
|
|
112
112
|
this.showContent = true;
|
|
113
|
-
/**
|
|
114
|
-
* Event name to be sent when the button is clicked
|
|
115
|
-
*/
|
|
116
|
-
this.postMessageEvent = 'articleActionButton';
|
|
117
113
|
/**
|
|
118
114
|
* Intl date format
|
|
119
115
|
*/
|
|
@@ -177,7 +173,7 @@ const BlogArticleDetails$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
|
|
|
177
173
|
}
|
|
178
174
|
}
|
|
179
175
|
connectedCallback() {
|
|
180
|
-
if (this.cmsEndpoint && this.language) {
|
|
176
|
+
if (this.cmsEndpoint && this.language && (this.postCustomPath || this.postSlug || this.postId)) {
|
|
181
177
|
this.getBlogArticleDetails();
|
|
182
178
|
}
|
|
183
179
|
}
|
|
@@ -187,7 +183,7 @@ const BlogArticleDetails$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
|
|
|
187
183
|
throw new Error('postId, postSlug or postCustomPath parameter has to be provided!');
|
|
188
184
|
}
|
|
189
185
|
this.isLoading = true;
|
|
190
|
-
let url = new URL(`${this.cmsEndpoint}/${this.language}/blog-posts${this.postCustomPath ? '' : this.postSlug || this.postId}`);
|
|
186
|
+
let url = new URL(`${this.cmsEndpoint}/${this.language}/blog-posts${this.postCustomPath ? '' : '/' + this.postSlug || '/' + this.postId}`);
|
|
191
187
|
url.searchParams.append('env', this.cmsEnv);
|
|
192
188
|
url.searchParams.append('userRoles', this.userRoles);
|
|
193
189
|
url.searchParams.append('device', getDevicePlatform());
|
|
@@ -255,12 +251,15 @@ const BlogArticleDetails$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
|
|
|
255
251
|
return (h("div", { class: "BlogArticleDetails" }, h("div", { class: "Title" }, translate('error', this.language))));
|
|
256
252
|
}
|
|
257
253
|
if (!this.isLoading) {
|
|
258
|
-
return (h("div", { ref: el => this.stylingContainer = el }, h("div", { class: "
|
|
259
|
-
h("div", { class: "BlogDate" }, this.formatDate((_a = this.blogData) === null || _a === void 0 ? void 0 : _a.publishingDate)), this.showImage && (h("div", { class: "BlogBanner" }, ((_b = this.blogData.image) === null || _b === void 0 ? void 0 : _b.src) ? (h("
|
|
260
|
-
h("div", { class: "BlogTitle" }, (_d = this.blogData) === null || _d === void 0 ? void 0 : _d.title), this.showContent && this.renderContentConditionally((_e = this.blogData) === null || _e === void 0 ? void 0 : _e.content))));
|
|
254
|
+
return (h("div", { ref: el => this.stylingContainer = el }, h("div", { class: "DetailsContainer" }, h("div", { class: "DetailsHeadWrapper" }, this.showPublishingDate &&
|
|
255
|
+
h("div", { class: "BlogDate" }, this.formatDate((_a = this.blogData) === null || _a === void 0 ? void 0 : _a.publishingDate)), this.showImage && (h("div", { class: "BlogBanner" }, ((_b = this.blogData.image) === null || _b === void 0 ? void 0 : _b.src) ? (h("div", { style: { background: `url(${this.setImage(this.blogData.image)}) no-repeat center center / cover` } })) : (((_c = this.blogData.video) === null || _c === void 0 ? void 0 : _c.sources[this.device]) ? (h("video", { src: this.blogData.video.sources[this.device], controls: true })) : (h("h1", { style: { color: "white" } }, "No Image")))))), h("div", { class: "DetailsBodyWrapper" }, this.showTitle &&
|
|
256
|
+
h("div", { class: "BlogTitle" }, (_d = this.blogData) === null || _d === void 0 ? void 0 : _d.title), this.showContent && this.renderContentConditionally((_e = this.blogData) === null || _e === void 0 ? void 0 : _e.content)))));
|
|
261
257
|
}
|
|
262
258
|
}
|
|
263
259
|
static get watchers() { return {
|
|
260
|
+
"postId": ["watchEndpoint"],
|
|
261
|
+
"postSlug": ["watchEndpoint"],
|
|
262
|
+
"postCustomPath": ["watchEndpoint"],
|
|
264
263
|
"cmsEndpoint": ["watchEndpoint"],
|
|
265
264
|
"language": ["watchEndpoint"]
|
|
266
265
|
}; }
|
|
@@ -276,7 +275,6 @@ const BlogArticleDetails$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
|
|
|
276
275
|
"showImage": [516, "show-image"],
|
|
277
276
|
"showTitle": [516, "show-title"],
|
|
278
277
|
"showContent": [516, "show-content"],
|
|
279
|
-
"postMessageEvent": [513, "post-message-event"],
|
|
280
278
|
"postId": [514, "post-id"],
|
|
281
279
|
"postSlug": [513, "post-slug"],
|
|
282
280
|
"postCustomPath": [513, "post-custom-path"],
|
|
@@ -67,7 +67,7 @@ const getDevicePlatform = () => {
|
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
69
|
|
|
70
|
-
const blogArticleDetailsCss = ":host {\n display: block;\n}\n\n.
|
|
70
|
+
const blogArticleDetailsCss = ":host {\n display: block;\n}\n\n.DetailsContainer {\n background-color: #07072A;\n color: #fff;\n display: flex;\n flex-direction: column;\n}\n.DetailsContainer .BlogBanner div {\n height: 400px;\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 .BlogContent {\n font-size: 14px;\n}\n.DetailsContainer .BlogContent p:last-child {\n margin-bottom: 0;\n}\n\n@container (max-width: 475px) {\n .DetailsContainer {\n font-size: 12px;\n }\n}";
|
|
71
71
|
|
|
72
72
|
const BlogArticleDetails = class {
|
|
73
73
|
constructor(hostRef) {
|
|
@@ -108,10 +108,6 @@ const BlogArticleDetails = class {
|
|
|
108
108
|
* Property used to display the description
|
|
109
109
|
*/
|
|
110
110
|
this.showContent = true;
|
|
111
|
-
/**
|
|
112
|
-
* Event name to be sent when the button is clicked
|
|
113
|
-
*/
|
|
114
|
-
this.postMessageEvent = 'articleActionButton';
|
|
115
111
|
/**
|
|
116
112
|
* Intl date format
|
|
117
113
|
*/
|
|
@@ -175,7 +171,7 @@ const BlogArticleDetails = class {
|
|
|
175
171
|
}
|
|
176
172
|
}
|
|
177
173
|
connectedCallback() {
|
|
178
|
-
if (this.cmsEndpoint && this.language) {
|
|
174
|
+
if (this.cmsEndpoint && this.language && (this.postCustomPath || this.postSlug || this.postId)) {
|
|
179
175
|
this.getBlogArticleDetails();
|
|
180
176
|
}
|
|
181
177
|
}
|
|
@@ -185,7 +181,7 @@ const BlogArticleDetails = class {
|
|
|
185
181
|
throw new Error('postId, postSlug or postCustomPath parameter has to be provided!');
|
|
186
182
|
}
|
|
187
183
|
this.isLoading = true;
|
|
188
|
-
let url = new URL(`${this.cmsEndpoint}/${this.language}/blog-posts${this.postCustomPath ? '' : this.postSlug || this.postId}`);
|
|
184
|
+
let url = new URL(`${this.cmsEndpoint}/${this.language}/blog-posts${this.postCustomPath ? '' : '/' + this.postSlug || '/' + this.postId}`);
|
|
189
185
|
url.searchParams.append('env', this.cmsEnv);
|
|
190
186
|
url.searchParams.append('userRoles', this.userRoles);
|
|
191
187
|
url.searchParams.append('device', getDevicePlatform());
|
|
@@ -253,12 +249,15 @@ const BlogArticleDetails = class {
|
|
|
253
249
|
return (h("div", { class: "BlogArticleDetails" }, h("div", { class: "Title" }, translate('error', this.language))));
|
|
254
250
|
}
|
|
255
251
|
if (!this.isLoading) {
|
|
256
|
-
return (h("div", { ref: el => this.stylingContainer = el }, h("div", { class: "
|
|
257
|
-
h("div", { class: "BlogDate" }, this.formatDate((_a = this.blogData) === null || _a === void 0 ? void 0 : _a.publishingDate)), this.showImage && (h("div", { class: "BlogBanner" }, ((_b = this.blogData.image) === null || _b === void 0 ? void 0 : _b.src) ? (h("
|
|
258
|
-
h("div", { class: "BlogTitle" }, (_d = this.blogData) === null || _d === void 0 ? void 0 : _d.title), this.showContent && this.renderContentConditionally((_e = this.blogData) === null || _e === void 0 ? void 0 : _e.content))));
|
|
252
|
+
return (h("div", { ref: el => this.stylingContainer = el }, h("div", { class: "DetailsContainer" }, h("div", { class: "DetailsHeadWrapper" }, this.showPublishingDate &&
|
|
253
|
+
h("div", { class: "BlogDate" }, this.formatDate((_a = this.blogData) === null || _a === void 0 ? void 0 : _a.publishingDate)), this.showImage && (h("div", { class: "BlogBanner" }, ((_b = this.blogData.image) === null || _b === void 0 ? void 0 : _b.src) ? (h("div", { style: { background: `url(${this.setImage(this.blogData.image)}) no-repeat center center / cover` } })) : (((_c = this.blogData.video) === null || _c === void 0 ? void 0 : _c.sources[this.device]) ? (h("video", { src: this.blogData.video.sources[this.device], controls: true })) : (h("h1", { style: { color: "white" } }, "No Image")))))), h("div", { class: "DetailsBodyWrapper" }, this.showTitle &&
|
|
254
|
+
h("div", { class: "BlogTitle" }, (_d = this.blogData) === null || _d === void 0 ? void 0 : _d.title), this.showContent && this.renderContentConditionally((_e = this.blogData) === null || _e === void 0 ? void 0 : _e.content)))));
|
|
259
255
|
}
|
|
260
256
|
}
|
|
261
257
|
static get watchers() { return {
|
|
258
|
+
"postId": ["watchEndpoint"],
|
|
259
|
+
"postSlug": ["watchEndpoint"],
|
|
260
|
+
"postCustomPath": ["watchEndpoint"],
|
|
262
261
|
"cmsEndpoint": ["watchEndpoint"],
|
|
263
262
|
"language": ["watchEndpoint"]
|
|
264
263
|
}; }
|
|
@@ -13,5 +13,5 @@ const patchBrowser = () => {
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
patchBrowser().then(options => {
|
|
16
|
-
return bootstrapLazy([["blog-article-details",[[1,"blog-article-details",{"cmsEndpoint":[513,"cms-endpoint"],"language":[513],"userRoles":[513,"user-roles"],"cmsEnv":[513,"cms-env"],"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"],"
|
|
16
|
+
return bootstrapLazy([["blog-article-details",[[1,"blog-article-details",{"cmsEndpoint":[513,"cms-endpoint"],"language":[513],"userRoles":[513,"user-roles"],"cmsEnv":[513,"cms-env"],"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"],"postId":[514,"post-id"],"postSlug":[513,"post-slug"],"postCustomPath":[513,"post-custom-path"],"intlDateTimeFormat":[1,"intl-date-time-format"],"hasErrors":[32],"limitStylingAppends":[32],"isLoading":[32],"bannerMatrixReady":[32],"device":[32]},[[8,"BannerMatrixReady","handleBannerReady"]]]]]], options);
|
|
17
17
|
});
|
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-article-details",[[1,"blog-article-details",{"cmsEndpoint":[513,"cms-endpoint"],"language":[513],"userRoles":[513,"user-roles"],"cmsEnv":[513,"cms-env"],"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"],"
|
|
13
|
+
return bootstrapLazy([["blog-article-details",[[1,"blog-article-details",{"cmsEndpoint":[513,"cms-endpoint"],"language":[513],"userRoles":[513,"user-roles"],"cmsEnv":[513,"cms-env"],"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"],"postId":[514,"post-id"],"postSlug":[513,"post-slug"],"postCustomPath":[513,"post-custom-path"],"intlDateTimeFormat":[1,"intl-date-time-format"],"hasErrors":[32],"limitStylingAppends":[32],"isLoading":[32],"bannerMatrixReady":[32],"device":[32]},[[8,"BannerMatrixReady","handleBannerReady"]]]]]], options);
|
|
14
14
|
});
|
|
15
15
|
};
|
|
16
16
|
|
|
@@ -39,10 +39,6 @@ export declare class BlogArticleDetails {
|
|
|
39
39
|
* Property used to display the description
|
|
40
40
|
*/
|
|
41
41
|
showContent: boolean;
|
|
42
|
-
/**
|
|
43
|
-
* Event name to be sent when the button is clicked
|
|
44
|
-
*/
|
|
45
|
-
postMessageEvent: string;
|
|
46
42
|
/**
|
|
47
43
|
* Showing post ID parameter
|
|
48
44
|
*/
|
|
@@ -39,10 +39,6 @@ export namespace Components {
|
|
|
39
39
|
* Showing post ID parameter
|
|
40
40
|
*/
|
|
41
41
|
"postId": number;
|
|
42
|
-
/**
|
|
43
|
-
* Event name to be sent when the button is clicked
|
|
44
|
-
*/
|
|
45
|
-
"postMessageEvent": string;
|
|
46
42
|
/**
|
|
47
43
|
* Slug of post
|
|
48
44
|
*/
|
|
@@ -114,10 +110,6 @@ declare namespace LocalJSX {
|
|
|
114
110
|
* Showing post ID parameter
|
|
115
111
|
*/
|
|
116
112
|
"postId"?: number;
|
|
117
|
-
/**
|
|
118
|
-
* Event name to be sent when the button is clicked
|
|
119
|
-
*/
|
|
120
|
-
"postMessageEvent"?: string;
|
|
121
113
|
/**
|
|
122
114
|
* Slug of post
|
|
123
115
|
*/
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,h as i}from"./p-68e0210a.js";const n=["ro","en","fr","ar","hr"],e={en:{error:"Error"},ro:{error:"Eroare"},fr:{error:"Error"},ar:{error:"خطأ"},hr:{error:"Greška"}};const r=class{constructor(n){t(this,n),this.language="en",this.userRoles="everyone",this.cmsEnv="stage",this.clientStyling="",this.clientStylingUrl="",this.showPublishingDate=!0,this.showImage=!0,this.showTitle=!0,this.showContent=!0,this.postMessageEvent="articleActionButton",this.intlDateTimeFormat="",this.hasErrors=!1,this.limitStylingAppends=!1,this.isLoading=!0,this.bannerMatrixReady=!1,this.device="",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=>-1!==(null==t?void 0:t.indexOf("<bannermatrix-banner"))?this.bannerMatrixReady?i("div",{class:"BlogContent",innerHTML:t}):null:i("div",{class:"BlogContent",innerHTML:t}),this.setImage=t=>{let i="";switch(this.device){case"mobile":i=t.sources[0].pictureSource;break;case"tablet":i=t.sources[1].pictureSource;break;case"desktop":i=t.sources[2].pictureSource}return i}}handleBannerReady(){this.bannerMatrixReady=!0}watchEndpoint(t,i){t&&t!=i&&this.cmsEndpoint&&this.getBlogArticleDetails()}connectedCallback(){this.cmsEndpoint&&this.language&&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!");this.isLoading=!0;let t=new URL(`${this.cmsEndpoint}/${this.language}/blog-posts${this.postCustomPath?"":this.postSlug||this.postId}`);t.searchParams.append("env",this.cmsEnv),t.searchParams.append("userRoles",this.userRoles),t.searchParams.append("device",(()=>{const t=(()=>{let t=window.navigator.userAgent;return t.toLowerCase().match(/android/i)?"Android":t.toLowerCase().match(/iphone/i)?"iPhone":t.toLowerCase().match(/ipad|ipod/i)?"iPad":"PC"})();if(t)return"PC"===t?"dk":"mtWeb"})()),this.postCustomPath&&t.searchParams.append("customURL",this.postCustomPath),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=>{if(t.count>1&&this.postCustomPath){let i=new Date(t.items[0].publishingDate),n=0;for(let e=1;e<t.items.length;e++){const r=new Date(t.items[e].publishingDate);i.getTime()<r.getTime()&&(i=r,n=e)}this.blogData=t.items[n]}else this.blogData=this.postCustomPath?t.items[0]:t;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)}componentDidLoad(){this.detectAndAlertDeviceType()}detectAndAlertDeviceType(){this.device=function(){const t=navigator.userAgent.toLowerCase();let i="";return i=t.includes("android")||t.includes("iphone")||t.includes("ipad")?function(){const t=screen.availWidth;return t<600?"mobile":t>=600&&t<1100?"tablet":void 0}():"desktop",i}()}formatDate(t){return new Intl.DateTimeFormat(this.intlDateTimeFormat||"en-GB").format(new Date(t))}render(){var t,r,s,o,h;return this.hasErrors?i("div",{class:"BlogArticleDetails"},i("div",{class:"Title"},(()=>{const t=this.language;return e[void 0!==t&&n.includes(t)?t:"en"].error})())):this.isLoading?void 0:i("div",{ref:t=>this.stylingContainer=t},i("div",{class:"GridContainer"},this.showPublishingDate&&i("div",{class:"BlogDate"},this.formatDate(null===(t=this.blogData)||void 0===t?void 0:t.publishingDate)),this.showImage&&i("div",{class:"BlogBanner"},(null===(r=this.blogData.image)||void 0===r?void 0:r.src)?i("img",{src:this.setImage(this.blogData.image),alt:this.blogData.image.slug}):(null===(s=this.blogData.video)||void 0===s?void 0:s.sources[this.device])?i("video",{src:this.blogData.video.sources[this.device],controls:!0}):i("h1",{style:{color:"white"}},"No Image")),this.showTitle&&i("div",{class:"BlogTitle"},null===(o=this.blogData)||void 0===o?void 0:o.title),this.showContent&&this.renderContentConditionally(null===(h=this.blogData)||void 0===h?void 0:h.content)))}static get watchers(){return{cmsEndpoint:["watchEndpoint"],language:["watchEndpoint"]}}};r.style=":host {\n display: block;\n}\n\n.GridContainer {\n overflow: auto;\n margin: auto;\n width: 100%;\n padding-bottom: 30px;\n background-color: #07072A;\n display: grid;\n grid-template-rows: auto;\n grid-template-columns: 30px 60px 1fr 30px;\n gap: 10px;\n}\n.GridContainer .BlogBanner {\n grid-column: 1/5;\n grid-row: 1/3;\n}\n.GridContainer .BlogBanner img {\n width: 100%;\n height: auto;\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: #FFF;\n background-color: #0D0D4D;\n z-index: 1;\n text-wrap: nowrap;\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\n@container (max-width: 475px) {\n .GridContainer {\n font-size: 12px;\n }\n}";export{r as blog_article_details}
|