@azzas/azzas-tracker-web 2.0.3-preview.3 → 2.0.3-preview.4
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 +235 -23
- package/dist/mod.cjs.map +1 -1
- package/dist/mod.d.cts +278 -2
- package/dist/mod.d.ts +278 -2
- package/dist/mod.global.js +235 -23
- package/dist/mod.global.js.map +1 -1
- package/dist/mod.js +235 -23
- package/dist/mod.js.map +1 -1
- package/dist/mod.vtex.global.js +307 -24
- package/package.json +1 -1
package/dist/mod.cjs
CHANGED
|
@@ -144,7 +144,6 @@ var EVENTS = {
|
|
|
144
144
|
"promotion_name",
|
|
145
145
|
"creative_slot",
|
|
146
146
|
"creative_name"
|
|
147
|
-
// "items",
|
|
148
147
|
]
|
|
149
148
|
},
|
|
150
149
|
SELECT_PROMOTION: {
|
|
@@ -156,10 +155,8 @@ var EVENTS = {
|
|
|
156
155
|
"region",
|
|
157
156
|
"currency",
|
|
158
157
|
"promotion_name",
|
|
159
|
-
"promotion_url",
|
|
160
158
|
"creative_slot",
|
|
161
159
|
"creative_name"
|
|
162
|
-
// "items",
|
|
163
160
|
]
|
|
164
161
|
},
|
|
165
162
|
SELECT_CONTENT: {
|
|
@@ -1102,8 +1099,8 @@ function getPaymentType(context, eventName) {
|
|
|
1102
1099
|
|
|
1103
1100
|
// src/params/userInfo.ts
|
|
1104
1101
|
var PROD_DOMAINS = {
|
|
1105
|
-
"
|
|
1106
|
-
"store": "https://
|
|
1102
|
+
"lojaanimale": {
|
|
1103
|
+
"store": "https://lojaanimale.myvtex.com",
|
|
1107
1104
|
"checkout": "https://secure.animale.com.br"
|
|
1108
1105
|
},
|
|
1109
1106
|
"lojafarm": {
|
|
@@ -1516,10 +1513,10 @@ var getItemCategory3 = (item) => {
|
|
|
1516
1513
|
};
|
|
1517
1514
|
var getItemCategory22 = (item) => {
|
|
1518
1515
|
var _a, _b, _c, _d;
|
|
1519
|
-
const
|
|
1516
|
+
const AVOID_CATEGORIES2 = /^(outlet|bazar|sale)$/i;
|
|
1520
1517
|
const categories = (_b = (_a = item.category) == null ? void 0 : _a.split(">")) != null ? _b : [];
|
|
1521
1518
|
const last = (_c = categories[categories.length - 1]) != null ? _c : "";
|
|
1522
|
-
const validHierarchy = last.split("/").filter((c) => c && !
|
|
1519
|
+
const validHierarchy = last.split("/").filter((c) => c && !AVOID_CATEGORIES2.test(c));
|
|
1523
1520
|
const deepest = (_d = validHierarchy[validHierarchy.length - 1]) != null ? _d : "";
|
|
1524
1521
|
return capitalize(deepest);
|
|
1525
1522
|
};
|
|
@@ -1627,9 +1624,9 @@ var getItemCategory5 = (item) => {
|
|
|
1627
1624
|
};
|
|
1628
1625
|
var getItemCategory23 = (item) => {
|
|
1629
1626
|
var _a, _b, _c, _d;
|
|
1630
|
-
const
|
|
1627
|
+
const AVOID_CATEGORIES2 = /^(outlet|bazar|sale|coleção|promoção)$/i;
|
|
1631
1628
|
const categories = (_c = (_b = (_a = item == null ? void 0 : item.similarItems) == null ? void 0 : _a[0]) == null ? void 0 : _b.categories) != null ? _c : [];
|
|
1632
|
-
const validHierarchy = categories.filter((c) => c && !
|
|
1629
|
+
const validHierarchy = categories.filter((c) => c && !AVOID_CATEGORIES2.test(c));
|
|
1633
1630
|
const deepest = (_d = validHierarchy[validHierarchy.length - 1]) != null ? _d : "";
|
|
1634
1631
|
return capitalize(deepest);
|
|
1635
1632
|
};
|
|
@@ -1715,8 +1712,222 @@ var reservaAdapter = {
|
|
|
1715
1712
|
}
|
|
1716
1713
|
};
|
|
1717
1714
|
|
|
1718
|
-
// src/params/adapters/
|
|
1715
|
+
// src/params/adapters/animale/utils.ts
|
|
1716
|
+
var SALE_CATEGORIES = /outlet|bazar|sale/i;
|
|
1717
|
+
var AVOID_CATEGORIES = /^(outlet|bazar|sale|cole(ç|c)(ã|a)o)$/i;
|
|
1718
|
+
var getLevels = (path) => path.split("/").filter(Boolean);
|
|
1719
|
+
var isProductCrumb = (path) => /\/p\/?$/.test(path != null ? path : "");
|
|
1720
|
+
var getCategoryPaths = (item) => {
|
|
1721
|
+
var _a, _b, _c;
|
|
1722
|
+
if (item && "categories" in item && ((_a = item.categories) == null ? void 0 : _a.length)) return item.categories;
|
|
1723
|
+
const names = [...(_c = (_b = item == null ? void 0 : item.breadcrumbList) == null ? void 0 : _b.itemListElement) != null ? _c : []].sort((a, b) => {
|
|
1724
|
+
var _a2, _b2;
|
|
1725
|
+
return ((_a2 = a == null ? void 0 : a.position) != null ? _a2 : 0) - ((_b2 = b == null ? void 0 : b.position) != null ? _b2 : 0);
|
|
1726
|
+
}).filter((crumb) => (crumb == null ? void 0 : crumb.name) && !isProductCrumb(crumb == null ? void 0 : crumb.item)).map((crumb) => crumb.name.trim());
|
|
1727
|
+
return names.length ? [`/${names.join("/")}/`] : [];
|
|
1728
|
+
};
|
|
1719
1729
|
var getItemCategory6 = (item) => {
|
|
1730
|
+
var _a;
|
|
1731
|
+
const categories = getCategoryPaths(item);
|
|
1732
|
+
if (!categories.length) return "Cole\xE7\xE3o";
|
|
1733
|
+
const match = (_a = categories.join(" ").match(SALE_CATEGORIES)) == null ? void 0 : _a[0].toLowerCase();
|
|
1734
|
+
return match != null ? match : "Cole\xE7\xE3o";
|
|
1735
|
+
};
|
|
1736
|
+
var getItemCategory24 = (item) => {
|
|
1737
|
+
const categories = getCategoryPaths(item);
|
|
1738
|
+
for (const path of [...categories].reverse()) {
|
|
1739
|
+
const deepest = getLevels(path).reverse().find((level) => !AVOID_CATEGORIES.test(level.trim()));
|
|
1740
|
+
if (deepest) return capitalize(deepest.trim());
|
|
1741
|
+
}
|
|
1742
|
+
return "";
|
|
1743
|
+
};
|
|
1744
|
+
var isInStock = (availability) => /InStock/i.test(availability != null ? availability : "");
|
|
1745
|
+
|
|
1746
|
+
// src/params/adapters/animale/zones/PDC.ts
|
|
1747
|
+
var AnimalePdcZone = {
|
|
1748
|
+
items: (context) => {
|
|
1749
|
+
if (context == null ? void 0 : context.items) return context.items;
|
|
1750
|
+
if (context == null ? void 0 : context.products) {
|
|
1751
|
+
return context.products.map((item) => {
|
|
1752
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A;
|
|
1753
|
+
const listPrice = (_b = (_a = item == null ? void 0 : item.offers) == null ? void 0 : _a.offers) == null ? void 0 : _b[0].listPrice;
|
|
1754
|
+
const price = (_d = (_c = item.offers) == null ? void 0 : _c.offers) == null ? void 0 : _d[0].price;
|
|
1755
|
+
const sellerId = (_h = (_g = (_f = (_e = item == null ? void 0 : item.isVariantOf) == null ? void 0 : _e.hasVariant) == null ? void 0 : _f.find((v) => v.offers.offers.find((o) => o.availability))) == null ? void 0 : _g.offers.offers[0]) == null ? void 0 : _h.seller.identifier;
|
|
1756
|
+
return {
|
|
1757
|
+
quantity: 1,
|
|
1758
|
+
index: (_i = item == null ? void 0 : item.index) != null ? _i : 0,
|
|
1759
|
+
item_brand: (_j = item.brand.name.toLowerCase()) != null ? _j : null,
|
|
1760
|
+
item_name: (_l = (_k = item == null ? void 0 : item.isVariantOf) == null ? void 0 : _k.name) != null ? _l : null,
|
|
1761
|
+
price: price != null ? price : null,
|
|
1762
|
+
item_shipping_tier: null,
|
|
1763
|
+
discount: Number(listPrice) - Number(price),
|
|
1764
|
+
item_variant: (_o = (_n = (_m = item.isVariantOf) == null ? void 0 : _m.hasVariant) == null ? void 0 : _n[0].name.split(" - ")[0]) != null ? _o : null,
|
|
1765
|
+
item_variant2: (_r = (_q = ((_p = item.additionalProperty) != null ? _p : []).find((p) => p.name === "Tamanho")) == null ? void 0 : _q.value) != null ? _r : null,
|
|
1766
|
+
item_ref: (_s = item == null ? void 0 : item.gtin) != null ? _s : null,
|
|
1767
|
+
item_category: getItemCategory6(item),
|
|
1768
|
+
item_category2: (_t = getItemCategory24(item)) != null ? _t : null,
|
|
1769
|
+
item_id: (_v = (_u = item == null ? void 0 : item.isVariantOf) == null ? void 0 : _u.productGroupID) != null ? _v : null,
|
|
1770
|
+
item_sku: (_w = item == null ? void 0 : item.sku) != null ? _w : null,
|
|
1771
|
+
item_url: (_x = item == null ? void 0 : item.slug) != null ? _x : null,
|
|
1772
|
+
// sem link/url no retorno do IS na multi-lib produtos PDC
|
|
1773
|
+
image_url: (_z = resizeVtexImage2((_y = item == null ? void 0 : item.image) == null ? void 0 : _y[0].url)) != null ? _z : null,
|
|
1774
|
+
seller_id: sellerId != null ? sellerId : null,
|
|
1775
|
+
item_list_name: (_A = item.item_list_name) != null ? _A : null
|
|
1776
|
+
};
|
|
1777
|
+
});
|
|
1778
|
+
}
|
|
1779
|
+
return null;
|
|
1780
|
+
},
|
|
1781
|
+
value: (context) => {
|
|
1782
|
+
if (context == null ? void 0 : context.value) return context.value;
|
|
1783
|
+
if (context == null ? void 0 : context.products) {
|
|
1784
|
+
return context.products.map((item) => item.offers.lowPrice).filter((price) => price !== void 0).reduce((sum, price) => sum + price, 0);
|
|
1785
|
+
}
|
|
1786
|
+
return null;
|
|
1787
|
+
},
|
|
1788
|
+
line_items: (context) => {
|
|
1789
|
+
if (context == null ? void 0 : context.line_items) return context.line_items;
|
|
1790
|
+
if (context == null ? void 0 : context.products) {
|
|
1791
|
+
return context.products.map((item) => item.id).filter((id) => Boolean(id)).join();
|
|
1792
|
+
}
|
|
1793
|
+
return null;
|
|
1794
|
+
},
|
|
1795
|
+
brand: (context, config2) => {
|
|
1796
|
+
if (config2 == null ? void 0 : config2.brand) return config2.brand;
|
|
1797
|
+
if (context == null ? void 0 : context.brand) return context.brand;
|
|
1798
|
+
if (context == null ? void 0 : context.products) {
|
|
1799
|
+
return context.products.map((p) => p.brand.name).join().trim();
|
|
1800
|
+
}
|
|
1801
|
+
return null;
|
|
1802
|
+
}
|
|
1803
|
+
};
|
|
1804
|
+
|
|
1805
|
+
// src/params/adapters/animale/zones/PDP.ts
|
|
1806
|
+
var AnimalePdpZone = {
|
|
1807
|
+
items: (context) => {
|
|
1808
|
+
if (context == null ? void 0 : context.items) return context.items;
|
|
1809
|
+
if (context == null ? void 0 : context.products) {
|
|
1810
|
+
return context.products.map((item) => {
|
|
1811
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F;
|
|
1812
|
+
const listPrice = (_b = (_a = item == null ? void 0 : item.offers) == null ? void 0 : _a.offers) == null ? void 0 : _b[0].listPrice;
|
|
1813
|
+
const price = (_d = (_c = item.offers) == null ? void 0 : _c.offers) == null ? void 0 : _d[0].price;
|
|
1814
|
+
const availableOffer = (_g = (_f = (_e = item == null ? void 0 : item.isVariantOf) == null ? void 0 : _e.hasVariant) == null ? void 0 : _f.flatMap((v) => {
|
|
1815
|
+
var _a2, _b2;
|
|
1816
|
+
return (_b2 = (_a2 = v == null ? void 0 : v.offers) == null ? void 0 : _a2.offers) != null ? _b2 : [];
|
|
1817
|
+
})) == null ? void 0 : _g.find((o) => isInStock(o == null ? void 0 : o.availability));
|
|
1818
|
+
const sellerId = (_m = (_h = availableOffer == null ? void 0 : availableOffer.seller) == null ? void 0 : _h.identifier) != null ? _m : (_l = (_k = (_j = (_i = item == null ? void 0 : item.offers) == null ? void 0 : _i.offers) == null ? void 0 : _j[0]) == null ? void 0 : _k.seller) == null ? void 0 : _l.identifier;
|
|
1819
|
+
return {
|
|
1820
|
+
quantity: 1,
|
|
1821
|
+
index: (_n = item == null ? void 0 : item.index) != null ? _n : 0,
|
|
1822
|
+
item_brand: (_o = item.brand.name.toLowerCase()) != null ? _o : null,
|
|
1823
|
+
item_name: (_q = (_p = item == null ? void 0 : item.isVariantOf) == null ? void 0 : _p.name) != null ? _q : null,
|
|
1824
|
+
price: price != null ? price : null,
|
|
1825
|
+
item_shipping_tier: null,
|
|
1826
|
+
discount: Number(listPrice) - Number(price),
|
|
1827
|
+
item_variant: (_t = (_s = (_r = item.isVariantOf) == null ? void 0 : _r.hasVariant) == null ? void 0 : _s[0].name.split(" - ")[0]) != null ? _t : null,
|
|
1828
|
+
item_variant2: (_w = (_v = ((_u = item.additionalProperty) != null ? _u : []).find((p) => p.name === "Tamanho")) == null ? void 0 : _v.value) != null ? _w : null,
|
|
1829
|
+
item_ref: (_x = item == null ? void 0 : item.gtin) != null ? _x : null,
|
|
1830
|
+
item_category: getItemCategory6(item),
|
|
1831
|
+
item_category2: (_y = getItemCategory24(item)) != null ? _y : null,
|
|
1832
|
+
item_id: (_A = (_z = item == null ? void 0 : item.isVariantOf) == null ? void 0 : _z.productGroupID) != null ? _A : null,
|
|
1833
|
+
item_sku: (_B = item == null ? void 0 : item.sku) != null ? _B : null,
|
|
1834
|
+
item_url: (_C = item == null ? void 0 : item.slug) != null ? _C : null,
|
|
1835
|
+
// sem link/url no retorno do IS na multi-lib produtos PDC
|
|
1836
|
+
image_url: (_E = resizeVtexImage2((_D = item == null ? void 0 : item.image) == null ? void 0 : _D[0].url)) != null ? _E : null,
|
|
1837
|
+
seller_id: sellerId != null ? sellerId : null,
|
|
1838
|
+
item_list_name: (_F = item.item_list_name) != null ? _F : null
|
|
1839
|
+
};
|
|
1840
|
+
});
|
|
1841
|
+
}
|
|
1842
|
+
return null;
|
|
1843
|
+
},
|
|
1844
|
+
value: (context) => {
|
|
1845
|
+
if (context == null ? void 0 : context.value) return context.value;
|
|
1846
|
+
if (context == null ? void 0 : context.products) {
|
|
1847
|
+
return context.products.map((item) => item.offers.lowPrice).filter((price) => price !== void 0).reduce((sum, price) => sum + price, 0);
|
|
1848
|
+
}
|
|
1849
|
+
return null;
|
|
1850
|
+
},
|
|
1851
|
+
line_items: (context) => {
|
|
1852
|
+
if (context == null ? void 0 : context.line_items) return context.line_items;
|
|
1853
|
+
if (context == null ? void 0 : context.products) {
|
|
1854
|
+
return context.products.map((item) => item.id).filter((id) => Boolean(id)).join();
|
|
1855
|
+
}
|
|
1856
|
+
return null;
|
|
1857
|
+
},
|
|
1858
|
+
brand: (context, config2) => {
|
|
1859
|
+
if (config2 == null ? void 0 : config2.brand) return config2.brand;
|
|
1860
|
+
if (context == null ? void 0 : context.brand) return context.brand;
|
|
1861
|
+
if (context == null ? void 0 : context.products) {
|
|
1862
|
+
return context.products.map((p) => p.brand.name).join().trim();
|
|
1863
|
+
}
|
|
1864
|
+
return null;
|
|
1865
|
+
}
|
|
1866
|
+
};
|
|
1867
|
+
|
|
1868
|
+
// src/params/adapters/animale/index.ts
|
|
1869
|
+
var animaleAdapter = {
|
|
1870
|
+
...metaAdapter,
|
|
1871
|
+
// global adapters
|
|
1872
|
+
brand: (context, config2) => {
|
|
1873
|
+
if (context.zone === "PDP") {
|
|
1874
|
+
return AnimalePdpZone.brand(context, config2);
|
|
1875
|
+
}
|
|
1876
|
+
if (context.zone === "PDC") {
|
|
1877
|
+
return AnimalePdcZone.brand(context, config2);
|
|
1878
|
+
}
|
|
1879
|
+
return null;
|
|
1880
|
+
},
|
|
1881
|
+
line_items: (context) => {
|
|
1882
|
+
if (context.zone === "PDP") {
|
|
1883
|
+
return AnimalePdpZone.line_items(context);
|
|
1884
|
+
}
|
|
1885
|
+
if (context.zone === "PDC") {
|
|
1886
|
+
return AnimalePdcZone.line_items(context);
|
|
1887
|
+
}
|
|
1888
|
+
return null;
|
|
1889
|
+
},
|
|
1890
|
+
value: (context) => {
|
|
1891
|
+
if (context.zone === "PDP") {
|
|
1892
|
+
return AnimalePdpZone.value(context);
|
|
1893
|
+
}
|
|
1894
|
+
if (context.zone === "PDC") {
|
|
1895
|
+
return AnimalePdcZone.value(context);
|
|
1896
|
+
}
|
|
1897
|
+
return null;
|
|
1898
|
+
},
|
|
1899
|
+
items: (context) => {
|
|
1900
|
+
if (context.zone === "PDP") {
|
|
1901
|
+
return AnimalePdpZone.items(context);
|
|
1902
|
+
}
|
|
1903
|
+
if (context.zone === "PDC") {
|
|
1904
|
+
return AnimalePdcZone.items(context);
|
|
1905
|
+
}
|
|
1906
|
+
},
|
|
1907
|
+
// param used only in one Zone, the PDP; no need condition
|
|
1908
|
+
available_grid: (context) => {
|
|
1909
|
+
if (context == null ? void 0 : context.available_grid) return context.available_grid;
|
|
1910
|
+
if (context == null ? void 0 : context.products) {
|
|
1911
|
+
const sizes = context.products.flatMap(
|
|
1912
|
+
(p) => {
|
|
1913
|
+
var _a, _b;
|
|
1914
|
+
return ((_b = (_a = p == null ? void 0 : p.isVariantOf) == null ? void 0 : _a.hasVariant) != null ? _b : []).flatMap((variant) => {
|
|
1915
|
+
var _a2, _b2, _c, _d;
|
|
1916
|
+
const available = (_b2 = (_a2 = variant == null ? void 0 : variant.offers) == null ? void 0 : _a2.offers) == null ? void 0 : _b2.some((o) => isInStock(o == null ? void 0 : o.availability));
|
|
1917
|
+
const size = (_d = (_c = variant == null ? void 0 : variant.additionalProperty) == null ? void 0 : _c.find((prop) => (prop == null ? void 0 : prop.name) === "Tamanho")) == null ? void 0 : _d.value;
|
|
1918
|
+
return available && size ? [size] : [];
|
|
1919
|
+
});
|
|
1920
|
+
}
|
|
1921
|
+
);
|
|
1922
|
+
const result = sortSizes(sizes).join(",");
|
|
1923
|
+
return result || null;
|
|
1924
|
+
}
|
|
1925
|
+
return null;
|
|
1926
|
+
}
|
|
1927
|
+
};
|
|
1928
|
+
|
|
1929
|
+
// src/params/adapters/headless/utils.ts
|
|
1930
|
+
var getItemCategory7 = (item) => {
|
|
1720
1931
|
const keywords = ["outlet", "bazar", "sale"];
|
|
1721
1932
|
const regex = new RegExp(keywords.join("|"), "i");
|
|
1722
1933
|
const value = item == null ? void 0 : item.categories;
|
|
@@ -1729,7 +1940,7 @@ var getItemCategory6 = (item) => {
|
|
|
1729
1940
|
}
|
|
1730
1941
|
return "Cole\xE7\xE3o";
|
|
1731
1942
|
};
|
|
1732
|
-
var
|
|
1943
|
+
var getItemCategory25 = (item) => {
|
|
1733
1944
|
var _a, _b, _c;
|
|
1734
1945
|
const avoidList = /outlet|bazar|sale/i;
|
|
1735
1946
|
const lastCategory = (_b = (_a = item.categories) == null ? void 0 : _a[item.categories.length - 1]) != null ? _b : "";
|
|
@@ -1759,8 +1970,8 @@ var HeadlessPdpZone = {
|
|
|
1759
1970
|
item_variant2: (_k = (_j = (_i = item.items[0]) == null ? void 0 : _i.name) == null ? void 0 : _j.split(" - ")[1]) != null ? _k : null,
|
|
1760
1971
|
item_ref: (_l = item.productReference) != null ? _l : null,
|
|
1761
1972
|
// sem ref no retorno do IS na multi-lib produtos PDC
|
|
1762
|
-
item_category:
|
|
1763
|
-
item_category2: (_m =
|
|
1973
|
+
item_category: getItemCategory7(item),
|
|
1974
|
+
item_category2: (_m = getItemCategory25(item)) != null ? _m : null,
|
|
1764
1975
|
item_id: (_n = item == null ? void 0 : item.productId) != null ? _n : null,
|
|
1765
1976
|
item_sku: (_p = (_o = item.items) == null ? void 0 : _o[0].itemId) != null ? _p : null,
|
|
1766
1977
|
item_url: (_q = item.link) != null ? _q : null,
|
|
@@ -1821,8 +2032,8 @@ var HeadlessPdcZone = {
|
|
|
1821
2032
|
item_variant2: (_i = (_h = ((_g = item.additionalProperty) != null ? _g : []).find((p) => p.name === "Tamanho")) == null ? void 0 : _h.value) != null ? _i : null,
|
|
1822
2033
|
item_ref: null,
|
|
1823
2034
|
// sem ref no retorno do IS na multi-lib produtos PDC
|
|
1824
|
-
item_category:
|
|
1825
|
-
item_category2: (_j =
|
|
2035
|
+
item_category: getItemCategory7(item),
|
|
2036
|
+
item_category2: (_j = getItemCategory25(item)) != null ? _j : null,
|
|
1826
2037
|
item_id: (_k = item.isVariantOf.productGroupID) != null ? _k : null,
|
|
1827
2038
|
item_sku: (_l = item.sku) != null ? _l : null,
|
|
1828
2039
|
item_url: null,
|
|
@@ -1968,7 +2179,7 @@ var getOrderFormItems = (orderForm) => {
|
|
|
1968
2179
|
return { ...i, quantity: 1 };
|
|
1969
2180
|
}) : orderForm.items;
|
|
1970
2181
|
};
|
|
1971
|
-
var
|
|
2182
|
+
var getItemCategory8 = (item) => {
|
|
1972
2183
|
var _a;
|
|
1973
2184
|
const categories = item == null ? void 0 : item.productCategories;
|
|
1974
2185
|
if (!categories) return "Cole\xE7\xE3o";
|
|
@@ -1976,11 +2187,11 @@ var getItemCategory7 = (item) => {
|
|
|
1976
2187
|
const match = (_a = text.match(/outlet|bazar|sale/i)) == null ? void 0 : _a[0].toLowerCase();
|
|
1977
2188
|
return match != null ? match : "Cole\xE7\xE3o";
|
|
1978
2189
|
};
|
|
1979
|
-
var
|
|
2190
|
+
var getItemCategory26 = (item) => {
|
|
1980
2191
|
var _a, _b;
|
|
1981
|
-
const
|
|
2192
|
+
const AVOID_CATEGORIES2 = /outlet|bazar|sale|coleção|promoção/i;
|
|
1982
2193
|
const categories = Object.values((_a = item == null ? void 0 : item.productCategories) != null ? _a : {});
|
|
1983
|
-
const validHierarchy = categories.map((c) => c.trim()).filter((c) => c && !
|
|
2194
|
+
const validHierarchy = categories.map((c) => c.trim()).filter((c) => c && !AVOID_CATEGORIES2.test(c));
|
|
1984
2195
|
const deepest = (_b = validHierarchy[validHierarchy.length - 1]) != null ? _b : "";
|
|
1985
2196
|
return capitalize(deepest);
|
|
1986
2197
|
};
|
|
@@ -2031,8 +2242,8 @@ var orderFormAdapter = {
|
|
|
2031
2242
|
item_variant2: (_m = size == null ? void 0 : size.toUpperCase()) != null ? _m : null,
|
|
2032
2243
|
item_shipping_tier: getItemShippingTier2(context.orderForm, item),
|
|
2033
2244
|
item_ref: (item == null ? void 0 : item.productRefId) || (item == null ? void 0 : item.refId.replace(/_\d+$/, "")) || null,
|
|
2034
|
-
item_category: (_n =
|
|
2035
|
-
item_category2: (_o =
|
|
2245
|
+
item_category: (_n = getItemCategory8(item)) != null ? _n : null,
|
|
2246
|
+
item_category2: (_o = getItemCategory26(item)) != null ? _o : null,
|
|
2036
2247
|
item_id: (_p = item == null ? void 0 : item.productId) != null ? _p : null,
|
|
2037
2248
|
item_sku: (_q = item == null ? void 0 : item.id) != null ? _q : null,
|
|
2038
2249
|
item_url: (_r = item.detailUrl) != null ? _r : null,
|
|
@@ -2276,7 +2487,8 @@ var adapters = {
|
|
|
2276
2487
|
HEADLESS: headlessAdapter,
|
|
2277
2488
|
PICKUP: pickupAdapter,
|
|
2278
2489
|
ORDERFORM: orderFormAdapter,
|
|
2279
|
-
META: metaAdapter
|
|
2490
|
+
META: metaAdapter,
|
|
2491
|
+
ANIMALE: animaleAdapter
|
|
2280
2492
|
};
|
|
2281
2493
|
async function getParameters(context, eventName, config2) {
|
|
2282
2494
|
var _a;
|
|
@@ -2320,7 +2532,7 @@ async function trackWebEvent(event, context) {
|
|
|
2320
2532
|
}
|
|
2321
2533
|
if (isDebugMode()) {
|
|
2322
2534
|
console.log(
|
|
2323
|
-
`%c [DT v2] %c ${event} `,
|
|
2535
|
+
`%c [DT v2 - Animale Preview] %c ${event} `,
|
|
2324
2536
|
"background: #6366f1; color: #fff; font-weight: bold; padding: 2px 6px; border-radius: 4px 0 0 4px;",
|
|
2325
2537
|
"background: #1e1e2e; color: #a5b4fc; font-weight: bold; padding: 2px 6px; border-radius: 0 4px 4px 0;",
|
|
2326
2538
|
{ context, parameters }
|