@everymatrix/blog-article-details 1.24.7 → 1.26.0

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 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-82230cc2",[[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"],postMessageEvent:[513,"post-message-event"],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)));
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-07387433",[[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"],postMessageEvent:[513,"post-message-event"],postId:[514,"post-id"],postSlug:[513,"post-slug"],postCustomPath:[513,"post-custom-path"],intlDateTimeFormat:[1,"intl-date-time-format"],hasErrors:[32],limitStylingAppends:[32],isLoading:[32],bannerMatrixReady:[32],device:[32]},[[8,"BannerMatrixReady","handleBannerReady"]]]]]],t)));
@@ -0,0 +1 @@
1
+ import{r as t,h as i}from"./p-68e0210a.js";const n=["ro","en","fr","ar","hr"],e={en:{error:"Error"},ro:{error:"Eroare"},fr:{error:"Error"},ar:{error:"خطأ"},hr:{error:"Greška"}};const r=class{constructor(n){t(this,n),this.language="en",this.userRoles="everyone",this.cmsEnv="stage",this.clientStyling="",this.clientStylingUrl="",this.showPublishingDate=!0,this.showImage=!0,this.showTitle=!0,this.showContent=!0,this.postMessageEvent="articleActionButton",this.intlDateTimeFormat="",this.hasErrors=!1,this.limitStylingAppends=!1,this.isLoading=!0,this.bannerMatrixReady=!1,this.device="",this.setClientStyling=()=>{let t=document.createElement("style");t.innerHTML=this.clientStyling,this.stylingContainer.prepend(t)},this.setClientStylingURL=()=>{let t=new URL(this.clientStylingUrl),i=document.createElement("style");fetch(t.href).then((t=>t.text())).then((t=>{i.innerHTML=t,setTimeout((()=>{this.stylingContainer.prepend(i)}),1)})).catch((t=>{console.log("error ",t)}))},this.renderContentConditionally=t=>-1!==(null==t?void 0:t.indexOf("<bannermatrix-banner"))?this.bannerMatrixReady?i("div",{class:"BlogContent",innerHTML:t}):null:i("div",{class:"BlogContent",innerHTML:t}),this.setImage=t=>{let i="";switch(this.device){case"mobile":i=t.sources[0].pictureSource;break;case"tablet":i=t.sources[1].pictureSource;break;case"desktop":i=t.sources[2].pictureSource}return i}}handleBannerReady(){this.bannerMatrixReady=!0}watchEndpoint(t,i){t&&t!=i&&this.cmsEndpoint&&this.getBlogArticleDetails()}connectedCallback(){this.cmsEndpoint&&this.language&&this.getBlogArticleDetails()}getBlogArticleDetails(){if(!this.postId&&!this.postSlug&&!this.postCustomPath)throw this.hasErrors=!0,new Error("postId, postSlug or postCustomPath parameter has to be provided!");this.isLoading=!0;let t=new URL(`${this.cmsEndpoint}/${this.language}/blog-posts/${this.postCustomPath?"":this.postSlug||this.postId}`);t.searchParams.append("env",this.cmsEnv),t.searchParams.append("userRoles",this.userRoles),t.searchParams.append("device",(()=>{const t=(()=>{let t=window.navigator.userAgent;return t.toLowerCase().match(/android/i)?"Android":t.toLowerCase().match(/iphone/i)?"iPhone":t.toLowerCase().match(/ipad|ipod/i)?"iPad":"PC"})();if(t)return"PC"===t?"dk":"mtWeb"})()),this.postCustomPath&&t.searchParams.append("customURL",this.postCustomPath),fetch(t.href).then((t=>{if(t.status>=300)throw this.hasErrors=!0,new Error("There was an error while fetching the data");return t.json()})).then((t=>{if(t.count>1&&this.postCustomPath){let i,n=new Date(t.items[0].publishingDate);for(let e=1;e<t.items.length;e++){const r=new Date(t.items[e].publishingDate);n<r&&(n=r,i=e)}this.blogData=t.items[i]}else this.blogData=this.postCustomPath?t.items[0]:t;this.isLoading=!1})).catch((t=>{this.hasErrors=!0,console.log("Error",t)})).finally((()=>this.isLoading=!1))}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}componentDidLoad(){this.detectAndAlertDeviceType()}detectAndAlertDeviceType(){this.device=function(){const t=navigator.userAgent.toLowerCase();let i="";return i=t.includes("android")||t.includes("iphone")||t.includes("ipad")?function(){const t=screen.availWidth;return t<600?"mobile":t>=600&&t<1100?"tablet":void 0}():"desktop",i}()}formatDate(t){return new Intl.DateTimeFormat(this.intlDateTimeFormat||"en-GB").format(new Date(t))}render(){var t,r,s,o,h;return this.hasErrors?i("div",{class:"BlogArticleDetails"},i("div",{class:"Title"},(()=>{const t=this.language;return e[void 0!==t&&n.includes(t)?t:"en"].error})())):this.isLoading?void 0:i("div",{ref:t=>this.stylingContainer=t},i("div",{class:"GridContainer"},this.showPublishingDate&&i("div",{class:"BlogDate"},this.formatDate(null===(t=this.blogData)||void 0===t?void 0:t.publishingDate)),this.showImage&&i("div",{class:"BlogBanner"},(null===(r=this.blogData.image)||void 0===r?void 0:r.src)?i("img",{src:this.setImage(this.blogData.image),alt:this.blogData.image.slug}):(null===(s=this.blogData.video)||void 0===s?void 0:s.sources[this.device])?i("video",{src:this.blogData.video.sources[this.device],controls:!0}):i("h1",{style:{color:"white"}},"No Image")),this.showTitle&&i("div",{class:"BlogTitle"},null===(o=this.blogData)||void 0===o?void 0:o.title),this.showContent&&this.renderContentConditionally(null===(h=this.blogData)||void 0===h?void 0:h.content)))}static get watchers(){return{cmsEndpoint:["watchEndpoint"],language:["watchEndpoint"]}}};r.style=":host {\n display: block;\n}\n\n.GridContainer {\n overflow: auto;\n margin: auto;\n width: 100%;\n padding-bottom: 30px;\n background-color: #07072A;\n display: grid;\n grid-template-rows: auto;\n grid-template-columns: 30px 60px 1fr 30px;\n gap: 10px;\n}\n.GridContainer .BlogBanner {\n grid-column: 1/5;\n grid-row: 1/3;\n}\n.GridContainer .BlogBanner img {\n width: 100%;\n height: auto;\n}\n.GridContainer .BlogDate {\n grid-column: 2/3;\n grid-row: 2/3;\n font-size: 12px;\n border-radius: 5px 5px 0 0;\n padding: 10px;\n width: fit-content;\n text-align: center;\n color: #FFF;\n background-color: #0D0D4D;\n z-index: 1;\n text-wrap: nowrap;\n}\n.GridContainer .BlogTitle {\n grid-column: 2/4;\n font-size: 24px;\n color: #FFF;\n}\n.GridContainer .BlogContent {\n grid-column: 2/4;\n font-size: 14px;\n color: #FFF;\n}\n\n@container (max-width: 475px) {\n .GridContainer {\n font-size: 12px;\n }\n}";export{r as blog_article_details}
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-d983d0f8.js');
6
6
 
7
7
  const DEFAULT_LANGUAGE = 'en';
8
- const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar'];
8
+ const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hr'];
9
9
  const TRANSLATIONS = {
10
10
  en: {
11
11
  error: 'Error',
@@ -18,6 +18,9 @@ const TRANSLATIONS = {
18
18
  },
19
19
  ar: {
20
20
  error: 'خطأ',
21
+ },
22
+ hr: {
23
+ error: 'Greška',
21
24
  }
22
25
  };
23
26
  const translate = (key, customLang) => {
@@ -1,5 +1,5 @@
1
1
  const DEFAULT_LANGUAGE = 'en';
2
- const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar'];
2
+ const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hr'];
3
3
  const TRANSLATIONS = {
4
4
  en: {
5
5
  error: 'Error',
@@ -12,6 +12,9 @@ const TRANSLATIONS = {
12
12
  },
13
13
  ar: {
14
14
  error: 'خطأ',
15
+ },
16
+ hr: {
17
+ error: 'Greška',
15
18
  }
16
19
  };
17
20
  export const translate = (key, customLang) => {
@@ -1,7 +1,7 @@
1
1
  import { proxyCustomElement, HTMLElement, h } from '@stencil/core/internal/client';
2
2
 
3
3
  const DEFAULT_LANGUAGE = 'en';
4
- const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar'];
4
+ const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hr'];
5
5
  const TRANSLATIONS = {
6
6
  en: {
7
7
  error: 'Error',
@@ -14,6 +14,9 @@ const TRANSLATIONS = {
14
14
  },
15
15
  ar: {
16
16
  error: 'خطأ',
17
+ },
18
+ hr: {
19
+ error: 'Greška',
17
20
  }
18
21
  };
19
22
  const translate = (key, customLang) => {
@@ -1,7 +1,7 @@
1
1
  import { r as registerInstance, h } from './index-a6d43dfd.js';
2
2
 
3
3
  const DEFAULT_LANGUAGE = 'en';
4
- const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar'];
4
+ const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hr'];
5
5
  const TRANSLATIONS = {
6
6
  en: {
7
7
  error: 'Error',
@@ -14,6 +14,9 @@ const TRANSLATIONS = {
14
14
  },
15
15
  ar: {
16
16
  error: 'خطأ',
17
+ },
18
+ hr: {
19
+ error: 'Greška',
17
20
  }
18
21
  };
19
22
  const translate = (key, customLang) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/blog-article-details",
3
- "version": "1.24.7",
3
+ "version": "1.26.0",
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-68e0210a.js";const n=["ro","en","fr","ar"],e={en:{error:"Error"},ro:{error:"Eroare"},fr:{error:"Error"},ar:{error:"خطأ"}};const s=class{constructor(n){t(this,n),this.language="en",this.userRoles="everyone",this.cmsEnv="stage",this.clientStyling="",this.clientStylingUrl="",this.showPublishingDate=!0,this.showImage=!0,this.showTitle=!0,this.showContent=!0,this.postMessageEvent="articleActionButton",this.intlDateTimeFormat="",this.hasErrors=!1,this.limitStylingAppends=!1,this.isLoading=!0,this.bannerMatrixReady=!1,this.device="",this.setClientStyling=()=>{let t=document.createElement("style");t.innerHTML=this.clientStyling,this.stylingContainer.prepend(t)},this.setClientStylingURL=()=>{let t=new URL(this.clientStylingUrl),i=document.createElement("style");fetch(t.href).then((t=>t.text())).then((t=>{i.innerHTML=t,setTimeout((()=>{this.stylingContainer.prepend(i)}),1)})).catch((t=>{console.log("error ",t)}))},this.renderContentConditionally=t=>-1!==(null==t?void 0:t.indexOf("<bannermatrix-banner"))?this.bannerMatrixReady?i("div",{class:"BlogContent",innerHTML:t}):null:i("div",{class:"BlogContent",innerHTML:t}),this.setImage=t=>{let i="";switch(this.device){case"mobile":i=t.sources[0].pictureSource;break;case"tablet":i=t.sources[1].pictureSource;break;case"desktop":i=t.sources[2].pictureSource}return i}}handleBannerReady(){this.bannerMatrixReady=!0}watchEndpoint(t,i){t&&t!=i&&this.cmsEndpoint&&this.getBlogArticleDetails()}connectedCallback(){this.cmsEndpoint&&this.language&&this.getBlogArticleDetails()}getBlogArticleDetails(){if(!this.postId&&!this.postSlug&&!this.postCustomPath)throw this.hasErrors=!0,new Error("postId, postSlug or postCustomPath parameter has to be provided!");this.isLoading=!0;let t=new URL(`${this.cmsEndpoint}/${this.language}/blog-posts/${this.postCustomPath?"":this.postSlug||this.postId}`);t.searchParams.append("env",this.cmsEnv),t.searchParams.append("userRoles",this.userRoles),t.searchParams.append("device",(()=>{const t=(()=>{let t=window.navigator.userAgent;return t.toLowerCase().match(/android/i)?"Android":t.toLowerCase().match(/iphone/i)?"iPhone":t.toLowerCase().match(/ipad|ipod/i)?"iPad":"PC"})();if(t)return"PC"===t?"dk":"mtWeb"})()),this.postCustomPath&&t.searchParams.append("customURL",this.postCustomPath),fetch(t.href).then((t=>{if(t.status>=300)throw this.hasErrors=!0,new Error("There was an error while fetching the data");return t.json()})).then((t=>{if(t.count>1&&this.postCustomPath){let i,n=new Date(t.items[0].publishingDate);for(let e=1;e<t.items.length;e++){const s=new Date(t.items[e].publishingDate);n<s&&(n=s,i=e)}this.blogData=t.items[i]}else this.blogData=this.postCustomPath?t.items[0]:t;this.isLoading=!1})).catch((t=>{this.hasErrors=!0,console.log("Error",t)})).finally((()=>this.isLoading=!1))}componentDidRender(){!this.limitStylingAppends&&this.stylingContainer&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}componentDidLoad(){this.detectAndAlertDeviceType()}detectAndAlertDeviceType(){this.device=function(){const t=navigator.userAgent.toLowerCase();let i="";return i=t.includes("android")||t.includes("iphone")||t.includes("ipad")?function(){const t=screen.availWidth;return t<600?"mobile":t>=600&&t<1100?"tablet":void 0}():"desktop",i}()}formatDate(t){return new Intl.DateTimeFormat(this.intlDateTimeFormat||"en-GB").format(new Date(t))}render(){var t,s,o,r,h;return this.hasErrors?i("div",{class:"BlogArticleDetails"},i("div",{class:"Title"},(()=>{const t=this.language;return e[void 0!==t&&n.includes(t)?t:"en"].error})())):this.isLoading?void 0:i("div",{ref:t=>this.stylingContainer=t},i("div",{class:"GridContainer"},this.showPublishingDate&&i("div",{class:"BlogDate"},this.formatDate(null===(t=this.blogData)||void 0===t?void 0:t.publishingDate)),this.showImage&&i("div",{class:"BlogBanner"},(null===(s=this.blogData.image)||void 0===s?void 0:s.src)?i("img",{src:this.setImage(this.blogData.image),alt:this.blogData.image.slug}):(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")),this.showTitle&&i("div",{class:"BlogTitle"},null===(r=this.blogData)||void 0===r?void 0:r.title),this.showContent&&this.renderContentConditionally(null===(h=this.blogData)||void 0===h?void 0:h.content)))}static get watchers(){return{cmsEndpoint:["watchEndpoint"],language:["watchEndpoint"]}}};s.style=":host {\n display: block;\n}\n\n.GridContainer {\n overflow: auto;\n margin: auto;\n width: 100%;\n padding-bottom: 30px;\n background-color: #07072A;\n display: grid;\n grid-template-rows: auto;\n grid-template-columns: 30px 60px 1fr 30px;\n gap: 10px;\n}\n.GridContainer .BlogBanner {\n grid-column: 1/5;\n grid-row: 1/3;\n}\n.GridContainer .BlogBanner img {\n width: 100%;\n height: auto;\n}\n.GridContainer .BlogDate {\n grid-column: 2/3;\n grid-row: 2/3;\n font-size: 12px;\n border-radius: 5px 5px 0 0;\n padding: 10px;\n width: fit-content;\n text-align: center;\n color: #FFF;\n background-color: #0D0D4D;\n z-index: 1;\n text-wrap: nowrap;\n}\n.GridContainer .BlogTitle {\n grid-column: 2/4;\n font-size: 24px;\n color: #FFF;\n}\n.GridContainer .BlogContent {\n grid-column: 2/4;\n font-size: 14px;\n color: #FFF;\n}\n\n@container (max-width: 475px) {\n .GridContainer {\n font-size: 12px;\n }\n}";export{s as blog_article_details}