@azzas/azzas-tracker-web 2.0.3-preview.2 → 2.0.3-preview.3
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 +21 -237
- package/dist/mod.cjs.map +1 -1
- package/dist/mod.d.cts +0 -276
- package/dist/mod.d.ts +0 -276
- package/dist/mod.global.js +21 -237
- package/dist/mod.global.js.map +1 -1
- package/dist/mod.js +21 -237
- package/dist/mod.js.map +1 -1
- package/dist/mod.vtex.global.js +24 -309
- package/package.json +1 -1
package/dist/mod.vtex.global.js
CHANGED
|
@@ -1569,7 +1569,7 @@ var AzzasTracker = function() {
|
|
|
1569
1569
|
});
|
|
1570
1570
|
}
|
|
1571
1571
|
if (isDebugMode()) {
|
|
1572
|
-
console.log("%c [DT v2
|
|
1572
|
+
console.log("%c [DT v2] %c ".concat(event, " "), "background: #6366f1; color: #fff; font-weight: bold; padding: 2px 6px; border-radius: 4px 0 0 4px;", "background: #1e1e2e; color: #a5b4fc; font-weight: bold; padding: 2px 6px; border-radius: 0 4px 4px 0;", {
|
|
1573
1573
|
context: context,
|
|
1574
1574
|
parameters: parameters
|
|
1575
1575
|
});
|
|
@@ -2295,8 +2295,8 @@ var AzzasTracker = function() {
|
|
|
2295
2295
|
};
|
|
2296
2296
|
// src/params/userInfo.ts
|
|
2297
2297
|
var PROD_DOMAINS = {
|
|
2298
|
-
"
|
|
2299
|
-
"store": "https://
|
|
2298
|
+
"animale": {
|
|
2299
|
+
"store": "https://www.animale.com.br",
|
|
2300
2300
|
"checkout": "https://secure.animale.com.br"
|
|
2301
2301
|
},
|
|
2302
2302
|
"lojafarm": {
|
|
@@ -2677,11 +2677,11 @@ var AzzasTracker = function() {
|
|
|
2677
2677
|
var getItemCategory22 = function(item) {
|
|
2678
2678
|
var _ref, _categories_, _validHierarchy_;
|
|
2679
2679
|
var _item_category;
|
|
2680
|
-
var
|
|
2680
|
+
var AVOID_CATEGORIES = /^(outlet|bazar|sale)$/i;
|
|
2681
2681
|
var categories = (_ref = (_item_category = item.category) === null || _item_category === void 0 ? void 0 : _item_category.split(">")) !== null && _ref !== void 0 ? _ref : [];
|
|
2682
2682
|
var last = (_categories_ = categories[categories.length - 1]) !== null && _categories_ !== void 0 ? _categories_ : "";
|
|
2683
2683
|
var validHierarchy = last.split("/").filter(function(c) {
|
|
2684
|
-
return c && !
|
|
2684
|
+
return c && !AVOID_CATEGORIES.test(c);
|
|
2685
2685
|
});
|
|
2686
2686
|
var deepest = (_validHierarchy_ = validHierarchy[validHierarchy.length - 1]) !== null && _validHierarchy_ !== void 0 ? _validHierarchy_ : "";
|
|
2687
2687
|
return capitalize(deepest);
|
|
@@ -2800,10 +2800,10 @@ var AzzasTracker = function() {
|
|
|
2800
2800
|
var getItemCategory23 = function(item) {
|
|
2801
2801
|
var _ref, _validHierarchy_;
|
|
2802
2802
|
var _item_similarItems_, _item_similarItems;
|
|
2803
|
-
var
|
|
2803
|
+
var AVOID_CATEGORIES = /^(outlet|bazar|sale|coleção|promoção)$/i;
|
|
2804
2804
|
var categories = (_ref = item === null || item === void 0 ? void 0 : (_item_similarItems = item.similarItems) === null || _item_similarItems === void 0 ? void 0 : (_item_similarItems_ = _item_similarItems[0]) === null || _item_similarItems_ === void 0 ? void 0 : _item_similarItems_.categories) !== null && _ref !== void 0 ? _ref : [];
|
|
2805
2805
|
var validHierarchy = categories.filter(function(c) {
|
|
2806
|
-
return c && !
|
|
2806
|
+
return c && !AVOID_CATEGORIES.test(c);
|
|
2807
2807
|
});
|
|
2808
2808
|
var deepest = (_validHierarchy_ = validHierarchy[validHierarchy.length - 1]) !== null && _validHierarchy_ !== void 0 ? _validHierarchy_ : "";
|
|
2809
2809
|
return capitalize(deepest);
|
|
@@ -2903,291 +2903,8 @@ var AzzasTracker = function() {
|
|
|
2903
2903
|
return sortSizes(sizes).join(",").trim() || null;
|
|
2904
2904
|
}
|
|
2905
2905
|
});
|
|
2906
|
-
// src/params/adapters/animale/utils.ts
|
|
2907
|
-
var SALE_CATEGORIES = /outlet|bazar|sale/i;
|
|
2908
|
-
var AVOID_CATEGORIES = /^(outlet|bazar|sale|cole(ç|c)(ã|a)o)$/i;
|
|
2909
|
-
var getLevels = function(path) {
|
|
2910
|
-
return path.split("/").filter(Boolean);
|
|
2911
|
-
};
|
|
2912
|
-
var isProductCrumb = function(path) {
|
|
2913
|
-
return /\/p\/?$/.test(path !== null && path !== void 0 ? path : "");
|
|
2914
|
-
};
|
|
2915
|
-
var getCategoryPaths = function(item) {
|
|
2916
|
-
var _ref;
|
|
2917
|
-
var _item_categories, _item_breadcrumbList;
|
|
2918
|
-
if (item && "categories" in item && ((_item_categories = item.categories) === null || _item_categories === void 0 ? void 0 : _item_categories.length)) return item.categories;
|
|
2919
|
-
var names = _to_consumable_array((_ref = item === null || item === void 0 ? void 0 : (_item_breadcrumbList = item.breadcrumbList) === null || _item_breadcrumbList === void 0 ? void 0 : _item_breadcrumbList.itemListElement) !== null && _ref !== void 0 ? _ref : []).sort(function(a, b) {
|
|
2920
|
-
var _ref, _ref1;
|
|
2921
|
-
return ((_ref = a === null || a === void 0 ? void 0 : a.position) !== null && _ref !== void 0 ? _ref : 0) - ((_ref1 = b === null || b === void 0 ? void 0 : b.position) !== null && _ref1 !== void 0 ? _ref1 : 0);
|
|
2922
|
-
}).filter(function(crumb) {
|
|
2923
|
-
return (crumb === null || crumb === void 0 ? void 0 : crumb.name) && !isProductCrumb(crumb === null || crumb === void 0 ? void 0 : crumb.item);
|
|
2924
|
-
}).map(function(crumb) {
|
|
2925
|
-
return crumb.name.trim();
|
|
2926
|
-
});
|
|
2927
|
-
return names.length ? [
|
|
2928
|
-
"/".concat(names.join("/"), "/")
|
|
2929
|
-
] : [];
|
|
2930
|
-
};
|
|
2931
|
-
var getItemCategory6 = function(item) {
|
|
2932
|
-
var _categories_join_match;
|
|
2933
|
-
var categories = getCategoryPaths(item);
|
|
2934
|
-
if (!categories.length) return "Cole\xE7\xE3o";
|
|
2935
|
-
var match = (_categories_join_match = categories.join(" ").match(SALE_CATEGORIES)) === null || _categories_join_match === void 0 ? void 0 : _categories_join_match[0].toLowerCase();
|
|
2936
|
-
return match !== null && match !== void 0 ? match : "Cole\xE7\xE3o";
|
|
2937
|
-
};
|
|
2938
|
-
var getItemCategory24 = function(item) {
|
|
2939
|
-
var categories = getCategoryPaths(item);
|
|
2940
|
-
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
2941
|
-
try {
|
|
2942
|
-
for(var _iterator = _to_consumable_array(categories).reverse()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
2943
|
-
var path = _step.value;
|
|
2944
|
-
var deepest = getLevels(path).reverse().find(function(level) {
|
|
2945
|
-
return !AVOID_CATEGORIES.test(level.trim());
|
|
2946
|
-
});
|
|
2947
|
-
if (deepest) return capitalize(deepest.trim());
|
|
2948
|
-
}
|
|
2949
|
-
} catch (err) {
|
|
2950
|
-
_didIteratorError = true;
|
|
2951
|
-
_iteratorError = err;
|
|
2952
|
-
} finally{
|
|
2953
|
-
try {
|
|
2954
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
2955
|
-
_iterator.return();
|
|
2956
|
-
}
|
|
2957
|
-
} finally{
|
|
2958
|
-
if (_didIteratorError) {
|
|
2959
|
-
throw _iteratorError;
|
|
2960
|
-
}
|
|
2961
|
-
}
|
|
2962
|
-
}
|
|
2963
|
-
return "";
|
|
2964
|
-
};
|
|
2965
|
-
var isInStock = function(availability) {
|
|
2966
|
-
return /InStock/i.test(availability !== null && availability !== void 0 ? availability : "");
|
|
2967
|
-
};
|
|
2968
|
-
// src/params/adapters/animale/zones/PDC.ts
|
|
2969
|
-
var AnimalePdcZone = {
|
|
2970
|
-
items: function(context) {
|
|
2971
|
-
if (context === null || context === void 0 ? void 0 : context.items) return context.items;
|
|
2972
|
-
if (context === null || context === void 0 ? void 0 : context.products) {
|
|
2973
|
-
return context.products.map(function(item) {
|
|
2974
|
-
var _ref, _item_brand_name_toLowerCase, _ref1, _ref2, _ref3, _item_additionalProperty, _ref4, _getItemCategory24, _ref5, _ref6, _ref7, _resizeVtexImage2, _item_item_list_name;
|
|
2975
|
-
var _item_offers_offers, _item_offers, _item_offers_offers1, _item_offers1, _item_isVariantOf_hasVariant_find_offers_offers_, _item_isVariantOf_hasVariant_find, _item_isVariantOf_hasVariant, _item_isVariantOf, _item_isVariantOf1, _item_isVariantOf_hasVariant1, _item_isVariantOf2, _find, _item_isVariantOf3, _item_image;
|
|
2976
|
-
var listPrice = item === null || item === void 0 ? void 0 : (_item_offers = item.offers) === null || _item_offers === void 0 ? void 0 : (_item_offers_offers = _item_offers.offers) === null || _item_offers_offers === void 0 ? void 0 : _item_offers_offers[0].listPrice;
|
|
2977
|
-
var price = (_item_offers1 = item.offers) === null || _item_offers1 === void 0 ? void 0 : (_item_offers_offers1 = _item_offers1.offers) === null || _item_offers_offers1 === void 0 ? void 0 : _item_offers_offers1[0].price;
|
|
2978
|
-
var sellerId = item === null || item === void 0 ? void 0 : (_item_isVariantOf = item.isVariantOf) === null || _item_isVariantOf === void 0 ? void 0 : (_item_isVariantOf_hasVariant = _item_isVariantOf.hasVariant) === null || _item_isVariantOf_hasVariant === void 0 ? void 0 : (_item_isVariantOf_hasVariant_find = _item_isVariantOf_hasVariant.find(function(v) {
|
|
2979
|
-
return v.offers.offers.find(function(o) {
|
|
2980
|
-
return o.availability;
|
|
2981
|
-
});
|
|
2982
|
-
})) === null || _item_isVariantOf_hasVariant_find === void 0 ? void 0 : (_item_isVariantOf_hasVariant_find_offers_offers_ = _item_isVariantOf_hasVariant_find.offers.offers[0]) === null || _item_isVariantOf_hasVariant_find_offers_offers_ === void 0 ? void 0 : _item_isVariantOf_hasVariant_find_offers_offers_.seller.identifier;
|
|
2983
|
-
return {
|
|
2984
|
-
quantity: 1,
|
|
2985
|
-
index: (_ref = item === null || item === void 0 ? void 0 : item.index) !== null && _ref !== void 0 ? _ref : 0,
|
|
2986
|
-
item_brand: (_item_brand_name_toLowerCase = item.brand.name.toLowerCase()) !== null && _item_brand_name_toLowerCase !== void 0 ? _item_brand_name_toLowerCase : null,
|
|
2987
|
-
item_name: (_ref1 = item === null || item === void 0 ? void 0 : (_item_isVariantOf1 = item.isVariantOf) === null || _item_isVariantOf1 === void 0 ? void 0 : _item_isVariantOf1.name) !== null && _ref1 !== void 0 ? _ref1 : null,
|
|
2988
|
-
price: price !== null && price !== void 0 ? price : null,
|
|
2989
|
-
item_shipping_tier: null,
|
|
2990
|
-
discount: Number(listPrice) - Number(price),
|
|
2991
|
-
item_variant: (_ref2 = (_item_isVariantOf2 = item.isVariantOf) === null || _item_isVariantOf2 === void 0 ? void 0 : (_item_isVariantOf_hasVariant1 = _item_isVariantOf2.hasVariant) === null || _item_isVariantOf_hasVariant1 === void 0 ? void 0 : _item_isVariantOf_hasVariant1[0].name.split(" - ")[0]) !== null && _ref2 !== void 0 ? _ref2 : null,
|
|
2992
|
-
item_variant2: (_ref3 = (_find = ((_item_additionalProperty = item.additionalProperty) !== null && _item_additionalProperty !== void 0 ? _item_additionalProperty : []).find(function(p) {
|
|
2993
|
-
return p.name === "Tamanho";
|
|
2994
|
-
})) === null || _find === void 0 ? void 0 : _find.value) !== null && _ref3 !== void 0 ? _ref3 : null,
|
|
2995
|
-
item_ref: (_ref4 = item === null || item === void 0 ? void 0 : item.gtin) !== null && _ref4 !== void 0 ? _ref4 : null,
|
|
2996
|
-
item_category: getItemCategory6(item),
|
|
2997
|
-
item_category2: (_getItemCategory24 = getItemCategory24(item)) !== null && _getItemCategory24 !== void 0 ? _getItemCategory24 : null,
|
|
2998
|
-
item_id: (_ref5 = item === null || item === void 0 ? void 0 : (_item_isVariantOf3 = item.isVariantOf) === null || _item_isVariantOf3 === void 0 ? void 0 : _item_isVariantOf3.productGroupID) !== null && _ref5 !== void 0 ? _ref5 : null,
|
|
2999
|
-
item_sku: (_ref6 = item === null || item === void 0 ? void 0 : item.sku) !== null && _ref6 !== void 0 ? _ref6 : null,
|
|
3000
|
-
item_url: (_ref7 = item === null || item === void 0 ? void 0 : item.slug) !== null && _ref7 !== void 0 ? _ref7 : null,
|
|
3001
|
-
// sem link/url no retorno do IS na multi-lib produtos PDC
|
|
3002
|
-
image_url: (_resizeVtexImage2 = resizeVtexImage2(item === null || item === void 0 ? void 0 : (_item_image = item.image) === null || _item_image === void 0 ? void 0 : _item_image[0].url)) !== null && _resizeVtexImage2 !== void 0 ? _resizeVtexImage2 : null,
|
|
3003
|
-
seller_id: sellerId !== null && sellerId !== void 0 ? sellerId : null,
|
|
3004
|
-
item_list_name: (_item_item_list_name = item.item_list_name) !== null && _item_item_list_name !== void 0 ? _item_item_list_name : null
|
|
3005
|
-
};
|
|
3006
|
-
});
|
|
3007
|
-
}
|
|
3008
|
-
return null;
|
|
3009
|
-
},
|
|
3010
|
-
value: function(context) {
|
|
3011
|
-
if (context === null || context === void 0 ? void 0 : context.value) return context.value;
|
|
3012
|
-
if (context === null || context === void 0 ? void 0 : context.products) {
|
|
3013
|
-
return context.products.map(function(item) {
|
|
3014
|
-
return item.offers.lowPrice;
|
|
3015
|
-
}).filter(function(price) {
|
|
3016
|
-
return price !== void 0;
|
|
3017
|
-
}).reduce(function(sum, price) {
|
|
3018
|
-
return sum + price;
|
|
3019
|
-
}, 0);
|
|
3020
|
-
}
|
|
3021
|
-
return null;
|
|
3022
|
-
},
|
|
3023
|
-
line_items: function(context) {
|
|
3024
|
-
if (context === null || context === void 0 ? void 0 : context.line_items) return context.line_items;
|
|
3025
|
-
if (context === null || context === void 0 ? void 0 : context.products) {
|
|
3026
|
-
return context.products.map(function(item) {
|
|
3027
|
-
return item.id;
|
|
3028
|
-
}).filter(function(id) {
|
|
3029
|
-
return Boolean(id);
|
|
3030
|
-
}).join();
|
|
3031
|
-
}
|
|
3032
|
-
return null;
|
|
3033
|
-
},
|
|
3034
|
-
brand: function(context, config2) {
|
|
3035
|
-
if (config2 === null || config2 === void 0 ? void 0 : config2.brand) return config2.brand;
|
|
3036
|
-
if (context === null || context === void 0 ? void 0 : context.brand) return context.brand;
|
|
3037
|
-
if (context === null || context === void 0 ? void 0 : context.products) {
|
|
3038
|
-
return context.products.map(function(p) {
|
|
3039
|
-
return p.brand.name;
|
|
3040
|
-
}).join().trim();
|
|
3041
|
-
}
|
|
3042
|
-
return null;
|
|
3043
|
-
}
|
|
3044
|
-
};
|
|
3045
|
-
// src/params/adapters/animale/zones/PDP.ts
|
|
3046
|
-
var AnimalePdpZone = {
|
|
3047
|
-
items: function(context) {
|
|
3048
|
-
if (context === null || context === void 0 ? void 0 : context.items) return context.items;
|
|
3049
|
-
if (context === null || context === void 0 ? void 0 : context.products) {
|
|
3050
|
-
return context.products.map(function(item) {
|
|
3051
|
-
var _ref, _ref1, _item_brand_name_toLowerCase, _ref2, _ref3, _ref4, _item_additionalProperty, _ref5, _getItemCategory24, _ref6, _ref7, _ref8, _resizeVtexImage2, _item_item_list_name;
|
|
3052
|
-
var _item_offers_offers, _item_offers, _item_offers_offers1, _item_offers1, _item_isVariantOf_hasVariant_flatMap, _item_isVariantOf_hasVariant, _item_isVariantOf, _availableOffer_seller, _item_offers_offers__seller, _item_offers_offers_, _item_offers_offers2, _item_offers2, _item_isVariantOf1, _item_isVariantOf_hasVariant1, _item_isVariantOf2, _find, _item_isVariantOf3, _item_image;
|
|
3053
|
-
var listPrice = item === null || item === void 0 ? void 0 : (_item_offers = item.offers) === null || _item_offers === void 0 ? void 0 : (_item_offers_offers = _item_offers.offers) === null || _item_offers_offers === void 0 ? void 0 : _item_offers_offers[0].listPrice;
|
|
3054
|
-
var price = (_item_offers1 = item.offers) === null || _item_offers1 === void 0 ? void 0 : (_item_offers_offers1 = _item_offers1.offers) === null || _item_offers_offers1 === void 0 ? void 0 : _item_offers_offers1[0].price;
|
|
3055
|
-
var availableOffer = item === null || item === void 0 ? void 0 : (_item_isVariantOf = item.isVariantOf) === null || _item_isVariantOf === void 0 ? void 0 : (_item_isVariantOf_hasVariant = _item_isVariantOf.hasVariant) === null || _item_isVariantOf_hasVariant === void 0 ? void 0 : (_item_isVariantOf_hasVariant_flatMap = _item_isVariantOf_hasVariant.flatMap(function(v) {
|
|
3056
|
-
var _ref;
|
|
3057
|
-
var _v_offers;
|
|
3058
|
-
return (_ref = v === null || v === void 0 ? void 0 : (_v_offers = v.offers) === null || _v_offers === void 0 ? void 0 : _v_offers.offers) !== null && _ref !== void 0 ? _ref : [];
|
|
3059
|
-
})) === null || _item_isVariantOf_hasVariant_flatMap === void 0 ? void 0 : _item_isVariantOf_hasVariant_flatMap.find(function(o) {
|
|
3060
|
-
return isInStock(o === null || o === void 0 ? void 0 : o.availability);
|
|
3061
|
-
});
|
|
3062
|
-
var sellerId = (_ref = availableOffer === null || availableOffer === void 0 ? void 0 : (_availableOffer_seller = availableOffer.seller) === null || _availableOffer_seller === void 0 ? void 0 : _availableOffer_seller.identifier) !== null && _ref !== void 0 ? _ref : item === null || item === void 0 ? void 0 : (_item_offers2 = item.offers) === null || _item_offers2 === void 0 ? void 0 : (_item_offers_offers2 = _item_offers2.offers) === null || _item_offers_offers2 === void 0 ? void 0 : (_item_offers_offers_ = _item_offers_offers2[0]) === null || _item_offers_offers_ === void 0 ? void 0 : (_item_offers_offers__seller = _item_offers_offers_.seller) === null || _item_offers_offers__seller === void 0 ? void 0 : _item_offers_offers__seller.identifier;
|
|
3063
|
-
return {
|
|
3064
|
-
quantity: 1,
|
|
3065
|
-
index: (_ref1 = item === null || item === void 0 ? void 0 : item.index) !== null && _ref1 !== void 0 ? _ref1 : 0,
|
|
3066
|
-
item_brand: (_item_brand_name_toLowerCase = item.brand.name.toLowerCase()) !== null && _item_brand_name_toLowerCase !== void 0 ? _item_brand_name_toLowerCase : null,
|
|
3067
|
-
item_name: (_ref2 = item === null || item === void 0 ? void 0 : (_item_isVariantOf1 = item.isVariantOf) === null || _item_isVariantOf1 === void 0 ? void 0 : _item_isVariantOf1.name) !== null && _ref2 !== void 0 ? _ref2 : null,
|
|
3068
|
-
price: price !== null && price !== void 0 ? price : null,
|
|
3069
|
-
item_shipping_tier: null,
|
|
3070
|
-
discount: Number(listPrice) - Number(price),
|
|
3071
|
-
item_variant: (_ref3 = (_item_isVariantOf2 = item.isVariantOf) === null || _item_isVariantOf2 === void 0 ? void 0 : (_item_isVariantOf_hasVariant1 = _item_isVariantOf2.hasVariant) === null || _item_isVariantOf_hasVariant1 === void 0 ? void 0 : _item_isVariantOf_hasVariant1[0].name.split(" - ")[0]) !== null && _ref3 !== void 0 ? _ref3 : null,
|
|
3072
|
-
item_variant2: (_ref4 = (_find = ((_item_additionalProperty = item.additionalProperty) !== null && _item_additionalProperty !== void 0 ? _item_additionalProperty : []).find(function(p) {
|
|
3073
|
-
return p.name === "Tamanho";
|
|
3074
|
-
})) === null || _find === void 0 ? void 0 : _find.value) !== null && _ref4 !== void 0 ? _ref4 : null,
|
|
3075
|
-
item_ref: (_ref5 = item === null || item === void 0 ? void 0 : item.gtin) !== null && _ref5 !== void 0 ? _ref5 : null,
|
|
3076
|
-
item_category: getItemCategory6(item),
|
|
3077
|
-
item_category2: (_getItemCategory24 = getItemCategory24(item)) !== null && _getItemCategory24 !== void 0 ? _getItemCategory24 : null,
|
|
3078
|
-
item_id: (_ref6 = item === null || item === void 0 ? void 0 : (_item_isVariantOf3 = item.isVariantOf) === null || _item_isVariantOf3 === void 0 ? void 0 : _item_isVariantOf3.productGroupID) !== null && _ref6 !== void 0 ? _ref6 : null,
|
|
3079
|
-
item_sku: (_ref7 = item === null || item === void 0 ? void 0 : item.sku) !== null && _ref7 !== void 0 ? _ref7 : null,
|
|
3080
|
-
item_url: (_ref8 = item === null || item === void 0 ? void 0 : item.slug) !== null && _ref8 !== void 0 ? _ref8 : null,
|
|
3081
|
-
// sem link/url no retorno do IS na multi-lib produtos PDC
|
|
3082
|
-
image_url: (_resizeVtexImage2 = resizeVtexImage2(item === null || item === void 0 ? void 0 : (_item_image = item.image) === null || _item_image === void 0 ? void 0 : _item_image[0].url)) !== null && _resizeVtexImage2 !== void 0 ? _resizeVtexImage2 : null,
|
|
3083
|
-
seller_id: sellerId !== null && sellerId !== void 0 ? sellerId : null,
|
|
3084
|
-
item_list_name: (_item_item_list_name = item.item_list_name) !== null && _item_item_list_name !== void 0 ? _item_item_list_name : null
|
|
3085
|
-
};
|
|
3086
|
-
});
|
|
3087
|
-
}
|
|
3088
|
-
return null;
|
|
3089
|
-
},
|
|
3090
|
-
value: function(context) {
|
|
3091
|
-
if (context === null || context === void 0 ? void 0 : context.value) return context.value;
|
|
3092
|
-
if (context === null || context === void 0 ? void 0 : context.products) {
|
|
3093
|
-
return context.products.map(function(item) {
|
|
3094
|
-
return item.offers.lowPrice;
|
|
3095
|
-
}).filter(function(price) {
|
|
3096
|
-
return price !== void 0;
|
|
3097
|
-
}).reduce(function(sum, price) {
|
|
3098
|
-
return sum + price;
|
|
3099
|
-
}, 0);
|
|
3100
|
-
}
|
|
3101
|
-
return null;
|
|
3102
|
-
},
|
|
3103
|
-
line_items: function(context) {
|
|
3104
|
-
if (context === null || context === void 0 ? void 0 : context.line_items) return context.line_items;
|
|
3105
|
-
if (context === null || context === void 0 ? void 0 : context.products) {
|
|
3106
|
-
return context.products.map(function(item) {
|
|
3107
|
-
return item.id;
|
|
3108
|
-
}).filter(function(id) {
|
|
3109
|
-
return Boolean(id);
|
|
3110
|
-
}).join();
|
|
3111
|
-
}
|
|
3112
|
-
return null;
|
|
3113
|
-
},
|
|
3114
|
-
brand: function(context, config2) {
|
|
3115
|
-
if (config2 === null || config2 === void 0 ? void 0 : config2.brand) return config2.brand;
|
|
3116
|
-
if (context === null || context === void 0 ? void 0 : context.brand) return context.brand;
|
|
3117
|
-
if (context === null || context === void 0 ? void 0 : context.products) {
|
|
3118
|
-
return context.products.map(function(p) {
|
|
3119
|
-
return p.brand.name;
|
|
3120
|
-
}).join().trim();
|
|
3121
|
-
}
|
|
3122
|
-
return null;
|
|
3123
|
-
}
|
|
3124
|
-
};
|
|
3125
|
-
// src/params/adapters/animale/index.ts
|
|
3126
|
-
var animaleAdapter = _object_spread_props(_object_spread({}, metaAdapter), {
|
|
3127
|
-
// global adapters
|
|
3128
|
-
brand: function(context, config2) {
|
|
3129
|
-
if (context.zone === "PDP") {
|
|
3130
|
-
return AnimalePdpZone.brand(context, config2);
|
|
3131
|
-
}
|
|
3132
|
-
if (context.zone === "PDC") {
|
|
3133
|
-
return AnimalePdcZone.brand(context, config2);
|
|
3134
|
-
}
|
|
3135
|
-
return null;
|
|
3136
|
-
},
|
|
3137
|
-
line_items: function(context) {
|
|
3138
|
-
if (context.zone === "PDP") {
|
|
3139
|
-
return AnimalePdpZone.line_items(context);
|
|
3140
|
-
}
|
|
3141
|
-
if (context.zone === "PDC") {
|
|
3142
|
-
return AnimalePdcZone.line_items(context);
|
|
3143
|
-
}
|
|
3144
|
-
return null;
|
|
3145
|
-
},
|
|
3146
|
-
value: function(context) {
|
|
3147
|
-
if (context.zone === "PDP") {
|
|
3148
|
-
return AnimalePdpZone.value(context);
|
|
3149
|
-
}
|
|
3150
|
-
if (context.zone === "PDC") {
|
|
3151
|
-
return AnimalePdcZone.value(context);
|
|
3152
|
-
}
|
|
3153
|
-
return null;
|
|
3154
|
-
},
|
|
3155
|
-
items: function(context) {
|
|
3156
|
-
if (context.zone === "PDP") {
|
|
3157
|
-
return AnimalePdpZone.items(context);
|
|
3158
|
-
}
|
|
3159
|
-
if (context.zone === "PDC") {
|
|
3160
|
-
return AnimalePdcZone.items(context);
|
|
3161
|
-
}
|
|
3162
|
-
},
|
|
3163
|
-
// param used only in one Zone, the PDP; no need condition
|
|
3164
|
-
available_grid: function(context) {
|
|
3165
|
-
if (context === null || context === void 0 ? void 0 : context.available_grid) return context.available_grid;
|
|
3166
|
-
if (context === null || context === void 0 ? void 0 : context.products) {
|
|
3167
|
-
var sizes = context.products.flatMap(function(p) {
|
|
3168
|
-
var _ref;
|
|
3169
|
-
var _p_isVariantOf;
|
|
3170
|
-
return ((_ref = p === null || p === void 0 ? void 0 : (_p_isVariantOf = p.isVariantOf) === null || _p_isVariantOf === void 0 ? void 0 : _p_isVariantOf.hasVariant) !== null && _ref !== void 0 ? _ref : []).flatMap(function(variant) {
|
|
3171
|
-
var _variant_offers_offers, _variant_offers, _variant_additionalProperty_find, _variant_additionalProperty;
|
|
3172
|
-
var available = variant === null || variant === void 0 ? void 0 : (_variant_offers = variant.offers) === null || _variant_offers === void 0 ? void 0 : (_variant_offers_offers = _variant_offers.offers) === null || _variant_offers_offers === void 0 ? void 0 : _variant_offers_offers.some(function(o) {
|
|
3173
|
-
return isInStock(o === null || o === void 0 ? void 0 : o.availability);
|
|
3174
|
-
});
|
|
3175
|
-
var size = variant === null || variant === void 0 ? void 0 : (_variant_additionalProperty = variant.additionalProperty) === null || _variant_additionalProperty === void 0 ? void 0 : (_variant_additionalProperty_find = _variant_additionalProperty.find(function(prop) {
|
|
3176
|
-
return (prop === null || prop === void 0 ? void 0 : prop.name) === "Tamanho";
|
|
3177
|
-
})) === null || _variant_additionalProperty_find === void 0 ? void 0 : _variant_additionalProperty_find.value;
|
|
3178
|
-
return available && size ? [
|
|
3179
|
-
size
|
|
3180
|
-
] : [];
|
|
3181
|
-
});
|
|
3182
|
-
});
|
|
3183
|
-
var result = sortSizes(sizes).join(",");
|
|
3184
|
-
return result || null;
|
|
3185
|
-
}
|
|
3186
|
-
return null;
|
|
3187
|
-
}
|
|
3188
|
-
});
|
|
3189
2906
|
// src/params/adapters/headless/utils.ts
|
|
3190
|
-
var
|
|
2907
|
+
var getItemCategory6 = function(item) {
|
|
3191
2908
|
var keywords = [
|
|
3192
2909
|
"outlet",
|
|
3193
2910
|
"bazar",
|
|
@@ -3204,7 +2921,7 @@ var AzzasTracker = function() {
|
|
|
3204
2921
|
}
|
|
3205
2922
|
return "Cole\xE7\xE3o";
|
|
3206
2923
|
};
|
|
3207
|
-
var
|
|
2924
|
+
var getItemCategory24 = function(item) {
|
|
3208
2925
|
var _ref, _reverse_find;
|
|
3209
2926
|
var _item_categories;
|
|
3210
2927
|
var avoidList = /outlet|bazar|sale/i;
|
|
@@ -3221,7 +2938,7 @@ var AzzasTracker = function() {
|
|
|
3221
2938
|
if (context === null || context === void 0 ? void 0 : context.items) return context.items;
|
|
3222
2939
|
if (context === null || context === void 0 ? void 0 : context.products) {
|
|
3223
2940
|
return context.products.map(function(item) {
|
|
3224
|
-
var _ref, _item_brand, _item_productName, _ref1, _ref2, _item_productReference,
|
|
2941
|
+
var _ref, _item_brand, _item_productName, _ref1, _ref2, _item_productReference, _getItemCategory24, _ref3, _ref4, _item_link, _resizeVtexImage2, _ref5, _item_item_list_name;
|
|
3225
2942
|
var _item_items__sellers, _item_items__sellers1, _item_items__name, _item_items_, _item_items__name1, _item_items_1, _item_items, _item_items__images, _item_items1, _item_items__sellers2, _item_items_2, _item_items2;
|
|
3226
2943
|
var listPrice = item === null || item === void 0 ? void 0 : (_item_items__sellers = item.items[0].sellers) === null || _item_items__sellers === void 0 ? void 0 : _item_items__sellers[0].commertialOffer.ListPrice;
|
|
3227
2944
|
var price = item === null || item === void 0 ? void 0 : (_item_items__sellers1 = item.items[0].sellers) === null || _item_items__sellers1 === void 0 ? void 0 : _item_items__sellers1[0].commertialOffer.Price;
|
|
@@ -3237,8 +2954,8 @@ var AzzasTracker = function() {
|
|
|
3237
2954
|
item_variant2: (_ref2 = (_item_items_1 = item.items[0]) === null || _item_items_1 === void 0 ? void 0 : (_item_items__name1 = _item_items_1.name) === null || _item_items__name1 === void 0 ? void 0 : _item_items__name1.split(" - ")[1]) !== null && _ref2 !== void 0 ? _ref2 : null,
|
|
3238
2955
|
item_ref: (_item_productReference = item.productReference) !== null && _item_productReference !== void 0 ? _item_productReference : null,
|
|
3239
2956
|
// sem ref no retorno do IS na multi-lib produtos PDC
|
|
3240
|
-
item_category:
|
|
3241
|
-
item_category2: (
|
|
2957
|
+
item_category: getItemCategory6(item),
|
|
2958
|
+
item_category2: (_getItemCategory24 = getItemCategory24(item)) !== null && _getItemCategory24 !== void 0 ? _getItemCategory24 : null,
|
|
3242
2959
|
item_id: (_ref3 = item === null || item === void 0 ? void 0 : item.productId) !== null && _ref3 !== void 0 ? _ref3 : null,
|
|
3243
2960
|
item_sku: (_ref4 = (_item_items = item.items) === null || _item_items === void 0 ? void 0 : _item_items[0].itemId) !== null && _ref4 !== void 0 ? _ref4 : null,
|
|
3244
2961
|
item_url: (_item_link = item.link) !== null && _item_link !== void 0 ? _item_link : null,
|
|
@@ -3293,7 +3010,7 @@ var AzzasTracker = function() {
|
|
|
3293
3010
|
if (context === null || context === void 0 ? void 0 : context.items) return context.items;
|
|
3294
3011
|
if (context === null || context === void 0 ? void 0 : context.products) {
|
|
3295
3012
|
return context.products.map(function(item) {
|
|
3296
|
-
var _ref, _item_brand_name, _item_name, _ref1, _ref2, _item_additionalProperty,
|
|
3013
|
+
var _ref, _item_brand_name, _item_name, _ref1, _ref2, _item_additionalProperty, _getItemCategory24, _item_isVariantOf_productGroupID, _item_sku, _resizeVtexImage2, _ref3, _item_item_list_name;
|
|
3297
3014
|
var _item_isVariantOf_hasVariant, _item_isVariantOf, _find, _item_image, _item_offers_offers_find_seller, _item_offers_offers_find, _item_offers_offers, _item_offers;
|
|
3298
3015
|
var listPrice = item.offers.highPrice;
|
|
3299
3016
|
var price = item.offers.lowPrice;
|
|
@@ -3311,8 +3028,8 @@ var AzzasTracker = function() {
|
|
|
3311
3028
|
})) === null || _find === void 0 ? void 0 : _find.value) !== null && _ref2 !== void 0 ? _ref2 : null,
|
|
3312
3029
|
item_ref: null,
|
|
3313
3030
|
// sem ref no retorno do IS na multi-lib produtos PDC
|
|
3314
|
-
item_category:
|
|
3315
|
-
item_category2: (
|
|
3031
|
+
item_category: getItemCategory6(item),
|
|
3032
|
+
item_category2: (_getItemCategory24 = getItemCategory24(item)) !== null && _getItemCategory24 !== void 0 ? _getItemCategory24 : null,
|
|
3316
3033
|
item_id: (_item_isVariantOf_productGroupID = item.isVariantOf.productGroupID) !== null && _item_isVariantOf_productGroupID !== void 0 ? _item_isVariantOf_productGroupID : null,
|
|
3317
3034
|
item_sku: (_item_sku = item.sku) !== null && _item_sku !== void 0 ? _item_sku : null,
|
|
3318
3035
|
item_url: null,
|
|
@@ -3474,7 +3191,7 @@ var AzzasTracker = function() {
|
|
|
3474
3191
|
});
|
|
3475
3192
|
}) : orderForm.items;
|
|
3476
3193
|
};
|
|
3477
|
-
var
|
|
3194
|
+
var getItemCategory7 = function(item) {
|
|
3478
3195
|
var _text_match;
|
|
3479
3196
|
var categories = item === null || item === void 0 ? void 0 : item.productCategories;
|
|
3480
3197
|
if (!categories) return "Cole\xE7\xE3o";
|
|
@@ -3482,14 +3199,14 @@ var AzzasTracker = function() {
|
|
|
3482
3199
|
var match = (_text_match = text.match(/outlet|bazar|sale/i)) === null || _text_match === void 0 ? void 0 : _text_match[0].toLowerCase();
|
|
3483
3200
|
return match !== null && match !== void 0 ? match : "Cole\xE7\xE3o";
|
|
3484
3201
|
};
|
|
3485
|
-
var
|
|
3202
|
+
var getItemCategory25 = function(item) {
|
|
3486
3203
|
var _ref, _validHierarchy_;
|
|
3487
|
-
var
|
|
3204
|
+
var AVOID_CATEGORIES = /outlet|bazar|sale|coleção|promoção/i;
|
|
3488
3205
|
var categories = Object.values((_ref = item === null || item === void 0 ? void 0 : item.productCategories) !== null && _ref !== void 0 ? _ref : {});
|
|
3489
3206
|
var validHierarchy = categories.map(function(c) {
|
|
3490
3207
|
return c.trim();
|
|
3491
3208
|
}).filter(function(c) {
|
|
3492
|
-
return c && !
|
|
3209
|
+
return c && !AVOID_CATEGORIES.test(c);
|
|
3493
3210
|
});
|
|
3494
3211
|
var deepest = (_validHierarchy_ = validHierarchy[validHierarchy.length - 1]) !== null && _validHierarchy_ !== void 0 ? _validHierarchy_ : "";
|
|
3495
3212
|
return capitalize(deepest);
|
|
@@ -3526,7 +3243,7 @@ var AzzasTracker = function() {
|
|
|
3526
3243
|
if (context === null || context === void 0 ? void 0 : context.items) return context.items;
|
|
3527
3244
|
if ((context === null || context === void 0 ? void 0 : context.orderForm) && (context === null || context === void 0 ? void 0 : context.orderForm.items)) {
|
|
3528
3245
|
return getOrderFormItems(context.orderForm).map(function(item, index) {
|
|
3529
|
-
var _ref, _ref1, _ref2, _ref3, _ref4,
|
|
3246
|
+
var _ref, _ref1, _ref2, _ref3, _ref4, _getItemCategory7, _getItemCategory25, _ref5, _ref6, _item_detailUrl, _resizeVtexImage2, _ref7, _ref8;
|
|
3530
3247
|
var _item_skuName_split__split_pop, _item_skuName_split_, _item_skuName, _item_skuName_split_1, _item_skuName1, _context_orderForm, _item_additionalInfo_brandName, _item_additionalInfo, _context_orderForm1;
|
|
3531
3248
|
var color = context.brand === "carolbassi" ? null : item === null || item === void 0 ? void 0 : (_item_skuName = item.skuName) === null || _item_skuName === void 0 ? void 0 : (_item_skuName_split_ = _item_skuName.split(" - ")[0]) === null || _item_skuName_split_ === void 0 ? void 0 : (_item_skuName_split__split_pop = _item_skuName_split_.split("_").pop()) === null || _item_skuName_split__split_pop === void 0 ? void 0 : _item_skuName_split__split_pop.trim();
|
|
3532
3249
|
var size = context.brand === "carolbassi" ? item === null || item === void 0 ? void 0 : item.skuName : item === null || item === void 0 ? void 0 : (_item_skuName1 = item.skuName) === null || _item_skuName1 === void 0 ? void 0 : (_item_skuName_split_1 = _item_skuName1.split(" - ")[1]) === null || _item_skuName_split_1 === void 0 ? void 0 : _item_skuName_split_1.trim();
|
|
@@ -3541,8 +3258,8 @@ var AzzasTracker = function() {
|
|
|
3541
3258
|
item_variant2: (_ref4 = size === null || size === void 0 ? void 0 : size.toUpperCase()) !== null && _ref4 !== void 0 ? _ref4 : null,
|
|
3542
3259
|
item_shipping_tier: getItemShippingTier2(context.orderForm, item),
|
|
3543
3260
|
item_ref: (item === null || item === void 0 ? void 0 : item.productRefId) || (item === null || item === void 0 ? void 0 : item.refId.replace(/_\d+$/, "")) || null,
|
|
3544
|
-
item_category: (
|
|
3545
|
-
item_category2: (
|
|
3261
|
+
item_category: (_getItemCategory7 = getItemCategory7(item)) !== null && _getItemCategory7 !== void 0 ? _getItemCategory7 : null,
|
|
3262
|
+
item_category2: (_getItemCategory25 = getItemCategory25(item)) !== null && _getItemCategory25 !== void 0 ? _getItemCategory25 : null,
|
|
3546
3263
|
item_id: (_ref5 = item === null || item === void 0 ? void 0 : item.productId) !== null && _ref5 !== void 0 ? _ref5 : null,
|
|
3547
3264
|
item_sku: (_ref6 = item === null || item === void 0 ? void 0 : item.id) !== null && _ref6 !== void 0 ? _ref6 : null,
|
|
3548
3265
|
item_url: (_item_detailUrl = item.detailUrl) !== null && _item_detailUrl !== void 0 ? _item_detailUrl : null,
|
|
@@ -3720,8 +3437,7 @@ var AzzasTracker = function() {
|
|
|
3720
3437
|
}).join(" | ");
|
|
3721
3438
|
},
|
|
3722
3439
|
coupon: function(context) {
|
|
3723
|
-
|
|
3724
|
-
return context.appliedCoupon || (context === null || context === void 0 ? void 0 : (_context_orderForm = context.orderForm) === null || _context_orderForm === void 0 ? void 0 : (_context_orderForm_marketingData = _context_orderForm.marketingData) === null || _context_orderForm_marketingData === void 0 ? void 0 : _context_orderForm_marketingData.coupon) || null;
|
|
3440
|
+
return context.appliedCoupon || null;
|
|
3725
3441
|
},
|
|
3726
3442
|
seller_cod_name: function(context) {
|
|
3727
3443
|
return context.appliedSellerCodName || null;
|
|
@@ -3739,8 +3455,7 @@ var AzzasTracker = function() {
|
|
|
3739
3455
|
HEADLESS: headlessAdapter,
|
|
3740
3456
|
PICKUP: pickupAdapter,
|
|
3741
3457
|
ORDERFORM: orderFormAdapter,
|
|
3742
|
-
META: metaAdapter
|
|
3743
|
-
ANIMALE: animaleAdapter
|
|
3458
|
+
META: metaAdapter
|
|
3744
3459
|
};
|
|
3745
3460
|
// src/index.ts
|
|
3746
3461
|
var config = {
|