@snabcentr/client-core 2.66.8 → 2.66.12

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.
@@ -1,5 +1,5 @@
1
1
  import { parseISO, parse, isValid, format } from 'date-fns';
2
- import { isString, isNil, isMatch, isArray } from 'lodash-es';
2
+ import { isString, isNil, isMatch, isArray, get } from 'lodash-es';
3
3
  import * as i0 from '@angular/core';
4
4
  import { InjectionToken, inject, PLATFORM_ID, Injectable, Inject, Optional, EventEmitter, LOCALE_ID, Pipe, RendererFactory2 } from '@angular/core';
5
5
  import { WA_LOCAL_STORAGE, WA_USER_AGENT, WA_WINDOW } from '@ng-web-apis/common';
@@ -4092,6 +4092,187 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
4092
4092
  */
4093
4093
  const SC_IS_HEADER_REQUIRED = new HttpContextToken(() => true);
4094
4094
 
4095
+ /**
4096
+ * Пайп для формирования полного URI изображения на media сервере.
4097
+ */
4098
+ class ScMediaImageTransformerPipe {
4099
+ constructor() {
4100
+ /**
4101
+ * Список ссылок на разделы backend'a.
4102
+ */
4103
+ this.urls = inject(SC_URLS);
4104
+ /**
4105
+ * Путь до изображения 'Товар не найден'.
4106
+ */
4107
+ this.pathImageNotFound = inject(SC_PATH_IMAGE_NOT_FOUND);
4108
+ }
4109
+ transform(image, useDefaultImage) {
4110
+ if (!image) {
4111
+ return useDefaultImage ? this.pathImageNotFound : undefined;
4112
+ }
4113
+ return image.startsWith('/') ? `${this.urls.imgServerUrl}${image}` : `${this.urls.imgServerUrl}/${image}`;
4114
+ }
4115
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ScMediaImageTransformerPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
4116
+ static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: ScMediaImageTransformerPipe, isStandalone: true, name: "scMediaImageTransformer" }); }
4117
+ }
4118
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ScMediaImageTransformerPipe, decorators: [{
4119
+ type: Pipe,
4120
+ args: [{
4121
+ name: 'scMediaImageTransformer',
4122
+ standalone: true,
4123
+ }]
4124
+ }] });
4125
+
4126
+ /**
4127
+ * Класс с вспомогательными методами для работы с изображениями.
4128
+ */
4129
+ class ScImageHelper {
4130
+ constructor() {
4131
+ /**
4132
+ * Список ссылок на разделы backend'a.
4133
+ */
4134
+ this.mediaImageTransformerPipe = inject(ScMediaImageTransformerPipe);
4135
+ }
4136
+ /**
4137
+ * Возвращает изображение товара по индексу.
4138
+ *
4139
+ * @param product Позиция товара/услуги.
4140
+ * @param imgIndex Индекс изображения в массиве.
4141
+ * @returns Возвращает изображение товара по индексу. Возвращает пути до изображения 'Товар не найден' {@link pathImageNotFound} если изображения по индексу не найдено.
4142
+ */
4143
+ getImage(product, imgIndex = 0) {
4144
+ return {
4145
+ image: this.mediaImageTransformerPipe.transform(product.getImage(imgIndex), true),
4146
+ alt: `${product.name} (${imgIndex + 1})`,
4147
+ imageWebp: this.mediaImageTransformerPipe.transform(product.getImageWebp(imgIndex), false),
4148
+ };
4149
+ }
4150
+ /**
4151
+ * Возвращает превью-изображение товара по индексу.
4152
+ *
4153
+ * @param product Позиция товара/услуги.
4154
+ * @param previewIndex Индекс превью-изображения в массиве.
4155
+ * @returns Возвращает превью-изображение товара по индексу. Возвращает основное изображение если превью-изображения по индексу не найдено.
4156
+ */
4157
+ getImagePreview(product, previewIndex = 0) {
4158
+ return {
4159
+ image: this.mediaImageTransformerPipe.transform(product.getImagePreview(previewIndex) ?? product.getImage(previewIndex), true),
4160
+ alt: `${product.name} (${previewIndex + 1})`,
4161
+ imageWebp: this.mediaImageTransformerPipe.transform(product.getImagePreviewWebp(previewIndex) ?? product.getImageWebp(previewIndex), false),
4162
+ };
4163
+ }
4164
+ getProductImageList(product, useDefaultImage) {
4165
+ const images = product.images?.filter((image) => image.image).map((_, index) => this.getImage(product, index));
4166
+ if (images?.length) {
4167
+ return images;
4168
+ }
4169
+ if (useDefaultImage) {
4170
+ return [
4171
+ new ScImage({
4172
+ image: this.mediaImageTransformerPipe.transform(undefined, true),
4173
+ alt: product.name,
4174
+ }),
4175
+ ];
4176
+ }
4177
+ return undefined;
4178
+ }
4179
+ getProductImagePreviewList(product, useDefaultImage) {
4180
+ const images = product.images?.filter((image) => image.preview).map((_, index) => this.getImagePreview(product, index));
4181
+ if (images?.length) {
4182
+ return images;
4183
+ }
4184
+ if (useDefaultImage) {
4185
+ return [
4186
+ new ScImage({
4187
+ image: this.mediaImageTransformerPipe.transform(undefined, true),
4188
+ alt: product.name,
4189
+ }),
4190
+ ];
4191
+ }
4192
+ return undefined;
4193
+ }
4194
+ /**
4195
+ * Возвращает признак того, что файл является изображением.
4196
+ *
4197
+ * @param format Формат файла.
4198
+ */
4199
+ // eslint-disable-next-line class-methods-use-this
4200
+ isImg(format) {
4201
+ return ['jpeg', 'jpg', 'png', 'gif', 'bmp', 'tiff', 'webp'].includes(format);
4202
+ }
4203
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ScImageHelper, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
4204
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ScImageHelper, providedIn: 'root' }); }
4205
+ }
4206
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ScImageHelper, decorators: [{
4207
+ type: Injectable,
4208
+ args: [{
4209
+ providedIn: 'root',
4210
+ }]
4211
+ }] });
4212
+
4213
+ /**
4214
+ * Клас-помощник для работы со значениями единиц измерения товара.
4215
+ */
4216
+ class ScUnitsHelper {
4217
+ /**
4218
+ * Инициирует экземпляр класса {@link ScUnitsHelper}.
4219
+ *
4220
+ * @param linearValues Единицы измерения линейной величины.
4221
+ */
4222
+ constructor(linearValues) {
4223
+ this.linearValues = linearValues;
4224
+ }
4225
+ /**
4226
+ * Возвращает признак возможности продажи товара на метраж.
4227
+ *
4228
+ * @param product Товар для которого нужно проверить возможность продажи на метраж.
4229
+ */
4230
+ productIsMeasurable(product) {
4231
+ return this.linearValues.includes(product.unit.name);
4232
+ }
4233
+ /**
4234
+ * Возвращает кратность количества для товара.
4235
+ *
4236
+ * @param product Товар для которого нужно вернуть кратность количества.
4237
+ */
4238
+ productMultiplicity(product) {
4239
+ return product.minCount && !this.linearValues.includes(product.unit.name) ? product.minCount : 1;
4240
+ }
4241
+ /**
4242
+ * Возвращает значение кратности, для проверки кратности количества товара.
4243
+ *
4244
+ * @param product Товар для которого нужно вернуть значение кратность.
4245
+ */
4246
+ productStepForValidator(product) {
4247
+ return product.ignoreMinCountCheck ? 1 : this.productMultiplicity(product);
4248
+ }
4249
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ScUnitsHelper, deps: [{ token: SC_LINEAR_VALUES_TOKEN }], target: i0.ɵɵFactoryTarget.Injectable }); }
4250
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ScUnitsHelper, providedIn: 'root' }); }
4251
+ }
4252
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ScUnitsHelper, decorators: [{
4253
+ type: Injectable,
4254
+ args: [{
4255
+ providedIn: 'root',
4256
+ }]
4257
+ }], ctorParameters: () => [{ type: undefined, decorators: [{
4258
+ type: Inject,
4259
+ args: [SC_LINEAR_VALUES_TOKEN]
4260
+ }] }] });
4261
+
4262
+ /**
4263
+ * Возвращает текущий маршрут.
4264
+ * Функция проходит по дереву маршрутов начиная с переданного route и возвращает самый вложенный активный маршрут.
4265
+ *
4266
+ * @param route Данные маршрута, от которого ищем текущий маршрут в приложении.
4267
+ */
4268
+ const scGetCurrentRoute = (route) => {
4269
+ let currentRoute = route;
4270
+ while (currentRoute.firstChild) {
4271
+ currentRoute = currentRoute.firstChild;
4272
+ }
4273
+ return currentRoute;
4274
+ };
4275
+
4095
4276
  /**
4096
4277
  * Токен потока данных о категории.
4097
4278
  */
@@ -4099,13 +4280,11 @@ const SC_CATEGORY_INFO = new InjectionToken('A stream with current category info
4099
4280
  /**
4100
4281
  * Фабрика создания потока данных о категории.
4101
4282
  *
4102
- * @param paramMap Параметры.
4103
- * @param paramMap.paramMap Параметры.
4283
+ * @param route Маршрут.
4104
4284
  * @param catalogService Сервис для работы с каталогом.
4105
- * @param catalogService.paramMap Параметры.
4106
4285
  */
4107
- function categoryFactory({ paramMap }, catalogService) {
4108
- return paramMap.pipe(map((parameters) => parameters.get('categoryIdOrSlug')), filter(tuiIsPresent), switchMap((categoryId) => catalogService.getCategoryCached$(categoryId).pipe(shareReplay())), takeUntilDestroyed());
4286
+ function categoryFactory(route, catalogService) {
4287
+ return scGetCurrentRoute(route).paramMap.pipe(map((parameters) => parameters.get('categoryIdOrSlug')), filter(tuiIsPresent), switchMap((categoryId) => catalogService.getCategoryCached$(categoryId).pipe(shareReplay())), takeUntilDestroyed());
4109
4288
  }
4110
4289
  /**
4111
4290
  * Провайдеры потока данных о категории.
@@ -5182,173 +5361,6 @@ const ScIdOrSlugGuard = (route) => {
5182
5361
  return true;
5183
5362
  };
5184
5363
 
5185
- /**
5186
- * Пайп для формирования полного URI изображения на media сервере.
5187
- */
5188
- class ScMediaImageTransformerPipe {
5189
- constructor() {
5190
- /**
5191
- * Список ссылок на разделы backend'a.
5192
- */
5193
- this.urls = inject(SC_URLS);
5194
- /**
5195
- * Путь до изображения 'Товар не найден'.
5196
- */
5197
- this.pathImageNotFound = inject(SC_PATH_IMAGE_NOT_FOUND);
5198
- }
5199
- transform(image, useDefaultImage) {
5200
- if (!image) {
5201
- return useDefaultImage ? this.pathImageNotFound : undefined;
5202
- }
5203
- return image.startsWith('/') ? `${this.urls.imgServerUrl}${image}` : `${this.urls.imgServerUrl}/${image}`;
5204
- }
5205
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ScMediaImageTransformerPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
5206
- static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "18.2.14", ngImport: i0, type: ScMediaImageTransformerPipe, isStandalone: true, name: "scMediaImageTransformer" }); }
5207
- }
5208
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ScMediaImageTransformerPipe, decorators: [{
5209
- type: Pipe,
5210
- args: [{
5211
- name: 'scMediaImageTransformer',
5212
- standalone: true,
5213
- }]
5214
- }] });
5215
-
5216
- /**
5217
- * Класс с вспомогательными методами для работы с изображениями.
5218
- */
5219
- class ScImageHelper {
5220
- constructor() {
5221
- /**
5222
- * Список ссылок на разделы backend'a.
5223
- */
5224
- this.mediaImageTransformerPipe = inject(ScMediaImageTransformerPipe);
5225
- }
5226
- /**
5227
- * Возвращает изображение товара по индексу.
5228
- *
5229
- * @param product Позиция товара/услуги.
5230
- * @param imgIndex Индекс изображения в массиве.
5231
- * @returns Возвращает изображение товара по индексу. Возвращает пути до изображения 'Товар не найден' {@link pathImageNotFound} если изображения по индексу не найдено.
5232
- */
5233
- getImage(product, imgIndex = 0) {
5234
- return {
5235
- image: this.mediaImageTransformerPipe.transform(product.getImage(imgIndex), true),
5236
- alt: `${product.name} (${imgIndex + 1})`,
5237
- imageWebp: this.mediaImageTransformerPipe.transform(product.getImageWebp(imgIndex), false),
5238
- };
5239
- }
5240
- /**
5241
- * Возвращает превью-изображение товара по индексу.
5242
- *
5243
- * @param product Позиция товара/услуги.
5244
- * @param previewIndex Индекс превью-изображения в массиве.
5245
- * @returns Возвращает превью-изображение товара по индексу. Возвращает основное изображение если превью-изображения по индексу не найдено.
5246
- */
5247
- getImagePreview(product, previewIndex = 0) {
5248
- return {
5249
- image: this.mediaImageTransformerPipe.transform(product.getImagePreview(previewIndex) ?? product.getImage(previewIndex), true),
5250
- alt: `${product.name} (${previewIndex + 1})`,
5251
- imageWebp: this.mediaImageTransformerPipe.transform(product.getImagePreviewWebp(previewIndex) ?? product.getImageWebp(previewIndex), false),
5252
- };
5253
- }
5254
- getProductImageList(product, useDefaultImage) {
5255
- const images = product.images?.filter((image) => image.image).map((_, index) => this.getImage(product, index));
5256
- if (images?.length) {
5257
- return images;
5258
- }
5259
- if (useDefaultImage) {
5260
- return [
5261
- new ScImage({
5262
- image: this.mediaImageTransformerPipe.transform(undefined, true),
5263
- alt: product.name,
5264
- }),
5265
- ];
5266
- }
5267
- return undefined;
5268
- }
5269
- getProductImagePreviewList(product, useDefaultImage) {
5270
- const images = product.images?.filter((image) => image.preview).map((_, index) => this.getImagePreview(product, index));
5271
- if (images?.length) {
5272
- return images;
5273
- }
5274
- if (useDefaultImage) {
5275
- return [
5276
- new ScImage({
5277
- image: this.mediaImageTransformerPipe.transform(undefined, true),
5278
- alt: product.name,
5279
- }),
5280
- ];
5281
- }
5282
- return undefined;
5283
- }
5284
- /**
5285
- * Возвращает признак того, что файл является изображением.
5286
- *
5287
- * @param format Формат файла.
5288
- */
5289
- // eslint-disable-next-line class-methods-use-this
5290
- isImg(format) {
5291
- return ['jpeg', 'jpg', 'png', 'gif', 'bmp', 'tiff', 'webp'].includes(format);
5292
- }
5293
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ScImageHelper, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
5294
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ScImageHelper, providedIn: 'root' }); }
5295
- }
5296
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ScImageHelper, decorators: [{
5297
- type: Injectable,
5298
- args: [{
5299
- providedIn: 'root',
5300
- }]
5301
- }] });
5302
-
5303
- /**
5304
- * Клас-помощник для работы со значениями единиц измерения товара.
5305
- */
5306
- class ScUnitsHelper {
5307
- /**
5308
- * Инициирует экземпляр класса {@link ScUnitsHelper}.
5309
- *
5310
- * @param linearValues Единицы измерения линейной величины.
5311
- */
5312
- constructor(linearValues) {
5313
- this.linearValues = linearValues;
5314
- }
5315
- /**
5316
- * Возвращает признак возможности продажи товара на метраж.
5317
- *
5318
- * @param product Товар для которого нужно проверить возможность продажи на метраж.
5319
- */
5320
- productIsMeasurable(product) {
5321
- return this.linearValues.includes(product.unit.name);
5322
- }
5323
- /**
5324
- * Возвращает кратность количества для товара.
5325
- *
5326
- * @param product Товар для которого нужно вернуть кратность количества.
5327
- */
5328
- productMultiplicity(product) {
5329
- return product.minCount && !this.linearValues.includes(product.unit.name) ? product.minCount : 1;
5330
- }
5331
- /**
5332
- * Возвращает значение кратности, для проверки кратности количества товара.
5333
- *
5334
- * @param product Товар для которого нужно вернуть значение кратность.
5335
- */
5336
- productStepForValidator(product) {
5337
- return product.ignoreMinCountCheck ? 1 : this.productMultiplicity(product);
5338
- }
5339
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ScUnitsHelper, deps: [{ token: SC_LINEAR_VALUES_TOKEN }], target: i0.ɵɵFactoryTarget.Injectable }); }
5340
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ScUnitsHelper, providedIn: 'root' }); }
5341
- }
5342
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: ScUnitsHelper, decorators: [{
5343
- type: Injectable,
5344
- args: [{
5345
- providedIn: 'root',
5346
- }]
5347
- }], ctorParameters: () => [{ type: undefined, decorators: [{
5348
- type: Inject,
5349
- args: [SC_LINEAR_VALUES_TOKEN]
5350
- }] }] });
5351
-
5352
5364
  /**
5353
5365
  * Модель данных настроек кэширования запросов.
5354
5366
  */
@@ -7635,10 +7647,6 @@ class ScSeoService {
7635
7647
  * Метаданные страницы каталога по умолчанию.
7636
7648
  */
7637
7649
  this.catalogDefaultSeo = inject(SC_CATALOG_PAGE_META);
7638
- /**
7639
- * Признак необходимости использовать Id или Slug при маршрутизации.
7640
- */
7641
- this.idOrSlugInRoute = inject(SC_ID_OR_SLUG_IN_ROUTE);
7642
7650
  /**
7643
7651
  * Список ссылок приложения.
7644
7652
  */
@@ -7685,14 +7693,15 @@ class ScSeoService {
7685
7693
  */
7686
7694
  setFromResource(resource, img = this.urls.logoUrl, robots = ['index', 'follow']) {
7687
7695
  const updatedResource = {
7688
- title: resource?.title ?? this.defaultSeo.title,
7689
- description: resource?.description ?? this.defaultSeo.description,
7696
+ title: this.replaceTemplates(resource?.title ?? this.defaultSeo.title, resource?.instanceData ?? {}),
7697
+ description: this.replaceTemplates(resource?.description ?? this.defaultSeo.description, resource?.instanceData ?? {}),
7690
7698
  keywords: resource?.keywords ?? this.defaultSeo.keywords,
7691
7699
  meta: resource?.meta ?? [],
7692
7700
  };
7693
7701
  const url = `${this.urls.siteUrl}${this.router.url}`;
7694
7702
  this.setMetaTags(updatedResource.title, updatedResource.description, updatedResource.keywords, updatedResource.meta, robots);
7695
7703
  this.setOpenGraphMetaTags(updatedResource.title, updatedResource.description, url, img);
7704
+ this.setCanonicalLink(url);
7696
7705
  }
7697
7706
  /**
7698
7707
  * Устанавливает seo параметры со значением по умолчанию.
@@ -7703,7 +7712,7 @@ class ScSeoService {
7703
7712
  setByDefault(title, robots = ['index', 'follow']) {
7704
7713
  this.setFromResource({
7705
7714
  title: `${title ?? this.defaultSeo.title} - ${this.companyInfo.name}`,
7706
- description: `${title}, ${this.defaultSeo.description}`,
7715
+ description: title ? `${title}, ${this.defaultSeo.description}` : this.defaultSeo.description,
7707
7716
  }, this.urls.logoUrl, robots);
7708
7717
  }
7709
7718
  /**
@@ -7723,23 +7732,38 @@ class ScSeoService {
7723
7732
  */
7724
7733
  setForCatalogItem(item, urlPath, schemaOrgData) {
7725
7734
  const url = `${this.urls.siteUrl}${urlPath.replace(':id', this.idOrSlugPipe.transform(item).toString())}`;
7726
- const title = item.seo?.title ?? `${item.name} - Купить в ${this.companyInfo.name}`;
7727
- const description = item.seo?.description ?? `${item.name} - Купить по выгодным ценам в ${this.companyInfo.name}`;
7735
+ const title = this.replaceTemplates(item.seo?.title ?? `${item.name} - Купить в ${this.companyInfo.name}`, item);
7736
+ const description = this.replaceTemplates(item.seo?.description ?? `${item.name} - Купить по выгодным ценам в ${this.companyInfo.name}`, item);
7728
7737
  const keywords = item.seo?.keywords ?? `${item.name}, ${this.catalogDefaultSeo.keywords}`;
7729
7738
  const meta = item.seo?.meta ?? [];
7730
- // Устанавливаем стандартные seo-параметры.
7739
+ // Устанавливаем стандартные seo-параметры, в том числе и каноническую ссылку.
7731
7740
  this.setMetaTags(title, description, keywords, meta, ['index', 'follow']);
7732
7741
  this.setOpenGraphMetaTags(title, description, url, this.mediaImageTransformerPipe.transform(item.image, true));
7733
- // В том случае, если используется slug для формирования ссылок, то необходимо сформировать кононическую
7734
- // ссылку на страницу в которой используется slug (а не id).
7735
- if (this.idOrSlugInRoute === 'slug' && item.id && item.slug) {
7736
- this.setCanonicalLink(url);
7737
- }
7742
+ this.setCanonicalLink(url);
7738
7743
  // Устанавливаем Schema.org параметры.
7739
7744
  if (schemaOrgData) {
7740
7745
  this.setSchemaOrgData(schemaOrgData);
7741
7746
  }
7742
7747
  }
7748
+ /**
7749
+ * Заменяет шаблоны в тексте на значения из объекта.
7750
+ *
7751
+ * @param text Текст с шаблонами.
7752
+ * @param instanceData Объект с данными для замены.
7753
+ */
7754
+ // eslint-disable-next-line class-methods-use-this
7755
+ replaceTemplates(text, instanceData) {
7756
+ return text.replaceAll(/\$\{([^}]+)\}/g, (_template, fieldPathVariants) => {
7757
+ const value = fieldPathVariants
7758
+ .split('|')
7759
+ .map((fieldPath) => fieldPath.trim())
7760
+ .filter(Boolean)
7761
+ .map((fieldPath) => get(instanceData, fieldPath))
7762
+ .find((fieldValue) => !isNil(fieldValue));
7763
+ // eslint-disable-next-line sonarjs/no-nested-conditional
7764
+ return isNil(value) ? '' : isString(value) ? value : String(value);
7765
+ });
7766
+ }
7743
7767
  /**
7744
7768
  * Устанавливает все meta-теги страницы. Если какой-либо из параметров не указан, для него устанавливается значение по умолчанию.
7745
7769
  *
@@ -8201,5 +8225,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
8201
8225
  * Generated bundle index. Do not edit.
8202
8226
  */
8203
8227
 
8204
- export { CATEGORY_PROVIDERS, EMPTY_CART, IS_BROWSER, IS_RUNNING_ON_TERMINAL, IS_SERVER, RESPONSE, SC_ACCESS_AUTH_TOKEN_STORAGE_KEY, SC_API_KEYS, SC_AUTH_ADD_HEADER_REQUIRED, SC_AUTH_AS_CLIENT_DEFAULT_OPTIONS, SC_AUTH_AS_CLIENT_OPTIONS, SC_CACHE_LIFETIME, SC_CACHE_SETTINGS, SC_CATALOG_PAGE_META, SC_CATEGORY_INFO, SC_COMPANY_INFO, SC_COMPANY_NAME, SC_CONFIGURATOR_COMPONENTS, SC_CONFIGURATOR_SETTINGS, SC_COUNT_FIRST_DISCOUNTED_PRODUCTS, SC_COUNT_LAST_NEWS, SC_DATE_FORMAT, SC_DEFAULT_PAGE_META, SC_FEEDBACK_API, SC_GUEST_ENDPOINTS_TOKEN, SC_GUEST_PARAMETER_NAME_TOKEN, SC_GUEST_TOKEN_STORAGE_KEY, SC_ID_OR_SLUG_IN_ROUTE, SC_IS_HEADER_REQUIRED, SC_IS_HIDDEN_ERROR_ALERT, SC_IS_HIDDEN_ERROR_ALERT_HTTP_CONTEXT, SC_IS_LOGOUT_REQUEST, SC_IS_REFRESH_REQUIRED, SC_LINEAR_VALUES, SC_LINEAR_VALUES_TOKEN, SC_MAX_LENGTH_SEARCH_TERM, SC_MIN_LENGTH_SEARCH_TERM, SC_NEXT_PAGE_PAGINATION_CLICK, SC_ORDER_LOADER, SC_ORDER_LOADING, SC_PATH_IMAGE_NOT_FOUND, SC_PRODUCT_PAGINATION_DEFAULT_OPTIONS, SC_PRODUCT_PAGINATION_OPTIONS, SC_REFRESH_AUTH_TOKEN_STORAGE_KEY, SC_RELEASE, SC_UPDATE_INTERVAL, SC_URLS, SC_USER_INFO, SC_VACANCIES_DATA_SOURCE, SC_VIRTUAL_CATEGORY_INFO, SC_VIRTUAL_CATEGORY_PROVIDERS, SEARCH_TERM, SEARCH_TERM_PROVIDERS, ScAuthAsClientGuard, ScAuthInterceptor, ScAuthService, ScBanner, ScBannerService, ScCacheInterceptor, ScCacheSettings, ScCachedData, ScCachedItem, ScCart, ScCartService, ScCatalogFilterService, ScCatalogFormat, ScCatalogItem, ScCatalogService, ScCatalogableItem, ScCategory, ScClientType, ScCodedIdentity, ScConfiguratorService, ScContactsService, ScContragentService, ScConvertInterceptor, ScConvertersService, ScDateFormatInterceptor, ScDeletableNamedIdentity, ScDeliveryAddressService, ScDeliveryCost, ScDeliveryType, ScDocumentInfoNode, ScDocumentInfoTypesEnum, ScErrorsInterceptor, ScFavoriteService, ScFeedbackForms, ScFeedbackService, ScFilesService, ScFrequentlyAskedQuestionsService, ScGuestInterceptor, ScHiddenCatalogableItem, ScIBreadcrumbItem, ScISuggestionType, ScIconTypesEnum, ScIdOrSlugGuard, ScIdOrSlugPipe, ScIdentity, ScImage, ScImageHelper, ScLocationsService, ScMediaImageTransformerPipe, ScMimeTypes, ScNamedIdentity, ScNews, ScNewsService, ScNotificationActionTypes, ScNotificationLevelNames, ScNotificationsService, ScOpfList, ScOptionsInterceptor, ScOrder, ScOrderBase, ScOrderDraft, ScOrderDraftShort, ScOrderDraftType, ScOrderDraftsService, ScOrderItem, ScOrderShort, ScOrderStateStatus, ScOrdersService, ScPaginationService, ScPaymentStatus, ScPaymentType, ScPhoneService, ScPrimaryCatalogableItem, ScProduct, ScProductTileType, ScQuestionnaireService, ScQuestionnaireStatusEnum, ScReclamationService, ScReclamationStatus, ScRecommendationService, ScReference, ScReferenceName, ScReferencesService, ScRequisitesService, ScRouteKeys, ScSearchService, ScSeoService, ScSocialType, ScSuggestionService, ScSum, ScTokenService, ScUIService, ScUTMService, ScUnitsHelper, ScUpdatableNamedIdentity, ScUploadedFile, ScUser, ScUserMetadata, ScUserMetrikaGoalsEnum, ScUserMetrikaService, ScUserService, ScUserType, ScVCardService, ScVacanciesList, ScVacanciesService, ScVacancy, ScVerificationService, ScVirtualCategory, ScWarehouseService, SchemaOrgFactory, TERMINAL_PROVIDERS, USER_AGENT_TERMINAL, filterChangedByKey, loadingPlaceholder, runningOnTerminalFactory, scOrderIsLoaded, searchTermFactory };
8228
+ export { CATEGORY_PROVIDERS, EMPTY_CART, IS_BROWSER, IS_RUNNING_ON_TERMINAL, IS_SERVER, RESPONSE, SC_ACCESS_AUTH_TOKEN_STORAGE_KEY, SC_API_KEYS, SC_AUTH_ADD_HEADER_REQUIRED, SC_AUTH_AS_CLIENT_DEFAULT_OPTIONS, SC_AUTH_AS_CLIENT_OPTIONS, SC_CACHE_LIFETIME, SC_CACHE_SETTINGS, SC_CATALOG_PAGE_META, SC_CATEGORY_INFO, SC_COMPANY_INFO, SC_COMPANY_NAME, SC_CONFIGURATOR_COMPONENTS, SC_CONFIGURATOR_SETTINGS, SC_COUNT_FIRST_DISCOUNTED_PRODUCTS, SC_COUNT_LAST_NEWS, SC_DATE_FORMAT, SC_DEFAULT_PAGE_META, SC_FEEDBACK_API, SC_GUEST_ENDPOINTS_TOKEN, SC_GUEST_PARAMETER_NAME_TOKEN, SC_GUEST_TOKEN_STORAGE_KEY, SC_ID_OR_SLUG_IN_ROUTE, SC_IS_HEADER_REQUIRED, SC_IS_HIDDEN_ERROR_ALERT, SC_IS_HIDDEN_ERROR_ALERT_HTTP_CONTEXT, SC_IS_LOGOUT_REQUEST, SC_IS_REFRESH_REQUIRED, SC_LINEAR_VALUES, SC_LINEAR_VALUES_TOKEN, SC_MAX_LENGTH_SEARCH_TERM, SC_MIN_LENGTH_SEARCH_TERM, SC_NEXT_PAGE_PAGINATION_CLICK, SC_ORDER_LOADER, SC_ORDER_LOADING, SC_PATH_IMAGE_NOT_FOUND, SC_PRODUCT_PAGINATION_DEFAULT_OPTIONS, SC_PRODUCT_PAGINATION_OPTIONS, SC_REFRESH_AUTH_TOKEN_STORAGE_KEY, SC_RELEASE, SC_UPDATE_INTERVAL, SC_URLS, SC_USER_INFO, SC_VACANCIES_DATA_SOURCE, SC_VIRTUAL_CATEGORY_INFO, SC_VIRTUAL_CATEGORY_PROVIDERS, SEARCH_TERM, SEARCH_TERM_PROVIDERS, ScAuthAsClientGuard, ScAuthInterceptor, ScAuthService, ScBanner, ScBannerService, ScCacheInterceptor, ScCacheSettings, ScCachedData, ScCachedItem, ScCart, ScCartService, ScCatalogFilterService, ScCatalogFormat, ScCatalogItem, ScCatalogService, ScCatalogableItem, ScCategory, ScClientType, ScCodedIdentity, ScConfiguratorService, ScContactsService, ScContragentService, ScConvertInterceptor, ScConvertersService, ScDateFormatInterceptor, ScDeletableNamedIdentity, ScDeliveryAddressService, ScDeliveryCost, ScDeliveryType, ScDocumentInfoNode, ScDocumentInfoTypesEnum, ScErrorsInterceptor, ScFavoriteService, ScFeedbackForms, ScFeedbackService, ScFilesService, ScFrequentlyAskedQuestionsService, ScGuestInterceptor, ScHiddenCatalogableItem, ScIBreadcrumbItem, ScISuggestionType, ScIconTypesEnum, ScIdOrSlugGuard, ScIdOrSlugPipe, ScIdentity, ScImage, ScImageHelper, ScLocationsService, ScMediaImageTransformerPipe, ScMimeTypes, ScNamedIdentity, ScNews, ScNewsService, ScNotificationActionTypes, ScNotificationLevelNames, ScNotificationsService, ScOpfList, ScOptionsInterceptor, ScOrder, ScOrderBase, ScOrderDraft, ScOrderDraftShort, ScOrderDraftType, ScOrderDraftsService, ScOrderItem, ScOrderShort, ScOrderStateStatus, ScOrdersService, ScPaginationService, ScPaymentStatus, ScPaymentType, ScPhoneService, ScPrimaryCatalogableItem, ScProduct, ScProductTileType, ScQuestionnaireService, ScQuestionnaireStatusEnum, ScReclamationService, ScReclamationStatus, ScRecommendationService, ScReference, ScReferenceName, ScReferencesService, ScRequisitesService, ScRouteKeys, ScSearchService, ScSeoService, ScSocialType, ScSuggestionService, ScSum, ScTokenService, ScUIService, ScUTMService, ScUnitsHelper, ScUpdatableNamedIdentity, ScUploadedFile, ScUser, ScUserMetadata, ScUserMetrikaGoalsEnum, ScUserMetrikaService, ScUserService, ScUserType, ScVCardService, ScVacanciesList, ScVacanciesService, ScVacancy, ScVerificationService, ScVirtualCategory, ScWarehouseService, SchemaOrgFactory, TERMINAL_PROVIDERS, USER_AGENT_TERMINAL, filterChangedByKey, loadingPlaceholder, runningOnTerminalFactory, scGetCurrentRoute, scOrderIsLoaded, searchTermFactory };
8205
8229
  //# sourceMappingURL=snabcentr-client-core.mjs.map