@aiconomy/aico-components 0.0.179 → 0.0.187

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.
Files changed (45) hide show
  1. package/README.md +0 -513
  2. package/dist/aico-components/aico-components.esm.js +1 -1
  3. package/dist/aico-components/aico-components.esm.js.map +1 -1
  4. package/dist/aico-components/{p-c9763f2d.entry.js → p-f2c14c63.entry.js} +3 -3
  5. package/dist/aico-components/p-f2c14c63.entry.js.map +1 -0
  6. package/dist/cjs/aico-album-content_27.cjs.entry.js +94 -66
  7. package/dist/cjs/aico-album-content_27.cjs.entry.js.map +1 -1
  8. package/dist/cjs/aico-components.cjs.js +1 -1
  9. package/dist/cjs/loader.cjs.js +1 -1
  10. package/dist/collection/components/aico-news-list/aico-news-list.js +63 -23
  11. package/dist/collection/components/aico-news-list/aico-news-list.js.map +1 -1
  12. package/dist/collection/components/aico-news-list-item/aico-news-list-item.js +1 -1
  13. package/dist/collection/components/aico-news-list-item/aico-news-list-item.js.map +1 -1
  14. package/dist/collection/components/aico-special-news-carousel/aico-special-news-carousel.js +26 -6
  15. package/dist/collection/components/aico-special-news-carousel/aico-special-news-carousel.js.map +1 -1
  16. package/dist/collection/components/aico-top-news-carousel/aico-top-news-carousel.js +25 -5
  17. package/dist/collection/components/aico-top-news-carousel/aico-top-news-carousel.js.map +1 -1
  18. package/dist/collection/model/AicoApiRequestInfo.js +7 -3
  19. package/dist/collection/model/AicoApiRequestInfo.js.map +1 -1
  20. package/dist/collection/utils/utils.js +53 -34
  21. package/dist/collection/utils/utils.js.map +1 -1
  22. package/dist/components/aico-news-list-item2.js +1 -1
  23. package/dist/components/aico-news-list-item2.js.map +1 -1
  24. package/dist/components/aico-news-list.js +26 -21
  25. package/dist/components/aico-news-list.js.map +1 -1
  26. package/dist/components/aico-special-news-carousel.js +6 -4
  27. package/dist/components/aico-special-news-carousel.js.map +1 -1
  28. package/dist/components/aico-top-news-carousel.js +5 -3
  29. package/dist/components/aico-top-news-carousel.js.map +1 -1
  30. package/dist/components/utils.js +60 -37
  31. package/dist/components/utils.js.map +1 -1
  32. package/dist/esm/aico-album-content_27.entry.js +94 -66
  33. package/dist/esm/aico-album-content_27.entry.js.map +1 -1
  34. package/dist/esm/aico-components.js +1 -1
  35. package/dist/esm/loader.js +1 -1
  36. package/dist/ssr/index.js +99 -67
  37. package/dist/ssr/index.mjs +99 -67
  38. package/dist/types/components/aico-news-list/aico-news-list.d.ts +8 -0
  39. package/dist/types/components/aico-special-news-carousel/aico-special-news-carousel.d.ts +4 -0
  40. package/dist/types/components/aico-top-news-carousel/aico-top-news-carousel.d.ts +4 -0
  41. package/dist/types/components.d.ts +35 -3
  42. package/dist/types/model/AicoApiRequestInfo.d.ts +3 -2
  43. package/dist/types/utils/utils.d.ts +1 -1
  44. package/package.json +1 -1
  45. package/dist/aico-components/p-c9763f2d.entry.js.map +0 -1
@@ -15974,15 +15974,19 @@ const ConditionalRender = ({ condition }, children) => {
15974
15974
  return condition ? children : [];
15975
15975
  };
15976
15976
 
15977
- const getAuthenticatedHeaders = (bearerToken) => {
15977
+ const getAuthenticatedHeaders = (token) => {
15978
15978
  const headers = new Headers();
15979
15979
  headers.append('Accept', 'application/vnd.api+json');
15980
- headers.append('Authorization', `Bearer ${bearerToken}`);
15980
+ headers.append('Authorization', `Bearer ${token}`);
15981
15981
  return headers;
15982
15982
  };
15983
15983
  const getAuthenticatedRequest = (api, route, query, signal) => {
15984
+ const token = api.bearerToken || api.accessToken;
15985
+ if (!token) {
15986
+ throw new Error('No valid token found');
15987
+ }
15984
15988
  return new Request(new URL(`${route}?${query.toString()}`, api.baseApi), {
15985
- headers: getAuthenticatedHeaders(api.bearerToken),
15989
+ headers: getAuthenticatedHeaders(token),
15986
15990
  signal,
15987
15991
  });
15988
15992
  };
@@ -15992,58 +15996,77 @@ function setArrayFilter(queryParams, key, values) {
15992
15996
  queryParams.append(key, value);
15993
15997
  }
15994
15998
  }
15995
- async function fetchNewsArticles(api, page, size, signal, newsChannels = [], newsSellerIds = [], newsBrandIds = [], newsLanguageLocales = [], hideTopArticles = false, hideSpecialArticles = false) {
15999
+ async function fetchNewsArticles(api, page, size, signal, newsChannels = [], newsSellerIds = [], newsBrandIds = [], newsLanguageLocales = [], hideTopArticles = false, hideSpecialArticles = false, latestNews = false) {
16000
+ const url = api.bearerToken
16001
+ ? 'news'
16002
+ : api.accessToken
16003
+ ? latestNews
16004
+ ? 'aico-shops/1/latest-news-resource'
16005
+ : 'aico-shops/1/news-resource'
16006
+ : '';
15996
16007
  const queryParams = new URLSearchParams();
15997
16008
  queryParams.set('page[number]', String(page));
15998
16009
  queryParams.set('page[size]', String(size));
15999
- queryParams.set('sort', '-publishDate');
16000
- queryParams.set('filter[isActive]', '1');
16001
- queryParams.set('filter[excludeTag][]', 'Eisnull');
16002
- setArrayFilter(queryParams, 'filter[channel][]', newsChannels);
16003
- setArrayFilter(queryParams, 'filter[sellerIds][]', newsSellerIds);
16004
- setArrayFilter(queryParams, 'filter[brandId][]', newsBrandIds);
16005
- setArrayFilter(queryParams, 'filter[newsLanguage][]', newsLanguageLocales);
16006
- if (hideTopArticles) {
16007
- queryParams.set('filter[isTopNews]', '0');
16008
- }
16009
- if (hideSpecialArticles) {
16010
- queryParams.set('filter[isSpecialArticle]', '0');
16011
- }
16012
- const request = getAuthenticatedRequest(api, 'news', queryParams, signal);
16010
+ if (api.bearerToken) {
16011
+ queryParams.set('sort', '-publishDate');
16012
+ queryParams.set('filter[isActive]', '1');
16013
+ queryParams.set('filter[excludeTag][]', 'Eisnull');
16014
+ setArrayFilter(queryParams, 'filter[channel][]', newsChannels);
16015
+ setArrayFilter(queryParams, 'filter[sellerIds][]', newsSellerIds);
16016
+ setArrayFilter(queryParams, 'filter[brandId][]', newsBrandIds);
16017
+ setArrayFilter(queryParams, 'filter[newsLanguage][]', newsLanguageLocales);
16018
+ if (hideTopArticles) {
16019
+ queryParams.set('filter[isTopNews]', '0');
16020
+ }
16021
+ if (hideSpecialArticles) {
16022
+ queryParams.set('filter[isSpecialArticle]', '0');
16023
+ }
16024
+ }
16025
+ const request = getAuthenticatedRequest(api, url, queryParams, signal);
16013
16026
  const response = await fetch(request);
16014
16027
  return await response.json();
16015
16028
  }
16016
16029
  async function fetchSpecialNewsArticles(api, page, size, signal, newsChannels = [], newsSellerIds = [], newsBrandIds = [], newsLanguageLocales = []) {
16030
+ const url = api.bearerToken
16031
+ ? 'news'
16032
+ : 'aico-shops/1/news-resource';
16017
16033
  const queryParams = new URLSearchParams();
16018
16034
  queryParams.set('page[number]', String(page));
16019
16035
  queryParams.set('page[size]', String(size));
16020
- queryParams.set('sort', '-publishDate');
16021
- queryParams.set('filter[isActive]', '1');
16022
- queryParams.set('filter[isSpecialArticle]', '1');
16023
- queryParams.set('filter[isLightVersion]', 'true');
16024
- queryParams.set('filter[excludeTag][]', 'Eisnull');
16025
- setArrayFilter(queryParams, 'filter[channel][]', newsChannels);
16026
- setArrayFilter(queryParams, 'filter[sellerIds][]', newsSellerIds);
16027
- setArrayFilter(queryParams, 'filter[brandId][]', newsBrandIds);
16028
- setArrayFilter(queryParams, 'filter[newsLanguage][]', newsLanguageLocales);
16029
- const request = getAuthenticatedRequest(api, 'news', queryParams, signal);
16036
+ if (api.bearerToken) {
16037
+ queryParams.set('sort', '-publishDate');
16038
+ queryParams.set('filter[isActive]', '1');
16039
+ queryParams.set('filter[isSpecialArticle]', '1');
16040
+ queryParams.set('filter[isLightVersion]', 'true');
16041
+ queryParams.set('filter[excludeTag][]', 'Eisnull');
16042
+ setArrayFilter(queryParams, 'filter[channel][]', newsChannels);
16043
+ setArrayFilter(queryParams, 'filter[sellerIds][]', newsSellerIds);
16044
+ setArrayFilter(queryParams, 'filter[brandId][]', newsBrandIds);
16045
+ setArrayFilter(queryParams, 'filter[newsLanguage][]', newsLanguageLocales);
16046
+ }
16047
+ const request = getAuthenticatedRequest(api, url, queryParams, signal);
16030
16048
  const response = await fetch(request);
16031
16049
  return await response.json();
16032
16050
  }
16033
16051
  async function fetchTopNewsArticles(api, page, size, signal, newsChannels = [], newsSellerIds = [], newsBrandIds = [], newsLanguageLocales = []) {
16052
+ const url = api.bearerToken
16053
+ ? 'news'
16054
+ : 'aico-shops/1/news-resource';
16034
16055
  const queryParams = new URLSearchParams();
16035
16056
  queryParams.set('page[number]', String(page));
16036
16057
  queryParams.set('page[size]', String(size));
16037
- queryParams.set('sort', '-publishDate');
16038
- queryParams.set('filter[isActive]', '1');
16039
- queryParams.set('filter[isTopNews]', '1');
16040
- queryParams.set('filter[isLightVersion]', 'true');
16041
- queryParams.set('filter[excludeTag][]', 'Eisnull');
16042
- setArrayFilter(queryParams, 'filter[channel][]', newsChannels);
16043
- setArrayFilter(queryParams, 'filter[sellerIds][]', newsSellerIds);
16044
- setArrayFilter(queryParams, 'filter[brandId][]', newsBrandIds);
16045
- setArrayFilter(queryParams, 'filter[newsLanguage][]', newsLanguageLocales);
16046
- const request = getAuthenticatedRequest(api, 'news', queryParams, signal);
16058
+ if (api.bearerToken) {
16059
+ queryParams.set('sort', '-publishDate');
16060
+ queryParams.set('filter[isActive]', '1');
16061
+ queryParams.set('filter[isTopNews]', '1');
16062
+ queryParams.set('filter[isLightVersion]', 'true');
16063
+ queryParams.set('filter[excludeTag][]', 'Eisnull');
16064
+ setArrayFilter(queryParams, 'filter[channel][]', newsChannels);
16065
+ setArrayFilter(queryParams, 'filter[sellerIds][]', newsSellerIds);
16066
+ setArrayFilter(queryParams, 'filter[brandId][]', newsBrandIds);
16067
+ setArrayFilter(queryParams, 'filter[newsLanguage][]', newsLanguageLocales);
16068
+ }
16069
+ const request = getAuthenticatedRequest(api, url, queryParams, signal);
16047
16070
  const response = await fetch(request);
16048
16071
  return await response.json();
16049
16072
  }
@@ -23078,13 +23101,15 @@ class AicoNewsList {
23078
23101
  this.newsBrandIdsArr = [];
23079
23102
  this.newsLanguageLocalesArr = [];
23080
23103
  this.aicoUrl = undefined;
23081
- this.aicoBearerToken = undefined;
23104
+ this.aicoBearerToken = '';
23105
+ this.userAccessToken = '';
23082
23106
  this.newsChannels = '';
23083
23107
  this.newsSellerIds = '';
23084
23108
  this.newsBrandIds = '';
23085
23109
  this.newsLanguageLocales = '';
23086
23110
  this.hideTopArticles = true;
23087
23111
  this.hideSpecialArticles = false;
23112
+ this.latestNews = false;
23088
23113
  this.pageSize = 16;
23089
23114
  this.nextButtonText = 'Next';
23090
23115
  this.previousButtonText = 'Previous';
@@ -23093,7 +23118,7 @@ class AicoNewsList {
23093
23118
  connectedCallback() {
23094
23119
  this.newsListFetchController = new AbortController();
23095
23120
  this.pageNumber = 1;
23096
- this.api = { baseApi: this.aicoUrl, bearerToken: this.aicoBearerToken };
23121
+ this.api = { baseApi: this.aicoUrl, bearerToken: this.aicoBearerToken, accessToken: this.userAccessToken };
23097
23122
  this.newsChannelsArr = splitByComma(this.newsChannels);
23098
23123
  this.newsSellerIdsArr = splitByComma(this.newsSellerIds);
23099
23124
  this.newsBrandIdsArr = splitByComma(this.newsBrandIds);
@@ -23103,36 +23128,37 @@ class AicoNewsList {
23103
23128
  this.newsListFetchController.abort('disconnected');
23104
23129
  }
23105
23130
  async componentWillLoad() {
23106
- this.newsResponse = await fetchNewsArticles(this.api, this.pageNumber, this.pageSize, this.newsListFetchController.signal, this.newsChannelsArr, this.newsSellerIdsArr, this.newsBrandIdsArr, this.newsLanguageLocalesArr, this.hideTopArticles, this.hideSpecialArticles);
23131
+ this.newsResponse = await fetchNewsArticles(this.api, this.pageNumber, this.pageSize, this.newsListFetchController.signal, this.newsChannelsArr, this.newsSellerIdsArr, this.newsBrandIdsArr, this.newsLanguageLocalesArr, this.hideTopArticles, this.hideSpecialArticles, this.latestNews);
23107
23132
  }
23108
23133
  async componentWillUpdate() {
23109
23134
  this.newsListFetchController = new AbortController();
23110
- this.newsResponse = await fetchNewsArticles(this.api, this.pageNumber, this.pageSize, this.newsListFetchController.signal, this.newsChannelsArr, this.newsSellerIdsArr, this.newsBrandIdsArr, this.newsLanguageLocalesArr, this.hideTopArticles, this.hideSpecialArticles);
23135
+ this.newsResponse = await fetchNewsArticles(this.api, this.pageNumber, this.pageSize, this.newsListFetchController.signal, this.newsChannelsArr, this.newsSellerIdsArr, this.newsBrandIdsArr, this.newsLanguageLocalesArr, this.hideTopArticles, this.hideSpecialArticles, this.latestNews);
23111
23136
  }
23112
23137
  render() {
23113
23138
  var _a, _b, _c;
23114
- return (hAsync(Host, { key: 'aacad98b3f28998312f373ce64352e4d0e053255' }, hAsync("div", { key: '5d1d20400ca9c70e948d8c3ace1c1ec73706d650', class: "newslist-grid-container mb-4" }, (_a = this.newsResponse) === null || _a === void 0 ? void 0 : _a.data.filter(article => !article.attributes.isTopNews).map((article, articleIndex) => {
23139
+ return (hAsync(Host, { key: 'e1667c954dd75052b26f824431174b7e734b484c' }, hAsync("div", { key: '93ebe550604322a061fc082390592445491877a6', class: "newslist-grid-container mb-4" }, (_a = this.newsResponse) === null || _a === void 0 ? void 0 : _a.data.filter(article => this.latestNews || !article.attributes.isTopNews).map((article, articleIndex) => {
23115
23140
  return (hAsync("div", { key: article.id, class: "col" }, hAsync("aico-news-list-item", { article: article, articleIndex: articleIndex, onArticleClick: e => {
23116
23141
  var _a;
23117
23142
  (_a = this.articleClick) === null || _a === void 0 ? void 0 : _a.emit(e.detail);
23118
23143
  e.stopPropagation();
23119
23144
  }, locale: this.locale })));
23120
- })), hAsync("nav", { key: 'bfb45f66e785d2541815cfbe35a84f64405256aa', class: "w-100", "aria-label": "News navigation" }, hAsync("ul", { key: '1c0ec21fb0b2637883b3cb2108767c78d33306ac', class: "pagination justify-content-center" }, hAsync("li", { key: '1e70a53475fc409cd00ea92f7dcf69bacbfc5579', 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: () => {
23121
- if (this.pageNumber > 1) {
23122
- this.pageNumber -= 1;
23123
- }
23124
- return false;
23125
- } }, hAsync("svg", { key: '90f7a776166c44dc5bd74fcdf1cec89bbca167b2', 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" }, hAsync("path", { key: '2762edda4d68a9fa6022c0cd8cbc7c5cff710c6b', "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" })), this.previousButtonText), this.getViewablePages().map(page => (hAsync("li", { class: `page-item page-link user-select-none ${page === '...' ? 'disabled' : Number(page) === this.pageNumber ? 'active' : ''}`, style: { cursor: 'pointer' }, onClick: () => {
23126
- if (page !== '...') {
23127
- this.pageNumber = Number(page);
23128
- }
23129
- return false;
23130
- } }, page))), hAsync("li", { key: '788a95d3978bccb990c7497cfc7b52b794159d97', class: `page-item page-link user-select-none d-flex align-items-center ${!((_c = this.newsResponse) === null || _c === void 0 ? void 0 : _c.links.next) ? 'disabled' : ''}`, style: { cursor: 'pointer' }, onClick: () => {
23131
- var _a, _b;
23132
- if (((_a = this.newsResponse) === null || _a === void 0 ? void 0 : _a.meta.page.lastPage) && this.pageNumber < ((_b = this.newsResponse) === null || _b === void 0 ? void 0 : _b.meta.page.lastPage)) {
23133
- this.pageNumber += 1;
23134
- }
23135
- } }, this.nextButtonText, hAsync("svg", { key: 'debb4cd195cc6bfe8c1bead7c324eebfb393f0b9', 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" }, hAsync("path", { key: 'ec9997466d968752da2213d5167db8f1b7b6191f', "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" })))))));
23145
+ })), !this.latestNews &&
23146
+ hAsync("nav", { key: 'b4e081968bf0de39ca6deb53f46e51149ba90c96', class: "w-100", "aria-label": "News navigation" }, hAsync("ul", { key: '306919fae60915ef97b0f8b499105252cffa7355', class: "pagination justify-content-center" }, hAsync("li", { key: '2004858d91a1d36f344947003e16276c06d012e4', 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: () => {
23147
+ if (this.pageNumber > 1) {
23148
+ this.pageNumber -= 1;
23149
+ }
23150
+ return false;
23151
+ } }, hAsync("svg", { key: '794bc0a90223b0bfb469732e64c8ecdc33cbf95f', 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" }, hAsync("path", { key: 'c114c34774e564ee68e70a72f02a53acc7d7403f', "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" })), this.previousButtonText), this.getViewablePages().map(page => (hAsync("li", { class: `page-item page-link user-select-none ${page === '...' ? 'disabled' : Number(page) === this.pageNumber ? 'active' : ''}`, style: { cursor: 'pointer' }, onClick: () => {
23152
+ if (page !== '...') {
23153
+ this.pageNumber = Number(page);
23154
+ }
23155
+ return false;
23156
+ } }, page))), hAsync("li", { key: 'a3b8aa8f9d69ad837e90b17f683fbcb97e70dd56', class: `page-item page-link user-select-none d-flex align-items-center ${!((_c = this.newsResponse) === null || _c === void 0 ? void 0 : _c.links.next) ? 'disabled' : ''}`, style: { cursor: 'pointer' }, onClick: () => {
23157
+ var _a, _b;
23158
+ if (((_a = this.newsResponse) === null || _a === void 0 ? void 0 : _a.meta.page.lastPage) && this.pageNumber < ((_b = this.newsResponse) === null || _b === void 0 ? void 0 : _b.meta.page.lastPage)) {
23159
+ this.pageNumber += 1;
23160
+ }
23161
+ } }, this.nextButtonText, hAsync("svg", { key: '46589c53b68ba1f8a87a893a63469e460d01b25e', 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" }, hAsync("path", { key: '5ea164fd74b2138274adcba33e0e54a42e52be4e', "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" })))))));
23136
23162
  }
23137
23163
  getViewablePages(lookAhead = 2) {
23138
23164
  var _a, _b, _c, _d, _e, _f, _g;
@@ -23169,12 +23195,14 @@ class AicoNewsList {
23169
23195
  "$members$": {
23170
23196
  "aicoUrl": [1, "aico-url"],
23171
23197
  "aicoBearerToken": [1, "aico-bearer-token"],
23198
+ "userAccessToken": [1, "user-access-token"],
23172
23199
  "newsChannels": [1, "news-channels"],
23173
23200
  "newsSellerIds": [1, "news-seller-ids"],
23174
23201
  "newsBrandIds": [1, "news-brand-ids"],
23175
23202
  "newsLanguageLocales": [1, "news-language-locales"],
23176
23203
  "hideTopArticles": [4, "hide-top-articles"],
23177
23204
  "hideSpecialArticles": [4, "hide-special-articles"],
23205
+ "latestNews": [4, "latest-news"],
23178
23206
  "pageSize": [2, "page-size"],
23179
23207
  "nextButtonText": [1, "next-button-text"],
23180
23208
  "previousButtonText": [1, "previous-button-text"],
@@ -23229,7 +23257,7 @@ class AicoNewsListItem {
23229
23257
  return (hAsync("div", { key: 'c133677601367cd225d44f120e7efa6db950c902', class: "card h-100 pe-auto", style: { cursor: 'pointer' }, onClick: () => {
23230
23258
  var _a;
23231
23259
  (_a = this.articleClick) === null || _a === void 0 ? void 0 : _a.emit(this.article);
23232
- } }, hAsync("div", { key: '33be1f94f953a1d60f5abba57c52f1a8d0d4d4ab', class: "ratio ratio-16x9 overflow-hidden" }, hAsync("img", { key: 'd4b5349021cba1d93c9a0dbaba3b8ea5ecb94ce1', 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.image) !== 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.optimizedListImage) !== null && _c !== void 0 ? _c : this.article.attributes.image) !== null && _d !== void 0 ? _d : this.article.attributes.optimizedImage) !== null && _e !== void 0 ? _e : this.article.attributes.optimizedListImage }), hAsync("div", { key: 'a3745aafc708a3e18adcb68b6c7d265ab12e8730', class: "card-img-overlay d-flex justify-content-end" })), hAsync("div", { key: '28f1a23fe2174a590e5ac571c34b11efd759596c', class: "card-body" }, hAsync("h5", { key: '8a9279c63bbfaef47496b89553bbc1e74a67e56d', class: "card-title" }, (_f = translation === null || translation === void 0 ? void 0 : translation.name) !== null && _f !== void 0 ? _f : this.article.attributes.name), hAsync("p", { key: '5ca9ae322f1244e8e5c0d2afc35eec71ba580de1', class: "card-text" }, (_g = translation === null || translation === void 0 ? void 0 : translation.excerpt) !== null && _g !== void 0 ? _g : this.article.attributes.excerpt))));
23260
+ } }, hAsync("div", { key: '33be1f94f953a1d60f5abba57c52f1a8d0d4d4ab', class: "ratio ratio-16x9 overflow-hidden" }, hAsync("img", { key: 'd4b5349021cba1d93c9a0dbaba3b8ea5ecb94ce1', 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 }), hAsync("div", { key: 'a3745aafc708a3e18adcb68b6c7d265ab12e8730', class: "card-img-overlay d-flex justify-content-end" })), hAsync("div", { key: '28f1a23fe2174a590e5ac571c34b11efd759596c', class: "card-body" }, hAsync("h5", { key: '8a9279c63bbfaef47496b89553bbc1e74a67e56d', class: "card-title" }, (_f = translation === null || translation === void 0 ? void 0 : translation.name) !== null && _f !== void 0 ? _f : this.article.attributes.name), hAsync("p", { key: '5ca9ae322f1244e8e5c0d2afc35eec71ba580de1', class: "card-text" }, (_g = translation === null || translation === void 0 ? void 0 : translation.excerpt) !== null && _g !== void 0 ? _g : this.article.attributes.excerpt))));
23233
23261
  }
23234
23262
  get thisHtml() { return getElement$1(this); }
23235
23263
  static get style() { return AicoNewsListItemStyle0; }
@@ -23314,7 +23342,8 @@ class AicoSpecialNewsCarousel {
23314
23342
  this.newsBrandIdsArr = [];
23315
23343
  this.newsLanguageLocalesArr = [];
23316
23344
  this.aicoUrl = undefined;
23317
- this.aicoBearerToken = undefined;
23345
+ this.aicoBearerToken = '';
23346
+ this.userAccessToken = '';
23318
23347
  this.newsChannels = '';
23319
23348
  this.newsSellerIds = '';
23320
23349
  this.newsBrandIds = '';
@@ -23324,7 +23353,7 @@ class AicoSpecialNewsCarousel {
23324
23353
  }
23325
23354
  connectedCallback() {
23326
23355
  this.newsListFetchController = new AbortController();
23327
- this.api = { baseApi: this.aicoUrl, bearerToken: this.aicoBearerToken };
23356
+ this.api = { baseApi: this.aicoUrl, bearerToken: this.aicoBearerToken, accessToken: this.userAccessToken };
23328
23357
  this.newsChannelsArr = splitByComma(this.newsChannels);
23329
23358
  this.newsSellerIdsArr = splitByComma(this.newsSellerIds);
23330
23359
  this.newsBrandIdsArr = splitByComma(this.newsBrandIds);
@@ -23350,7 +23379,7 @@ class AicoSpecialNewsCarousel {
23350
23379
  });
23351
23380
  }
23352
23381
  render() {
23353
- return (hAsync("div", { key: 'ba2ff387f355995b8123e472de17810f0705b23a', class: "carousel" }, this.newsResponse.data.map(article => {
23382
+ return (hAsync("div", { key: 'cdbe261371e46876ac8b4677067c0c1d60d2e9e9', class: "carousel" }, this.newsResponse.data.map(article => {
23354
23383
  var _a, _b, _c, _d, _e, _f, _g;
23355
23384
  const focusX = article.attributes.focusXPercentage ? `${article.attributes.focusXPercentage}%` : 'center';
23356
23385
  const focusY = article.attributes.focusYPercentage ? `${article.attributes.focusYPercentage}%` : 'center';
@@ -23359,7 +23388,7 @@ class AicoSpecialNewsCarousel {
23359
23388
  var _a;
23360
23389
  e.preventDefault();
23361
23390
  (_a = this.articleClicked) === null || _a === void 0 ? void 0 : _a.emit(article);
23362
- } }, (_a = translation === null || translation === void 0 ? void 0 : translation.name) !== null && _a !== void 0 ? _a : article.attributes.name)), hAsync("p", { class: "card-text text-center" }, (_b = translation === null || translation === void 0 ? void 0 : translation.excerpt) !== null && _b !== void 0 ? _b : article.attributes.excerpt)), hAsync("div", { class: "ratio ratio-16x9 mx-auto", style: { 'max-width': '50%' } }, hAsync("img", { class: "card-img-bottom object-fit-cover", style: { 'object-position': `${focusX} ${focusY}`, 'min-height': '15rem' }, alt: "News Picture", "data-lazy": (_g = (_f = (_e = (_d = (_c = translation === null || translation === void 0 ? void 0 : translation.image) !== null && _c !== void 0 ? _c : translation === null || translation === void 0 ? void 0 : translation.optimizedListImage) !== null && _d !== void 0 ? _d : translation === null || translation === void 0 ? void 0 : translation.optimizedImage) !== null && _e !== void 0 ? _e : article.attributes.image) !== null && _f !== void 0 ? _f : article.attributes.optimizedListImage) !== null && _g !== void 0 ? _g : article.attributes.optimizedImage }))));
23391
+ } }, (_a = translation === null || translation === void 0 ? void 0 : translation.name) !== null && _a !== void 0 ? _a : article.attributes.name)), hAsync("p", { class: "card-text text-center" }, (_b = translation === null || translation === void 0 ? void 0 : translation.excerpt) !== null && _b !== void 0 ? _b : article.attributes.excerpt)), hAsync("div", { class: "ratio ratio-16x9 mx-auto", style: { 'max-width': '50%' } }, hAsync("img", { class: "card-img-bottom object-fit-cover", style: { 'object-position': `${focusX} ${focusY}`, 'min-height': '15rem' }, alt: "News Picture", "data-lazy": (_g = (_f = (_e = (_d = (_c = translation === null || translation === void 0 ? void 0 : translation.optimizedListImage) !== null && _c !== void 0 ? _c : translation === null || translation === void 0 ? void 0 : translation.optimizedImage) !== null && _d !== void 0 ? _d : translation === null || translation === void 0 ? void 0 : translation.image) !== null && _e !== void 0 ? _e : article.attributes.optimizedListImage) !== null && _f !== void 0 ? _f : article.attributes.optimizedImage) !== null && _g !== void 0 ? _g : article.attributes.image }))));
23363
23392
  })));
23364
23393
  }
23365
23394
  static get style() { return AicoSpecialNewsCarouselStyle0; }
@@ -23369,6 +23398,7 @@ class AicoSpecialNewsCarousel {
23369
23398
  "$members$": {
23370
23399
  "aicoUrl": [1, "aico-url"],
23371
23400
  "aicoBearerToken": [1, "aico-bearer-token"],
23401
+ "userAccessToken": [1, "user-access-token"],
23372
23402
  "newsChannels": [1, "news-channels"],
23373
23403
  "newsSellerIds": [1, "news-seller-ids"],
23374
23404
  "newsBrandIds": [1, "news-brand-ids"],
@@ -23618,7 +23648,8 @@ class AicoTopNewsCarousel {
23618
23648
  this.newsBrandIdsArr = [];
23619
23649
  this.newsLanguageLocalesArr = [];
23620
23650
  this.aicoUrl = undefined;
23621
- this.aicoBearerToken = undefined;
23651
+ this.aicoBearerToken = '';
23652
+ this.userAccessToken = '';
23622
23653
  this.newsChannels = '';
23623
23654
  this.newsSellerIds = '';
23624
23655
  this.newsBrandIds = '';
@@ -23628,7 +23659,7 @@ class AicoTopNewsCarousel {
23628
23659
  }
23629
23660
  connectedCallback() {
23630
23661
  this.newsListFetchController = new AbortController();
23631
- this.api = { baseApi: this.aicoUrl, bearerToken: this.aicoBearerToken };
23662
+ this.api = { baseApi: this.aicoUrl, bearerToken: this.aicoBearerToken, accessToken: this.userAccessToken };
23632
23663
  this.newsChannelsArr = splitByComma(this.newsChannels);
23633
23664
  this.newsSellerIdsArr = splitByComma(this.newsSellerIds);
23634
23665
  this.newsBrandIdsArr = splitByComma(this.newsBrandIds);
@@ -23654,7 +23685,7 @@ class AicoTopNewsCarousel {
23654
23685
  });
23655
23686
  }
23656
23687
  render() {
23657
- return (hAsync("div", { key: '35573f965fd179a8fe35125da8856e42533b86b4', class: "carousel" }, this.newsResponse.data.map(article => {
23688
+ return (hAsync("div", { key: '403ffcf2505ada818121277bedf4099015221c9a', class: "carousel" }, this.newsResponse.data.map(article => {
23658
23689
  var _a, _b, _c, _d, _e, _f, _g;
23659
23690
  const focusX = article.attributes.focusXPercentage ? `${article.attributes.focusXPercentage}%` : 'center';
23660
23691
  const focusY = article.attributes.focusYPercentage ? `${article.attributes.focusYPercentage}%` : 'center';
@@ -23673,6 +23704,7 @@ class AicoTopNewsCarousel {
23673
23704
  "$members$": {
23674
23705
  "aicoUrl": [1, "aico-url"],
23675
23706
  "aicoBearerToken": [1, "aico-bearer-token"],
23707
+ "userAccessToken": [1, "user-access-token"],
23676
23708
  "newsChannels": [1, "news-channels"],
23677
23709
  "newsSellerIds": [1, "news-seller-ids"],
23678
23710
  "newsBrandIds": [1, "news-brand-ids"],
@@ -16,6 +16,10 @@ export declare class AicoNewsList {
16
16
  * The token used to authenticate against he Aico Api.
17
17
  */
18
18
  aicoBearerToken: string;
19
+ /**
20
+ * The user access token
21
+ */
22
+ userAccessToken: string;
19
23
  /**
20
24
  * Channel names as a comma separated list used to filter the results.
21
25
  */
@@ -40,6 +44,10 @@ export declare class AicoNewsList {
40
44
  * Determines wheter special articles will be included in the list or not.
41
45
  */
42
46
  hideSpecialArticles: boolean;
47
+ /**
48
+ * Determines wheter special articles will be included in the list or not.
49
+ */
50
+ latestNews: boolean;
43
51
  /**
44
52
  * The page size. Prefer this number to be even.
45
53
  */
@@ -16,6 +16,10 @@ export declare class AicoSpecialNewsCarousel {
16
16
  * The token used to authenticate against he Aico Api.
17
17
  */
18
18
  aicoBearerToken: string;
19
+ /**
20
+ * The user access token
21
+ */
22
+ userAccessToken: string;
19
23
  /**
20
24
  * Channel names as a comma separated list used to filter the results.
21
25
  */
@@ -16,6 +16,10 @@ export declare class AicoTopNewsCarousel {
16
16
  * The token used to authenticate against he Aico Api.
17
17
  */
18
18
  aicoBearerToken: string;
19
+ /**
20
+ * The user access token
21
+ */
22
+ userAccessToken: string;
19
23
  /**
20
24
  * Channel names as a comma separated list used to filter the results.
21
25
  */
@@ -167,6 +167,10 @@ export namespace Components {
167
167
  * Determines wheter top articles will be included in the list or not.
168
168
  */
169
169
  "hideTopArticles": boolean;
170
+ /**
171
+ * Determines wheter special articles will be included in the list or not.
172
+ */
173
+ "latestNews": boolean;
170
174
  /**
171
175
  * The article translation that will be used to render the content. If the locale specified is not present in the article's translations, most content will not be shown.
172
176
  */
@@ -199,6 +203,10 @@ export namespace Components {
199
203
  * The text used by the previous button in the pagination component.
200
204
  */
201
205
  "previousButtonText": string;
206
+ /**
207
+ * The user access token
208
+ */
209
+ "userAccessToken": string;
202
210
  }
203
211
  interface AicoNewsListItem {
204
212
  "article": Article;
@@ -247,6 +255,10 @@ export namespace Components {
247
255
  * The number of articles shown in the carousel. Prefer this number to be small.
248
256
  */
249
257
  "numberOfArticles": number;
258
+ /**
259
+ * The user access token
260
+ */
261
+ "userAccessToken": string;
250
262
  }
251
263
  interface AicoTableContent {
252
264
  "content": TableContent;
@@ -296,6 +308,10 @@ export namespace Components {
296
308
  * The number of articles shown in the carousel. Prefer this number to be small.
297
309
  */
298
310
  "numberOfArticles": number;
311
+ /**
312
+ * The user access token
313
+ */
314
+ "userAccessToken": string;
299
315
  }
300
316
  interface AicoUploadContent {
301
317
  "content": UploadContent;
@@ -709,7 +725,7 @@ declare namespace LocalJSX {
709
725
  /**
710
726
  * The token used to authenticate against he Aico Api.
711
727
  */
712
- "aicoBearerToken": string;
728
+ "aicoBearerToken"?: string;
713
729
  /**
714
730
  * The url of the Aico Api that will be used to retrieve the article.
715
731
  */
@@ -722,6 +738,10 @@ declare namespace LocalJSX {
722
738
  * Determines wheter top articles will be included in the list or not.
723
739
  */
724
740
  "hideTopArticles"?: boolean;
741
+ /**
742
+ * Determines wheter special articles will be included in the list or not.
743
+ */
744
+ "latestNews"?: boolean;
725
745
  /**
726
746
  * The article translation that will be used to render the content. If the locale specified is not present in the article's translations, most content will not be shown.
727
747
  */
@@ -758,6 +778,10 @@ declare namespace LocalJSX {
758
778
  * The text used by the previous button in the pagination component.
759
779
  */
760
780
  "previousButtonText"?: string;
781
+ /**
782
+ * The user access token
783
+ */
784
+ "userAccessToken"?: string;
761
785
  }
762
786
  interface AicoNewsListItem {
763
787
  "article": Article;
@@ -779,7 +803,7 @@ declare namespace LocalJSX {
779
803
  /**
780
804
  * The token used to authenticate against he Aico Api.
781
805
  */
782
- "aicoBearerToken": string;
806
+ "aicoBearerToken"?: string;
783
807
  /**
784
808
  * The url of the Aico Api that will be used to retrieve the article.
785
809
  */
@@ -812,6 +836,10 @@ declare namespace LocalJSX {
812
836
  * Event emitted when a user clicks an article title. The handler receives the entire Article entity.
813
837
  */
814
838
  "onArticleClicked"?: (event: AicoSpecialNewsCarouselCustomEvent<Article>) => void;
839
+ /**
840
+ * The user access token
841
+ */
842
+ "userAccessToken"?: string;
815
843
  }
816
844
  interface AicoTableContent {
817
845
  "content": TableContent;
@@ -832,7 +860,7 @@ declare namespace LocalJSX {
832
860
  /**
833
861
  * The token used to authenticate against he Aico Api.
834
862
  */
835
- "aicoBearerToken": string;
863
+ "aicoBearerToken"?: string;
836
864
  /**
837
865
  * The url of the Aico Api that will be used to retrieve the article.
838
866
  */
@@ -865,6 +893,10 @@ declare namespace LocalJSX {
865
893
  * Event emitted when a user clicks an article title. The handler receives the entire Article entity.
866
894
  */
867
895
  "onArticleClicked"?: (event: AicoTopNewsCarouselCustomEvent<Article>) => void;
896
+ /**
897
+ * The user access token
898
+ */
899
+ "userAccessToken"?: string;
868
900
  }
869
901
  interface AicoUploadContent {
870
902
  "content": UploadContent;
@@ -1,6 +1,7 @@
1
1
  export type AicoApiRequestInfo = {
2
2
  baseApi: string;
3
- bearerToken: string;
3
+ bearerToken?: string;
4
+ accessToken?: string;
4
5
  };
5
- export declare const getAuthenticatedHeaders: (bearerToken: string) => Headers;
6
+ export declare const getAuthenticatedHeaders: (token: string) => Headers;
6
7
  export declare const getAuthenticatedRequest: (api: AicoApiRequestInfo, route: string, query: URLSearchParams, signal?: AbortSignal) => Request;
@@ -1,7 +1,7 @@
1
1
  import { Article } from '../components';
2
2
  import { AicoApiRequestInfo } from '../model/AicoApiRequestInfo';
3
3
  import { NewsResponse } from '../model/NewsResponse';
4
- export declare function fetchNewsArticles(api: AicoApiRequestInfo, page: number, size: number, signal: AbortSignal, newsChannels?: string[], newsSellerIds?: string[], newsBrandIds?: string[], newsLanguageLocales?: string[], hideTopArticles?: boolean, hideSpecialArticles?: boolean): Promise<NewsResponse>;
4
+ export declare function fetchNewsArticles(api: AicoApiRequestInfo, page: number, size: number, signal: AbortSignal, newsChannels?: string[], newsSellerIds?: string[], newsBrandIds?: string[], newsLanguageLocales?: string[], hideTopArticles?: boolean, hideSpecialArticles?: boolean, latestNews?: boolean): Promise<NewsResponse>;
5
5
  export declare function fetchSpecialNewsArticles(api: AicoApiRequestInfo, page: number, size: number, signal: AbortSignal, newsChannels?: string[], newsSellerIds?: string[], newsBrandIds?: string[], newsLanguageLocales?: string[]): Promise<NewsResponse>;
6
6
  export declare function fetchTopNewsArticles(api: AicoApiRequestInfo, page: number, size: number, signal: AbortSignal, newsChannels?: string[], newsSellerIds?: string[], newsBrandIds?: string[], newsLanguageLocales?: string[]): Promise<NewsResponse>;
7
7
  export declare function fetchNewsArticle(api: AicoApiRequestInfo, articleId: string, signal: AbortSignal): Promise<Article>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiconomy/aico-components",
3
- "version": "0.0.179",
3
+ "version": "0.0.187",
4
4
  "description": "Aiconomy components",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",