@infrab4a/connect-angular 5.2.0 → 5.2.1-beta.1
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/strategies/term-search.strategy.mjs +18 -10
- package/fesm2015/infrab4a-connect-angular.mjs +16 -8
- package/fesm2015/infrab4a-connect-angular.mjs.map +1 -1
- package/fesm2020/infrab4a-connect-angular.mjs +16 -8
- package/fesm2020/infrab4a-connect-angular.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1690,7 +1690,7 @@ class TermSearchStrategy {
|
|
|
1690
1690
|
maximum: ['price'],
|
|
1691
1691
|
...(isEmpty(filters?.brands) ? { distinct: ['brand'] } : {}),
|
|
1692
1692
|
},
|
|
1693
|
-
}
|
|
1693
|
+
});
|
|
1694
1694
|
return this.sortByTermRelevance({
|
|
1695
1695
|
productIds,
|
|
1696
1696
|
totalResult,
|
|
@@ -1716,20 +1716,28 @@ class TermSearchStrategy {
|
|
|
1716
1716
|
maximum: ['price'],
|
|
1717
1717
|
distinct: ['brand'],
|
|
1718
1718
|
},
|
|
1719
|
-
}
|
|
1719
|
+
});
|
|
1720
1720
|
}
|
|
1721
1721
|
sortByTermRelevance(params) {
|
|
1722
1722
|
const { productIds, totalResult, limits, filters, fieldsHelper } = params;
|
|
1723
1723
|
const defaultGender = filters?.gender?.at(0) || 'male';
|
|
1724
1724
|
const stockData = totalResult.data.filter((product) => product.stock.quantity > 0);
|
|
1725
1725
|
const stockOut = totalResult.data.filter((product) => product.stock.quantity <= 0);
|
|
1726
|
-
const productIdsStockGender = productIds.filter((product) =>
|
|
1727
|
-
|
|
1728
|
-
|
|
1726
|
+
// const productIdsStockGender = productIds.filter((product) =>
|
|
1727
|
+
// stockData.some(
|
|
1728
|
+
// (result: any) =>
|
|
1729
|
+
// result.id === product && (result.gender?.includes(defaultGender) || result.gender?.includes('unisex')),
|
|
1730
|
+
// ),
|
|
1731
|
+
// )
|
|
1732
|
+
// const productIdsStockNotGender = productIds.filter((product) =>
|
|
1733
|
+
// stockData.some(
|
|
1734
|
+
// (result: any) =>
|
|
1735
|
+
// result.id === product && !result.gender?.includes(defaultGender) && !result.gender?.includes('unisex'),
|
|
1736
|
+
// ),
|
|
1737
|
+
// )
|
|
1738
|
+
// const productIdsStock = productIdsStockGender.concat(productIdsStockNotGender)
|
|
1729
1739
|
const productIdsStockOut = productIds.filter((product) => stockOut.some((result) => result.id === product));
|
|
1730
|
-
const limitedProductId =
|
|
1731
|
-
.concat(productIdsStockOut)
|
|
1732
|
-
.slice(limits.offset, limits.offset + limits.limit);
|
|
1740
|
+
const limitedProductId = stockData.concat(productIdsStockOut).slice(limits.offset, limits.offset + limits.limit);
|
|
1733
1741
|
const orderedId = productIds.filter((product) => limitedProductId.includes(product));
|
|
1734
1742
|
return this.getDetailedProducts(orderedId, totalResult, fieldsHelper);
|
|
1735
1743
|
}
|