@plurix/ecom-components 1.14.2-COM-1647.8 → 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,
@@ -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.8",
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",