@snabcentr/client-core 4.14.0 → 4.14.2

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.
@@ -2,7 +2,7 @@ import * as i1 from 'rxjs';
2
2
  import { of, startWith as startWith$1, Subject, ReplaySubject, partition, combineLatest, map as map$1, debounceTime, switchMap, tap, filter, shareReplay, distinctUntilChanged, BehaviorSubject, materialize, dematerialize, merge, distinctUntilKeyChanged, skip, first, catchError as catchError$1, throwError, expand, takeWhile, toArray, EMPTY, take, defaultIfEmpty, concatMap, finalize, takeUntil, timeout, interval, share, scan } from 'rxjs';
3
3
  import { map, startWith, catchError } from 'rxjs/operators';
4
4
  import { parseISO, parse, isValid, format } from 'date-fns';
5
- import { isString, isNil, isObject, isDate, isMatch, isArray, omit, get, isNumber, isBoolean } from 'lodash-es';
5
+ import { isString, constant, isNil, isObject, isDate, isMatch, isArray, omit, get, isNumber, isBoolean } from 'lodash-es';
6
6
  import * as i0 from '@angular/core';
7
7
  import { InjectionToken, inject, PLATFORM_ID, Inject, Optional, Injectable, EventEmitter, DestroyRef, LOCALE_ID, Pipe, RESPONSE_INIT, RendererFactory2 } from '@angular/core';
8
8
  import { WA_LOCAL_STORAGE, WA_USER_AGENT, WA_WINDOW } from '@ng-web-apis/common';
@@ -237,7 +237,7 @@ class ScPrimaryCatalogableItem extends ScHiddenCatalogableItem {
237
237
  */
238
238
  const SC_ACCESS_AUTH_TOKEN_STORAGE_KEY = new InjectionToken('accessAuthTokenStorageKey', {
239
239
  providedIn: 'root',
240
- factory: () => 'AccessAuth-Token',
240
+ factory: constant('AccessAuth-Token'),
241
241
  });
242
242
 
243
243
  /**
@@ -245,7 +245,7 @@ const SC_ACCESS_AUTH_TOKEN_STORAGE_KEY = new InjectionToken('accessAuthTokenStor
245
245
  */
246
246
  const SC_GUEST_TOKEN_STORAGE_KEY = new InjectionToken('guestTokenStorageKey', {
247
247
  providedIn: 'root',
248
- factory: () => 'Guest-Token',
248
+ factory: constant('Guest-Token'),
249
249
  });
250
250
 
251
251
  /**
@@ -253,7 +253,7 @@ const SC_GUEST_TOKEN_STORAGE_KEY = new InjectionToken('guestTokenStorageKey', {
253
253
  */
254
254
  const SC_REFRESH_AUTH_TOKEN_STORAGE_KEY = new InjectionToken('refreshAuthTokenStorageKey', {
255
255
  providedIn: 'root',
256
- factory: () => 'RefreshAuth-Token',
256
+ factory: constant('RefreshAuth-Token'),
257
257
  });
258
258
 
259
259
  /**
@@ -430,17 +430,17 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImpo
430
430
  *
431
431
  * Если указать `false`, то заголовки аутентификации будут проигнорированы при отправке запросов, не зависимо от значения {@link SC_IS_HEADER_REQUIRED}.
432
432
  */
433
- const SC_AUTH_ADD_HEADER_REQUIRED = new HttpContextToken(() => true);
433
+ const SC_AUTH_ADD_HEADER_REQUIRED = new HttpContextToken(constant(true));
434
434
 
435
435
  /**
436
436
  * Токен, указывающий, что выполняется запрос выхода из системы.
437
437
  */
438
- const SC_IS_LOGOUT_REQUEST = new HttpContextToken(() => false);
438
+ const SC_IS_LOGOUT_REQUEST = new HttpContextToken(constant(false));
439
439
 
440
440
  /**
441
441
  * Токен, указывающий, что выполняется запрос на обновление ключей доступа.
442
442
  */
443
- const SC_IS_REFRESH_REQUIRED = new HttpContextToken(() => false);
443
+ const SC_IS_REFRESH_REQUIRED = new HttpContextToken(constant(false));
444
444
 
445
445
  /**
446
446
  * Параметры по-умолчанию авторизации под клиентом.
@@ -503,13 +503,13 @@ const SC_CONFIGURATOR_SETTINGS = new InjectionToken('SC_CONFIGURATOR_SETTINGS');
503
503
  * Токен определяющий, идентификатор или символьное обозначение (slug) используется для роутинга и маршрутизации.
504
504
  */
505
505
  const SC_ID_OR_SLUG_IN_ROUTE = new InjectionToken('SC_ID_OR_SLUG_IN_ROUTE', {
506
- factory: () => 'id',
506
+ factory: constant('id'),
507
507
  });
508
508
 
509
509
  /**
510
510
  * Токен контекста запроса, указывающий на необходимость скрыть уведомление об ошибке.
511
511
  */
512
- const SC_IS_HIDDEN_ERROR_ALERT = new HttpContextToken(() => false);
512
+ const SC_IS_HIDDEN_ERROR_ALERT = new HttpContextToken(constant(false));
513
513
  /**
514
514
  * Контекст запроса, указывающий на необходимость скрыть уведомление об ошибке.
515
515
  */
@@ -1496,6 +1496,7 @@ class ScCatalogItem extends ScCatalogableItem {
1496
1496
  }
1497
1497
  }
1498
1498
 
1499
+ /* eslint-disable sonarjs/deprecation -- устаревшие члены используются внутри класса до завершения TASK[#10153] */
1499
1500
  /**
1500
1501
  * Модель данных категории товаров.
1501
1502
  */
@@ -2278,7 +2279,7 @@ function runningOnTerminalFactory(userAgentTerminal) {
2278
2279
  */
2279
2280
  const USER_AGENT_TERMINAL = new InjectionToken('USER_AGENT_TERMINAL', {
2280
2281
  providedIn: 'root',
2281
- factory: () => /sc_terminal_w/i,
2282
+ factory: constant(/sc_terminal_w/i),
2282
2283
  });
2283
2284
  /**
2284
2285
  * Провайдеры данных о терминале.
@@ -3108,7 +3109,7 @@ class ScVirtualCategory extends ScCatalogItem {
3108
3109
  * Токен, указывающий число первых записей товаров со скидкой.
3109
3110
  */
3110
3111
  const SC_COUNT_FIRST_DISCOUNTED_PRODUCTS = new InjectionToken('SC_COUNT_FIRST_DISCOUNTED_PRODUCTS', {
3111
- factory: () => 10,
3112
+ factory: constant(10),
3112
3113
  });
3113
3114
 
3114
3115
  /**
@@ -3312,6 +3313,7 @@ class ScCatalogService {
3312
3313
  * Очищает данные каталога, привязанные к текущему пользователю.
3313
3314
  */
3314
3315
  clearCache() {
3316
+ // eslint-disable-next-line sonarjs/deprecation -- idCategoryMap удаляется в рамках TASK[#10153]
3315
3317
  this.idCategoryMap.clear();
3316
3318
  this.categoryMap.clear();
3317
3319
  this.productHistoryMap.clear();
@@ -3329,10 +3331,13 @@ class ScCatalogService {
3329
3331
  * @param categoryIdOrSlug Идентификатор или slug категории товаров.
3330
3332
  */
3331
3333
  getCategoryFromMap(categoryIdOrSlug) {
3334
+ // eslint-disable-next-line sonarjs/deprecation -- deprecated API до TASK[#10153]
3332
3335
  const category = this.idCategoryMap.get(categoryIdOrSlug?.toString());
3336
+ // eslint-disable-next-line sonarjs/deprecation -- deprecated API до TASK[#10153]
3333
3337
  if (category && (!category.parentCategory || !category.loadedAt || category.cachedDataIsActual(this.cacheLifeTime.categoryData))) {
3334
3338
  return category;
3335
3339
  }
3340
+ // eslint-disable-next-line sonarjs/deprecation -- deprecated API до TASK[#10153]
3336
3341
  this.idCategoryMap.delete(categoryIdOrSlug?.toString());
3337
3342
  return undefined;
3338
3343
  }
@@ -4176,6 +4181,7 @@ class ScConfiguratorService {
4176
4181
  * @param editor Название конфигуратора.
4177
4182
  */
4178
4183
  getSettings$(categoryIdOrSlug, editor) {
4184
+ // eslint-disable-next-line sonarjs/deprecation -- getCategoryFromMap удаляется в рамках TASK[#10153]
4179
4185
  const category = this.catalogService.getCategoryFromMap(categoryIdOrSlug);
4180
4186
  if (category?.configuratorSettings) {
4181
4187
  return of(category.configuratorSettings);
@@ -4420,7 +4426,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.16", ngImpo
4420
4426
  /**
4421
4427
  * Токен, указывающий на необходимость добавления заголовков в исходящие запросы.
4422
4428
  */
4423
- const SC_IS_HEADER_REQUIRED = new HttpContextToken(() => true);
4429
+ const SC_IS_HEADER_REQUIRED = new HttpContextToken(constant(true));
4424
4430
 
4425
4431
  /**
4426
4432
  * Пайп для формирования полного URI изображения на media сервере.
@@ -5738,7 +5744,7 @@ const SC_GUEST_ENDPOINTS_TOKEN = new InjectionToken('SC_GUEST_ENDPOINTS_TOKEN',
5738
5744
  * Токен имени параметра, при котором кешируются запросы у гостя.
5739
5745
  */
5740
5746
  const SC_GUEST_PARAMETER_NAME_TOKEN = new InjectionToken('SC_GUEST_PARAMETER_NAME_TOKEN', {
5741
- factory: () => '',
5747
+ factory: constant(''),
5742
5748
  });
5743
5749
 
5744
5750
  /**
@@ -5850,7 +5856,6 @@ function ScConvertInterceptor(request, next) {
5850
5856
  error: objectToCamel(error.error),
5851
5857
  headers: error.headers,
5852
5858
  status: error.status,
5853
- statusText: error.statusText,
5854
5859
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
5855
5860
  url: error.url,
5856
5861
  }))));
@@ -6386,7 +6391,7 @@ class ScNews extends ScIdentity {
6386
6391
  */
6387
6392
  const SC_COUNT_LAST_NEWS = new InjectionToken('countLasNews', {
6388
6393
  providedIn: 'root',
6389
- factory: () => 4,
6394
+ factory: constant(4),
6390
6395
  });
6391
6396
 
6392
6397
  /**