@snabcentr/client-core 4.11.0 → 4.13.0
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.
|
@@ -7082,9 +7082,36 @@ class ScOrderDraftsService {
|
|
|
7082
7082
|
params: { offer_id: offerId, order_id: order.id },
|
|
7083
7083
|
});
|
|
7084
7084
|
});
|
|
7085
|
-
this.
|
|
7085
|
+
this.removeOrderedProductsFromCache(offerId, data.items ?? []);
|
|
7086
7086
|
}));
|
|
7087
7087
|
}
|
|
7088
|
+
/**
|
|
7089
|
+
* Убирает заказанные позиции из кэша черновика локально (сервер сразу после заказа ещё может вернуть их в списке).
|
|
7090
|
+
*
|
|
7091
|
+
* @param offerId Идентификатор черновика.
|
|
7092
|
+
* @param orderedItemIds Идентификаторы заказанных позиций.
|
|
7093
|
+
*/
|
|
7094
|
+
removeOrderedProductsFromCache(offerId, orderedItemIds) {
|
|
7095
|
+
const cachedItem = this.offerMap.get(offerId);
|
|
7096
|
+
if (!cachedItem || orderedItemIds.length === 0) {
|
|
7097
|
+
return;
|
|
7098
|
+
}
|
|
7099
|
+
const orderedIds = new Set(orderedItemIds.map(String));
|
|
7100
|
+
cachedItem.item$.pipe(take(1)).subscribe((draft) => {
|
|
7101
|
+
if (draft === loadingPlaceholder) {
|
|
7102
|
+
return;
|
|
7103
|
+
}
|
|
7104
|
+
const currentDraft = draft;
|
|
7105
|
+
const remainingProducts = currentDraft.products.filter((product) => !orderedIds.has(product.id));
|
|
7106
|
+
if (remainingProducts.length === currentDraft.products.length) {
|
|
7107
|
+
return;
|
|
7108
|
+
}
|
|
7109
|
+
const updatedDraft = new ScOrderDraft(currentDraft);
|
|
7110
|
+
updatedDraft.products = remainingProducts;
|
|
7111
|
+
updatedDraft.sum = remainingProducts.reduce((sum, product) => sum + product.costRub, 0);
|
|
7112
|
+
cachedItem.setValue(updatedDraft);
|
|
7113
|
+
});
|
|
7114
|
+
}
|
|
7088
7115
|
/**
|
|
7089
7116
|
* Добавляет продукт в коммерческое предложение/черновик.
|
|
7090
7117
|
*
|
|
@@ -7382,6 +7409,9 @@ class ScPaginationService {
|
|
|
7382
7409
|
* Список сохраняется при переходе по страницам, до тех пор пока не будет получен сигнал `others$`.
|
|
7383
7410
|
*/
|
|
7384
7411
|
this.dataAccumulated$ = this.others$.pipe(filter(tuiIsPresent), switchMap((params) => this.authStatus$.pipe(map$1(() => params))), switchMap((params) => this.page$.pipe(
|
|
7412
|
+
// Избегаем лишнего запроса со старыми параметрами: сброс страницы (patchPage) при смене others$ синхронно
|
|
7413
|
+
// «пинает» ещё живую предыдущую подписку — debounceTime(0) схлопывает такой всплеск до одной эмиссии.
|
|
7414
|
+
debounceTime(0),
|
|
7385
7415
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/no-unsafe-assignment
|
|
7386
7416
|
map$1((page) => ({ ...params, ...page })),
|
|
7387
7417
|
// TODO: Заменить this.catalogService.getProducts$ на абстрактный метод сервиса по примеру `TuiTreeLoader`.
|
|
@@ -7717,7 +7747,7 @@ class SchemaOrgFactory {
|
|
|
7717
7747
|
...(id && { '@id': id }),
|
|
7718
7748
|
name: product.name,
|
|
7719
7749
|
...(image && { image }),
|
|
7720
|
-
...(description && { description }),
|
|
7750
|
+
...(description && { description: this.stripHtml(description) }),
|
|
7721
7751
|
mpn: product.code,
|
|
7722
7752
|
url: productUrl,
|
|
7723
7753
|
offers: {
|
|
@@ -7746,7 +7776,8 @@ class SchemaOrgFactory {
|
|
|
7746
7776
|
* @param id Необязательный идентификатор сущности для поля `@id` в JSON-LD.
|
|
7747
7777
|
*/
|
|
7748
7778
|
generateForCategoryItem(category, products, categoryPath, productPath, breadcrumbs, id) {
|
|
7749
|
-
const
|
|
7779
|
+
const descriptionRaw = category.seo?.description ?? category.properties?.description;
|
|
7780
|
+
const description = descriptionRaw ? this.stripHtml(descriptionRaw) : undefined;
|
|
7750
7781
|
const image = this.mediaImageTransformerPipe.transform(category.image, true);
|
|
7751
7782
|
return {
|
|
7752
7783
|
'@context': 'https://schema.org',
|
|
@@ -7865,7 +7896,7 @@ class SchemaOrgFactory {
|
|
|
7865
7896
|
'@type': 'NewsArticle',
|
|
7866
7897
|
...(id && { '@id': id }),
|
|
7867
7898
|
headline,
|
|
7868
|
-
...(description && { description }),
|
|
7899
|
+
...(description && { description: this.stripHtml(description) }),
|
|
7869
7900
|
...(image && { image }),
|
|
7870
7901
|
...(datePublished && { datePublished }),
|
|
7871
7902
|
...(articleBody && { articleBody }),
|
|
@@ -7997,6 +8028,7 @@ class SchemaOrgFactory {
|
|
|
7997
8028
|
})
|
|
7998
8029
|
.join('');
|
|
7999
8030
|
return withoutTags
|
|
8031
|
+
.replaceAll(/ /gi, ' ')
|
|
8000
8032
|
.replaceAll(/\s+/g, ' ')
|
|
8001
8033
|
.replaceAll(/ ([.,!?;:])/g, '$1')
|
|
8002
8034
|
.trim();
|
|
@@ -8092,7 +8124,7 @@ class SchemaOrgFactory {
|
|
|
8092
8124
|
name: product.name,
|
|
8093
8125
|
url: productUrl,
|
|
8094
8126
|
...(image && { image }),
|
|
8095
|
-
...(description && { description }),
|
|
8127
|
+
...(description && { description: this.stripHtml(description) }),
|
|
8096
8128
|
offers: {
|
|
8097
8129
|
'@type': 'Offer',
|
|
8098
8130
|
priceCurrency: 'RUB',
|
|
@@ -8138,7 +8170,7 @@ class SchemaOrgFactory {
|
|
|
8138
8170
|
name: subCategory.name,
|
|
8139
8171
|
url: this.getCategoryCanonicalUrl(subCategory, categoryPath),
|
|
8140
8172
|
...(image && { image }),
|
|
8141
|
-
...(description && { description }),
|
|
8173
|
+
...(description && { description: this.stripHtml(description) }),
|
|
8142
8174
|
},
|
|
8143
8175
|
};
|
|
8144
8176
|
}),
|