@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
|
|
5
|
-
const v = M(null),
|
|
4
|
+
import { getFullLocalStorage as c } from "../utils/localStorage.js";
|
|
5
|
+
const v = M(null), re = ({
|
|
6
6
|
setMethod: o,
|
|
7
|
-
setPickupName:
|
|
8
|
-
setCity:
|
|
9
|
-
setUf:
|
|
10
|
-
setPickupTimes:
|
|
11
|
-
pricesAndHours:
|
|
12
|
-
setModalOpen:
|
|
13
|
-
inputPostalCode:
|
|
14
|
-
setInputPostalCode:
|
|
15
|
-
sendPostalCode:
|
|
16
|
-
status:
|
|
17
|
-
setStatus:
|
|
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,
|
|
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
|
-
|
|
37
|
+
s({ loading: !0, message: "Carregando..." });
|
|
38
38
|
const {
|
|
39
|
-
isValid:
|
|
40
|
-
address:
|
|
41
|
-
deliveryInfos:
|
|
42
|
-
customShipping:
|
|
43
|
-
} = await
|
|
44
|
-
console.log({
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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
|
|
62
|
-
m((
|
|
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:
|
|
72
|
-
setCity:
|
|
73
|
-
setUf:
|
|
74
|
-
setPickupTimes:
|
|
65
|
+
setPickupName: C,
|
|
66
|
+
setCity: p,
|
|
67
|
+
setUf: x,
|
|
68
|
+
setPickupTimes: y,
|
|
75
69
|
pickupTimes: X,
|
|
76
70
|
pickupConfirmScreenText: W,
|
|
77
|
-
pricesAndHours:
|
|
78
|
-
setModalOpen:
|
|
79
|
-
inputPostalCode:
|
|
80
|
-
setInputPostalCode:
|
|
81
|
-
sendPostalCode:
|
|
82
|
-
status:
|
|
83
|
-
setStatus:
|
|
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:
|
|
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:
|
|
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
|
-
},
|
|
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
|
-
|
|
120
|
-
|
|
113
|
+
re as RegionalizationContextProvider,
|
|
114
|
+
le as useRegionalizationContext
|
|
121
115
|
};
|
|
@@ -1,32 +1,31 @@
|
|
|
1
|
-
import { jsx as n, Fragment as
|
|
2
|
-
import { Title as
|
|
3
|
-
import { SetViewButton as
|
|
4
|
-
import { InfoPrices as
|
|
5
|
-
import { ShoppingIcon as
|
|
6
|
-
import { WarningIcon as
|
|
7
|
-
import { ArrowIcon as
|
|
8
|
-
import { useRegionalizationContext as
|
|
9
|
-
import { postalCodeMask as
|
|
10
|
-
|
|
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:
|
|
16
|
-
setInputPostalCode:
|
|
17
|
-
postalCode:
|
|
14
|
+
postalCodeValidation: r,
|
|
15
|
+
setInputPostalCode: m,
|
|
16
|
+
postalCode: p,
|
|
18
17
|
deliveryPrice: h,
|
|
19
|
-
textBackButton:
|
|
20
|
-
pickup:
|
|
18
|
+
textBackButton: d,
|
|
19
|
+
pickup: t,
|
|
21
20
|
setBackToDelivery: a
|
|
22
|
-
} =
|
|
23
|
-
return /* @__PURE__ */ n(
|
|
24
|
-
/* @__PURE__ */ n(
|
|
25
|
-
l ? /* @__PURE__ */
|
|
26
|
-
/* @__PURE__ */ n(
|
|
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
|
-
|
|
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__ */
|
|
38
|
-
/* @__PURE__ */
|
|
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
|
-
|
|
43
|
-
|
|
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:
|
|
51
|
-
onKeyUp:
|
|
47
|
+
placeholder: p || "00000-000",
|
|
48
|
+
onKeyUp: P
|
|
52
49
|
}
|
|
53
50
|
),
|
|
54
51
|
/* @__PURE__ */ n(
|
|
55
52
|
"button",
|
|
56
53
|
{
|
|
57
|
-
onKeyDown: (
|
|
58
|
-
|
|
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__ */
|
|
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__ */
|
|
72
|
-
|
|
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(
|
|
79
|
-
/* @__PURE__ */
|
|
80
|
-
/* @__PURE__ */ n("h4", { children:
|
|
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__ */
|
|
89
|
-
/* @__PURE__ */ n("span", { children: /* @__PURE__ */ n(
|
|
90
|
-
|
|
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
|
-
|
|
88
|
+
T as PostalCodeInputScreen
|
|
96
89
|
};
|