@azzas/azzas-tracker-web 2.0.2-preview.0 → 2.0.2-preview.2

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.js CHANGED
@@ -1581,7 +1581,7 @@ var reservaAdapter = {
1581
1581
  discount: Math.round((Number(listPrice) - Number((_j = item == null ? void 0 : item.offers) == null ? void 0 : _j.lowPrice)) * 100) / 100,
1582
1582
  item_variant: ((_l = (_k = item == null ? void 0 : item.name) == null ? void 0 : _k.split(" - ")[0]) == null ? void 0 : _l.replace(/^[^_]+_/, "").replace(/_/g, " ")) || null,
1583
1583
  // cor
1584
- item_variant2: (_n = (_m = item == null ? void 0 : item.name) == null ? void 0 : _m.split(" - ")[1]) != null ? _n : null,
1584
+ item_variant2: (_n = (_m = item == null ? void 0 : item.name) == null ? void 0 : _m.split(" - ")[1].toUpperCase()) != null ? _n : null,
1585
1585
  // tamanho
1586
1586
  item_shipping_tier: "",
1587
1587
  item_ref: (_o = item.groupRefId) != null ? _o : null,
@@ -1627,18 +1627,19 @@ var reservaAdapter = {
1627
1627
  return null;
1628
1628
  },
1629
1629
  available_grid: (context) => {
1630
+ var _a;
1630
1631
  if (context == null ? void 0 : context.available_grid) return context.available_grid;
1631
- if (context == null ? void 0 : context.products) {
1632
- const sizes = context.products.flatMap(
1633
- (p) => {
1634
- var _a, _b, _c, _d, _e;
1635
- 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 : [];
1636
- }
1632
+ if (!((_a = context == null ? void 0 : context.products) == null ? void 0 : _a.length)) return null;
1633
+ const sizes = context.products.flatMap((p) => {
1634
+ var _a2, _b, _c, _d;
1635
+ const { productGroupID, skuVariants } = (_a2 = p == null ? void 0 : p.isVariantOf) != null ? _a2 : {};
1636
+ const currentColor = (_b = p == null ? void 0 : p.similarItems) == null ? void 0 : _b.find((i) => (i == null ? void 0 : i.productId) === productGroupID);
1637
+ const variantIDs = (_c = skuVariants == null ? void 0 : skuVariants.allVariantProducts) == null ? void 0 : _c.map((v) => v == null ? void 0 : v.productID);
1638
+ return ((_d = currentColor == null ? void 0 : currentColor.sizes) != null ? _d : []).flatMap(
1639
+ (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] : []
1637
1640
  );
1638
- const result = sortSizes(sizes).join(",").trim();
1639
- return result || null;
1640
- }
1641
- return null;
1641
+ });
1642
+ return sortSizes(sizes).join(",").trim() || null;
1642
1643
  }
1643
1644
  };
1644
1645