@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.d.cts CHANGED
@@ -1357,6 +1357,7 @@ interface RatesAndBenefitsData {
1357
1357
  teaser: unknown[];
1358
1358
  }
1359
1359
  interface OrderForm {
1360
+ multipleRemove?: boolean;
1360
1361
  selected?: string;
1361
1362
  index?: number;
1362
1363
  item_list_name: string;
package/dist/mod.d.ts CHANGED
@@ -1357,6 +1357,7 @@ interface RatesAndBenefitsData {
1357
1357
  teaser: unknown[];
1358
1358
  }
1359
1359
  interface OrderForm {
1360
+ multipleRemove?: boolean;
1360
1361
  selected?: string;
1361
1362
  index?: number;
1362
1363
  item_list_name: string;
@@ -1816,7 +1816,11 @@ var AzzasTracker = (() => {
1816
1816
  // src/params/adapters/orderForm/utils.ts
1817
1817
  var getOrderFormItems = (orderForm) => {
1818
1818
  const idSelected = orderForm == null ? void 0 : orderForm.selected;
1819
- return idSelected ? orderForm.items.filter((item) => item.id === idSelected) : orderForm.items;
1819
+ const isMultipleRemove = orderForm == null ? void 0 : orderForm.multipleRemove;
1820
+ return idSelected ? orderForm.items.filter((item) => item.id === idSelected).map((i) => {
1821
+ if (isMultipleRemove) return i;
1822
+ return { ...i, quantity: 1 };
1823
+ }) : orderForm.items;
1820
1824
  };
1821
1825
  var getItemCategory6 = (item) => {
1822
1826
  var _a;
@@ -1843,17 +1847,19 @@ var AzzasTracker = (() => {
1843
1847
  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;
1844
1848
  }
1845
1849
  var getPaymentType2 = (context) => {
1846
- var _a, _b, _c;
1850
+ var _a, _b, _c, _d;
1847
1851
  if (context.payment_type) return context.payment_type;
1848
1852
  if (!context.orderForm) return null;
1849
- const payments = ((_a = context.orderForm.paymentData) == null ? void 0 : _a.payments) || [];
1850
- const systems = ((_b = context.orderForm.paymentData) == null ? void 0 : _b.paymentSystems) || [];
1853
+ const giftCards = ((_a = context.orderForm.paymentData) == null ? void 0 : _a.giftCards) || [];
1854
+ if (giftCards.some((g) => g == null ? void 0 : g.inUse)) return "vale";
1855
+ const payments = ((_b = context.orderForm.paymentData) == null ? void 0 : _b.payments) || [];
1856
+ const systems = ((_c = context.orderForm.paymentData) == null ? void 0 : _c.paymentSystems) || [];
1851
1857
  if (!payments.length || !systems.length) return null;
1852
1858
  const selectedPayment = payments.find((p) => p == null ? void 0 : p.paymentSystem) || payments[0];
1853
1859
  const id = String((selectedPayment == null ? void 0 : selectedPayment.paymentSystem) || "").trim();
1854
1860
  if (!id) return null;
1855
1861
  const system = systems.find((s) => String(s.id) === id);
1856
- const name = ((_c = system == null ? void 0 : system.name) == null ? void 0 : _c.toLowerCase()) || "";
1862
+ const name = ((_d = system == null ? void 0 : system.name) == null ? void 0 : _d.toLowerCase()) || "";
1857
1863
  const match = paymentTypeMap.find(([key]) => name.includes(key));
1858
1864
  return match ? match[1] : null;
1859
1865
  };