@plurix/ecom-components 1.14.2-COM-1647.6 → 1.14.2-COM-1647.7

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