@azzas/azzas-tracker-web 2.0.1 → 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.
@@ -2090,6 +2090,7 @@ var AzzasTracker = function() {
2090
2090
  "M",
2091
2091
  "G",
2092
2092
  "GG",
2093
+ "GGG",
2093
2094
  "XG",
2094
2095
  "XGG",
2095
2096
  "EG",
@@ -2109,7 +2110,8 @@ var AzzasTracker = function() {
2109
2110
  "P",
2110
2111
  "M",
2111
2112
  "G",
2112
- "GG"
2113
+ "GG",
2114
+ "GGG"
2113
2115
  ]
2114
2116
  };
2115
2117
  var detectSizeType = function(sizes) {
@@ -2730,23 +2732,26 @@ var AzzasTracker = function() {
2730
2732
  return null;
2731
2733
  },
2732
2734
  available_grid: function(context) {
2735
+ var _context_products;
2733
2736
  if (context === null || context === void 0 ? void 0 : context.available_grid) return context.available_grid;
2734
- if (context === null || context === void 0 ? void 0 : context.products) {
2735
- var sizes = context.products.filter(function(product) {
2736
- var _product_offers_offers, _product_offers;
2737
- return (_product_offers = product.offers) === null || _product_offers === void 0 ? void 0 : (_product_offers_offers = _product_offers.offers) === null || _product_offers_offers === void 0 ? void 0 : _product_offers_offers.some(function(o) {
2738
- return o.availability === "https://schema.org/InStock";
2739
- });
2740
- }).map(function(product) {
2741
- var _product_name;
2742
- return (_product_name = product.name) === null || _product_name === void 0 ? void 0 : _product_name.split(" - ")[1];
2743
- }).filter(function(name) {
2744
- return Boolean(name);
2737
+ if (!(context === null || context === void 0 ? void 0 : (_context_products = context.products) === null || _context_products === void 0 ? void 0 : _context_products.length)) return null;
2738
+ var sizes = context.products.flatMap(function(p) {
2739
+ var _ref, _ref1;
2740
+ var _p_similarItems, _skuVariants_allVariantProducts;
2741
+ var _ref2 = (_ref = p === null || p === void 0 ? void 0 : p.isVariantOf) !== null && _ref !== void 0 ? _ref : {}, productGroupID = _ref2.productGroupID, skuVariants = _ref2.skuVariants;
2742
+ var currentColor = p === null || p === void 0 ? void 0 : (_p_similarItems = p.similarItems) === null || _p_similarItems === void 0 ? void 0 : _p_similarItems.find(function(i) {
2743
+ return (i === null || i === void 0 ? void 0 : i.productId) === productGroupID;
2745
2744
  });
2746
- var result = sortSizes(sizes).join(",").trim();
2747
- return result || null;
2748
- }
2749
- return null;
2745
+ var variantIDs = skuVariants === null || skuVariants === void 0 ? void 0 : (_skuVariants_allVariantProducts = skuVariants.allVariantProducts) === null || _skuVariants_allVariantProducts === void 0 ? void 0 : _skuVariants_allVariantProducts.map(function(v) {
2746
+ return v === null || v === void 0 ? void 0 : v.productID;
2747
+ });
2748
+ return ((_ref1 = currentColor === null || currentColor === void 0 ? void 0 : currentColor.sizes) !== null && _ref1 !== void 0 ? _ref1 : []).flatMap(function(entry) {
2749
+ return (entry === null || entry === void 0 ? void 0 : entry.isAvailable) && (entry === null || entry === void 0 ? void 0 : entry.size) && (!(variantIDs === null || variantIDs === void 0 ? void 0 : variantIDs.length) || variantIDs.includes(entry.skuId)) ? [
2750
+ entry.size
2751
+ ] : [];
2752
+ });
2753
+ });
2754
+ return sortSizes(sizes).join(",").trim() || null;
2750
2755
  }
2751
2756
  });
2752
2757
  // src/params/adapters/headless/utils.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azzas/azzas-tracker-web",
3
- "version": "2.0.1",
3
+ "version": "2.0.2-preview.1",
4
4
  "type": "module",
5
5
  "main": "./dist/mod.cjs",
6
6
  "module": "./dist/mod.js",