@plurix/ecom-components 1.6.0-commerce.3 → 1.6.0-commerce.5

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.
@@ -16,9 +16,9 @@ const Y = ({
16
16
  isOpen: h,
17
17
  environment: y,
18
18
  setIsOpen: m,
19
- saveSelectedSimilarProduct: s
19
+ saveSelectedSimilarProduct: d
20
20
  }) => {
21
- const [b, F] = c(), [O, a] = c(!1), d = y === "io", { genericTaggingEvent: P } = _(), [r, e] = c({ productId: "" });
21
+ const [b, F] = c(), [O, a] = c(!1), s = y === "io", { genericTaggingEvent: P } = _(), [r, e] = c({ productId: "" });
22
22
  return w(() => {
23
23
  (async () => {
24
24
  a(!0);
@@ -26,7 +26,7 @@ const Y = ({
26
26
  const t = await N({
27
27
  postalCode: p,
28
28
  selectedItem: o,
29
- isIO: d
29
+ isIO: s
30
30
  });
31
31
  F(t == null ? void 0 : t.products);
32
32
  } finally {
@@ -36,7 +36,7 @@ const Y = ({
36
36
  var t, l;
37
37
  a(!0);
38
38
  try {
39
- const u = await J(g), i = ((l = (t = u == null ? void 0 : u.customData) == null ? void 0 : t.customApps) == null ? void 0 : l.find((C) => C.id === "janis")) || null;
39
+ const u = await J(g, s), i = ((l = (t = u == null ? void 0 : u.customData) == null ? void 0 : t.customApps) == null ? void 0 : l.find((C) => C.id === "janis")) || null;
40
40
  let f = {};
41
41
  i != null && i.fields.idSubstitutionCriterias && (f = JSON.parse(i == null ? void 0 : i.fields.idSubstitutionCriterias));
42
42
  const x = o == null ? void 0 : o.productOriginId;
@@ -56,7 +56,7 @@ const Y = ({
56
56
  A,
57
57
  {
58
58
  saveSelectedSimilarProduct: () => {
59
- r && (s == null || s(r), P("salvar_substituto", {
59
+ r && (d == null || d(r), P("salvar_substituto", {
60
60
  name: o.name,
61
61
  replacement_item: r == null ? void 0 : r.name
62
62
  })), m(!1);
@@ -66,8 +66,8 @@ const Y = ({
66
66
  children: O ? /* @__PURE__ */ n(
67
67
  E,
68
68
  {
69
- width: d ? "100%" : "90%",
70
- height: d ? 600 : 425,
69
+ width: s ? "100%" : "90%",
70
+ height: s ? 600 : 425,
71
71
  backgroundColor: "var(--color-grayScale-faded)",
72
72
  margin: "auto",
73
73
  animation: !0
@@ -1 +1 @@
1
- export declare const getOrderForm: (orderFormId: string) => Promise<any>;
1
+ export declare const getOrderForm: (orderFormId: string, isIO: boolean) => Promise<any>;
@@ -1,8 +1,14 @@
1
- import t from "axios";
2
- const e = async (o) => {
1
+ import o from "axios";
2
+ const c = async (t, a) => {
3
3
  try {
4
- const { data: r } = await t.post("http://localhost:8000/api/proxy", {
5
- targetUrl: `/api/checkout/pub/orderForm/${o}`,
4
+ if (a) {
5
+ const { data: e } = await o.post(
6
+ `/api/checkout/pub/orderForm/${t}`
7
+ );
8
+ return e;
9
+ }
10
+ const { data: r } = await o.post("/api/proxy", {
11
+ targetUrl: `/api/checkout/pub/orderForm/${t}`,
6
12
  method: "GET",
7
13
  headers: {
8
14
  "Content-Type": "application/json",
@@ -15,5 +21,5 @@ const e = async (o) => {
15
21
  }
16
22
  };
17
23
  export {
18
- e as getOrderForm
24
+ c as getOrderForm
19
25
  };
@@ -1,20 +1,20 @@
1
1
  import n from "axios";
2
- const h = async ({
2
+ const O = async ({
3
3
  postalCode: a,
4
- isIO: s,
4
+ isIO: p,
5
5
  selectedItem: r
6
6
  }) => {
7
7
  try {
8
- if (s) {
8
+ if (p) {
9
9
  const { data: o } = await n.get(
10
- `https://smrholding.myvtex.com/_v/commerce/products/productsSimilar?postalCode=${a}&skus=${r == null ? void 0 : r.productOriginId}&field=sku`
11
- ), { similarProducts: c } = o;
12
- return c.find(
13
- (t) => t.productOrigin === (r == null ? void 0 : r.productOriginId)
10
+ `/_v/commerce/products/productsSimilar?postalCode=${a}&skus=${r == null ? void 0 : r.productOriginId}&field=sku`
11
+ ), { similarProducts: u } = o;
12
+ return u.find(
13
+ (c) => c.productOrigin === (r == null ? void 0 : r.productOriginId)
14
14
  );
15
15
  }
16
16
  const { data: i } = await n.post(
17
- "http://localhost:8000/api/proxy",
17
+ "/api/proxy",
18
18
  {
19
19
  targetUrl: `/_v/commerce/products/productsSimilar?postalCode=${a}&skus=${r == null ? void 0 : r.productOriginId}&field=sku`,
20
20
  method: "GET",
@@ -23,8 +23,8 @@ const h = async ({
23
23
  Accept: "application/json"
24
24
  }
25
25
  }
26
- ), { similarProducts: p } = i;
27
- return p.find(
26
+ ), { similarProducts: s } = i;
27
+ return s.find(
28
28
  (o) => o.productOrigin === r.productOriginId
29
29
  );
30
30
  } catch (i) {
@@ -32,5 +32,5 @@ const h = async ({
32
32
  }
33
33
  };
34
34
  export {
35
- h as getProductsSimilars
35
+ O as getProductsSimilars
36
36
  };
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.6.0-commerce.3",
5
+ "version": "1.6.0-commerce.5",
6
6
  "type": "module",
7
7
  "main": "dist/main.js",
8
8
  "types": "dist/main.d.ts",