@azzas/azzas-tracker-web 2.0.0-preview.18 → 2.0.0-preview.19

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.js CHANGED
@@ -1787,7 +1787,11 @@ var pickupAdapter = {
1787
1787
  // src/params/adapters/orderForm/utils.ts
1788
1788
  var getOrderFormItems = (orderForm) => {
1789
1789
  const idSelected = orderForm == null ? void 0 : orderForm.selected;
1790
- return idSelected ? orderForm.items.filter((item) => item.id === idSelected) : orderForm.items;
1790
+ const isMultipleRemove = orderForm == null ? void 0 : orderForm.multipleRemove;
1791
+ return idSelected ? orderForm.items.filter((item) => item.id === idSelected).map((i) => {
1792
+ if (isMultipleRemove) return i;
1793
+ return { ...i, quantity: 1 };
1794
+ }) : orderForm.items;
1791
1795
  };
1792
1796
  var getItemCategory6 = (item) => {
1793
1797
  var _a;
@@ -1814,17 +1818,19 @@ function getItemShippingTier2(orderForm, item) {
1814
1818
  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;
1815
1819
  }
1816
1820
  var getPaymentType2 = (context) => {
1817
- var _a, _b, _c;
1821
+ var _a, _b, _c, _d;
1818
1822
  if (context.payment_type) return context.payment_type;
1819
1823
  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) || [];
1824
+ const giftCards = ((_a = context.orderForm.paymentData) == null ? void 0 : _a.giftCards) || [];
1825
+ if (giftCards.some((g) => g == null ? void 0 : g.inUse)) return "vale";
1826
+ const payments = ((_b = context.orderForm.paymentData) == null ? void 0 : _b.payments) || [];
1827
+ const systems = ((_c = context.orderForm.paymentData) == null ? void 0 : _c.paymentSystems) || [];
1822
1828
  if (!payments.length || !systems.length) return null;
1823
1829
  const selectedPayment = payments.find((p) => p == null ? void 0 : p.paymentSystem) || payments[0];
1824
1830
  const id = String((selectedPayment == null ? void 0 : selectedPayment.paymentSystem) || "").trim();
1825
1831
  if (!id) return null;
1826
1832
  const system = systems.find((s) => String(s.id) === id);
1827
- const name = ((_c = system == null ? void 0 : system.name) == null ? void 0 : _c.toLowerCase()) || "";
1833
+ const name = ((_d = system == null ? void 0 : system.name) == null ? void 0 : _d.toLowerCase()) || "";
1828
1834
  const match = paymentTypeMap.find(([key]) => name.includes(key));
1829
1835
  return match ? match[1] : null;
1830
1836
  };