@aiconomy/aico-components 0.0.95 → 0.0.100
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/aico-components/aico-components.esm.js +1 -1
- package/dist/aico-components/aico-components.esm.js.map +1 -1
- package/dist/aico-components/p-368addda.entry.js +2 -0
- package/dist/aico-components/p-368addda.entry.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-c900f292.entry.js → p-c69f0ecc.entry.js} +2 -2
- package/dist/aico-components/p-e187bbea.js +2 -0
- package/dist/aico-components/p-e187bbea.js.map +1 -0
- package/dist/aico-components/{p-7ea04e72.entry.js → p-eee603da.entry.js} +2 -2
- package/dist/cjs/aico-album-content_19.cjs.entry.js +1 -1
- package/dist/cjs/aico-components.cjs.js +1 -1
- package/dist/cjs/aico-fetch-article-detail.cjs.entry.js +1 -1
- package/dist/cjs/aico-news-list.cjs.entry.js +6 -3
- 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-news-list/aico-news-list.js +53 -2
- 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 +53 -2
- package/dist/collection/components/aico-special-news-carousel/aico-special-news-carousel.js.map +1 -1
- package/dist/collection/utils/utils.js +15 -8
- package/dist/collection/utils/utils.js.map +1 -1
- package/dist/components/aico-news-list.js +8 -2
- 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/aico-album-content_19.entry.js +1 -1
- package/dist/esm/aico-components.js +1 -1
- package/dist/esm/aico-fetch-article-detail.entry.js +1 -1
- package/dist/esm/aico-news-list.entry.js +6 -3
- 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-news-list/aico-news-list.d.ts +3 -0
- package/dist/types/components/aico-special-news-carousel/aico-special-news-carousel.d.ts +3 -0
- package/dist/types/components.d.ts +12 -0
- package/dist/types/utils/utils.d.ts +2 -2
- package/docs/components/aico-news-list/readme.md +3 -0
- package/docs/components/aico-special-news-carousel/readme.md +3 -0
- package/package.json +1 -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-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/cjs/utils-9ae3486f.js.map +0 -1
- package/dist/esm/utils-25eef7c7.js.map +0 -1
- /package/dist/aico-components/{p-c900f292.entry.js.map → p-c69f0ecc.entry.js.map} +0 -0
- /package/dist/aico-components/{p-7ea04e72.entry.js.map → p-eee603da.entry.js.map} +0 -0
|
@@ -17,7 +17,7 @@ const patchBrowser = () => {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
patchBrowser().then(options => {
|
|
20
|
-
return index.bootstrapLazy([["aico-fetch-article-detail.cjs",[[2,"aico-fetch-article-detail",{"aicoUrl":[1,"aico-url"],"aicoBearerToken":[1,"aico-bearer-token"],"locale":[1],"articleId":[1,"article-id"],"articleUrlHandle":[1,"article-url-handle"],"article":[32]}]]],["aico-news-list.cjs",[[2,"aico-news-list",{"aicoUrl":[1,"aico-url"],"aicoBearerToken":[1,"aico-bearer-token"],"newsChannels":[16],"nextButtonText":[1,"next-button-text"],"previousButtonText":[1,"previous-button-text"],"newsResponse":[32],"pageNumber":[32]}]]],["aico-asking-list-content.cjs",[[6,"aico-asking-list-content"]]],["aico-collection-content.cjs",[[6,"aico-collection-content"]]],["aico-special-news-carousel.cjs",[[2,"aico-special-news-carousel",{"aicoUrl":[1,"aico-url"],"aicoBearerToken":[1,"aico-bearer-token"],"newsChannels":[16],"numberOfArticles":[2,"number-of-articles"],"newsResponse":[32]}]]],["aico-no-content_2.cjs",[[2,"aico-title-content",{"content":[16],"locale":[1]}],[2,"aico-no-content"]]],["aico-album-content_19.cjs",[[2,"aico-bullet-content",{"content":[16],"locale":[1]}],[2,"aico-carousel-content",{"content":[16],"hasArrows":[4,"has-arrows"],"locale":[1]}],[2,"aico-content-card-content",{"content":[16],"locale":[1]}],[2,"aico-heading-content",{"content":[16],"locale":[1]}],[2,"aico-table-content",{"content":[16],"locale":[1]}],[2,"aico-text-content",{"content":[16],"locale":[1]}],[2,"aico-upload-content",{"content":[16],"locale":[1]}],[2,"aico-video-content",{"content":[16],"locale":[1]}],[2,"aico-album-content",{"content":[16]}],[2,"aico-asking-content",{"content":[16],"locale":[1]}],[2,"aico-block-quote-content",{"content":[16],"locale":[1]}],[2,"aico-divider-content",{"content":[16],"locale":[1]}],[2,"aico-document-content",{"content":[16],"locale":[1]}],[2,"aico-faq-content",{"content":[16],"locale":[1]}],[2,"aico-html-content",{"content":[16],"locale":[1]}],[2,"aico-link-content",{"content":[16],"locale":[1]}],[2,"aico-news-content",{"content":[16]}],[2,"aico-page-content",{"content":[16],"locale":[1]}],[2,"aico-testimonial-content",{"content":[16]}]]],["aico-article-detail.cjs",[[2,"aico-article-detail",{"article":[16],"locale":[1]}]]],["aico-news-list-item.cjs",[[2,"aico-news-list-item",{"article":[16]}]]]], options);
|
|
20
|
+
return index.bootstrapLazy([["aico-fetch-article-detail.cjs",[[2,"aico-fetch-article-detail",{"aicoUrl":[1,"aico-url"],"aicoBearerToken":[1,"aico-bearer-token"],"locale":[1],"articleId":[1,"article-id"],"articleUrlHandle":[1,"article-url-handle"],"article":[32]}]]],["aico-news-list.cjs",[[2,"aico-news-list",{"aicoUrl":[1,"aico-url"],"aicoBearerToken":[1,"aico-bearer-token"],"newsChannels":[16],"newsSellerIds":[16],"newsBrandIds":[16],"newsLanguageLocales":[16],"nextButtonText":[1,"next-button-text"],"previousButtonText":[1,"previous-button-text"],"newsResponse":[32],"pageNumber":[32]}]]],["aico-asking-list-content.cjs",[[6,"aico-asking-list-content"]]],["aico-collection-content.cjs",[[6,"aico-collection-content"]]],["aico-special-news-carousel.cjs",[[2,"aico-special-news-carousel",{"aicoUrl":[1,"aico-url"],"aicoBearerToken":[1,"aico-bearer-token"],"newsChannels":[16],"newsSellerIds":[16],"newsBrandIds":[16],"newsLanguageLocales":[16],"numberOfArticles":[2,"number-of-articles"],"newsResponse":[32]}]]],["aico-no-content_2.cjs",[[2,"aico-title-content",{"content":[16],"locale":[1]}],[2,"aico-no-content"]]],["aico-album-content_19.cjs",[[2,"aico-bullet-content",{"content":[16],"locale":[1]}],[2,"aico-carousel-content",{"content":[16],"hasArrows":[4,"has-arrows"],"locale":[1]}],[2,"aico-content-card-content",{"content":[16],"locale":[1]}],[2,"aico-heading-content",{"content":[16],"locale":[1]}],[2,"aico-table-content",{"content":[16],"locale":[1]}],[2,"aico-text-content",{"content":[16],"locale":[1]}],[2,"aico-upload-content",{"content":[16],"locale":[1]}],[2,"aico-video-content",{"content":[16],"locale":[1]}],[2,"aico-album-content",{"content":[16]}],[2,"aico-asking-content",{"content":[16],"locale":[1]}],[2,"aico-block-quote-content",{"content":[16],"locale":[1]}],[2,"aico-divider-content",{"content":[16],"locale":[1]}],[2,"aico-document-content",{"content":[16],"locale":[1]}],[2,"aico-faq-content",{"content":[16],"locale":[1]}],[2,"aico-html-content",{"content":[16],"locale":[1]}],[2,"aico-link-content",{"content":[16],"locale":[1]}],[2,"aico-news-content",{"content":[16]}],[2,"aico-page-content",{"content":[16],"locale":[1]}],[2,"aico-testimonial-content",{"content":[16]}]]],["aico-article-detail.cjs",[[2,"aico-article-detail",{"article":[16],"locale":[1]}]]],["aico-news-list-item.cjs",[[2,"aico-news-list-item",{"article":[16]}]]]], options);
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
exports.setNonce = index.setNonce;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-e52034b7.js');
|
|
6
|
-
const utils = require('./utils-
|
|
6
|
+
const utils = require('./utils-3d8a97f6.js');
|
|
7
7
|
|
|
8
8
|
const aicoNewsListCss = "";
|
|
9
9
|
|
|
@@ -17,6 +17,9 @@ const AicoNewsList = class {
|
|
|
17
17
|
this.aicoUrl = undefined;
|
|
18
18
|
this.aicoBearerToken = undefined;
|
|
19
19
|
this.newsChannels = [];
|
|
20
|
+
this.newsSellerIds = [];
|
|
21
|
+
this.newsBrandIds = [];
|
|
22
|
+
this.newsLanguageLocales = [];
|
|
20
23
|
this.nextButtonText = 'Next';
|
|
21
24
|
this.previousButtonText = 'Previous';
|
|
22
25
|
}
|
|
@@ -29,11 +32,11 @@ const AicoNewsList = class {
|
|
|
29
32
|
this.newsListFetchController.abort('disconnected');
|
|
30
33
|
}
|
|
31
34
|
async componentWillLoad() {
|
|
32
|
-
this.newsResponse = await utils.fetchNewsArticles(this.api, this.pageNumber, this.pageSize, this.newsListFetchController.signal, this.newsChannels);
|
|
35
|
+
this.newsResponse = await utils.fetchNewsArticles(this.api, this.pageNumber, this.pageSize, this.newsListFetchController.signal, this.newsChannels, this.newsSellerIds, this.newsBrandIds, this.newsLanguageLocales);
|
|
33
36
|
}
|
|
34
37
|
async componentWillUpdate() {
|
|
35
38
|
this.newsListFetchController = new AbortController();
|
|
36
|
-
this.newsResponse = await utils.fetchNewsArticles(this.api, this.pageNumber, this.pageSize, this.newsListFetchController.signal, this.newsChannels);
|
|
39
|
+
this.newsResponse = await utils.fetchNewsArticles(this.api, this.pageNumber, this.pageSize, this.newsListFetchController.signal, this.newsChannels, this.newsSellerIds, this.newsBrandIds, this.newsLanguageLocales);
|
|
37
40
|
}
|
|
38
41
|
render() {
|
|
39
42
|
var _a, _b, _c;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"aico-news-list.entry.cjs.js","mappings":";;;;;;;AAAA,MAAM,eAAe,GAAG,EAAE;;MCWb,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;KACzE;IAED,oBAAoB;QAClB,IAAI,CAAC,uBAAwB,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;KACrD;IAED,MAAM,iBAAiB;QACrB,IAAI,CAAC,YAAY,GAAG,MAAMA,uBAAiB,CAAC,IAAI,CAAC,GAAI,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,uBAAwB,CAAC,MAAM,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC;KACjJ;IAED,MAAM,mBAAmB;QACvB,IAAI,CAAC,uBAAuB,GAAG,IAAI,eAAe,EAAE,CAAC;QACrD,IAAI,CAAC,YAAY,GAAG,MAAMA,uBAAiB,CAAC,IAAI,CAAC,GAAI,EAAE,IAAI,CAAC,UAAU,EAAE,I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SACxD;QAED,OAAO,KAAK,CAAC;KACd;;;;;;","names":["fetchNewsArticles","h","Host"],"sources":["src/components/aico-news-list/aico-news-list.css?tag=aico-news-list&encapsulation=scoped","src/components/aico-news-list/aico-news-list.tsx"],"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"],"version":3}
|
|
1
|
+
{"file":"aico-news-list.entry.cjs.js","mappings":";;;;;;;AAAA,MAAM,eAAe,GAAG,EAAE;;MCWb,YAAY;;;;QACN,aAAQ,GAAG,EAAE,CAAC;;0BAIT,CAAC;;;4BAMU,EAAE;6BAED,EAAE;4BAEH,EAAE;mCAEK,EAAE;8BAET,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;KACzE;IAED,oBAAoB;QAClB,IAAI,CAAC,uBAAwB,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;KACrD;IAED,MAAM,iBAAiB;QACrB,IAAI,CAAC,YAAY,GAAG,MAAMA,uBAAiB,CACzC,IAAI,CAAC,GAAI,EACT,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,QAAQ,EACb,IAAI,CAA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AI,CAAC,IAAI,CAAC,QAAQ,mCAAI,CAAC,IAAI,CAAC,EAAE;YAClF,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SACnB;QAED,IAAI,IAAI,CAAC,UAAU,GAAG,SAAS,IAAI,CAAC,MAAA,MAAA,IAAI,CAAC,YAAY,0CAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,mCAAI,CAAC,IAAI,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;KACd;;;;;;","names":["fetchNewsArticles","h","Host"],"sources":["src/components/aico-news-list/aico-news-list.css?tag=aico-news-list&encapsulation=scoped","src/components/aico-news-list/aico-news-list.tsx"],"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() newsSellerIds: string[] = [];\n\n @Prop() newsBrandIds: string[] = [];\n\n @Prop() newsLanguageLocales: 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(\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"],"version":3}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-e52034b7.js');
|
|
6
|
-
const utils = require('./utils-
|
|
6
|
+
const utils = require('./utils-3d8a97f6.js');
|
|
7
7
|
const slick = require('./slick-d0dfbd94.js');
|
|
8
8
|
|
|
9
9
|
const aicoSpecialNewsCarouselCss = ".slick-slide.sc-aico-special-news-carousel>div.sc-aico-special-news-carousel{height:100% !important}";
|
|
@@ -16,6 +16,9 @@ const AicoSpecialNewsCarousel = class {
|
|
|
16
16
|
this.aicoUrl = undefined;
|
|
17
17
|
this.aicoBearerToken = undefined;
|
|
18
18
|
this.newsChannels = [];
|
|
19
|
+
this.newsSellerIds = [];
|
|
20
|
+
this.newsBrandIds = [];
|
|
21
|
+
this.newsLanguageLocales = [];
|
|
19
22
|
this.numberOfArticles = 6;
|
|
20
23
|
}
|
|
21
24
|
connectedCallback() {
|
|
@@ -26,11 +29,11 @@ const AicoSpecialNewsCarousel = class {
|
|
|
26
29
|
this.newsListFetchController.abort('disconnected');
|
|
27
30
|
}
|
|
28
31
|
async componentWillLoad() {
|
|
29
|
-
this.newsResponse = await utils.fetchSpecialNewsArticles(this.api, 1, this.numberOfArticles, this.newsListFetchController.signal, this.newsChannels);
|
|
32
|
+
this.newsResponse = await utils.fetchSpecialNewsArticles(this.api, 1, this.numberOfArticles, this.newsListFetchController.signal, this.newsChannels, this.newsSellerIds, this.newsBrandIds, this.newsLanguageLocales);
|
|
30
33
|
}
|
|
31
34
|
async componentWillUpdate() {
|
|
32
35
|
this.newsListFetchController = new AbortController();
|
|
33
|
-
this.newsResponse = await utils.fetchSpecialNewsArticles(this.api, 1, this.numberOfArticles, this.newsListFetchController.signal, this.newsChannels);
|
|
36
|
+
this.newsResponse = await utils.fetchSpecialNewsArticles(this.api, 1, this.numberOfArticles, this.newsListFetchController.signal, this.newsChannels, this.newsSellerIds, this.newsBrandIds, this.newsLanguageLocales);
|
|
34
37
|
}
|
|
35
38
|
componentDidLoad() {
|
|
36
39
|
slick.jquery('.carousel').slick({
|
|
@@ -1 +1 @@
|
|
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AAC,CACE,EACN;KACH;;;;;;","names":["fetchSpecialNewsArticles","$","h"],"sources":["src/components/aico-special-news-carousel/aico-special-news-carousel.css?tag=aico-special-news-carousel&encapsulation=scoped","src/components/aico-special-news-carousel/aico-special-news-carousel.tsx"],"sourcesContent":[".slick-slide > div {\n height: 100% !important;\n}\n","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 @Prop() aicoUrl!: string;\n\n @Prop() aicoBearerToken!: string;\n\n @Prop() newsChannels: string[] = [];\n\n @Prop() newsSellerIds: string[] = [];\n\n @Prop() newsBrandIds: string[] = [];\n\n @Prop() newsLanguageLocales: string[] = [];\n\n @Prop() numberOfArticles: number = 6;\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"],"version":3}
|
package/dist/cjs/loader.cjs.js
CHANGED
|
@@ -6,7 +6,7 @@ const index = require('./index-e52034b7.js');
|
|
|
6
6
|
|
|
7
7
|
const defineCustomElements = (win, options) => {
|
|
8
8
|
if (typeof window === 'undefined') return undefined;
|
|
9
|
-
return index.bootstrapLazy([["aico-fetch-article-detail.cjs",[[2,"aico-fetch-article-detail",{"aicoUrl":[1,"aico-url"],"aicoBearerToken":[1,"aico-bearer-token"],"locale":[1],"articleId":[1,"article-id"],"articleUrlHandle":[1,"article-url-handle"],"article":[32]}]]],["aico-news-list.cjs",[[2,"aico-news-list",{"aicoUrl":[1,"aico-url"],"aicoBearerToken":[1,"aico-bearer-token"],"newsChannels":[16],"nextButtonText":[1,"next-button-text"],"previousButtonText":[1,"previous-button-text"],"newsResponse":[32],"pageNumber":[32]}]]],["aico-asking-list-content.cjs",[[6,"aico-asking-list-content"]]],["aico-collection-content.cjs",[[6,"aico-collection-content"]]],["aico-special-news-carousel.cjs",[[2,"aico-special-news-carousel",{"aicoUrl":[1,"aico-url"],"aicoBearerToken":[1,"aico-bearer-token"],"newsChannels":[16],"numberOfArticles":[2,"number-of-articles"],"newsResponse":[32]}]]],["aico-no-content_2.cjs",[[2,"aico-title-content",{"content":[16],"locale":[1]}],[2,"aico-no-content"]]],["aico-album-content_19.cjs",[[2,"aico-bullet-content",{"content":[16],"locale":[1]}],[2,"aico-carousel-content",{"content":[16],"hasArrows":[4,"has-arrows"],"locale":[1]}],[2,"aico-content-card-content",{"content":[16],"locale":[1]}],[2,"aico-heading-content",{"content":[16],"locale":[1]}],[2,"aico-table-content",{"content":[16],"locale":[1]}],[2,"aico-text-content",{"content":[16],"locale":[1]}],[2,"aico-upload-content",{"content":[16],"locale":[1]}],[2,"aico-video-content",{"content":[16],"locale":[1]}],[2,"aico-album-content",{"content":[16]}],[2,"aico-asking-content",{"content":[16],"locale":[1]}],[2,"aico-block-quote-content",{"content":[16],"locale":[1]}],[2,"aico-divider-content",{"content":[16],"locale":[1]}],[2,"aico-document-content",{"content":[16],"locale":[1]}],[2,"aico-faq-content",{"content":[16],"locale":[1]}],[2,"aico-html-content",{"content":[16],"locale":[1]}],[2,"aico-link-content",{"content":[16],"locale":[1]}],[2,"aico-news-content",{"content":[16]}],[2,"aico-page-content",{"content":[16],"locale":[1]}],[2,"aico-testimonial-content",{"content":[16]}]]],["aico-article-detail.cjs",[[2,"aico-article-detail",{"article":[16],"locale":[1]}]]],["aico-news-list-item.cjs",[[2,"aico-news-list-item",{"article":[16]}]]]], options);
|
|
9
|
+
return index.bootstrapLazy([["aico-fetch-article-detail.cjs",[[2,"aico-fetch-article-detail",{"aicoUrl":[1,"aico-url"],"aicoBearerToken":[1,"aico-bearer-token"],"locale":[1],"articleId":[1,"article-id"],"articleUrlHandle":[1,"article-url-handle"],"article":[32]}]]],["aico-news-list.cjs",[[2,"aico-news-list",{"aicoUrl":[1,"aico-url"],"aicoBearerToken":[1,"aico-bearer-token"],"newsChannels":[16],"newsSellerIds":[16],"newsBrandIds":[16],"newsLanguageLocales":[16],"nextButtonText":[1,"next-button-text"],"previousButtonText":[1,"previous-button-text"],"newsResponse":[32],"pageNumber":[32]}]]],["aico-asking-list-content.cjs",[[6,"aico-asking-list-content"]]],["aico-collection-content.cjs",[[6,"aico-collection-content"]]],["aico-special-news-carousel.cjs",[[2,"aico-special-news-carousel",{"aicoUrl":[1,"aico-url"],"aicoBearerToken":[1,"aico-bearer-token"],"newsChannels":[16],"newsSellerIds":[16],"newsBrandIds":[16],"newsLanguageLocales":[16],"numberOfArticles":[2,"number-of-articles"],"newsResponse":[32]}]]],["aico-no-content_2.cjs",[[2,"aico-title-content",{"content":[16],"locale":[1]}],[2,"aico-no-content"]]],["aico-album-content_19.cjs",[[2,"aico-bullet-content",{"content":[16],"locale":[1]}],[2,"aico-carousel-content",{"content":[16],"hasArrows":[4,"has-arrows"],"locale":[1]}],[2,"aico-content-card-content",{"content":[16],"locale":[1]}],[2,"aico-heading-content",{"content":[16],"locale":[1]}],[2,"aico-table-content",{"content":[16],"locale":[1]}],[2,"aico-text-content",{"content":[16],"locale":[1]}],[2,"aico-upload-content",{"content":[16],"locale":[1]}],[2,"aico-video-content",{"content":[16],"locale":[1]}],[2,"aico-album-content",{"content":[16]}],[2,"aico-asking-content",{"content":[16],"locale":[1]}],[2,"aico-block-quote-content",{"content":[16],"locale":[1]}],[2,"aico-divider-content",{"content":[16],"locale":[1]}],[2,"aico-document-content",{"content":[16],"locale":[1]}],[2,"aico-faq-content",{"content":[16],"locale":[1]}],[2,"aico-html-content",{"content":[16],"locale":[1]}],[2,"aico-link-content",{"content":[16],"locale":[1]}],[2,"aico-news-content",{"content":[16]}],[2,"aico-page-content",{"content":[16],"locale":[1]}],[2,"aico-testimonial-content",{"content":[16]}]]],["aico-article-detail.cjs",[[2,"aico-article-detail",{"article":[16],"locale":[1]}]]],["aico-news-list-item.cjs",[[2,"aico-news-list-item",{"article":[16]}]]]], options);
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
exports.setNonce = index.setNonce;
|
|
@@ -13,21 +13,27 @@ const getAuthenticatedRequest = (api, route, query, signal) => {
|
|
|
13
13
|
});
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
function setArrayFilter(queryParams, key, values) {
|
|
17
|
+
for (const value of values) {
|
|
18
|
+
queryParams.append(key, value);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
async function fetchNewsArticles(api, page, size, signal, newsChannels = [], newsSellerIds = [], newsBrandIds = [], newsLanguageLocales = []) {
|
|
17
22
|
const queryParams = new URLSearchParams();
|
|
18
23
|
queryParams.set('page[number]', String(page));
|
|
19
24
|
queryParams.set('page[size]', String(size));
|
|
20
25
|
queryParams.set('sort', '-publishDate');
|
|
21
26
|
queryParams.set('filter[isActive]', '1');
|
|
22
27
|
queryParams.set('filter[excludeTag][]', 'Eisnull');
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
setArrayFilter(queryParams, 'filter[channel][]', newsChannels);
|
|
29
|
+
setArrayFilter(queryParams, 'filter[sellerIds][]', newsSellerIds);
|
|
30
|
+
setArrayFilter(queryParams, 'filter[brandId][]', newsBrandIds);
|
|
31
|
+
setArrayFilter(queryParams, 'filter[newsLanguage][]', newsLanguageLocales);
|
|
26
32
|
const request = getAuthenticatedRequest(api, 'news', queryParams, signal);
|
|
27
33
|
const response = await fetch(request);
|
|
28
34
|
return await response.json();
|
|
29
35
|
}
|
|
30
|
-
async function fetchSpecialNewsArticles(api, page, size, signal, newsChannels = []) {
|
|
36
|
+
async function fetchSpecialNewsArticles(api, page, size, signal, newsChannels = [], newsSellerIds = [], newsBrandIds = [], newsLanguageLocales = []) {
|
|
31
37
|
const queryParams = new URLSearchParams();
|
|
32
38
|
queryParams.set('page[number]', String(page));
|
|
33
39
|
queryParams.set('page[size]', String(size));
|
|
@@ -36,9 +42,10 @@ async function fetchSpecialNewsArticles(api, page, size, signal, newsChannels =
|
|
|
36
42
|
queryParams.set('filter[isSpecialArticle]', '1');
|
|
37
43
|
queryParams.set('filter[isLightVersion]', 'true');
|
|
38
44
|
queryParams.set('filter[excludeTag][]', 'Eisnull');
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
45
|
+
setArrayFilter(queryParams, 'filter[channel][]', newsChannels);
|
|
46
|
+
setArrayFilter(queryParams, 'filter[sellerIds][]', newsSellerIds);
|
|
47
|
+
setArrayFilter(queryParams, 'filter[brandId][]', newsBrandIds);
|
|
48
|
+
setArrayFilter(queryParams, 'filter[newsLanguage][]', newsLanguageLocales);
|
|
42
49
|
const request = getAuthenticatedRequest(api, 'news', queryParams, signal);
|
|
43
50
|
const response = await fetch(request);
|
|
44
51
|
return await response.json();
|
|
@@ -104,4 +111,4 @@ exports.getImageWidthPrc = getImageWidthPrc;
|
|
|
104
111
|
exports.getYoutubeURL = getYoutubeURL;
|
|
105
112
|
exports.strIsNullOrEmptyOrWhitespace = strIsNullOrEmptyOrWhitespace;
|
|
106
113
|
|
|
107
|
-
//# sourceMappingURL=utils-
|
|
114
|
+
//# sourceMappingURL=utils-3d8a97f6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"file":"utils-3d8a97f6.js","mappings":";;AAKO,MAAM,uBAAuB,GAAG,CAAC,WAAmB;IACzD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;IAC9B,OAAO,CAAC,MAAM,CAAC,QAAQ,EAAE,0BAA0B,CAAC,CAAC;IACrD,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,UAAU,WAAW,EAAE,CAAC,CAAC;IACzD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEK,MAAM,uBAAuB,GAAG,CAAC,GAAuB,EAAE,KAAa,EAAE,KAAsB,EAAE,MAAoB;IAC1H,OAAO,IAAI,OAAO,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AK,GAAG,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAChC,IAAI,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,EAAE,EAAE;QAClC,OAAO,iCAAiC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;KACpD;IAED,OAAO,IAAI,CAAC;AACd,CAAC;SAEe,4BAA4B,CAAC,GAAmB;IAC9D,IAAI,CAAC,GAAG,IAAI,GAAG,KAAK,GAAG,EAAE;QACvB,OAAO,IAAI,CAAC;KACb;IAED,OAAO,KAAK,CAAC;AACf,CAAC;SAEe,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;;;;;;;;;;;","names":[],"sources":["src/model/AicoApiRequestInfo.ts","src/utils/utils.ts"],"sourcesContent":["export type AicoApiRequestInfo = {\n baseApi: string;\n bearerToken: string;\n};\n\nexport const getAuthenticatedHeaders = (bearerToken: string): Headers => {\n const headers = new Headers();\n headers.append('Accept', 'application/vnd.api+json');\n headers.append('Authorization', `Bearer ${bearerToken}`);\n return headers;\n};\n\nexport const getAuthenticatedRequest = (api: AicoApiRequestInfo, route: string, query: URLSearchParams, signal?: AbortSignal): Request => {\n return new Request(new URL(`${route}?${query.toString()}`, api.baseApi), {\n headers: getAuthenticatedHeaders(api.bearerToken),\n signal,\n });\n};\n","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"],"version":3}
|
|
@@ -8,6 +8,9 @@ export class AicoNewsList {
|
|
|
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.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;
|
|
@@ -140,6 +143,54 @@ export class AicoNewsList {
|
|
|
140
143
|
},
|
|
141
144
|
"defaultValue": "[]"
|
|
142
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": ""
|
|
159
|
+
},
|
|
160
|
+
"defaultValue": "[]"
|
|
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": ""
|
|
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": ""
|
|
191
|
+
},
|
|
192
|
+
"defaultValue": "[]"
|
|
193
|
+
},
|
|
143
194
|
"nextButtonText": {
|
|
144
195
|
"type": "string",
|
|
145
196
|
"mutable": false,
|
|
@@ -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,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AC;QACjC,KAAK,IAAI,CAAC,GAAG,IAAI,CAAC,UAAU,GAAG,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,UAAU,GAAG,SAAS,EAAE,CAAC,IAAI,CAAC,EAAE;YAC1E,IAAI,CAAC,IAAI,CAAC,MAAA,MAAA,IAAI,CAAC,YAAY,0CAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,mCAAI,CAAC,CAAC,EAAE;gBACrD,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;aACpB;SACF;QAED,IAAI,IAAI,CAAC,UAAU,GAAG,SAAS,GAAG,CAAC,MAAA,MAAA,IAAI,CAAC,YAAY,0CAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,mCAAI,CAAC,CAAC,GAAG,CAAC,EAAE;YAClF,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,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;;QACN,aAAQ,GAAG,EAAE,CAAC;;0BAIT,CAAC;;;4BAMU,EAAE;6BAED,EAAE;4BAEH,EAAE;mCAEK,EAAE;8BAET,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,CACzC,IAAI,CAAC,GAAI,EACT,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,uBAAwB,CAAC,MAAM,EACpC,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,mBAAmB,CACzB,CAAC;IACJ,CAAC;IAED,KAAK,CAAC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;QAED,IAAI,IAAI,CAAC,UAAU,GAAG,SAAS,GAAG,CAAC,MAAA,MAAA,IAAI,CAAC,YAAY,0CAAE,IAAI,CAAC,IAAI,CAAC,QAAQ,mCAAI,CAAC,CAAC,GAAG,CAAC,EAAE;YAClF,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,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() newsSellerIds: string[] = [];\n\n @Prop() newsBrandIds: string[] = [];\n\n @Prop() newsLanguageLocales: 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(\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({
|
|
@@ -109,6 +112,54 @@ export class AicoSpecialNewsCarousel {
|
|
|
109
112
|
},
|
|
110
113
|
"defaultValue": "[]"
|
|
111
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": ""
|
|
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": ""
|
|
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": ""
|
|
160
|
+
},
|
|
161
|
+
"defaultValue": "[]"
|
|
162
|
+
},
|
|
112
163
|
"numberOfArticles": {
|
|
113
164
|
"type": "number",
|
|
114
165
|
"mutable": false,
|
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;;;;;4BAOD,EAAE;
|
|
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;;;;;4BAOD,EAAE;6BAED,EAAE;4BAEH,EAAE;mCAEK,EAAE;gCAEP,CAAC;;IAOpC,iBAAiB;QACf,IAAI,CAAC,uBAAuB,GAAG,IAAI,eAAe,EAAE,CAAC;QACrD,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,wBAAwB,CAChD,IAAI,CAAC,GAAI,EACT,CAAC,EACD,IAAI,CAAC,gBAAgB,EACrB,IAAI,CAAC,uBAAwB,CAAC,MAAM,EACpC,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,mBAAmB,CACzB,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,mBAAmB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CAAE,IAAI,CAAC,OAAO,CAAC,CAAC;4BACrC,CAAC,IAEA,OAAO,CAAC,UAAU,CAAC,IAAI,CACtB,CACD,CACD;gBACN,WAAK,KAAK,EAAC,0BAA0B,EAAC,KAAK,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE;oBACjE,WACE,KAAK,EAAC,kCAAkC,EACxC,KAAK,EAAE,EAAE,iBAAiB,EAAE,GAAG,MAAM,IAAI,MAAM,EAAE,EAAE,YAAY,EAAE,OAAO,EAAE,EAC1E,GAAG,EAAC,cAAc,eACP,MAAA,OAAO,CAAC,UAAU,CAAC,cAAc,mCAAI,OAAO,CAAC,UAAU,CAAC,KAAK,GACxE,CACE,CACF,CACP,CAAC;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 @Prop() aicoUrl!: string;\n\n @Prop() aicoBearerToken!: string;\n\n @Prop() newsChannels: string[] = [];\n\n @Prop() newsSellerIds: string[] = [];\n\n @Prop() newsBrandIds: string[] = [];\n\n @Prop() newsLanguageLocales: string[] = [];\n\n @Prop() numberOfArticles: number = 6;\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,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();
|