@infrab4a/connect-angular 4.10.0-beta.8 → 4.10.0-beta.9
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.
- package/esm2020/services/catalog/catalog.service.mjs +5 -16
- package/fesm2015/infrab4a-connect-angular.mjs +5 -16
- package/fesm2015/infrab4a-connect-angular.mjs.map +1 -1
- package/fesm2020/infrab4a-connect-angular.mjs +4 -15
- package/fesm2020/infrab4a-connect-angular.mjs.map +1 -1
- package/package.json +1 -1
- package/services/catalog/catalog.service.d.ts +0 -1
|
@@ -1839,7 +1839,7 @@ class CatalogService {
|
|
|
1839
1839
|
};
|
|
1840
1840
|
}
|
|
1841
1841
|
async findCatalogAndSortByMostRevelantByTerm(productIds, options, limits) {
|
|
1842
|
-
|
|
1842
|
+
console.log('findCatalogAndSortByMostRevelantByTerm', this.shop, options, limits);
|
|
1843
1843
|
// console.log(
|
|
1844
1844
|
// 'productIds from search',
|
|
1845
1845
|
// productIds.length,
|
|
@@ -1859,7 +1859,7 @@ class CatalogService {
|
|
|
1859
1859
|
distinct: ['brand'],
|
|
1860
1860
|
},
|
|
1861
1861
|
}, options?.mainGender || this.shop === Shops.MENSMARKET ? 'male' : 'female');
|
|
1862
|
-
const productsTotalResult = totalResult.data.slice(limits.offset, limits.offset + limits.limit)
|
|
1862
|
+
// const productsTotalResult = totalResult.data.slice(limits.offset, limits.offset + limits.limit)
|
|
1863
1863
|
// console.log(
|
|
1864
1864
|
// 'productsTotalResult',
|
|
1865
1865
|
// productsTotalResult.map((p) => {
|
|
@@ -1877,7 +1877,7 @@ class CatalogService {
|
|
|
1877
1877
|
const stockData = totalResult.data.filter((product) => product.stock.quantity > 0);
|
|
1878
1878
|
const stockOut = totalResult.data.filter((product) => product.stock.quantity <= 0);
|
|
1879
1879
|
const productIdsStockGender = productIds.filter((product) => stockData.some((result) => result.id === product && (result.gender.includes(defaultGender) || result.gender.includes('unisex'))));
|
|
1880
|
-
const productIdsStockNotGender = productIds.filter((product) => stockData.some((result) => result.id === product && !result.gender.includes(defaultGender)));
|
|
1880
|
+
const productIdsStockNotGender = productIds.filter((product) => stockData.some((result) => result.id === product && !result.gender.includes(defaultGender) && !result.gender.includes('unisex')));
|
|
1881
1881
|
const productIdsStock = productIdsStockGender.concat(productIdsStockNotGender);
|
|
1882
1882
|
const productIdsStockOut = productIds.filter((product) => stockOut.some((result) => result.id === product));
|
|
1883
1883
|
const limitedProductId = productIdsStock
|
|
@@ -1912,24 +1912,13 @@ class CatalogService {
|
|
|
1912
1912
|
};
|
|
1913
1913
|
}
|
|
1914
1914
|
async findCatalogIdsBySearch(term, preview = false) {
|
|
1915
|
+
console.log('this.productsByTerm[term]', this.productsByTerm[term]?.length);
|
|
1915
1916
|
if (this.productsByTerm[term])
|
|
1916
1917
|
return this.productsByTerm[term];
|
|
1917
1918
|
return (this.productsByTerm[term] = await this.productSearch
|
|
1918
1919
|
.search(term, 999, this.shop == Shops.GLAMSHOP ? 'female' : 'male')
|
|
1919
1920
|
.then((products) => [...new Set(products.map((product) => product.id))]));
|
|
1920
1921
|
}
|
|
1921
|
-
prepareSearchResult(resultDb, searchIds, options, limits) {
|
|
1922
|
-
const stockData = resultDb.filter((product) => product.stock.quantity > 0);
|
|
1923
|
-
const stockOut = resultDb.filter((product) => product.stock.quantity <= 0);
|
|
1924
|
-
if (options.filters?.gender) {
|
|
1925
|
-
}
|
|
1926
|
-
const productIdsStock = searchIds.filter((product) => stockData.some((result) => result.id === product));
|
|
1927
|
-
const productIdsStockOut = searchIds.filter((product) => stockOut.some((result) => result.id === product));
|
|
1928
|
-
const limitedProductId = productIdsStock
|
|
1929
|
-
.concat(productIdsStockOut)
|
|
1930
|
-
.slice(limits.offset, limits.offset + limits.limit);
|
|
1931
|
-
return limitedProductId;
|
|
1932
|
-
}
|
|
1933
1922
|
}
|
|
1934
1923
|
CatalogService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogService, deps: [{ token: 'ProductRepository' }, { token: 'ProductStockNotificationRepository' }, { token: 'CategoryRepository' }, { token: CATEGORY_STRUCTURE }, { token: DEFAULT_SHOP }, { token: 'ProductSearch' }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1935
1924
|
CatalogService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.1.0", ngImport: i0, type: CatalogService });
|