@azzas/azzas-tracker-web 2.0.1-preview.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.cjs CHANGED
@@ -987,8 +987,8 @@ var documentToHash = async (document2) => {
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";
@@ -1087,13 +1087,15 @@ var PROD_DOMAINS = {
1087
1087
  "checkout": "https://secure.offpremium.com.br"
1088
1088
  },
1089
1089
  "carolbassi": {
1090
- "store": "https://carolbassi.myvtex.com"
1090
+ "store": "https://carolbassi.myvtex.com",
1091
+ "checkout": "https://secure.carolbassi.com.br"
1091
1092
  },
1092
1093
  "bynv": {
1093
1094
  "store": "https://bynv.myvtex.com"
1094
1095
  },
1095
1096
  "lojafabula": {
1096
- "store": "https://lojafabula.myvtex.com"
1097
+ "store": "https://lojafabula.myvtex.com",
1098
+ "checkout": "https://secure.lojafabula.com.br"
1097
1099
  }
1098
1100
  };
1099
1101
  async function getUserInfo(context) {
@@ -1656,13 +1658,12 @@ var reservaAdapter = {
1656
1658
  available_grid: (context) => {
1657
1659
  if (context == null ? void 0 : context.available_grid) return context.available_grid;
1658
1660
  if (context == null ? void 0 : context.products) {
1659
- const sizes = context.products.filter((product) => {
1660
- var _a, _b;
1661
- return (_b = (_a = product.offers) == null ? void 0 : _a.offers) == null ? void 0 : _b.some((o) => o.availability === "https://schema.org/InStock");
1662
- }).map((product) => {
1663
- var _a;
1664
- return (_a = product.name) == null ? void 0 : _a.split(" - ")[1];
1665
- }).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
+ );
1666
1667
  const result = sortSizes(sizes).join(",").trim();
1667
1668
  return result || null;
1668
1669
  }
@@ -2023,10 +2024,13 @@ var orderFormAdapter = {
2023
2024
  total_discount: (context) => {
2024
2025
  var _a, _b, _c;
2025
2026
  if (context == null ? void 0 : context.total_discount) return context.total_discount;
2026
- if (!((_a = context == null ? void 0 : context.orderForm) == null ? void 0 : _a.items)) return null;
2027
- const totalizers = (_b = context == null ? void 0 : context.orderForm) == null ? void 0 : _b.totalizers;
2028
- const productDiscount = ((_c = totalizers.find((t) => t.id === "Discounts")) == null ? void 0 : _c.value) || 0;
2029
- return Math.abs(productDiscount) / 100 || null;
2027
+ const orderForm = context == null ? void 0 : context.orderForm;
2028
+ const items = orderForm == null ? void 0 : orderForm.items;
2029
+ if (!(items == null ? void 0 : items.length) || typeof (orderForm == null ? void 0 : orderForm.value) !== "number") return null;
2030
+ const itemsFullValue = items.reduce((acc, item) => acc + item.listPrice * item.quantity, 0);
2031
+ const shipping = (_c = (_b = (_a = orderForm == null ? void 0 : orderForm.totalizers) == null ? void 0 : _a.find((t) => t.id === "Shipping")) == null ? void 0 : _b.value) != null ? _c : 0;
2032
+ const derived = itemsFullValue + shipping - orderForm.value;
2033
+ return derived > 0 ? derived / 100 : null;
2030
2034
  },
2031
2035
  subtotal: (context) => {
2032
2036
  var _a, _b;