@azzas/azzas-tracker-web 2.0.0-preview.15 → 2.0.0-preview.17
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 +43 -30
- package/dist/mod.cjs.map +1 -1
- package/dist/mod.global.js +43 -30
- package/dist/mod.global.js.map +1 -1
- package/dist/mod.js +43 -30
- package/dist/mod.js.map +1 -1
- package/dist/mod.vtex.global.js +52 -30
- package/package.json +1 -1
package/dist/mod.js
CHANGED
|
@@ -1355,7 +1355,7 @@ var metaAdapter = {
|
|
|
1355
1355
|
return context.meta.search_term || null;
|
|
1356
1356
|
},
|
|
1357
1357
|
search_found: (context) => {
|
|
1358
|
-
return context.meta.search_found ||
|
|
1358
|
+
return context.meta.search_found || false;
|
|
1359
1359
|
},
|
|
1360
1360
|
search_quantity: (context) => {
|
|
1361
1361
|
return context.meta.search_quantity || 0;
|
|
@@ -1785,6 +1785,10 @@ var pickupAdapter = {
|
|
|
1785
1785
|
};
|
|
1786
1786
|
|
|
1787
1787
|
// src/params/adapters/orderForm/utils.ts
|
|
1788
|
+
var getOrderFormItems = (orderForm) => {
|
|
1789
|
+
const idSelected = orderForm == null ? void 0 : orderForm.selected;
|
|
1790
|
+
return idSelected ? orderForm.items.filter((item) => item.id === idSelected) : orderForm.items;
|
|
1791
|
+
};
|
|
1788
1792
|
var getItemCategory6 = (item) => {
|
|
1789
1793
|
var _a;
|
|
1790
1794
|
const categories = item == null ? void 0 : item.productCategories;
|
|
@@ -1809,9 +1813,20 @@ function getItemShippingTier2(orderForm, item) {
|
|
|
1809
1813
|
const selectedSla = (_c = info == null ? void 0 : info.slas) == null ? void 0 : _c.find((sla) => sla.id === info.selectedSla);
|
|
1810
1814
|
return ((_d = selectedSla == null ? void 0 : selectedSla.pickupStoreInfo) == null ? void 0 : _d.friendlyName) ? `retirada em loja: ${selectedSla.pickupStoreInfo.friendlyName}` : (selectedSla == null ? void 0 : selectedSla.name) ? `Receba em casa: ${selectedSla.name}` : null;
|
|
1811
1815
|
}
|
|
1812
|
-
var
|
|
1813
|
-
|
|
1814
|
-
|
|
1816
|
+
var getPaymentType2 = (context) => {
|
|
1817
|
+
var _a, _b, _c;
|
|
1818
|
+
if (context.payment_type) return context.payment_type;
|
|
1819
|
+
if (!context.orderForm) return null;
|
|
1820
|
+
const payments = ((_a = context.orderForm.paymentData) == null ? void 0 : _a.payments) || [];
|
|
1821
|
+
const systems = ((_b = context.orderForm.paymentData) == null ? void 0 : _b.paymentSystems) || [];
|
|
1822
|
+
if (!payments.length || !systems.length) return null;
|
|
1823
|
+
const selectedPayment = payments.find((p) => p == null ? void 0 : p.paymentSystem) || payments[0];
|
|
1824
|
+
const id = String((selectedPayment == null ? void 0 : selectedPayment.paymentSystem) || "").trim();
|
|
1825
|
+
if (!id) return null;
|
|
1826
|
+
const system = systems.find((s) => String(s.id) === id);
|
|
1827
|
+
const name = ((_c = system == null ? void 0 : system.name) == null ? void 0 : _c.toLowerCase()) || "";
|
|
1828
|
+
const match = paymentTypeMap.find(([key]) => name.includes(key));
|
|
1829
|
+
return match ? match[1] : null;
|
|
1815
1830
|
};
|
|
1816
1831
|
|
|
1817
1832
|
// src/params/adapters/orderForm/index.ts
|
|
@@ -1821,26 +1836,26 @@ var orderFormAdapter = {
|
|
|
1821
1836
|
if (context == null ? void 0 : context.items) return context.items;
|
|
1822
1837
|
if ((context == null ? void 0 : context.orderForm) && (context == null ? void 0 : context.orderForm.items)) {
|
|
1823
1838
|
return getOrderFormItems(context.orderForm).map((item, index) => {
|
|
1824
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v
|
|
1839
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
1825
1840
|
return {
|
|
1826
1841
|
quantity: (_a = item == null ? void 0 : item.quantity) != null ? _a : 1,
|
|
1827
|
-
index: (
|
|
1828
|
-
item_brand: (
|
|
1829
|
-
item_name: (
|
|
1842
|
+
index: (_c = (_b = context == null ? void 0 : context.orderForm) == null ? void 0 : _b.index) != null ? _c : index + 1,
|
|
1843
|
+
item_brand: (_e = (_d = item.additionalInfo) == null ? void 0 : _d.brandName) != null ? _e : null,
|
|
1844
|
+
item_name: (_f = item == null ? void 0 : item.name.replace(item == null ? void 0 : item.skuName, "").trim()) != null ? _f : null,
|
|
1830
1845
|
price: (item == null ? void 0 : item.price) / 100,
|
|
1831
1846
|
discount: ((item == null ? void 0 : item.listPrice) - (item == null ? void 0 : item.sellingPrice)) / 100,
|
|
1832
|
-
item_variant: (
|
|
1833
|
-
item_variant2: (
|
|
1847
|
+
item_variant: (_j = (_i = (_h = (_g = item == null ? void 0 : item.skuName) == null ? void 0 : _g.split(" - ")[0]) == null ? void 0 : _h.split("_").pop()) == null ? void 0 : _i.trim()) != null ? _j : null,
|
|
1848
|
+
item_variant2: (_m = (_l = (_k = item == null ? void 0 : item.skuName) == null ? void 0 : _k.split(" - ")[1]) == null ? void 0 : _l.trim()) != null ? _m : null,
|
|
1834
1849
|
item_shipping_tier: getItemShippingTier2(context.orderForm, item),
|
|
1835
1850
|
item_ref: (item == null ? void 0 : item.productRefId) || (item == null ? void 0 : item.refId.replace(/_\d+$/, "")) || null,
|
|
1836
|
-
item_category: (
|
|
1837
|
-
item_category2: (
|
|
1838
|
-
item_id: (
|
|
1839
|
-
item_sku: (
|
|
1840
|
-
item_url: (
|
|
1841
|
-
image_url: (
|
|
1842
|
-
seller_id: (
|
|
1843
|
-
item_list_name: (
|
|
1851
|
+
item_category: (_n = getItemCategory6(item)) != null ? _n : null,
|
|
1852
|
+
item_category2: (_o = getItemCategory24(item)) != null ? _o : null,
|
|
1853
|
+
item_id: (_p = item == null ? void 0 : item.productId) != null ? _p : null,
|
|
1854
|
+
item_sku: (_q = item == null ? void 0 : item.id) != null ? _q : null,
|
|
1855
|
+
item_url: (_r = item.detailUrl) != null ? _r : null,
|
|
1856
|
+
image_url: (_s = resizeVtexImage2(item.imageUrl)) != null ? _s : null,
|
|
1857
|
+
seller_id: (_t = item == null ? void 0 : item.seller) != null ? _t : null,
|
|
1858
|
+
item_list_name: (_v = (_u = context == null ? void 0 : context.orderForm) == null ? void 0 : _u.item_list_name) != null ? _v : null
|
|
1844
1859
|
};
|
|
1845
1860
|
});
|
|
1846
1861
|
}
|
|
@@ -1866,7 +1881,7 @@ var orderFormAdapter = {
|
|
|
1866
1881
|
if (!((_a = context == null ? void 0 : context.orderForm) == null ? void 0 : _a.items)) return null;
|
|
1867
1882
|
return getOrderFormItems(context.orderForm).map((item) => (item == null ? void 0 : item.price) / 100 * item.quantity).filter((price) => price !== void 0).reduce((sum, price) => sum + price, 0);
|
|
1868
1883
|
},
|
|
1869
|
-
payment_type:
|
|
1884
|
+
payment_type: getPaymentType2,
|
|
1870
1885
|
total_discount: (context) => {
|
|
1871
1886
|
var _a, _b;
|
|
1872
1887
|
if (context == null ? void 0 : context.total_discount) return context.total_discount;
|
|
@@ -1885,17 +1900,6 @@ var orderFormAdapter = {
|
|
|
1885
1900
|
const subtotal = totalsList.filter((t) => t.id === "Items").reduce((acc, t) => acc + (t.value || 0), 0) / 100 || 0;
|
|
1886
1901
|
return subtotal;
|
|
1887
1902
|
},
|
|
1888
|
-
coupon_message: (context) => {
|
|
1889
|
-
var _a;
|
|
1890
|
-
if (context.couponMessage) return context.couponMessage;
|
|
1891
|
-
const messages = ((_a = context.orderForm) == null ? void 0 : _a.messages) || [];
|
|
1892
|
-
if (messages.length === 0) return null;
|
|
1893
|
-
const couponMessages = messages.filter(
|
|
1894
|
-
(msg) => msg.text.toLowerCase().includes("cupom")
|
|
1895
|
-
);
|
|
1896
|
-
if (couponMessages.length === 0) return null;
|
|
1897
|
-
return couponMessages.map((msg) => msg.text).join(" | ");
|
|
1898
|
-
},
|
|
1899
1903
|
zipcode: (context) => {
|
|
1900
1904
|
var _a;
|
|
1901
1905
|
return (_a = context.meta.zipcode) != null ? _a : null;
|
|
@@ -1978,6 +1982,15 @@ var orderFormAdapter = {
|
|
|
1978
1982
|
var _a, _b;
|
|
1979
1983
|
return ((_b = (_a = context.orderForm) == null ? void 0 : _a.orderGroup) == null ? void 0 : _b.toString()) || null;
|
|
1980
1984
|
},
|
|
1985
|
+
coupon_message: (context) => {
|
|
1986
|
+
var _a;
|
|
1987
|
+
if (context.couponMessage) return context.couponMessage;
|
|
1988
|
+
const messages = ((_a = context.orderForm) == null ? void 0 : _a.messages) || [];
|
|
1989
|
+
if (messages.length === 0) return "C\xF3digo de desconto aplicado com sucesso";
|
|
1990
|
+
const couponMessages = messages.filter((msg) => msg.text.toLowerCase().includes("cupom"));
|
|
1991
|
+
if (couponMessages.length === 0) return "C\xF3digo de desconto aplicado com sucesso";
|
|
1992
|
+
return couponMessages.map((msg) => msg.text).join(" | ");
|
|
1993
|
+
},
|
|
1981
1994
|
coupon: (context) => {
|
|
1982
1995
|
var _a, _b;
|
|
1983
1996
|
return context.appliedCoupon || ((_b = (_a = context == null ? void 0 : context.orderForm) == null ? void 0 : _a.marketingData) == null ? void 0 : _b.coupon) || null;
|