@plurix/ecom-components 1.14.1-eng-task-1249.8 → 1.14.1-eng-task-1249.10

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.
@@ -1,5 +1,5 @@
1
1
  import { jsx as a, jsxs as k, Fragment as A } from "react/jsx-runtime";
2
- import { useState as l, useEffect as E } from "react";
2
+ import { useState as p, useEffect as E } from "react";
3
3
  import { Modal as J } from "../Modal/Modal.js";
4
4
  import { ProductSelected as _ } from "./components/ProductSelected.js";
5
5
  import { SimilarProducts as v } from "./components/SimilarProducts.js";
@@ -13,17 +13,17 @@ import { Skeleton as H } from "../Skeleton/index.js";
13
13
  const no = ({
14
14
  selectedItem: o,
15
15
  postalCode: S,
16
- orderFormId: d,
16
+ orderFormId: c,
17
17
  isClubClient: O,
18
18
  isOpen: y,
19
19
  environment: b,
20
- setIsOpen: p,
21
- saveSelectedSimilarProduct: c,
20
+ setIsOpen: f,
21
+ saveSelectedSimilarProduct: e,
22
22
  getOrderFormMutation: C,
23
23
  getProductsSimilarsMutation: F,
24
24
  postChangeOrderMutation: P
25
25
  }) => {
26
- const [s, x] = l(), [N, m] = l(!1), r = b === "io", { genericTaggingEvent: j } = $(), [t, g] = l({ itemId: "" });
26
+ const [s, x] = p(), [N, m] = p(!1), r = b === "io", { genericTaggingEvent: j } = $(), [t, l] = p({ itemId: "" });
27
27
  E(() => {
28
28
  (async () => {
29
29
  m(!0);
@@ -42,13 +42,13 @@ const no = ({
42
42
  var i, u;
43
43
  m(!0);
44
44
  try {
45
- const e = r ? B(d, r) : await C({
45
+ const g = r ? B(c, r) : await C({
46
46
  input: {
47
- orderFormId: d
47
+ orderFormId: c
48
48
  }
49
- });
50
- console.log("rest", e);
51
- const f = r ? e : JSON.parse(e.getOrderForm.data), n = ((u = (i = f == null ? void 0 : f.customData) == null ? void 0 : i.customApps) == null ? void 0 : u.find(
49
+ }), d = r ? g : JSON.parse(g.getOrderForm.data);
50
+ console.log("parsedResponse", d);
51
+ const n = ((u = (i = d == null ? void 0 : d.customData) == null ? void 0 : i.customApps) == null ? void 0 : u.find(
52
52
  (M) => M.id === "janis"
53
53
  )) || null;
54
54
  let h = {};
@@ -56,7 +56,7 @@ const no = ({
56
56
  n == null ? void 0 : n.fields.idSubstitutionCriterias
57
57
  ));
58
58
  const w = o == null ? void 0 : o.productOriginId;
59
- g({
59
+ l({
60
60
  itemId: `${h[w]}`
61
61
  });
62
62
  } finally {
@@ -66,21 +66,21 @@ const no = ({
66
66
  }, []);
67
67
  const q = () => {
68
68
  G(
69
- d,
69
+ c,
70
70
  r,
71
71
  o.productOriginId,
72
72
  t.itemId,
73
73
  P
74
- ), t && (c == null || c(t), j("salvar_substituto", {
74
+ ), t && (e == null || e(t), j("salvar_substituto", {
75
75
  name: o.name,
76
76
  replacement_item: t == null ? void 0 : t.name
77
- })), p(!1);
77
+ })), f(!1);
78
78
  };
79
79
  return /* @__PURE__ */ a(
80
80
  J,
81
81
  {
82
82
  isOpen: y,
83
- setIsOpen: p,
83
+ setIsOpen: f,
84
84
  className: "change-order-modal",
85
85
  title: "Produto com estoque baixo",
86
86
  Footer: s && s.length > 0 && /* @__PURE__ */ a(
@@ -105,7 +105,7 @@ const no = ({
105
105
  {
106
106
  isClubClient: O,
107
107
  similarProductSelect: t,
108
- setSimilarProductSelect: g,
108
+ setSimilarProductSelect: l,
109
109
  products: s
110
110
  }
111
111
  ) : /* @__PURE__ */ a(z, {})
@@ -1,49 +1,41 @@
1
- import { jsxs as c, jsx as e } from "react/jsx-runtime";
2
- import { useMemo as p } from "react";
3
- import { isMobile as u } from "../../../constants/index.js";
4
- import { formatBrazilianPrice as n, formatedQty as h } from "../../../utils/changerOrderModal.js";
5
- const M = ({ selectedItem: l }) => {
1
+ import { jsxs as r, jsx as e } from "react/jsx-runtime";
2
+ import { useMemo as d } from "react";
3
+ import { isMobile as p } from "../../../constants/index.js";
4
+ import { formatedQty as h, formatBrazilianPrice as u } from "../../../utils/changerOrderModal.js";
5
+ const P = ({ selectedItem: n }) => {
6
6
  const {
7
7
  imageUrl: t,
8
- name: o,
9
- quantity: i,
10
- sellingPrice: m,
8
+ name: i,
9
+ quantity: a,
10
+ sellingPrice: o,
11
11
  measurementUnit: s,
12
- unitMultiplier: r
13
- } = l || {};
14
- console.log({
15
- measurementUnit: s,
16
- unitMultiplier: r,
17
- quantity: i,
18
- testeunitMultiplier: n(r || 0),
19
- testeuquantity: n(i || 0)
20
- });
21
- const a = p(() => u ? 48 : 80, []), d = t == null ? void 0 : t.replace("-55-55", "-80-80");
22
- return /* @__PURE__ */ c("section", { className: "change-order-pre-content", children: [
12
+ unitMultiplier: l
13
+ } = n || {}, c = d(() => p ? 48 : 80, []), m = t == null ? void 0 : t.replace("-55-55", "-80-80");
14
+ return /* @__PURE__ */ r("section", { className: "change-order-pre-content", children: [
23
15
  /* @__PURE__ */ e(
24
16
  "img",
25
17
  {
26
- height: a,
27
- width: a,
18
+ height: c,
19
+ width: c,
28
20
  style: { objectFit: "contain", width: "20%" },
29
- src: d,
30
- alt: o,
21
+ src: m,
22
+ alt: i,
31
23
  className: "change-order-pre-content-img"
32
24
  }
33
25
  ),
34
- /* @__PURE__ */ c("div", { className: "change-order-pre-content-infos", children: [
35
- /* @__PURE__ */ e("h3", { className: "product-name", children: o }),
36
- /* @__PURE__ */ c("div", { className: "product-details", children: [
26
+ /* @__PURE__ */ r("div", { className: "change-order-pre-content-infos", children: [
27
+ /* @__PURE__ */ e("h3", { className: "product-name", children: i }),
28
+ /* @__PURE__ */ r("div", { className: "product-details", children: [
37
29
  /* @__PURE__ */ e("p", { className: "quantity", children: h(
38
30
  s || "",
39
- r || 0,
40
- i || 0
31
+ l || 0,
32
+ a || 0
41
33
  ) }),
42
- /* @__PURE__ */ e("p", { className: "sellingPrice", children: n(m || 0) })
34
+ /* @__PURE__ */ e("p", { className: "sellingPrice", children: u(o || 0) })
43
35
  ] })
44
36
  ] })
45
37
  ] });
46
38
  };
47
39
  export {
48
- M as ProductSelected
40
+ P as ProductSelected
49
41
  };
@@ -1,20 +1,17 @@
1
- const s = (t, r, e = "") => {
2
- if (e === "un")
1
+ const i = (t, e, r = "") => {
2
+ if (r === "un")
3
3
  return t;
4
- const o = (t * r).toString().match(/^\d+(?:\.\d{0,2})?/);
4
+ const o = (t * e).toString().match(/^\d+(?:\.\d{0,2})?/);
5
5
  return Number(o);
6
- }, u = (t) => t.toLocaleString("pt-br", { style: "currency", currency: "BRL" }), m = (t) => Number(t.toString().match(/^\d+(?:\.\d{0,2})?/)), d = (t, r, e) => {
7
- const n = r * 1e3 * e;
8
- return t === "un" ? `${e} ${e > 1 ? "unidades" : "unidade"} ` : n >= 1e3 ? `${n / 1e3}kg` : `${n}g`;
9
- }, a = (t, r) => {
10
- const e = r * 1e3;
11
- return t === "un" ? "" : e >= 1e3 ? `/${e / 1e3}kg` : `/${e}g`;
12
- }, i = (t, r) => {
13
- const e = r == null ? void 0 : r.filter(
6
+ }, u = (t) => t.toLocaleString("pt-br", { style: "currency", currency: "BRL" }), m = (t) => Number(t.toString().match(/^\d+(?:\.\d{0,2})?/)), a = (t, e, r) => t === "un" ? `${r} ${r > 1 ? "unidades" : "unidade"} ` : e >= 1 ? `${e}kg` : `${e * 1e3}g`, d = (t, e) => {
7
+ const r = e * 1e3;
8
+ return t === "un" ? "" : r >= 1e3 ? `/${r / 1e3}kg` : `/${r}g`;
9
+ }, s = (t, e) => {
10
+ const r = e == null ? void 0 : e.filter(
14
11
  (n) => t.includes(n.field.originalName) && n.values.some((c) => c.originalName.toLowerCase() === "true")
15
12
  );
16
- return (e == null ? void 0 : e.map((n) => n.field.originalName)) || [];
17
- }, f = (t) => i([
13
+ return (r == null ? void 0 : r.map((n) => n.field.originalName)) || [];
14
+ }, f = (t) => s([
18
15
  "Vegano",
19
16
  "Orgânico",
20
17
  "Sem Glúten",
@@ -24,8 +21,8 @@ const s = (t, r, e = "") => {
24
21
  export {
25
22
  u as formatBrazilianPrice,
26
23
  f as formatEspecifications,
27
- s as formatListPrice,
28
- a as formatedMultiply,
29
- d as formatedQty,
24
+ i as formatListPrice,
25
+ d as formatedMultiply,
26
+ a as formatedQty,
30
27
  m as truncPrice
31
28
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@plurix/ecom-components",
3
3
  "author": "Plurix",
4
4
  "private": false,
5
- "version": "1.14.1-eng-task-1249.8",
5
+ "version": "1.14.1-eng-task-1249.10",
6
6
  "type": "module",
7
7
  "main": "dist/main.js",
8
8
  "types": "dist/main.d.ts",