@everymatrix/blog-article-details 1.10.8 → 1.10.10

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.
Files changed (48) hide show
  1. package/dist/blog-article-details/blog-article-details.esm.js +1 -0
  2. package/dist/blog-article-details/index.esm.js +0 -0
  3. package/dist/blog-article-details/p-1309d7c4.js +1 -0
  4. package/dist/blog-article-details/p-32b7169e.entry.js +1 -0
  5. package/dist/cjs/blog-article-details.cjs.entry.js +158 -0
  6. package/dist/cjs/blog-article-details.cjs.js +19 -0
  7. package/dist/cjs/index-1bd1306a.js +1159 -0
  8. package/dist/cjs/index.cjs.js +2 -0
  9. package/dist/cjs/loader.cjs.js +21 -0
  10. package/dist/collection/collection-manifest.json +12 -0
  11. package/dist/collection/components/blog-article-details/blog-article-details.css +51 -0
  12. package/dist/collection/components/blog-article-details/blog-article-details.js +365 -0
  13. package/dist/collection/index.js +1 -0
  14. package/dist/collection/utils/locale.utils.js +20 -0
  15. package/dist/collection/utils/utils.js +0 -0
  16. package/dist/components/blog-article-details.d.ts +11 -0
  17. package/dist/components/blog-article-details.js +188 -0
  18. package/dist/components/index.d.ts +26 -0
  19. package/dist/components/index.js +1 -0
  20. package/dist/esm/blog-article-details.entry.js +154 -0
  21. package/dist/esm/blog-article-details.js +17 -0
  22. package/dist/esm/index-645c241e.js +1134 -0
  23. package/dist/esm/index.js +1 -0
  24. package/dist/esm/loader.js +17 -0
  25. package/dist/esm/polyfills/core-js.js +11 -0
  26. package/dist/esm/polyfills/css-shim.js +1 -0
  27. package/dist/esm/polyfills/dom.js +79 -0
  28. package/dist/esm/polyfills/es5-html-element.js +1 -0
  29. package/dist/esm/polyfills/index.js +34 -0
  30. package/dist/esm/polyfills/system.js +6 -0
  31. package/dist/index.cjs.js +1 -0
  32. package/dist/index.js +1 -0
  33. package/dist/stencil.config.js +22 -0
  34. package/dist/types/Users/user/workspace/everymatrix/widgets-stencil/packages/blog-article-details/.stencil/packages/blog-article-details/stencil.config.d.ts +2 -0
  35. package/dist/types/components/blog-article-details/blog-article-details.d.ts +62 -0
  36. package/dist/types/components.d.ts +133 -0
  37. package/dist/types/index.d.ts +1 -0
  38. package/dist/types/stencil-public-runtime.d.ts +1565 -0
  39. package/dist/types/utils/locale.utils.d.ts +1 -0
  40. package/dist/types/utils/utils.d.ts +0 -0
  41. package/loader/cdn.js +3 -0
  42. package/loader/index.cjs.js +3 -0
  43. package/loader/index.d.ts +12 -0
  44. package/loader/index.es2017.js +3 -0
  45. package/loader/index.js +4 -0
  46. package/loader/package.json +10 -0
  47. package/package.json +2 -6
  48. package/LICENSE +0 -21
@@ -0,0 +1 @@
1
+ import{p as t,b as n}from"./p-1309d7c4.js";(()=>{const n=import.meta.url,e={};return""!==n&&(e.resourcesUrl=new URL(".",n).href),t(e)})().then((t=>n([["p-32b7169e",[[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
+ 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),c=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replace}catch(e){}return!1})(),i=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 c=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?c(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(c(n),t){const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}const i=d(e,null);return i.u=t,r.length>0&&(i.$=r),i},d=(e,t)=>({t:0,h:e,i:t,p:null,$:null,u:null}),h={},y=(e,t,n,l,s,o)=>{if(n!==l){let r=V(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 c=f(l);if((r||c&&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)&&!c&&e.setAttribute(t,l=!0===l?"":l)}}},p=/\s/,m=e=>e?e.split(p):[],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||y(s,l,o[l],void 0,n,t.t);for(l in r)y(s,l,o[l],r[l],n,t.t)},w=(t,n,l)=>{let o,r,c=n.$[l],i=0;if(null!==c.i)o=c.p=s.createTextNode(c.i);else if(o=c.p=s.createElement(c.h),b(null,c,!1),null!=e&&o["s-si"]!==e&&o.classList.add(o["s-si"]=e),c.$)for(i=0;i<c.$.length;++i)r=w(t,c,i),r&&o.appendChild(r);return o},S=(e,n,l,s,o,r)=>{let c,i=e;for(i.shadowRoot&&i.tagName===t&&(i=i.shadowRoot);o<=r;++o)s[o]&&(c=w(null,l,o),c&&(s[o].p=c,i.insertBefore(c,n)))},g=(e,t,n,l,s)=>{for(;t<=n;++t)(l=e[t])&&(s=l.p,M(l),s.remove())},j=(e,t)=>e.h===t.h,v=(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,c=t.length-1,i=t[0],u=t[c],a=l.length-1,f=l[0],$=l[a];for(;o<=c&&r<=a;)null==i?i=t[++o]:null==u?u=t[--c]:null==f?f=l[++r]:null==$?$=l[--a]:j(i,f)?(v(i,f),i=t[++o],f=l[++r]):j(u,$)?(v(u,$),u=t[--c],$=l[--a]):j(i,$)?(v(i,$),e.insertBefore(i.p,u.p.nextSibling),i=t[++o],$=l[--a]):j(u,f)?(v(u,f),e.insertBefore(u.p,i.p),u=t[--c],f=l[++r]):(s=w(t&&t[r],n,r),f=l[++r],s&&i.p.parentNode.insertBefore(s,i.p));o>c?S(e,null==l[a+1]?null:l[a+1].p,n,l,r,a):r>a&&g(t,o,c)})(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)},M=e=>{e.u&&e.u.ref&&e.u.ref(null),e.$&&e.$.map(M)},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),Z((()=>O(e,t)));e.t|=512},O=(e,t)=>{const n=e.g;return T(void 0,(()=>P(e,n,t)))},P=async(e,t,n)=>{const l=e.j,o=l["s-rc"];n&&(e=>{const t=e.v,n=e.j,l=t.t,o=((e,t)=>{let n=u(t),l=G.get(n);if(e=11===e.nodeType?e:s,l)if("string"==typeof l){let t,o=i.get(e=e.head||e);o||i.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.M||d(null,null),r=(e=>e&&e.h===h)(l)?l:$(null,null,l);t=s.tagName,r.h=null,r.t|=4,n.M=r,r.p=o.p=s.shadowRoot||s,e=s["s-sc"],v(o,r)})(n,l)}catch(e){_(e,n.j)}return null},E=e=>{const t=e.j,n=e.S;R(e.g,"componentDidRender"),64&e.t||(e.t|=64,A(t),e.k(t),n||N()),e.m&&(e.m(),e.m=void 0),512&e.t&&Y((()=>C(e,!1))),e.t&=-517},N=()=>{A(s.documentElement),Y((()=>(e=>{const t=o.ce("appload",{detail:{namespace:"blog-article-details"}});return e.dispatchEvent(t),t})(l)))},R=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){_(e)}},T=(e,t)=>e&&e.then?e.then(t):t(),A=e=>e.classList.add("hydrated"),F=(e,t,n)=>{if(t.C){e.watchers&&(t.O=e.watchers);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)=>q(this).P.get(t))(0,e)},set(n){((e,t,n,l)=>{const s=q(e),o=s.j,r=s.P.get(t),c=s.t,i=s.g;if(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&c)||void 0===r)&&n!==r&&(!Number.isNaN(r)||!Number.isNaN(n))&&(s.P.set(t,n),i)){if(l.O&&128&c){const e=l.O[t];e&&e.map((e=>{try{i[e](n,r,t)}catch(e){_(e,o)}}))}2==(18&c)&&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},L=e=>{R(e,"connectedCallback")},U=(e,t={})=>{const n=[],r=t.exclude||[],i=l.customElements,a=s.head,f=a.querySelector("meta[charset]"),$=s.createElement("style"),d=[];let h,y=!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],N:t[3]};l.C=t[2],l.O={};const s=l.o,a=class extends HTMLElement{constructor(e){super(e),H(e=this,l),1&l.t&&e.attachShadow({mode:"open"})}connectedCallback(){h&&(clearTimeout(h),h=null),y?d.push(this):o.jmp((()=>(e=>{if(0==(1&o.t)){const t=q(e),n=t.v,l=()=>{};if(1&t.t)L(t.g);else{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=B(n)).then){const e=()=>{};s=await s,e()}s.isProxied||(n.O=s.watchers,F(s,n,2),s.isProxied=!0);const e=()=>{};t.t|=8;try{new s(t)}catch(e){_(e)}t.t&=-9,t.t|=128,e(),L(t.g)}if(s.style){let e=s.style;const t=u(n);if(!G.has(t)){const l=()=>{};((e,t,n)=>{let l=G.get(e);c&&n?(l=l||new CSSStyleSheet,l.replace(t)):l=t,G.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 q(this).R}};l.T=e[0],r.includes(s)||i.get(s)||(n.push(s),i.define(s,F(a,l,1)))}))})),$.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",$.setAttribute("data-styles",""),a.insertBefore($,f?f.nextSibling:a.firstChild),y=!1,d.length?d.map((e=>e.connectedCallback())):o.jmp((()=>h=setTimeout(N,30)))},W=new WeakMap,q=e=>W.get(e),D=(e,t)=>W.set(t.g=e,t),H=(e,t)=>{const n={t:0,j:e,v:t,P:new Map};return n.R=new Promise((e=>n.k=e)),e["s-p"]=[],e["s-rc"]=[],W.set(e,n)},V=(e,t)=>t in e,_=(e,t)=>(0,console.error)(e,t),z=new Map,B=e=>{const t=e.o.replace(/-/g,"_"),n=e.T,l=z.get(n);return l?l[t]:import(`./${n}.entry.js`).then((e=>(z.set(n,e),e[t])),_)},G=new Map,I=[],J=[],K=(e,t)=>l=>{e.push(l),n||(n=!0,t&&4&o.t?Y(X):o.raf(X))},Q=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){_(e)}e.length=0},X=()=>{Q(I),Q(J),(n=I.length>0)&&o.raf(X)},Y=e=>r().then(e),Z=K(J,!0);export{U as b,$ as h,r as p,D as r}
@@ -0,0 +1 @@
1
+ import{r as t,h as i}from"./p-1309d7c4.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)}))}}watchEndpoint(t,i){t&&t!=i&&this.cmsEndpoint&&this.getBlogArticleDetails()}connectedCallback(){this.cmsEndpoint&&this.language&&this.getBlogArticleDetails()}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.blogData.publishingDate=new Date(this.blogData.publishingDate).toLocaleDateString(),this.isLoading=!1})).catch((t=>{this.hasErrors=!0,console.log("Error",t)})).finally((()=>this.isLoading=!1))}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrlContent&&this.setClientStylingURL(),this.limitStylingAppends=!0)}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.image.src,alt:this.blogData.title})),this.showTitle&&i("div",{class:"BlogTitle"},this.blogData.title),this.showContent&&i("div",{class:"BlogContent",innerHTML:this.blogData.content})))}static get watchers(){return{cmsEndpoint:["watchEndpoint"],language:["watchEndpoint"]}}};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,158 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-1bd1306a.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
+ watchEndpoint(newValue, oldValue) {
93
+ if (newValue && newValue != oldValue && this.cmsEndpoint) {
94
+ this.getBlogArticleDetails();
95
+ }
96
+ }
97
+ connectedCallback() {
98
+ if (this.cmsEndpoint && this.language) {
99
+ this.getBlogArticleDetails();
100
+ }
101
+ }
102
+ getBlogArticleDetails() {
103
+ if (!this.postId && isNaN(this.postId)) {
104
+ this.hasErrors = true;
105
+ throw new Error('The postId parameter is missing!');
106
+ }
107
+ this.isLoading = true;
108
+ let url = new URL(`${this.cmsEndpoint}/${this.language}/blog-posts/${this.postId}`);
109
+ fetch(url.href)
110
+ .then((res) => {
111
+ if (res.status >= 300) {
112
+ this.hasErrors = true;
113
+ throw new Error('There was an error while fetching the data');
114
+ }
115
+ return res.json();
116
+ })
117
+ .then((blogContent) => {
118
+ this.blogData = blogContent;
119
+ this.blogData.publishingDate = new Date(this.blogData.publishingDate).toLocaleDateString();
120
+ this.isLoading = false;
121
+ })
122
+ .catch((err) => {
123
+ this.hasErrors = true;
124
+ console.log('Error', err);
125
+ })
126
+ .finally(() => this.isLoading = false);
127
+ }
128
+ componentDidRender() {
129
+ // start custom styling area
130
+ if (!this.limitStylingAppends && this.stylingContainer) {
131
+ if (this.clientStyling)
132
+ this.setClientStyling();
133
+ if (this.clientStylingUrlContent)
134
+ this.setClientStylingURL();
135
+ this.limitStylingAppends = true;
136
+ }
137
+ // end custom styling area
138
+ }
139
+ render() {
140
+ if (this.hasErrors) {
141
+ return (index.h("div", { class: "BlogArticleDetails" }, index.h("div", { class: "Title" }, translate('error', this.language))));
142
+ }
143
+ if (!this.isLoading) {
144
+ return (index.h("div", { ref: el => this.stylingContainer = el }, index.h("div", { class: "GridContainer" }, this.showPublishingDate &&
145
+ index.h("div", { class: "BlogDate" }, this.blogData.publishingDate), this.showImage &&
146
+ index.h("div", { class: "BlogBanner" }, index.h("img", { src: this.blogData.image.src, alt: this.blogData.title })), this.showTitle &&
147
+ index.h("div", { class: "BlogTitle" }, this.blogData.title), this.showContent &&
148
+ index.h("div", { class: "BlogContent", innerHTML: this.blogData.content }))));
149
+ }
150
+ }
151
+ static get watchers() { return {
152
+ "cmsEndpoint": ["watchEndpoint"],
153
+ "language": ["watchEndpoint"]
154
+ }; }
155
+ };
156
+ BlogArticleDetails.style = blogArticleDetailsCss;
157
+
158
+ exports.blog_article_details = BlogArticleDetails;
@@ -0,0 +1,19 @@
1
+ 'use strict';
2
+
3
+ const index = require('./index-1bd1306a.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
+ });