wt-front-shared 19.0.25 → 19.0.27

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.
@@ -742,8 +742,8 @@ class GetCacheDataRequest extends GetRequest {
742
742
  this.config = config;
743
743
  }
744
744
  get url() {
745
- const { type, revision } = this.config;
746
- return `${this.domain}/api/cache-data/${type}${revision ? '?revision=' + revision : ''}`;
745
+ const { type, revision, langId } = this.config;
746
+ return `${this.domain}/api/cache-data/${type}${langId ? '/' + langId : ''}${revision ? '?revision=' + revision : ''}`;
747
747
  }
748
748
  get headers() {
749
749
  return this.addAuthHeaders(this.config.headers);
@@ -6951,11 +6951,14 @@ const getStaticDataRevisionsList = (contentTypes) => createSelector(getStaticDat
6951
6951
  return result;
6952
6952
  });
6953
6953
  const getStaticData = (contentType, subSection, where) => createSelector(getDataByType(contentType, subSection), getLoaded$1(contentType, subSection), (listDataModels, isLoaded) => {
6954
+ // console.log('getStaticData');
6954
6955
  let list = isLoaded ? listDataModels : null;
6955
6956
  if (where && list?.length) {
6956
6957
  list = list.filter(item => {
6958
+ // console.log('getStaticData', contentType, where);
6957
6959
  return Object.keys(where)
6958
6960
  .every(whereItem => {
6961
+ // console.log('whereItem', contentType, whereItem);
6959
6962
  // No array field value
6960
6963
  if (!Array.isArray(item[whereItem])) {
6961
6964
  const fieldValue = item[whereItem];
@@ -6963,6 +6966,7 @@ const getStaticData = (contentType, subSection, where) => createSelector(getData
6963
6966
  if (!Array.isArray(where[whereItem])) {
6964
6967
  let result = false;
6965
6968
  const whereValueFunction = typeof where[whereItem] === "string" ? where[whereItem]?.split('(') : '';
6969
+ // console.log('whereValueFunction', contentType, whereValueFunction?.[0]);
6966
6970
  if (whereValueFunction?.[0]) {
6967
6971
  switch (whereValueFunction[0]) {
6968
6972
  case 'between':
@@ -6988,6 +6992,7 @@ const getStaticData = (contentType, subSection, where) => createSelector(getData
6988
6992
  }
6989
6993
  }
6990
6994
  else {
6995
+ // console.log('fieldValue', contentType,fieldValue, where[whereItem]);
6991
6996
  result = fieldValue === where[whereItem];
6992
6997
  }
6993
6998
  return result;
@@ -7011,10 +7016,15 @@ const getStaticData = (contentType, subSection, where) => createSelector(getData
7011
7016
  }
7012
7017
  return list;
7013
7018
  });
7014
- const getStaticDataForListContentTypes = (contentTypes) => createSelector(getStaticDataState, (state) => {
7019
+ const getStaticDataForListContentTypes = (contentTypes, langId) => createSelector(getStaticDataState, (state) => {
7015
7020
  let result = {};
7016
7021
  contentTypes.forEach(contentType => {
7017
- result[contentType] = state.list[contentType]?.list || [];
7022
+ if (!langId) {
7023
+ result[contentType] = state.list[contentType]?.list || [];
7024
+ }
7025
+ else {
7026
+ result[contentType] = state.list[contentType]?.list?.filter(item => item._langId === langId) || [];
7027
+ }
7018
7028
  });
7019
7029
  return result;
7020
7030
  });
@@ -7066,8 +7076,8 @@ class StaticDataFacade {
7066
7076
  return this.store.pipe(select(staticDataQuery.getStaticData(contentType, subSection, where)));
7067
7077
  }));
7068
7078
  }
7069
- getStaticDataForListContentTypes$(contentTypes) {
7070
- return this.store.pipe(select(staticDataQuery.getStaticDataForListContentTypes(contentTypes)));
7079
+ getStaticDataForListContentTypes$(contentTypes, langId) {
7080
+ return this.store.pipe(select(staticDataQuery.getStaticDataForListContentTypes(contentTypes, langId)));
7071
7081
  }
7072
7082
  getStaticDataItem$(contentType, subSection = 'list', itemIdOrSlug, langId) {
7073
7083
  return this.store.pipe(select(staticDataQuery.getStaticDataItem(contentType, subSection, itemIdOrSlug, langId)));
@@ -7908,6 +7918,7 @@ class CacheDataEffects extends BaseEffects {
7908
7918
  headers: { token: headers.token, uid: headers.id },
7909
7919
  type: action.payload.type,
7910
7920
  revision: action.payload.revision,
7921
+ langId: action.payload.langId,
7911
7922
  };
7912
7923
  return this.cacheDataService.getCacheData(config)
7913
7924
  .pipe(flatMap((r) => new CacheDataGetBehavior(action, r).resolve()));
@@ -8141,7 +8152,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.14", ngImpo
8141
8152
  }], ctorParameters: () => [{ type: i1$1.Store }] });
8142
8153
 
8143
8154
  const getCacheDataState = createFeatureSelector(CACHE_DATA_FEATURE_KEY);
8144
- const getCacheData = (type) => createSelector(getCacheDataState, (state) => {
8155
+ const getCacheData = (type, langId) => createSelector(getCacheDataState, (state) => {
8145
8156
  return state[type] || null;
8146
8157
  });
8147
8158
  const cacheDataQuery = {
@@ -8152,14 +8163,15 @@ class CacheDataFacade {
8152
8163
  constructor(store) {
8153
8164
  this.store = store;
8154
8165
  }
8155
- getCacheData$(type) {
8156
- return this.store.pipe(select(cacheDataQuery.getCacheData(type)));
8166
+ getCacheData$(type, langId) {
8167
+ return this.store.pipe(select(cacheDataQuery.getCacheData(type, langId)));
8157
8168
  }
8158
- loadCacheData(type, revision) {
8169
+ loadCacheData(type, revision, langId) {
8159
8170
  this.store.dispatch(CacheDataGet({
8160
8171
  payload: {
8161
8172
  type,
8162
- revision
8173
+ revision,
8174
+ langId
8163
8175
  }
8164
8176
  }));
8165
8177
  }
@@ -15502,15 +15514,15 @@ class HeadersInterceptor {
15502
15514
  this.updateRequestData(request.urlWithParams, request.method, errResponse.error.error || errResponse.error.errorCode || errResponse.status, requestError, errResponse.error?.meta?.formId);
15503
15515
  const currentHost = this.getDomainByUrl(isPlatformBrowser(this.platformId) ? window.location.host : '');
15504
15516
  const requestDomain = this.getDomainByUrl(request.url);
15505
- if (errResponse.status !== 401) {
15506
- const notification = {
15507
- id: 5,
15508
- type: 'error',
15509
- text: 'Произошла ошибка выполнения запроса, проверьте правильность заполненных данных и повторите запрос.',
15510
- timeout: 10000
15511
- };
15512
- this.notificationsFacade.addNotifications(notification);
15513
- }
15517
+ /* if (errResponse.status !== 401) {
15518
+ const notification: NotificationModel = {
15519
+ id: 5,
15520
+ type: 'error',
15521
+ text: 'Произошла ошибка выполнения запроса, проверьте правильность заполненных данных и повторите запрос.',
15522
+ timeout: 10000
15523
+ };
15524
+ this.notificationsFacade.addNotifications(notification);
15525
+ }*/
15514
15526
  if (currentHost === requestDomain) {
15515
15527
  if (errResponse.status === 401) {
15516
15528
  return this.handle401Error(errResponse, userInfo, request, next);