@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
|
|
4
|
-
import { getFullLocalStorage as
|
|
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:
|
|
8
|
-
setCity:
|
|
7
|
+
setPickupName: p,
|
|
8
|
+
setCity: C,
|
|
9
9
|
setUf: y,
|
|
10
10
|
setPickupTimes: x,
|
|
11
|
-
pricesAndHours:
|
|
12
|
-
setModalOpen:
|
|
11
|
+
pricesAndHours: w,
|
|
12
|
+
setModalOpen: I,
|
|
13
13
|
inputPostalCode: r,
|
|
14
14
|
setInputPostalCode: R,
|
|
15
|
-
sendPostalCode:
|
|
16
|
-
status:
|
|
17
|
-
setStatus:
|
|
18
|
-
priceStockInformation:
|
|
19
|
-
pickupPoints:
|
|
20
|
-
titleText:
|
|
21
|
-
moreInfosText:
|
|
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:
|
|
24
|
-
editAddress:
|
|
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(), [
|
|
34
|
-
openingTime: (
|
|
35
|
-
closingTime: (
|
|
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
|
-
|
|
37
|
+
a({ loading: !0, message: "Carregando..." });
|
|
38
38
|
const {
|
|
39
|
-
isValid:
|
|
40
|
-
address:
|
|
39
|
+
isValid: s,
|
|
40
|
+
address: n,
|
|
41
41
|
deliveryInfos: t,
|
|
42
42
|
customShipping: l
|
|
43
|
-
} = await
|
|
43
|
+
} = await c();
|
|
44
44
|
console.log({
|
|
45
|
-
isValid:
|
|
46
|
-
address:
|
|
45
|
+
isValid: s,
|
|
46
|
+
address: n,
|
|
47
47
|
deliveryInfos: t,
|
|
48
48
|
customShipping: l
|
|
49
|
-
}),
|
|
50
|
-
}, Z = () => {
|
|
51
|
-
/\d{8}$/.test(
|
|
52
|
-
|
|
53
|
-
)
|
|
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
|
|
61
|
-
m((
|
|
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:
|
|
70
|
-
setPickupName:
|
|
71
|
-
setCity:
|
|
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:
|
|
77
|
-
setModalOpen:
|
|
77
|
+
pricesAndHours: w,
|
|
78
|
+
setModalOpen: I,
|
|
78
79
|
inputPostalCode: r,
|
|
79
80
|
setInputPostalCode: R,
|
|
80
|
-
sendPostalCode:
|
|
81
|
-
status:
|
|
82
|
-
setStatus:
|
|
83
|
-
pickupPoints:
|
|
84
|
-
titleText:
|
|
85
|
-
moreInfosText:
|
|
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:
|
|
89
|
-
editAddress:
|
|
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:
|
|
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
|
|
2
|
-
import { Title as
|
|
3
|
-
import { SetViewButton as
|
|
4
|
-
import { InfoPrices as
|
|
5
|
-
import { ShoppingIcon as
|
|
6
|
-
import { WarningIcon as
|
|
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
|
|
9
|
-
import { postalCodeMask as
|
|
10
|
-
|
|
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:
|
|
16
|
-
postalCode:
|
|
17
|
-
deliveryPrice:
|
|
18
|
-
textBackButton:
|
|
19
|
-
pickup:
|
|
16
|
+
setInputPostalCode: s,
|
|
17
|
+
postalCode: d,
|
|
18
|
+
deliveryPrice: h,
|
|
19
|
+
textBackButton: f,
|
|
20
|
+
pickup: c,
|
|
20
21
|
setBackToDelivery: a
|
|
21
|
-
} =
|
|
22
|
-
return /* @__PURE__ */ n(
|
|
23
|
-
/* @__PURE__ */ n(
|
|
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(
|
|
26
|
+
/* @__PURE__ */ n(C, {}),
|
|
26
27
|
/* @__PURE__ */ n("span", { className: "warning-text", children: o == null ? void 0 : o.message })
|
|
27
28
|
] }) : /* @__PURE__ */ n(
|
|
28
|
-
|
|
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:
|
|
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: (
|
|
43
|
-
|
|
43
|
+
onChange: (t) => {
|
|
44
|
+
t.target.value.length === 9 && g(t.target.value);
|
|
44
45
|
},
|
|
45
46
|
maxLength: 9,
|
|
46
|
-
placeholder:
|
|
47
|
-
onKeyUp:
|
|
47
|
+
placeholder: d || "00000-000",
|
|
48
|
+
onKeyUp: w
|
|
48
49
|
}
|
|
49
50
|
),
|
|
50
51
|
/* @__PURE__ */ n(
|
|
51
52
|
"button",
|
|
52
53
|
{
|
|
53
|
-
onKeyDown: (
|
|
54
|
-
|
|
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
|
-
|
|
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(
|
|
75
|
+
/* @__PURE__ */ n(P, {}),
|
|
71
76
|
/* @__PURE__ */ r("div", { className: "postal-code-container-pickup-select-informative", children: [
|
|
72
|
-
/* @__PURE__ */ n("h4", { children:
|
|
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(
|
|
85
|
+
/* @__PURE__ */ r(p, { view: "InitialView", className: "back-button", children: [
|
|
81
86
|
/* @__PURE__ */ n("span", { children: /* @__PURE__ */ n(x, { color: "var(--color-main)" }) }),
|
|
82
|
-
|
|
87
|
+
f
|
|
83
88
|
] })
|
|
84
89
|
] }) }) });
|
|
85
90
|
};
|
|
86
91
|
export {
|
|
87
|
-
|
|
92
|
+
F as PostalCodeInputScreen
|
|
88
93
|
};
|