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

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,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";
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 = () => {
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 = () => {
11
12
  const {
12
13
  delivery: e,
13
14
  status: o,
14
- postalCodeValidation: i,
15
- setInputPostalCode: m,
16
- postalCode: p,
17
- deliveryPrice: d,
18
- textBackButton: h,
19
- pickup: t,
15
+ postalCodeValidation: c,
16
+ setInputPostalCode: s,
17
+ postalCode: d,
18
+ deliveryPrice: h,
19
+ textBackButton: f,
20
+ pickup: i,
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
+ } = 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 }),
24
25
  l ? /* @__PURE__ */ r("div", { className: "warning-container", children: [
25
- /* @__PURE__ */ n(u, {}),
26
+ /* @__PURE__ */ n(x, {}),
26
27
  /* @__PURE__ */ n("span", { className: "warning-text", children: o == null ? void 0 : o.message })
27
28
  ] }) : /* @__PURE__ */ n(
28
- N,
29
+ P,
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,26 @@ 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
+ if (t.target.value.length === 9) {
45
+ const u = t.target.value.replace(/\D/g, "");
46
+ g(u);
47
+ }
44
48
  },
45
49
  maxLength: 9,
46
- placeholder: p || "00000-000",
47
- onKeyUp: b
50
+ placeholder: d || "00000-000",
51
+ onKeyUp: I
48
52
  }
49
53
  ),
50
54
  /* @__PURE__ */ n(
51
55
  "button",
52
56
  {
53
- onKeyDown: (c) => c.key === "Enter" && (i == null ? void 0 : i()),
54
- onClick: () => i == null ? void 0 : i(),
57
+ onKeyDown: (t) => {
58
+ s(m), t.key === "Enter" && (c == null || c());
59
+ },
60
+ onClick: () => {
61
+ s(m), c == null || c();
62
+ },
55
63
  disabled: o == null ? void 0 : o.loading,
56
64
  children: o != null && o.loading ? o.message : e == null ? void 0 : e.searchButton
57
65
  }
@@ -61,15 +69,15 @@ const T = () => {
61
69
  l && /* @__PURE__ */ r("div", { className: "postal-code-container-pickup", children: [
62
70
  /* @__PURE__ */ n("label", { children: "Você pode escolhes retirar na loja" }),
63
71
  /* @__PURE__ */ r(
64
- s,
72
+ p,
65
73
  {
66
74
  onClick: () => a == null ? void 0 : a(!0),
67
75
  view: "PickupPointInfoScreen",
68
76
  className: "postal-code-container-pickup-select",
69
77
  children: [
70
- /* @__PURE__ */ n(k, {}),
78
+ /* @__PURE__ */ n(C, {}),
71
79
  /* @__PURE__ */ r("div", { className: "postal-code-container-pickup-select-informative", children: [
72
- /* @__PURE__ */ n("h4", { children: t == null ? void 0 : t.title }),
80
+ /* @__PURE__ */ n("h4", { children: i == null ? void 0 : i.title }),
73
81
  /* @__PURE__ */ n("p", { children: " Grátis" })
74
82
  ] })
75
83
  ]
@@ -77,12 +85,12 @@ const T = () => {
77
85
  )
78
86
  ] })
79
87
  ] }),
80
- /* @__PURE__ */ r(s, { view: "InitialView", className: "back-button", children: [
81
- /* @__PURE__ */ n("span", { children: /* @__PURE__ */ n(x, { color: "var(--color-main)" }) }),
82
- h
88
+ /* @__PURE__ */ r(p, { view: "InitialView", className: "back-button", children: [
89
+ /* @__PURE__ */ n("span", { children: /* @__PURE__ */ n(b, { color: "var(--color-main)" }) }),
90
+ f
83
91
  ] })
84
92
  ] }) }) });
85
93
  };
86
94
  export {
87
- T as PostalCodeInputScreen
95
+ F as PostalCodeInputScreen
88
96
  };
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.4",
5
+ "version": "1.14.2-COM-1647.6",
6
6
  "type": "module",
7
7
  "main": "dist/main.js",
8
8
  "types": "dist/main.d.ts",