@infrab4a/connect 0.7.2 → 0.7.4

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.
@@ -849,7 +849,7 @@
849
849
 
850
850
  exports.Shops = void 0;
851
851
  (function (Shops) {
852
- Shops["MENSMARKET"] = "Men's Market";
852
+ Shops["MENSMARKET"] = "mensmarket";
853
853
  Shops["GLAMSHOP"] = "Glamshop";
854
854
  })(exports.Shops || (exports.Shops = {}));
855
855
 
@@ -1639,7 +1639,7 @@
1639
1639
  };
1640
1640
  CategoryFirestoreRepository.prototype.getCategoriesForHome = function (categoryIds) {
1641
1641
  return __awaiter(this, void 0, void 0, function () {
1642
- var categorySnap, categories, homeSections, categories_1, categories_1_1, category, productSnap, products, e_1_1;
1642
+ var categorySnap, categories, homeSections, categories_1, categories_1_1, category, publishedField, productSnap, products, e_1_1;
1643
1643
  var e_1, _a;
1644
1644
  return __generator(this, function (_b) {
1645
1645
  switch (_b.label) {
@@ -1661,8 +1661,10 @@
1661
1661
  case 3:
1662
1662
  if (!!categories_1_1.done) return [3 /*break*/, 6];
1663
1663
  category = categories_1_1.value;
1664
+ publishedField = category.shop === exports.Shops.GLAMSHOP ? 'publishedGlam' : 'published';
1664
1665
  return [4 /*yield*/, this.collection('products')
1665
1666
  .where('categories', 'array-contains', category.id)
1667
+ .where(publishedField, '==', true)
1666
1668
  .where('stock.quantity', '>', 1)
1667
1669
  .limit(4)
1668
1670
  .get()];
@@ -1692,7 +1694,7 @@
1692
1694
  };
1693
1695
  CategoryFirestoreRepository.prototype.mountCategory = function (category) {
1694
1696
  return __awaiter(this, void 0, void 0, function () {
1695
- var chunks, products, chunks_1, chunks_1_1, productIds, productSnap, e_2_1;
1697
+ var chunks, products, publishedField, chunks_1, chunks_1_1, productIds, productSnap, e_2_1;
1696
1698
  var e_2, _a;
1697
1699
  return __generator(this, function (_b) {
1698
1700
  switch (_b.label) {
@@ -1707,6 +1709,7 @@
1707
1709
  return resultArray;
1708
1710
  }, []);
1709
1711
  products = [];
1712
+ publishedField = category.shop === exports.Shops.GLAMSHOP ? 'publishedGlam' : 'published';
1710
1713
  _b.label = 1;
1711
1714
  case 1:
1712
1715
  _b.trys.push([1, 6, 7, 8]);
@@ -1715,7 +1718,10 @@
1715
1718
  case 2:
1716
1719
  if (!!chunks_1_1.done) return [3 /*break*/, 5];
1717
1720
  productIds = chunks_1_1.value;
1718
- return [4 /*yield*/, this.collection('products').where('id', 'in', productIds).get()];
1721
+ return [4 /*yield*/, this.collection('products')
1722
+ .where(publishedField, '==', true)
1723
+ .where('id', 'in', productIds)
1724
+ .get()];
1719
1725
  case 3:
1720
1726
  productSnap = _b.sent();
1721
1727
  if (productSnap.empty)