@everymatrix/blog-article-details 1.44.0 → 1.45.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.
Files changed (48) hide show
  1. package/dist/blog-article-details/blog-article-details.esm.js +1 -1
  2. package/dist/blog-article-details/p-0783b0ba.js +2 -0
  3. package/dist/blog-article-details/p-e1255160.js +1 -0
  4. package/dist/blog-article-details/p-f02359f3.entry.js +1 -0
  5. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  6. package/dist/cjs/blog-article-details.cjs.entry.js +223 -248
  7. package/dist/cjs/blog-article-details.cjs.js +17 -11
  8. package/dist/cjs/index-ade27b33.js +1254 -0
  9. package/dist/cjs/loader.cjs.js +7 -13
  10. package/dist/collection/collection-manifest.json +3 -3
  11. package/dist/collection/components/blog-article-details/blog-article-details.js +463 -485
  12. package/dist/collection/components/blog-article-details/index.js +1 -0
  13. package/dist/collection/utils/locale.utils.js +23 -23
  14. package/dist/collection/utils/utils.js +48 -48
  15. package/dist/esm/app-globals-0f993ce5.js +3 -0
  16. package/dist/esm/blog-article-details.entry.js +223 -248
  17. package/dist/esm/blog-article-details.js +14 -11
  18. package/dist/esm/index-9d94198d.js +1228 -0
  19. package/dist/esm/loader.js +7 -13
  20. package/dist/stencil.config.dev.js +17 -0
  21. package/dist/stencil.config.js +14 -19
  22. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/blog-article-details/.stencil/packages/stencil/blog-article-details/stencil.config.d.ts +2 -0
  23. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/blog-article-details/.stencil/packages/stencil/blog-article-details/stencil.config.dev.d.ts +2 -0
  24. package/dist/types/components/blog-article-details/blog-article-details.d.ts +78 -78
  25. package/dist/types/components/blog-article-details/index.d.ts +1 -0
  26. package/dist/types/stencil-public-runtime.d.ts +142 -33
  27. package/loader/cdn.js +1 -3
  28. package/loader/index.cjs.js +1 -3
  29. package/loader/index.d.ts +13 -1
  30. package/loader/index.es2017.js +1 -3
  31. package/loader/index.js +1 -3
  32. package/loader/package.json +1 -0
  33. package/package.json +8 -6
  34. package/dist/blog-article-details/p-68e0210a.js +0 -1
  35. package/dist/blog-article-details/p-b8c9de45.entry.js +0 -1
  36. package/dist/cjs/index-d983d0f8.js +0 -1255
  37. package/dist/components/blog-article-details.d.ts +0 -11
  38. package/dist/components/blog-article-details.js +0 -317
  39. package/dist/components/index.d.ts +0 -26
  40. package/dist/components/index.js +0 -1
  41. package/dist/esm/index-a6d43dfd.js +0 -1230
  42. package/dist/esm/polyfills/core-js.js +0 -11
  43. package/dist/esm/polyfills/css-shim.js +0 -1
  44. package/dist/esm/polyfills/dom.js +0 -79
  45. package/dist/esm/polyfills/es5-html-element.js +0 -1
  46. package/dist/esm/polyfills/index.js +0 -34
  47. package/dist/esm/polyfills/system.js +0 -6
  48. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/blog-article-details/.stencil/packages/blog-article-details/stencil.config.d.ts +0 -2
@@ -1,496 +1,474 @@
1
- import { Component, Prop, State, Watch, h, Listen } from '@stencil/core';
2
- import { translate } from '../../utils/locale.utils';
3
- import { getDevicePlatform, getDeviceCustom } from '../../utils/utils';
1
+ import { h } from "@stencil/core";
2
+ import { translate } from "../../utils/locale.utils";
3
+ import { getDevicePlatform, getDeviceCustom } from "../../utils/utils";
4
4
  export class BlogArticleDetails {
5
- constructor() {
6
- /**
7
- * Language of the widget
8
- */
9
- this.language = 'en';
10
- /**
11
- * User roles
12
- */
13
- this.userRoles = 'everyone';
14
- /**
15
- * CMS Endpoint stage
16
- */
17
- this.cmsEnv = 'stage';
18
- /**
19
- * Client custom styling via string
20
- */
21
- this.clientStyling = '';
22
- /**
23
- * Client custom styling via url
24
- */
25
- this.clientStylingUrl = '';
26
- /**
27
- * Property used to display the publishing date
28
- */
29
- this.showPublishingDate = true;
30
- /**
31
- * Property used to display the image
32
- */
33
- this.showImage = true;
34
- /**
35
- * Property used to display the image
36
- */
37
- this.showTitle = true;
38
- /**
39
- * Property used to display the description
40
- */
41
- this.showContent = true;
42
- /**
43
- * Intl date format
44
- */
45
- this.intlDateTimeFormat = '';
46
- this.hasErrors = false;
47
- this.limitStylingAppends = false;
48
- this.isLoading = true;
49
- this.bannerMatrixReady = false;
50
- this.device = '';
51
- this.setClientStyling = () => {
52
- let sheet = document.createElement('style');
53
- sheet.innerHTML = this.clientStyling;
54
- this.stylingContainer.prepend(sheet);
55
- };
56
- this.setClientStylingURL = () => {
57
- let url = new URL(this.clientStylingUrl);
58
- let cssFile = document.createElement('style');
59
- fetch(url.href)
60
- .then((res) => res.text())
61
- .then((data) => {
62
- cssFile.innerHTML = data;
63
- setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
64
- })
65
- .catch((err) => {
66
- console.log('Error ', err);
67
- });
68
- };
69
- this.renderContentConditionally = (content) => {
70
- const hasBanner = (content === null || content === void 0 ? void 0 : content.indexOf('<bannermatrix-banner')) !== -1;
71
- if (!hasBanner) {
72
- return h("div", { class: "BlogContent", innerHTML: content });
73
- }
74
- if (this.bannerMatrixReady) {
75
- return h("div", { class: "BlogContent", innerHTML: content });
76
- }
77
- return null;
78
- };
79
- this.setImage = (image) => {
80
- let source = '';
81
- switch (this.device) {
82
- case 'mobile':
83
- source = image.sources[0].pictureSource;
84
- break;
85
- case 'tablet':
86
- source = image.sources[1].pictureSource;
87
- break;
88
- case 'desktop':
89
- source = image.sources[2].pictureSource;
90
- break;
91
- }
92
- return source;
93
- };
94
- }
95
- // Rerender when bannermatrix has finished loaded. Issue when bannermatrix passed as content from CMS.
96
- handleBannerReady() {
97
- this.bannerMatrixReady = true;
98
- }
99
- watchEndpoint(newValue, oldValue) {
100
- if (newValue && newValue != oldValue && this.cmsEndpoint && this.language && (this.postCustomPath || this.postSlug || this.postId)) {
101
- this.getBlogArticleDetails();
5
+ constructor() {
6
+ this.setClientStyling = () => {
7
+ let sheet = document.createElement('style');
8
+ sheet.innerHTML = this.clientStyling;
9
+ this.stylingContainer.prepend(sheet);
10
+ };
11
+ this.setClientStylingURL = () => {
12
+ let url = new URL(this.clientStylingUrl);
13
+ let cssFile = document.createElement('style');
14
+ fetch(url.href)
15
+ .then((res) => res.text())
16
+ .then((data) => {
17
+ cssFile.innerHTML = data;
18
+ setTimeout(() => { this.stylingContainer.prepend(cssFile); }, 1);
19
+ })
20
+ .catch((err) => {
21
+ console.log('Error ', err);
22
+ });
23
+ };
24
+ this.renderContentConditionally = (content) => {
25
+ const hasBanner = (content === null || content === void 0 ? void 0 : content.indexOf('<bannermatrix-banner')) !== -1;
26
+ if (!hasBanner) {
27
+ return h("div", { class: "BlogContent", innerHTML: content });
28
+ }
29
+ if (this.bannerMatrixReady) {
30
+ return h("div", { class: "BlogContent", innerHTML: content });
31
+ }
32
+ return null;
33
+ };
34
+ this.setImage = (image) => {
35
+ let source = '';
36
+ switch (this.device) {
37
+ case 'mobile':
38
+ source = image.sources[0].pictureSource;
39
+ break;
40
+ case 'tablet':
41
+ source = image.sources[1].pictureSource;
42
+ break;
43
+ case 'desktop':
44
+ source = image.sources[2].pictureSource;
45
+ break;
46
+ }
47
+ return source;
48
+ };
49
+ this.cmsEndpoint = undefined;
50
+ this.language = 'en';
51
+ this.userRoles = 'everyone';
52
+ this.cmsEnv = 'stage';
53
+ this.clientStyling = '';
54
+ this.clientStylingUrl = '';
55
+ this.showPublishingDate = true;
56
+ this.showImage = true;
57
+ this.showTitle = true;
58
+ this.showContent = true;
59
+ this.postId = undefined;
60
+ this.postSlug = undefined;
61
+ this.postCustomPath = undefined;
62
+ this.intlDateTimeFormat = '';
63
+ this.hasErrors = false;
64
+ this.limitStylingAppends = false;
65
+ this.isLoading = true;
66
+ this.bannerMatrixReady = false;
67
+ this.device = '';
102
68
  }
103
- }
104
- handleStylingChange(newValue, oldValue) {
105
- if (newValue !== oldValue)
106
- this.setClientStyling();
107
- }
108
- handleStylingUrlChange(newValue, oldValue) {
109
- if (newValue !== oldValue)
110
- this.setClientStylingURL();
111
- }
112
- connectedCallback() {
113
- if (this.cmsEndpoint && this.language && (this.postCustomPath || this.postSlug || this.postId)) {
114
- this.getBlogArticleDetails();
69
+ // Rerender when bannermatrix has finished loaded. Issue when bannermatrix passed as content from CMS.
70
+ handleBannerReady() {
71
+ this.bannerMatrixReady = true;
115
72
  }
116
- }
117
- getBlogArticleDetails() {
118
- if (!this.postId && !this.postSlug && !this.postCustomPath) {
119
- this.hasErrors = true;
120
- throw new Error('postId, postSlug or postCustomPath parameter has to be provided!');
73
+ watchEndpoint(newValue, oldValue) {
74
+ if (newValue && newValue != oldValue && this.cmsEndpoint && this.language && (this.postCustomPath || this.postSlug || this.postId)) {
75
+ this.getBlogArticleDetails();
76
+ }
77
+ }
78
+ handleStylingChange(newValue, oldValue) {
79
+ if (newValue !== oldValue)
80
+ this.setClientStyling();
81
+ }
82
+ handleStylingUrlChange(newValue, oldValue) {
83
+ if (newValue !== oldValue)
84
+ this.setClientStylingURL();
85
+ }
86
+ connectedCallback() {
87
+ if (this.cmsEndpoint && this.language && (this.postCustomPath || this.postSlug || this.postId)) {
88
+ this.getBlogArticleDetails();
89
+ }
90
+ }
91
+ getBlogArticleDetails() {
92
+ if (!this.postId && !this.postSlug && !this.postCustomPath) {
93
+ this.hasErrors = true;
94
+ throw new Error('postId, postSlug or postCustomPath parameter has to be provided!');
95
+ }
96
+ this.isLoading = true;
97
+ let url = new URL(`${this.cmsEndpoint}/${this.language}/blog-posts${this.postCustomPath ? '' : '/' + this.postSlug || '/' + this.postId}`);
98
+ url.searchParams.append('env', this.cmsEnv);
99
+ url.searchParams.append('userRoles', this.userRoles);
100
+ url.searchParams.append('device', getDevicePlatform());
101
+ if (this.postCustomPath) {
102
+ url.searchParams.append('customURL', this.postCustomPath);
103
+ }
104
+ fetch(url.href)
105
+ .then((res) => {
106
+ if (res.status >= 300) {
107
+ this.hasErrors = true;
108
+ throw new Error('There was an error while fetching the data');
109
+ }
110
+ return res.json();
111
+ })
112
+ .then((blogContent) => {
113
+ if (blogContent.count >= 1 && this.postCustomPath) {
114
+ let firstBlogPublishDate = new Date(blogContent.items[0].publishingDate);
115
+ let indexOfLatestPublished = 0;
116
+ for (let i = 1; i < blogContent.items.length; i++) {
117
+ const blogDate = new Date(blogContent.items[i].publishingDate);
118
+ if (firstBlogPublishDate.getTime() < blogDate.getTime()) {
119
+ firstBlogPublishDate = blogDate;
120
+ indexOfLatestPublished = i;
121
+ }
122
+ }
123
+ this.blogData = blogContent.items[indexOfLatestPublished];
124
+ }
125
+ else {
126
+ this.blogData = blogContent;
127
+ }
128
+ ;
129
+ this.isLoading = false;
130
+ })
131
+ .catch((err) => {
132
+ this.hasErrors = true;
133
+ console.log('Error', err);
134
+ })
135
+ .finally(() => this.isLoading = false);
121
136
  }
122
- this.isLoading = true;
123
- let url = new URL(`${this.cmsEndpoint}/${this.language}/blog-posts${this.postCustomPath ? '' : '/' + this.postSlug || '/' + this.postId}`);
124
- url.searchParams.append('env', this.cmsEnv);
125
- url.searchParams.append('userRoles', this.userRoles);
126
- url.searchParams.append('device', getDevicePlatform());
127
- if (this.postCustomPath) {
128
- url.searchParams.append('customURL', this.postCustomPath);
137
+ componentDidRender() {
138
+ // start custom styling area
139
+ if (!this.limitStylingAppends && this.stylingContainer) {
140
+ if (this.clientStyling)
141
+ this.setClientStyling();
142
+ if (this.clientStylingUrl)
143
+ this.setClientStylingURL();
144
+ this.limitStylingAppends = true;
145
+ }
146
+ // end custom styling area
147
+ }
148
+ componentDidLoad() {
149
+ this.detectAndAlertDeviceType();
150
+ }
151
+ detectAndAlertDeviceType() {
152
+ this.device = getDeviceCustom();
153
+ }
154
+ formatDate(dateString) {
155
+ return new Intl.DateTimeFormat(this.intlDateTimeFormat || 'en-GB').format(new Date(dateString));
129
156
  }
130
- fetch(url.href)
131
- .then((res) => {
132
- if (res.status >= 300) {
133
- this.hasErrors = true;
134
- throw new Error('There was an error while fetching the data');
135
- }
136
- return res.json();
137
- })
138
- .then((blogContent) => {
139
- if (blogContent.count >= 1 && this.postCustomPath) {
140
- let firstBlogPublishDate = new Date(blogContent.items[0].publishingDate);
141
- let indexOfLatestPublished = 0;
142
- for (let i = 1; i < blogContent.items.length; i++) {
143
- const blogDate = new Date(blogContent.items[i].publishingDate);
144
- if (firstBlogPublishDate.getTime() < blogDate.getTime()) {
145
- firstBlogPublishDate = blogDate;
146
- indexOfLatestPublished = i;
147
- }
157
+ render() {
158
+ var _a, _b, _c, _d, _e;
159
+ if (this.hasErrors) {
160
+ return (h("div", { class: "BlogArticleDetails" }, h("div", { class: "Title" }, translate('error', this.language))));
148
161
  }
149
- this.blogData = blogContent.items[indexOfLatestPublished];
150
- }
151
- else {
152
- this.blogData = blogContent;
153
- }
154
- ;
155
- this.isLoading = false;
156
- })
157
- .catch((err) => {
158
- this.hasErrors = true;
159
- console.log('Error', err);
160
- })
161
- .finally(() => this.isLoading = false);
162
- }
163
- componentDidRender() {
164
- // start custom styling area
165
- if (!this.limitStylingAppends && this.stylingContainer) {
166
- if (this.clientStyling)
167
- this.setClientStyling();
168
- if (this.clientStylingUrl)
169
- this.setClientStylingURL();
170
- this.limitStylingAppends = true;
162
+ if (!this.isLoading) {
163
+ return (h("div", { ref: el => this.stylingContainer = el }, h("div", { class: "DetailsContainer" }, h("div", { class: "DetailsHeadWrapper" }, this.showPublishingDate && this.blogData.publishingDate &&
164
+ h("div", { class: "BlogDate" }, this.formatDate((_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("div", { style: { background: `url(${this.setImage(this.blogData.image)}) no-repeat center center / cover` } })) : (((_c = this.blogData.video) === null || _c === void 0 ? void 0 : _c.sources[this.device]) ? (h("video", { src: this.blogData.video.sources[this.device], controls: true })) : (h("h1", { style: { color: "white" } }, "No Image")))))), h("div", { class: "DetailsBodyWrapper" }, this.showTitle &&
165
+ 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)))));
166
+ }
167
+ }
168
+ static get is() { return "blog-article-details"; }
169
+ static get encapsulation() { return "shadow"; }
170
+ static get originalStyleUrls() {
171
+ return {
172
+ "$": ["blog-article-details.scss"]
173
+ };
174
+ }
175
+ static get styleUrls() {
176
+ return {
177
+ "$": ["blog-article-details.css"]
178
+ };
179
+ }
180
+ static get properties() {
181
+ return {
182
+ "cmsEndpoint": {
183
+ "type": "string",
184
+ "mutable": false,
185
+ "complexType": {
186
+ "original": "string",
187
+ "resolved": "string",
188
+ "references": {}
189
+ },
190
+ "required": false,
191
+ "optional": false,
192
+ "docs": {
193
+ "tags": [],
194
+ "text": "Endpoint URL for the source of data"
195
+ },
196
+ "attribute": "cms-endpoint",
197
+ "reflect": true
198
+ },
199
+ "language": {
200
+ "type": "string",
201
+ "mutable": false,
202
+ "complexType": {
203
+ "original": "string",
204
+ "resolved": "string",
205
+ "references": {}
206
+ },
207
+ "required": false,
208
+ "optional": false,
209
+ "docs": {
210
+ "tags": [],
211
+ "text": "Language of the widget"
212
+ },
213
+ "attribute": "language",
214
+ "reflect": true,
215
+ "defaultValue": "'en'"
216
+ },
217
+ "userRoles": {
218
+ "type": "string",
219
+ "mutable": false,
220
+ "complexType": {
221
+ "original": "string",
222
+ "resolved": "string",
223
+ "references": {}
224
+ },
225
+ "required": false,
226
+ "optional": false,
227
+ "docs": {
228
+ "tags": [],
229
+ "text": "User roles"
230
+ },
231
+ "attribute": "user-roles",
232
+ "reflect": true,
233
+ "defaultValue": "'everyone'"
234
+ },
235
+ "cmsEnv": {
236
+ "type": "string",
237
+ "mutable": false,
238
+ "complexType": {
239
+ "original": "string",
240
+ "resolved": "string",
241
+ "references": {}
242
+ },
243
+ "required": false,
244
+ "optional": false,
245
+ "docs": {
246
+ "tags": [],
247
+ "text": "CMS Endpoint stage"
248
+ },
249
+ "attribute": "cms-env",
250
+ "reflect": true,
251
+ "defaultValue": "'stage'"
252
+ },
253
+ "clientStyling": {
254
+ "type": "string",
255
+ "mutable": false,
256
+ "complexType": {
257
+ "original": "string",
258
+ "resolved": "string",
259
+ "references": {}
260
+ },
261
+ "required": false,
262
+ "optional": false,
263
+ "docs": {
264
+ "tags": [],
265
+ "text": "Client custom styling via string"
266
+ },
267
+ "attribute": "client-styling",
268
+ "reflect": true,
269
+ "defaultValue": "''"
270
+ },
271
+ "clientStylingUrl": {
272
+ "type": "string",
273
+ "mutable": false,
274
+ "complexType": {
275
+ "original": "string",
276
+ "resolved": "string",
277
+ "references": {}
278
+ },
279
+ "required": false,
280
+ "optional": false,
281
+ "docs": {
282
+ "tags": [],
283
+ "text": "Client custom styling via url"
284
+ },
285
+ "attribute": "client-styling-url",
286
+ "reflect": true,
287
+ "defaultValue": "''"
288
+ },
289
+ "showPublishingDate": {
290
+ "type": "boolean",
291
+ "mutable": false,
292
+ "complexType": {
293
+ "original": "boolean",
294
+ "resolved": "boolean",
295
+ "references": {}
296
+ },
297
+ "required": false,
298
+ "optional": false,
299
+ "docs": {
300
+ "tags": [],
301
+ "text": "Property used to display the publishing date"
302
+ },
303
+ "attribute": "show-publishing-date",
304
+ "reflect": true,
305
+ "defaultValue": "true"
306
+ },
307
+ "showImage": {
308
+ "type": "boolean",
309
+ "mutable": false,
310
+ "complexType": {
311
+ "original": "boolean",
312
+ "resolved": "boolean",
313
+ "references": {}
314
+ },
315
+ "required": false,
316
+ "optional": false,
317
+ "docs": {
318
+ "tags": [],
319
+ "text": "Property used to display the image"
320
+ },
321
+ "attribute": "show-image",
322
+ "reflect": true,
323
+ "defaultValue": "true"
324
+ },
325
+ "showTitle": {
326
+ "type": "boolean",
327
+ "mutable": false,
328
+ "complexType": {
329
+ "original": "boolean",
330
+ "resolved": "boolean",
331
+ "references": {}
332
+ },
333
+ "required": false,
334
+ "optional": false,
335
+ "docs": {
336
+ "tags": [],
337
+ "text": "Property used to display the image"
338
+ },
339
+ "attribute": "show-title",
340
+ "reflect": true,
341
+ "defaultValue": "true"
342
+ },
343
+ "showContent": {
344
+ "type": "boolean",
345
+ "mutable": false,
346
+ "complexType": {
347
+ "original": "boolean",
348
+ "resolved": "boolean",
349
+ "references": {}
350
+ },
351
+ "required": false,
352
+ "optional": false,
353
+ "docs": {
354
+ "tags": [],
355
+ "text": "Property used to display the description"
356
+ },
357
+ "attribute": "show-content",
358
+ "reflect": true,
359
+ "defaultValue": "true"
360
+ },
361
+ "postId": {
362
+ "type": "number",
363
+ "mutable": false,
364
+ "complexType": {
365
+ "original": "number",
366
+ "resolved": "number",
367
+ "references": {}
368
+ },
369
+ "required": false,
370
+ "optional": false,
371
+ "docs": {
372
+ "tags": [],
373
+ "text": "Showing post ID parameter"
374
+ },
375
+ "attribute": "post-id",
376
+ "reflect": true
377
+ },
378
+ "postSlug": {
379
+ "type": "string",
380
+ "mutable": false,
381
+ "complexType": {
382
+ "original": "string",
383
+ "resolved": "string",
384
+ "references": {}
385
+ },
386
+ "required": false,
387
+ "optional": false,
388
+ "docs": {
389
+ "tags": [],
390
+ "text": "Slug of post"
391
+ },
392
+ "attribute": "post-slug",
393
+ "reflect": true
394
+ },
395
+ "postCustomPath": {
396
+ "type": "string",
397
+ "mutable": false,
398
+ "complexType": {
399
+ "original": "string",
400
+ "resolved": "string",
401
+ "references": {}
402
+ },
403
+ "required": false,
404
+ "optional": false,
405
+ "docs": {
406
+ "tags": [],
407
+ "text": "Custom Path of post"
408
+ },
409
+ "attribute": "post-custom-path",
410
+ "reflect": true
411
+ },
412
+ "intlDateTimeFormat": {
413
+ "type": "string",
414
+ "mutable": false,
415
+ "complexType": {
416
+ "original": "string",
417
+ "resolved": "string",
418
+ "references": {}
419
+ },
420
+ "required": false,
421
+ "optional": false,
422
+ "docs": {
423
+ "tags": [],
424
+ "text": "Intl date format"
425
+ },
426
+ "attribute": "intl-date-time-format",
427
+ "reflect": false,
428
+ "defaultValue": "''"
429
+ }
430
+ };
171
431
  }
172
- // end custom styling area
173
- }
174
- componentDidLoad() {
175
- this.detectAndAlertDeviceType();
176
- }
177
- detectAndAlertDeviceType() {
178
- this.device = getDeviceCustom();
179
- }
180
- formatDate(dateString) {
181
- return new Intl.DateTimeFormat(this.intlDateTimeFormat || 'en-GB').format(new Date(dateString));
182
- }
183
- render() {
184
- var _a, _b, _c, _d, _e;
185
- if (this.hasErrors) {
186
- return (h("div", { class: "BlogArticleDetails" },
187
- h("div", { class: "Title" }, translate('error', this.language))));
432
+ static get states() {
433
+ return {
434
+ "hasErrors": {},
435
+ "limitStylingAppends": {},
436
+ "isLoading": {},
437
+ "bannerMatrixReady": {},
438
+ "device": {}
439
+ };
188
440
  }
189
- if (!this.isLoading) {
190
- return (h("div", { ref: el => this.stylingContainer = el },
191
- h("div", { class: "DetailsContainer" },
192
- h("div", { class: "DetailsHeadWrapper" },
193
- this.showPublishingDate && this.blogData.publishingDate &&
194
- h("div", { class: "BlogDate" }, this.formatDate((_a = this.blogData) === null || _a === void 0 ? void 0 : _a.publishingDate)),
195
- this.showImage && (h("div", { class: "BlogBanner" }, ((_b = this.blogData.image) === null || _b === void 0 ? void 0 : _b.src) ? (h("div", { style: { background: `url(${this.setImage(this.blogData.image)}) no-repeat center center / cover` } })) : (((_c = this.blogData.video) === null || _c === void 0 ? void 0 : _c.sources[this.device]) ? (h("video", { src: this.blogData.video.sources[this.device], controls: true })) : (h("h1", { style: { color: "white" } }, "No Image")))))),
196
- h("div", { class: "DetailsBodyWrapper" },
197
- this.showTitle &&
198
- h("div", { class: "BlogTitle" }, (_d = this.blogData) === null || _d === void 0 ? void 0 : _d.title),
199
- this.showContent && this.renderContentConditionally((_e = this.blogData) === null || _e === void 0 ? void 0 : _e.content)))));
441
+ static get watchers() {
442
+ return [{
443
+ "propName": "postId",
444
+ "methodName": "watchEndpoint"
445
+ }, {
446
+ "propName": "postSlug",
447
+ "methodName": "watchEndpoint"
448
+ }, {
449
+ "propName": "postCustomPath",
450
+ "methodName": "watchEndpoint"
451
+ }, {
452
+ "propName": "cmsEndpoint",
453
+ "methodName": "watchEndpoint"
454
+ }, {
455
+ "propName": "language",
456
+ "methodName": "watchEndpoint"
457
+ }, {
458
+ "propName": "clientStyling",
459
+ "methodName": "handleStylingChange"
460
+ }, {
461
+ "propName": "clientStylingUrl",
462
+ "methodName": "handleStylingUrlChange"
463
+ }];
200
464
  }
201
- }
202
- static get is() { return "blog-article-details"; }
203
- static get encapsulation() { return "shadow"; }
204
- static get originalStyleUrls() { return {
205
- "$": ["blog-article-details.scss"]
206
- }; }
207
- static get styleUrls() { return {
208
- "$": ["blog-article-details.css"]
209
- }; }
210
- static get properties() { return {
211
- "cmsEndpoint": {
212
- "type": "string",
213
- "mutable": false,
214
- "complexType": {
215
- "original": "string",
216
- "resolved": "string",
217
- "references": {}
218
- },
219
- "required": false,
220
- "optional": false,
221
- "docs": {
222
- "tags": [],
223
- "text": "Endpoint URL for the source of data"
224
- },
225
- "attribute": "cms-endpoint",
226
- "reflect": true
227
- },
228
- "language": {
229
- "type": "string",
230
- "mutable": false,
231
- "complexType": {
232
- "original": "string",
233
- "resolved": "string",
234
- "references": {}
235
- },
236
- "required": false,
237
- "optional": false,
238
- "docs": {
239
- "tags": [],
240
- "text": "Language of the widget"
241
- },
242
- "attribute": "language",
243
- "reflect": true,
244
- "defaultValue": "'en'"
245
- },
246
- "userRoles": {
247
- "type": "string",
248
- "mutable": false,
249
- "complexType": {
250
- "original": "string",
251
- "resolved": "string",
252
- "references": {}
253
- },
254
- "required": false,
255
- "optional": false,
256
- "docs": {
257
- "tags": [],
258
- "text": "User roles"
259
- },
260
- "attribute": "user-roles",
261
- "reflect": true,
262
- "defaultValue": "'everyone'"
263
- },
264
- "cmsEnv": {
265
- "type": "string",
266
- "mutable": false,
267
- "complexType": {
268
- "original": "string",
269
- "resolved": "string",
270
- "references": {}
271
- },
272
- "required": false,
273
- "optional": false,
274
- "docs": {
275
- "tags": [],
276
- "text": "CMS Endpoint stage"
277
- },
278
- "attribute": "cms-env",
279
- "reflect": true,
280
- "defaultValue": "'stage'"
281
- },
282
- "clientStyling": {
283
- "type": "string",
284
- "mutable": false,
285
- "complexType": {
286
- "original": "string",
287
- "resolved": "string",
288
- "references": {}
289
- },
290
- "required": false,
291
- "optional": false,
292
- "docs": {
293
- "tags": [],
294
- "text": "Client custom styling via string"
295
- },
296
- "attribute": "client-styling",
297
- "reflect": true,
298
- "defaultValue": "''"
299
- },
300
- "clientStylingUrl": {
301
- "type": "string",
302
- "mutable": false,
303
- "complexType": {
304
- "original": "string",
305
- "resolved": "string",
306
- "references": {}
307
- },
308
- "required": false,
309
- "optional": false,
310
- "docs": {
311
- "tags": [],
312
- "text": "Client custom styling via url"
313
- },
314
- "attribute": "client-styling-url",
315
- "reflect": true,
316
- "defaultValue": "''"
317
- },
318
- "showPublishingDate": {
319
- "type": "boolean",
320
- "mutable": false,
321
- "complexType": {
322
- "original": "boolean",
323
- "resolved": "boolean",
324
- "references": {}
325
- },
326
- "required": false,
327
- "optional": false,
328
- "docs": {
329
- "tags": [],
330
- "text": "Property used to display the publishing date"
331
- },
332
- "attribute": "show-publishing-date",
333
- "reflect": true,
334
- "defaultValue": "true"
335
- },
336
- "showImage": {
337
- "type": "boolean",
338
- "mutable": false,
339
- "complexType": {
340
- "original": "boolean",
341
- "resolved": "boolean",
342
- "references": {}
343
- },
344
- "required": false,
345
- "optional": false,
346
- "docs": {
347
- "tags": [],
348
- "text": "Property used to display the image"
349
- },
350
- "attribute": "show-image",
351
- "reflect": true,
352
- "defaultValue": "true"
353
- },
354
- "showTitle": {
355
- "type": "boolean",
356
- "mutable": false,
357
- "complexType": {
358
- "original": "boolean",
359
- "resolved": "boolean",
360
- "references": {}
361
- },
362
- "required": false,
363
- "optional": false,
364
- "docs": {
365
- "tags": [],
366
- "text": "Property used to display the image"
367
- },
368
- "attribute": "show-title",
369
- "reflect": true,
370
- "defaultValue": "true"
371
- },
372
- "showContent": {
373
- "type": "boolean",
374
- "mutable": false,
375
- "complexType": {
376
- "original": "boolean",
377
- "resolved": "boolean",
378
- "references": {}
379
- },
380
- "required": false,
381
- "optional": false,
382
- "docs": {
383
- "tags": [],
384
- "text": "Property used to display the description"
385
- },
386
- "attribute": "show-content",
387
- "reflect": true,
388
- "defaultValue": "true"
389
- },
390
- "postId": {
391
- "type": "number",
392
- "mutable": false,
393
- "complexType": {
394
- "original": "number",
395
- "resolved": "number",
396
- "references": {}
397
- },
398
- "required": false,
399
- "optional": false,
400
- "docs": {
401
- "tags": [],
402
- "text": "Showing post ID parameter"
403
- },
404
- "attribute": "post-id",
405
- "reflect": true
406
- },
407
- "postSlug": {
408
- "type": "string",
409
- "mutable": false,
410
- "complexType": {
411
- "original": "string",
412
- "resolved": "string",
413
- "references": {}
414
- },
415
- "required": false,
416
- "optional": false,
417
- "docs": {
418
- "tags": [],
419
- "text": "Slug of post"
420
- },
421
- "attribute": "post-slug",
422
- "reflect": true
423
- },
424
- "postCustomPath": {
425
- "type": "string",
426
- "mutable": false,
427
- "complexType": {
428
- "original": "string",
429
- "resolved": "string",
430
- "references": {}
431
- },
432
- "required": false,
433
- "optional": false,
434
- "docs": {
435
- "tags": [],
436
- "text": "Custom Path of post"
437
- },
438
- "attribute": "post-custom-path",
439
- "reflect": true
440
- },
441
- "intlDateTimeFormat": {
442
- "type": "string",
443
- "mutable": false,
444
- "complexType": {
445
- "original": "string",
446
- "resolved": "string",
447
- "references": {}
448
- },
449
- "required": false,
450
- "optional": false,
451
- "docs": {
452
- "tags": [],
453
- "text": "Intl date format"
454
- },
455
- "attribute": "intl-date-time-format",
456
- "reflect": false,
457
- "defaultValue": "''"
465
+ static get listeners() {
466
+ return [{
467
+ "name": "BannerMatrixReady",
468
+ "method": "handleBannerReady",
469
+ "target": "window",
470
+ "capture": false,
471
+ "passive": false
472
+ }];
458
473
  }
459
- }; }
460
- static get states() { return {
461
- "hasErrors": {},
462
- "limitStylingAppends": {},
463
- "isLoading": {},
464
- "bannerMatrixReady": {},
465
- "device": {}
466
- }; }
467
- static get watchers() { return [{
468
- "propName": "postId",
469
- "methodName": "watchEndpoint"
470
- }, {
471
- "propName": "postSlug",
472
- "methodName": "watchEndpoint"
473
- }, {
474
- "propName": "postCustomPath",
475
- "methodName": "watchEndpoint"
476
- }, {
477
- "propName": "cmsEndpoint",
478
- "methodName": "watchEndpoint"
479
- }, {
480
- "propName": "language",
481
- "methodName": "watchEndpoint"
482
- }, {
483
- "propName": "clientStyling",
484
- "methodName": "handleStylingChange"
485
- }, {
486
- "propName": "clientStylingUrl",
487
- "methodName": "handleStylingUrlChange"
488
- }]; }
489
- static get listeners() { return [{
490
- "name": "BannerMatrixReady",
491
- "method": "handleBannerReady",
492
- "target": "window",
493
- "capture": false,
494
- "passive": false
495
- }]; }
496
474
  }