@plurix/ecom-components 1.14.2-COM-1647.3 → 1.14.2-COM-1647.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.
@@ -1,27 +1,27 @@
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 se } from "../utils/postalCode.js";
4
- import { getFullLocalStorage as c } from "../utils/localStorage.js";
3
+ import { removeSpecialCharacter as ie } from "../utils/postalCode.js";
4
+ import { getFullLocalStorage as d } from "../utils/localStorage.js";
5
5
  const v = M(null), le = ({
6
6
  setMethod: o,
7
- setPickupName: C,
8
- setCity: p,
7
+ setPickupName: p,
8
+ setCity: C,
9
9
  setUf: y,
10
10
  setPickupTimes: x,
11
- pricesAndHours: I,
12
- setModalOpen: P,
11
+ pricesAndHours: w,
12
+ setModalOpen: I,
13
13
  inputPostalCode: r,
14
14
  setInputPostalCode: R,
15
- sendPostalCode: d,
16
- status: w,
17
- setStatus: n,
18
- priceStockInformation: D = "",
19
- pickupPoints: T,
20
- titleText: b,
21
- moreInfosText: z,
15
+ sendPostalCode: c,
16
+ status: D,
17
+ setStatus: a,
18
+ priceStockInformation: T = "",
19
+ pickupPoints: b,
20
+ titleText: z,
21
+ moreInfosText: P,
22
22
  textBackButton: S,
23
- confirmButton: h,
24
- editAddress: V,
23
+ confirmButton: V,
24
+ editAddress: h,
25
25
  delivery: H,
26
26
  deliveryPrice: k,
27
27
  pickup: q,
@@ -30,35 +30,36 @@ const v = M(null), le = ({
30
30
  disabledSearch: j,
31
31
  children: B
32
32
  }) => {
33
- const [F, g] = e(), [L, u] = 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)) || ""
33
+ const [F, g] = e(), [L, u] = 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)) || ""
36
36
  }, Y = async () => {
37
- n({ loading: !0, message: "Carregando..." });
37
+ a({ loading: !0, message: "Carregando..." });
38
38
  const {
39
- isValid: i,
40
- address: a,
39
+ isValid: s,
40
+ address: n,
41
41
  deliveryInfos: t,
42
42
  customShipping: l
43
- } = await d();
43
+ } = await c();
44
44
  console.log({
45
- isValid: i,
46
- address: a,
45
+ isValid: s,
46
+ address: n,
47
47
  deliveryInfos: t,
48
48
  customShipping: l
49
- }), i && (console.log("entrou no if `isValid`"), n({ loading: !1 }), g("delivery"), A(a), n({}), m(r), f(t), u("ConfirmScreen"), N(l));
50
- }, Z = () => {
51
- /\d{8}$/.test(
52
- se(r)
53
- ) ? (console.log("caiu no if validatePostalCode"), Y()) : (console.log("caiu no else validatePostalCode"), n({
49
+ }), s && (console.log("entrou no if `isValid`"), a({ loading: !1 }), g("delivery"), A(n), a({}), m(r), f(t), u("ConfirmScreen"), N(l));
50
+ }, Z = async () => {
51
+ const s = /\d{8}$/.test(
52
+ ie(r)
53
+ ), { isValid: n } = await c();
54
+ s && n ? (console.log("caiu no if validatePostalCode"), Y()) : (console.log("caiu no else validatePostalCode"), a({
54
55
  status: "failed",
55
56
  loading: !1,
56
57
  message: "Que Pena, ainda não entregamos na sua região."
57
58
  }));
58
59
  };
59
60
  return ee(() => {
60
- var i, a, t, l;
61
- m((a = (i = c()) == null ? void 0 : i.userAddressInfos) == null ? void 0 : a.postalCode), o == null || o((t = c()) == null ? void 0 : t.regionalized), f((l = c()) == null ? void 0 : l.deliveryInfos);
61
+ var s, n, t, l;
62
+ m((n = (s = d()) == null ? void 0 : s.userAddressInfos) == null ? void 0 : n.postalCode), o == null || o((t = d()) == null ? void 0 : t.regionalized), f((l = d()) == null ? void 0 : l.deliveryInfos);
62
63
  }, []), /* @__PURE__ */ _(
63
64
  v.Provider,
64
65
  {
@@ -66,34 +67,34 @@ const v = M(null), le = ({
66
67
  backToDelivery: O,
67
68
  setBackToDelivery: U,
68
69
  setMethod: o,
69
- priceStockInformation: D,
70
- setPickupName: C,
71
- setCity: p,
70
+ priceStockInformation: T,
71
+ setPickupName: p,
72
+ setCity: C,
72
73
  setUf: y,
73
74
  setPickupTimes: x,
74
75
  pickupTimes: X,
75
76
  pickupConfirmScreenText: W,
76
- pricesAndHours: I,
77
- setModalOpen: P,
77
+ pricesAndHours: w,
78
+ setModalOpen: I,
78
79
  inputPostalCode: r,
79
80
  setInputPostalCode: R,
80
- sendPostalCode: d,
81
- status: w,
82
- setStatus: n,
83
- pickupPoints: T,
84
- titleText: b,
85
- moreInfosText: z,
81
+ sendPostalCode: c,
82
+ status: D,
83
+ setStatus: a,
84
+ pickupPoints: b,
85
+ titleText: z,
86
+ moreInfosText: P,
86
87
  customShippingData: K,
87
88
  textBackButton: S,
88
- confirmButton: h,
89
- editAddress: V,
89
+ confirmButton: V,
90
+ editAddress: h,
90
91
  delivery: H,
91
92
  pickup: q,
92
93
  view: L,
93
94
  setView: u,
94
95
  postalCodeValidation: Z,
95
96
  address: $,
96
- pickupAddress: s,
97
+ pickupAddress: i,
97
98
  setPickupAddress: G,
98
99
  deliveryRequestInfos: J,
99
100
  postalCode: Q,
@@ -1,36 +1,37 @@
1
- import { jsx as n, Fragment as f, jsxs as r } from "react/jsx-runtime";
2
- import { Title as g } from "../components/Title.js";
3
- import { SetViewButton as s } from "../components/SetViewButton.js";
4
- import { InfoPrices as N } from "../components/InfoPrices.js";
5
- import { ShoppingIcon as k } from "../../../assets/svgs/ShoppingIcon.js";
6
- import { WarningIcon as u } from "../../../assets/svgs/WarningIcon.js";
1
+ import { jsx as n, Fragment as u, jsxs as r } from "react/jsx-runtime";
2
+ import { Title as N } from "../components/Title.js";
3
+ import { SetViewButton as p } from "../components/SetViewButton.js";
4
+ import { InfoPrices as k } from "../components/InfoPrices.js";
5
+ import { ShoppingIcon as P } from "../../../assets/svgs/ShoppingIcon.js";
6
+ import { WarningIcon as C } from "../../../assets/svgs/WarningIcon.js";
7
7
  import { ArrowIcon as x } from "../../../assets/svgs/ArrowIcon.js";
8
- import { useRegionalizationContext as P } from "../context/RegionalizationContext.js";
9
- import { postalCodeMask as b } from "../utils/postalCode.js";
10
- const T = () => {
8
+ import { useRegionalizationContext as b } from "../context/RegionalizationContext.js";
9
+ import { postalCodeMask as w } from "../utils/postalCode.js";
10
+ import { useState as I } from "react";
11
+ const F = () => {
11
12
  const {
12
13
  delivery: e,
13
14
  status: o,
14
15
  postalCodeValidation: i,
15
- setInputPostalCode: m,
16
- postalCode: p,
17
- deliveryPrice: d,
18
- textBackButton: h,
19
- pickup: t,
16
+ setInputPostalCode: s,
17
+ postalCode: d,
18
+ deliveryPrice: h,
19
+ textBackButton: f,
20
+ pickup: c,
20
21
  setBackToDelivery: a
21
- } = P(), l = (o == null ? void 0 : o.status) === "failed";
22
- return /* @__PURE__ */ n(f, { children: /* @__PURE__ */ n("div", { className: "delivery-pickup-container", children: /* @__PURE__ */ r("div", { className: "content-container", children: [
23
- /* @__PURE__ */ n(g, { title: l ? "Tente outro CEP" : e == null ? void 0 : e.title }),
22
+ } = b(), [m, g] = I(""), l = (o == null ? void 0 : o.status) === "failed";
23
+ return /* @__PURE__ */ n(u, { children: /* @__PURE__ */ n("div", { className: "delivery-pickup-container", children: /* @__PURE__ */ r("div", { className: "content-container", children: [
24
+ /* @__PURE__ */ n(N, { title: l ? "Tente outro CEP" : e == null ? void 0 : e.title }),
24
25
  l ? /* @__PURE__ */ r("div", { className: "warning-container", children: [
25
- /* @__PURE__ */ n(u, {}),
26
+ /* @__PURE__ */ n(C, {}),
26
27
  /* @__PURE__ */ n("span", { className: "warning-text", children: o == null ? void 0 : o.message })
27
28
  ] }) : /* @__PURE__ */ n(
28
- N,
29
+ k,
29
30
  {
30
31
  containerClassName: "delivery-container",
31
32
  priceClassName: "info-price",
32
33
  labelPrice: e == null ? void 0 : e.labelPrice,
33
- price: d
34
+ price: h
34
35
  }
35
36
  ),
36
37
  /* @__PURE__ */ r("div", { className: "postal-code-container", children: [
@@ -39,19 +40,23 @@ const T = () => {
39
40
  "input",
40
41
  {
41
42
  type: "text",
42
- onChange: (c) => {
43
- c.target.value.length === 9 && m(c.target.value);
43
+ onChange: (t) => {
44
+ t.target.value.length === 9 && g(t.target.value);
44
45
  },
45
46
  maxLength: 9,
46
- placeholder: p || "00000-000",
47
- onKeyUp: b
47
+ placeholder: d || "00000-000",
48
+ onKeyUp: w
48
49
  }
49
50
  ),
50
51
  /* @__PURE__ */ n(
51
52
  "button",
52
53
  {
53
- onKeyDown: (c) => c.key === "Enter" && (i == null ? void 0 : i()),
54
- onClick: () => i == null ? void 0 : i(),
54
+ onKeyDown: (t) => {
55
+ s(m), t.key === "Enter" && (i == null || i());
56
+ },
57
+ onClick: () => {
58
+ s(m), i == null || i();
59
+ },
55
60
  disabled: o == null ? void 0 : o.loading,
56
61
  children: o != null && o.loading ? o.message : e == null ? void 0 : e.searchButton
57
62
  }
@@ -61,15 +66,15 @@ const T = () => {
61
66
  l && /* @__PURE__ */ r("div", { className: "postal-code-container-pickup", children: [
62
67
  /* @__PURE__ */ n("label", { children: "Você pode escolhes retirar na loja" }),
63
68
  /* @__PURE__ */ r(
64
- s,
69
+ p,
65
70
  {
66
71
  onClick: () => a == null ? void 0 : a(!0),
67
72
  view: "PickupPointInfoScreen",
68
73
  className: "postal-code-container-pickup-select",
69
74
  children: [
70
- /* @__PURE__ */ n(k, {}),
75
+ /* @__PURE__ */ n(P, {}),
71
76
  /* @__PURE__ */ r("div", { className: "postal-code-container-pickup-select-informative", children: [
72
- /* @__PURE__ */ n("h4", { children: t == null ? void 0 : t.title }),
77
+ /* @__PURE__ */ n("h4", { children: c == null ? void 0 : c.title }),
73
78
  /* @__PURE__ */ n("p", { children: " Grátis" })
74
79
  ] })
75
80
  ]
@@ -77,12 +82,12 @@ const T = () => {
77
82
  )
78
83
  ] })
79
84
  ] }),
80
- /* @__PURE__ */ r(s, { view: "InitialView", className: "back-button", children: [
85
+ /* @__PURE__ */ r(p, { view: "InitialView", className: "back-button", children: [
81
86
  /* @__PURE__ */ n("span", { children: /* @__PURE__ */ n(x, { color: "var(--color-main)" }) }),
82
- h
87
+ f
83
88
  ] })
84
89
  ] }) }) });
85
90
  };
86
91
  export {
87
- T as PostalCodeInputScreen
92
+ F as PostalCodeInputScreen
88
93
  };
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.3",
5
+ "version": "1.14.2-COM-1647.5",
6
6
  "type": "module",
7
7
  "main": "dist/main.js",
8
8
  "types": "dist/main.d.ts",