@plurix/ecom-components 1.20.0 → 1.20.1
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.
- package/dist/packages/Modal/Modal.d.ts +2 -7
- package/dist/packages/Modal/Modal.js +47 -136
- package/dist/packages/Regionalization/Regionalization.d.ts +1 -1
- package/dist/packages/Regionalization/Regionalization.js +2 -2
- package/dist/packages/Regionalization/context/RegionalizationContext.d.ts +1 -1
- package/dist/packages/Regionalization/context/RegionalizationContext.js +87 -96
- package/dist/packages/Regionalization/types/RegionalizationProps.d.ts +6 -6
- package/dist/packages/Regionalization/views/InitialView.js +40 -41
- package/dist/packages/Regionalization/views/PostalCodeInputScreen.js +1 -1
- package/package.json +69 -69
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode, Dispatch, SetStateAction } from 'react';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface ModalProps {
|
|
4
4
|
isOpen: boolean;
|
|
5
5
|
setIsOpen: Dispatch<SetStateAction<boolean>>;
|
|
6
6
|
children: ReactNode;
|
|
@@ -11,11 +11,6 @@ export interface ModalProps {
|
|
|
11
11
|
Footer?: ReactNode;
|
|
12
12
|
hideHeader?: boolean;
|
|
13
13
|
PreContent?: ReactNode;
|
|
14
|
-
/** Fecha o modal com a tecla Esc. Default: true. */
|
|
15
|
-
closeOnEsc?: boolean;
|
|
16
|
-
/** Mantém o foco do teclado dentro do modal enquanto aberto. Default: true. */
|
|
17
|
-
trapFocus?: boolean;
|
|
18
|
-
/** Texto acessível do botão de fechar. Default: 'Fechar'. */
|
|
19
|
-
closeButtonLabel?: string;
|
|
20
14
|
}
|
|
21
15
|
export declare const Modal: (props: ModalProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
16
|
+
export {};
|
|
@@ -1,151 +1,62 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
T.call(t, o) && N(r, o, t[o]);
|
|
8
|
-
if (v)
|
|
9
|
-
for (var o of v(t))
|
|
10
|
-
$.call(t, o) && N(r, o, t[o]);
|
|
11
|
-
return r;
|
|
12
|
-
}, F = (r, t) => B(r, K(t));
|
|
13
|
-
import { jsx as i, jsxs as E } from "react/jsx-runtime";
|
|
14
|
-
import { useRef as m, useId as M, useEffect as w } from "react";
|
|
15
|
-
import { ArrowIcon as W } from "../../assets/svgs/ArrowIcon.js";
|
|
16
|
-
import { CloseIcon as _ } from "../../assets/svgs/CloseIcon.js";
|
|
17
|
-
import { HAS_WINDOW as H } from "../../constants/index.js";
|
|
18
|
-
/* empty css */const q = [
|
|
19
|
-
"a[href]",
|
|
20
|
-
"button:not([disabled])",
|
|
21
|
-
"input:not([disabled])",
|
|
22
|
-
"select:not([disabled])",
|
|
23
|
-
"textarea:not([disabled])",
|
|
24
|
-
'[tabindex]:not([tabindex="-1"])'
|
|
25
|
-
].join(","), X = (r) => {
|
|
1
|
+
import { jsx as o, jsxs as i } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as s, useEffect as p } from "react";
|
|
3
|
+
import { ArrowIcon as g } from "../../assets/svgs/ArrowIcon.js";
|
|
4
|
+
import { CloseIcon as k } from "../../assets/svgs/CloseIcon.js";
|
|
5
|
+
import { HAS_WINDOW as v } from "../../constants/index.js";
|
|
6
|
+
/* empty css */const R = (w) => {
|
|
26
7
|
const {
|
|
27
|
-
isOpen:
|
|
28
|
-
setIsOpen:
|
|
29
|
-
children:
|
|
30
|
-
className:
|
|
31
|
-
title:
|
|
32
|
-
titleAction:
|
|
33
|
-
hasTitleArrow:
|
|
34
|
-
Footer:
|
|
35
|
-
hideHeader:
|
|
36
|
-
PreContent:
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return w(() => {
|
|
42
|
-
if (H)
|
|
43
|
-
return t ? window.document.body.classList.add("no-scroll") : window.document.body.classList.remove("no-scroll"), () => {
|
|
8
|
+
isOpen: r,
|
|
9
|
+
setIsOpen: C,
|
|
10
|
+
children: L,
|
|
11
|
+
className: N,
|
|
12
|
+
title: d,
|
|
13
|
+
titleAction: a,
|
|
14
|
+
hasTitleArrow: x,
|
|
15
|
+
Footer: m,
|
|
16
|
+
hideHeader: b,
|
|
17
|
+
PreContent: u
|
|
18
|
+
} = w, t = s(null), n = s(null), l = s(null), f = () => C(!1);
|
|
19
|
+
return p(() => {
|
|
20
|
+
if (v)
|
|
21
|
+
return r ? window.document.body.classList.add("no-scroll") : window.document.body.classList.remove("no-scroll"), () => {
|
|
44
22
|
window.document.body.classList.remove("no-scroll");
|
|
45
23
|
};
|
|
46
|
-
}, [
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
h
|
|
50
|
-
|
|
51
|
-
const c = (n) => {
|
|
52
|
-
var e;
|
|
53
|
-
u.current && (n == null ? void 0 : n.target) instanceof Node && !((e = u.current) != null && e.contains(n == null ? void 0 : n.target)) && y();
|
|
24
|
+
}, [r]), p(() => {
|
|
25
|
+
n.current && t.current && (t.current.style.maxHeight = `calc(100% - 56px - ${n.current.offsetHeight}px)`);
|
|
26
|
+
const c = (e) => {
|
|
27
|
+
var h;
|
|
28
|
+
l.current && (e == null ? void 0 : e.target) instanceof Node && !((h = l.current) != null && h.contains(e == null ? void 0 : e.target)) && f();
|
|
54
29
|
};
|
|
55
|
-
return
|
|
30
|
+
return r ? document.addEventListener("mousedown", c) : document.removeEventListener("mousedown", c), () => {
|
|
56
31
|
document.removeEventListener("mousedown", c);
|
|
57
32
|
};
|
|
58
|
-
}, [
|
|
59
|
-
if (!t || !H)
|
|
60
|
-
return;
|
|
61
|
-
C.current = document.activeElement;
|
|
62
|
-
const c = () => {
|
|
63
|
-
var e, l;
|
|
64
|
-
return Array.from(
|
|
65
|
-
(l = (e = u.current) == null ? void 0 : e.querySelectorAll(q)) != null ? l : []
|
|
66
|
-
).filter(
|
|
67
|
-
(a) => !a.hasAttribute("hidden") && a.getAttribute("aria-hidden") !== "true"
|
|
68
|
-
);
|
|
69
|
-
};
|
|
70
|
-
if (s) {
|
|
71
|
-
const [e] = c();
|
|
72
|
-
e == null || e.focus();
|
|
73
|
-
}
|
|
74
|
-
const n = (e) => {
|
|
75
|
-
if (A && e.key === "Escape") {
|
|
76
|
-
y();
|
|
77
|
-
return;
|
|
78
|
-
}
|
|
79
|
-
if (!s || e.key !== "Tab")
|
|
80
|
-
return;
|
|
81
|
-
const l = c();
|
|
82
|
-
if (l.length === 0)
|
|
83
|
-
return;
|
|
84
|
-
const a = l[0], k = l[l.length - 1];
|
|
85
|
-
if (e.shiftKey && document.activeElement === a) {
|
|
86
|
-
e.preventDefault(), k.focus();
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
!e.shiftKey && document.activeElement === k && (e.preventDefault(), a.focus());
|
|
90
|
-
};
|
|
91
|
-
return document.addEventListener("keydown", n), () => {
|
|
92
|
-
var e, l;
|
|
93
|
-
document.removeEventListener("keydown", n), s && ((l = (e = C.current) == null ? void 0 : e.focus) == null || l.call(e));
|
|
94
|
-
};
|
|
95
|
-
}, [t, A, s]), t ? /* @__PURE__ */ i(
|
|
33
|
+
}, [r]), r ? /* @__PURE__ */ o(
|
|
96
34
|
"div",
|
|
97
35
|
{
|
|
98
36
|
id: "modal-container",
|
|
99
37
|
"data-testid": "modal-container",
|
|
100
|
-
className:
|
|
101
|
-
children: /* @__PURE__ */
|
|
102
|
-
"
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
W,
|
|
120
|
-
{
|
|
121
|
-
rotate: "Left",
|
|
122
|
-
color: "var(--color-support-links)"
|
|
123
|
-
}
|
|
124
|
-
),
|
|
125
|
-
f
|
|
126
|
-
]
|
|
127
|
-
}
|
|
128
|
-
) : /* @__PURE__ */ i("h2", { id: p, className: "modal-title", children: f }),
|
|
129
|
-
/* @__PURE__ */ i(
|
|
130
|
-
"button",
|
|
131
|
-
{
|
|
132
|
-
onClick: y,
|
|
133
|
-
className: "modal-close",
|
|
134
|
-
type: "button",
|
|
135
|
-
"aria-label": I,
|
|
136
|
-
children: /* @__PURE__ */ i(_, { color: "var(--color-main)" })
|
|
137
|
-
}
|
|
138
|
-
)
|
|
139
|
-
] }),
|
|
140
|
-
!!x && x,
|
|
141
|
-
/* @__PURE__ */ i("div", { ref: h, children: O }),
|
|
142
|
-
g && /* @__PURE__ */ i("footer", { className: "modal-footer", ref: b, children: g })
|
|
143
|
-
]
|
|
144
|
-
})
|
|
145
|
-
) })
|
|
38
|
+
className: N,
|
|
39
|
+
children: /* @__PURE__ */ o("div", { id: "modal-content-container", children: /* @__PURE__ */ i("div", { id: "modal-content", ref: l, children: [
|
|
40
|
+
!b && /* @__PURE__ */ i("header", { children: [
|
|
41
|
+
a ? /* @__PURE__ */ i("button", { onClick: a, className: "modal-title", children: [
|
|
42
|
+
x && /* @__PURE__ */ o(
|
|
43
|
+
g,
|
|
44
|
+
{
|
|
45
|
+
rotate: "Left",
|
|
46
|
+
color: "var(--color-support-links)"
|
|
47
|
+
}
|
|
48
|
+
),
|
|
49
|
+
d
|
|
50
|
+
] }) : /* @__PURE__ */ o("h2", { className: "modal-title", children: d }),
|
|
51
|
+
/* @__PURE__ */ o("button", { onClick: f, className: "modal-close", children: /* @__PURE__ */ o(k, { color: "var(--color-main)" }) })
|
|
52
|
+
] }),
|
|
53
|
+
!!u && u,
|
|
54
|
+
/* @__PURE__ */ o("div", { ref: t, children: L }),
|
|
55
|
+
m && /* @__PURE__ */ o("footer", { className: "modal-footer", ref: n, children: m })
|
|
56
|
+
] }) })
|
|
146
57
|
}
|
|
147
58
|
) : null;
|
|
148
59
|
};
|
|
149
60
|
export {
|
|
150
|
-
|
|
61
|
+
R as Modal
|
|
151
62
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { RegionalizationProps } from './types/RegionalizationProps';
|
|
2
2
|
|
|
3
|
-
export declare const Regionalization: ({ setMethod, setPickupName, setCity, deliveryPrice, setUf, setPickupTimes, pricesAndHours, setModalOpen, inputPostalCode, setInputPostalCode,
|
|
3
|
+
export declare const Regionalization: ({ setMethod, setPickupName, setCity, deliveryPrice, setUf, setPickupTimes, pricesAndHours, setModalOpen, inputPostalCode, setInputPostalCode, addressDelivery, status, setStatus, pickupPoints, pickupConfirmScreenText, regionalizeCatalog, titleText, priceStockInformation, moreInfosText, textBackButton, confirmButton, editAddress, delivery, pickup, disabledSearch }: RegionalizationProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -12,7 +12,7 @@ import { ViewsContainer as k } from "./views/ViewsContainer.js";
|
|
|
12
12
|
setModalOpen: l,
|
|
13
13
|
inputPostalCode: d,
|
|
14
14
|
setInputPostalCode: c,
|
|
15
|
-
|
|
15
|
+
addressDelivery: m,
|
|
16
16
|
status: p,
|
|
17
17
|
setStatus: u,
|
|
18
18
|
pickupPoints: g,
|
|
@@ -72,7 +72,7 @@ import { ViewsContainer as k } from "./views/ViewsContainer.js";
|
|
|
72
72
|
setModalOpen: l,
|
|
73
73
|
inputPostalCode: d,
|
|
74
74
|
setInputPostalCode: c,
|
|
75
|
-
|
|
75
|
+
addressDelivery: m,
|
|
76
76
|
pickupPoints: g,
|
|
77
77
|
titleText: j,
|
|
78
78
|
moreInfosText: E,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { RegionalizationProps, ContextProps } from '../types';
|
|
2
2
|
|
|
3
|
-
export declare const RegionalizationContextProvider: ({ setMethod, setPickupName, setCity, setUf, setPickupTimes, pricesAndHours, setModalOpen, inputPostalCode, setInputPostalCode,
|
|
3
|
+
export declare const RegionalizationContextProvider: ({ setMethod, setPickupName, setCity, setUf, setPickupTimes, pricesAndHours, setModalOpen, inputPostalCode, setInputPostalCode, addressDelivery, status, setStatus, priceStockInformation, pickupPoints, titleText, moreInfosText, textBackButton, confirmButton, editAddress, delivery, deliveryPrice, pickup, regionalizeCatalog, pickupConfirmScreenText, disabledSearch, children }: RegionalizationProps & ContextProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export declare const useRegionalizationContext: () => RegionalizationProps & ContextProps;
|
|
@@ -1,115 +1,106 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { createContext as
|
|
3
|
-
import { removeSpecialCharacter as
|
|
4
|
-
import { getFullLocalStorage as
|
|
5
|
-
const
|
|
6
|
-
setMethod:
|
|
7
|
-
setPickupName:
|
|
8
|
-
setCity:
|
|
9
|
-
setUf:
|
|
10
|
-
setPickupTimes:
|
|
11
|
-
pricesAndHours:
|
|
1
|
+
import { jsx as y } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as D, useState as n, useEffect as d, useContext as oo } from "react";
|
|
3
|
+
import { removeSpecialCharacter as no } from "../utils/postalCode.js";
|
|
4
|
+
import { getFullLocalStorage as g } from "../utils/localStorage.js";
|
|
5
|
+
const x = D(null), uo = ({
|
|
6
|
+
setMethod: t,
|
|
7
|
+
setPickupName: I,
|
|
8
|
+
setCity: S,
|
|
9
|
+
setUf: R,
|
|
10
|
+
setPickupTimes: T,
|
|
11
|
+
pricesAndHours: b,
|
|
12
12
|
setModalOpen: w,
|
|
13
|
-
inputPostalCode:
|
|
14
|
-
setInputPostalCode:
|
|
15
|
-
|
|
16
|
-
status:
|
|
17
|
-
setStatus:
|
|
18
|
-
priceStockInformation:
|
|
19
|
-
pickupPoints:
|
|
20
|
-
titleText:
|
|
21
|
-
moreInfosText:
|
|
22
|
-
textBackButton:
|
|
23
|
-
confirmButton:
|
|
24
|
-
editAddress:
|
|
25
|
-
delivery:
|
|
26
|
-
deliveryPrice:
|
|
27
|
-
pickup:
|
|
28
|
-
regionalizeCatalog:
|
|
29
|
-
pickupConfirmScreenText:
|
|
30
|
-
disabledSearch:
|
|
31
|
-
children:
|
|
13
|
+
inputPostalCode: c,
|
|
14
|
+
setInputPostalCode: z,
|
|
15
|
+
addressDelivery: o,
|
|
16
|
+
status: P,
|
|
17
|
+
setStatus: a,
|
|
18
|
+
priceStockInformation: E = "",
|
|
19
|
+
pickupPoints: H,
|
|
20
|
+
titleText: h,
|
|
21
|
+
moreInfosText: k,
|
|
22
|
+
textBackButton: V,
|
|
23
|
+
confirmButton: q,
|
|
24
|
+
editAddress: F,
|
|
25
|
+
delivery: L,
|
|
26
|
+
deliveryPrice: W,
|
|
27
|
+
pickup: j,
|
|
28
|
+
regionalizeCatalog: A,
|
|
29
|
+
pickupConfirmScreenText: B,
|
|
30
|
+
disabledSearch: Q,
|
|
31
|
+
children: U
|
|
32
32
|
}) => {
|
|
33
|
-
const [
|
|
34
|
-
openingTime: (
|
|
35
|
-
closingTime: (
|
|
36
|
-
},
|
|
37
|
-
i({ loading: !0, message: "Carregando..." });
|
|
38
|
-
const {
|
|
39
|
-
isValid: n,
|
|
40
|
-
address: t,
|
|
41
|
-
deliveryInfos: a,
|
|
42
|
-
customShipping: r
|
|
43
|
-
} = await d();
|
|
44
|
-
n && (i({ loading: !1 }), u("delivery"), A(t), i({}), m(l), f(a), g("ConfirmScreen"), N(r));
|
|
45
|
-
}, Z = () => {
|
|
33
|
+
const [$, m] = n(), [G, f] = n("InitialView"), [J, s] = n(""), [K, N] = n(), [i, O] = n(), [X, C] = n(), [Y, Z] = n(), [_, M] = n(!1), r = {
|
|
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
|
+
}, v = () => {
|
|
46
37
|
/\d{8}$/.test(
|
|
47
|
-
|
|
48
|
-
) ?
|
|
49
|
-
status: "
|
|
38
|
+
no(c)
|
|
39
|
+
) || !(o != null && o.loading) && (o != null && o.address) && (o != null && o.deliveryInfos) ? o != null && o.loading && (o != null && o.address) && (o != null && o.deliveryInfos) && (a({ status: "SUCCESS", loading: !1, message: "" }), m("delivery"), N(o.address), s(c), C(o.deliveryInfos), f("ConfirmScreen"), Z(o.customShipping)) : a({
|
|
40
|
+
status: "FAILED",
|
|
50
41
|
loading: !1,
|
|
51
42
|
message: "Que Pena, ainda não entregamos na sua região."
|
|
52
43
|
});
|
|
53
44
|
};
|
|
54
|
-
return
|
|
55
|
-
var
|
|
56
|
-
|
|
57
|
-
}, []), /* @__PURE__ */
|
|
58
|
-
|
|
45
|
+
return d(() => {
|
|
46
|
+
var u, p, e, l;
|
|
47
|
+
s((p = (u = g()) == null ? void 0 : u.userAddressInfos) == null ? void 0 : p.postalCode), t == null || t((e = g()) == null ? void 0 : e.regionalized), C((l = g()) == null ? void 0 : l.deliveryInfos);
|
|
48
|
+
}, []), /* @__PURE__ */ y(
|
|
49
|
+
x.Provider,
|
|
59
50
|
{
|
|
60
51
|
value: {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
52
|
+
addressDelivery: o,
|
|
53
|
+
backToDelivery: _,
|
|
54
|
+
setBackToDelivery: M,
|
|
55
|
+
setMethod: t,
|
|
56
|
+
priceStockInformation: E,
|
|
57
|
+
setPickupName: I,
|
|
58
|
+
setCity: S,
|
|
59
|
+
setUf: R,
|
|
60
|
+
setPickupTimes: T,
|
|
61
|
+
pickupTimes: r,
|
|
62
|
+
pickupConfirmScreenText: B,
|
|
63
|
+
pricesAndHours: b,
|
|
72
64
|
setModalOpen: w,
|
|
73
|
-
inputPostalCode:
|
|
74
|
-
setInputPostalCode:
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
deliveryPrice: k
|
|
65
|
+
inputPostalCode: c,
|
|
66
|
+
setInputPostalCode: z,
|
|
67
|
+
status: P,
|
|
68
|
+
setStatus: a,
|
|
69
|
+
pickupPoints: H,
|
|
70
|
+
titleText: h,
|
|
71
|
+
moreInfosText: k,
|
|
72
|
+
customShippingData: Y,
|
|
73
|
+
textBackButton: V,
|
|
74
|
+
confirmButton: q,
|
|
75
|
+
editAddress: F,
|
|
76
|
+
delivery: L,
|
|
77
|
+
pickup: j,
|
|
78
|
+
view: G,
|
|
79
|
+
setView: f,
|
|
80
|
+
postalCodeValidation: v,
|
|
81
|
+
address: K,
|
|
82
|
+
pickupAddress: i,
|
|
83
|
+
setPickupAddress: O,
|
|
84
|
+
deliveryRequestInfos: X,
|
|
85
|
+
postalCode: J,
|
|
86
|
+
internalMethod: $,
|
|
87
|
+
setInternalMethod: m,
|
|
88
|
+
regionalizeCatalog: A,
|
|
89
|
+
disabledSearch: Q,
|
|
90
|
+
deliveryPrice: W
|
|
100
91
|
},
|
|
101
|
-
children:
|
|
92
|
+
children: U
|
|
102
93
|
}
|
|
103
94
|
);
|
|
104
|
-
},
|
|
105
|
-
const
|
|
106
|
-
if (!
|
|
95
|
+
}, go = () => {
|
|
96
|
+
const t = oo(x);
|
|
97
|
+
if (!t)
|
|
107
98
|
throw new Error(
|
|
108
99
|
"useRegionalizationContext must be used within a RegionalizationContextProvider"
|
|
109
100
|
);
|
|
110
|
-
return
|
|
101
|
+
return t;
|
|
111
102
|
};
|
|
112
103
|
export {
|
|
113
|
-
|
|
114
|
-
|
|
104
|
+
uo as RegionalizationContextProvider,
|
|
105
|
+
go as useRegionalizationContext
|
|
115
106
|
};
|
|
@@ -28,12 +28,12 @@ export interface RegionalizationProps {
|
|
|
28
28
|
setModalOpen: (modalOpen: boolean) => void;
|
|
29
29
|
inputPostalCode: string;
|
|
30
30
|
setInputPostalCode: (value: string) => void;
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
addressDelivery: {
|
|
32
|
+
loading: boolean;
|
|
33
33
|
address?: Address;
|
|
34
34
|
deliveryInfos?: DeliveryProps;
|
|
35
35
|
customShipping?: CustomShippingProps;
|
|
36
|
-
}
|
|
36
|
+
};
|
|
37
37
|
status: Status;
|
|
38
38
|
setStatus: (status: Status) => void;
|
|
39
39
|
pickupPoints: PikcupPointType[];
|
|
@@ -82,7 +82,7 @@ export interface RegionalizationProps {
|
|
|
82
82
|
children?: ReactNode;
|
|
83
83
|
}
|
|
84
84
|
export interface Status {
|
|
85
|
-
status
|
|
86
|
-
message
|
|
87
|
-
loading
|
|
85
|
+
status: "FAILED" | "SUCCESS" | "LOADING";
|
|
86
|
+
message: string;
|
|
87
|
+
loading: boolean;
|
|
88
88
|
}
|
|
@@ -1,67 +1,66 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useEffect as
|
|
3
|
-
import { Title as
|
|
4
|
-
import { SetViewButton as
|
|
5
|
-
import { ArrowIcon as
|
|
6
|
-
import { ShoppingBagsIcon as
|
|
7
|
-
import { ShoppingIcon as
|
|
8
|
-
import { useRegionalizationContext as
|
|
9
|
-
import { formatPrice as
|
|
10
|
-
const
|
|
1
|
+
import { jsxs as e, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect as l } from "react";
|
|
3
|
+
import { Title as p } from "../components/Title.js";
|
|
4
|
+
import { SetViewButton as r } from "../components/SetViewButton.js";
|
|
5
|
+
import { ArrowIcon as d } from "../../../assets/svgs/ArrowIcon.js";
|
|
6
|
+
import { ShoppingBagsIcon as f } from "../../../assets/svgs/ShoppingBagsIcon.js";
|
|
7
|
+
import { ShoppingIcon as h } from "../../../assets/svgs/ShoppingIcon.js";
|
|
8
|
+
import { useRegionalizationContext as I } from "../context/RegionalizationContext.js";
|
|
9
|
+
import { formatPrice as u } from "../utils/formatPrice.js";
|
|
10
|
+
const k = () => {
|
|
11
11
|
const {
|
|
12
|
-
titleText:
|
|
13
|
-
moreInfosText:
|
|
14
|
-
deliveryPrice:
|
|
15
|
-
priceStockInformation:
|
|
16
|
-
backToDelivery:
|
|
17
|
-
setBackToDelivery:
|
|
18
|
-
status:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
/* @__PURE__ */
|
|
25
|
-
/* @__PURE__ */ e(
|
|
26
|
-
|
|
27
|
-
t,
|
|
12
|
+
titleText: n,
|
|
13
|
+
moreInfosText: a,
|
|
14
|
+
deliveryPrice: c,
|
|
15
|
+
priceStockInformation: s,
|
|
16
|
+
backToDelivery: t,
|
|
17
|
+
setBackToDelivery: i,
|
|
18
|
+
status: m
|
|
19
|
+
} = I();
|
|
20
|
+
return l(() => {
|
|
21
|
+
t && (i == null || i(!1));
|
|
22
|
+
}, [t, m]), /* @__PURE__ */ e("div", { className: "inital-view-container", children: [
|
|
23
|
+
/* @__PURE__ */ o(p, { title: n }),
|
|
24
|
+
/* @__PURE__ */ o("p", { className: "price-stock-information", children: s }),
|
|
25
|
+
/* @__PURE__ */ e(
|
|
26
|
+
r,
|
|
28
27
|
{
|
|
29
28
|
view: "MoreInfosScreen",
|
|
30
29
|
className: "more-infos-button",
|
|
31
30
|
dataTestId: "more-infos-button",
|
|
32
31
|
children: [
|
|
33
|
-
|
|
34
|
-
/* @__PURE__ */
|
|
32
|
+
a,
|
|
33
|
+
/* @__PURE__ */ o("span", { children: /* @__PURE__ */ o(d, { color: "var(--color-main)" }) })
|
|
35
34
|
]
|
|
36
35
|
}
|
|
37
36
|
),
|
|
38
|
-
/* @__PURE__ */
|
|
39
|
-
/* @__PURE__ */
|
|
40
|
-
|
|
37
|
+
/* @__PURE__ */ e("div", { className: "delivery-option-container", children: [
|
|
38
|
+
/* @__PURE__ */ e(
|
|
39
|
+
r,
|
|
41
40
|
{
|
|
42
41
|
view: "PostalCodeInputScreen",
|
|
43
42
|
className: "option",
|
|
44
43
|
dataTestId: "delivery-options",
|
|
45
44
|
children: [
|
|
46
|
-
/* @__PURE__ */
|
|
47
|
-
/* @__PURE__ */
|
|
48
|
-
/* @__PURE__ */
|
|
45
|
+
/* @__PURE__ */ o(f, {}),
|
|
46
|
+
/* @__PURE__ */ o("h4", { children: "Receber em casa" }),
|
|
47
|
+
/* @__PURE__ */ e("p", { children: [
|
|
49
48
|
" A partir de ",
|
|
50
|
-
|
|
49
|
+
u(c || 0)
|
|
51
50
|
] })
|
|
52
51
|
]
|
|
53
52
|
}
|
|
54
53
|
),
|
|
55
|
-
/* @__PURE__ */
|
|
56
|
-
|
|
54
|
+
/* @__PURE__ */ e(
|
|
55
|
+
r,
|
|
57
56
|
{
|
|
58
57
|
view: "PickupPointInfoScreen",
|
|
59
58
|
className: "option",
|
|
60
59
|
dataTestId: "pickup-options",
|
|
61
60
|
children: [
|
|
62
|
-
/* @__PURE__ */
|
|
63
|
-
/* @__PURE__ */
|
|
64
|
-
/* @__PURE__ */
|
|
61
|
+
/* @__PURE__ */ o(h, {}),
|
|
62
|
+
/* @__PURE__ */ o("h4", { children: "Retirar na Loja" }),
|
|
63
|
+
/* @__PURE__ */ o("p", { children: " Grátis" })
|
|
65
64
|
]
|
|
66
65
|
}
|
|
67
66
|
)
|
|
@@ -69,5 +68,5 @@ const j = () => {
|
|
|
69
68
|
] });
|
|
70
69
|
};
|
|
71
70
|
export {
|
|
72
|
-
|
|
71
|
+
k as InitialView
|
|
73
72
|
};
|
|
@@ -18,7 +18,7 @@ const K = () => {
|
|
|
18
18
|
textBackButton: h,
|
|
19
19
|
pickup: i,
|
|
20
20
|
setBackToDelivery: a
|
|
21
|
-
} = I(), l = (o == null ? void 0 : o.status) === "
|
|
21
|
+
} = I(), l = (o == null ? void 0 : o.status) === "FAILED";
|
|
22
22
|
return /* @__PURE__ */ n(f, { children: /* @__PURE__ */ n("div", { className: "delivery-pickup-container", children: /* @__PURE__ */ c("div", { className: "content-container", children: [
|
|
23
23
|
/* @__PURE__ */ n(k, { title: l ? "Tente outro CEP" : e == null ? void 0 : e.title }),
|
|
24
24
|
l ? /* @__PURE__ */ c("div", { className: "warning-container", children: [
|
package/package.json
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@plurix/ecom-components",
|
|
3
|
-
"author": "Plurix",
|
|
4
|
-
"private": false,
|
|
5
|
-
"version": "1.20.
|
|
6
|
-
"type": "module",
|
|
7
|
-
"main": "dist/main.js",
|
|
8
|
-
"types": "dist/main.d.ts",
|
|
9
|
-
"files": [
|
|
10
|
-
"dist"
|
|
11
|
-
],
|
|
12
|
-
"repository": {
|
|
13
|
-
"type": "git",
|
|
14
|
-
"url": "git+https://github.com/plurix-ecommerce/ecom-components.git"
|
|
15
|
-
},
|
|
16
|
-
"sideEffects": [
|
|
17
|
-
"**/*.css"
|
|
18
|
-
],
|
|
19
|
-
"scripts": {
|
|
20
|
-
"dev": "vite",
|
|
21
|
-
"build": "tsc --p ./tsconfig-build.json && vite build",
|
|
22
|
-
"format": "prettier --write .",
|
|
23
|
-
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
24
|
-
"prepare": "husky install",
|
|
25
|
-
"preview": "vite preview",
|
|
26
|
-
"test": "jest"
|
|
27
|
-
},
|
|
28
|
-
"peerDependencies": {
|
|
29
|
-
"react": "^18.2.0",
|
|
30
|
-
"react-dom": "^18.2.0"
|
|
31
|
-
},
|
|
32
|
-
"devDependencies": {
|
|
33
|
-
"@babel/preset-env": "^7.24.5",
|
|
34
|
-
"@babel/preset-react": "^7.24.1",
|
|
35
|
-
"@commitlint/cli": "^17.4.2",
|
|
36
|
-
"@commitlint/config-conventional": "^17.4.2",
|
|
37
|
-
"@jest/globals": "^29.7.0",
|
|
38
|
-
"@testing-library/jest-dom": "^6.4.5",
|
|
39
|
-
"@testing-library/react": "^15.0.7",
|
|
40
|
-
"@types/jest": "^29.5.12",
|
|
41
|
-
"@types/node": "^20.11.30",
|
|
42
|
-
"@types/react": "^18.2.71",
|
|
43
|
-
"@types/react-dom": "^18.2.22",
|
|
44
|
-
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
45
|
-
"@typescript-eslint/parser": "^6.21.0",
|
|
46
|
-
"@vitejs/plugin-react": "^4.2.1",
|
|
47
|
-
"eslint": "^8.57.0",
|
|
48
|
-
"eslint-plugin-react-hooks": "^4.6.0",
|
|
49
|
-
"eslint-plugin-react-refresh": "^0.4.6",
|
|
50
|
-
"glob": "^10.3.10",
|
|
51
|
-
"husky": "^9.0.11",
|
|
52
|
-
"identity-obj-proxy": "^3.0.0",
|
|
53
|
-
"jest": "^29.7.0",
|
|
54
|
-
"jest-environment-jsdom": "^29.7.0",
|
|
55
|
-
"jest-svg-transformer": "^1.0.0",
|
|
56
|
-
"prettier": "^2.2.1",
|
|
57
|
-
"react": "^18.2.0",
|
|
58
|
-
"react-dom": "^18.2.0",
|
|
59
|
-
"rollup-plugin-delete": "^2.0.0",
|
|
60
|
-
"ts-jest": "^29.1.2",
|
|
61
|
-
"typescript": "^5.4.3",
|
|
62
|
-
"vite": "^4.5.3",
|
|
63
|
-
"vite-plugin-dts": "^3.7.3",
|
|
64
|
-
"vite-plugin-lib-inject-css": "^2.0.1"
|
|
65
|
-
},
|
|
66
|
-
"dependencies": {
|
|
67
|
-
"axios": "^1.7.4"
|
|
68
|
-
}
|
|
69
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@plurix/ecom-components",
|
|
3
|
+
"author": "Plurix",
|
|
4
|
+
"private": false,
|
|
5
|
+
"version": "1.20.1",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "dist/main.js",
|
|
8
|
+
"types": "dist/main.d.ts",
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/plurix-ecommerce/ecom-components.git"
|
|
15
|
+
},
|
|
16
|
+
"sideEffects": [
|
|
17
|
+
"**/*.css"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"dev": "vite",
|
|
21
|
+
"build": "tsc --p ./tsconfig-build.json && vite build",
|
|
22
|
+
"format": "prettier --write .",
|
|
23
|
+
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
24
|
+
"prepare": "husky install",
|
|
25
|
+
"preview": "vite preview",
|
|
26
|
+
"test": "jest"
|
|
27
|
+
},
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"react": "^18.2.0",
|
|
30
|
+
"react-dom": "^18.2.0"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@babel/preset-env": "^7.24.5",
|
|
34
|
+
"@babel/preset-react": "^7.24.1",
|
|
35
|
+
"@commitlint/cli": "^17.4.2",
|
|
36
|
+
"@commitlint/config-conventional": "^17.4.2",
|
|
37
|
+
"@jest/globals": "^29.7.0",
|
|
38
|
+
"@testing-library/jest-dom": "^6.4.5",
|
|
39
|
+
"@testing-library/react": "^15.0.7",
|
|
40
|
+
"@types/jest": "^29.5.12",
|
|
41
|
+
"@types/node": "^20.11.30",
|
|
42
|
+
"@types/react": "^18.2.71",
|
|
43
|
+
"@types/react-dom": "^18.2.22",
|
|
44
|
+
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
45
|
+
"@typescript-eslint/parser": "^6.21.0",
|
|
46
|
+
"@vitejs/plugin-react": "^4.2.1",
|
|
47
|
+
"eslint": "^8.57.0",
|
|
48
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
49
|
+
"eslint-plugin-react-refresh": "^0.4.6",
|
|
50
|
+
"glob": "^10.3.10",
|
|
51
|
+
"husky": "^9.0.11",
|
|
52
|
+
"identity-obj-proxy": "^3.0.0",
|
|
53
|
+
"jest": "^29.7.0",
|
|
54
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
55
|
+
"jest-svg-transformer": "^1.0.0",
|
|
56
|
+
"prettier": "^2.2.1",
|
|
57
|
+
"react": "^18.2.0",
|
|
58
|
+
"react-dom": "^18.2.0",
|
|
59
|
+
"rollup-plugin-delete": "^2.0.0",
|
|
60
|
+
"ts-jest": "^29.1.2",
|
|
61
|
+
"typescript": "^5.4.3",
|
|
62
|
+
"vite": "^4.5.3",
|
|
63
|
+
"vite-plugin-dts": "^3.7.3",
|
|
64
|
+
"vite-plugin-lib-inject-css": "^2.0.1"
|
|
65
|
+
},
|
|
66
|
+
"dependencies": {
|
|
67
|
+
"axios": "^1.7.4"
|
|
68
|
+
}
|
|
69
|
+
}
|