@plurix/ecom-components 1.14.2-COM-1647.7 → 1.14.2-COM-2082.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.
@@ -1,14 +1,17 @@
1
- import r from "axios";
2
- const s = async (o, t, a) => {
3
- const { data: p } = await r.post(
1
+ import p from "axios";
2
+ import { changeAccount as r } from "../../../utils/changeAccount.js";
3
+ const u = async (t, n, c) => {
4
+ const o = r(t);
5
+ console.log("newAccount", o);
6
+ const { data: a } = await p.post(
4
7
  `https://${o}.vtex.app/api/coupon/order`,
5
8
  {
6
- orderFormId: t,
7
- couponId: a
9
+ orderFormId: n,
10
+ couponId: c
8
11
  }
9
12
  );
10
- return p;
13
+ return a;
11
14
  };
12
15
  export {
13
- s as addCoupon
16
+ u as addCoupon
14
17
  };
@@ -1,8 +1,9 @@
1
- import o from "axios";
2
- const e = async (n, p, t) => {
3
- const a = `https://${n}.vtex.app/api/coupon/list`, s = Math.random(), { data: r } = t ? await o.post(a, { couponsList: t }) : await o.get(a, { params: { builder: p, random: s } });
1
+ import n from "axios";
2
+ import { changeAccount as s } from "../../../utils/changeAccount.js";
3
+ const i = async (a, c, t) => {
4
+ const o = `https://${s(a)}.vtex.app/api/coupon/list`, p = Math.random(), { data: r } = t ? await n.post(o, { couponsList: t }) : await n.get(o, { params: { builder: c, random: p } });
4
5
  return r.coupons;
5
6
  };
6
7
  export {
7
- e as getCoupons
8
+ i as getCoupons
8
9
  };
@@ -1,13 +1,14 @@
1
- import e from "axios";
2
- const r = async (o, t) => {
3
- const { data: a } = await e.delete(
4
- `https://${o}.vtex.app/api/coupon/order`,
1
+ import n from "axios";
2
+ import { changeAccount as c } from "../../../utils/changeAccount.js";
3
+ const s = async (o, t) => {
4
+ const a = c(o), { data: e } = await n.delete(
5
+ `https://${a}.vtex.app/api/coupon/order`,
5
6
  {
6
7
  data: { orderFormId: t }
7
8
  }
8
9
  );
9
- return a;
10
+ return e;
10
11
  };
11
12
  export {
12
- r as removeCoupon
13
+ s as removeCoupon
13
14
  };
@@ -1,6 +1,6 @@
1
1
  import { jsx as _ } from "react/jsx-runtime";
2
2
  import { createContext as M, useState as e, useEffect as ee, useContext as oe } from "react";
3
- import { removeSpecialCharacter as ie } from "../utils/postalCode.js";
3
+ import { removeSpecialCharacter as se } from "../utils/postalCode.js";
4
4
  import { getFullLocalStorage as c } from "../utils/localStorage.js";
5
5
  const v = M(null), re = ({
6
6
  setMethod: o,
@@ -14,15 +14,15 @@ const v = M(null), re = ({
14
14
  setInputPostalCode: D,
15
15
  sendPostalCode: d,
16
16
  status: I,
17
- setStatus: s,
17
+ setStatus: i,
18
18
  priceStockInformation: T = "",
19
19
  pickupPoints: b,
20
20
  titleText: z,
21
21
  moreInfosText: P,
22
22
  textBackButton: S,
23
- confirmButton: V,
24
- editAddress: h,
25
- delivery: H,
23
+ confirmButton: h,
24
+ editAddress: H,
25
+ delivery: V,
26
26
  deliveryPrice: k,
27
27
  pickup: q,
28
28
  regionalizeCatalog: E,
@@ -30,22 +30,22 @@ const v = M(null), re = ({
30
30
  disabledSearch: j,
31
31
  children: B
32
32
  }) => {
33
- const [F, u] = e(), [L, g] = e("InitialView"), [Q, m] = e(""), [$, A] = e(), [i, G] = e(), [J, f] = e(), [K, N] = e(), [O, U] = e(!1), X = {
34
- openingTime: (i == null ? void 0 : i.businessHours.businessHoursWeek.openingTime.slice(0, 2)) || "",
35
- closingTime: (i == null ? void 0 : i.businessHours.businessHoursWeek.closingTime.slice(0, 2)) || ""
33
+ const [F, u] = e(), [L, g] = e("InitialView"), [Q, m] = e(""), [$, A] = e(), [s, G] = e(), [J, f] = e(), [K, N] = e(), [O, U] = e(!1), X = {
34
+ openingTime: (s == null ? void 0 : s.businessHours.businessHoursWeek.openingTime.slice(0, 2)) || "",
35
+ closingTime: (s == null ? void 0 : s.businessHours.businessHoursWeek.closingTime.slice(0, 2)) || ""
36
36
  }, Y = async () => {
37
- s({ loading: !0, message: "Carregando..." });
37
+ i({ loading: !0, message: "Carregando..." });
38
38
  const {
39
39
  isValid: n,
40
40
  address: t,
41
41
  deliveryInfos: a,
42
42
  customShipping: r
43
43
  } = await d();
44
- n && (console.log("entrou no if `isValid`"), s({ loading: !1 }), u("delivery"), A(t), s({}), m(l), f(a), g("ConfirmScreen"), N(r));
44
+ n && (i({ loading: !1 }), u("delivery"), A(t), i({}), m(l), f(a), g("ConfirmScreen"), N(r));
45
45
  }, Z = () => {
46
46
  /\d{8}$/.test(
47
- ie(l)
48
- ) ? Y() : s({
47
+ se(l)
48
+ ) ? Y() : i({
49
49
  status: "failed",
50
50
  loading: !1,
51
51
  message: "Que Pena, ainda não entregamos na sua região."
@@ -74,21 +74,21 @@ const v = M(null), re = ({
74
74
  setInputPostalCode: D,
75
75
  sendPostalCode: d,
76
76
  status: I,
77
- setStatus: s,
77
+ setStatus: i,
78
78
  pickupPoints: b,
79
79
  titleText: z,
80
80
  moreInfosText: P,
81
81
  customShippingData: K,
82
82
  textBackButton: S,
83
- confirmButton: V,
84
- editAddress: h,
85
- delivery: H,
83
+ confirmButton: h,
84
+ editAddress: H,
85
+ delivery: V,
86
86
  pickup: q,
87
87
  view: L,
88
88
  setView: g,
89
89
  postalCodeValidation: Z,
90
90
  address: $,
91
- pickupAddress: i,
91
+ pickupAddress: s,
92
92
  setPickupAddress: G,
93
93
  deliveryRequestInfos: J,
94
94
  postalCode: Q,
@@ -10,20 +10,20 @@ import { postalCodeMask as P } from "../utils/postalCode.js";
10
10
  const T = () => {
11
11
  const {
12
12
  delivery: e,
13
- status: o,
14
- postalCodeValidation: r,
13
+ status: r,
14
+ postalCodeValidation: o,
15
15
  setInputPostalCode: m,
16
16
  postalCode: p,
17
17
  deliveryPrice: h,
18
18
  textBackButton: d,
19
19
  pickup: t,
20
20
  setBackToDelivery: a
21
- } = x(), l = (o == null ? void 0 : o.status) === "failed";
21
+ } = x(), l = (r == null ? void 0 : r.status) === "failed";
22
22
  return /* @__PURE__ */ n(f, { children: /* @__PURE__ */ n("div", { className: "delivery-pickup-container", children: /* @__PURE__ */ c("div", { className: "content-container", children: [
23
23
  /* @__PURE__ */ n(g, { title: l ? "Tente outro CEP" : e == null ? void 0 : e.title }),
24
24
  l ? /* @__PURE__ */ c("div", { className: "warning-container", children: [
25
25
  /* @__PURE__ */ n(u, {}),
26
- /* @__PURE__ */ n("span", { className: "warning-text", children: o == null ? void 0 : o.message })
26
+ /* @__PURE__ */ n("span", { className: "warning-text", children: r == null ? void 0 : r.message })
27
27
  ] }) : /* @__PURE__ */ n(
28
28
  k,
29
29
  {
@@ -38,9 +38,7 @@ const T = () => {
38
38
  /* @__PURE__ */ n(
39
39
  "input",
40
40
  {
41
- onKeyDown: (i) => {
42
- console.log("event", i.key), i.key === "Enter" && (r == null || r());
43
- },
41
+ onKeyDown: (i) => i.key === "Enter" && (o == null ? void 0 : o()),
44
42
  type: "text",
45
43
  onChange: (i) => m(i.target.value),
46
44
  maxLength: 9,
@@ -51,10 +49,10 @@ const T = () => {
51
49
  /* @__PURE__ */ n(
52
50
  "button",
53
51
  {
54
- onKeyDown: (i) => i.key === "Enter" && (r == null ? void 0 : r()),
55
- onClick: () => r == null ? void 0 : r(),
56
- disabled: o == null ? void 0 : o.loading,
57
- children: o != null && o.loading ? o.message : e == null ? void 0 : e.searchButton
52
+ onKeyDown: (i) => i.key === "Enter" && (o == null ? void 0 : o()),
53
+ onClick: () => o == null ? void 0 : o(),
54
+ disabled: r == null ? void 0 : r.loading,
55
+ children: r != null && r.loading ? r.message : e == null ? void 0 : e.searchButton
58
56
  }
59
57
  )
60
58
  ] }),
@@ -0,0 +1 @@
1
+ export declare const changeAccount: (account: string) => string;
@@ -0,0 +1,12 @@
1
+ const a = {
2
+ smrholdingv2: "smrholding",
3
+ amigaov3: "amigao",
4
+ avenidab2cv2: "avenidab2c",
5
+ boav3: "boa",
6
+ superpaov3: "superpao",
7
+ compremaisv3: "compremais",
8
+ domoliviov3: "domolivio"
9
+ }, i = (o) => a[o] || o;
10
+ export {
11
+ i as changeAccount
12
+ };
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.2-COM-1647.7",
5
+ "version": "1.14.2-COM-2082.0",
6
6
  "type": "module",
7
7
  "main": "dist/main.js",
8
8
  "types": "dist/main.d.ts",