@everymatrix/blog-article-details 1.13.6 → 1.13.17

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.
@@ -1 +1 @@
1
- import{p as e,b as n}from"./p-b3ab7cf8.js";(()=>{const n=import.meta.url,t={};return""!==n&&(t.resourcesUrl=new URL(".",n).href),e(t)})().then((e=>n([["p-493d4f13",[[1,"blog-article-details",{cmsEndpoint:[1,"cms-endpoint"],language:[1],handleClick:[1,"handle-click"],clientStyling:[1,"client-styling"],clientStylingUrl:[1,"client-styling-url"],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],bannerMatrixReady:[32]},[[8,"WebComponentsReady","handleBannerReady"]]]]]],e)));
1
+ import{p as e,b as n}from"./p-68e0210a.js";(()=>{const n=import.meta.url,s={};return""!==n&&(s.resourcesUrl=new URL(".",n).href),e(s)})().then((e=>n([["p-d34c740d",[[1,"blog-article-details",{cmsEndpoint:[513,"cms-endpoint"],language:[513],userRoles:[513,"user-roles"],cmsEnv:[513,"cms-env"],handleClick:[513,"handle-click"],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"],postMessageEvent:[513,"post-message-event"],postId:[514,"post-id"],hasErrors:[32],limitStylingAppends:[32],isLoading:[32],bannerMatrixReady:[32],device:[32]},[[8,"BannerMatrixReady","handleBannerReady"]]]]]],e)));
@@ -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)},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}
@@ -0,0 +1 @@
1
+ import{r as t,h as i}from"./p-68e0210a.js";const n=["ro","en","fr","ar"],r={en:{error:"Error"},ro:{error:"Eroare"},fr:{error:"Error"},ar:{error:"خطأ"}},o=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.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})}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&&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}`);t.searchParams.append("env",this.cmsEnv),t.searchParams.append("userRoles",this.userRoles),t.searchParams.append("platform",(()=>{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"})()),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.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}componentDidLoad(){this.detectAndAlertDeviceType()}detectAndAlertDeviceType(){this.device=function(){const t=navigator.userAgent.toLowerCase(),i=screen.availWidth,n=screen.availHeight;if(t.includes("iphone"))return"mobile";if(t.includes("android")){if(n>i&&i<800)return"mobile";if(i>n&&n<800)return"tablet"}return"desktop"}()}render(){var t,o,e,s,h;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"},null===(t=this.blogData)||void 0===t?void 0:t.publishingDate),this.showImage&&i("div",{class:"BlogBanner"},(null===(o=this.blogData.image)||void 0===o?void 0:o.src)?i("img",{src:this.blogData.image.src,alt:this.blogData.image.src}):(null===(e=this.blogData.video)||void 0===e?void 0:e.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===(s=this.blogData)||void 0===s?void 0:s.title),this.showContent&&this.renderContentConditionally(null===(h=this.blogData)||void 0===h?void 0:h.content)))}static get watchers(){return{cmsEndpoint:["watchEndpoint"],language:["watchEndpoint"]}}};o.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{o as blog_article_details}
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-045ab4cd.js');
5
+ const index = require('./index-d983d0f8.js');
6
6
 
7
7
  const DEFAULT_LANGUAGE = 'en';
8
8
  const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar'];
@@ -25,6 +25,51 @@ const translate = (key, customLang) => {
25
25
  return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
26
26
  };
27
27
 
28
+ function checkDeviceType() {
29
+ const userAgent = navigator.userAgent.toLowerCase();
30
+ const width = screen.availWidth;
31
+ const height = screen.availHeight;
32
+ if (userAgent.includes('iphone')) {
33
+ return 'mobile';
34
+ }
35
+ if (userAgent.includes('android')) {
36
+ if (height > width && width < 800) {
37
+ return 'mobile';
38
+ }
39
+ if (width > height && height < 800) {
40
+ return 'tablet';
41
+ }
42
+ }
43
+ return 'desktop';
44
+ }
45
+ const getDevice = () => {
46
+ let userAgent = window.navigator.userAgent;
47
+ if (userAgent.toLowerCase().match(/android/i)) {
48
+ return 'Android';
49
+ }
50
+ if (userAgent.toLowerCase().match(/iphone/i)) {
51
+ return 'iPhone';
52
+ }
53
+ if (userAgent.toLowerCase().match(/ipad|ipod/i)) {
54
+ return 'iPad';
55
+ }
56
+ return 'PC';
57
+ };
58
+ const getDevicePlatform = () => {
59
+ const device = getDevice();
60
+ if (device) {
61
+ if (device === 'PC') {
62
+ return 'dk';
63
+ }
64
+ else if (device === 'iPad' || device === 'iPhone') {
65
+ return 'mtWeb';
66
+ }
67
+ else {
68
+ return 'mtWeb';
69
+ }
70
+ }
71
+ };
72
+
28
73
  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
74
 
30
75
  const BlogArticleDetails = class {
@@ -34,6 +79,14 @@ const BlogArticleDetails = class {
34
79
  * Language of the widget
35
80
  */
36
81
  this.language = 'en';
82
+ /**
83
+ * User roles
84
+ */
85
+ this.userRoles = 'everyone';
86
+ /**
87
+ * CMS Endpoint stage
88
+ */
89
+ this.cmsEnv = 'stage';
37
90
  /**
38
91
  * Client custom styling via string
39
92
  */
@@ -47,8 +100,8 @@ const BlogArticleDetails = class {
47
100
  */
48
101
  this.showPublishingDate = true;
49
102
  /**
50
- * Property used to display the image
51
- */
103
+ * Property used to display the image
104
+ */
52
105
  this.showImage = true;
53
106
  /**
54
107
  * Property used to display the image
@@ -66,6 +119,7 @@ const BlogArticleDetails = class {
66
119
  this.limitStylingAppends = false;
67
120
  this.isLoading = true;
68
121
  this.bannerMatrixReady = false;
122
+ this.device = '';
69
123
  this.setClientStyling = () => {
70
124
  let sheet = document.createElement('style');
71
125
  sheet.innerHTML = this.clientStyling;
@@ -85,13 +139,12 @@ const BlogArticleDetails = class {
85
139
  });
86
140
  };
87
141
  this.renderContentConditionally = (content) => {
88
- var _a, _b;
89
142
  const hasBanner = (content === null || content === void 0 ? void 0 : content.indexOf('<bannermatrix-banner')) !== -1;
90
143
  if (!hasBanner) {
91
- return index.h("div", { class: "BlogContent", innerHTML: (_a = this.blogData) === null || _a === void 0 ? void 0 : _a.content });
144
+ return index.h("div", { class: "BlogContent", innerHTML: content });
92
145
  }
93
146
  if (this.bannerMatrixReady) {
94
- return index.h("div", { class: "BlogContent", innerHTML: (_b = this.blogData) === null || _b === void 0 ? void 0 : _b.content });
147
+ return index.h("div", { class: "BlogContent", innerHTML: content });
95
148
  }
96
149
  return null;
97
150
  };
@@ -117,6 +170,9 @@ const BlogArticleDetails = class {
117
170
  }
118
171
  this.isLoading = true;
119
172
  let url = new URL(`${this.cmsEndpoint}/${this.language}/blog-posts/${this.postId}`);
173
+ url.searchParams.append('env', this.cmsEnv);
174
+ url.searchParams.append('userRoles', this.userRoles);
175
+ url.searchParams.append('platform', getDevicePlatform());
120
176
  fetch(url.href)
121
177
  .then((res) => {
122
178
  if (res.status >= 300) {
@@ -147,16 +203,21 @@ const BlogArticleDetails = class {
147
203
  }
148
204
  // end custom styling area
149
205
  }
206
+ componentDidLoad() {
207
+ this.detectAndAlertDeviceType();
208
+ }
209
+ detectAndAlertDeviceType() {
210
+ this.device = checkDeviceType();
211
+ }
150
212
  render() {
151
- var _a, _b, _c, _d;
213
+ var _a, _b, _c, _d, _e;
152
214
  if (this.hasErrors) {
153
215
  return (index.h("div", { class: "BlogArticleDetails" }, index.h("div", { class: "Title" }, translate('error', this.language))));
154
216
  }
155
217
  if (!this.isLoading) {
156
218
  return (index.h("div", { ref: el => this.stylingContainer = el }, index.h("div", { class: "GridContainer" }, this.showPublishingDate &&
157
- index.h("div", { class: "BlogDate" }, (_a = this.blogData) === null || _a === void 0 ? void 0 : _a.publishingDate), this.showImage &&
158
- index.h("div", { class: "BlogBanner" }, index.h("img", { src: this.blogData.image.src, alt: (_b = this.blogData) === null || _b === void 0 ? void 0 : _b.title })), this.showTitle &&
159
- index.h("div", { class: "BlogTitle" }, (_c = this.blogData) === null || _c === void 0 ? void 0 : _c.title), this.showContent && this.renderContentConditionally((_d = this.blogData) === null || _d === void 0 ? void 0 : _d.content))));
219
+ index.h("div", { class: "BlogDate" }, (_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("img", { src: this.blogData.image.src, alt: this.blogData.image.src })) : (((_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"))))), this.showTitle &&
220
+ 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))));
160
221
  }
161
222
  }
162
223
  static get watchers() { return {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index-045ab4cd.js');
3
+ const index = require('./index-d983d0f8.js');
4
4
 
5
5
  /*
6
6
  Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
@@ -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":[1,"cms-endpoint"],"language":[1],"handleClick":[1,"handle-click"],"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"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],"bannerMatrixReady":[32]},[[8,"WebComponentsReady","handleBannerReady"]]]]]], 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"],"handleClick":[513,"handle-click"],"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"],"postMessageEvent":[513,"post-message-event"],"postId":[514,"post-id"],"hasErrors":[32],"limitStylingAppends":[32],"isLoading":[32],"bannerMatrixReady":[32],"device":[32]},[[8,"BannerMatrixReady","handleBannerReady"]]]]]], options);
19
19
  });
@@ -268,6 +268,31 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
268
268
  classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
269
269
  classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
270
270
  }
271
+ else if (memberName === 'style') {
272
+ // update style attribute, css properties and values
273
+ {
274
+ for (const prop in oldValue) {
275
+ if (!newValue || newValue[prop] == null) {
276
+ if (prop.includes('-')) {
277
+ elm.style.removeProperty(prop);
278
+ }
279
+ else {
280
+ elm.style[prop] = '';
281
+ }
282
+ }
283
+ }
284
+ }
285
+ for (const prop in newValue) {
286
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
287
+ if (prop.includes('-')) {
288
+ elm.style.setProperty(prop, newValue[prop]);
289
+ }
290
+ else {
291
+ elm.style[prop] = newValue[prop];
292
+ }
293
+ }
294
+ }
295
+ }
271
296
  else if (memberName === 'ref') {
272
297
  // minifier will clean this up
273
298
  if (newValue) {
@@ -518,9 +543,14 @@ const callNodeRefs = (vNode) => {
518
543
  };
519
544
  const renderVdom = (hostRef, renderFnResults) => {
520
545
  const hostElm = hostRef.$hostElement$;
546
+ const cmpMeta = hostRef.$cmpMeta$;
521
547
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
522
548
  const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
523
549
  hostTagName = hostElm.tagName;
550
+ if (cmpMeta.$attrsToReflect$) {
551
+ rootVnode.$attrs$ = rootVnode.$attrs$ || {};
552
+ cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
553
+ }
524
554
  rootVnode.$tag$ = null;
525
555
  rootVnode.$flags$ |= 4 /* isHost */;
526
556
  hostRef.$vnode$ = rootVnode;
@@ -654,6 +684,9 @@ const postUpdateComponent = (hostRef) => {
654
684
  // DOM WRITE!
655
685
  addHydratedFlag(elm);
656
686
  }
687
+ {
688
+ safeCall(instance, 'componentDidLoad');
689
+ }
657
690
  endPostUpdate();
658
691
  {
659
692
  hostRef.$onReadyResolve$(elm);
@@ -881,6 +914,9 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
881
914
  .map(([propName, m]) => {
882
915
  const attrName = m[1] || propName;
883
916
  attrNameToPropName.set(attrName, propName);
917
+ if (m[0] & 512 /* ReflectAttr */) {
918
+ cmpMeta.$attrsToReflect$.push([propName, attrName]);
919
+ }
884
920
  return attrName;
885
921
  });
886
922
  }
@@ -1058,6 +1094,9 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1058
1094
  {
1059
1095
  cmpMeta.$listeners$ = compactMeta[3];
1060
1096
  }
1097
+ {
1098
+ cmpMeta.$attrsToReflect$ = [];
1099
+ }
1061
1100
  {
1062
1101
  cmpMeta.$watchers$ = {};
1063
1102
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-045ab4cd.js');
5
+ const index = require('./index-d983d0f8.js');
6
6
 
7
7
  /*
8
8
  Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
@@ -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":[1,"cms-endpoint"],"language":[1],"handleClick":[1,"handle-click"],"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"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],"bannerMatrixReady":[32]},[[8,"WebComponentsReady","handleBannerReady"]]]]]], options);
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"],"handleClick":[513,"handle-click"],"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"],"postMessageEvent":[513,"post-message-event"],"postId":[514,"post-id"],"hasErrors":[32],"limitStylingAppends":[32],"isLoading":[32],"bannerMatrixReady":[32],"device":[32]},[[8,"BannerMatrixReady","handleBannerReady"]]]]]], options);
18
18
  });
19
19
  };
20
20
 
@@ -1,11 +1,20 @@
1
1
  import { Component, Prop, State, Watch, h, Listen } from '@stencil/core';
2
2
  import { translate } from '../../utils/locale.utils';
3
+ import { checkDeviceType, getDevicePlatform } from '../../utils/utils';
3
4
  export class BlogArticleDetails {
4
5
  constructor() {
5
6
  /**
6
7
  * Language of the widget
7
8
  */
8
9
  this.language = 'en';
10
+ /**
11
+ * User roles
12
+ */
13
+ this.userRoles = 'everyone';
14
+ /**
15
+ * CMS Endpoint stage
16
+ */
17
+ this.cmsEnv = 'stage';
9
18
  /**
10
19
  * Client custom styling via string
11
20
  */
@@ -19,8 +28,8 @@ export class BlogArticleDetails {
19
28
  */
20
29
  this.showPublishingDate = true;
21
30
  /**
22
- * Property used to display the image
23
- */
31
+ * Property used to display the image
32
+ */
24
33
  this.showImage = true;
25
34
  /**
26
35
  * Property used to display the image
@@ -38,6 +47,7 @@ export class BlogArticleDetails {
38
47
  this.limitStylingAppends = false;
39
48
  this.isLoading = true;
40
49
  this.bannerMatrixReady = false;
50
+ this.device = '';
41
51
  this.setClientStyling = () => {
42
52
  let sheet = document.createElement('style');
43
53
  sheet.innerHTML = this.clientStyling;
@@ -57,13 +67,12 @@ export class BlogArticleDetails {
57
67
  });
58
68
  };
59
69
  this.renderContentConditionally = (content) => {
60
- var _a, _b;
61
70
  const hasBanner = (content === null || content === void 0 ? void 0 : content.indexOf('<bannermatrix-banner')) !== -1;
62
71
  if (!hasBanner) {
63
- return h("div", { class: "BlogContent", innerHTML: (_a = this.blogData) === null || _a === void 0 ? void 0 : _a.content });
72
+ return h("div", { class: "BlogContent", innerHTML: content });
64
73
  }
65
74
  if (this.bannerMatrixReady) {
66
- return h("div", { class: "BlogContent", innerHTML: (_b = this.blogData) === null || _b === void 0 ? void 0 : _b.content });
75
+ return h("div", { class: "BlogContent", innerHTML: content });
67
76
  }
68
77
  return null;
69
78
  };
@@ -89,6 +98,9 @@ export class BlogArticleDetails {
89
98
  }
90
99
  this.isLoading = true;
91
100
  let url = new URL(`${this.cmsEndpoint}/${this.language}/blog-posts/${this.postId}`);
101
+ url.searchParams.append('env', this.cmsEnv);
102
+ url.searchParams.append('userRoles', this.userRoles);
103
+ url.searchParams.append('platform', getDevicePlatform());
92
104
  fetch(url.href)
93
105
  .then((res) => {
94
106
  if (res.status >= 300) {
@@ -119,8 +131,14 @@ export class BlogArticleDetails {
119
131
  }
120
132
  // end custom styling area
121
133
  }
134
+ componentDidLoad() {
135
+ this.detectAndAlertDeviceType();
136
+ }
137
+ detectAndAlertDeviceType() {
138
+ this.device = checkDeviceType();
139
+ }
122
140
  render() {
123
- var _a, _b, _c, _d;
141
+ var _a, _b, _c, _d, _e;
124
142
  if (this.hasErrors) {
125
143
  return (h("div", { class: "BlogArticleDetails" },
126
144
  h("div", { class: "Title" }, translate('error', this.language))));
@@ -130,12 +148,10 @@ export class BlogArticleDetails {
130
148
  h("div", { class: "GridContainer" },
131
149
  this.showPublishingDate &&
132
150
  h("div", { class: "BlogDate" }, (_a = this.blogData) === null || _a === void 0 ? void 0 : _a.publishingDate),
133
- this.showImage &&
134
- h("div", { class: "BlogBanner" },
135
- h("img", { src: this.blogData.image.src, alt: (_b = this.blogData) === null || _b === void 0 ? void 0 : _b.title })),
151
+ this.showImage && (h("div", { class: "BlogBanner" }, ((_b = this.blogData.image) === null || _b === void 0 ? void 0 : _b.src) ? (h("img", { src: this.blogData.image.src, alt: this.blogData.image.src })) : (((_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"))))),
136
152
  this.showTitle &&
137
- h("div", { class: "BlogTitle" }, (_c = this.blogData) === null || _c === void 0 ? void 0 : _c.title),
138
- this.showContent && this.renderContentConditionally((_d = this.blogData) === null || _d === void 0 ? void 0 : _d.content))));
153
+ h("div", { class: "BlogTitle" }, (_d = this.blogData) === null || _d === void 0 ? void 0 : _d.title),
154
+ this.showContent && this.renderContentConditionally((_e = this.blogData) === null || _e === void 0 ? void 0 : _e.content))));
139
155
  }
140
156
  }
141
157
  static get is() { return "blog-article-details"; }
@@ -162,7 +178,7 @@ export class BlogArticleDetails {
162
178
  "text": "Endpoint URL for the source of data"
163
179
  },
164
180
  "attribute": "cms-endpoint",
165
- "reflect": false
181
+ "reflect": true
166
182
  },
167
183
  "language": {
168
184
  "type": "string",
@@ -179,9 +195,45 @@ export class BlogArticleDetails {
179
195
  "text": "Language of the widget"
180
196
  },
181
197
  "attribute": "language",
182
- "reflect": false,
198
+ "reflect": true,
183
199
  "defaultValue": "'en'"
184
200
  },
201
+ "userRoles": {
202
+ "type": "string",
203
+ "mutable": false,
204
+ "complexType": {
205
+ "original": "string",
206
+ "resolved": "string",
207
+ "references": {}
208
+ },
209
+ "required": false,
210
+ "optional": false,
211
+ "docs": {
212
+ "tags": [],
213
+ "text": "User roles"
214
+ },
215
+ "attribute": "user-roles",
216
+ "reflect": true,
217
+ "defaultValue": "'everyone'"
218
+ },
219
+ "cmsEnv": {
220
+ "type": "string",
221
+ "mutable": false,
222
+ "complexType": {
223
+ "original": "string",
224
+ "resolved": "string",
225
+ "references": {}
226
+ },
227
+ "required": false,
228
+ "optional": false,
229
+ "docs": {
230
+ "tags": [],
231
+ "text": "CMS Endpoint stage"
232
+ },
233
+ "attribute": "cms-env",
234
+ "reflect": true,
235
+ "defaultValue": "'stage'"
236
+ },
185
237
  "handleClick": {
186
238
  "type": "string",
187
239
  "mutable": false,
@@ -197,7 +249,7 @@ export class BlogArticleDetails {
197
249
  "text": "Handle when you click on show more button"
198
250
  },
199
251
  "attribute": "handle-click",
200
- "reflect": false
252
+ "reflect": true
201
253
  },
202
254
  "clientStyling": {
203
255
  "type": "string",
@@ -214,7 +266,7 @@ export class BlogArticleDetails {
214
266
  "text": "Client custom styling via string"
215
267
  },
216
268
  "attribute": "client-styling",
217
- "reflect": false,
269
+ "reflect": true,
218
270
  "defaultValue": "''"
219
271
  },
220
272
  "clientStylingUrl": {
@@ -232,7 +284,7 @@ export class BlogArticleDetails {
232
284
  "text": "Client custom styling via url"
233
285
  },
234
286
  "attribute": "client-styling-url",
235
- "reflect": false,
287
+ "reflect": true,
236
288
  "defaultValue": "''"
237
289
  },
238
290
  "showPublishingDate": {
@@ -250,7 +302,7 @@ export class BlogArticleDetails {
250
302
  "text": "Property used to display the publishing date"
251
303
  },
252
304
  "attribute": "show-publishing-date",
253
- "reflect": false,
305
+ "reflect": true,
254
306
  "defaultValue": "true"
255
307
  },
256
308
  "showImage": {
@@ -268,7 +320,7 @@ export class BlogArticleDetails {
268
320
  "text": "Property used to display the image"
269
321
  },
270
322
  "attribute": "show-image",
271
- "reflect": false,
323
+ "reflect": true,
272
324
  "defaultValue": "true"
273
325
  },
274
326
  "showTitle": {
@@ -286,7 +338,7 @@ export class BlogArticleDetails {
286
338
  "text": "Property used to display the image"
287
339
  },
288
340
  "attribute": "show-title",
289
- "reflect": false,
341
+ "reflect": true,
290
342
  "defaultValue": "true"
291
343
  },
292
344
  "showContent": {
@@ -304,7 +356,7 @@ export class BlogArticleDetails {
304
356
  "text": "Property used to display the description"
305
357
  },
306
358
  "attribute": "show-content",
307
- "reflect": false,
359
+ "reflect": true,
308
360
  "defaultValue": "true"
309
361
  },
310
362
  "postMessageEvent": {
@@ -322,7 +374,7 @@ export class BlogArticleDetails {
322
374
  "text": "Event name to be sent when the button is clicked"
323
375
  },
324
376
  "attribute": "post-message-event",
325
- "reflect": false,
377
+ "reflect": true,
326
378
  "defaultValue": "'articleActionButton'"
327
379
  },
328
380
  "postId": {
@@ -340,14 +392,15 @@ export class BlogArticleDetails {
340
392
  "text": "Showing post ID parameter"
341
393
  },
342
394
  "attribute": "post-id",
343
- "reflect": false
395
+ "reflect": true
344
396
  }
345
397
  }; }
346
398
  static get states() { return {
347
399
  "hasErrors": {},
348
400
  "limitStylingAppends": {},
349
401
  "isLoading": {},
350
- "bannerMatrixReady": {}
402
+ "bannerMatrixReady": {},
403
+ "device": {}
351
404
  }; }
352
405
  static get watchers() { return [{
353
406
  "propName": "cmsEndpoint",
@@ -357,7 +410,7 @@ export class BlogArticleDetails {
357
410
  "methodName": "watchEndpoint"
358
411
  }]; }
359
412
  static get listeners() { return [{
360
- "name": "WebComponentsReady",
413
+ "name": "BannerMatrixReady",
361
414
  "method": "handleBannerReady",
362
415
  "target": "window",
363
416
  "capture": false,
@@ -0,0 +1,44 @@
1
+ export function checkDeviceType() {
2
+ const userAgent = navigator.userAgent.toLowerCase();
3
+ const width = screen.availWidth;
4
+ const height = screen.availHeight;
5
+ if (userAgent.includes('iphone')) {
6
+ return 'mobile';
7
+ }
8
+ if (userAgent.includes('android')) {
9
+ if (height > width && width < 800) {
10
+ return 'mobile';
11
+ }
12
+ if (width > height && height < 800) {
13
+ return 'tablet';
14
+ }
15
+ }
16
+ return 'desktop';
17
+ }
18
+ export const getDevice = () => {
19
+ let userAgent = window.navigator.userAgent;
20
+ if (userAgent.toLowerCase().match(/android/i)) {
21
+ return 'Android';
22
+ }
23
+ if (userAgent.toLowerCase().match(/iphone/i)) {
24
+ return 'iPhone';
25
+ }
26
+ if (userAgent.toLowerCase().match(/ipad|ipod/i)) {
27
+ return 'iPad';
28
+ }
29
+ return 'PC';
30
+ };
31
+ export const getDevicePlatform = () => {
32
+ const device = getDevice();
33
+ if (device) {
34
+ if (device === 'PC') {
35
+ return 'dk';
36
+ }
37
+ else if (device === 'iPad' || device === 'iPhone') {
38
+ return 'mtWeb';
39
+ }
40
+ else {
41
+ return 'mtWeb';
42
+ }
43
+ }
44
+ };
@@ -21,6 +21,51 @@ const translate = (key, customLang) => {
21
21
  return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
22
22
  };
23
23
 
24
+ function checkDeviceType() {
25
+ const userAgent = navigator.userAgent.toLowerCase();
26
+ const width = screen.availWidth;
27
+ const height = screen.availHeight;
28
+ if (userAgent.includes('iphone')) {
29
+ return 'mobile';
30
+ }
31
+ if (userAgent.includes('android')) {
32
+ if (height > width && width < 800) {
33
+ return 'mobile';
34
+ }
35
+ if (width > height && height < 800) {
36
+ return 'tablet';
37
+ }
38
+ }
39
+ return 'desktop';
40
+ }
41
+ const getDevice = () => {
42
+ let userAgent = window.navigator.userAgent;
43
+ if (userAgent.toLowerCase().match(/android/i)) {
44
+ return 'Android';
45
+ }
46
+ if (userAgent.toLowerCase().match(/iphone/i)) {
47
+ return 'iPhone';
48
+ }
49
+ if (userAgent.toLowerCase().match(/ipad|ipod/i)) {
50
+ return 'iPad';
51
+ }
52
+ return 'PC';
53
+ };
54
+ const getDevicePlatform = () => {
55
+ const device = getDevice();
56
+ if (device) {
57
+ if (device === 'PC') {
58
+ return 'dk';
59
+ }
60
+ else if (device === 'iPad' || device === 'iPhone') {
61
+ return 'mtWeb';
62
+ }
63
+ else {
64
+ return 'mtWeb';
65
+ }
66
+ }
67
+ };
68
+
24
69
  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}";
25
70
 
26
71
  const BlogArticleDetails$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
@@ -32,6 +77,14 @@ const BlogArticleDetails$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
32
77
  * Language of the widget
33
78
  */
34
79
  this.language = 'en';
80
+ /**
81
+ * User roles
82
+ */
83
+ this.userRoles = 'everyone';
84
+ /**
85
+ * CMS Endpoint stage
86
+ */
87
+ this.cmsEnv = 'stage';
35
88
  /**
36
89
  * Client custom styling via string
37
90
  */
@@ -45,8 +98,8 @@ const BlogArticleDetails$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
45
98
  */
46
99
  this.showPublishingDate = true;
47
100
  /**
48
- * Property used to display the image
49
- */
101
+ * Property used to display the image
102
+ */
50
103
  this.showImage = true;
51
104
  /**
52
105
  * Property used to display the image
@@ -64,6 +117,7 @@ const BlogArticleDetails$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
64
117
  this.limitStylingAppends = false;
65
118
  this.isLoading = true;
66
119
  this.bannerMatrixReady = false;
120
+ this.device = '';
67
121
  this.setClientStyling = () => {
68
122
  let sheet = document.createElement('style');
69
123
  sheet.innerHTML = this.clientStyling;
@@ -83,13 +137,12 @@ const BlogArticleDetails$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
83
137
  });
84
138
  };
85
139
  this.renderContentConditionally = (content) => {
86
- var _a, _b;
87
140
  const hasBanner = (content === null || content === void 0 ? void 0 : content.indexOf('<bannermatrix-banner')) !== -1;
88
141
  if (!hasBanner) {
89
- return h("div", { class: "BlogContent", innerHTML: (_a = this.blogData) === null || _a === void 0 ? void 0 : _a.content });
142
+ return h("div", { class: "BlogContent", innerHTML: content });
90
143
  }
91
144
  if (this.bannerMatrixReady) {
92
- return h("div", { class: "BlogContent", innerHTML: (_b = this.blogData) === null || _b === void 0 ? void 0 : _b.content });
145
+ return h("div", { class: "BlogContent", innerHTML: content });
93
146
  }
94
147
  return null;
95
148
  };
@@ -115,6 +168,9 @@ const BlogArticleDetails$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
115
168
  }
116
169
  this.isLoading = true;
117
170
  let url = new URL(`${this.cmsEndpoint}/${this.language}/blog-posts/${this.postId}`);
171
+ url.searchParams.append('env', this.cmsEnv);
172
+ url.searchParams.append('userRoles', this.userRoles);
173
+ url.searchParams.append('platform', getDevicePlatform());
118
174
  fetch(url.href)
119
175
  .then((res) => {
120
176
  if (res.status >= 300) {
@@ -145,16 +201,21 @@ const BlogArticleDetails$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
145
201
  }
146
202
  // end custom styling area
147
203
  }
204
+ componentDidLoad() {
205
+ this.detectAndAlertDeviceType();
206
+ }
207
+ detectAndAlertDeviceType() {
208
+ this.device = checkDeviceType();
209
+ }
148
210
  render() {
149
- var _a, _b, _c, _d;
211
+ var _a, _b, _c, _d, _e;
150
212
  if (this.hasErrors) {
151
213
  return (h("div", { class: "BlogArticleDetails" }, h("div", { class: "Title" }, translate('error', this.language))));
152
214
  }
153
215
  if (!this.isLoading) {
154
216
  return (h("div", { ref: el => this.stylingContainer = el }, h("div", { class: "GridContainer" }, this.showPublishingDate &&
155
- h("div", { class: "BlogDate" }, (_a = this.blogData) === null || _a === void 0 ? void 0 : _a.publishingDate), this.showImage &&
156
- h("div", { class: "BlogBanner" }, h("img", { src: this.blogData.image.src, alt: (_b = this.blogData) === null || _b === void 0 ? void 0 : _b.title })), this.showTitle &&
157
- h("div", { class: "BlogTitle" }, (_c = this.blogData) === null || _c === void 0 ? void 0 : _c.title), this.showContent && this.renderContentConditionally((_d = this.blogData) === null || _d === void 0 ? void 0 : _d.content))));
217
+ h("div", { class: "BlogDate" }, (_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("img", { src: this.blogData.image.src, alt: this.blogData.image.src })) : (((_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"))))), this.showTitle &&
218
+ 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))));
158
219
  }
159
220
  }
160
221
  static get watchers() { return {
@@ -163,22 +224,25 @@ const BlogArticleDetails$1 = /*@__PURE__*/ proxyCustomElement(class extends HTML
163
224
  }; }
164
225
  static get style() { return blogArticleDetailsCss; }
165
226
  }, [1, "blog-article-details", {
166
- "cmsEndpoint": [1, "cms-endpoint"],
167
- "language": [1],
168
- "handleClick": [1, "handle-click"],
169
- "clientStyling": [1, "client-styling"],
170
- "clientStylingUrl": [1, "client-styling-url"],
171
- "showPublishingDate": [4, "show-publishing-date"],
172
- "showImage": [4, "show-image"],
173
- "showTitle": [4, "show-title"],
174
- "showContent": [4, "show-content"],
175
- "postMessageEvent": [1, "post-message-event"],
176
- "postId": [2, "post-id"],
227
+ "cmsEndpoint": [513, "cms-endpoint"],
228
+ "language": [513],
229
+ "userRoles": [513, "user-roles"],
230
+ "cmsEnv": [513, "cms-env"],
231
+ "handleClick": [513, "handle-click"],
232
+ "clientStyling": [513, "client-styling"],
233
+ "clientStylingUrl": [513, "client-styling-url"],
234
+ "showPublishingDate": [516, "show-publishing-date"],
235
+ "showImage": [516, "show-image"],
236
+ "showTitle": [516, "show-title"],
237
+ "showContent": [516, "show-content"],
238
+ "postMessageEvent": [513, "post-message-event"],
239
+ "postId": [514, "post-id"],
177
240
  "hasErrors": [32],
178
241
  "limitStylingAppends": [32],
179
242
  "isLoading": [32],
180
- "bannerMatrixReady": [32]
181
- }, [[8, "WebComponentsReady", "handleBannerReady"]]]);
243
+ "bannerMatrixReady": [32],
244
+ "device": [32]
245
+ }, [[8, "BannerMatrixReady", "handleBannerReady"]]]);
182
246
  function defineCustomElement$1() {
183
247
  if (typeof customElements === "undefined") {
184
248
  return;
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, h } from './index-26083270.js';
1
+ import { r as registerInstance, h } from './index-a6d43dfd.js';
2
2
 
3
3
  const DEFAULT_LANGUAGE = 'en';
4
4
  const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar'];
@@ -21,6 +21,51 @@ const translate = (key, customLang) => {
21
21
  return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
22
22
  };
23
23
 
24
+ function checkDeviceType() {
25
+ const userAgent = navigator.userAgent.toLowerCase();
26
+ const width = screen.availWidth;
27
+ const height = screen.availHeight;
28
+ if (userAgent.includes('iphone')) {
29
+ return 'mobile';
30
+ }
31
+ if (userAgent.includes('android')) {
32
+ if (height > width && width < 800) {
33
+ return 'mobile';
34
+ }
35
+ if (width > height && height < 800) {
36
+ return 'tablet';
37
+ }
38
+ }
39
+ return 'desktop';
40
+ }
41
+ const getDevice = () => {
42
+ let userAgent = window.navigator.userAgent;
43
+ if (userAgent.toLowerCase().match(/android/i)) {
44
+ return 'Android';
45
+ }
46
+ if (userAgent.toLowerCase().match(/iphone/i)) {
47
+ return 'iPhone';
48
+ }
49
+ if (userAgent.toLowerCase().match(/ipad|ipod/i)) {
50
+ return 'iPad';
51
+ }
52
+ return 'PC';
53
+ };
54
+ const getDevicePlatform = () => {
55
+ const device = getDevice();
56
+ if (device) {
57
+ if (device === 'PC') {
58
+ return 'dk';
59
+ }
60
+ else if (device === 'iPad' || device === 'iPhone') {
61
+ return 'mtWeb';
62
+ }
63
+ else {
64
+ return 'mtWeb';
65
+ }
66
+ }
67
+ };
68
+
24
69
  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}";
25
70
 
26
71
  const BlogArticleDetails = class {
@@ -30,6 +75,14 @@ const BlogArticleDetails = class {
30
75
  * Language of the widget
31
76
  */
32
77
  this.language = 'en';
78
+ /**
79
+ * User roles
80
+ */
81
+ this.userRoles = 'everyone';
82
+ /**
83
+ * CMS Endpoint stage
84
+ */
85
+ this.cmsEnv = 'stage';
33
86
  /**
34
87
  * Client custom styling via string
35
88
  */
@@ -43,8 +96,8 @@ const BlogArticleDetails = class {
43
96
  */
44
97
  this.showPublishingDate = true;
45
98
  /**
46
- * Property used to display the image
47
- */
99
+ * Property used to display the image
100
+ */
48
101
  this.showImage = true;
49
102
  /**
50
103
  * Property used to display the image
@@ -62,6 +115,7 @@ const BlogArticleDetails = class {
62
115
  this.limitStylingAppends = false;
63
116
  this.isLoading = true;
64
117
  this.bannerMatrixReady = false;
118
+ this.device = '';
65
119
  this.setClientStyling = () => {
66
120
  let sheet = document.createElement('style');
67
121
  sheet.innerHTML = this.clientStyling;
@@ -81,13 +135,12 @@ const BlogArticleDetails = class {
81
135
  });
82
136
  };
83
137
  this.renderContentConditionally = (content) => {
84
- var _a, _b;
85
138
  const hasBanner = (content === null || content === void 0 ? void 0 : content.indexOf('<bannermatrix-banner')) !== -1;
86
139
  if (!hasBanner) {
87
- return h("div", { class: "BlogContent", innerHTML: (_a = this.blogData) === null || _a === void 0 ? void 0 : _a.content });
140
+ return h("div", { class: "BlogContent", innerHTML: content });
88
141
  }
89
142
  if (this.bannerMatrixReady) {
90
- return h("div", { class: "BlogContent", innerHTML: (_b = this.blogData) === null || _b === void 0 ? void 0 : _b.content });
143
+ return h("div", { class: "BlogContent", innerHTML: content });
91
144
  }
92
145
  return null;
93
146
  };
@@ -113,6 +166,9 @@ const BlogArticleDetails = class {
113
166
  }
114
167
  this.isLoading = true;
115
168
  let url = new URL(`${this.cmsEndpoint}/${this.language}/blog-posts/${this.postId}`);
169
+ url.searchParams.append('env', this.cmsEnv);
170
+ url.searchParams.append('userRoles', this.userRoles);
171
+ url.searchParams.append('platform', getDevicePlatform());
116
172
  fetch(url.href)
117
173
  .then((res) => {
118
174
  if (res.status >= 300) {
@@ -143,16 +199,21 @@ const BlogArticleDetails = class {
143
199
  }
144
200
  // end custom styling area
145
201
  }
202
+ componentDidLoad() {
203
+ this.detectAndAlertDeviceType();
204
+ }
205
+ detectAndAlertDeviceType() {
206
+ this.device = checkDeviceType();
207
+ }
146
208
  render() {
147
- var _a, _b, _c, _d;
209
+ var _a, _b, _c, _d, _e;
148
210
  if (this.hasErrors) {
149
211
  return (h("div", { class: "BlogArticleDetails" }, h("div", { class: "Title" }, translate('error', this.language))));
150
212
  }
151
213
  if (!this.isLoading) {
152
214
  return (h("div", { ref: el => this.stylingContainer = el }, h("div", { class: "GridContainer" }, this.showPublishingDate &&
153
- h("div", { class: "BlogDate" }, (_a = this.blogData) === null || _a === void 0 ? void 0 : _a.publishingDate), this.showImage &&
154
- h("div", { class: "BlogBanner" }, h("img", { src: this.blogData.image.src, alt: (_b = this.blogData) === null || _b === void 0 ? void 0 : _b.title })), this.showTitle &&
155
- h("div", { class: "BlogTitle" }, (_c = this.blogData) === null || _c === void 0 ? void 0 : _c.title), this.showContent && this.renderContentConditionally((_d = this.blogData) === null || _d === void 0 ? void 0 : _d.content))));
215
+ h("div", { class: "BlogDate" }, (_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("img", { src: this.blogData.image.src, alt: this.blogData.image.src })) : (((_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"))))), this.showTitle &&
216
+ 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))));
156
217
  }
157
218
  }
158
219
  static get watchers() { return {
@@ -1,4 +1,4 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-26083270.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-a6d43dfd.js';
2
2
 
3
3
  /*
4
4
  Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
@@ -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":[1,"cms-endpoint"],"language":[1],"handleClick":[1,"handle-click"],"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"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],"bannerMatrixReady":[32]},[[8,"WebComponentsReady","handleBannerReady"]]]]]], 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"],"handleClick":[513,"handle-click"],"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"],"postMessageEvent":[513,"post-message-event"],"postId":[514,"post-id"],"hasErrors":[32],"limitStylingAppends":[32],"isLoading":[32],"bannerMatrixReady":[32],"device":[32]},[[8,"BannerMatrixReady","handleBannerReady"]]]]]], options);
17
17
  });
@@ -246,6 +246,31 @@ const setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
246
246
  classList.remove(...oldClasses.filter((c) => c && !newClasses.includes(c)));
247
247
  classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
248
248
  }
249
+ else if (memberName === 'style') {
250
+ // update style attribute, css properties and values
251
+ {
252
+ for (const prop in oldValue) {
253
+ if (!newValue || newValue[prop] == null) {
254
+ if (prop.includes('-')) {
255
+ elm.style.removeProperty(prop);
256
+ }
257
+ else {
258
+ elm.style[prop] = '';
259
+ }
260
+ }
261
+ }
262
+ }
263
+ for (const prop in newValue) {
264
+ if (!oldValue || newValue[prop] !== oldValue[prop]) {
265
+ if (prop.includes('-')) {
266
+ elm.style.setProperty(prop, newValue[prop]);
267
+ }
268
+ else {
269
+ elm.style[prop] = newValue[prop];
270
+ }
271
+ }
272
+ }
273
+ }
249
274
  else if (memberName === 'ref') {
250
275
  // minifier will clean this up
251
276
  if (newValue) {
@@ -496,9 +521,14 @@ const callNodeRefs = (vNode) => {
496
521
  };
497
522
  const renderVdom = (hostRef, renderFnResults) => {
498
523
  const hostElm = hostRef.$hostElement$;
524
+ const cmpMeta = hostRef.$cmpMeta$;
499
525
  const oldVNode = hostRef.$vnode$ || newVNode(null, null);
500
526
  const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
501
527
  hostTagName = hostElm.tagName;
528
+ if (cmpMeta.$attrsToReflect$) {
529
+ rootVnode.$attrs$ = rootVnode.$attrs$ || {};
530
+ cmpMeta.$attrsToReflect$.map(([propName, attribute]) => (rootVnode.$attrs$[attribute] = hostElm[propName]));
531
+ }
502
532
  rootVnode.$tag$ = null;
503
533
  rootVnode.$flags$ |= 4 /* isHost */;
504
534
  hostRef.$vnode$ = rootVnode;
@@ -632,6 +662,9 @@ const postUpdateComponent = (hostRef) => {
632
662
  // DOM WRITE!
633
663
  addHydratedFlag(elm);
634
664
  }
665
+ {
666
+ safeCall(instance, 'componentDidLoad');
667
+ }
635
668
  endPostUpdate();
636
669
  {
637
670
  hostRef.$onReadyResolve$(elm);
@@ -859,6 +892,9 @@ const proxyComponent = (Cstr, cmpMeta, flags) => {
859
892
  .map(([propName, m]) => {
860
893
  const attrName = m[1] || propName;
861
894
  attrNameToPropName.set(attrName, propName);
895
+ if (m[0] & 512 /* ReflectAttr */) {
896
+ cmpMeta.$attrsToReflect$.push([propName, attrName]);
897
+ }
862
898
  return attrName;
863
899
  });
864
900
  }
@@ -1036,6 +1072,9 @@ const bootstrapLazy = (lazyBundles, options = {}) => {
1036
1072
  {
1037
1073
  cmpMeta.$listeners$ = compactMeta[3];
1038
1074
  }
1075
+ {
1076
+ cmpMeta.$attrsToReflect$ = [];
1077
+ }
1039
1078
  {
1040
1079
  cmpMeta.$watchers$ = {};
1041
1080
  }
@@ -1,4 +1,4 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-26083270.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-a6d43dfd.js';
2
2
 
3
3
  /*
4
4
  Stencil Client Patch Esm v2.15.2 | MIT Licensed | https://stenciljs.com
@@ -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":[1,"cms-endpoint"],"language":[1],"handleClick":[1,"handle-click"],"clientStyling":[1,"client-styling"],"clientStylingUrl":[1,"client-styling-url"],"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],"bannerMatrixReady":[32]},[[8,"WebComponentsReady","handleBannerReady"]]]]]], options);
13
+ return bootstrapLazy([["blog-article-details",[[1,"blog-article-details",{"cmsEndpoint":[513,"cms-endpoint"],"language":[513],"userRoles":[513,"user-roles"],"cmsEnv":[513,"cms-env"],"handleClick":[513,"handle-click"],"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"],"postMessageEvent":[513,"post-message-event"],"postId":[514,"post-id"],"hasErrors":[32],"limitStylingAppends":[32],"isLoading":[32],"bannerMatrixReady":[32],"device":[32]},[[8,"BannerMatrixReady","handleBannerReady"]]]]]], options);
14
14
  });
15
15
  };
16
16
 
@@ -0,0 +1,2 @@
1
+ import { Config } from '../../../../../../../../../../stencil-public-runtime';
2
+ export declare const config: Config;
@@ -7,6 +7,14 @@ export declare class BlogArticleDetails {
7
7
  * Language of the widget
8
8
  */
9
9
  language: string;
10
+ /**
11
+ * User roles
12
+ */
13
+ userRoles: string;
14
+ /**
15
+ * CMS Endpoint stage
16
+ */
17
+ cmsEnv: string;
10
18
  /**
11
19
  * Handle when you click on show more button
12
20
  */
@@ -24,8 +32,8 @@ export declare class BlogArticleDetails {
24
32
  */
25
33
  showPublishingDate: boolean;
26
34
  /**
27
- * Property used to display the image
28
- */
35
+ * Property used to display the image
36
+ */
29
37
  showImage: boolean;
30
38
  /**
31
39
  * Property used to display the image
@@ -47,6 +55,7 @@ export declare class BlogArticleDetails {
47
55
  private limitStylingAppends;
48
56
  private isLoading;
49
57
  bannerMatrixReady: boolean;
58
+ device: string;
50
59
  handleBannerReady(): void;
51
60
  watchEndpoint(newValue: string, oldValue: string): void;
52
61
  private stylingContainer;
@@ -54,6 +63,8 @@ export declare class BlogArticleDetails {
54
63
  connectedCallback(): void;
55
64
  getBlogArticleDetails(): void;
56
65
  componentDidRender(): void;
66
+ componentDidLoad(): void;
67
+ detectAndAlertDeviceType(): void;
57
68
  setClientStyling: () => void;
58
69
  setClientStylingURL: () => void;
59
70
  renderContentConditionally: (content: string) => HTMLElement;
@@ -19,6 +19,10 @@ export namespace Components {
19
19
  * Endpoint URL for the source of data
20
20
  */
21
21
  "cmsEndpoint": string;
22
+ /**
23
+ * CMS Endpoint stage
24
+ */
25
+ "cmsEnv": string;
22
26
  /**
23
27
  * Handle when you click on show more button
24
28
  */
@@ -51,6 +55,10 @@ export namespace Components {
51
55
  * Property used to display the image
52
56
  */
53
57
  "showTitle": boolean;
58
+ /**
59
+ * User roles
60
+ */
61
+ "userRoles": string;
54
62
  }
55
63
  }
56
64
  declare global {
@@ -78,6 +86,10 @@ declare namespace LocalJSX {
78
86
  * Endpoint URL for the source of data
79
87
  */
80
88
  "cmsEndpoint"?: string;
89
+ /**
90
+ * CMS Endpoint stage
91
+ */
92
+ "cmsEnv"?: string;
81
93
  /**
82
94
  * Handle when you click on show more button
83
95
  */
@@ -110,6 +122,10 @@ declare namespace LocalJSX {
110
122
  * Property used to display the image
111
123
  */
112
124
  "showTitle"?: boolean;
125
+ /**
126
+ * User roles
127
+ */
128
+ "userRoles"?: string;
113
129
  }
114
130
  interface IntrinsicElements {
115
131
  "blog-article-details": BlogArticleDetails;
@@ -0,0 +1,3 @@
1
+ export declare function checkDeviceType(): 'mobile' | 'tablet' | 'desktop';
2
+ export declare const getDevice: () => "Android" | "iPhone" | "iPad" | "PC";
3
+ export declare const getDevicePlatform: () => "dk" | "mtWeb";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/blog-article-details",
3
- "version": "1.13.6",
3
+ "version": "1.13.17",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.js",
6
6
  "es2015": "./dist/esm/index.mjs",
@@ -1 +0,0 @@
1
- import{r as t,h as i}from"./p-b3ab7cf8.js";const n=["ro","en","fr","ar"],r={en:{error:"Error"},ro:{error:"Eroare"},fr:{error:"Error"},ar:{error:"خطأ"}},o=class{constructor(n){t(this,n),this.language="en",this.clientStyling="",this.clientStylingUrl="",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.bannerMatrixReady=!1,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=>{var n,r;return-1!==(null==t?void 0:t.indexOf("<bannermatrix-banner"))?this.bannerMatrixReady?i("div",{class:"BlogContent",innerHTML:null===(r=this.blogData)||void 0===r?void 0:r.content}):null:i("div",{class:"BlogContent",innerHTML:null===(n=this.blogData)||void 0===n?void 0:n.content})}}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&&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.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}render(){var t,o,s,e;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"},null===(t=this.blogData)||void 0===t?void 0:t.publishingDate),this.showImage&&i("div",{class:"BlogBanner"},i("img",{src:this.blogData.image.src,alt:null===(o=this.blogData)||void 0===o?void 0:o.title})),this.showTitle&&i("div",{class:"BlogTitle"},null===(s=this.blogData)||void 0===s?void 0:s.title),this.showContent&&this.renderContentConditionally(null===(e=this.blogData)||void 0===e?void 0:e.content)))}static get watchers(){return{cmsEndpoint:["watchEndpoint"],language:["watchEndpoint"]}}};o.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{o as blog_article_details}
@@ -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)},r=e=>Promise.resolve(e),c=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replace}catch(e){}return!1})(),i=(e,t,n)=>{n&&n.map((([n,l,s])=>{const r=a(e,n),c=u(t,s),i=f(n);o.ael(r,l,c,i),(t.o=t.o||[]).push((()=>o.rel(r,l,c,i)))}))},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),h=new WeakMap,d=e=>"sc-"+e.h,$={},y=e=>"object"==(e=typeof e)||"function"===e,p=(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&&!y(l))&&(l+=""),s&&o?r[r.length-1].$+=l:r.push(s?m(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=m(e,null);return i.p=t,r.length>0&&(i.m=r),i},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 r=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("ref"===t)l&&l(e);else{const c=y(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)}}},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||$,r=t.p||$;for(l in o)l in r||w(s,l,o[l],void 0,n,t.t);for(l in r)w(s,l,o[l],r[l],n,t.t)},v=(t,n,l)=>{let o,r,c=n.m[l],i=0;if(null!==c.$)o=c.g=s.createTextNode(c.$);else if(o=c.g=s.createElement(c.S),j(null,c,!1),null!=e&&o["s-si"]!==e&&o.classList.add(o["s-si"]=e),c.m)for(i=0;i<c.m.length;++i)r=v(t,c,i),r&&o.appendChild(r);return o},M=(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=v(null,l,o),c&&(s[o].g=c,i.insertBefore(c,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,r=0,c=t.length-1,i=t[0],u=t[c],a=l.length-1,f=l[0],h=l[a];for(;o<=c&&r<=a;)null==i?i=t[++o]:null==u?u=t[--c]:null==f?f=l[++r]:null==h?h=l[--a]:C(i,f)?(O(i,f),i=t[++o],f=l[++r]):C(u,h)?(O(u,h),u=t[--c],h=l[--a]):C(i,h)?(O(i,h),e.insertBefore(i.g,u.g.nextSibling),i=t[++o],h=l[--a]):C(u,f)?(O(u,f),e.insertBefore(u.g,i.g),u=t[--c],f=l[++r]):(s=v(t&&t[r],n,r),f=l[++r],s&&i.g.parentNode.insertBefore(s,i.g));o>c?M(e,null==l[a+1]?null:l[a+1].g,n,l,r,a):r>a&&k(t,o,c)})(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((()=>N(e,t)));e.t|=512},N=(e,t)=>{const n=e.i;return t&&(e.t|=256,e.u&&(e.u.map((([e,t])=>L(n,e,t))),e.u=null)),U(void 0,(()=>R(e,n,t)))},R=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=d(t),l=Q.get(n);if(e=11===e.nodeType?e:s,l)if("string"==typeof l){let t,o=h.get(e=e.head||e);o||h.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);T(e,t),o&&(o.map((e=>e())),l["s-rc"]=void 0);{const t=l["s-p"],n=()=>A(e);0===t.length?n():(Promise.all(t).then(n),e.t|=4,t.length=0)}},T=(n,l)=>{try{l=l.render(),n.t&=-17,n.t|=2,((n,l)=>{const s=n.M,o=n.C||m(null,null),r=(e=>e&&e.S===b)(l)?l:p(null,null,l);t=s.tagName,r.S=null,r.t|=4,n.C=r,r.g=o.g=s.shadowRoot||s,e=s["s-sc"],O(o,r)})(n,l)}catch(e){I(e,n.M)}return null},A=e=>{const t=e.M,n=e.v;L(e.i,"componentDidRender"),64&e.t||(e.t|=64,W(t),e.O(t),n||F()),e.j&&(e.j(),e.j=void 0),512&e.t&&ne((()=>E(e,!1))),e.t&=-517},F=()=>{W(s.documentElement),ne((()=>(e=>{const t=o.ce("appload",{detail:{namespace:"blog-article-details"}});return e.dispatchEvent(t),t})(l)))},L=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){I(e)}},U=(e,t)=>e&&e.then?e.then(t):t(),W=e=>e.classList.add("hydrated"),q=(e,t,n)=>{if(t.P){e.watchers&&(t.N=e.watchers);const l=Object.entries(t.P),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,r=s.R.get(t),c=s.t,i=s.i;if(n=((e,t)=>null==e||y(e)?e:4&t?"false"!==e&&(""===e||!!e):2&t?parseFloat(e):1&t?e+"":e)(n,l.P[t][0]),(!(8&c)||void 0===r)&&n!==r&&(!Number.isNaN(r)||!Number.isNaN(n))&&(s.R.set(t,n),i)){if(l.N&&128&c){const e=l.N[t];e&&e.map((e=>{try{i[e](n,r,t)}catch(e){I(e,o)}}))}2==(18&c)&&E(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},D=e=>{L(e,"connectedCallback")},H=(e,t={})=>{const n=[],r=t.exclude||[],u=l.customElements,a=s.head,f=a.querySelector("meta[charset]"),h=s.createElement("style"),$=[];let y,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],P:t[2],T:t[3]};l.P=t[2],l.T=t[3],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(){y&&(clearTimeout(y),y=null),p?$.push(this):o.jmp((()=>(e=>{if(0==(1&o.t)){const t=_(e),n=t.k,l=()=>{};if(1&t.t)i(e,t,n.T),D(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.P&&Object.entries(n.P).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,q(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(),D(t.i)}if(s.style){let e=s.style;const t=d(n);if(!Q.has(t)){const l=()=>{};((e,t,n)=>{let l=Q.get(e);c&&n?(l=l||new CSSStyleSheet,l.replace(t)):l=t,Q.set(e,l)})(t,e,!!(1&n.t)),l()}}}const o=t.v,r=()=>E(t,!0);o&&o["s-rc"]?o["s-rc"].push(r):r()})(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.F=e[0],r.includes(s)||u.get(s)||(n.push(s),u.define(s,q(a,l,1)))}))})),h.innerHTML=n+"{visibility:hidden}.hydrated{visibility:inherit}",h.setAttribute("data-styles",""),a.insertBefore(h,f?f.nextSibling:a.firstChild),p=!1,$.length?$.map((e=>e.connectedCallback())):o.jmp((()=>y=setTimeout(F,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.O=e)),e["s-p"]=[],e["s-rc"]=[],i(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.F,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=>r().then(e),le=Z(Y,!0);export{H as b,p as h,r as p,z as r}
@@ -1,2 +0,0 @@
1
- import { Config } from '../../../../../../../../../../../stencil-public-runtime';
2
- export declare const config: Config;