@aiconomy/aico-components 0.0.128 → 0.0.136
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 +26 -23
- 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-64d6361b.entry.js → p-de1a4cc0.entry.js} +3 -3
- package/dist/aico-components/p-de1a4cc0.entry.js.map +1 -0
- package/dist/cjs/aico-album-content_26.cjs.entry.js +16 -10
- package/dist/cjs/aico-album-content_26.cjs.entry.js.map +1 -1
- package/dist/cjs/aico-components.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/aico-article-detail/aico-article-detail.js +4 -3
- package/dist/collection/components/aico-article-detail/aico-article-detail.js.map +1 -1
- package/dist/collection/components/aico-news-list/aico-news-list.js +20 -1
- package/dist/collection/components/aico-news-list/aico-news-list.js.map +1 -1
- package/dist/collection/components/aico-news-list-item/aico-news-list-item.js +22 -2
- package/dist/collection/components/aico-news-list-item/aico-news-list-item.js.map +1 -1
- package/dist/collection/components/aico-special-news-carousel/aico-special-news-carousel.js +22 -2
- package/dist/collection/components/aico-special-news-carousel/aico-special-news-carousel.js.map +1 -1
- package/dist/collection/utils/ConditionalRender.js +1 -1
- package/dist/collection/utils/ConditionalRender.js.map +1 -1
- package/dist/collection/utils/utils.js +1 -1
- package/dist/collection/utils/utils.js.map +1 -1
- package/dist/components/ConditionalRender.js +1 -1
- package/dist/components/ConditionalRender.js.map +1 -1
- package/dist/components/aico-article-detail2.js +4 -3
- package/dist/components/aico-article-detail2.js.map +1 -1
- package/dist/components/aico-news-list-item2.js +6 -3
- package/dist/components/aico-news-list-item2.js.map +1 -1
- package/dist/components/aico-news-list.js +3 -1
- package/dist/components/aico-news-list.js.map +1 -1
- package/dist/components/aico-special-news-carousel.js +5 -2
- package/dist/components/aico-special-news-carousel.js.map +1 -1
- package/dist/components/utils.js +1 -1
- package/dist/components/utils.js.map +1 -1
- package/dist/esm/aico-album-content_26.entry.js +16 -10
- package/dist/esm/aico-album-content_26.entry.js.map +1 -1
- package/dist/esm/aico-components.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/aico-news-list/aico-news-list.d.ts +6 -0
- package/dist/types/components/aico-news-list-item/aico-news-list-item.d.ts +6 -0
- package/dist/types/components/aico-special-news-carousel/aico-special-news-carousel.d.ts +6 -0
- package/dist/types/components.d.ts +24 -0
- package/dist/types/utils/utils.d.ts +1 -1
- package/package.json +1 -1
- package/dist/aico-components/p-64d6361b.entry.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"aico-article-detail2.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAY,WA8BX;AA9BD,WAAY,WAAW;IACrB,gCAAiB,CAAA;IACjB,4BAAa,CAAA;IACb,8BAAe,CAAA;IACf,8BAAe,CAAA;IACf,kCAAmB,CAAA;IACnB,8BAAe,CAAA;IACf,4CAA6B,CAAA;IAC7B,0CAA2B,CAAA;IAC3B,kCAAmB,CAAA;IACnB,4BAAa,CAAA;IACb,gCAAiB,CAAA;IACjB,gCAAiB,CAAA;IACjB,0CAA2B,CAAA;IAC3B,0CAA2B,CAAA;IAC3B,0BAAW,CAAA;IACX,0BAAW,CAAA;IACX,4CAA6B,CAAA;IAC7B,0CAA2B,CAAA;IAC3B,0BAAW,CAAA;IACX,gCAAiB,CAAA;IACjB,oCAAqB,CAAA;IACrB,4BAAa,CAAA;IACb,4BAAa,CAAA;IACb,kCAAmB,CAAA;IACnB,wCAAyB,CAAA;IACzB,oCAAqB,CAAA;IACrB,4BAAa,CAAA;IACb,8BAAe,CAAA;IACf,gCAAiB,CAAA;AACnB,CAAC,EA9BW,WAAW,KAAX,WAAW;;ACAvB,MAAM,oBAAoB,GAAG,EAAE;;MC+BlB,iBAAiB;;;;QAoBX,gBAAW,GAA+B,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,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K,WAAW,CAAC,MAAM;gBACrB,OAAO,2BAAqB,OAAO,EAAE,OAAwB,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,GAAI,CAAC;YAEzF,KAAK,WAAW,CAAC,KAAK;gBACpB,OAAO,0BAAoB,OAAO,EAAE,OAAuB,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,GAAI,CAAC;YAEvF,KAAK,WAAW,CAAC,OAAO,CAAC;YACzB,KAAK,WAAW,CAAC,MAAM,CAAC;YACxB,KAAK,WAAW,CAAC,WAAW,CAAC;YAC7B,KAAK,WAAW,CAAC,WAAW,CAAC;YAC7B,KAAK,WAAW,CAAC,GAAG,CAAC;YACrB,KAAK,WAAW,CAAC,GAAG,CAAC;YACrB,KAAK,WAAW,CAAC,YAAY,CAAC;YAC9B,KAAK,WAAW,CAAC,MAAM,CAAC;YACxB,KAAK,WAAW,CAAC,UAAU,CAAC;YAC5B;gBACE,OAAO,WAAK,KAAK,EAAC,uCAAuC,gCAAgC,CAAC;SAC7F;KACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/model/article/ContentType.ts","src/components/aico-article-detail/aico-article-detail.css?tag=aico-article-detail&encapsulation=scoped","src/components/aico-article-detail/aico-article-detail.tsx"],"sourcesContent":["export enum ContentType {\n BULLET = 'BULLET',\n TEXT = 'TEXT',\n VIDEO = 'VIDEO',\n TABLE = 'TABLE',\n HEADING = 'HEADING',\n TITLE = 'TITLE',\n CONTENT_CARD = 'CONTENT_CARD',\n TESTIMONIAL = 'TESTIMONIAL',\n PRODUCT = 'PRODUCT',\n NEWS = 'NEWS',\n ASKING = 'ASKING',\n AGENDA = 'AGENDA',\n LIST_ASKING = 'LIST_ASKING',\n LIST_AGENDA = 'LIST_AGENDA',\n CRM = 'CRM',\n B2B = 'B2B',\n FORM_BUILDER = 'FORM_BUILDER',\n BLOCK_QUOTE = 'BLOCK_QUOTE',\n FAQ = 'FAQ',\n COURSE = 'COURSE',\n DOCUMENT = 'DOCUMENT',\n LINK = 'LINK',\n HTML = 'HTML',\n DIVIDER = 'DIVIDER',\n COLLECTION = 'COLLECTION',\n CAROUSEL = 'CAROUSEL',\n PAGE = 'PAGE',\n ALBUM = 'ALBUM',\n UPLOAD = 'UPLOAD',\n}\n","","import { Component, Host, Prop, h } from '@stencil/core';\nimport { ContentType } from '../../model/article/ContentType';\nimport type { Article, ArticleContent, ArticleContentBuilderColumn, ArticleContentBuilderRow } from '../../model/Article';\nimport type { HtmlContent } from '../../model/article/content/HtmlContent';\nimport type { AlbumContent } from '../../model/article/content/AlbumContent';\nimport type { TitleContent } from '../../model/article/content/TitleContent';\nimport type { BlockQuoteContent } from '../../model/article/content/BlockQuoteContent';\nimport type { BulletContent } from '../../model/article/content/BulletContent';\nimport type { CardContent } from '../../model/article/content/CardContent';\nimport type { CarouselContent } from '../../model/article/content/CarouselContent';\nimport type { DividerContent } from '../../model/article/content/DividerContent';\nimport type { DocumentContent } from '../../model/article/content/DocumentContent';\nimport type { HeadingContent } from '../../model/article/content/HeadingContent';\nimport type { LinkContent } from '../../model/article/content/LinkContent';\nimport type { TableContent } from '../../model/article/content/TableContet';\nimport type { TestimonialContent } from '../../model/article/content/TestimonialContent';\nimport type { TextContent } from '../../model/article/content/TextContent';\nimport type { VideoContent } from '../../model/article/content/VideoContent';\nimport type { AskingContent } from '../../model/article/content/AskingContent';\nimport type { FaqContent } from '../../model/article/content/FaqContent';\nimport type { NewsContent } from '../../model/article/content/NewsContent';\nimport type { PageContent } from '../../model/article/content/PageContent';\nimport type { UploadContent } from '../../model/article/content/UploadContent';\nimport ConditionalRender from '../../utils/ConditionalRender';\nimport { strIsNullOrEmptyOrWhitespace } from '../../utils/utils';\n\n@Component({\n tag: 'aico-article-detail',\n styleUrl: 'aico-article-detail.css',\n scoped: true,\n})\nexport class AicoArticleDetail {\n @Prop() article!: Article;\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 private readonly dateOptions: Intl.DateTimeFormatOptions = { day: 'numeric', month: 'long', year: 'numeric' };\n\n render() {\n const category = this.article.attributes.newsCategory?.translations.find(translation => translation.locale === this.locale) ?? null;\n const articleDate = new Date(this.article.attributes.publishDate);\n const content = this.article.attributes.contentBuilder.rows.sort((a, b) => a.order - b.order).map((row, index) => this.mapRowContent(row, index));\n return (\n <Host>\n <figure>\n <blockquote class=\"blockquote\">\n <h2 class=\"text-uppercase\">{this.article.attributes.name}</h2>\n </blockquote>\n <ConditionalRender condition={!this.hideDateAndAuthor}>\n <figcaption class=\"blockquote-footer mb-1\">\n {articleDate.toLocaleDateString('en-US', this.dateOptions)} by <cite title=\"Author\">{this.article.attributes.author}</cite>\n </figcaption>\n </ConditionalRender>\n <ConditionalRender condition={!this.hideCategoryAndTags && !strIsNullOrEmptyOrWhitespace(category?.webName)}>\n <span class=\"badge bg-info text-dark\">{category?.webName}</span>\n </ConditionalRender>\n </figure>\n <div class=\"content-wrapper\">{content}</div>\n <ConditionalRender condition={!this.hideCategoryAndTags}>\n {this.article.attributes.newsTags.map(tag => {\n const translation = tag.translations.find(translation => translation.locale === this.locale) ?? null;\n return (\n <ConditionalRender condition={!strIsNullOrEmptyOrWhitespace(translation?.webName)}>\n <span class=\"badge bg-light text-dark\">{translation!.webName}</span>\n </ConditionalRender>\n );\n })}\n </ConditionalRender>\n </Host>\n );\n }\n\n private mapRowContent(row: ArticleContentBuilderRow, index: number) {\n const rowContent = row.columns.map((column, columnIndex) => this.mapColumnContent(column, columnIndex));\n return <div class={`content-row content-row-index-${index}`}>{rowContent}</div>;\n }\n\n private mapColumnContent(column: ArticleContentBuilderColumn, index: number) {\n const columnContent = column.contentContainer.contents.sort((a, b) => (a.sort ?? 0) - (b.sort ?? 0)).map((content, contentIndex) => this.mapContent(content, contentIndex));\n return <div class={`content-column content-column-index-${index}`}>{columnContent}</div>;\n }\n\n private mapContent(content: ArticleContent, index: number) {\n return <div class={`content-data-wrapper content-data-wrapper-index-${index}`}>{this.mapContentData(content.type, content.contentData)}</div>;\n }\n\n private mapContentData(contentType: ContentType | undefined, content: object) {\n switch (contentType) {\n case ContentType.ALBUM:\n return <aico-album-content content={content as AlbumContent} />;\n\n case ContentType.ASKING:\n return <aico-asking-content content={content as AskingContent} locale={this.locale} />;\n\n case ContentType.BLOCK_QUOTE:\n return <aico-block-quote-content content={content as BlockQuoteContent} locale={this.locale} />;\n\n case ContentType.BULLET:\n return <aico-bullet-content content={content as BulletContent} locale={this.locale} />;\n\n case ContentType.CAROUSEL:\n return <aico-carousel-content content={content as CarouselContent} locale={this.locale} />;\n\n case ContentType.CONTENT_CARD:\n return <aico-content-card-content content={content as CardContent} locale={this.locale} />;\n\n case ContentType.DIVIDER:\n return <aico-divider-content content={content as DividerContent} locale={this.locale} />;\n\n case ContentType.DOCUMENT:\n return <aico-document-content content={content as DocumentContent} locale={this.locale} />;\n\n case ContentType.FAQ:\n return <aico-faq-content content={content as FaqContent} locale={this.locale} />;\n\n case ContentType.HEADING:\n return <aico-heading-content content={content as HeadingContent} locale={this.locale} />;\n\n case ContentType.HTML:\n return <aico-html-content content={content as HtmlContent} locale={this.locale} />;\n\n case ContentType.LINK:\n return <aico-link-content content={content as LinkContent} locale={this.locale} />;\n\n case ContentType.NEWS:\n return <aico-news-content content={content as NewsContent} />;\n\n case ContentType.PAGE:\n return <aico-page-content content={content as PageContent} locale={this.locale} />;\n\n case ContentType.TABLE:\n return <aico-table-content content={content as TableContent} locale={this.locale} />;\n\n case ContentType.TESTIMONIAL:\n return <aico-testimonial-content content={content as TestimonialContent} />;\n\n case ContentType.TEXT:\n return <aico-text-content content={content as TextContent} locale={this.locale} />;\n\n case ContentType.TITLE:\n return <aico-title-content content={content as TitleContent} locale={this.locale} />;\n\n case ContentType.UPLOAD:\n return <aico-upload-content content={content as UploadContent} locale={this.locale} />;\n\n case ContentType.VIDEO:\n return <aico-video-content content={content as VideoContent} locale={this.locale} />;\n\n case ContentType.PRODUCT:\n case ContentType.AGENDA:\n case ContentType.LIST_ASKING:\n case ContentType.LIST_AGENDA:\n case ContentType.CRM:\n case ContentType.B2B:\n case ContentType.FORM_BUILDER:\n case ContentType.COURSE:\n case ContentType.COLLECTION:\n default:\n return <div class=\"content-data content-data-not-handled\">Content type not handled.</div>;\n }\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"aico-article-detail2.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAY,WA8BX;AA9BD,WAAY,WAAW;IACrB,gCAAiB,CAAA;IACjB,4BAAa,CAAA;IACb,8BAAe,CAAA;IACf,8BAAe,CAAA;IACf,kCAAmB,CAAA;IACnB,8BAAe,CAAA;IACf,4CAA6B,CAAA;IAC7B,0CAA2B,CAAA;IAC3B,kCAAmB,CAAA;IACnB,4BAAa,CAAA;IACb,gCAAiB,CAAA;IACjB,gCAAiB,CAAA;IACjB,0CAA2B,CAAA;IAC3B,0CAA2B,CAAA;IAC3B,0BAAW,CAAA;IACX,0BAAW,CAAA;IACX,4CAA6B,CAAA;IAC7B,0CAA2B,CAAA;IAC3B,0BAAW,CAAA;IACX,gCAAiB,CAAA;IACjB,oCAAqB,CAAA;IACrB,4BAAa,CAAA;IACb,4BAAa,CAAA;IACb,kCAAmB,CAAA;IACnB,wCAAyB,CAAA;IACzB,oCAAqB,CAAA;IACrB,4BAAa,CAAA;IACb,8BAAe,CAAA;IACf,gCAAiB,CAAA;AACnB,CAAC,EA9BW,WAAW,KAAX,WAAW;;ACAvB,MAAM,oBAAoB,GAAG,EAAE;;MC+BlB,iBAAiB;;;;QAoBX,gBAAW,GAA+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,OAA6B,GAAI,CAAC;YAE9E,KAAK,WAAW,CAAC,IAAI;gBACnB,OAAO,yBAAmB,OAAO,EAAE,OAAsB,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,GAAI,CAAC;YAErF,KAAK,WAAW,CAAC,KAAK;gBACpB,OAAO,0BAAoB,OAAO,EAAE,OAAuB,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,GAAI,CAAC;YAEvF,KAAK,WAAW,CAAC,MAAM;gBACrB,OAAO,2BAAqB,OAAO,EAAE,OAAwB,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,GAAI,CAAC;YAEzF,KAAK,WAAW,CAAC,KAAK;gBACpB,OAAO,0BAAoB,OAAO,EAAE,OAAuB,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,GAAI,CAAC;YAEvF,KAAK,WAAW,CAAC,OAAO,CAAC;YACzB,KAAK,WAAW,CAAC,MAAM,CAAC;YACxB,KAAK,WAAW,CAAC,WAAW,CAAC;YAC7B,KAAK,WAAW,CAAC,WAAW,CAAC;YAC7B,KAAK,WAAW,CAAC,GAAG,CAAC;YACrB,KAAK,WAAW,CAAC,GAAG,CAAC;YACrB,KAAK,WAAW,CAAC,YAAY,CAAC;YAC9B,KAAK,WAAW,CAAC,MAAM,CAAC;YACxB,KAAK,WAAW,CAAC,UAAU,CAAC;YAC5B;gBACE,OAAO,WAAK,KAAK,EAAC,uCAAuC,gCAAgC,CAAC;SAC7F;KACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/model/article/ContentType.ts","src/components/aico-article-detail/aico-article-detail.css?tag=aico-article-detail&encapsulation=scoped","src/components/aico-article-detail/aico-article-detail.tsx"],"sourcesContent":["export enum ContentType {\n BULLET = 'BULLET',\n TEXT = 'TEXT',\n VIDEO = 'VIDEO',\n TABLE = 'TABLE',\n HEADING = 'HEADING',\n TITLE = 'TITLE',\n CONTENT_CARD = 'CONTENT_CARD',\n TESTIMONIAL = 'TESTIMONIAL',\n PRODUCT = 'PRODUCT',\n NEWS = 'NEWS',\n ASKING = 'ASKING',\n AGENDA = 'AGENDA',\n LIST_ASKING = 'LIST_ASKING',\n LIST_AGENDA = 'LIST_AGENDA',\n CRM = 'CRM',\n B2B = 'B2B',\n FORM_BUILDER = 'FORM_BUILDER',\n BLOCK_QUOTE = 'BLOCK_QUOTE',\n FAQ = 'FAQ',\n COURSE = 'COURSE',\n DOCUMENT = 'DOCUMENT',\n LINK = 'LINK',\n HTML = 'HTML',\n DIVIDER = 'DIVIDER',\n COLLECTION = 'COLLECTION',\n CAROUSEL = 'CAROUSEL',\n PAGE = 'PAGE',\n ALBUM = 'ALBUM',\n UPLOAD = 'UPLOAD',\n}\n","","import { Component, Host, Prop, h } from '@stencil/core';\nimport { ContentType } from '../../model/article/ContentType';\nimport type { Article, ArticleContent, ArticleContentBuilderColumn, ArticleContentBuilderRow } from '../../model/Article';\nimport type { HtmlContent } from '../../model/article/content/HtmlContent';\nimport type { AlbumContent } from '../../model/article/content/AlbumContent';\nimport type { TitleContent } from '../../model/article/content/TitleContent';\nimport type { BlockQuoteContent } from '../../model/article/content/BlockQuoteContent';\nimport type { BulletContent } from '../../model/article/content/BulletContent';\nimport type { CardContent } from '../../model/article/content/CardContent';\nimport type { CarouselContent } from '../../model/article/content/CarouselContent';\nimport type { DividerContent } from '../../model/article/content/DividerContent';\nimport type { DocumentContent } from '../../model/article/content/DocumentContent';\nimport type { HeadingContent } from '../../model/article/content/HeadingContent';\nimport type { LinkContent } from '../../model/article/content/LinkContent';\nimport type { TableContent } from '../../model/article/content/TableContet';\nimport type { TestimonialContent } from '../../model/article/content/TestimonialContent';\nimport type { TextContent } from '../../model/article/content/TextContent';\nimport type { VideoContent } from '../../model/article/content/VideoContent';\nimport type { AskingContent } from '../../model/article/content/AskingContent';\nimport type { FaqContent } from '../../model/article/content/FaqContent';\nimport type { NewsContent } from '../../model/article/content/NewsContent';\nimport type { PageContent } from '../../model/article/content/PageContent';\nimport type { UploadContent } from '../../model/article/content/UploadContent';\nimport ConditionalRender from '../../utils/ConditionalRender';\nimport { strIsNullOrEmptyOrWhitespace } from '../../utils/utils';\n\n@Component({\n tag: 'aico-article-detail',\n styleUrl: 'aico-article-detail.css',\n scoped: true,\n})\nexport class AicoArticleDetail {\n @Prop() article!: Article;\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 private readonly dateOptions: Intl.DateTimeFormatOptions = { day: 'numeric', month: 'long', year: 'numeric' };\n\n render() {\n const translation = this.article.attributes.translations.find(translation => translation.locale === this.locale) ?? null;\n const category = this.article.attributes.newsCategory?.translations.find(translation => translation.locale === this.locale) ?? null;\n const articleDate = new Date(this.article.attributes.publishDate);\n const content = this.article.attributes.contentBuilder.rows.sort((a, b) => a.order - b.order).map((row, index) => this.mapRowContent(row, index));\n return (\n <Host>\n <figure>\n <blockquote class=\"blockquote\">\n <h2 class=\"text-uppercase\">{translation?.name ?? this.article.attributes.name}</h2>\n </blockquote>\n <ConditionalRender condition={!this.hideDateAndAuthor}>\n <figcaption class=\"blockquote-footer mb-1\">\n {articleDate.toLocaleDateString('en-US', this.dateOptions)} by <cite title=\"Author\">{this.article.attributes.author}</cite>\n </figcaption>\n </ConditionalRender>\n <ConditionalRender condition={!this.hideCategoryAndTags && !strIsNullOrEmptyOrWhitespace(category?.webName)}>\n <span class=\"badge bg-info text-dark\">{category?.webName}</span>\n </ConditionalRender>\n </figure>\n <div class=\"content-wrapper\">{content}</div>\n <ConditionalRender condition={!this.hideCategoryAndTags}>\n {this.article.attributes.newsTags.map(tag => {\n const translation = tag.translations.find(translation => translation.locale === this.locale) ?? null;\n return (\n <ConditionalRender condition={!strIsNullOrEmptyOrWhitespace(translation?.webName)}>\n <span class=\"badge bg-light text-dark\">{translation!.webName}</span>\n </ConditionalRender>\n );\n })}\n </ConditionalRender>\n </Host>\n );\n }\n\n private mapRowContent(row: ArticleContentBuilderRow, index: number) {\n const rowContent = row.columns.map((column, columnIndex) => this.mapColumnContent(column, columnIndex));\n return <div class={`content-row content-row-index-${index}`}>{rowContent}</div>;\n }\n\n private mapColumnContent(column: ArticleContentBuilderColumn, index: number) {\n const columnContent = column.contentContainer.contents.sort((a, b) => (a.sort ?? 0) - (b.sort ?? 0)).map((content, contentIndex) => this.mapContent(content, contentIndex));\n return <div class={`content-column content-column-index-${index}`}>{columnContent}</div>;\n }\n\n private mapContent(content: ArticleContent, index: number) {\n return <div class={`content-data-wrapper content-data-wrapper-index-${index}`}>{this.mapContentData(content.type, content.contentData)}</div>;\n }\n\n private mapContentData(contentType: ContentType | undefined, content: object) {\n switch (contentType) {\n case ContentType.ALBUM:\n return <aico-album-content content={content as AlbumContent} />;\n\n case ContentType.ASKING:\n return <aico-asking-content content={content as AskingContent} locale={this.locale} />;\n\n case ContentType.BLOCK_QUOTE:\n return <aico-block-quote-content content={content as BlockQuoteContent} locale={this.locale} />;\n\n case ContentType.BULLET:\n return <aico-bullet-content content={content as BulletContent} locale={this.locale} />;\n\n case ContentType.CAROUSEL:\n return <aico-carousel-content content={content as CarouselContent} locale={this.locale} />;\n\n case ContentType.CONTENT_CARD:\n return <aico-content-card-content content={content as CardContent} locale={this.locale} />;\n\n case ContentType.DIVIDER:\n return <aico-divider-content content={content as DividerContent} locale={this.locale} />;\n\n case ContentType.DOCUMENT:\n return <aico-document-content content={content as DocumentContent} locale={this.locale} />;\n\n case ContentType.FAQ:\n return <aico-faq-content content={content as FaqContent} locale={this.locale} />;\n\n case ContentType.HEADING:\n return <aico-heading-content content={content as HeadingContent} locale={this.locale} />;\n\n case ContentType.HTML:\n return <aico-html-content content={content as HtmlContent} locale={this.locale} />;\n\n case ContentType.LINK:\n return <aico-link-content content={content as LinkContent} locale={this.locale} />;\n\n case ContentType.NEWS:\n return <aico-news-content content={content as NewsContent} />;\n\n case ContentType.PAGE:\n return <aico-page-content content={content as PageContent} locale={this.locale} />;\n\n case ContentType.TABLE:\n return <aico-table-content content={content as TableContent} locale={this.locale} />;\n\n case ContentType.TESTIMONIAL:\n return <aico-testimonial-content content={content as TestimonialContent} />;\n\n case ContentType.TEXT:\n return <aico-text-content content={content as TextContent} locale={this.locale} />;\n\n case ContentType.TITLE:\n return <aico-title-content content={content as TitleContent} locale={this.locale} />;\n\n case ContentType.UPLOAD:\n return <aico-upload-content content={content as UploadContent} locale={this.locale} />;\n\n case ContentType.VIDEO:\n return <aico-video-content content={content as VideoContent} locale={this.locale} />;\n\n case ContentType.PRODUCT:\n case ContentType.AGENDA:\n case ContentType.LIST_ASKING:\n case ContentType.LIST_AGENDA:\n case ContentType.CRM:\n case ContentType.B2B:\n case ContentType.FORM_BUILDER:\n case ContentType.COURSE:\n case ContentType.COLLECTION:\n default:\n return <div class=\"content-data content-data-not-handled\">Content type not handled.</div>;\n }\n }\n}\n"],"version":3}
|
|
@@ -8,17 +8,20 @@ const AicoNewsListItem = /*@__PURE__*/ proxyCustomElement(class AicoNewsListItem
|
|
|
8
8
|
this.__registerHost();
|
|
9
9
|
this.articleClick = createEvent(this, "articleClick", 7);
|
|
10
10
|
this.article = undefined;
|
|
11
|
+
this.locale = 'de';
|
|
11
12
|
}
|
|
12
13
|
render() {
|
|
13
|
-
var _a, _b;
|
|
14
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
15
|
+
const translation = this.article.attributes.translations.find(t => t.locale === this.locale);
|
|
14
16
|
return (h("div", { class: "card h-100 pe-auto", style: { cursor: 'pointer' }, onClick: () => {
|
|
15
17
|
var _a;
|
|
16
18
|
(_a = this.articleClick) === null || _a === void 0 ? void 0 : _a.emit(this.article);
|
|
17
|
-
} }, h("div", { class: "ratio ratio-16x9 overflow-hidden" }, h("img", { class: "object-fit-cover", style: { 'min-height': '15rem' }, alt: "Article image", src: (_b = (_a = this.article.attributes.optimizedListImage) !== null &&
|
|
19
|
+
} }, h("div", { class: "ratio ratio-16x9 overflow-hidden" }, h("img", { class: "object-fit-cover", style: { 'min-height': '15rem' }, alt: "Article image", src: (_e = (_d = (_c = (_b = (_a = translation === null || translation === void 0 ? void 0 : translation.optimizedListImage) !== null && _a !== void 0 ? _a : translation === null || translation === void 0 ? void 0 : translation.optimizedImage) !== null && _b !== void 0 ? _b : translation === null || translation === void 0 ? void 0 : translation.image) !== null && _c !== void 0 ? _c : this.article.attributes.optimizedListImage) !== null && _d !== void 0 ? _d : this.article.attributes.optimizedImage) !== null && _e !== void 0 ? _e : this.article.attributes.image }), h("div", { class: "card-img-overlay d-flex justify-content-end" })), h("div", { class: "card-body" }, h("h5", { class: "card-title" }, (_f = translation === null || translation === void 0 ? void 0 : translation.name) !== null && _f !== void 0 ? _f : this.article.attributes.name), h("p", { class: "card-text" }, (_g = translation === null || translation === void 0 ? void 0 : translation.excerpt) !== null && _g !== void 0 ? _g : this.article.attributes.excerpt))));
|
|
18
20
|
}
|
|
19
21
|
static get style() { return aicoNewsListItemCss; }
|
|
20
22
|
}, [2, "aico-news-list-item", {
|
|
21
|
-
"article": [16]
|
|
23
|
+
"article": [16],
|
|
24
|
+
"locale": [1]
|
|
22
25
|
}]);
|
|
23
26
|
function defineCustomElement() {
|
|
24
27
|
if (typeof customElements === "undefined") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"aico-news-list-item2.js","mappings":";;AAAA,MAAM,mBAAmB,GAAG,EAAE;;MCQjB,gBAAgB
|
|
1
|
+
{"file":"aico-news-list-item2.js","mappings":";;AAAA,MAAM,mBAAmB,GAAG,EAAE;;MCQjB,gBAAgB;;;;;;sBAUF,IAAI;;IAE7B,MAAM;;QACJ,MAAM,WAAW,GAAG,IAAI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list-item/aico-news-list-item.css?tag=aico-news-list-item&encapsulation=scoped","src/components/aico-news-list-item/aico-news-list-item.tsx"],"sourcesContent":["","import { Component, Prop, Event, EventEmitter, h } from '@stencil/core';\nimport { Article } from '../../model/Article';\n\n@Component({\n tag: 'aico-news-list-item',\n styleUrl: 'aico-news-list-item.css',\n scoped: true,\n})\nexport class AicoNewsListItem {\n @Prop() article!: Article;\n\n @Event() articleClick?: EventEmitter<Article>;\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 render() {\n const translation = this.article.attributes.translations.find(t => t.locale === this.locale);\n return (\n <div\n class=\"card h-100 pe-auto\"\n style={{ cursor: 'pointer' }}\n onClick={() => {\n this.articleClick?.emit(this.article);\n }}\n >\n <div class=\"ratio ratio-16x9 overflow-hidden\">\n <img\n class=\"object-fit-cover\"\n style={{ 'min-height': '15rem' }}\n alt=\"Article image\"\n src={\n translation?.optimizedListImage ??\n translation?.optimizedImage ??\n translation?.image ??\n this.article.attributes.optimizedListImage ??\n this.article.attributes.optimizedImage ??\n this.article.attributes.image\n }\n />\n <div class=\"card-img-overlay d-flex justify-content-end\">{/*TODO: set the date top-right?*/}</div>\n </div>\n <div class=\"card-body\">\n <h5 class=\"card-title\">{translation?.name ?? this.article.attributes.name}</h5>\n <p class=\"card-text\">{translation?.excerpt ?? this.article.attributes.excerpt}</p>\n </div>\n </div>\n );\n }\n}\n"],"version":3}
|
|
@@ -20,6 +20,7 @@ const AicoNewsList$1 = /*@__PURE__*/ proxyCustomElement(class AicoNewsList exten
|
|
|
20
20
|
this.pageSize = 16;
|
|
21
21
|
this.nextButtonText = 'Next';
|
|
22
22
|
this.previousButtonText = 'Previous';
|
|
23
|
+
this.locale = 'de';
|
|
23
24
|
}
|
|
24
25
|
connectedCallback() {
|
|
25
26
|
this.newsListFetchController = new AbortController();
|
|
@@ -41,7 +42,7 @@ const AicoNewsList$1 = /*@__PURE__*/ proxyCustomElement(class AicoNewsList exten
|
|
|
41
42
|
return (h(Host, null, h("div", { class: "row row-cols-1 row-cols-sm-2 row-cols-lg-4 g-4 mb-4" }, (_a = this.newsResponse) === null || _a === void 0 ? void 0 : _a.data.map(article => (h("div", { class: "col" }, h("aico-news-list-item", { article: article, onArticleClick: e => {
|
|
42
43
|
var _a;
|
|
43
44
|
(_a = this.articleClick) === null || _a === void 0 ? void 0 : _a.emit(e.detail);
|
|
44
|
-
} }))))), h("nav", { class: "w-100", "aria-label": "News navigation" }, h("ul", { class: "pagination justify-content-center" }, h("li", { class: `page-item page-link user-select-none d-flex align-items-center ${!((_b = this.newsResponse) === null || _b === void 0 ? void 0 : _b.links.prev) ? 'disabled' : ''}`, style: { cursor: 'pointer' }, onClick: () => {
|
|
45
|
+
}, locale: this.locale }))))), h("nav", { class: "w-100", "aria-label": "News navigation" }, h("ul", { class: "pagination justify-content-center" }, h("li", { class: `page-item page-link user-select-none d-flex align-items-center ${!((_b = this.newsResponse) === null || _b === void 0 ? void 0 : _b.links.prev) ? 'disabled' : ''}`, style: { cursor: 'pointer' }, onClick: () => {
|
|
45
46
|
if (this.pageNumber > 1) {
|
|
46
47
|
this.pageNumber -= 1;
|
|
47
48
|
}
|
|
@@ -97,6 +98,7 @@ const AicoNewsList$1 = /*@__PURE__*/ proxyCustomElement(class AicoNewsList exten
|
|
|
97
98
|
"pageSize": [2, "page-size"],
|
|
98
99
|
"nextButtonText": [1, "next-button-text"],
|
|
99
100
|
"previousButtonText": [1, "previous-button-text"],
|
|
101
|
+
"locale": [1],
|
|
100
102
|
"newsResponse": [32],
|
|
101
103
|
"pageNumber": [32]
|
|
102
104
|
}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"aico-news-list.js","mappings":";;;;AAAA,MAAM,eAAe,GAAG,EAAE;;MCWbA,cAAY;;;;;;0BAGD,CAAC;;;4BAeU,EAAE;6BAKD,EAAE;4BAKH,EAAE;mCAKK,EAAE;wBAKf,EAAE;8BAKI,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AAI,CAAC,UAAU,EAAE,CAAC,CAAC;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,KAAK,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,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":["AicoNewsList"],"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 @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"],"version":3}
|
|
1
|
+
{"file":"aico-news-list.js","mappings":";;;;AAAA,MAAM,eAAe,GAAG,EAAE;;MCWbA,cAAY;;;;;;0BAGD,CAAC;;;4BAeU,EAAE;6BAKD,EAAE;4BAKH,EAAE;mCAKK,EAAE;wBAKf,EAAE;8BAKI,MAAM;kCAKF,UAAU;sBAOtB,IAAI;;IAY7B,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;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AAK,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,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":["AicoNewsList"],"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 @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 * 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 * 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 locale={this.locale}\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}
|
|
@@ -17,6 +17,7 @@ const AicoSpecialNewsCarousel$1 = /*@__PURE__*/ proxyCustomElement(class AicoSpe
|
|
|
17
17
|
this.newsBrandIds = [];
|
|
18
18
|
this.newsLanguageLocales = [];
|
|
19
19
|
this.numberOfArticles = 6;
|
|
20
|
+
this.locale = 'de';
|
|
20
21
|
}
|
|
21
22
|
connectedCallback() {
|
|
22
23
|
this.newsListFetchController = new AbortController();
|
|
@@ -43,14 +44,15 @@ const AicoSpecialNewsCarousel$1 = /*@__PURE__*/ proxyCustomElement(class AicoSpe
|
|
|
43
44
|
}
|
|
44
45
|
render() {
|
|
45
46
|
return (h("div", { class: "carousel" }, this.newsResponse.data.map(article => {
|
|
46
|
-
var _a;
|
|
47
|
+
var _a, _b, _c, _d;
|
|
47
48
|
const focusX = article.attributes.focusXPercentage ? `${article.attributes.focusXPercentage}%` : 'center';
|
|
48
49
|
const focusY = article.attributes.focusYPercentage ? `${article.attributes.focusYPercentage}%` : 'center';
|
|
50
|
+
const translation = article.attributes.translations.find(t => t.locale === this.locale);
|
|
49
51
|
return (h("div", { class: "carousel-item card border-0" }, h("div", { class: "card-body" }, h("h5", { class: "card-title text-center text-uppercase" }, h("a", { class: "text-reset text-decoration-none", href: "#", onClick: e => {
|
|
50
52
|
var _a;
|
|
51
53
|
e.preventDefault();
|
|
52
54
|
(_a = this.articleClicked) === null || _a === void 0 ? void 0 : _a.emit(article);
|
|
53
|
-
} }, article.attributes.name))), h("div", { class: "ratio ratio-16x9 mx-auto", style: { 'max-width': '50%' } }, h("img", { class: "card-img-bottom object-fit-cover", style: { 'object-position': `${focusX} ${focusY}`, 'min-height': '15rem' }, alt: "News Picture", "data-lazy": (
|
|
55
|
+
} }, (_a = translation === null || translation === void 0 ? void 0 : translation.name) !== null && _a !== void 0 ? _a : article.attributes.name))), h("div", { class: "ratio ratio-16x9 mx-auto", style: { 'max-width': '50%' } }, h("img", { class: "card-img-bottom object-fit-cover", style: { 'object-position': `${focusX} ${focusY}`, 'min-height': '15rem' }, alt: "News Picture", "data-lazy": (_d = (_c = (_b = translation === null || translation === void 0 ? void 0 : translation.optimizedImage) !== null && _b !== void 0 ? _b : translation === null || translation === void 0 ? void 0 : translation.image) !== null && _c !== void 0 ? _c : article.attributes.optimizedImage) !== null && _d !== void 0 ? _d : article.attributes.image }))));
|
|
54
56
|
})));
|
|
55
57
|
}
|
|
56
58
|
static get style() { return aicoSpecialNewsCarouselCss; }
|
|
@@ -62,6 +64,7 @@ const AicoSpecialNewsCarousel$1 = /*@__PURE__*/ proxyCustomElement(class AicoSpe
|
|
|
62
64
|
"newsBrandIds": [16],
|
|
63
65
|
"newsLanguageLocales": [16],
|
|
64
66
|
"numberOfArticles": [2, "number-of-articles"],
|
|
67
|
+
"locale": [1],
|
|
65
68
|
"newsResponse": [32]
|
|
66
69
|
}]);
|
|
67
70
|
function defineCustomElement$1() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"aico-special-news-carousel.js","mappings":";;;;AAAA,MAAM,0BAA0B,GAAG,sGAAsG;;MCc5HA,yBAAuB;;;;;;;;4BAgBD,EAAE;6BAKD,EAAE;4BAKH,EAAE;mCAKK,EAAE;gCAKP,CA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AAX,WAAW,CAAE,cAAc,mCAAI,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,KAAK,mCAAI,OAAO,CAAC,UAAU,CAAC,cAAc,mCAAI,OAAO,CAAC,UAAU,CAAC,KAAK,GAC7H,CACE,CACF,EACN;SACH,CAAC,CACE,EACN;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["AicoSpecialNewsCarousel","$"],"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 /**\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 * 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 * 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 const translation = article.attributes.translations.find(t => t.locale === this.locale);\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 {translation?.name ?? 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={translation?.optimizedImage ?? translation?.image ?? article.attributes.optimizedImage ?? article.attributes.image}\n />\n </div>\n </div>\n );\n })}\n </div>\n );\n }\n}\n"],"version":3}
|
package/dist/components/utils.js
CHANGED
|
@@ -60,7 +60,7 @@ async function fetchNewsArticleByHandle(api, urlHandle, signal) {
|
|
|
60
60
|
const request = getAuthenticatedRequest(api, 'news', queryParams, signal);
|
|
61
61
|
const response = await fetch(request);
|
|
62
62
|
const articles = await response.json();
|
|
63
|
-
return articles.data[0];
|
|
63
|
+
return articles.data.length === 1 ? articles.data[0] : undefined;
|
|
64
64
|
}
|
|
65
65
|
function getImageWidthPrc(pictureSize) {
|
|
66
66
|
switch (pictureSize) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"utils.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,CAAC,IAAI,GAAG,CAAC,GAAG,KAAK,IAAI,KAAK,CAAC,QAAQ,EAAE,EAAE,EAAE,GAAG,CAAC,OAAO,CAAC,EAAE;QACvE,OAAO,EAAE,uBAAuB,CAAC,GAAG,CAAC,WAAW,CAAC;QACjD,MAAM;KACP,CAAC,CAAC;AACL,CAAC;;ACbD,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;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B;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 | undefined> {\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.length === 1 ? articles.data[0] : undefined;\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}
|
|
@@ -13759,7 +13759,7 @@ var ContentType;
|
|
|
13759
13759
|
})(ContentType || (ContentType = {}));
|
|
13760
13760
|
|
|
13761
13761
|
const ConditionalRender = ({ condition }, children) => {
|
|
13762
|
-
return condition
|
|
13762
|
+
return condition ? children : [];
|
|
13763
13763
|
};
|
|
13764
13764
|
|
|
13765
13765
|
const getAuthenticatedHeaders = (bearerToken) => {
|
|
@@ -13824,7 +13824,7 @@ async function fetchNewsArticleByHandle(api, urlHandle, signal) {
|
|
|
13824
13824
|
const request = getAuthenticatedRequest(api, 'news', queryParams, signal);
|
|
13825
13825
|
const response = await fetch(request);
|
|
13826
13826
|
const articles = await response.json();
|
|
13827
|
-
return articles.data[0];
|
|
13827
|
+
return articles.data.length === 1 ? articles.data[0] : undefined;
|
|
13828
13828
|
}
|
|
13829
13829
|
function getImageWidthPrc(pictureSize) {
|
|
13830
13830
|
switch (pictureSize) {
|
|
@@ -13876,11 +13876,12 @@ const AicoArticleDetail = class {
|
|
|
13876
13876
|
this.hideCategoryAndTags = false;
|
|
13877
13877
|
}
|
|
13878
13878
|
render() {
|
|
13879
|
-
var _a, _b;
|
|
13880
|
-
const
|
|
13879
|
+
var _a, _b, _c, _d;
|
|
13880
|
+
const translation = (_a = this.article.attributes.translations.find(translation => translation.locale === this.locale)) !== null && _a !== void 0 ? _a : null;
|
|
13881
|
+
const category = (_c = (_b = this.article.attributes.newsCategory) === null || _b === void 0 ? void 0 : _b.translations.find(translation => translation.locale === this.locale)) !== null && _c !== void 0 ? _c : null;
|
|
13881
13882
|
const articleDate = new Date(this.article.attributes.publishDate);
|
|
13882
13883
|
const content = this.article.attributes.contentBuilder.rows.sort((a, b) => a.order - b.order).map((row, index) => this.mapRowContent(row, index));
|
|
13883
|
-
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 === null || category === void 0 ? void 0 : category.webName))), h("div", { class: "content-wrapper" }, content), h(ConditionalRender, { condition: !this.hideCategoryAndTags }, this.article.attributes.newsTags.map(tag => {
|
|
13884
|
+
return (h(Host, null, h("figure", null, h("blockquote", { class: "blockquote" }, h("h2", { class: "text-uppercase" }, (_d = translation === null || translation === void 0 ? void 0 : translation.name) !== null && _d !== void 0 ? _d : 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 === null || category === void 0 ? void 0 : category.webName))), h("div", { class: "content-wrapper" }, content), h(ConditionalRender, { condition: !this.hideCategoryAndTags }, this.article.attributes.newsTags.map(tag => {
|
|
13884
13885
|
var _a;
|
|
13885
13886
|
const translation = (_a = tag.translations.find(translation => translation.locale === this.locale)) !== null && _a !== void 0 ? _a : null;
|
|
13886
13887
|
return (h(ConditionalRender, { condition: !strIsNullOrEmptyOrWhitespace(translation === null || translation === void 0 ? void 0 : translation.webName) }, h("span", { class: "badge bg-light text-dark" }, translation.webName)));
|
|
@@ -20617,6 +20618,7 @@ const AicoNewsList = class {
|
|
|
20617
20618
|
this.pageSize = 16;
|
|
20618
20619
|
this.nextButtonText = 'Next';
|
|
20619
20620
|
this.previousButtonText = 'Previous';
|
|
20621
|
+
this.locale = 'de';
|
|
20620
20622
|
}
|
|
20621
20623
|
connectedCallback() {
|
|
20622
20624
|
this.newsListFetchController = new AbortController();
|
|
@@ -20638,7 +20640,7 @@ const AicoNewsList = class {
|
|
|
20638
20640
|
return (h(Host, null, h("div", { class: "row row-cols-1 row-cols-sm-2 row-cols-lg-4 g-4 mb-4" }, (_a = this.newsResponse) === null || _a === void 0 ? void 0 : _a.data.map(article => (h("div", { class: "col" }, h("aico-news-list-item", { article: article, onArticleClick: e => {
|
|
20639
20641
|
var _a;
|
|
20640
20642
|
(_a = this.articleClick) === null || _a === void 0 ? void 0 : _a.emit(e.detail);
|
|
20641
|
-
} }))))), h("nav", { class: "w-100", "aria-label": "News navigation" }, h("ul", { class: "pagination justify-content-center" }, h("li", { class: `page-item page-link user-select-none d-flex align-items-center ${!((_b = this.newsResponse) === null || _b === void 0 ? void 0 : _b.links.prev) ? 'disabled' : ''}`, style: { cursor: 'pointer' }, onClick: () => {
|
|
20643
|
+
}, locale: this.locale }))))), h("nav", { class: "w-100", "aria-label": "News navigation" }, h("ul", { class: "pagination justify-content-center" }, h("li", { class: `page-item page-link user-select-none d-flex align-items-center ${!((_b = this.newsResponse) === null || _b === void 0 ? void 0 : _b.links.prev) ? 'disabled' : ''}`, style: { cursor: 'pointer' }, onClick: () => {
|
|
20642
20644
|
if (this.pageNumber > 1) {
|
|
20643
20645
|
this.pageNumber -= 1;
|
|
20644
20646
|
}
|
|
@@ -20693,13 +20695,15 @@ const AicoNewsListItem = class {
|
|
|
20693
20695
|
registerInstance(this, hostRef);
|
|
20694
20696
|
this.articleClick = createEvent(this, "articleClick", 7);
|
|
20695
20697
|
this.article = undefined;
|
|
20698
|
+
this.locale = 'de';
|
|
20696
20699
|
}
|
|
20697
20700
|
render() {
|
|
20698
|
-
var _a, _b;
|
|
20701
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
20702
|
+
const translation = this.article.attributes.translations.find(t => t.locale === this.locale);
|
|
20699
20703
|
return (h("div", { class: "card h-100 pe-auto", style: { cursor: 'pointer' }, onClick: () => {
|
|
20700
20704
|
var _a;
|
|
20701
20705
|
(_a = this.articleClick) === null || _a === void 0 ? void 0 : _a.emit(this.article);
|
|
20702
|
-
} }, h("div", { class: "ratio ratio-16x9 overflow-hidden" }, h("img", { class: "object-fit-cover", style: { 'min-height': '15rem' }, alt: "Article image", src: (_b = (_a = this.article.attributes.optimizedListImage) !== null &&
|
|
20706
|
+
} }, h("div", { class: "ratio ratio-16x9 overflow-hidden" }, h("img", { class: "object-fit-cover", style: { 'min-height': '15rem' }, alt: "Article image", src: (_e = (_d = (_c = (_b = (_a = translation === null || translation === void 0 ? void 0 : translation.optimizedListImage) !== null && _a !== void 0 ? _a : translation === null || translation === void 0 ? void 0 : translation.optimizedImage) !== null && _b !== void 0 ? _b : translation === null || translation === void 0 ? void 0 : translation.image) !== null && _c !== void 0 ? _c : this.article.attributes.optimizedListImage) !== null && _d !== void 0 ? _d : this.article.attributes.optimizedImage) !== null && _e !== void 0 ? _e : this.article.attributes.image }), h("div", { class: "card-img-overlay d-flex justify-content-end" })), h("div", { class: "card-body" }, h("h5", { class: "card-title" }, (_f = translation === null || translation === void 0 ? void 0 : translation.name) !== null && _f !== void 0 ? _f : this.article.attributes.name), h("p", { class: "card-text" }, (_g = translation === null || translation === void 0 ? void 0 : translation.excerpt) !== null && _g !== void 0 ? _g : this.article.attributes.excerpt))));
|
|
20703
20707
|
}
|
|
20704
20708
|
};
|
|
20705
20709
|
AicoNewsListItem.style = aicoNewsListItemCss;
|
|
@@ -20751,6 +20755,7 @@ const AicoSpecialNewsCarousel = class {
|
|
|
20751
20755
|
this.newsBrandIds = [];
|
|
20752
20756
|
this.newsLanguageLocales = [];
|
|
20753
20757
|
this.numberOfArticles = 6;
|
|
20758
|
+
this.locale = 'de';
|
|
20754
20759
|
}
|
|
20755
20760
|
connectedCallback() {
|
|
20756
20761
|
this.newsListFetchController = new AbortController();
|
|
@@ -20777,14 +20782,15 @@ const AicoSpecialNewsCarousel = class {
|
|
|
20777
20782
|
}
|
|
20778
20783
|
render() {
|
|
20779
20784
|
return (h("div", { class: "carousel" }, this.newsResponse.data.map(article => {
|
|
20780
|
-
var _a;
|
|
20785
|
+
var _a, _b, _c, _d;
|
|
20781
20786
|
const focusX = article.attributes.focusXPercentage ? `${article.attributes.focusXPercentage}%` : 'center';
|
|
20782
20787
|
const focusY = article.attributes.focusYPercentage ? `${article.attributes.focusYPercentage}%` : 'center';
|
|
20788
|
+
const translation = article.attributes.translations.find(t => t.locale === this.locale);
|
|
20783
20789
|
return (h("div", { class: "carousel-item card border-0" }, h("div", { class: "card-body" }, h("h5", { class: "card-title text-center text-uppercase" }, h("a", { class: "text-reset text-decoration-none", href: "#", onClick: e => {
|
|
20784
20790
|
var _a;
|
|
20785
20791
|
e.preventDefault();
|
|
20786
20792
|
(_a = this.articleClicked) === null || _a === void 0 ? void 0 : _a.emit(article);
|
|
20787
|
-
} }, article.attributes.name))), h("div", { class: "ratio ratio-16x9 mx-auto", style: { 'max-width': '50%' } }, h("img", { class: "card-img-bottom object-fit-cover", style: { 'object-position': `${focusX} ${focusY}`, 'min-height': '15rem' }, alt: "News Picture", "data-lazy": (
|
|
20793
|
+
} }, (_a = translation === null || translation === void 0 ? void 0 : translation.name) !== null && _a !== void 0 ? _a : article.attributes.name))), h("div", { class: "ratio ratio-16x9 mx-auto", style: { 'max-width': '50%' } }, h("img", { class: "card-img-bottom object-fit-cover", style: { 'object-position': `${focusX} ${focusY}`, 'min-height': '15rem' }, alt: "News Picture", "data-lazy": (_d = (_c = (_b = translation === null || translation === void 0 ? void 0 : translation.optimizedImage) !== null && _b !== void 0 ? _b : translation === null || translation === void 0 ? void 0 : translation.image) !== null && _c !== void 0 ? _c : article.attributes.optimizedImage) !== null && _d !== void 0 ? _d : article.attributes.image }))));
|
|
20788
20794
|
})));
|
|
20789
20795
|
}
|
|
20790
20796
|
};
|