@everymatrix/blog-article-details 1.10.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/dist/blog-article-details/blog-article-details.esm.js +1 -0
  2. package/dist/blog-article-details/index.esm.js +0 -0
  3. package/dist/blog-article-details/p-6214f0ca.entry.js +1 -0
  4. package/dist/blog-article-details/p-7187d97f.js +1 -0
  5. package/dist/cjs/blog-article-details.cjs.entry.js +146 -0
  6. package/dist/cjs/blog-article-details.cjs.js +19 -0
  7. package/dist/cjs/index-df694837.js +1122 -0
  8. package/dist/cjs/index.cjs.js +2 -0
  9. package/dist/cjs/loader.cjs.js +21 -0
  10. package/dist/collection/collection-manifest.json +12 -0
  11. package/dist/collection/components/blog-article-details/blog-article-details.css +51 -0
  12. package/dist/collection/components/blog-article-details/blog-article-details.js +350 -0
  13. package/dist/collection/index.js +1 -0
  14. package/dist/collection/utils/locale.utils.js +20 -0
  15. package/dist/collection/utils/utils.js +0 -0
  16. package/dist/components/blog-article-details.d.ts +11 -0
  17. package/dist/components/blog-article-details.js +176 -0
  18. package/dist/components/index.d.ts +26 -0
  19. package/dist/components/index.js +1 -0
  20. package/dist/esm/blog-article-details.entry.js +142 -0
  21. package/dist/esm/blog-article-details.js +17 -0
  22. package/dist/esm/index-c07b2186.js +1097 -0
  23. package/dist/esm/index.js +1 -0
  24. package/dist/esm/loader.js +17 -0
  25. package/dist/esm/polyfills/core-js.js +11 -0
  26. package/dist/esm/polyfills/css-shim.js +1 -0
  27. package/dist/esm/polyfills/dom.js +79 -0
  28. package/dist/esm/polyfills/es5-html-element.js +1 -0
  29. package/dist/esm/polyfills/index.js +34 -0
  30. package/dist/esm/polyfills/system.js +6 -0
  31. package/dist/index.cjs.js +1 -0
  32. package/dist/index.js +1 -0
  33. package/dist/stencil.config.js +22 -0
  34. package/dist/types/Users/adrian.pripon/Documents/Work/stencil/widgets-stencil/packages/blog-article-details/.stencil/packages/blog-article-details/stencil.config.d.ts +2 -0
  35. package/dist/types/components/blog-article-details/blog-article-details.d.ts +61 -0
  36. package/dist/types/components.d.ts +133 -0
  37. package/dist/types/index.d.ts +1 -0
  38. package/dist/types/stencil-public-runtime.d.ts +1565 -0
  39. package/dist/types/utils/locale.utils.d.ts +1 -0
  40. package/dist/types/utils/utils.d.ts +0 -0
  41. package/loader/cdn.js +3 -0
  42. package/loader/index.cjs.js +3 -0
  43. package/loader/index.d.ts +12 -0
  44. package/loader/index.es2017.js +3 -0
  45. package/loader/index.js +4 -0
  46. package/loader/package.json +10 -0
  47. package/package.json +23 -0
@@ -0,0 +1,142 @@
1
+ import { r as registerInstance, h } from './index-c07b2186.js';
2
+
3
+ const DEFAULT_LANGUAGE = 'en';
4
+ const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar'];
5
+ const TRANSLATIONS = {
6
+ en: {
7
+ error: 'Error',
8
+ },
9
+ ro: {
10
+ error: 'Eroare',
11
+ },
12
+ fr: {
13
+ error: 'Error',
14
+ },
15
+ ar: {
16
+ error: 'خطأ',
17
+ }
18
+ };
19
+ const translate = (key, customLang) => {
20
+ const lang = customLang;
21
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
22
+ };
23
+
24
+ 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
+
26
+ const BlogArticleDetails = class {
27
+ constructor(hostRef) {
28
+ registerInstance(this, hostRef);
29
+ /**
30
+ * Language of the widget
31
+ */
32
+ this.language = 'en';
33
+ /**
34
+ * Client custom styling via string
35
+ */
36
+ this.clientStyling = '';
37
+ /**
38
+ * Client custom styling via url
39
+ */
40
+ this.clientStylingurl = '';
41
+ /**
42
+ * Client custom styling via url content
43
+ */
44
+ this.clientStylingUrlContent = '';
45
+ /**
46
+ * Property used to display the publishing date
47
+ */
48
+ this.showPublishingDate = true;
49
+ /**
50
+ * Property used to display the image
51
+ */
52
+ this.showImage = true;
53
+ /**
54
+ * Property used to display the image
55
+ */
56
+ this.showTitle = true;
57
+ /**
58
+ * Property used to display the description
59
+ */
60
+ this.showContent = true;
61
+ /**
62
+ * Event name to be sent when the button is clicked
63
+ */
64
+ this.postMessageEvent = 'articleActionButton';
65
+ this.hasErrors = false;
66
+ this.limitStylingAppends = false;
67
+ this.isLoading = true;
68
+ this.setClientStyling = () => {
69
+ let sheet = document.createElement('style');
70
+ sheet.innerHTML = this.clientStyling;
71
+ this.stylingContainer.prepend(sheet);
72
+ };
73
+ this.setClientStylingURL = () => {
74
+ let url = new URL(this.clientStylingurl);
75
+ let cssFile = document.createElement('style');
76
+ fetch(url.href)
77
+ .then((res) => res.text())
78
+ .then((data) => {
79
+ this.clientStylingUrlContent = data;
80
+ cssFile.innerHTML = data;
81
+ setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
82
+ })
83
+ .catch((err) => {
84
+ console.log('error ', err);
85
+ });
86
+ };
87
+ }
88
+ getBlogArticleDetails() {
89
+ if (!this.postId && isNaN(this.postId)) {
90
+ this.hasErrors = true;
91
+ throw new Error('The postId parameter is missing!');
92
+ }
93
+ this.isLoading = true;
94
+ let url = new URL(`${this.cmsEndpoint}/${this.language}/blog-posts/${this.postId}`);
95
+ fetch(url.href)
96
+ .then((res) => {
97
+ if (res.status >= 300) {
98
+ this.hasErrors = true;
99
+ throw new Error('There was an error while fetching the data');
100
+ }
101
+ return res.json();
102
+ })
103
+ .then((blogContent) => {
104
+ this.blogData = blogContent;
105
+ this.isLoading = false;
106
+ })
107
+ .catch((err) => {
108
+ this.hasErrors = true;
109
+ console.log('Error', err);
110
+ })
111
+ .finally(() => this.isLoading = false);
112
+ }
113
+ componentDidRender() {
114
+ // start custom styling area
115
+ if (!this.limitStylingAppends && this.stylingContainer) {
116
+ if (this.clientStyling)
117
+ this.setClientStyling();
118
+ if (this.clientStylingUrlContent)
119
+ this.setClientStylingURL();
120
+ this.limitStylingAppends = true;
121
+ }
122
+ // end custom styling area
123
+ }
124
+ componentWillLoad() {
125
+ this.getBlogArticleDetails();
126
+ }
127
+ render() {
128
+ if (this.hasErrors) {
129
+ return (h("div", { class: "BlogArticleDetails" }, h("div", { class: "Title" }, translate('error', this.language))));
130
+ }
131
+ if (!this.isLoading) {
132
+ return (h("div", { ref: el => this.stylingContainer = el }, h("div", { class: "GridContainer" }, this.showPublishingDate &&
133
+ h("div", { class: "BlogDate" }, this.blogData.publishingDate), this.showImage &&
134
+ h("div", { class: "BlogBanner" }, h("img", { src: this.blogData, alt: this.blogData.title })), this.showTitle &&
135
+ h("div", { class: "BlogTitle" }, this.blogData.title), this.showContent &&
136
+ h("div", { class: "BlogContent", innerHTML: this.blogData.content }))));
137
+ }
138
+ }
139
+ };
140
+ BlogArticleDetails.style = blogArticleDetailsCss;
141
+
142
+ export { BlogArticleDetails as blog_article_details };
@@ -0,0 +1,17 @@
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-c07b2186.js';
2
+
3
+ /*
4
+ Stencil Client Patch Browser v2.15.2 | MIT Licensed | https://stenciljs.com
5
+ */
6
+ const patchBrowser = () => {
7
+ const importMeta = import.meta.url;
8
+ const opts = {};
9
+ if (importMeta !== '') {
10
+ opts.resourcesUrl = new URL('.', importMeta).href;
11
+ }
12
+ return promiseResolve(opts);
13
+ };
14
+
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-stylingurl"],"clientStylingUrlContent":[1,"client-styling-url-content"],"showPublishingDate":[4,"show-publishing-date"],"showImage":[4,"show-image"],"showTitle":[4,"show-title"],"showContent":[4,"show-content"],"postMessageEvent":[1,"post-message-event"],"postId":[2,"post-id"],"hasErrors":[32],"limitStylingAppends":[32],"isLoading":[32]}]]]], options);
17
+ });