@aiconomy/aico-components 0.0.95 → 0.0.114
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/README.md +671 -32
- package/dist/aico-components/aico-components.esm.js +1 -1
- package/dist/aico-components/aico-components.esm.js.map +1 -1
- package/dist/aico-components/p-34bd96ca.js +2 -0
- package/dist/aico-components/p-34bd96ca.js.map +1 -0
- package/dist/aico-components/p-7f6fcb2e.entry.js +2 -0
- package/dist/aico-components/p-7f6fcb2e.entry.js.map +1 -0
- package/dist/aico-components/p-a4f7ae53.entry.js +2 -0
- package/dist/aico-components/p-a4f7ae53.entry.js.map +1 -0
- package/dist/aico-components/p-b61bc8e9.entry.js +2 -0
- package/dist/aico-components/p-b61bc8e9.entry.js.map +1 -0
- package/dist/aico-components/{p-7ea04e72.entry.js → p-b9bc0400.entry.js} +3 -3
- package/dist/aico-components/p-b9bc0400.entry.js.map +1 -0
- package/dist/aico-components/p-bf3db54a.entry.js +2 -0
- package/dist/aico-components/p-bf3db54a.entry.js.map +1 -0
- package/dist/aico-components/p-e187bbea.js +2 -0
- package/dist/aico-components/p-e187bbea.js.map +1 -0
- package/dist/cjs/ConditionalRender-52579540.js +9 -0
- package/dist/cjs/ConditionalRender-52579540.js.map +1 -0
- package/dist/cjs/aico-album-content_19.cjs.entry.js +22 -25
- package/dist/cjs/aico-album-content_19.cjs.entry.js.map +1 -1
- package/dist/cjs/aico-article-detail.cjs.entry.js +11 -1
- package/dist/cjs/aico-article-detail.cjs.entry.js.map +1 -1
- package/dist/cjs/aico-components.cjs.js +1 -1
- package/dist/cjs/aico-fetch-article-detail.cjs.entry.js +4 -2
- package/dist/cjs/aico-fetch-article-detail.cjs.entry.js.map +1 -1
- package/dist/cjs/aico-news-list.cjs.entry.js +7 -4
- package/dist/cjs/aico-news-list.cjs.entry.js.map +1 -1
- package/dist/cjs/aico-special-news-carousel.cjs.entry.js +6 -3
- package/dist/cjs/aico-special-news-carousel.cjs.entry.js.map +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{utils-9ae3486f.js → utils-3d8a97f6.js} +16 -9
- package/dist/cjs/utils-3d8a97f6.js.map +1 -0
- package/dist/collection/components/aico-article-detail/aico-article-detail.js +48 -2
- package/dist/collection/components/aico-article-detail/aico-article-detail.js.map +1 -1
- package/dist/collection/components/aico-fetch-article-detail/aico-fetch-article-detail.js +42 -4
- package/dist/collection/components/aico-fetch-article-detail/aico-fetch-article-detail.js.map +1 -1
- package/dist/collection/components/aico-news-list/aico-news-list.js +78 -9
- package/dist/collection/components/aico-news-list/aico-news-list.js.map +1 -1
- package/dist/collection/components/aico-special-news-carousel/aico-special-news-carousel.js +58 -7
- package/dist/collection/components/aico-special-news-carousel/aico-special-news-carousel.js.map +1 -1
- package/dist/collection/model/Article.js.map +1 -1
- package/dist/collection/model/NewsTag.js +2 -0
- package/dist/collection/model/NewsTag.js.map +1 -0
- package/dist/collection/utils/utils.js +15 -8
- package/dist/collection/utils/utils.js.map +1 -1
- package/dist/components/aico-article-detail2.js +14 -2
- package/dist/components/aico-article-detail2.js.map +1 -1
- package/dist/components/aico-fetch-article-detail.js +5 -1
- package/dist/components/aico-fetch-article-detail.js.map +1 -1
- package/dist/components/aico-news-list.js +10 -3
- package/dist/components/aico-news-list.js.map +1 -1
- package/dist/components/aico-special-news-carousel.js +8 -2
- package/dist/components/aico-special-news-carousel.js.map +1 -1
- package/dist/components/utils.js +15 -8
- package/dist/components/utils.js.map +1 -1
- package/dist/esm/ConditionalRender-7460c386.js +7 -0
- package/dist/esm/ConditionalRender-7460c386.js.map +1 -0
- package/dist/esm/aico-album-content_19.entry.js +2 -5
- package/dist/esm/aico-album-content_19.entry.js.map +1 -1
- package/dist/esm/aico-article-detail.entry.js +11 -1
- package/dist/esm/aico-article-detail.entry.js.map +1 -1
- package/dist/esm/aico-components.js +1 -1
- package/dist/esm/aico-fetch-article-detail.entry.js +4 -2
- package/dist/esm/aico-fetch-article-detail.entry.js.map +1 -1
- package/dist/esm/aico-news-list.entry.js +7 -4
- package/dist/esm/aico-news-list.entry.js.map +1 -1
- package/dist/esm/aico-special-news-carousel.entry.js +6 -3
- package/dist/esm/aico-special-news-carousel.entry.js.map +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{utils-25eef7c7.js → utils-f81eb958.js} +16 -9
- package/dist/esm/utils-f81eb958.js.map +1 -0
- package/dist/types/components/aico-article-detail/aico-article-detail.d.ts +13 -0
- package/dist/types/components/aico-fetch-article-detail/aico-fetch-article-detail.d.ts +19 -0
- package/dist/types/components/aico-news-list/aico-news-list.d.ts +36 -1
- package/dist/types/components/aico-special-news-carousel/aico-special-news-carousel.d.ts +29 -0
- package/dist/types/components.d.ts +172 -0
- package/dist/types/model/Article.d.ts +2 -1
- package/dist/types/model/NewsTag.d.ts +8 -0
- package/dist/types/utils/utils.d.ts +2 -2
- package/package.json +2 -3
- package/dist/aico-components/p-19752961.entry.js +0 -2
- package/dist/aico-components/p-19752961.entry.js.map +0 -1
- package/dist/aico-components/p-59bfd021.js +0 -2
- package/dist/aico-components/p-59bfd021.js.map +0 -1
- package/dist/aico-components/p-7ea04e72.entry.js.map +0 -1
- package/dist/aico-components/p-80cb133a.entry.js +0 -2
- package/dist/aico-components/p-80cb133a.entry.js.map +0 -1
- package/dist/aico-components/p-918b9928.entry.js +0 -2
- package/dist/aico-components/p-918b9928.entry.js.map +0 -1
- package/dist/aico-components/p-c900f292.entry.js +0 -2
- package/dist/aico-components/p-c900f292.entry.js.map +0 -1
- package/dist/cjs/utils-9ae3486f.js.map +0 -1
- package/dist/esm/utils-25eef7c7.js.map +0 -1
- package/docs/components/aico-article-detail/readme.md +0 -83
- package/docs/components/aico-fetch-article-detail/readme.md +0 -63
- package/docs/components/aico-news-list/readme.md +0 -41
- package/docs/components/aico-news-list-item/readme.md +0 -37
- package/docs/components/aico-special-news-carousel/readme.md +0 -27
- package/docs/components/content/aico-album-content/readme.md +0 -30
- package/docs/components/content/aico-asking-content/readme.md +0 -31
- package/docs/components/content/aico-asking-list-content/readme.md +0 -10
- package/docs/components/content/aico-block-quote-content/readme.md +0 -31
- package/docs/components/content/aico-bullet-content/readme.md +0 -37
- package/docs/components/content/aico-carousel-content/readme.md +0 -38
- package/docs/components/content/aico-collection-content/readme.md +0 -10
- package/docs/components/content/aico-content-card-content/readme.md +0 -37
- package/docs/components/content/aico-divider-content/readme.md +0 -31
- package/docs/components/content/aico-document-content/readme.md +0 -31
- package/docs/components/content/aico-faq-content/readme.md +0 -31
- package/docs/components/content/aico-heading-content/readme.md +0 -37
- package/docs/components/content/aico-html-content/readme.md +0 -31
- package/docs/components/content/aico-link-content/readme.md +0 -31
- package/docs/components/content/aico-news-content/readme.md +0 -37
- package/docs/components/content/aico-no-content/readme.md +0 -23
- package/docs/components/content/aico-page-content/readme.md +0 -38
- package/docs/components/content/aico-table-content/readme.md +0 -37
- package/docs/components/content/aico-testimonial-content/readme.md +0 -30
- package/docs/components/content/aico-text-content/readme.md +0 -37
- package/docs/components/content/aico-title-content/readme.md +0 -52
- package/docs/components/content/aico-upload-content/readme.md +0 -37
- package/docs/components/content/aico-video-content/readme.md +0 -37
|
@@ -6,6 +6,8 @@ export class AicoFetchArticleDetail {
|
|
|
6
6
|
this.aicoUrl = undefined;
|
|
7
7
|
this.aicoBearerToken = undefined;
|
|
8
8
|
this.locale = 'de';
|
|
9
|
+
this.hideDateAndAuthor = false;
|
|
10
|
+
this.hideCategoryAndTags = false;
|
|
9
11
|
this.articleId = undefined;
|
|
10
12
|
this.articleUrlHandle = undefined;
|
|
11
13
|
}
|
|
@@ -27,7 +29,7 @@ export class AicoFetchArticleDetail {
|
|
|
27
29
|
this.article = await fetchNewsArticle(this.api, this.articleId, this.articleFetchController.signal);
|
|
28
30
|
}
|
|
29
31
|
render() {
|
|
30
|
-
return h("aico-article-detail", { article: this.article, locale: this.locale });
|
|
32
|
+
return h("aico-article-detail", { article: this.article, locale: this.locale, "hide-date-and-author": this.hideDateAndAuthor });
|
|
31
33
|
}
|
|
32
34
|
static get is() { return "aico-fetch-article-detail"; }
|
|
33
35
|
static get encapsulation() { return "scoped"; }
|
|
@@ -55,7 +57,7 @@ export class AicoFetchArticleDetail {
|
|
|
55
57
|
"optional": false,
|
|
56
58
|
"docs": {
|
|
57
59
|
"tags": [],
|
|
58
|
-
"text": ""
|
|
60
|
+
"text": "The url of the Aico Api that will be used to retrieve the article."
|
|
59
61
|
},
|
|
60
62
|
"attribute": "aico-url",
|
|
61
63
|
"reflect": false
|
|
@@ -72,7 +74,7 @@ export class AicoFetchArticleDetail {
|
|
|
72
74
|
"optional": false,
|
|
73
75
|
"docs": {
|
|
74
76
|
"tags": [],
|
|
75
|
-
"text": ""
|
|
77
|
+
"text": "The token used to authenticate against he Aico Api."
|
|
76
78
|
},
|
|
77
79
|
"attribute": "aico-bearer-token",
|
|
78
80
|
"reflect": false
|
|
@@ -89,12 +91,48 @@ export class AicoFetchArticleDetail {
|
|
|
89
91
|
"optional": false,
|
|
90
92
|
"docs": {
|
|
91
93
|
"tags": [],
|
|
92
|
-
"text": ""
|
|
94
|
+
"text": "The article translation that will be used to render the content.\n\nIf the locale specified is not present in the article's translations, most content will not be shown."
|
|
93
95
|
},
|
|
94
96
|
"attribute": "locale",
|
|
95
97
|
"reflect": false,
|
|
96
98
|
"defaultValue": "'de'"
|
|
97
99
|
},
|
|
100
|
+
"hideDateAndAuthor": {
|
|
101
|
+
"type": "boolean",
|
|
102
|
+
"mutable": false,
|
|
103
|
+
"complexType": {
|
|
104
|
+
"original": "boolean",
|
|
105
|
+
"resolved": "boolean",
|
|
106
|
+
"references": {}
|
|
107
|
+
},
|
|
108
|
+
"required": false,
|
|
109
|
+
"optional": false,
|
|
110
|
+
"docs": {
|
|
111
|
+
"tags": [],
|
|
112
|
+
"text": "Determines if the article date and author are shown or not."
|
|
113
|
+
},
|
|
114
|
+
"attribute": "hide-date-and-author",
|
|
115
|
+
"reflect": false,
|
|
116
|
+
"defaultValue": "false"
|
|
117
|
+
},
|
|
118
|
+
"hideCategoryAndTags": {
|
|
119
|
+
"type": "boolean",
|
|
120
|
+
"mutable": false,
|
|
121
|
+
"complexType": {
|
|
122
|
+
"original": "boolean",
|
|
123
|
+
"resolved": "boolean",
|
|
124
|
+
"references": {}
|
|
125
|
+
},
|
|
126
|
+
"required": false,
|
|
127
|
+
"optional": false,
|
|
128
|
+
"docs": {
|
|
129
|
+
"tags": [],
|
|
130
|
+
"text": "Determines if the article category and tags are shown or not."
|
|
131
|
+
},
|
|
132
|
+
"attribute": "hide-category-and-tags",
|
|
133
|
+
"reflect": false,
|
|
134
|
+
"defaultValue": "false"
|
|
135
|
+
},
|
|
98
136
|
"articleId": {
|
|
99
137
|
"type": "string",
|
|
100
138
|
"mutable": false,
|
package/dist/collection/components/aico-fetch-article-detail/aico-fetch-article-detail.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aico-fetch-article-detail.js","sourceRoot":"","sources":["../../../src/components/aico-fetch-article-detail/aico-fetch-article-detail.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAS/E,MAAM,OAAO,sBAAsB;;;;;
|
|
1
|
+
{"version":3,"file":"aico-fetch-article-detail.js","sourceRoot":"","sources":["../../../src/components/aico-fetch-article-detail/aico-fetch-article-detail.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAS/E,MAAM,OAAO,sBAAsB;;;;;sBAkBR,IAAI;iCAKQ,KAAK;mCAKH,KAAK;;;;IAmB5C,iBAAiB;QACf,IAAI,CAAC,sBAAsB,GAAG,IAAI,eAAe,EAAE,CAAC;QACpD,IAAI,CAAC,GAAG,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC;IAC1E,CAAC;IAED,oBAAoB;QAClB,IAAI,CAAC,sBAAuB,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IACrD,CAAC;IAED,KAAK,CAAC,iBAAiB;QACrB,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE;YAC7C,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC;SAC9E;QAED,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACzB,IAAI,CAAC,OAAO,GAAG,MAAM,wBAAwB,CAAC,IAAI,CAAC,GAAI,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,sBAAuB,CAAC,MAAM,CAAC,CAAC;YACrH,OAAO;SACR;QAED,IAAI,CAAC,OAAO,GAAG,MAAM,gBAAgB,CAAC,IAAI,CAAC,GAAI,EAAE,IAAI,CAAC,SAAU,EAAE,IAAI,CAAC,sBAAuB,CAAC,MAAM,CAAC,CAAC;IACzG,CAAC;IAED,MAAM;QACJ,OAAO,2BAAqB,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,0BAAwB,IAAI,CAAC,iBAAiB,GAAI,CAAC;IAC3H,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, State, h } from '@stencil/core';\nimport { fetchNewsArticle, fetchNewsArticleByHandle } from '../../utils/utils';\nimport { Article } from '../../model/Article';\nimport { AicoApiRequestInfo } from '../../model/AicoApiRequestInfo';\n\n@Component({\n tag: 'aico-fetch-article-detail',\n styleUrl: 'aico-fetch-article-detail.css',\n scoped: true,\n})\nexport class AicoFetchArticleDetail {\n @State() article!: Article;\n\n /**\n * The url of the Aico Api that will be used to retrieve the article.\n */\n @Prop() aicoUrl!: string;\n\n /**\n * The token used to authenticate against he Aico Api.\n */\n @Prop() aicoBearerToken!: string;\n\n /**\n * The article translation that will be used to render the content.\n *\n * If the locale specified is not present in the article's translations, most content will not be shown.\n */\n @Prop() locale: string = 'de';\n\n /**\n * Determines if the article date and author are shown or not.\n */\n @Prop() hideDateAndAuthor: boolean = false;\n\n /**\n * Determines if the article category and tags are shown or not.\n */\n @Prop() hideCategoryAndTags: boolean = false;\n\n /**\n * The id will be used to fetch the article.\n *\n * If both the 'articleId' and 'articleUrlHandle' are provided, the latter will be used. If neither are provided, an error is thrown.\n */\n @Prop() articleId?: string;\n\n /**\n * The url handle will be used to fetch the article.\n *\n * If both the 'articleId' and 'articleUrlHandle' are provided, the latter will be used. If neither are provided, an error is thrown.\n */\n @Prop() articleUrlHandle?: string;\n\n private api?: AicoApiRequestInfo;\n private articleFetchController?: AbortController;\n\n connectedCallback() {\n this.articleFetchController = new AbortController();\n this.api = { baseApi: this.aicoUrl, bearerToken: this.aicoBearerToken };\n }\n\n disconnectedCallback() {\n this.articleFetchController!.abort('disconnected');\n }\n\n async componentWillLoad(): Promise<void> {\n if (!this.articleId && !this.articleUrlHandle) {\n throw new Error('Either the article id or the url handle must be provided.');\n }\n\n if (this.articleUrlHandle) {\n this.article = await fetchNewsArticleByHandle(this.api!, this.articleUrlHandle, this.articleFetchController!.signal);\n return;\n }\n\n this.article = await fetchNewsArticle(this.api!, this.articleId!, this.articleFetchController!.signal);\n }\n\n render() {\n return <aico-article-detail article={this.article} locale={this.locale} hide-date-and-author={this.hideDateAndAuthor} />;\n }\n}\n"]}
|
|
@@ -2,12 +2,15 @@ import { Host, h } from "@stencil/core";
|
|
|
2
2
|
import { fetchNewsArticles } from "../../utils/utils";
|
|
3
3
|
export class AicoNewsList {
|
|
4
4
|
constructor() {
|
|
5
|
-
this.pageSize = 16;
|
|
6
5
|
this.newsResponse = undefined;
|
|
7
6
|
this.pageNumber = 1;
|
|
8
7
|
this.aicoUrl = undefined;
|
|
9
8
|
this.aicoBearerToken = undefined;
|
|
10
9
|
this.newsChannels = [];
|
|
10
|
+
this.newsSellerIds = [];
|
|
11
|
+
this.newsBrandIds = [];
|
|
12
|
+
this.newsLanguageLocales = [];
|
|
13
|
+
this.pageSize = 16;
|
|
11
14
|
this.nextButtonText = 'Next';
|
|
12
15
|
this.previousButtonText = 'Previous';
|
|
13
16
|
}
|
|
@@ -20,11 +23,11 @@ export class AicoNewsList {
|
|
|
20
23
|
this.newsListFetchController.abort('disconnected');
|
|
21
24
|
}
|
|
22
25
|
async componentWillLoad() {
|
|
23
|
-
this.newsResponse = await fetchNewsArticles(this.api, this.pageNumber, this.pageSize, this.newsListFetchController.signal, this.newsChannels);
|
|
26
|
+
this.newsResponse = await fetchNewsArticles(this.api, this.pageNumber, this.pageSize, this.newsListFetchController.signal, this.newsChannels, this.newsSellerIds, this.newsBrandIds, this.newsLanguageLocales);
|
|
24
27
|
}
|
|
25
28
|
async componentWillUpdate() {
|
|
26
29
|
this.newsListFetchController = new AbortController();
|
|
27
|
-
this.newsResponse = await fetchNewsArticles(this.api, this.pageNumber, this.pageSize, this.newsListFetchController.signal, this.newsChannels);
|
|
30
|
+
this.newsResponse = await fetchNewsArticles(this.api, this.pageNumber, this.pageSize, this.newsListFetchController.signal, this.newsChannels, this.newsSellerIds, this.newsBrandIds, this.newsLanguageLocales);
|
|
28
31
|
}
|
|
29
32
|
render() {
|
|
30
33
|
var _a, _b, _c;
|
|
@@ -102,7 +105,7 @@ export class AicoNewsList {
|
|
|
102
105
|
"optional": false,
|
|
103
106
|
"docs": {
|
|
104
107
|
"tags": [],
|
|
105
|
-
"text": ""
|
|
108
|
+
"text": "The url of the Aico Api that will be used to retrieve the article."
|
|
106
109
|
},
|
|
107
110
|
"attribute": "aico-url",
|
|
108
111
|
"reflect": false
|
|
@@ -119,7 +122,7 @@ export class AicoNewsList {
|
|
|
119
122
|
"optional": false,
|
|
120
123
|
"docs": {
|
|
121
124
|
"tags": [],
|
|
122
|
-
"text": ""
|
|
125
|
+
"text": "The token used to authenticate against he Aico Api."
|
|
123
126
|
},
|
|
124
127
|
"attribute": "aico-bearer-token",
|
|
125
128
|
"reflect": false
|
|
@@ -136,10 +139,76 @@ export class AicoNewsList {
|
|
|
136
139
|
"optional": false,
|
|
137
140
|
"docs": {
|
|
138
141
|
"tags": [],
|
|
139
|
-
"text": ""
|
|
142
|
+
"text": "Channel names used to filter the results."
|
|
143
|
+
},
|
|
144
|
+
"defaultValue": "[]"
|
|
145
|
+
},
|
|
146
|
+
"newsSellerIds": {
|
|
147
|
+
"type": "unknown",
|
|
148
|
+
"mutable": false,
|
|
149
|
+
"complexType": {
|
|
150
|
+
"original": "string[]",
|
|
151
|
+
"resolved": "string[]",
|
|
152
|
+
"references": {}
|
|
153
|
+
},
|
|
154
|
+
"required": false,
|
|
155
|
+
"optional": false,
|
|
156
|
+
"docs": {
|
|
157
|
+
"tags": [],
|
|
158
|
+
"text": "Sellers used to filter the results."
|
|
140
159
|
},
|
|
141
160
|
"defaultValue": "[]"
|
|
142
161
|
},
|
|
162
|
+
"newsBrandIds": {
|
|
163
|
+
"type": "unknown",
|
|
164
|
+
"mutable": false,
|
|
165
|
+
"complexType": {
|
|
166
|
+
"original": "string[]",
|
|
167
|
+
"resolved": "string[]",
|
|
168
|
+
"references": {}
|
|
169
|
+
},
|
|
170
|
+
"required": false,
|
|
171
|
+
"optional": false,
|
|
172
|
+
"docs": {
|
|
173
|
+
"tags": [],
|
|
174
|
+
"text": "Brands used to filter the results."
|
|
175
|
+
},
|
|
176
|
+
"defaultValue": "[]"
|
|
177
|
+
},
|
|
178
|
+
"newsLanguageLocales": {
|
|
179
|
+
"type": "unknown",
|
|
180
|
+
"mutable": false,
|
|
181
|
+
"complexType": {
|
|
182
|
+
"original": "string[]",
|
|
183
|
+
"resolved": "string[]",
|
|
184
|
+
"references": {}
|
|
185
|
+
},
|
|
186
|
+
"required": false,
|
|
187
|
+
"optional": false,
|
|
188
|
+
"docs": {
|
|
189
|
+
"tags": [],
|
|
190
|
+
"text": "Language locales used to filter the results."
|
|
191
|
+
},
|
|
192
|
+
"defaultValue": "[]"
|
|
193
|
+
},
|
|
194
|
+
"pageSize": {
|
|
195
|
+
"type": "number",
|
|
196
|
+
"mutable": false,
|
|
197
|
+
"complexType": {
|
|
198
|
+
"original": "number",
|
|
199
|
+
"resolved": "number",
|
|
200
|
+
"references": {}
|
|
201
|
+
},
|
|
202
|
+
"required": false,
|
|
203
|
+
"optional": false,
|
|
204
|
+
"docs": {
|
|
205
|
+
"tags": [],
|
|
206
|
+
"text": "The page size. Prefer this number to be even."
|
|
207
|
+
},
|
|
208
|
+
"attribute": "page-size",
|
|
209
|
+
"reflect": false,
|
|
210
|
+
"defaultValue": "16"
|
|
211
|
+
},
|
|
143
212
|
"nextButtonText": {
|
|
144
213
|
"type": "string",
|
|
145
214
|
"mutable": false,
|
|
@@ -152,7 +221,7 @@ export class AicoNewsList {
|
|
|
152
221
|
"optional": false,
|
|
153
222
|
"docs": {
|
|
154
223
|
"tags": [],
|
|
155
|
-
"text": ""
|
|
224
|
+
"text": "The text used by the next button in the pagination component."
|
|
156
225
|
},
|
|
157
226
|
"attribute": "next-button-text",
|
|
158
227
|
"reflect": false,
|
|
@@ -170,7 +239,7 @@ export class AicoNewsList {
|
|
|
170
239
|
"optional": false,
|
|
171
240
|
"docs": {
|
|
172
241
|
"tags": [],
|
|
173
|
-
"text": ""
|
|
242
|
+
"text": "The text used by the previous button in the pagination component."
|
|
174
243
|
},
|
|
175
244
|
"attribute": "previous-button-text",
|
|
176
245
|
"reflect": false,
|
|
@@ -193,7 +262,7 @@ export class AicoNewsList {
|
|
|
193
262
|
"composed": true,
|
|
194
263
|
"docs": {
|
|
195
264
|
"tags": [],
|
|
196
|
-
"text": ""
|
|
265
|
+
"text": "Event emitted when a user clicks an article.\n\nThe handler receives the entire Article entity."
|
|
197
266
|
},
|
|
198
267
|
"complexType": {
|
|
199
268
|
"original": "Article",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aico-news-list.js","sourceRoot":"","sources":["../../../src/components/aico-news-list/aico-news-list.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAUtD,MAAM,OAAO,YAAY;;QACN,aAAQ,GAAG,EAAE,CAAC;;0BAIT,CAAC;;;4BAMU,EAAE;8BAEF,MAAM;kCAEF,UAAU;;IAO/C,iBAAiB;QACf,IAAI,CAAC,uBAAuB,GAAG,IAAI,eAAe,EAAE,CAAC;QACrD,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;QAEpB,IAAI,CAAC,GAAG,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC;IAC1E,CAAC;IAED,oBAAoB;QAClB,IAAI,CAAC,uBAAwB,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IACtD,CAAC;IAED,KAAK,CAAC,iBAAiB;QACrB,IAAI,CAAC,YAAY,GAAG,MAAM,iBAAiB,CAAC,IAAI,CAAC,GAAI,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,uBAAwB,CAAC,MAAM,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;IAClJ,CAAC;IAED,KAAK,CAAC,mBAAmB;QACvB,IAAI,CAAC,uBAAuB,GAAG,IAAI,eAAe,EAAE,CAAC;QACrD,IAAI,CAAC,YAAY,GAAG,MAAM,iBAAiB,CAAC,IAAI,CAAC,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AC,CAAC;SACnB;QAED,IAAI,IAAI,CAAC,UAAU,GAAG,SAAS,IAAI,CAAC,MAAA,MAAA,IAAI,CAAC,YAAY,0CAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,mCAAI,CAAC,CAAC,GAAG,CAAC,EAAE;YACnF,KAAK,CAAC,IAAI,CAAC,GAAG,MAAA,IAAI,CAAC,YAAY,0CAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;SACxD;QAED,OAAO,KAAK,CAAC;IACf,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, EventEmitter, Host, Prop, State, h } from '@stencil/core';\nimport { fetchNewsArticles } from '../../utils/utils';\nimport { NewsResponse } from '../../model/NewsResponse';\nimport { AicoApiRequestInfo } from '../../model/AicoApiRequestInfo';\nimport { Article } from '../../model/Article';\n\n@Component({\n tag: 'aico-news-list',\n styleUrl: 'aico-news-list.css',\n scoped: true,\n})\nexport class AicoNewsList {\n private readonly pageSize = 16;\n\n @State() newsResponse?: NewsResponse;\n\n @State() pageNumber = 1;\n\n @Prop() aicoUrl!: string;\n\n @Prop() aicoBearerToken!: string;\n\n @Prop() newsChannels: string[] = [];\n\n @Prop() nextButtonText: string = 'Next';\n\n @Prop() previousButtonText: string = 'Previous';\n\n @Event() articleClick?: EventEmitter<Article>;\n\n private api?: AicoApiRequestInfo;\n private newsListFetchController?: AbortController;\n\n connectedCallback() {\n this.newsListFetchController = new AbortController();\n this.pageNumber = 1;\n\n this.api = { baseApi: this.aicoUrl, bearerToken: this.aicoBearerToken };\n }\n\n disconnectedCallback() {\n this.newsListFetchController!.abort('disconnected');\n }\n\n async componentWillLoad(): Promise<void> {\n this.newsResponse = await fetchNewsArticles(this.api!, this.pageNumber, this.pageSize, this.newsListFetchController!.signal, this.newsChannels);\n }\n\n async componentWillUpdate(): Promise<void> {\n this.newsListFetchController = new AbortController();\n this.newsResponse = await fetchNewsArticles(this.api!, this.pageNumber, this.pageSize, this.newsListFetchController.signal, this.newsChannels);\n }\n\n render() {\n return (\n <Host>\n <div class=\"row row-cols-1 row-cols-sm-2 row-cols-lg-4 g-4 mb-4\">\n {this.newsResponse?.data.map(article => (\n <div class=\"col\">\n <aico-news-list-item\n article={article}\n onArticleClick={e => {\n this.articleClick?.emit(e.detail);\n }}\n />\n </div>\n ))}\n </div>\n <nav class=\"w-100\" aria-label=\"News navigation\">\n <ul class=\"pagination justify-content-center\">\n <li\n class={`page-item page-link user-select-none d-flex align-items-center ${!this.newsResponse?.links.prev ? 'disabled' : ''}`}\n style={{ cursor: 'pointer' }}\n onClick={() => {\n if (this.pageNumber > 1) {\n this.pageNumber -= 1;\n }\n\n return false;\n }}\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"currentColor\" class=\"bi bi-chevron-left me-1 fs-4\" style={{ width: '1em', height: '1em' }} viewBox=\"0 0 16 16\">\n <path fill-rule=\"evenodd\" d=\"M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0\" />\n </svg>\n {this.previousButtonText}\n </li>\n {this.getViewablePages().map(page => (\n <li\n class={`page-item page-link user-select-none ${page === '...' ? 'disabled' : Number(page) === this.pageNumber ? 'active' : ''}`}\n style={{ cursor: 'pointer' }}\n onClick={() => {\n if (page !== '...') {\n this.pageNumber = Number(page);\n }\n return false;\n }}\n >\n {page}\n </li>\n ))}\n <li\n class={`page-item page-link user-select-none d-flex align-items-center ${!this.newsResponse?.links.next ? 'disabled' : ''}`}\n style={{ cursor: 'pointer' }}\n onClick={() => {\n if (this.newsResponse?.meta.page.lastPage && this.pageNumber < this.newsResponse?.meta.page.lastPage) {\n this.pageNumber += 1;\n }\n }}\n >\n {this.nextButtonText}\n <svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"currentColor\" class=\"bi bi-chevron-right ms-1 fs-4\" style={{ width: '1em', height: '1em' }} viewBox=\"0 0 16 16\">\n <path fill-rule=\"evenodd\" d=\"M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708\" />\n </svg>\n </li>\n </ul>\n </nav>\n </Host>\n );\n }\n\n private getViewablePages(lookAhead: number = 2) {\n const pages: string[] = [];\n if (this.pageNumber - lookAhead >= 2) {\n pages.push('1');\n }\n\n if (this.pageNumber - lookAhead > 2) {\n pages.push('...');\n }\n\n for (let i = this.pageNumber - lookAhead; i < this.pageNumber; i += 1) {\n if (i >= 1) {\n pages.push(`${i}`);\n }\n }\n\n pages.push(`${this.pageNumber}`);\n for (let i = this.pageNumber + 1; i <= this.pageNumber + lookAhead; i += 1) {\n if (i <= (this.newsResponse?.meta.page.lastPage ?? 0)) {\n pages.push(`${i}`);\n }\n }\n\n if (this.pageNumber + lookAhead < (this.newsResponse?.meta.page.lastPage ?? 0) - 1) {\n pages.push('...');\n }\n\n if (this.pageNumber + lookAhead <= (this.newsResponse?.meta.page.lastPage ?? 0) - 1) {\n pages.push(`${this.newsResponse?.meta.page.lastPage}`);\n }\n\n return pages;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"aico-news-list.js","sourceRoot":"","sources":["../../../src/components/aico-news-list/aico-news-list.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAUtD,MAAM,OAAO,YAAY;;;0BAGD,CAAC;;;4BAeU,EAAE;6BAKD,EAAE;4BAKH,EAAE;mCAKK,EAAE;wBAKf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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, EventEmitter, Host, Prop, State, h } from '@stencil/core';\nimport { fetchNewsArticles } from '../../utils/utils';\nimport { NewsResponse } from '../../model/NewsResponse';\nimport { AicoApiRequestInfo } from '../../model/AicoApiRequestInfo';\nimport { Article } from '../../model/Article';\n\n@Component({\n tag: 'aico-news-list',\n styleUrl: 'aico-news-list.css',\n scoped: true,\n})\nexport class AicoNewsList {\n @State() newsResponse?: NewsResponse;\n\n @State() pageNumber = 1;\n\n /**\n * The url of the Aico Api that will be used to retrieve the article.\n */\n @Prop() aicoUrl!: string;\n\n /**\n * The token used to authenticate against he Aico Api.\n */\n @Prop() aicoBearerToken!: string;\n\n /**\n * Channel names used to filter the results.\n */\n @Prop() newsChannels: string[] = [];\n\n /**\n * Sellers used to filter the results.\n */\n @Prop() newsSellerIds: string[] = [];\n\n /**\n * Brands used to filter the results.\n */\n @Prop() newsBrandIds: string[] = [];\n\n /**\n * Language locales used to filter the results.\n */\n @Prop() newsLanguageLocales: string[] = [];\n\n /**\n * The page size. Prefer this number to be even.\n */\n @Prop() pageSize: number = 16;\n\n /**\n * The text used by the next button in the pagination component.\n */\n @Prop() nextButtonText: string = 'Next';\n\n /**\n * The text used by the previous button in the pagination component.\n */\n @Prop() previousButtonText: string = 'Previous';\n\n /**\n * Event emitted when a user clicks an article.\n *\n * The handler receives the entire Article entity.\n */\n @Event() articleClick?: EventEmitter<Article>;\n\n private api?: AicoApiRequestInfo;\n private newsListFetchController?: AbortController;\n\n connectedCallback() {\n this.newsListFetchController = new AbortController();\n this.pageNumber = 1;\n\n this.api = { baseApi: this.aicoUrl, bearerToken: this.aicoBearerToken };\n }\n\n disconnectedCallback() {\n this.newsListFetchController!.abort('disconnected');\n }\n\n async componentWillLoad(): Promise<void> {\n this.newsResponse = await fetchNewsArticles(\n this.api!,\n this.pageNumber,\n this.pageSize,\n this.newsListFetchController!.signal,\n this.newsChannels,\n this.newsSellerIds,\n this.newsBrandIds,\n this.newsLanguageLocales,\n );\n }\n\n async componentWillUpdate(): Promise<void> {\n this.newsListFetchController = new AbortController();\n this.newsResponse = await fetchNewsArticles(\n this.api!,\n this.pageNumber,\n this.pageSize,\n this.newsListFetchController.signal,\n this.newsChannels,\n this.newsSellerIds,\n this.newsBrandIds,\n this.newsLanguageLocales,\n );\n }\n\n render() {\n return (\n <Host>\n <div class=\"row row-cols-1 row-cols-sm-2 row-cols-lg-4 g-4 mb-4\">\n {this.newsResponse?.data.map(article => (\n <div class=\"col\">\n <aico-news-list-item\n article={article}\n onArticleClick={e => {\n this.articleClick?.emit(e.detail);\n }}\n />\n </div>\n ))}\n </div>\n <nav class=\"w-100\" aria-label=\"News navigation\">\n <ul class=\"pagination justify-content-center\">\n <li\n class={`page-item page-link user-select-none d-flex align-items-center ${!this.newsResponse?.links.prev ? 'disabled' : ''}`}\n style={{ cursor: 'pointer' }}\n onClick={() => {\n if (this.pageNumber > 1) {\n this.pageNumber -= 1;\n }\n\n return false;\n }}\n >\n <svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"currentColor\" class=\"bi bi-chevron-left me-1 fs-4\" style={{ width: '1em', height: '1em' }} viewBox=\"0 0 16 16\">\n <path fill-rule=\"evenodd\" d=\"M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0\" />\n </svg>\n {this.previousButtonText}\n </li>\n {this.getViewablePages().map(page => (\n <li\n class={`page-item page-link user-select-none ${page === '...' ? 'disabled' : Number(page) === this.pageNumber ? 'active' : ''}`}\n style={{ cursor: 'pointer' }}\n onClick={() => {\n if (page !== '...') {\n this.pageNumber = Number(page);\n }\n return false;\n }}\n >\n {page}\n </li>\n ))}\n <li\n class={`page-item page-link user-select-none d-flex align-items-center ${!this.newsResponse?.links.next ? 'disabled' : ''}`}\n style={{ cursor: 'pointer' }}\n onClick={() => {\n if (this.newsResponse?.meta.page.lastPage && this.pageNumber < this.newsResponse?.meta.page.lastPage) {\n this.pageNumber += 1;\n }\n }}\n >\n {this.nextButtonText}\n <svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"currentColor\" class=\"bi bi-chevron-right ms-1 fs-4\" style={{ width: '1em', height: '1em' }} viewBox=\"0 0 16 16\">\n <path fill-rule=\"evenodd\" d=\"M4.646 1.646a.5.5 0 0 1 .708 0l6 6a.5.5 0 0 1 0 .708l-6 6a.5.5 0 0 1-.708-.708L10.293 8 4.646 2.354a.5.5 0 0 1 0-.708\" />\n </svg>\n </li>\n </ul>\n </nav>\n </Host>\n );\n }\n\n private getViewablePages(lookAhead: number = 2) {\n const pages: string[] = [];\n if (this.pageNumber - lookAhead >= 2) {\n pages.push('1');\n }\n\n if (this.pageNumber - lookAhead > 2) {\n pages.push('...');\n }\n\n for (let i = this.pageNumber - lookAhead; i < this.pageNumber; i += 1) {\n if (i >= 1) {\n pages.push(`${i}`);\n }\n }\n\n pages.push(`${this.pageNumber}`);\n for (let i = this.pageNumber + 1; i <= this.pageNumber + lookAhead; i += 1) {\n if (i <= (this.newsResponse?.meta.page.lastPage ?? 0)) {\n pages.push(`${i}`);\n }\n }\n\n if (this.pageNumber + lookAhead < (this.newsResponse?.meta.page.lastPage ?? 0) - 1) {\n pages.push('...');\n }\n\n if (this.pageNumber + lookAhead <= (this.newsResponse?.meta.page.lastPage ?? 0) - 1) {\n pages.push(`${this.newsResponse?.meta.page.lastPage}`);\n }\n\n return pages;\n }\n}\n"]}
|
|
@@ -8,6 +8,9 @@ export class AicoSpecialNewsCarousel {
|
|
|
8
8
|
this.aicoUrl = undefined;
|
|
9
9
|
this.aicoBearerToken = undefined;
|
|
10
10
|
this.newsChannels = [];
|
|
11
|
+
this.newsSellerIds = [];
|
|
12
|
+
this.newsBrandIds = [];
|
|
13
|
+
this.newsLanguageLocales = [];
|
|
11
14
|
this.numberOfArticles = 6;
|
|
12
15
|
}
|
|
13
16
|
connectedCallback() {
|
|
@@ -18,11 +21,11 @@ export class AicoSpecialNewsCarousel {
|
|
|
18
21
|
this.newsListFetchController.abort('disconnected');
|
|
19
22
|
}
|
|
20
23
|
async componentWillLoad() {
|
|
21
|
-
this.newsResponse = await fetchSpecialNewsArticles(this.api, 1, this.numberOfArticles, this.newsListFetchController.signal, this.newsChannels);
|
|
24
|
+
this.newsResponse = await fetchSpecialNewsArticles(this.api, 1, this.numberOfArticles, this.newsListFetchController.signal, this.newsChannels, this.newsSellerIds, this.newsBrandIds, this.newsLanguageLocales);
|
|
22
25
|
}
|
|
23
26
|
async componentWillUpdate() {
|
|
24
27
|
this.newsListFetchController = new AbortController();
|
|
25
|
-
this.newsResponse = await fetchSpecialNewsArticles(this.api, 1, this.numberOfArticles, this.newsListFetchController.signal, this.newsChannels);
|
|
28
|
+
this.newsResponse = await fetchSpecialNewsArticles(this.api, 1, this.numberOfArticles, this.newsListFetchController.signal, this.newsChannels, this.newsSellerIds, this.newsBrandIds, this.newsLanguageLocales);
|
|
26
29
|
}
|
|
27
30
|
componentDidLoad() {
|
|
28
31
|
$('.carousel').slick({
|
|
@@ -71,7 +74,7 @@ export class AicoSpecialNewsCarousel {
|
|
|
71
74
|
"optional": false,
|
|
72
75
|
"docs": {
|
|
73
76
|
"tags": [],
|
|
74
|
-
"text": ""
|
|
77
|
+
"text": "The url of the Aico Api that will be used to retrieve the article."
|
|
75
78
|
},
|
|
76
79
|
"attribute": "aico-url",
|
|
77
80
|
"reflect": false
|
|
@@ -88,7 +91,7 @@ export class AicoSpecialNewsCarousel {
|
|
|
88
91
|
"optional": false,
|
|
89
92
|
"docs": {
|
|
90
93
|
"tags": [],
|
|
91
|
-
"text": ""
|
|
94
|
+
"text": "The token used to authenticate against he Aico Api."
|
|
92
95
|
},
|
|
93
96
|
"attribute": "aico-bearer-token",
|
|
94
97
|
"reflect": false
|
|
@@ -105,7 +108,55 @@ export class AicoSpecialNewsCarousel {
|
|
|
105
108
|
"optional": false,
|
|
106
109
|
"docs": {
|
|
107
110
|
"tags": [],
|
|
108
|
-
"text": ""
|
|
111
|
+
"text": "Channel names used to filter the results."
|
|
112
|
+
},
|
|
113
|
+
"defaultValue": "[]"
|
|
114
|
+
},
|
|
115
|
+
"newsSellerIds": {
|
|
116
|
+
"type": "unknown",
|
|
117
|
+
"mutable": false,
|
|
118
|
+
"complexType": {
|
|
119
|
+
"original": "string[]",
|
|
120
|
+
"resolved": "string[]",
|
|
121
|
+
"references": {}
|
|
122
|
+
},
|
|
123
|
+
"required": false,
|
|
124
|
+
"optional": false,
|
|
125
|
+
"docs": {
|
|
126
|
+
"tags": [],
|
|
127
|
+
"text": "Sellers used to filter the results."
|
|
128
|
+
},
|
|
129
|
+
"defaultValue": "[]"
|
|
130
|
+
},
|
|
131
|
+
"newsBrandIds": {
|
|
132
|
+
"type": "unknown",
|
|
133
|
+
"mutable": false,
|
|
134
|
+
"complexType": {
|
|
135
|
+
"original": "string[]",
|
|
136
|
+
"resolved": "string[]",
|
|
137
|
+
"references": {}
|
|
138
|
+
},
|
|
139
|
+
"required": false,
|
|
140
|
+
"optional": false,
|
|
141
|
+
"docs": {
|
|
142
|
+
"tags": [],
|
|
143
|
+
"text": "Brands used to filter the results."
|
|
144
|
+
},
|
|
145
|
+
"defaultValue": "[]"
|
|
146
|
+
},
|
|
147
|
+
"newsLanguageLocales": {
|
|
148
|
+
"type": "unknown",
|
|
149
|
+
"mutable": false,
|
|
150
|
+
"complexType": {
|
|
151
|
+
"original": "string[]",
|
|
152
|
+
"resolved": "string[]",
|
|
153
|
+
"references": {}
|
|
154
|
+
},
|
|
155
|
+
"required": false,
|
|
156
|
+
"optional": false,
|
|
157
|
+
"docs": {
|
|
158
|
+
"tags": [],
|
|
159
|
+
"text": "Language locales used to filter the results."
|
|
109
160
|
},
|
|
110
161
|
"defaultValue": "[]"
|
|
111
162
|
},
|
|
@@ -121,7 +172,7 @@ export class AicoSpecialNewsCarousel {
|
|
|
121
172
|
"optional": false,
|
|
122
173
|
"docs": {
|
|
123
174
|
"tags": [],
|
|
124
|
-
"text": ""
|
|
175
|
+
"text": "The number of articles shown in the carousel. Prefer this number to be small."
|
|
125
176
|
},
|
|
126
177
|
"attribute": "number-of-articles",
|
|
127
178
|
"reflect": false,
|
|
@@ -143,7 +194,7 @@ export class AicoSpecialNewsCarousel {
|
|
|
143
194
|
"composed": true,
|
|
144
195
|
"docs": {
|
|
145
196
|
"tags": [],
|
|
146
|
-
"text": ""
|
|
197
|
+
"text": "Event emitted when a user clicks an article title.\n\nThe handler receives the entire Article entity."
|
|
147
198
|
},
|
|
148
199
|
"complexType": {
|
|
149
200
|
"original": "Article",
|
package/dist/collection/components/aico-special-news-carousel/aico-special-news-carousel.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aico-special-news-carousel.js","sourceRoot":"","sources":["../../../src/components/aico-special-news-carousel/aico-special-news-carousel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAI/E,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAE7D,OAAO,CAAC,MAAM,QAAQ,CAAC;AACvB,OAAO,gBAAgB,CAAC;AAOxB,MAAM,OAAO,uBAAuB;;;;;
|
|
1
|
+
{"version":3,"file":"aico-special-news-carousel.js","sourceRoot":"","sources":["../../../src/components/aico-special-news-carousel/aico-special-news-carousel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAgB,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAI/E,OAAO,EAAE,wBAAwB,E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AC;QACJ,CAAC,CAAC,CACE,CACP,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Event, EventEmitter, Prop, State, h } from '@stencil/core';\nimport type { NewsResponse } from '../../model/NewsResponse';\nimport type { AicoApiRequestInfo } from '../../model/AicoApiRequestInfo';\nimport type { Article } from '../../model/Article';\nimport { fetchSpecialNewsArticles } from '../../utils/utils';\n\nimport $ from 'jquery';\nimport 'slick-carousel';\n\n@Component({\n tag: 'aico-special-news-carousel',\n styleUrl: 'aico-special-news-carousel.css',\n scoped: true,\n})\nexport class AicoSpecialNewsCarousel {\n @State() newsResponse!: NewsResponse;\n\n /**\n * The url of the Aico Api that will be used to retrieve the article.\n */\n @Prop() aicoUrl!: string;\n\n /**\n * The token used to authenticate against he Aico Api.\n */\n @Prop() aicoBearerToken!: string;\n\n /**\n * Channel names used to filter the results.\n */\n @Prop() newsChannels: string[] = [];\n\n /**\n * Sellers used to filter the results.\n */\n @Prop() newsSellerIds: string[] = [];\n\n /**\n * Brands used to filter the results.\n */\n @Prop() newsBrandIds: string[] = [];\n\n /**\n * Language locales used to filter the results.\n */\n @Prop() newsLanguageLocales: string[] = [];\n\n /**\n * The number of articles shown in the carousel. Prefer this number to be small.\n */\n @Prop() numberOfArticles: number = 6;\n\n /**\n * Event emitted when a user clicks an article title.\n *\n * The handler receives the entire Article entity.\n */\n @Event() articleClicked?: EventEmitter<Article>;\n\n private api?: AicoApiRequestInfo;\n private newsListFetchController?: AbortController;\n\n connectedCallback() {\n this.newsListFetchController = new AbortController();\n this.api = { baseApi: this.aicoUrl, bearerToken: this.aicoBearerToken };\n }\n\n disconnectedCallback() {\n this.newsListFetchController!.abort('disconnected');\n }\n\n async componentWillLoad(): Promise<void> {\n this.newsResponse = await fetchSpecialNewsArticles(\n this.api!,\n 1,\n this.numberOfArticles,\n this.newsListFetchController!.signal,\n this.newsChannels,\n this.newsSellerIds,\n this.newsBrandIds,\n this.newsLanguageLocales,\n );\n }\n\n async componentWillUpdate(): Promise<void> {\n this.newsListFetchController = new AbortController();\n this.newsResponse = await fetchSpecialNewsArticles(\n this.api!,\n 1,\n this.numberOfArticles,\n this.newsListFetchController.signal,\n this.newsChannels,\n this.newsSellerIds,\n this.newsBrandIds,\n this.newsLanguageLocales,\n );\n }\n\n componentDidLoad() {\n $('.carousel').slick({\n autoplay: true,\n autoplaySpeed: 6000,\n dots: true,\n arrows: false,\n pauseOnDotsHover: true,\n });\n }\n\n render() {\n return (\n <div class=\"carousel\">\n {this.newsResponse.data.map(article => {\n const focusX = article.attributes.focusXPercentage ? `${article.attributes.focusXPercentage}%` : 'center';\n const focusY = article.attributes.focusYPercentage ? `${article.attributes.focusYPercentage}%` : 'center';\n return (\n <div class=\"carousel-item card border-0\">\n <div class=\"card-body\">\n <h5 class=\"card-title text-center text-uppercase\">\n <a\n class=\"text-reset text-decoration-none\"\n href=\"#\"\n onClick={e => {\n e.preventDefault();\n this.articleClicked?.emit(article);\n }}\n >\n {article.attributes.name}\n </a>\n </h5>\n </div>\n <div class=\"ratio ratio-16x9 mx-auto\" style={{ 'max-width': '50%' }}>\n <img\n class=\"card-img-bottom object-fit-cover\"\n style={{ 'object-position': `${focusX} ${focusY}`, 'min-height': '15rem' }}\n alt=\"News Picture\"\n data-lazy={article.attributes.optimizedImage ?? article.attributes.image}\n />\n </div>\n </div>\n );\n })}\n </div>\n );\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Article.js","sourceRoot":"","sources":["../../src/model/Article.ts"],"names":[],"mappings":"","sourcesContent":["import { Entity } from './Entity';\nimport { NewsCategory } from './NewsCategory';\nimport { ContentType } from './article/ContentType';\n\nexport type ArticleTranslation = Entity & {\n locale: string;\n name: string;\n description: string;\n excerpt: string;\n image?: string;\n optimizedImage?: string;\n portraitImage?: string;\n optimizedPortraitImage?: string;\n optimizedListImage?: string;\n shouldShowTranslation: boolean;\n};\n\nexport type ArticleContentTranslation = Entity & {\n locale: string;\n text: string;\n};\n\nexport type ArticleContent = Entity & {\n sort?: number;\n containerOrder?: number;\n type?: ContentType;\n contentData: object;\n};\n\nexport type ArticleContentBuilderColumn = Entity & {\n contentContainer: Entity & {\n isSplit?: object;\n contents: ArticleContent[];\n };\n};\n\nexport type ArticleContentBuilderRow = Entity & {\n defaultTextColor?: string;\n promptText?: string;\n order: number;\n isFullWidth: boolean;\n hasBackground: boolean;\n isOnPrompt: boolean;\n shouldMinimizeColumnSpacing: boolean;\n backgroundColor?: string;\n backgroundType?: string;\n backgroundImage?: string;\n backgroundGradientFrom?: string;\n backgroundGradientTo?: string;\n columns: ArticleContentBuilderColumn[];\n};\n\nexport type ArticleContetBuilder = Entity & {\n name: string;\n rows: ArticleContentBuilderRow[];\n};\n\nexport type ArticleAttributes = {\n createdAt: Date;\n updatedAt: Date;\n publishDate: Date;\n endDatePermanentNews?: Date;\n\n newsCategory: NewsCategory;\n newsTags:
|
|
1
|
+
{"version":3,"file":"Article.js","sourceRoot":"","sources":["../../src/model/Article.ts"],"names":[],"mappings":"","sourcesContent":["import { Entity } from './Entity';\nimport { NewsCategory } from './NewsCategory';\nimport { NewsTag } from './NewsTag';\nimport { ContentType } from './article/ContentType';\n\nexport type ArticleTranslation = Entity & {\n locale: string;\n name: string;\n description: string;\n excerpt: string;\n image?: string;\n optimizedImage?: string;\n portraitImage?: string;\n optimizedPortraitImage?: string;\n optimizedListImage?: string;\n shouldShowTranslation: boolean;\n};\n\nexport type ArticleContentTranslation = Entity & {\n locale: string;\n text: string;\n};\n\nexport type ArticleContent = Entity & {\n sort?: number;\n containerOrder?: number;\n type?: ContentType;\n contentData: object;\n};\n\nexport type ArticleContentBuilderColumn = Entity & {\n contentContainer: Entity & {\n isSplit?: object;\n contents: ArticleContent[];\n };\n};\n\nexport type ArticleContentBuilderRow = Entity & {\n defaultTextColor?: string;\n promptText?: string;\n order: number;\n isFullWidth: boolean;\n hasBackground: boolean;\n isOnPrompt: boolean;\n shouldMinimizeColumnSpacing: boolean;\n backgroundColor?: string;\n backgroundType?: string;\n backgroundImage?: string;\n backgroundGradientFrom?: string;\n backgroundGradientTo?: string;\n columns: ArticleContentBuilderColumn[];\n};\n\nexport type ArticleContetBuilder = Entity & {\n name: string;\n rows: ArticleContentBuilderRow[];\n};\n\nexport type ArticleAttributes = {\n createdAt: Date;\n updatedAt: Date;\n publishDate: Date;\n endDatePermanentNews?: Date;\n\n newsCategory: NewsCategory;\n newsTags: NewsTag[];\n soccerTeams: object[];\n brands: object[];\n album?: object;\n match?: object;\n\n // content\n pageTitle: string;\n metaDescription?: string;\n urlHandle: string;\n author: string;\n contentBuilder: ArticleContetBuilder;\n\n // flags\n isActive: boolean;\n isSpecialArticle: boolean;\n isFullWidth: boolean;\n showInApp: boolean;\n isPermanent: boolean;\n translations: ArticleTranslation[];\n name: string;\n description: string;\n excerpt: string;\n\n // visuals\n headlineImage?: string;\n videoUrl?: string;\n image?: string;\n optimizedImage?: string;\n portraitImage?: string;\n optimizedPortraitImage?: string;\n optimizedListImage?: string;\n\n // coordinates\n focusXCoordinate?: number;\n focusYCoordinate?: number;\n focusXPercentage?: number;\n focusYPercentage?: number;\n mobileFocusXCoordinate?: number;\n mobileFocusYCoordinate?: number;\n mobileFocusXPercentage?: number;\n mobileFocusYPercentage?: number;\n headlineImageFocusXCoordinate?: number;\n headlineImageFocusYCoordinate?: number;\n headlineImageFocusXPercentage?: number;\n headlineImageFocusYPercentage?: number;\n};\n\nexport type Article = {\n id: string;\n type: string;\n links: {\n self: string;\n };\n attributes: ArticleAttributes;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NewsTag.js","sourceRoot":"","sources":["../../src/model/NewsTag.ts"],"names":[],"mappings":"","sourcesContent":["import { Entity } from './Entity';\nimport { Translation } from './article/Translation';\n\nexport type NewsTag = Entity & {\n translations: (Translation & {\n name?: string | null;\n webName?: string | null;\n })[];\n};\n"]}
|
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
import { getAuthenticatedHeaders, getAuthenticatedRequest } from "../model/AicoApiRequestInfo";
|
|
2
|
-
|
|
2
|
+
function setArrayFilter(queryParams, key, values) {
|
|
3
|
+
for (const value of values) {
|
|
4
|
+
queryParams.append(key, value);
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export async function fetchNewsArticles(api, page, size, signal, newsChannels = [], newsSellerIds = [], newsBrandIds = [], newsLanguageLocales = []) {
|
|
3
8
|
const queryParams = new URLSearchParams();
|
|
4
9
|
queryParams.set('page[number]', String(page));
|
|
5
10
|
queryParams.set('page[size]', String(size));
|
|
6
11
|
queryParams.set('sort', '-publishDate');
|
|
7
12
|
queryParams.set('filter[isActive]', '1');
|
|
8
13
|
queryParams.set('filter[excludeTag][]', 'Eisnull');
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
14
|
+
setArrayFilter(queryParams, 'filter[channel][]', newsChannels);
|
|
15
|
+
setArrayFilter(queryParams, 'filter[sellerIds][]', newsSellerIds);
|
|
16
|
+
setArrayFilter(queryParams, 'filter[brandId][]', newsBrandIds);
|
|
17
|
+
setArrayFilter(queryParams, 'filter[newsLanguage][]', newsLanguageLocales);
|
|
12
18
|
const request = getAuthenticatedRequest(api, 'news', queryParams, signal);
|
|
13
19
|
const response = await fetch(request);
|
|
14
20
|
return await response.json();
|
|
15
21
|
}
|
|
16
|
-
export async function fetchSpecialNewsArticles(api, page, size, signal, newsChannels = []) {
|
|
22
|
+
export async function fetchSpecialNewsArticles(api, page, size, signal, newsChannels = [], newsSellerIds = [], newsBrandIds = [], newsLanguageLocales = []) {
|
|
17
23
|
const queryParams = new URLSearchParams();
|
|
18
24
|
queryParams.set('page[number]', String(page));
|
|
19
25
|
queryParams.set('page[size]', String(size));
|
|
@@ -22,9 +28,10 @@ export async function fetchSpecialNewsArticles(api, page, size, signal, newsChan
|
|
|
22
28
|
queryParams.set('filter[isSpecialArticle]', '1');
|
|
23
29
|
queryParams.set('filter[isLightVersion]', 'true');
|
|
24
30
|
queryParams.set('filter[excludeTag][]', 'Eisnull');
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
31
|
+
setArrayFilter(queryParams, 'filter[channel][]', newsChannels);
|
|
32
|
+
setArrayFilter(queryParams, 'filter[sellerIds][]', newsSellerIds);
|
|
33
|
+
setArrayFilter(queryParams, 'filter[brandId][]', newsBrandIds);
|
|
34
|
+
setArrayFilter(queryParams, 'filter[newsLanguage][]', newsLanguageLocales);
|
|
28
35
|
const request = getAuthenticatedRequest(api, 'news', queryParams, signal);
|
|
29
36
|
const response = await fetch(request);
|
|
30
37
|
return await response.json();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAGnH,MAAM,CAAC,KAAK,UAAU,iBAAiB,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAC;AAGnH,SAAS,cAAc,CAAC,WAA4B,EAAE,GAAW,EAAE,MAAgB;IACjF,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE;QAC1B,WAAW,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;KAChC;AACH,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,GAAuB,EACvB,IAAY,EACZ,IAAY,EACZ,MAAmB,EACnB,eAAyB,EAAE,EAC3B,gBAA0B,EAAE,EAC5B,eAAyB,EAAE,EAC3B,sBAAgC,E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C,CAAC,CAAC,MAAM,IAAI,EAAE,EAAE;QAClC,OAAO,iCAAiC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;KACpD;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,4BAA4B,CAAC,GAAmB;IAC9D,IAAI,CAAC,GAAG,IAAI,GAAG,KAAK,GAAG,EAAE;QACvB,OAAO,IAAI,CAAC;KACb;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,UAAsC;IAC7D,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;QAC5C,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE;YACV,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;SACtB;KACF;IAED,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC3B,CAAC","sourcesContent":["import { Article } from '../components';\nimport { AicoApiRequestInfo, getAuthenticatedHeaders, getAuthenticatedRequest } from '../model/AicoApiRequestInfo';\nimport { NewsResponse } from '../model/NewsResponse';\n\nfunction setArrayFilter(queryParams: URLSearchParams, key: string, values: string[]) {\n for (const value of values) {\n queryParams.append(key, value);\n }\n}\n\nexport async function fetchNewsArticles(\n api: AicoApiRequestInfo,\n page: number,\n size: number,\n signal: AbortSignal,\n newsChannels: string[] = [],\n newsSellerIds: string[] = [],\n newsBrandIds: string[] = [],\n newsLanguageLocales: string[] = [],\n): Promise<NewsResponse> {\n const queryParams = new URLSearchParams();\n queryParams.set('page[number]', String(page));\n queryParams.set('page[size]', String(size));\n queryParams.set('sort', '-publishDate');\n queryParams.set('filter[isActive]', '1');\n queryParams.set('filter[excludeTag][]', 'Eisnull');\n setArrayFilter(queryParams, 'filter[channel][]', newsChannels);\n setArrayFilter(queryParams, 'filter[sellerIds][]', newsSellerIds);\n setArrayFilter(queryParams, 'filter[brandId][]', newsBrandIds);\n setArrayFilter(queryParams, 'filter[newsLanguage][]', newsLanguageLocales);\n\n const request = getAuthenticatedRequest(api, 'news', queryParams, signal);\n const response = await fetch(request);\n return await response.json();\n}\n\nexport async function fetchSpecialNewsArticles(\n api: AicoApiRequestInfo,\n page: number,\n size: number,\n signal: AbortSignal,\n newsChannels: string[] = [],\n newsSellerIds: string[] = [],\n newsBrandIds: string[] = [],\n newsLanguageLocales: string[] = [],\n): Promise<NewsResponse> {\n const queryParams = new URLSearchParams();\n queryParams.set('page[number]', String(page));\n queryParams.set('page[size]', String(size));\n queryParams.set('sort', '-publishDate');\n queryParams.set('filter[isActive]', '1');\n queryParams.set('filter[isSpecialArticle]', '1');\n queryParams.set('filter[isLightVersion]', 'true');\n queryParams.set('filter[excludeTag][]', 'Eisnull');\n setArrayFilter(queryParams, 'filter[channel][]', newsChannels);\n setArrayFilter(queryParams, 'filter[sellerIds][]', newsSellerIds);\n setArrayFilter(queryParams, 'filter[brandId][]', newsBrandIds);\n setArrayFilter(queryParams, 'filter[newsLanguage][]', newsLanguageLocales);\n\n const request = getAuthenticatedRequest(api, 'news', queryParams, signal);\n const response = await fetch(request);\n return await response.json();\n}\n\nexport async function fetchNewsArticle(api: AicoApiRequestInfo, articleId: string, signal: AbortSignal): Promise<Article> {\n const request = getAuthenticatedRequest(api, `news/${articleId}`, new URLSearchParams(), signal);\n const response = await fetch(request);\n const article = await response.json();\n return article.data;\n}\n\nexport async function fetchNewsArticleByHandle(api: AicoApiRequestInfo, urlHandle: string, signal: AbortSignal): Promise<Article> {\n const queryParams = new URLSearchParams();\n queryParams.set('filter[urlHandle]', urlHandle);\n\n const request = getAuthenticatedRequest(api, 'news', queryParams, signal);\n const response = await fetch(request);\n const articles = await response.json();\n return articles.data[0];\n}\n\nexport async function fetchArticle(url: string, bearerToken: string, signal: AbortSignal): Promise<Article> {\n const request = new Request(new URL(url), {\n headers: getAuthenticatedHeaders(bearerToken),\n signal,\n });\n const response = await fetch(request);\n return await response.json();\n}\n\nexport function getImageWidthPrc(pictureSize?: string): string {\n switch (pictureSize) {\n case 'extra-small':\n return '28%';\n case 'small':\n return '40%';\n case 'large':\n return '80%';\n case 'extra large': // TODO: has - or not?\n return '100%';\n default:\n return '60%';\n }\n}\n\nexport function getYoutubeURL(url: string): string | null {\n const regExp = /.*(?:youtu.be\\/|v\\/|u\\/\\w\\/|embed\\/|watch\\?v=)([^#&?]*).*/;\n const match = url.match(regExp);\n if (match && match[1].length == 11) {\n return `https://www.youtube.com/embed/${match[1]}`;\n }\n\n return null;\n}\n\nexport function strIsNullOrEmptyOrWhitespace(str?: string | null): boolean {\n if (!str || str === ' ') {\n return true;\n }\n\n return false;\n}\n\nexport function getClass(conditions: { [key: string]: boolean }): string {\n const classes: string[] = [];\n for (const kvp of Object.entries(conditions)) {\n if (kvp[1]) {\n classes.push(kvp[0]);\n }\n }\n\n return classes.join(' ');\n}\n"]}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
|
+
import { C as ConditionalRender } from './ConditionalRender.js';
|
|
3
|
+
import { s as strIsNullOrEmptyOrWhitespace } from './utils.js';
|
|
2
4
|
import { d as defineCustomElement$l } from './aico-album-content2.js';
|
|
3
5
|
import { d as defineCustomElement$k } from './aico-asking-content2.js';
|
|
4
6
|
import { d as defineCustomElement$j } from './aico-block-quote-content2.js';
|
|
@@ -63,11 +65,19 @@ const AicoArticleDetail = /*@__PURE__*/ proxyCustomElement(class AicoArticleDeta
|
|
|
63
65
|
this.dateOptions = { day: 'numeric', month: 'long', year: 'numeric' };
|
|
64
66
|
this.article = undefined;
|
|
65
67
|
this.locale = 'de';
|
|
68
|
+
this.hideDateAndAuthor = false;
|
|
69
|
+
this.hideCategoryAndTags = false;
|
|
66
70
|
}
|
|
67
71
|
render() {
|
|
72
|
+
var _a;
|
|
73
|
+
const category = (_a = this.article.attributes.newsCategory.translations.find(translation => translation.locale === this.locale)) !== null && _a !== void 0 ? _a : null;
|
|
68
74
|
const articleDate = new Date(this.article.attributes.publishDate);
|
|
69
75
|
const content = this.article.attributes.contentBuilder.rows.sort((a, b) => a.order - b.order).map((row, index) => this.mapRowContent(row, index));
|
|
70
|
-
return (h(Host, null, h("figure", null, h("blockquote", { class: "blockquote" }, h("h2", { class: "text-uppercase" }, this.article.attributes.name)), h("figcaption", { class: "blockquote-footer" }, articleDate.toLocaleDateString('en-US', this.dateOptions), " by ", h("cite", { title: "Author" }, this.article.attributes.author))), h("div", { class: "content-wrapper" }, content)
|
|
76
|
+
return (h(Host, null, h("figure", null, h("blockquote", { class: "blockquote" }, h("h2", { class: "text-uppercase" }, this.article.attributes.name)), h(ConditionalRender, { condition: !this.hideDateAndAuthor }, h("figcaption", { class: "blockquote-footer mb-1" }, articleDate.toLocaleDateString('en-US', this.dateOptions), " by ", h("cite", { title: "Author" }, this.article.attributes.author))), h(ConditionalRender, { condition: !this.hideCategoryAndTags && !strIsNullOrEmptyOrWhitespace(category === null || category === void 0 ? void 0 : category.webName) }, h("span", { class: "badge bg-info text-dark" }, category.webName))), h("div", { class: "content-wrapper" }, content), h(ConditionalRender, { condition: !this.hideCategoryAndTags }, this.article.attributes.newsTags.map(tag => {
|
|
77
|
+
var _a;
|
|
78
|
+
const translation = (_a = tag.translations.find(translation => translation.locale === this.locale)) !== null && _a !== void 0 ? _a : null;
|
|
79
|
+
return (h(ConditionalRender, { condition: !strIsNullOrEmptyOrWhitespace(translation === null || translation === void 0 ? void 0 : translation.webName) }, h("span", { class: "badge bg-light text-dark" }, translation.webName)));
|
|
80
|
+
}))));
|
|
71
81
|
}
|
|
72
82
|
mapRowContent(row, index) {
|
|
73
83
|
const rowContent = row.columns.map((column, columnIndex) => this.mapColumnContent(column, columnIndex));
|
|
@@ -138,7 +148,9 @@ const AicoArticleDetail = /*@__PURE__*/ proxyCustomElement(class AicoArticleDeta
|
|
|
138
148
|
static get style() { return aicoArticleDetailCss; }
|
|
139
149
|
}, [2, "aico-article-detail", {
|
|
140
150
|
"article": [16],
|
|
141
|
-
"locale": [1]
|
|
151
|
+
"locale": [1],
|
|
152
|
+
"hideDateAndAuthor": [4, "hide-date-and-author"],
|
|
153
|
+
"hideCategoryAndTags": [4, "hide-category-and-tags"]
|
|
142
154
|
}]);
|
|
143
155
|
function defineCustomElement() {
|
|
144
156
|
if (typeof customElements === "undefined") {
|