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

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.d.cts CHANGED
@@ -1455,7 +1455,7 @@ type ProductAdditionalProperty = {
1455
1455
  type ProductSkuVariants = {
1456
1456
  activeVariations?: unknown | null;
1457
1457
  slugsMap?: unknown | null;
1458
- availableVariations?: unknown | null;
1458
+ availableVariations?: Record<string, Array<Record<string, string>>>;
1459
1459
  allVariantProducts?: Array<{
1460
1460
  name: string;
1461
1461
  productID: string;
package/dist/mod.d.ts CHANGED
@@ -1455,7 +1455,7 @@ type ProductAdditionalProperty = {
1455
1455
  type ProductSkuVariants = {
1456
1456
  activeVariations?: unknown | null;
1457
1457
  slugsMap?: unknown | null;
1458
- availableVariations?: unknown | null;
1458
+ availableVariations?: Record<string, Array<Record<string, string>>>;
1459
1459
  allVariantProducts?: Array<{
1460
1460
  name: string;
1461
1461
  productID: string;
@@ -987,8 +987,8 @@ var AzzasTracker = (() => {
987
987
  return hashArray.map((b) => b.toString(16).padStart(2, "0")).join("");
988
988
  };
989
989
  var SIZE_ORDER = {
990
- alfabetico: ["PP", "P", "M", "G", "GG", "XG", "XGG", "EG", "EGG", "3G", "4G", "5G"],
991
- infantil: ["RN", "0-3M", "3-6M", "6-9M", "9-12M", "12-18M", "18-24M", "P", "M", "G", "GG"]
990
+ alfabetico: ["PP", "P", "M", "G", "GG", "GGG", "XG", "XGG", "EG", "EGG", "3G", "4G", "5G"],
991
+ infantil: ["RN", "0-3M", "3-6M", "6-9M", "9-12M", "12-18M", "18-24M", "P", "M", "G", "GG", "GGG"]
992
992
  };
993
993
  var detectSizeType = (sizes) => {
994
994
  if (sizes.every((s) => /^\d+([.,]\d+)?$/.test(s))) return "numerico";
@@ -1658,13 +1658,12 @@ var AzzasTracker = (() => {
1658
1658
  available_grid: (context) => {
1659
1659
  if (context == null ? void 0 : context.available_grid) return context.available_grid;
1660
1660
  if (context == null ? void 0 : context.products) {
1661
- const sizes = context.products.filter((product) => {
1662
- var _a, _b;
1663
- return (_b = (_a = product.offers) == null ? void 0 : _a.offers) == null ? void 0 : _b.some((o) => o.availability === "https://schema.org/InStock");
1664
- }).map((product) => {
1665
- var _a;
1666
- return (_a = product.name) == null ? void 0 : _a.split(" - ")[1];
1667
- }).filter((name) => Boolean(name));
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
+ }
1666
+ );
1668
1667
  const result = sortSizes(sizes).join(",").trim();
1669
1668
  return result || null;
1670
1669
  }