@everymatrix/blog-article-details 1.34.2 → 1.34.3
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/LICENSE +21 -0
- package/package.json +1 -1
- package/dist/blog-article-details/blog-article-details.esm.js +0 -1
- package/dist/blog-article-details/index.esm.js +0 -0
- package/dist/blog-article-details/p-68e0210a.js +0 -1
- package/dist/blog-article-details/p-6ad174c5.entry.js +0 -1
- package/dist/cjs/blog-article-details.cjs.entry.js +0 -274
- package/dist/cjs/blog-article-details.cjs.js +0 -19
- package/dist/cjs/index-d983d0f8.js +0 -1255
- package/dist/cjs/index.cjs.js +0 -2
- package/dist/cjs/loader.cjs.js +0 -21
- package/dist/collection/collection-manifest.json +0 -12
- package/dist/collection/components/blog-article-details/blog-article-details.css +0 -47
- package/dist/collection/components/blog-article-details/blog-article-details.js +0 -482
- package/dist/collection/index.js +0 -1
- package/dist/collection/utils/locale.utils.js +0 -29
- package/dist/collection/utils/utils.js +0 -59
- package/dist/components/blog-article-details.d.ts +0 -11
- package/dist/components/blog-article-details.js +0 -308
- package/dist/components/index.d.ts +0 -26
- package/dist/components/index.js +0 -1
- package/dist/esm/blog-article-details.entry.js +0 -270
- package/dist/esm/blog-article-details.js +0 -17
- package/dist/esm/index-a6d43dfd.js +0 -1230
- package/dist/esm/index.js +0 -1
- package/dist/esm/loader.js +0 -17
- package/dist/esm/polyfills/core-js.js +0 -11
- package/dist/esm/polyfills/css-shim.js +0 -1
- package/dist/esm/polyfills/dom.js +0 -79
- package/dist/esm/polyfills/es5-html-element.js +0 -1
- package/dist/esm/polyfills/index.js +0 -34
- package/dist/esm/polyfills/system.js +0 -6
- package/dist/index.cjs.js +0 -1
- package/dist/index.js +0 -1
- package/dist/stencil.config.js +0 -22
- 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 +0 -2
- package/dist/types/components/blog-article-details/blog-article-details.d.ts +0 -78
- package/dist/types/components.d.ts +0 -149
- package/dist/types/index.d.ts +0 -1
- package/dist/types/stencil-public-runtime.d.ts +0 -1565
- package/dist/types/utils/locale.utils.d.ts +0 -1
- package/dist/types/utils/utils.d.ts +0 -4
- package/loader/cdn.js +0 -3
- package/loader/index.cjs.js +0 -3
- package/loader/index.d.ts +0 -12
- package/loader/index.es2017.js +0 -3
- package/loader/index.js +0 -4
- package/loader/package.json +0 -10
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
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-6ad174c5",[[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)));
|
|
File without changes
|
|
@@ -1 +0,0 @@
|
|
|
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)},c=e=>Promise.resolve(e),i=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replace}catch(e){}return!1})(),r=(e,t,n)=>{n&&n.map((([n,l,s])=>{const c=a(e,n),i=u(t,s),r=f(n);o.ael(c,l,i,r),(t.o=t.o||[]).push((()=>o.rel(c,l,i,r)))}))},u=(e,t)=>n=>{try{256&e.t?e.i[t](n):(e.u=e.u||[]).push([t,n])}catch(e){I(e)}},a=(e,t)=>8&t?l:e,f=e=>0!=(2&e),d=new WeakMap,h=e=>"sc-"+e.h,y={},$=e=>"object"==(e=typeof e)||"function"===e,p=(e,t,...n)=>{let l=null,s=!1,o=!1,c=[];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&&!$(l))&&(l+=""),s&&o?c[c.length-1].$+=l:c.push(s?m(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 r=m(e,null);return r.p=t,c.length>0&&(r.m=c),r},m=(e,t)=>({t:0,S:e,$:t,g:null,m:null,p:null}),b={},w=(e,t,n,l,s,o)=>{if(n!==l){let c=G(e,t);if(t.toLowerCase(),"class"===t){const t=e.classList,s=g(n),o=g(l);t.remove(...s.filter((e=>e&&!o.includes(e)))),t.add(...o.filter((e=>e&&!s.includes(e))))}else if("style"===t){for(const t in n)l&&null!=l[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in l)n&&l[t]===n[t]||(t.includes("-")?e.style.setProperty(t,l[t]):e.style[t]=l[t])}else if("ref"===t)l&&l(e);else{const i=$(l);if((c||i&&null!==l)&&!s)try{if(e.tagName.includes("-"))e[t]=l;else{let s=null==l?"":l;"list"===t?c=!1:null!=n&&e[t]==s||(e[t]=s)}}catch(e){}null==l||!1===l?!1===l&&""!==e.getAttribute(t)||e.removeAttribute(t):(!c||4&o||s)&&!i&&e.setAttribute(t,l=!0===l?"":l)}}},S=/\s/,g=e=>e?e.split(S):[],j=(e,t,n,l)=>{const s=11===t.g.nodeType&&t.g.host?t.g.host:t.g,o=e&&e.p||y,c=t.p||y;for(l in o)l in c||w(s,l,o[l],void 0,n,t.t);for(l in c)w(s,l,o[l],c[l],n,t.t)},v=(t,n,l)=>{let o,c,i=n.m[l],r=0;if(null!==i.$)o=i.g=s.createTextNode(i.$);else if(o=i.g=s.createElement(i.S),j(null,i,!1),null!=e&&o["s-si"]!==e&&o.classList.add(o["s-si"]=e),i.m)for(r=0;r<i.m.length;++r)c=v(t,i,r),c&&o.appendChild(c);return o},M=(e,n,l,s,o,c)=>{let i,r=e;for(r.shadowRoot&&r.tagName===t&&(r=r.shadowRoot);o<=c;++o)s[o]&&(i=v(null,l,o),i&&(s[o].g=i,r.insertBefore(i,n)))},k=(e,t,n,l,s)=>{for(;t<=n;++t)(l=e[t])&&(s=l.g,P(l),s.remove())},C=(e,t)=>e.S===t.S,O=(e,t)=>{const n=t.g=e.g,l=e.m,s=t.m,o=t.$;null===o?(j(e,t,!1),null!==l&&null!==s?((e,t,n,l)=>{let s,o=0,c=0,i=t.length-1,r=t[0],u=t[i],a=l.length-1,f=l[0],d=l[a];for(;o<=i&&c<=a;)null==r?r=t[++o]:null==u?u=t[--i]:null==f?f=l[++c]:null==d?d=l[--a]:C(r,f)?(O(r,f),r=t[++o],f=l[++c]):C(u,d)?(O(u,d),u=t[--i],d=l[--a]):C(r,d)?(O(r,d),e.insertBefore(r.g,u.g.nextSibling),r=t[++o],d=l[--a]):C(u,f)?(O(u,f),e.insertBefore(u.g,r.g),u=t[--i],f=l[++c]):(s=v(t&&t[c],n,c),f=l[++c],s&&r.g.parentNode.insertBefore(s,r.g));o>i?M(e,null==l[a+1]?null:l[a+1].g,n,l,c,a):c>a&&k(t,o,i)})(n,l,t,s):null!==s?(null!==e.$&&(n.textContent=""),M(n,null,t,s,0,s.length-1)):null!==l&&k(l,0,l.length-1)):e.$!==o&&(n.data=o)},P=e=>{e.p&&e.p.ref&&e.p.ref(null),e.m&&e.m.map(P)},x=(e,t)=>{t&&!e.j&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.j=t)))},E=(e,t)=>{if(e.t|=16,!(4&e.t))return x(e,e.v),le((()=>L(e,t)));e.t|=512},L=(e,t)=>{const n=e.i;return t&&(e.t|=256,e.u&&(e.u.map((([e,t])=>D(n,e,t))),e.u=null)),F(void 0,(()=>N(e,n,t)))},N=async(e,t,n)=>{const l=e.M,o=l["s-rc"];n&&(e=>{const t=e.k,n=e.M,l=t.t,o=((e,t)=>{let n=h(t),l=Q.get(n);if(e=11===e.nodeType?e:s,l)if("string"==typeof l){let t,o=d.get(e=e.head||e);o||d.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);R(e,t),o&&(o.map((e=>e())),l["s-rc"]=void 0);{const t=l["s-p"],n=()=>T(e);0===t.length?n():(Promise.all(t).then(n),e.t|=4,t.length=0)}},R=(n,l)=>{try{l=l.render(),n.t&=-17,n.t|=2,((n,l)=>{const s=n.M,o=n.k,c=n.C||m(null,null),i=(e=>e&&e.S===b)(l)?l:p(null,null,l);t=s.tagName,o.O&&(i.p=i.p||{},o.O.map((([e,t])=>i.p[t]=s[e]))),i.S=null,i.t|=4,n.C=i,i.g=c.g=s.shadowRoot||s,e=s["s-sc"],O(c,i)})(n,l)}catch(e){I(e,n.M)}return null},T=e=>{const t=e.M,n=e.i,l=e.v;D(n,"componentDidRender"),64&e.t||(e.t|=64,U(t),D(n,"componentDidLoad"),e.P(t),l||A()),e.j&&(e.j(),e.j=void 0),512&e.t&&ne((()=>E(e,!1))),e.t&=-517},A=()=>{U(s.documentElement),ne((()=>(e=>{const t=o.ce("appload",{detail:{namespace:"blog-article-details"}});return e.dispatchEvent(t),t})(l)))},D=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){I(e)}},F=(e,t)=>e&&e.then?e.then(t):t(),U=e=>e.classList.add("hydrated"),W=(e,t,n)=>{if(t.L){e.watchers&&(t.N=e.watchers);const l=Object.entries(t.L),s=e.prototype;if(l.map((([e,[l]])=>{(31&l||2&n&&32&l)&&Object.defineProperty(s,e,{get(){return((e,t)=>_(this).R.get(t))(0,e)},set(n){((e,t,n,l)=>{const s=_(e),o=s.M,c=s.R.get(t),i=s.t,r=s.i;if(n=((e,t)=>null==e||$(e)?e:4&t?"false"!==e&&(""===e||!!e):2&t?parseFloat(e):1&t?e+"":e)(n,l.L[t][0]),(!(8&i)||void 0===c)&&n!==c&&(!Number.isNaN(c)||!Number.isNaN(n))&&(s.R.set(t,n),r)){if(l.N&&128&i){const e=l.N[t];e&&e.map((e=>{try{r[e](n,c,t)}catch(e){I(e,o)}}))}2==(18&i)&&E(s,!1)}})(this,e,n,t)},configurable:!0,enumerable:!0})})),1&n){const n=new Map;s.attributeChangedCallback=function(e,t,l){o.jmp((()=>{const t=n.get(e);if(this.hasOwnProperty(t))l=this[t],delete this[t];else if(s.hasOwnProperty(t)&&"number"==typeof this[t]&&this[t]==l)return;this[t]=(null!==l||"boolean"!=typeof this[t])&&l}))},e.observedAttributes=l.filter((([e,t])=>15&t[0])).map((([e,l])=>{const s=l[1]||e;return n.set(s,e),512&l[0]&&t.O.push([e,s]),s}))}}return e},q=e=>{D(e,"connectedCallback")},H=(e,t={})=>{const n=[],c=t.exclude||[],u=l.customElements,a=s.head,f=a.querySelector("meta[charset]"),d=s.createElement("style"),y=[];let $,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],h:t[1],L:t[2],T:t[3]};l.L=t[2],l.T=t[3],l.O=[],l.N={};const s=l.h,a=class extends HTMLElement{constructor(e){super(e),B(e=this,l),1&l.t&&e.attachShadow({mode:"open"})}connectedCallback(){$&&(clearTimeout($),$=null),p?y.push(this):o.jmp((()=>(e=>{if(0==(1&o.t)){const t=_(e),n=t.k,l=()=>{};if(1&t.t)r(e,t,n.T),q(t.i);else{t.t|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){x(t,t.v=n);break}}n.L&&Object.entries(n.L).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=K(n)).then){const e=()=>{};s=await s,e()}s.isProxied||(n.N=s.watchers,W(s,n,2),s.isProxied=!0);const e=()=>{};t.t|=8;try{new s(t)}catch(e){I(e)}t.t&=-9,t.t|=128,e(),q(t.i)}if(s.style){let e=s.style;const t=h(n);if(!Q.has(t)){const l=()=>{};((e,t,n)=>{let l=Q.get(e);i&&n?(l=l||new CSSStyleSheet,l.replace(t)):l=t,Q.set(e,l)})(t,e,!!(1&n.t)),l()}}}const o=t.v,c=()=>E(t,!0);o&&o["s-rc"]?o["s-rc"].push(c):c()})(0,t,n)}l()}})(this)))}disconnectedCallback(){o.jmp((()=>(()=>{if(0==(1&o.t)){const e=_(this);e.o&&(e.o.map((e=>e())),e.o=void 0)}})()))}componentOnReady(){return _(this).A}};l.D=e[0],c.includes(s)||u.get(s)||(n.push(s),u.define(s,W(a,l,1)))}))})),d.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",d.setAttribute("data-styles",""),a.insertBefore(d,f?f.nextSibling:a.firstChild),p=!1,y.length?y.map((e=>e.connectedCallback())):o.jmp((()=>$=setTimeout(A,30)))},V=new WeakMap,_=e=>V.get(e),z=(e,t)=>V.set(t.i=e,t),B=(e,t)=>{const n={t:0,M:e,k:t,R:new Map};return n.A=new Promise((e=>n.P=e)),e["s-p"]=[],e["s-rc"]=[],r(e,n,t.T),V.set(e,n)},G=(e,t)=>t in e,I=(e,t)=>(0,console.error)(e,t),J=new Map,K=e=>{const t=e.h.replace(/-/g,"_"),n=e.D,l=J.get(n);return l?l[t]:import(`./${n}.entry.js`).then((e=>(J.set(n,e),e[t])),I)},Q=new Map,X=[],Y=[],Z=(e,t)=>l=>{e.push(l),n||(n=!0,t&&4&o.t?ne(te):o.raf(te))},ee=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){I(e)}e.length=0},te=()=>{ee(X),ee(Y),(n=X.length>0)&&o.raf(te)},ne=e=>c().then(e),le=Z(Y,!0);export{H as b,p as h,c as p,z as r}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as t,h as i}from"./p-68e0210a.js";const e=["ro","en","fr","ar","hr"],n={en:{error:"Error"},ro:{error:"Eroare"},fr:{error:"Error"},ar:{error:"خطأ"},hr:{error:"Greška"},"pt-br":{error:"Erro"},"es-mx":{error:"Error"}};const s=class{constructor(e){t(this,e),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.language&&(this.postCustomPath||this.postSlug||this.postId)&&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),e=0;for(let n=1;n<t.items.length;n++){const s=new Date(t.items[n].publishingDate);i.getTime()<s.getTime()&&(i=s,e=n)}this.blogData=t.items[e]}else 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.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 n[void 0!==t&&e.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&&this.blogData.publishingDate&&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}
|
|
@@ -1,274 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const index = require('./index-d983d0f8.js');
|
|
6
|
-
|
|
7
|
-
const DEFAULT_LANGUAGE = 'en';
|
|
8
|
-
const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hr'];
|
|
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
|
-
hr: {
|
|
23
|
-
error: 'Greška',
|
|
24
|
-
},
|
|
25
|
-
'pt-br': {
|
|
26
|
-
error: 'Erro'
|
|
27
|
-
},
|
|
28
|
-
'es-mx': {
|
|
29
|
-
error: 'Error'
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
const translate = (key, customLang) => {
|
|
33
|
-
const lang = customLang;
|
|
34
|
-
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const getDevice = () => {
|
|
38
|
-
let userAgent = window.navigator.userAgent;
|
|
39
|
-
if (userAgent.toLowerCase().match(/android/i)) {
|
|
40
|
-
return 'Android';
|
|
41
|
-
}
|
|
42
|
-
if (userAgent.toLowerCase().match(/iphone/i)) {
|
|
43
|
-
return 'iPhone';
|
|
44
|
-
}
|
|
45
|
-
if (userAgent.toLowerCase().match(/ipad|ipod/i)) {
|
|
46
|
-
return 'iPad';
|
|
47
|
-
}
|
|
48
|
-
return 'PC';
|
|
49
|
-
};
|
|
50
|
-
function checkCustomDeviceWidth() {
|
|
51
|
-
const width = screen.availWidth;
|
|
52
|
-
if (width < 600) {
|
|
53
|
-
return 'mobile';
|
|
54
|
-
}
|
|
55
|
-
else if (width >= 600 && width < 1100) {
|
|
56
|
-
return 'tablet';
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
function getDeviceCustom() {
|
|
60
|
-
const userAgent = navigator.userAgent.toLowerCase();
|
|
61
|
-
let source = '';
|
|
62
|
-
source = (userAgent.includes('android') || userAgent.includes('iphone') || userAgent.includes('ipad')) ? checkCustomDeviceWidth() : 'desktop';
|
|
63
|
-
return source;
|
|
64
|
-
}
|
|
65
|
-
const getDevicePlatform = () => {
|
|
66
|
-
const device = getDevice();
|
|
67
|
-
if (device) {
|
|
68
|
-
if (device === 'PC') {
|
|
69
|
-
return 'dk';
|
|
70
|
-
}
|
|
71
|
-
else if (device === 'iPad' || device === 'iPhone') {
|
|
72
|
-
return 'mtWeb';
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
return 'mtWeb';
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
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}";
|
|
81
|
-
|
|
82
|
-
const BlogArticleDetails = class {
|
|
83
|
-
constructor(hostRef) {
|
|
84
|
-
index.registerInstance(this, hostRef);
|
|
85
|
-
/**
|
|
86
|
-
* Language of the widget
|
|
87
|
-
*/
|
|
88
|
-
this.language = 'en';
|
|
89
|
-
/**
|
|
90
|
-
* User roles
|
|
91
|
-
*/
|
|
92
|
-
this.userRoles = 'everyone';
|
|
93
|
-
/**
|
|
94
|
-
* CMS Endpoint stage
|
|
95
|
-
*/
|
|
96
|
-
this.cmsEnv = 'stage';
|
|
97
|
-
/**
|
|
98
|
-
* Client custom styling via string
|
|
99
|
-
*/
|
|
100
|
-
this.clientStyling = '';
|
|
101
|
-
/**
|
|
102
|
-
* Client custom styling via url
|
|
103
|
-
*/
|
|
104
|
-
this.clientStylingUrl = '';
|
|
105
|
-
/**
|
|
106
|
-
* Property used to display the publishing date
|
|
107
|
-
*/
|
|
108
|
-
this.showPublishingDate = true;
|
|
109
|
-
/**
|
|
110
|
-
* Property used to display the image
|
|
111
|
-
*/
|
|
112
|
-
this.showImage = true;
|
|
113
|
-
/**
|
|
114
|
-
* Property used to display the image
|
|
115
|
-
*/
|
|
116
|
-
this.showTitle = true;
|
|
117
|
-
/**
|
|
118
|
-
* Property used to display the description
|
|
119
|
-
*/
|
|
120
|
-
this.showContent = true;
|
|
121
|
-
/**
|
|
122
|
-
* Intl date format
|
|
123
|
-
*/
|
|
124
|
-
this.intlDateTimeFormat = '';
|
|
125
|
-
this.hasErrors = false;
|
|
126
|
-
this.limitStylingAppends = false;
|
|
127
|
-
this.isLoading = true;
|
|
128
|
-
this.bannerMatrixReady = false;
|
|
129
|
-
this.device = '';
|
|
130
|
-
this.setClientStyling = () => {
|
|
131
|
-
let sheet = document.createElement('style');
|
|
132
|
-
sheet.innerHTML = this.clientStyling;
|
|
133
|
-
this.stylingContainer.prepend(sheet);
|
|
134
|
-
};
|
|
135
|
-
this.setClientStylingURL = () => {
|
|
136
|
-
let url = new URL(this.clientStylingUrl);
|
|
137
|
-
let cssFile = document.createElement('style');
|
|
138
|
-
fetch(url.href)
|
|
139
|
-
.then((res) => res.text())
|
|
140
|
-
.then((data) => {
|
|
141
|
-
cssFile.innerHTML = data;
|
|
142
|
-
setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
|
|
143
|
-
})
|
|
144
|
-
.catch((err) => {
|
|
145
|
-
console.log('Error ', err);
|
|
146
|
-
});
|
|
147
|
-
};
|
|
148
|
-
this.renderContentConditionally = (content) => {
|
|
149
|
-
const hasBanner = (content === null || content === void 0 ? void 0 : content.indexOf('<bannermatrix-banner')) !== -1;
|
|
150
|
-
if (!hasBanner) {
|
|
151
|
-
return index.h("div", { class: "BlogContent", innerHTML: content });
|
|
152
|
-
}
|
|
153
|
-
if (this.bannerMatrixReady) {
|
|
154
|
-
return index.h("div", { class: "BlogContent", innerHTML: content });
|
|
155
|
-
}
|
|
156
|
-
return null;
|
|
157
|
-
};
|
|
158
|
-
this.setImage = (image) => {
|
|
159
|
-
let source = '';
|
|
160
|
-
switch (this.device) {
|
|
161
|
-
case 'mobile':
|
|
162
|
-
source = image.sources[0].pictureSource;
|
|
163
|
-
break;
|
|
164
|
-
case 'tablet':
|
|
165
|
-
source = image.sources[1].pictureSource;
|
|
166
|
-
break;
|
|
167
|
-
case 'desktop':
|
|
168
|
-
source = image.sources[2].pictureSource;
|
|
169
|
-
break;
|
|
170
|
-
}
|
|
171
|
-
return source;
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
// Rerender when bannermatrix has finished loaded. Issue when bannermatrix passed as content from CMS.
|
|
175
|
-
handleBannerReady() {
|
|
176
|
-
this.bannerMatrixReady = true;
|
|
177
|
-
}
|
|
178
|
-
watchEndpoint(newValue, oldValue) {
|
|
179
|
-
if (newValue && newValue != oldValue && this.cmsEndpoint && this.language && (this.postCustomPath || this.postSlug || this.postId)) {
|
|
180
|
-
this.getBlogArticleDetails();
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
connectedCallback() {
|
|
184
|
-
if (this.cmsEndpoint && this.language && (this.postCustomPath || this.postSlug || this.postId)) {
|
|
185
|
-
this.getBlogArticleDetails();
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
getBlogArticleDetails() {
|
|
189
|
-
if (!this.postId && !this.postSlug && !this.postCustomPath) {
|
|
190
|
-
this.hasErrors = true;
|
|
191
|
-
throw new Error('postId, postSlug or postCustomPath parameter has to be provided!');
|
|
192
|
-
}
|
|
193
|
-
this.isLoading = true;
|
|
194
|
-
let url = new URL(`${this.cmsEndpoint}/${this.language}/blog-posts${this.postCustomPath ? '' : '/' + this.postSlug || '/' + this.postId}`);
|
|
195
|
-
url.searchParams.append('env', this.cmsEnv);
|
|
196
|
-
url.searchParams.append('userRoles', this.userRoles);
|
|
197
|
-
url.searchParams.append('device', getDevicePlatform());
|
|
198
|
-
if (this.postCustomPath) {
|
|
199
|
-
url.searchParams.append('customURL', this.postCustomPath);
|
|
200
|
-
}
|
|
201
|
-
fetch(url.href)
|
|
202
|
-
.then((res) => {
|
|
203
|
-
if (res.status >= 300) {
|
|
204
|
-
this.hasErrors = true;
|
|
205
|
-
throw new Error('There was an error while fetching the data');
|
|
206
|
-
}
|
|
207
|
-
return res.json();
|
|
208
|
-
})
|
|
209
|
-
.then((blogContent) => {
|
|
210
|
-
if (blogContent.count >= 1 && this.postCustomPath) {
|
|
211
|
-
let firstBlogPublishDate = new Date(blogContent.items[0].publishingDate);
|
|
212
|
-
let indexOfLatestPublished = 0;
|
|
213
|
-
for (let i = 1; i < blogContent.items.length; i++) {
|
|
214
|
-
const blogDate = new Date(blogContent.items[i].publishingDate);
|
|
215
|
-
if (firstBlogPublishDate.getTime() < blogDate.getTime()) {
|
|
216
|
-
firstBlogPublishDate = blogDate;
|
|
217
|
-
indexOfLatestPublished = i;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
this.blogData = blogContent.items[indexOfLatestPublished];
|
|
221
|
-
}
|
|
222
|
-
else {
|
|
223
|
-
this.blogData = blogContent;
|
|
224
|
-
}
|
|
225
|
-
this.isLoading = false;
|
|
226
|
-
})
|
|
227
|
-
.catch((err) => {
|
|
228
|
-
this.hasErrors = true;
|
|
229
|
-
console.log('Error', err);
|
|
230
|
-
})
|
|
231
|
-
.finally(() => this.isLoading = false);
|
|
232
|
-
}
|
|
233
|
-
componentDidRender() {
|
|
234
|
-
// start custom styling area
|
|
235
|
-
if (!this.limitStylingAppends && this.stylingContainer) {
|
|
236
|
-
if (this.clientStyling)
|
|
237
|
-
this.setClientStyling();
|
|
238
|
-
if (this.clientStylingUrl)
|
|
239
|
-
this.setClientStylingURL();
|
|
240
|
-
this.limitStylingAppends = true;
|
|
241
|
-
}
|
|
242
|
-
// end custom styling area
|
|
243
|
-
}
|
|
244
|
-
componentDidLoad() {
|
|
245
|
-
this.detectAndAlertDeviceType();
|
|
246
|
-
}
|
|
247
|
-
detectAndAlertDeviceType() {
|
|
248
|
-
this.device = getDeviceCustom();
|
|
249
|
-
}
|
|
250
|
-
formatDate(dateString) {
|
|
251
|
-
return new Intl.DateTimeFormat(this.intlDateTimeFormat || 'en-GB').format(new Date(dateString));
|
|
252
|
-
}
|
|
253
|
-
render() {
|
|
254
|
-
var _a, _b, _c, _d, _e;
|
|
255
|
-
if (this.hasErrors) {
|
|
256
|
-
return (index.h("div", { class: "BlogArticleDetails" }, index.h("div", { class: "Title" }, translate('error', this.language))));
|
|
257
|
-
}
|
|
258
|
-
if (!this.isLoading) {
|
|
259
|
-
return (index.h("div", { ref: el => this.stylingContainer = el }, index.h("div", { class: "DetailsContainer" }, index.h("div", { class: "DetailsHeadWrapper" }, this.showPublishingDate && this.blogData.publishingDate &&
|
|
260
|
-
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 &&
|
|
261
|
-
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)))));
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
static get watchers() { return {
|
|
265
|
-
"postId": ["watchEndpoint"],
|
|
266
|
-
"postSlug": ["watchEndpoint"],
|
|
267
|
-
"postCustomPath": ["watchEndpoint"],
|
|
268
|
-
"cmsEndpoint": ["watchEndpoint"],
|
|
269
|
-
"language": ["watchEndpoint"]
|
|
270
|
-
}; }
|
|
271
|
-
};
|
|
272
|
-
BlogArticleDetails.style = blogArticleDetailsCss;
|
|
273
|
-
|
|
274
|
-
exports.blog_article_details = BlogArticleDetails;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const index = require('./index-d983d0f8.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":[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
|
-
});
|