@aiconomy/aico-components 0.0.78 → 0.0.95
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 +50 -36
- package/dist/aico-components/aico-components.esm.js +1 -1
- package/dist/aico-components/p-59bfd021.js +2 -0
- package/dist/aico-components/p-59bfd021.js.map +1 -0
- package/dist/aico-components/{p-368503ee.entry.js → p-7ea04e72.entry.js} +2 -2
- package/dist/aico-components/{p-7e0074f7.entry.js → p-80cb133a.entry.js} +2 -2
- package/dist/aico-components/{p-c9eea1b1.entry.js → p-918b9928.entry.js} +2 -2
- package/dist/aico-components/{p-bccf08d0.entry.js → p-c900f292.entry.js} +2 -2
- package/dist/aico-components/{p-bccf08d0.entry.js.map → p-c900f292.entry.js.map} +1 -1
- package/dist/cjs/aico-album-content_19.cjs.entry.js +1 -1
- package/dist/cjs/aico-fetch-article-detail.cjs.entry.js +1 -1
- package/dist/cjs/aico-fetch-article-detail.cjs.entry.js.map +1 -1
- package/dist/cjs/aico-news-list.cjs.entry.js +1 -1
- package/dist/cjs/aico-special-news-carousel.cjs.entry.js +1 -1
- package/dist/cjs/{utils-c1b7a052.js → utils-9ae3486f.js} +3 -3
- package/dist/cjs/{utils-c1b7a052.js.map → utils-9ae3486f.js.map} +1 -1
- package/dist/collection/components/aico-fetch-article-detail/aico-fetch-article-detail.js +2 -2
- package/dist/collection/components/aico-fetch-article-detail/aico-fetch-article-detail.js.map +1 -1
- package/dist/collection/components/aico-fetch-article-detail/aico-fetch-article-detail.stories.js +2 -0
- package/dist/collection/components/aico-fetch-article-detail/aico-fetch-article-detail.stories.js.map +1 -1
- package/dist/collection/utils/utils.js +2 -2
- package/dist/collection/utils/utils.js.map +1 -1
- package/dist/components/aico-fetch-article-detail.js.map +1 -1
- package/dist/components/utils.js +2 -2
- package/dist/components/utils.js.map +1 -1
- package/dist/esm/aico-album-content_19.entry.js +1 -1
- package/dist/esm/aico-fetch-article-detail.entry.js +1 -1
- package/dist/esm/aico-fetch-article-detail.entry.js.map +1 -1
- package/dist/esm/aico-news-list.entry.js +1 -1
- package/dist/esm/aico-special-news-carousel.entry.js +1 -1
- package/dist/esm/{utils-b4eec8e9.js → utils-25eef7c7.js} +3 -3
- package/dist/esm/{utils-b4eec8e9.js.map → utils-25eef7c7.js.map} +1 -1
- package/dist/types/components/aico-fetch-article-detail/aico-fetch-article-detail.d.ts +2 -4
- package/dist/types/components.d.ts +4 -4
- package/docs/components/aico-article-detail/readme.md +83 -0
- package/docs/components/aico-fetch-article-detail/readme.md +63 -0
- package/docs/components/aico-news-list/readme.md +41 -0
- package/docs/components/aico-news-list-item/readme.md +37 -0
- package/docs/components/aico-special-news-carousel/readme.md +27 -0
- package/docs/components/content/aico-album-content/readme.md +30 -0
- package/docs/components/content/aico-asking-content/readme.md +31 -0
- package/docs/components/content/aico-asking-list-content/readme.md +10 -0
- package/docs/components/content/aico-block-quote-content/readme.md +31 -0
- package/docs/components/content/aico-bullet-content/readme.md +37 -0
- package/docs/components/content/aico-carousel-content/readme.md +38 -0
- package/docs/components/content/aico-collection-content/readme.md +10 -0
- package/docs/components/content/aico-content-card-content/readme.md +37 -0
- package/docs/components/content/aico-divider-content/readme.md +31 -0
- package/docs/components/content/aico-document-content/readme.md +31 -0
- package/docs/components/content/aico-faq-content/readme.md +31 -0
- package/docs/components/content/aico-heading-content/readme.md +37 -0
- package/docs/components/content/aico-html-content/readme.md +31 -0
- package/docs/components/content/aico-link-content/readme.md +31 -0
- package/docs/components/content/aico-news-content/readme.md +37 -0
- package/docs/components/content/aico-no-content/readme.md +23 -0
- package/docs/components/content/aico-page-content/readme.md +38 -0
- package/docs/components/content/aico-table-content/readme.md +37 -0
- package/docs/components/content/aico-testimonial-content/readme.md +30 -0
- package/docs/components/content/aico-text-content/readme.md +37 -0
- package/docs/components/content/aico-title-content/readme.md +52 -0
- package/docs/components/content/aico-upload-content/readme.md +37 -0
- package/docs/components/content/aico-video-content/readme.md +37 -0
- package/package.json +3 -2
- package/dist/aico-components/p-2677f2ab.js +0 -2
- package/dist/aico-components/p-2677f2ab.js.map +0 -1
- /package/dist/aico-components/{p-368503ee.entry.js.map → p-7ea04e72.entry.js.map} +0 -0
- /package/dist/aico-components/{p-7e0074f7.entry.js.map → p-80cb133a.entry.js.map} +0 -0
- /package/dist/aico-components/{p-c9eea1b1.entry.js.map → p-918b9928.entry.js.map} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{r as t,h as i}from"./p-ae20e789.js";import{f as e,a as s}from"./p-
|
|
2
|
-
//# sourceMappingURL=p-
|
|
1
|
+
import{r as t,h as i}from"./p-ae20e789.js";import{f as e,a as s}from"./p-59bfd021.js";const h="";const r=class{constructor(i){t(this,i);this.article=undefined;this.aicoUrl=undefined;this.aicoBearerToken=undefined;this.locale="de";this.articleId=undefined;this.articleUrlHandle=undefined}connectedCallback(){this.articleFetchController=new AbortController;this.api={baseApi:this.aicoUrl,bearerToken:this.aicoBearerToken}}disconnectedCallback(){this.articleFetchController.abort("disconnected")}async componentWillLoad(){if(!this.articleId&&!this.articleUrlHandle){throw new Error("Either the article id or the url handle must be provided.")}if(this.articleUrlHandle){this.article=await e(this.api,this.articleUrlHandle,this.articleFetchController.signal);return}this.article=await s(this.api,this.articleId,this.articleFetchController.signal)}render(){return i("aico-article-detail",{article:this.article,locale:this.locale})}};r.style=h;export{r as aico_fetch_article_detail};
|
|
2
|
+
//# sourceMappingURL=p-c900f292.entry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["aicoFetchArticleDetailCss","AicoFetchArticleDetail","connectedCallback","this","articleFetchController","AbortController","api","baseApi","aicoUrl","bearerToken","aicoBearerToken","disconnectedCallback","abort","componentWillLoad","articleId","articleUrlHandle","Error","article","fetchNewsArticleByHandle","signal","fetchNewsArticle","render","h","locale"],"sources":["src/components/aico-fetch-article-detail/aico-fetch-article-detail.css?tag=aico-fetch-article-detail&encapsulation=scoped","src/components/aico-fetch-article-detail/aico-fetch-article-detail.tsx"],"sourcesContent":[null,"import { Component, Prop, State, h } from '@stencil/core';\nimport { fetchNewsArticle, fetchNewsArticleByHandle } from '../../utils/utils';\nimport { Article } from '../../model/Article';\nimport { AicoApiRequestInfo } from '../../model/AicoApiRequestInfo';\n\n@Component({\n tag: 'aico-fetch-article-detail',\n styleUrl: 'aico-fetch-article-detail.css',\n scoped: true,\n})\nexport class AicoFetchArticleDetail {\n @State() article!: Article;\n\n @Prop() aicoUrl!: string;\n\n @Prop() aicoBearerToken!: string;\n\n @Prop() locale: string = 'de';\n\n /**\n * The id will be used to fetch the article.\n *\n * If both the
|
|
1
|
+
{"version":3,"names":["aicoFetchArticleDetailCss","AicoFetchArticleDetail","connectedCallback","this","articleFetchController","AbortController","api","baseApi","aicoUrl","bearerToken","aicoBearerToken","disconnectedCallback","abort","componentWillLoad","articleId","articleUrlHandle","Error","article","fetchNewsArticleByHandle","signal","fetchNewsArticle","render","h","locale"],"sources":["src/components/aico-fetch-article-detail/aico-fetch-article-detail.css?tag=aico-fetch-article-detail&encapsulation=scoped","src/components/aico-fetch-article-detail/aico-fetch-article-detail.tsx"],"sourcesContent":[null,"import { Component, Prop, State, h } from '@stencil/core';\nimport { fetchNewsArticle, fetchNewsArticleByHandle } from '../../utils/utils';\nimport { Article } from '../../model/Article';\nimport { AicoApiRequestInfo } from '../../model/AicoApiRequestInfo';\n\n@Component({\n tag: 'aico-fetch-article-detail',\n styleUrl: 'aico-fetch-article-detail.css',\n scoped: true,\n})\nexport class AicoFetchArticleDetail {\n @State() article!: Article;\n\n @Prop() aicoUrl!: string;\n\n @Prop() aicoBearerToken!: string;\n\n @Prop() locale: string = 'de';\n\n /**\n * The id will be used to fetch the article.\n *\n * If both the 'articleId' and 'articleUrlHandle' are provided, the latter will be used. If neither are provided, an error is thrown.\n */\n @Prop() articleId?: string;\n\n /**\n * The url handle will be used to fetch the article.\n *\n * If both the 'articleId' and 'articleUrlHandle' are provided, the latter will be used. If neither are provided, an error is thrown.\n */\n @Prop() articleUrlHandle?: string;\n\n private api?: AicoApiRequestInfo;\n private articleFetchController?: AbortController;\n\n connectedCallback() {\n this.articleFetchController = new AbortController();\n this.api = { baseApi: this.aicoUrl, bearerToken: this.aicoBearerToken };\n }\n\n disconnectedCallback() {\n this.articleFetchController!.abort('disconnected');\n }\n\n async componentWillLoad(): Promise<void> {\n if (!this.articleId && !this.articleUrlHandle) {\n throw new Error('Either the article id or the url handle must be provided.');\n }\n\n if (this.articleUrlHandle) {\n this.article = await fetchNewsArticleByHandle(this.api!, this.articleUrlHandle, this.articleFetchController!.signal);\n return;\n }\n\n this.article = await fetchNewsArticle(this.api!, this.articleId!, this.articleFetchController!.signal);\n }\n\n render() {\n return <aico-article-detail article={this.article} locale={this.locale} />;\n }\n}\n"],"mappings":"sFAAA,MAAMA,EAA4B,G,MCUrBC,EAAsB,M,kHAOR,K,yDAmBzB,iBAAAC,GACEC,KAAKC,uBAAyB,IAAIC,gBAClCF,KAAKG,IAAM,CAAEC,QAASJ,KAAKK,QAASC,YAAaN,KAAKO,gB,CAGxD,oBAAAC,GACER,KAAKC,uBAAwBQ,MAAM,e,CAGrC,uBAAMC,GACJ,IAAKV,KAAKW,YAAcX,KAAKY,iBAAkB,CAC7C,MAAM,IAAIC,MAAM,4D,CAGlB,GAAIb,KAAKY,iBAAkB,CACzBZ,KAAKc,cAAgBC,EAAyBf,KAAKG,IAAMH,KAAKY,iBAAkBZ,KAAKC,uBAAwBe,QAC7G,M,CAGFhB,KAAKc,cAAgBG,EAAiBjB,KAAKG,IAAMH,KAAKW,UAAYX,KAAKC,uBAAwBe,O,CAGjG,MAAAE,GACE,OAAOC,EAAA,uBAAqBL,QAASd,KAAKc,QAASM,OAAQpB,KAAKoB,Q"}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
const index = require('./index-e52034b7.js');
|
|
6
6
|
const slick = require('./slick-d0dfbd94.js');
|
|
7
|
-
const utils = require('./utils-
|
|
7
|
+
const utils = require('./utils-9ae3486f.js');
|
|
8
8
|
|
|
9
9
|
const aicoAlbumContentCss = "";
|
|
10
10
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"aico-fetch-article-detail.entry.cjs.js","mappings":";;;;;;;AAAA,MAAM,yBAAyB,GAAG,EAAE;;MCUvB,sBAAsB;;;;;;sBAOR,IAAI;;;;
|
|
1
|
+
{"file":"aico-fetch-article-detail.entry.cjs.js","mappings":";;;;;;;AAAA,MAAM,yBAAyB,GAAG,EAAE;;MCUvB,sBAAsB;;;;;;sBAOR,IAAI;;;;IAmB7B,iBAAiB;QACf,IAAI,CAAC,sBAAsB,GAAG,IAAI,eAAe,EAAE,CAAC;QACpD,IAAI,CAAC,GAAG,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC;KACzE;IAED,oBAAoB;QAClB,IAAI,CAAC,sBAAuB,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;KACpD;IAED,MAAM,iBAAiB;QACrB,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE;YAC7C,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC;SAC9E;QAED,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACzB,IAAI,CAAC,OAAO,GAAG,MAAMA,8BAAwB,CAAC,IAAI,CAAC,GAAI,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,sBAAuB,CAAC,MAAM,CAAC,CAAC;YACrH,OAAO;SACR;QAED,IAAI,CAAC,OAAO,GAAG,MAAMC,sBAAgB,CAAC,IAAI,CAAC,GAAI,EAAE,IAAI,CAAC,SAAU,EAAE,IAAI,CAAC,sBAAuB,CAAC,MAAM,CAAC,CAAC;KACxG;IAED,MAAM;QACJ,OAAOC,iCAAqB,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,GAAI,CAAC;KAC5E;;;;;;","names":["fetchNewsArticleByHandle","fetchNewsArticle","h"],"sources":["src/components/aico-fetch-article-detail/aico-fetch-article-detail.css?tag=aico-fetch-article-detail&encapsulation=scoped","src/components/aico-fetch-article-detail/aico-fetch-article-detail.tsx"],"sourcesContent":["","import { Component, Prop, State, h } from '@stencil/core';\nimport { fetchNewsArticle, fetchNewsArticleByHandle } from '../../utils/utils';\nimport { Article } from '../../model/Article';\nimport { AicoApiRequestInfo } from '../../model/AicoApiRequestInfo';\n\n@Component({\n tag: 'aico-fetch-article-detail',\n styleUrl: 'aico-fetch-article-detail.css',\n scoped: true,\n})\nexport class AicoFetchArticleDetail {\n @State() article!: Article;\n\n @Prop() aicoUrl!: string;\n\n @Prop() aicoBearerToken!: string;\n\n @Prop() locale: string = 'de';\n\n /**\n * The id will be used to fetch the article.\n *\n * If both the 'articleId' and 'articleUrlHandle' are provided, the latter will be used. If neither are provided, an error is thrown.\n */\n @Prop() articleId?: string;\n\n /**\n * The url handle will be used to fetch the article.\n *\n * If both the 'articleId' and 'articleUrlHandle' are provided, the latter will be used. If neither are provided, an error is thrown.\n */\n @Prop() articleUrlHandle?: string;\n\n private api?: AicoApiRequestInfo;\n private articleFetchController?: AbortController;\n\n connectedCallback() {\n this.articleFetchController = new AbortController();\n this.api = { baseApi: this.aicoUrl, bearerToken: this.aicoBearerToken };\n }\n\n disconnectedCallback() {\n this.articleFetchController!.abort('disconnected');\n }\n\n async componentWillLoad(): Promise<void> {\n if (!this.articleId && !this.articleUrlHandle) {\n throw new Error('Either the article id or the url handle must be provided.');\n }\n\n if (this.articleUrlHandle) {\n this.article = await fetchNewsArticleByHandle(this.api!, this.articleUrlHandle, this.articleFetchController!.signal);\n return;\n }\n\n this.article = await fetchNewsArticle(this.api!, this.articleId!, this.articleFetchController!.signal);\n }\n\n render() {\n return <aico-article-detail article={this.article} locale={this.locale} />;\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-9ae3486f.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}";
|
|
@@ -21,7 +21,7 @@ async function fetchNewsArticles(api, page, size, signal, newsChannels = []) {
|
|
|
21
21
|
queryParams.set('filter[isActive]', '1');
|
|
22
22
|
queryParams.set('filter[excludeTag][]', 'Eisnull');
|
|
23
23
|
for (const newsChannel of newsChannels) {
|
|
24
|
-
queryParams.
|
|
24
|
+
queryParams.append('filter[channel][]', newsChannel);
|
|
25
25
|
}
|
|
26
26
|
const request = getAuthenticatedRequest(api, 'news', queryParams, signal);
|
|
27
27
|
const response = await fetch(request);
|
|
@@ -37,7 +37,7 @@ async function fetchSpecialNewsArticles(api, page, size, signal, newsChannels =
|
|
|
37
37
|
queryParams.set('filter[isLightVersion]', 'true');
|
|
38
38
|
queryParams.set('filter[excludeTag][]', 'Eisnull');
|
|
39
39
|
for (const newsChannel of newsChannels) {
|
|
40
|
-
queryParams.
|
|
40
|
+
queryParams.append('filter[channel][]', newsChannel);
|
|
41
41
|
}
|
|
42
42
|
const request = getAuthenticatedRequest(api, 'news', queryParams, signal);
|
|
43
43
|
const response = await fetch(request);
|
|
@@ -104,4 +104,4 @@ exports.getImageWidthPrc = getImageWidthPrc;
|
|
|
104
104
|
exports.getYoutubeURL = getYoutubeURL;
|
|
105
105
|
exports.strIsNullOrEmptyOrWhitespace = strIsNullOrEmptyOrWhitespace;
|
|
106
106
|
|
|
107
|
-
//# sourceMappingURL=utils-
|
|
107
|
+
//# sourceMappingURL=utils-9ae3486f.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"utils-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;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\nexport async function fetchNewsArticles(api: AicoApiRequestInfo, page: number, size: number, signal: AbortSignal, newsChannels: string[] = []): 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 for (const newsChannel of newsChannels) {\n queryParams.append('filter[channel][]', newsChannel);\n }\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(api: AicoApiRequestInfo, page: number, size: number, signal: AbortSignal, newsChannels: string[] = []): 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 for (const newsChannel of newsChannels) {\n queryParams.append('filter[channel][]', newsChannel);\n }\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}
|
|
@@ -107,7 +107,7 @@ export class AicoFetchArticleDetail {
|
|
|
107
107
|
"optional": true,
|
|
108
108
|
"docs": {
|
|
109
109
|
"tags": [],
|
|
110
|
-
"text": "The id will be used to fetch the article.\n\nIf both the
|
|
110
|
+
"text": "The id will be used to fetch the article.\n\nIf both the 'articleId' and 'articleUrlHandle' are provided, the latter will be used. If neither are provided, an error is thrown."
|
|
111
111
|
},
|
|
112
112
|
"attribute": "article-id",
|
|
113
113
|
"reflect": false
|
|
@@ -124,7 +124,7 @@ export class AicoFetchArticleDetail {
|
|
|
124
124
|
"optional": true,
|
|
125
125
|
"docs": {
|
|
126
126
|
"tags": [],
|
|
127
|
-
"text": "The url handle will be used to fetch the article.\n\nIf both the
|
|
127
|
+
"text": "The url handle will be used to fetch the article.\n\nIf both the 'articleId' and 'articleUrlHandle' are provided, the latter will be used. If neither are provided, an error is thrown."
|
|
128
128
|
},
|
|
129
129
|
"attribute": "article-url-handle",
|
|
130
130
|
"reflect": false
|
package/dist/collection/components/aico-fetch-article-detail/aico-fetch-article-detail.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aico-fetch-article-detail.js","sourceRoot":"","sources":["../../../src/components/aico-fetch-article-detail/aico-fetch-article-detail.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAS/E,MAAM,OAAO,sBAAsB;;;;;sBAOR,IAAI;;;;
|
|
1
|
+
{"version":3,"file":"aico-fetch-article-detail.js","sourceRoot":"","sources":["../../../src/components/aico-fetch-article-detail/aico-fetch-article-detail.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAS/E,MAAM,OAAO,sBAAsB;;;;;sBAOR,IAAI;;;;IAmB7B,iBAAiB;QACf,IAAI,CAAC,sBAAsB,GAAG,IAAI,eAAe,EAAE,CAAC;QACpD,IAAI,CAAC,GAAG,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC;IAC1E,CAAC;IAED,oBAAoB;QAClB,IAAI,CAAC,sBAAuB,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IACrD,CAAC;IAED,KAAK,CAAC,iBAAiB;QACrB,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE;YAC7C,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC;SAC9E;QAED,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACzB,IAAI,CAAC,OAAO,GAAG,MAAM,wBAAwB,CAAC,IAAI,CAAC,GAAI,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,sBAAuB,CAAC,MAAM,CAAC,CAAC;YACrH,OAAO;SACR;QAED,IAAI,CAAC,OAAO,GAAG,MAAM,gBAAgB,CAAC,IAAI,CAAC,GAAI,EAAE,IAAI,CAAC,SAAU,EAAE,IAAI,CAAC,sBAAuB,CAAC,MAAM,CAAC,CAAC;IACzG,CAAC;IAED,MAAM;QACJ,OAAO,2BAAqB,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,GAAI,CAAC;IAC7E,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Prop, State, h } from '@stencil/core';\nimport { fetchNewsArticle, fetchNewsArticleByHandle } from '../../utils/utils';\nimport { Article } from '../../model/Article';\nimport { AicoApiRequestInfo } from '../../model/AicoApiRequestInfo';\n\n@Component({\n tag: 'aico-fetch-article-detail',\n styleUrl: 'aico-fetch-article-detail.css',\n scoped: true,\n})\nexport class AicoFetchArticleDetail {\n @State() article!: Article;\n\n @Prop() aicoUrl!: string;\n\n @Prop() aicoBearerToken!: string;\n\n @Prop() locale: string = 'de';\n\n /**\n * The id will be used to fetch the article.\n *\n * If both the 'articleId' and 'articleUrlHandle' are provided, the latter will be used. If neither are provided, an error is thrown.\n */\n @Prop() articleId?: string;\n\n /**\n * The url handle will be used to fetch the article.\n *\n * If both the 'articleId' and 'articleUrlHandle' are provided, the latter will be used. If neither are provided, an error is thrown.\n */\n @Prop() articleUrlHandle?: string;\n\n private api?: AicoApiRequestInfo;\n private articleFetchController?: AbortController;\n\n connectedCallback() {\n this.articleFetchController = new AbortController();\n this.api = { baseApi: this.aicoUrl, bearerToken: this.aicoBearerToken };\n }\n\n disconnectedCallback() {\n this.articleFetchController!.abort('disconnected');\n }\n\n async componentWillLoad(): Promise<void> {\n if (!this.articleId && !this.articleUrlHandle) {\n throw new Error('Either the article id or the url handle must be provided.');\n }\n\n if (this.articleUrlHandle) {\n this.article = await fetchNewsArticleByHandle(this.api!, this.articleUrlHandle, this.articleFetchController!.signal);\n return;\n }\n\n this.article = await fetchNewsArticle(this.api!, this.articleId!, this.articleFetchController!.signal);\n }\n\n render() {\n return <aico-article-detail article={this.article} locale={this.locale} />;\n }\n}\n"]}
|
package/dist/collection/components/aico-fetch-article-detail/aico-fetch-article-detail.stories.js
CHANGED
|
@@ -13,6 +13,7 @@ export const Kj = {
|
|
|
13
13
|
aicoUrl: 'https://kj-acceptance.aico.swiss/api/v1/',
|
|
14
14
|
aicoBearerToken: 'Sq4WkveRPJ64SHR9zqZW8oLjIDjnlBg0gXHSuIMweb966802',
|
|
15
15
|
articleId: '32',
|
|
16
|
+
locale: 'de_CH',
|
|
16
17
|
},
|
|
17
18
|
};
|
|
18
19
|
export const Fcz = {
|
|
@@ -20,6 +21,7 @@ export const Fcz = {
|
|
|
20
21
|
aicoUrl: 'https://app.aico.swiss/19838/api/v1/',
|
|
21
22
|
aicoBearerToken: 'B3NXuTbnCeppJl9NHu27Kjs7Hm3EOKSGCkR6CVwO',
|
|
22
23
|
articleId: '44239',
|
|
24
|
+
locale: 'de_CH',
|
|
23
25
|
},
|
|
24
26
|
};
|
|
25
27
|
//# sourceMappingURL=aico-fetch-article-detail.stories.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aico-fetch-article-detail.stories.js","sourceRoot":"","sources":["../../../src/components/aico-fetch-article-detail/aico-fetch-article-detail.stories.ts"],"names":[],"mappings":"AAGA,MAAM,IAAI,GAAqC;IAC7C,SAAS,EAAE,2BAA2B;IACtC,QAAQ,EAAE;QACR,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,mBAAmB,EAAE;QAC7D,eAAe,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,4BAA4B,EAAE;QAC9E,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC7B,gBAAgB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;KACrC;CACF,CAAC;AAEF,eAAe,IAAI,CAAC;AAIpB,MAAM,CAAC,MAAM,EAAE,GAAU;IACvB,IAAI,EAAE;QACJ,OAAO,EAAE,0CAA0C;QACnD,eAAe,EAAE,kDAAkD;QACnE,SAAS,EAAE,IAAI;KAChB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,GAAG,GAAU;IACxB,IAAI,EAAE;QACJ,OAAO,EAAE,sCAAsC;QAC/C,eAAe,EAAE,0CAA0C;QAC3D,SAAS,EAAE,OAAO;
|
|
1
|
+
{"version":3,"file":"aico-fetch-article-detail.stories.js","sourceRoot":"","sources":["../../../src/components/aico-fetch-article-detail/aico-fetch-article-detail.stories.ts"],"names":[],"mappings":"AAGA,MAAM,IAAI,GAAqC;IAC7C,SAAS,EAAE,2BAA2B;IACtC,QAAQ,EAAE;QACR,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,mBAAmB,EAAE;QAC7D,eAAe,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,4BAA4B,EAAE;QAC9E,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;QAC7B,gBAAgB,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;KACrC;CACF,CAAC;AAEF,eAAe,IAAI,CAAC;AAIpB,MAAM,CAAC,MAAM,EAAE,GAAU;IACvB,IAAI,EAAE;QACJ,OAAO,EAAE,0CAA0C;QACnD,eAAe,EAAE,kDAAkD;QACnE,SAAS,EAAE,IAAI;QACf,MAAM,EAAE,OAAO;KAChB;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,GAAG,GAAU;IACxB,IAAI,EAAE;QACJ,OAAO,EAAE,sCAAsC;QAC/C,eAAe,EAAE,0CAA0C;QAC3D,SAAS,EAAE,OAAO;QAClB,MAAM,EAAE,OAAO;KAChB;CACF,CAAC","sourcesContent":["import type { Meta, StoryObj } from '@storybook/web-components';\nimport { JSX } from '../../components';\n\nconst meta: Meta<JSX.AicoFetchArticleDetail> = {\n component: 'aico-fetch-article-detail',\n argTypes: {\n aicoUrl: { type: 'string', description: 'The Aico api url.' },\n aicoBearerToken: { type: 'string', description: 'The Aico api access token.' },\n articleId: { type: 'string' },\n articleUrlHandle: { type: 'string' },\n },\n};\n\nexport default meta;\n\ntype Story = StoryObj;\n\nexport const Kj: Story = {\n args: {\n aicoUrl: 'https://kj-acceptance.aico.swiss/api/v1/',\n aicoBearerToken: 'Sq4WkveRPJ64SHR9zqZW8oLjIDjnlBg0gXHSuIMweb966802',\n articleId: '32',\n locale: 'de_CH',\n },\n};\n\nexport const Fcz: Story = {\n args: {\n aicoUrl: 'https://app.aico.swiss/19838/api/v1/',\n aicoBearerToken: 'B3NXuTbnCeppJl9NHu27Kjs7Hm3EOKSGCkR6CVwO',\n articleId: '44239',\n locale: 'de_CH',\n },\n};\n"]}
|
|
@@ -7,7 +7,7 @@ export async function fetchNewsArticles(api, page, size, signal, newsChannels =
|
|
|
7
7
|
queryParams.set('filter[isActive]', '1');
|
|
8
8
|
queryParams.set('filter[excludeTag][]', 'Eisnull');
|
|
9
9
|
for (const newsChannel of newsChannels) {
|
|
10
|
-
queryParams.
|
|
10
|
+
queryParams.append('filter[channel][]', newsChannel);
|
|
11
11
|
}
|
|
12
12
|
const request = getAuthenticatedRequest(api, 'news', queryParams, signal);
|
|
13
13
|
const response = await fetch(request);
|
|
@@ -23,7 +23,7 @@ export async function fetchSpecialNewsArticles(api, page, size, signal, newsChan
|
|
|
23
23
|
queryParams.set('filter[isLightVersion]', 'true');
|
|
24
24
|
queryParams.set('filter[excludeTag][]', 'Eisnull');
|
|
25
25
|
for (const newsChannel of newsChannels) {
|
|
26
|
-
queryParams.
|
|
26
|
+
queryParams.append('filter[channel][]', newsChannel);
|
|
27
27
|
}
|
|
28
28
|
const request = getAuthenticatedRequest(api, 'news', queryParams, signal);
|
|
29
29
|
const response = await fetch(request);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,uBAAuB,EAAE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,EAAE,CAAC;AAC/B,CAAC;AAED,MAAM,UAAU,gBAAgB,CAAC,WAAoB;IACnD,QAAQ,WAAW,EAAE;QACnB,KAAK,aAAa;YAChB,OAAO,KAAK,CAAC;QACf,KAAK,OAAO;YACV,OAAO,KAAK,CAAC;QACf,KAAK,OAAO;YACV,OAAO,KAAK,CAAC;QACf,KAAK,aAAa,EAAE,sBAAsB;YACxC,OAAO,MAAM,CAAC;QAChB;YACE,OAAO,KAAK,CAAC;KAChB;AACH,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,MAAM,MAAM,GAAG,2DAA2D,CAAC;IAC3E,MAAM,KAAK,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;AAED,MAAM,UAAU,4BAA4B,CAAC,GAAmB;IAC9D,IAAI,CAAC,GAAG,IAAI,GAAG,KAAK,GAAG,EAAE;QACvB,OAAO,IAAI,CAAC;KACb;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,UAAsC;IAC7D,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;QAC5C,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE;YACV,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;SACtB;KACF;IAED,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC3B,CAAC","sourcesContent":["import { Article } from '../components';\nimport { AicoApiRequestInfo, getAuthenticatedHeaders, getAuthenticatedRequest } from '../model/AicoApiRequestInfo';\nimport { NewsResponse } from '../model/NewsResponse';\n\nexport async function fetchNewsArticles(api: AicoApiRequestInfo, page: number, size: number, signal: AbortSignal, newsChannels: string[] = []): 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 for (const newsChannel of newsChannels) {\n queryParams.append('filter[channel][]', newsChannel);\n }\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(api: AicoApiRequestInfo, page: number, size: number, signal: AbortSignal, newsChannels: string[] = []): 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 for (const newsChannel of newsChannels) {\n queryParams.append('filter[channel][]', newsChannel);\n }\n\n const request = getAuthenticatedRequest(api, 'news', queryParams, signal);\n const response = await fetch(request);\n return await response.json();\n}\n\nexport async function fetchNewsArticle(api: AicoApiRequestInfo, articleId: string, signal: AbortSignal): Promise<Article> {\n const request = getAuthenticatedRequest(api, `news/${articleId}`, new URLSearchParams(), signal);\n const response = await fetch(request);\n const article = await response.json();\n return article.data;\n}\n\nexport async function fetchNewsArticleByHandle(api: AicoApiRequestInfo, urlHandle: string, signal: AbortSignal): Promise<Article> {\n const queryParams = new URLSearchParams();\n queryParams.set('filter[urlHandle]', urlHandle);\n\n const request = getAuthenticatedRequest(api, 'news', queryParams, signal);\n const response = await fetch(request);\n const articles = await response.json();\n return articles.data[0];\n}\n\nexport async function fetchArticle(url: string, bearerToken: string, signal: AbortSignal): Promise<Article> {\n const request = new Request(new URL(url), {\n headers: getAuthenticatedHeaders(bearerToken),\n signal,\n });\n const response = await fetch(request);\n return await response.json();\n}\n\nexport function getImageWidthPrc(pictureSize?: string): string {\n switch (pictureSize) {\n case 'extra-small':\n return '28%';\n case 'small':\n return '40%';\n case 'large':\n return '80%';\n case 'extra large': // TODO: has - or not?\n return '100%';\n default:\n return '60%';\n }\n}\n\nexport function getYoutubeURL(url: string): string | null {\n const regExp = /.*(?:youtu.be\\/|v\\/|u\\/\\w\\/|embed\\/|watch\\?v=)([^#&?]*).*/;\n const match = url.match(regExp);\n if (match && match[1].length == 11) {\n return `https://www.youtube.com/embed/${match[1]}`;\n }\n\n return null;\n}\n\nexport function strIsNullOrEmptyOrWhitespace(str?: string | null): boolean {\n if (!str || str === ' ') {\n return true;\n }\n\n return false;\n}\n\nexport function getClass(conditions: { [key: string]: boolean }): string {\n const classes: string[] = [];\n for (const kvp of Object.entries(conditions)) {\n if (kvp[1]) {\n classes.push(kvp[0]);\n }\n }\n\n return classes.join(' ');\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"aico-fetch-article-detail.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAM,yBAAyB,GAAG,EAAE;;MCUvBA,wBAAsB;;;;;;;sBAOR,IAAI;;;;
|
|
1
|
+
{"file":"aico-fetch-article-detail.js","mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,MAAM,yBAAyB,GAAG,EAAE;;MCUvBA,wBAAsB;;;;;;;sBAOR,IAAI;;;;IAmB7B,iBAAiB;QACf,IAAI,CAAC,sBAAsB,GAAG,IAAI,eAAe,EAAE,CAAC;QACpD,IAAI,CAAC,GAAG,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC;KACzE;IAED,oBAAoB;QAClB,IAAI,CAAC,sBAAuB,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;KACpD;IAED,MAAM,iBAAiB;QACrB,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE;YAC7C,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC;SAC9E;QAED,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACzB,IAAI,CAAC,OAAO,GAAG,MAAM,wBAAwB,CAAC,IAAI,CAAC,GAAI,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,sBAAuB,CAAC,MAAM,CAAC,CAAC;YACrH,OAAO;SACR;QAED,IAAI,CAAC,OAAO,GAAG,MAAM,gBAAgB,CAAC,IAAI,CAAC,GAAI,EAAE,IAAI,CAAC,SAAU,EAAE,IAAI,CAAC,sBAAuB,CAAC,MAAM,CAAC,CAAC;KACxG;IAED,MAAM;QACJ,OAAO,2BAAqB,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,GAAI,CAAC;KAC5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["AicoFetchArticleDetail"],"sources":["src/components/aico-fetch-article-detail/aico-fetch-article-detail.css?tag=aico-fetch-article-detail&encapsulation=scoped","src/components/aico-fetch-article-detail/aico-fetch-article-detail.tsx"],"sourcesContent":["","import { Component, Prop, State, h } from '@stencil/core';\nimport { fetchNewsArticle, fetchNewsArticleByHandle } from '../../utils/utils';\nimport { Article } from '../../model/Article';\nimport { AicoApiRequestInfo } from '../../model/AicoApiRequestInfo';\n\n@Component({\n tag: 'aico-fetch-article-detail',\n styleUrl: 'aico-fetch-article-detail.css',\n scoped: true,\n})\nexport class AicoFetchArticleDetail {\n @State() article!: Article;\n\n @Prop() aicoUrl!: string;\n\n @Prop() aicoBearerToken!: string;\n\n @Prop() locale: string = 'de';\n\n /**\n * The id will be used to fetch the article.\n *\n * If both the 'articleId' and 'articleUrlHandle' are provided, the latter will be used. If neither are provided, an error is thrown.\n */\n @Prop() articleId?: string;\n\n /**\n * The url handle will be used to fetch the article.\n *\n * If both the 'articleId' and 'articleUrlHandle' are provided, the latter will be used. If neither are provided, an error is thrown.\n */\n @Prop() articleUrlHandle?: string;\n\n private api?: AicoApiRequestInfo;\n private articleFetchController?: AbortController;\n\n connectedCallback() {\n this.articleFetchController = new AbortController();\n this.api = { baseApi: this.aicoUrl, bearerToken: this.aicoBearerToken };\n }\n\n disconnectedCallback() {\n this.articleFetchController!.abort('disconnected');\n }\n\n async componentWillLoad(): Promise<void> {\n if (!this.articleId && !this.articleUrlHandle) {\n throw new Error('Either the article id or the url handle must be provided.');\n }\n\n if (this.articleUrlHandle) {\n this.article = await fetchNewsArticleByHandle(this.api!, this.articleUrlHandle, this.articleFetchController!.signal);\n return;\n }\n\n this.article = await fetchNewsArticle(this.api!, this.articleId!, this.articleFetchController!.signal);\n }\n\n render() {\n return <aico-article-detail article={this.article} locale={this.locale} />;\n }\n}\n"],"version":3}
|
package/dist/components/utils.js
CHANGED
|
@@ -19,7 +19,7 @@ async function fetchNewsArticles(api, page, size, signal, newsChannels = []) {
|
|
|
19
19
|
queryParams.set('filter[isActive]', '1');
|
|
20
20
|
queryParams.set('filter[excludeTag][]', 'Eisnull');
|
|
21
21
|
for (const newsChannel of newsChannels) {
|
|
22
|
-
queryParams.
|
|
22
|
+
queryParams.append('filter[channel][]', newsChannel);
|
|
23
23
|
}
|
|
24
24
|
const request = getAuthenticatedRequest(api, 'news', queryParams, signal);
|
|
25
25
|
const response = await fetch(request);
|
|
@@ -35,7 +35,7 @@ async function fetchSpecialNewsArticles(api, page, size, signal, newsChannels =
|
|
|
35
35
|
queryParams.set('filter[isLightVersion]', 'true');
|
|
36
36
|
queryParams.set('filter[excludeTag][]', 'Eisnull');
|
|
37
37
|
for (const newsChannel of newsChannels) {
|
|
38
|
-
queryParams.
|
|
38
|
+
queryParams.append('filter[channel][]', newsChannel);
|
|
39
39
|
}
|
|
40
40
|
const request = getAuthenticatedRequest(api, 'news', queryParams, signal);
|
|
41
41
|
const response = await fetch(request);
|
|
@@ -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;;ACbM,eAAe,iBAAiB,CAAC,GAAuB,EAAE,IAAY,EAAE,IAAY,EAAE,MAAmB,EAAE,eAAyB,EAAE;IAC3I,MAAM,WAAW,GAAG,IAAI,eAAe,EAAE,CAAC;IAC1C,WAAW,CAAC,GAAG,CAAC,cAAc,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9C,WAAW,CAAC,GAAG,CAAC,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5C,WAAW,CAAC,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IACxC,WAAW,CAAC,GAAG,CAAC,kBAAkB,EAAE,GAAG,CAAC,CAAC;IACzC,WAAW,CAAC,GAAG,CAAC,sBAAsB,EAAE,SAAS,CAAC,CAAC;IACnD,KAAK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AiC,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\nexport async function fetchNewsArticles(api: AicoApiRequestInfo, page: number, size: number, signal: AbortSignal, newsChannels: string[] = []): 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 for (const newsChannel of newsChannels) {\n queryParams.append('filter[channel][]', newsChannel);\n }\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(api: AicoApiRequestInfo, page: number, size: number, signal: AbortSignal, newsChannels: string[] = []): 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 for (const newsChannel of newsChannels) {\n queryParams.append('filter[channel][]', newsChannel);\n }\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}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { r as registerInstance, h, H as Host, c as createEvent, F as Fragment } from './index-4621a8ba.js';
|
|
2
2
|
import { j as jquery } from './slick-d11cf173.js';
|
|
3
|
-
import { s as strIsNullOrEmptyOrWhitespace, g as getImageWidthPrc, d as getClass, e as getYoutubeURL } from './utils-
|
|
3
|
+
import { s as strIsNullOrEmptyOrWhitespace, g as getImageWidthPrc, d as getClass, e as getYoutubeURL } from './utils-25eef7c7.js';
|
|
4
4
|
|
|
5
5
|
const aicoAlbumContentCss = "";
|
|
6
6
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, h } from './index-4621a8ba.js';
|
|
2
|
-
import { f as fetchNewsArticleByHandle, a as fetchNewsArticle } from './utils-
|
|
2
|
+
import { f as fetchNewsArticleByHandle, a as fetchNewsArticle } from './utils-25eef7c7.js';
|
|
3
3
|
|
|
4
4
|
const aicoFetchArticleDetailCss = "";
|
|
5
5
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"aico-fetch-article-detail.entry.js","mappings":";;;AAAA,MAAM,yBAAyB,GAAG,EAAE;;MCUvB,sBAAsB;;;;;;sBAOR,IAAI;;;;
|
|
1
|
+
{"file":"aico-fetch-article-detail.entry.js","mappings":";;;AAAA,MAAM,yBAAyB,GAAG,EAAE;;MCUvB,sBAAsB;;;;;;sBAOR,IAAI;;;;IAmB7B,iBAAiB;QACf,IAAI,CAAC,sBAAsB,GAAG,IAAI,eAAe,EAAE,CAAC;QACpD,IAAI,CAAC,GAAG,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,WAAW,EAAE,IAAI,CAAC,eAAe,EAAE,CAAC;KACzE;IAED,oBAAoB;QAClB,IAAI,CAAC,sBAAuB,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;KACpD;IAED,MAAM,iBAAiB;QACrB,IAAI,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE;YAC7C,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAC;SAC9E;QAED,IAAI,IAAI,CAAC,gBAAgB,EAAE;YACzB,IAAI,CAAC,OAAO,GAAG,MAAM,wBAAwB,CAAC,IAAI,CAAC,GAAI,EAAE,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,sBAAuB,CAAC,MAAM,CAAC,CAAC;YACrH,OAAO;SACR;QAED,IAAI,CAAC,OAAO,GAAG,MAAM,gBAAgB,CAAC,IAAI,CAAC,GAAI,EAAE,IAAI,CAAC,SAAU,EAAE,IAAI,CAAC,sBAAuB,CAAC,MAAM,CAAC,CAAC;KACxG;IAED,MAAM;QACJ,OAAO,2BAAqB,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,GAAI,CAAC;KAC5E;;;;;;","names":[],"sources":["src/components/aico-fetch-article-detail/aico-fetch-article-detail.css?tag=aico-fetch-article-detail&encapsulation=scoped","src/components/aico-fetch-article-detail/aico-fetch-article-detail.tsx"],"sourcesContent":["","import { Component, Prop, State, h } from '@stencil/core';\nimport { fetchNewsArticle, fetchNewsArticleByHandle } from '../../utils/utils';\nimport { Article } from '../../model/Article';\nimport { AicoApiRequestInfo } from '../../model/AicoApiRequestInfo';\n\n@Component({\n tag: 'aico-fetch-article-detail',\n styleUrl: 'aico-fetch-article-detail.css',\n scoped: true,\n})\nexport class AicoFetchArticleDetail {\n @State() article!: Article;\n\n @Prop() aicoUrl!: string;\n\n @Prop() aicoBearerToken!: string;\n\n @Prop() locale: string = 'de';\n\n /**\n * The id will be used to fetch the article.\n *\n * If both the 'articleId' and 'articleUrlHandle' are provided, the latter will be used. If neither are provided, an error is thrown.\n */\n @Prop() articleId?: string;\n\n /**\n * The url handle will be used to fetch the article.\n *\n * If both the 'articleId' and 'articleUrlHandle' are provided, the latter will be used. If neither are provided, an error is thrown.\n */\n @Prop() articleUrlHandle?: string;\n\n private api?: AicoApiRequestInfo;\n private articleFetchController?: AbortController;\n\n connectedCallback() {\n this.articleFetchController = new AbortController();\n this.api = { baseApi: this.aicoUrl, bearerToken: this.aicoBearerToken };\n }\n\n disconnectedCallback() {\n this.articleFetchController!.abort('disconnected');\n }\n\n async componentWillLoad(): Promise<void> {\n if (!this.articleId && !this.articleUrlHandle) {\n throw new Error('Either the article id or the url handle must be provided.');\n }\n\n if (this.articleUrlHandle) {\n this.article = await fetchNewsArticleByHandle(this.api!, this.articleUrlHandle, this.articleFetchController!.signal);\n return;\n }\n\n this.article = await fetchNewsArticle(this.api!, this.articleId!, this.articleFetchController!.signal);\n }\n\n render() {\n return <aico-article-detail article={this.article} locale={this.locale} />;\n }\n}\n"],"version":3}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as registerInstance, c as createEvent, h } from './index-4621a8ba.js';
|
|
2
|
-
import { c as fetchSpecialNewsArticles } from './utils-
|
|
2
|
+
import { c as fetchSpecialNewsArticles } from './utils-25eef7c7.js';
|
|
3
3
|
import { j as jquery } from './slick-d11cf173.js';
|
|
4
4
|
|
|
5
5
|
const aicoSpecialNewsCarouselCss = ".slick-slide.sc-aico-special-news-carousel>div.sc-aico-special-news-carousel{height:100% !important}";
|
|
@@ -19,7 +19,7 @@ async function fetchNewsArticles(api, page, size, signal, newsChannels = []) {
|
|
|
19
19
|
queryParams.set('filter[isActive]', '1');
|
|
20
20
|
queryParams.set('filter[excludeTag][]', 'Eisnull');
|
|
21
21
|
for (const newsChannel of newsChannels) {
|
|
22
|
-
queryParams.
|
|
22
|
+
queryParams.append('filter[channel][]', newsChannel);
|
|
23
23
|
}
|
|
24
24
|
const request = getAuthenticatedRequest(api, 'news', queryParams, signal);
|
|
25
25
|
const response = await fetch(request);
|
|
@@ -35,7 +35,7 @@ async function fetchSpecialNewsArticles(api, page, size, signal, newsChannels =
|
|
|
35
35
|
queryParams.set('filter[isLightVersion]', 'true');
|
|
36
36
|
queryParams.set('filter[excludeTag][]', 'Eisnull');
|
|
37
37
|
for (const newsChannel of newsChannels) {
|
|
38
|
-
queryParams.
|
|
38
|
+
queryParams.append('filter[channel][]', newsChannel);
|
|
39
39
|
}
|
|
40
40
|
const request = getAuthenticatedRequest(api, 'news', queryParams, signal);
|
|
41
41
|
const response = await fetch(request);
|
|
@@ -95,4 +95,4 @@ function getClass(conditions) {
|
|
|
95
95
|
|
|
96
96
|
export { fetchNewsArticle as a, fetchNewsArticles as b, fetchSpecialNewsArticles as c, getClass as d, getYoutubeURL as e, fetchNewsArticleByHandle as f, getImageWidthPrc as g, strIsNullOrEmptyOrWhitespace as s };
|
|
97
97
|
|
|
98
|
-
//# sourceMappingURL=utils-
|
|
98
|
+
//# sourceMappingURL=utils-25eef7c7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"utils-
|
|
1
|
+
{"file":"utils-25eef7c7.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;AAE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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\nexport async function fetchNewsArticles(api: AicoApiRequestInfo, page: number, size: number, signal: AbortSignal, newsChannels: string[] = []): 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 for (const newsChannel of newsChannels) {\n queryParams.append('filter[channel][]', newsChannel);\n }\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(api: AicoApiRequestInfo, page: number, size: number, signal: AbortSignal, newsChannels: string[] = []): 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 for (const newsChannel of newsChannels) {\n queryParams.append('filter[channel][]', newsChannel);\n }\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}
|
|
@@ -7,15 +7,13 @@ export declare class AicoFetchArticleDetail {
|
|
|
7
7
|
/**
|
|
8
8
|
* The id will be used to fetch the article.
|
|
9
9
|
*
|
|
10
|
-
* If both the
|
|
11
|
-
* provided, the latter will be used. If neither are provided, an error is thrown.
|
|
10
|
+
* If both the 'articleId' and 'articleUrlHandle' are provided, the latter will be used. If neither are provided, an error is thrown.
|
|
12
11
|
*/
|
|
13
12
|
articleId?: string;
|
|
14
13
|
/**
|
|
15
14
|
* The url handle will be used to fetch the article.
|
|
16
15
|
*
|
|
17
|
-
* If both the
|
|
18
|
-
* provided, the latter will be used. If neither are provided, an error is thrown.
|
|
16
|
+
* If both the 'articleId' and 'articleUrlHandle' are provided, the latter will be used. If neither are provided, an error is thrown.
|
|
19
17
|
*/
|
|
20
18
|
articleUrlHandle?: string;
|
|
21
19
|
private api?;
|
|
@@ -98,11 +98,11 @@ export namespace Components {
|
|
|
98
98
|
"aicoBearerToken": string;
|
|
99
99
|
"aicoUrl": string;
|
|
100
100
|
/**
|
|
101
|
-
* The id will be used to fetch the article. If both the
|
|
101
|
+
* The id will be used to fetch the article. If both the 'articleId' and 'articleUrlHandle' are provided, the latter will be used. If neither are provided, an error is thrown.
|
|
102
102
|
*/
|
|
103
103
|
"articleId"?: string;
|
|
104
104
|
/**
|
|
105
|
-
* The url handle will be used to fetch the article. If both the
|
|
105
|
+
* The url handle will be used to fetch the article. If both the 'articleId' and 'articleUrlHandle' are provided, the latter will be used. If neither are provided, an error is thrown.
|
|
106
106
|
*/
|
|
107
107
|
"articleUrlHandle"?: string;
|
|
108
108
|
"locale": string;
|
|
@@ -492,11 +492,11 @@ declare namespace LocalJSX {
|
|
|
492
492
|
"aicoBearerToken": string;
|
|
493
493
|
"aicoUrl": string;
|
|
494
494
|
/**
|
|
495
|
-
* The id will be used to fetch the article. If both the
|
|
495
|
+
* The id will be used to fetch the article. If both the 'articleId' and 'articleUrlHandle' are provided, the latter will be used. If neither are provided, an error is thrown.
|
|
496
496
|
*/
|
|
497
497
|
"articleId"?: string;
|
|
498
498
|
/**
|
|
499
|
-
* The url handle will be used to fetch the article. If both the
|
|
499
|
+
* The url handle will be used to fetch the article. If both the 'articleId' and 'articleUrlHandle' are provided, the latter will be used. If neither are provided, an error is thrown.
|
|
500
500
|
*/
|
|
501
501
|
"articleUrlHandle"?: string;
|
|
502
502
|
"locale"?: string;
|