@azzas/azzas-tracker-web 2.0.2-preview.0 → 2.0.2-preview.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/dist/mod.cjs CHANGED
@@ -1656,18 +1656,19 @@ var reservaAdapter = {
1656
1656
  return null;
1657
1657
  },
1658
1658
  available_grid: (context) => {
1659
+ var _a;
1659
1660
  if (context == null ? void 0 : context.available_grid) return context.available_grid;
1660
- if (context == null ? void 0 : context.products) {
1661
- const sizes = context.products.flatMap(
1662
- (p) => {
1663
- var _a, _b, _c, _d, _e;
1664
- return (_e = (_d = (_c = (_b = (_a = p == null ? void 0 : p.isVariantOf) == null ? void 0 : _a.skuVariants) == null ? void 0 : _b.availableVariations) == null ? void 0 : _c.Tamanho) == null ? void 0 : _d.map((size) => size.value)) != null ? _e : [];
1665
- }
1661
+ if (!((_a = context == null ? void 0 : context.products) == null ? void 0 : _a.length)) return null;
1662
+ const sizes = context.products.flatMap((p) => {
1663
+ var _a2, _b, _c, _d;
1664
+ const { productGroupID, skuVariants } = (_a2 = p == null ? void 0 : p.isVariantOf) != null ? _a2 : {};
1665
+ const currentColor = (_b = p == null ? void 0 : p.similarItems) == null ? void 0 : _b.find((i) => (i == null ? void 0 : i.productId) === productGroupID);
1666
+ const variantIDs = (_c = skuVariants == null ? void 0 : skuVariants.allVariantProducts) == null ? void 0 : _c.map((v) => v == null ? void 0 : v.productID);
1667
+ return ((_d = currentColor == null ? void 0 : currentColor.sizes) != null ? _d : []).flatMap(
1668
+ (entry) => (entry == null ? void 0 : entry.isAvailable) && (entry == null ? void 0 : entry.size) && (!(variantIDs == null ? void 0 : variantIDs.length) || variantIDs.includes(entry.skuId)) ? [entry.size] : []
1666
1669
  );
1667
- const result = sortSizes(sizes).join(",").trim();
1668
- return result || null;
1669
- }
1670
- return null;
1670
+ });
1671
+ return sortSizes(sizes).join(",").trim() || null;
1671
1672
  }
1672
1673
  };
1673
1674