@everymatrix/blog-article-details 1.0.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/blog-article-details/blog-article-details.esm.js +1 -0
- package/dist/blog-article-details/index.esm.js +0 -0
- package/dist/blog-article-details/p-0783b0ba.js +2 -0
- package/dist/blog-article-details/p-db82d889.entry.js +1 -0
- package/dist/blog-article-details/p-e1255160.js +1 -0
- package/dist/cjs/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/blog-article-details.cjs.entry.js +259 -0
- package/dist/cjs/blog-article-details.cjs.js +25 -0
- package/dist/cjs/index-ade27b33.js +1254 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +15 -0
- package/dist/collection/collection-manifest.json +12 -0
- package/dist/collection/components/blog-article-details/blog-article-details.css +47 -0
- package/dist/collection/components/blog-article-details/blog-article-details.js +474 -0
- package/dist/collection/components/blog-article-details/index.js +1 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/utils/locale.utils.js +29 -0
- package/dist/collection/utils/utils.js +59 -0
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/blog-article-details.entry.js +255 -0
- package/dist/esm/blog-article-details.js +20 -0
- package/dist/esm/index-9d94198d.js +1228 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +11 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/stencil.config.dev.js +17 -0
- package/dist/stencil.config.js +17 -0
- package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/blog-article-details/.stencil/packages/stencil/blog-article-details/stencil.config.d.ts +2 -0
- package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/blog-article-details/.stencil/packages/stencil/blog-article-details/stencil.config.dev.d.ts +2 -0
- package/dist/types/components/blog-article-details/blog-article-details.d.ts +80 -0
- package/dist/types/components/blog-article-details/index.d.ts +1 -0
- package/dist/types/components.d.ts +149 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/stencil-public-runtime.d.ts +1674 -0
- package/dist/types/utils/locale.utils.d.ts +1 -0
- package/dist/types/utils/utils.d.ts +4 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/loader/package.json +11 -0
- package/package.json +26 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-ade27b33.js');
|
|
6
|
+
const appGlobals = require('./app-globals-3a1e7e63.js');
|
|
7
|
+
|
|
8
|
+
const defineCustomElements = async (win, options) => {
|
|
9
|
+
if (typeof window === 'undefined') return undefined;
|
|
10
|
+
await appGlobals.globalScripts();
|
|
11
|
+
return index.bootstrapLazy([["blog-article-details.cjs",[[1,"blog-article-details",{"cmsEndpoint":[513,"cms-endpoint"],"language":[513],"userRoles":[513,"user-roles"],"cmsEnv":[513,"cms-env"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"showPublishingDate":[516,"show-publishing-date"],"showImage":[516,"show-image"],"showTitle":[516,"show-title"],"showContent":[516,"show-content"],"postId":[514,"post-id"],"postSlug":[513,"post-slug"],"postCustomPath":[513,"post-custom-path"],"intlDateTimeFormat":[1,"intl-date-time-format"],"hasErrors":[32],"limitStylingAppends":[32],"isLoading":[32],"bannerMatrixReady":[32],"device":[32]},[[8,"BannerMatrixReady","handleBannerReady"]],{"postId":["watchEndpoint"],"postSlug":["watchEndpoint"],"postCustomPath":["watchEndpoint"],"cmsEndpoint":["watchEndpoint"],"language":["watchEndpoint"],"clientStyling":["handleStylingChange"],"clientStylingUrl":["handleStylingUrlChange"]}]]]], options);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.setNonce = index.setNonce;
|
|
15
|
+
exports.defineCustomElements = defineCustomElements;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
:host {
|
|
2
|
+
display: block;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.DetailsContainer {
|
|
6
|
+
background-color: #07072A;
|
|
7
|
+
color: #fff;
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
}
|
|
11
|
+
.DetailsContainer .BlogBanner div {
|
|
12
|
+
height: 400px;
|
|
13
|
+
}
|
|
14
|
+
.DetailsContainer .DetailsHeadWrapper {
|
|
15
|
+
position: relative;
|
|
16
|
+
}
|
|
17
|
+
.DetailsContainer .DetailsBodyWrapper {
|
|
18
|
+
padding: 30px;
|
|
19
|
+
}
|
|
20
|
+
.DetailsContainer .BlogDate {
|
|
21
|
+
font-size: 12px;
|
|
22
|
+
border-radius: 5px 5px 0 0;
|
|
23
|
+
padding: 10px;
|
|
24
|
+
width: fit-content;
|
|
25
|
+
text-align: center;
|
|
26
|
+
background-color: #0D0D4D;
|
|
27
|
+
z-index: 1;
|
|
28
|
+
text-wrap: nowrap;
|
|
29
|
+
position: absolute;
|
|
30
|
+
bottom: 0;
|
|
31
|
+
left: 30px;
|
|
32
|
+
}
|
|
33
|
+
.DetailsContainer .BlogTitle {
|
|
34
|
+
font-size: 24px;
|
|
35
|
+
}
|
|
36
|
+
.DetailsContainer .BlogContent {
|
|
37
|
+
font-size: 14px;
|
|
38
|
+
}
|
|
39
|
+
.DetailsContainer .BlogContent p:last-child {
|
|
40
|
+
margin-bottom: 0;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@container (max-width: 475px) {
|
|
44
|
+
.DetailsContainer {
|
|
45
|
+
font-size: 12px;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,474 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { translate } from "../../utils/locale.utils";
|
|
3
|
+
import { getDevicePlatform, getDeviceCustom } from "../../utils/utils";
|
|
4
|
+
export class BlogArticleDetails {
|
|
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 = '';
|
|
68
|
+
}
|
|
69
|
+
// Rerender when bannermatrix has finished loaded. Issue when bannermatrix passed as content from CMS.
|
|
70
|
+
handleBannerReady() {
|
|
71
|
+
this.bannerMatrixReady = true;
|
|
72
|
+
}
|
|
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);
|
|
136
|
+
}
|
|
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));
|
|
156
|
+
}
|
|
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))));
|
|
161
|
+
}
|
|
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
|
+
};
|
|
431
|
+
}
|
|
432
|
+
static get states() {
|
|
433
|
+
return {
|
|
434
|
+
"hasErrors": {},
|
|
435
|
+
"limitStylingAppends": {},
|
|
436
|
+
"isLoading": {},
|
|
437
|
+
"bannerMatrixReady": {},
|
|
438
|
+
"device": {}
|
|
439
|
+
};
|
|
440
|
+
}
|
|
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
|
+
}];
|
|
464
|
+
}
|
|
465
|
+
static get listeners() {
|
|
466
|
+
return [{
|
|
467
|
+
"name": "BannerMatrixReady",
|
|
468
|
+
"method": "handleBannerReady",
|
|
469
|
+
"target": "window",
|
|
470
|
+
"capture": false,
|
|
471
|
+
"passive": false
|
|
472
|
+
}];
|
|
473
|
+
}
|
|
474
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BlogArticleDetails } from './blog-article-details';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
2
|
+
const SUPPORTED_LANGUAGES = ['ro', 'en', 'fr', 'ar', 'hr'];
|
|
3
|
+
const TRANSLATIONS = {
|
|
4
|
+
en: {
|
|
5
|
+
error: 'Error',
|
|
6
|
+
},
|
|
7
|
+
ro: {
|
|
8
|
+
error: 'Eroare',
|
|
9
|
+
},
|
|
10
|
+
fr: {
|
|
11
|
+
error: 'Error',
|
|
12
|
+
},
|
|
13
|
+
ar: {
|
|
14
|
+
error: 'خطأ',
|
|
15
|
+
},
|
|
16
|
+
hr: {
|
|
17
|
+
error: 'Greška',
|
|
18
|
+
},
|
|
19
|
+
'pt-br': {
|
|
20
|
+
error: 'Erro'
|
|
21
|
+
},
|
|
22
|
+
'es-mx': {
|
|
23
|
+
error: 'Error'
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
export const translate = (key, customLang) => {
|
|
27
|
+
const lang = customLang;
|
|
28
|
+
return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
29
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
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
|
+
function checkCustomDeviceWidth() {
|
|
32
|
+
const width = screen.availWidth;
|
|
33
|
+
if (width < 600) {
|
|
34
|
+
return 'mobile';
|
|
35
|
+
}
|
|
36
|
+
else if (width >= 600 && width < 1100) {
|
|
37
|
+
return 'tablet';
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export function getDeviceCustom() {
|
|
41
|
+
const userAgent = navigator.userAgent.toLowerCase();
|
|
42
|
+
let source = '';
|
|
43
|
+
source = (userAgent.includes('android') || userAgent.includes('iphone') || userAgent.includes('ipad')) ? checkCustomDeviceWidth() : 'desktop';
|
|
44
|
+
return source;
|
|
45
|
+
}
|
|
46
|
+
export const getDevicePlatform = () => {
|
|
47
|
+
const device = getDevice();
|
|
48
|
+
if (device) {
|
|
49
|
+
if (device === 'PC') {
|
|
50
|
+
return 'dk';
|
|
51
|
+
}
|
|
52
|
+
else if (device === 'iPad' || device === 'iPhone') {
|
|
53
|
+
return 'mtWeb';
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
return 'mtWeb';
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
};
|