@everymatrix/blog-article-details 1.10.6
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 -0
- package/dist/blog-article-details/index.esm.js +0 -0
- package/dist/blog-article-details/p-6214f0ca.entry.js +1 -0
- package/dist/blog-article-details/p-7187d97f.js +1 -0
- package/dist/cjs/blog-article-details.cjs.entry.js +146 -0
- package/dist/cjs/blog-article-details.cjs.js +19 -0
- package/dist/cjs/index-df694837.js +1122 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/collection/collection-manifest.json +12 -0
- package/dist/collection/components/blog-article-details/blog-article-details.css +51 -0
- package/dist/collection/components/blog-article-details/blog-article-details.js +350 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/locale.utils.js +20 -0
- package/dist/collection/utils/utils.js +0 -0
- package/dist/components/blog-article-details.d.ts +11 -0
- package/dist/components/blog-article-details.js +176 -0
- package/dist/components/index.d.ts +26 -0
- package/dist/components/index.js +1 -0
- package/dist/esm/blog-article-details.entry.js +142 -0
- package/dist/esm/blog-article-details.js +17 -0
- package/dist/esm/index-c07b2186.js +1097 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/stencil.config.js +22 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/stencil/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 +61 -0
- package/dist/types/components.d.ts +133 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1565 -0
- package/dist/types/utils/locale.utils.d.ts +1 -0
- package/dist/types/utils/utils.d.ts +0 -0
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +12 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +10 -0
- package/package.json +23 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{p as t,b as n}from"./p-7187d97f.js";(()=>{const n=import.meta.url,i={};return""!==n&&(i.resourcesUrl=new URL(".",n).href),t(i)})().then((t=>n([["p-6214f0ca",[[1,"blog-article-details",{cmsEndpoint:[1,"cms-endpoint"],language:[1],handleClick:[1,"handle-click"],clientStyling:[1,"client-styling"],clientStylingurl:[1,"client-stylingurl"],clientStylingUrlContent:[1,"client-styling-url-content"],showPublishingDate:[4,"show-publishing-date"],showImage:[4,"show-image"],showTitle:[4,"show-title"],showContent:[4,"show-content"],postMessageEvent:[1,"post-message-event"],postId:[2,"post-id"],hasErrors:[32],limitStylingAppends:[32],isLoading:[32]}]]]],t)));
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as t,h as i}from"./p-7187d97f.js";const n=["ro","en","fr","ar"],r={en:{error:"Error"},ro:{error:"Eroare"},fr:{error:"Error"},ar:{error:"خطأ"}},s=class{constructor(i){t(this,i),this.language="en",this.clientStyling="",this.clientStylingurl="",this.clientStylingUrlContent="",this.showPublishingDate=!0,this.showImage=!0,this.showTitle=!0,this.showContent=!0,this.postMessageEvent="articleActionButton",this.hasErrors=!1,this.limitStylingAppends=!1,this.isLoading=!0,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=>{this.clientStylingUrlContent=t,i.innerHTML=t,setTimeout((()=>{this.stylingContainer.prepend(i)}),1)})).catch((t=>{console.log("error ",t)}))}}getBlogArticleDetails(){if(!this.postId&&isNaN(this.postId))throw this.hasErrors=!0,new Error("The postId parameter is missing!");this.isLoading=!0;let t=new URL(`${this.cmsEndpoint}/${this.language}/blog-posts/${this.postId}`);fetch(t.href).then((t=>{if(t.status>=300)throw this.hasErrors=!0,new Error("There was an error while fetching the data");return t.json()})).then((t=>{this.blogData=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.clientStylingUrlContent&&this.setClientStylingURL(),this.limitStylingAppends=!0)}componentWillLoad(){this.getBlogArticleDetails()}render(){return this.hasErrors?i("div",{class:"BlogArticleDetails"},i("div",{class:"Title"},(()=>{const t=this.language;return r[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.blogData.publishingDate),this.showImage&&i("div",{class:"BlogBanner"},i("img",{src:this.blogData,alt:this.blogData.title})),this.showTitle&&i("div",{class:"BlogTitle"},this.blogData.title),this.showContent&&i("div",{class:"BlogContent",innerHTML:this.blogData.content})))}};s.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}\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{s as blog_article_details}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let e,t,n=!1;const l="undefined"!=typeof window?window:{},s=l.document||{head:{}},o={t:0,l:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,l)=>e.addEventListener(t,n,l),rel:(e,t,n,l)=>e.removeEventListener(t,n,l),ce:(e,t)=>new CustomEvent(e,t)},r=e=>Promise.resolve(e),i=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replace}catch(e){}return!1})(),c=new WeakMap,u=e=>"sc-"+e.o,a={},f=e=>"object"==(e=typeof e)||"function"===e,$=(e,t,...n)=>{let l=null,s=!1,o=!1,r=[];const i=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?i(l):null!=l&&"boolean"!=typeof l&&((s="function"!=typeof e&&!f(l))&&(l+=""),s&&o?r[r.length-1].i+=l:r.push(s?d(null,l):l),o=s)};if(i(n),t){const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}const c=d(e,null);return c.u=t,r.length>0&&(c.$=r),c},d=(e,t)=>({t:0,h:e,i:t,p:null,$:null,u:null}),h={},p=(e,t,n,l,s,o)=>{if(n!==l){let r=H(e,t);if(t.toLowerCase(),"class"===t){const t=e.classList,s=m(n),o=m(l);t.remove(...s.filter((e=>e&&!o.includes(e)))),t.add(...o.filter((e=>e&&!s.includes(e))))}else if("ref"===t)l&&l(e);else{const i=f(l);if((r||i&&null!==l)&&!s)try{if(e.tagName.includes("-"))e[t]=l;else{let s=null==l?"":l;"list"===t?r=!1:null!=n&&e[t]==s||(e[t]=s)}}catch(e){}null==l||!1===l?!1===l&&""!==e.getAttribute(t)||e.removeAttribute(t):(!r||4&o||s)&&!i&&e.setAttribute(t,l=!0===l?"":l)}}},y=/\s/,m=e=>e?e.split(y):[],b=(e,t,n,l)=>{const s=11===t.p.nodeType&&t.p.host?t.p.host:t.p,o=e&&e.u||a,r=t.u||a;for(l in o)l in r||p(s,l,o[l],void 0,n,t.t);for(l in r)p(s,l,o[l],r[l],n,t.t)},w=(t,n,l)=>{let o,r,i=n.$[l],c=0;if(null!==i.i)o=i.p=s.createTextNode(i.i);else if(o=i.p=s.createElement(i.h),b(null,i,!1),null!=e&&o["s-si"]!==e&&o.classList.add(o["s-si"]=e),i.$)for(c=0;c<i.$.length;++c)r=w(t,i,c),r&&o.appendChild(r);return o},S=(e,n,l,s,o,r)=>{let i,c=e;for(c.shadowRoot&&c.tagName===t&&(c=c.shadowRoot);o<=r;++o)s[o]&&(i=w(null,l,o),i&&(s[o].p=i,c.insertBefore(i,n)))},g=(e,t,n,l,s)=>{for(;t<=n;++t)(l=e[t])&&(s=l.p,v(l),s.remove())},j=(e,t)=>e.h===t.h,M=(e,t)=>{const n=t.p=e.p,l=e.$,s=t.$,o=t.i;null===o?(b(e,t,!1),null!==l&&null!==s?((e,t,n,l)=>{let s,o=0,r=0,i=t.length-1,c=t[0],u=t[i],a=l.length-1,f=l[0],$=l[a];for(;o<=i&&r<=a;)null==c?c=t[++o]:null==u?u=t[--i]:null==f?f=l[++r]:null==$?$=l[--a]:j(c,f)?(M(c,f),c=t[++o],f=l[++r]):j(u,$)?(M(u,$),u=t[--i],$=l[--a]):j(c,$)?(M(c,$),e.insertBefore(c.p,u.p.nextSibling),c=t[++o],$=l[--a]):j(u,f)?(M(u,f),e.insertBefore(u.p,c.p),u=t[--i],f=l[++r]):(s=w(t&&t[r],n,r),f=l[++r],s&&c.p.parentNode.insertBefore(s,c.p));o>i?S(e,null==l[a+1]?null:l[a+1].p,n,l,r,a):r>a&&g(t,o,i)})(n,l,t,s):null!==s?(null!==e.i&&(n.textContent=""),S(n,null,t,s,0,s.length-1)):null!==l&&g(l,0,l.length-1)):e.i!==o&&(n.data=o)},v=e=>{e.u&&e.u.ref&&e.u.ref(null),e.$&&e.$.map(v)},k=(e,t)=>{t&&!e.m&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.m=t)))},C=(e,t)=>{if(e.t|=16,!(4&e.t))return k(e,e.S),Y((()=>O(e,t)));e.t|=512},O=(e,t)=>{const n=e.g;let l;return t&&(l=N(n,"componentWillLoad")),R(l,(()=>P(e,n,t)))},P=async(e,t,n)=>{const l=e.j,o=l["s-rc"];n&&(e=>{const t=e.M,n=e.j,l=t.t,o=((e,t)=>{let n=u(t),l=B.get(n);if(e=11===e.nodeType?e:s,l)if("string"==typeof l){let t,o=c.get(e=e.head||e);o||c.set(e,o=new Set),o.has(n)||(t=s.createElement("style"),t.innerHTML=l,e.insertBefore(t,e.querySelector("link")),o&&o.add(n))}else e.adoptedStyleSheets.includes(l)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,l]);return n})(n.shadowRoot?n.shadowRoot:n.getRootNode(),t);10&l&&(n["s-sc"]=o,n.classList.add(o+"-h"))})(e);x(e,t),o&&(o.map((e=>e())),l["s-rc"]=void 0);{const t=l["s-p"],n=()=>E(e);0===t.length?n():(Promise.all(t).then(n),e.t|=4,t.length=0)}},x=(n,l)=>{try{l=l.render(),n.t&=-17,n.t|=2,((n,l)=>{const s=n.j,o=n.v||d(null,null),r=(e=>e&&e.h===h)(l)?l:$(null,null,l);t=s.tagName,r.h=null,r.t|=4,n.v=r,r.p=o.p=s.shadowRoot||s,e=s["s-sc"],M(o,r)})(n,l)}catch(e){V(e,n.j)}return null},E=e=>{const t=e.j,n=e.S;N(e.g,"componentDidRender"),64&e.t||(e.t|=64,T(t),e.k(t),n||L()),e.m&&(e.m(),e.m=void 0),512&e.t&&X((()=>C(e,!1))),e.t&=-517},L=()=>{T(s.documentElement),X((()=>(e=>{const t=o.ce("appload",{detail:{namespace:"blog-article-details"}});return e.dispatchEvent(t),t})(l)))},N=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){V(e)}},R=(e,t)=>e&&e.then?e.then(t):t(),T=e=>e.classList.add("hydrated"),W=(e,t,n)=>{if(t.C){const l=Object.entries(t.C),s=e.prototype;if(l.map((([e,[l]])=>{(31&l||2&n&&32&l)&&Object.defineProperty(s,e,{get(){return((e,t)=>U(this).O.get(t))(0,e)},set(n){((e,t,n,l)=>{const s=U(e),o=s.O.get(t),r=s.t,i=s.g;n=((e,t)=>null==e||f(e)?e:4&t?"false"!==e&&(""===e||!!e):2&t?parseFloat(e):1&t?e+"":e)(n,l.C[t][0]),8&r&&void 0!==o||n===o||Number.isNaN(o)&&Number.isNaN(n)||(s.O.set(t,n),i&&2==(18&r)&&C(s,!1))})(this,e,n,t)},configurable:!0,enumerable:!0})})),1&n){const t=new Map;s.attributeChangedCallback=function(e,n,l){o.jmp((()=>{const n=t.get(e);if(this.hasOwnProperty(n))l=this[n],delete this[n];else if(s.hasOwnProperty(n)&&"number"==typeof this[n]&&this[n]==l)return;this[n]=(null!==l||"boolean"!=typeof this[n])&&l}))},e.observedAttributes=l.filter((([e,t])=>15&t[0])).map((([e,n])=>{const l=n[1]||e;return t.set(l,e),l}))}}return e},A=(e,t={})=>{const n=[],r=t.exclude||[],c=l.customElements,a=s.head,f=a.querySelector("meta[charset]"),$=s.createElement("style"),d=[];let h,p=!0;Object.assign(o,t),o.l=new URL(t.resourcesUrl||"./",s.baseURI).href,e.map((e=>{e[1].map((t=>{const l={t:t[0],o:t[1],C:t[2],P:t[3]};l.C=t[2];const s=l.o,a=class extends HTMLElement{constructor(e){super(e),D(e=this,l),1&l.t&&e.attachShadow({mode:"open"})}connectedCallback(){h&&(clearTimeout(h),h=null),p?d.push(this):o.jmp((()=>(e=>{if(0==(1&o.t)){const t=U(e),n=t.M,l=()=>{};if(!(1&t.t)){t.t|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){k(t,t.S=n);break}}n.C&&Object.entries(n.C).map((([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}})),(async(e,t,n,l,s)=>{if(0==(32&t.t)){{if(t.t|=32,(s=z(n)).then){const e=()=>{};s=await s,e()}s.isProxied||(W(s,n,2),s.isProxied=!0);const e=()=>{};t.t|=8;try{new s(t)}catch(e){V(e)}t.t&=-9,e()}if(s.style){let e=s.style;const t=u(n);if(!B.has(t)){const l=()=>{};((e,t,n)=>{let l=B.get(e);i&&n?(l=l||new CSSStyleSheet,l.replace(t)):l=t,B.set(e,l)})(t,e,!!(1&n.t)),l()}}}const o=t.S,r=()=>C(t,!0);o&&o["s-rc"]?o["s-rc"].push(r):r()})(0,t,n)}l()}})(this)))}disconnectedCallback(){o.jmp((()=>{}))}componentOnReady(){return U(this).L}};l.N=e[0],r.includes(s)||c.get(s)||(n.push(s),c.define(s,W(a,l,1)))}))})),$.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",$.setAttribute("data-styles",""),a.insertBefore($,f?f.nextSibling:a.firstChild),p=!1,d.length?d.map((e=>e.connectedCallback())):o.jmp((()=>h=setTimeout(L,30)))},F=new WeakMap,U=e=>F.get(e),q=(e,t)=>F.set(t.g=e,t),D=(e,t)=>{const n={t:0,j:e,M:t,O:new Map};return n.L=new Promise((e=>n.k=e)),e["s-p"]=[],e["s-rc"]=[],F.set(e,n)},H=(e,t)=>t in e,V=(e,t)=>(0,console.error)(e,t),_=new Map,z=e=>{const t=e.o.replace(/-/g,"_"),n=e.N,l=_.get(n);return l?l[t]:import(`./${n}.entry.js`).then((e=>(_.set(n,e),e[t])),V)},B=new Map,G=[],I=[],J=(e,t)=>l=>{e.push(l),n||(n=!0,t&&4&o.t?X(Q):o.raf(Q))},K=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){V(e)}e.length=0},Q=()=>{K(G),K(I),(n=G.length>0)&&o.raf(Q)},X=e=>r().then(e),Y=J(I,!0);export{A as b,$ as h,r as p,q as r}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-df694837.js');
|
|
6
|
+
|
|
7
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
8
|
+
const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar'];
|
|
9
|
+
const TRANSLATIONS = {
|
|
10
|
+
en: {
|
|
11
|
+
error: 'Error',
|
|
12
|
+
},
|
|
13
|
+
ro: {
|
|
14
|
+
error: 'Eroare',
|
|
15
|
+
},
|
|
16
|
+
fr: {
|
|
17
|
+
error: 'Error',
|
|
18
|
+
},
|
|
19
|
+
ar: {
|
|
20
|
+
error: 'خطأ',
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
const translate = (key, customLang) => {
|
|
24
|
+
const lang = customLang;
|
|
25
|
+
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const blogArticleDetailsCss = ":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}\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}";
|
|
29
|
+
|
|
30
|
+
const BlogArticleDetails = class {
|
|
31
|
+
constructor(hostRef) {
|
|
32
|
+
index.registerInstance(this, hostRef);
|
|
33
|
+
/**
|
|
34
|
+
* Language of the widget
|
|
35
|
+
*/
|
|
36
|
+
this.language = 'en';
|
|
37
|
+
/**
|
|
38
|
+
* Client custom styling via string
|
|
39
|
+
*/
|
|
40
|
+
this.clientStyling = '';
|
|
41
|
+
/**
|
|
42
|
+
* Client custom styling via url
|
|
43
|
+
*/
|
|
44
|
+
this.clientStylingurl = '';
|
|
45
|
+
/**
|
|
46
|
+
* Client custom styling via url content
|
|
47
|
+
*/
|
|
48
|
+
this.clientStylingUrlContent = '';
|
|
49
|
+
/**
|
|
50
|
+
* Property used to display the publishing date
|
|
51
|
+
*/
|
|
52
|
+
this.showPublishingDate = true;
|
|
53
|
+
/**
|
|
54
|
+
* Property used to display the image
|
|
55
|
+
*/
|
|
56
|
+
this.showImage = true;
|
|
57
|
+
/**
|
|
58
|
+
* Property used to display the image
|
|
59
|
+
*/
|
|
60
|
+
this.showTitle = true;
|
|
61
|
+
/**
|
|
62
|
+
* Property used to display the description
|
|
63
|
+
*/
|
|
64
|
+
this.showContent = true;
|
|
65
|
+
/**
|
|
66
|
+
* Event name to be sent when the button is clicked
|
|
67
|
+
*/
|
|
68
|
+
this.postMessageEvent = 'articleActionButton';
|
|
69
|
+
this.hasErrors = false;
|
|
70
|
+
this.limitStylingAppends = false;
|
|
71
|
+
this.isLoading = true;
|
|
72
|
+
this.setClientStyling = () => {
|
|
73
|
+
let sheet = document.createElement('style');
|
|
74
|
+
sheet.innerHTML = this.clientStyling;
|
|
75
|
+
this.stylingContainer.prepend(sheet);
|
|
76
|
+
};
|
|
77
|
+
this.setClientStylingURL = () => {
|
|
78
|
+
let url = new URL(this.clientStylingurl);
|
|
79
|
+
let cssFile = document.createElement('style');
|
|
80
|
+
fetch(url.href)
|
|
81
|
+
.then((res) => res.text())
|
|
82
|
+
.then((data) => {
|
|
83
|
+
this.clientStylingUrlContent = data;
|
|
84
|
+
cssFile.innerHTML = data;
|
|
85
|
+
setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
|
|
86
|
+
})
|
|
87
|
+
.catch((err) => {
|
|
88
|
+
console.log('error ', err);
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
getBlogArticleDetails() {
|
|
93
|
+
if (!this.postId && isNaN(this.postId)) {
|
|
94
|
+
this.hasErrors = true;
|
|
95
|
+
throw new Error('The postId parameter is missing!');
|
|
96
|
+
}
|
|
97
|
+
this.isLoading = true;
|
|
98
|
+
let url = new URL(`${this.cmsEndpoint}/${this.language}/blog-posts/${this.postId}`);
|
|
99
|
+
fetch(url.href)
|
|
100
|
+
.then((res) => {
|
|
101
|
+
if (res.status >= 300) {
|
|
102
|
+
this.hasErrors = true;
|
|
103
|
+
throw new Error('There was an error while fetching the data');
|
|
104
|
+
}
|
|
105
|
+
return res.json();
|
|
106
|
+
})
|
|
107
|
+
.then((blogContent) => {
|
|
108
|
+
this.blogData = blogContent;
|
|
109
|
+
this.isLoading = false;
|
|
110
|
+
})
|
|
111
|
+
.catch((err) => {
|
|
112
|
+
this.hasErrors = true;
|
|
113
|
+
console.log('Error', err);
|
|
114
|
+
})
|
|
115
|
+
.finally(() => this.isLoading = false);
|
|
116
|
+
}
|
|
117
|
+
componentDidRender() {
|
|
118
|
+
// start custom styling area
|
|
119
|
+
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
120
|
+
if (this.clientStyling)
|
|
121
|
+
this.setClientStyling();
|
|
122
|
+
if (this.clientStylingUrlContent)
|
|
123
|
+
this.setClientStylingURL();
|
|
124
|
+
this.limitStylingAppends = true;
|
|
125
|
+
}
|
|
126
|
+
// end custom styling area
|
|
127
|
+
}
|
|
128
|
+
componentWillLoad() {
|
|
129
|
+
this.getBlogArticleDetails();
|
|
130
|
+
}
|
|
131
|
+
render() {
|
|
132
|
+
if (this.hasErrors) {
|
|
133
|
+
return (index.h("div", { class: "BlogArticleDetails" }, index.h("div", { class: "Title" }, translate('error', this.language))));
|
|
134
|
+
}
|
|
135
|
+
if (!this.isLoading) {
|
|
136
|
+
return (index.h("div", { ref: el => this.stylingContainer = el }, index.h("div", { class: "GridContainer" }, this.showPublishingDate &&
|
|
137
|
+
index.h("div", { class: "BlogDate" }, this.blogData.publishingDate), this.showImage &&
|
|
138
|
+
index.h("div", { class: "BlogBanner" }, index.h("img", { src: this.blogData, alt: this.blogData.title })), this.showTitle &&
|
|
139
|
+
index.h("div", { class: "BlogTitle" }, this.blogData.title), this.showContent &&
|
|
140
|
+
index.h("div", { class: "BlogContent", innerHTML: this.blogData.content }))));
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
BlogArticleDetails.style = blogArticleDetailsCss;
|
|
145
|
+
|
|
146
|
+
exports.blog_article_details = BlogArticleDetails;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index-df694837.js');
|
|
4
|
+
|
|
5
|
+
/*
|
|
6
|
+
Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
|
|
7
|
+
*/
|
|
8
|
+
const patchBrowser = () => {
|
|
9
|
+
const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('blog-article-details.cjs.js', document.baseURI).href));
|
|
10
|
+
const opts = {};
|
|
11
|
+
if (importMeta !== '') {
|
|
12
|
+
opts.resourcesUrl = new URL('.', importMeta).href;
|
|
13
|
+
}
|
|
14
|
+
return index.promiseResolve(opts);
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
patchBrowser().then(options => {
|
|
18
|
+
return index.bootstrapLazy([["blog-article-details.cjs",[[1,"blog-article-details",{"cmsEndpoint":[1,"cms-endpoint"],"language":[1],"handleClick":[1,"handle-click"],"clientStyling":[1,"client-styling"],"clientStylingurl":[1,"client-stylingurl"],"clientStylingUrlContent":[1,"client-styling-url-content"],"showPublishingDate":[4,"show-publishing-date"],"showImage":[4,"show-image"],"showTitle":[4,"show-title"],"showContent":[4,"show-content"],"postMessageEvent":[1,"post-message-event"],"postId":[2,"post-id"],"hasErrors":[32],"limitStylingAppends":[32],"isLoading":[32]}]]]], options);
|
|
19
|
+
});
|