@plurix/ecom-components 0.0.2-beta.2 → 0.0.2-beta.4
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/assets/svgs/ArrowIcon.d.ts +9 -0
- package/dist/assets/svgs/ArrowIcon.js +37 -0
- package/dist/assets/svgs/CartEmptyCoupon.d.ts +1 -0
- package/dist/assets/svgs/CartEmptyCoupon.js +937 -0
- package/dist/assets/svgs/CloseIcon.d.ts +7 -1
- package/dist/assets/svgs/CloseIcon.js +13 -9
- package/dist/assets/svgs/CouponIcon.d.ts +4 -0
- package/dist/assets/svgs/CouponIcon.js +22 -0
- package/dist/assets/svgs/DeliveryExpressIcon.d.ts +1 -0
- package/dist/assets/svgs/DeliveryExpressIcon.js +21 -0
- package/dist/assets/svgs/DeliveryIcon.d.ts +1 -0
- package/dist/assets/svgs/DeliveryIcon.js +21 -0
- package/dist/assets/svgs/ErrorIcon.d.ts +5 -0
- package/dist/assets/svgs/ErrorIcon.js +29 -0
- package/dist/assets/svgs/GlassIcon.d.ts +1 -0
- package/dist/assets/svgs/GlassIcon.js +23 -0
- package/dist/assets/svgs/InfoIcon.d.ts +6 -0
- package/dist/assets/svgs/InfoIcon.js +47 -0
- package/dist/assets/svgs/NoCouponIcon.d.ts +1 -0
- package/dist/assets/svgs/NoCouponIcon.js +107 -0
- package/dist/assets/svgs/ShoppingBagsIcon.d.ts +1 -0
- package/dist/assets/svgs/ShoppingBagsIcon.js +30 -0
- package/dist/assets/svgs/ShoppingIcon.d.ts +1 -0
- package/dist/assets/svgs/ShoppingIcon.js +21 -0
- package/dist/assets/svgs/SuccessIcon.d.ts +6 -0
- package/dist/assets/svgs/SuccessIcon.js +38 -0
- package/dist/assets/svgs/WarningIcon.d.ts +1 -0
- package/dist/assets/svgs/WarningIcon.js +25 -0
- package/dist/main.d.ts +5 -0
- package/dist/main.js +11 -3
- package/dist/packages/Carousel/Carousel.d.ts +24 -0
- package/dist/packages/Carousel/Carousel.js +128 -0
- package/dist/packages/Carousel/components/Arrows.d.ts +8 -0
- package/dist/packages/Carousel/components/Arrows.js +43 -0
- package/dist/packages/Carousel/components/Bullets.d.ts +7 -0
- package/dist/packages/Carousel/components/Bullets.js +5 -0
- package/dist/packages/Carousel/test/Carrousel.test.js +80 -0
- package/dist/packages/Carousel/utils/defaultProps.d.ts +19 -0
- package/dist/packages/Carousel/utils/defaultProps.js +22 -0
- package/dist/packages/Coupons/Coupons.d.ts +14 -0
- package/dist/packages/Coupons/Coupons.js +100 -0
- package/dist/packages/Coupons/api/addCoupon.d.ts +3 -0
- package/dist/packages/Coupons/api/addCoupon.js +14 -0
- package/dist/packages/Coupons/api/getCoupons.d.ts +3 -0
- package/dist/packages/Coupons/api/getCoupons.js +15 -0
- package/dist/packages/Coupons/api/removeCoupon.d.ts +3 -0
- package/dist/packages/Coupons/api/removeCoupon.js +13 -0
- package/dist/packages/Coupons/components/Alert.d.ts +6 -0
- package/dist/packages/Coupons/components/Alert.js +13 -0
- package/dist/packages/Coupons/components/Breadcrumb.d.ts +6 -0
- package/dist/packages/Coupons/components/Breadcrumb.js +33 -0
- package/dist/packages/Coupons/components/CouponCard.d.ts +25 -0
- package/dist/packages/Coupons/components/CouponCard.js +132 -0
- package/dist/packages/Coupons/components/Modal.d.ts +8 -0
- package/dist/packages/Coupons/components/Modal.js +34 -0
- package/dist/packages/Coupons/components/ModalFooter.d.ts +8 -0
- package/dist/packages/Coupons/components/ModalFooter.js +14 -0
- package/dist/packages/Coupons/components/ModalHeader.d.ts +6 -0
- package/dist/packages/Coupons/components/ModalHeader.js +25 -0
- package/dist/packages/Coupons/components/NoCoupons.d.ts +1 -0
- package/dist/packages/Coupons/components/NoCoupons.js +10 -0
- package/dist/packages/Coupons/test/Alert.test.js +18 -0
- package/dist/packages/Coupons/test/Breadcrumb.test.js +41 -0
- package/dist/packages/Coupons/test/ModalFooter.test.js +32 -0
- package/dist/packages/Coupons/test/ModalHeader.test.js +23 -0
- package/dist/packages/Coupons/test/NoCoupons.test.js +17 -0
- package/dist/packages/Coupons/types/CouponType.d.ts +8 -0
- package/dist/packages/Coupons/types/CouponType.js +1 -0
- package/dist/packages/Coupons/types/SetOrderFormCouponResponse.d.ts +10 -0
- package/dist/packages/Coupons/types/SetOrderFormCouponResponse.js +1 -0
- package/dist/packages/Coupons/types/Views.d.ts +1 -0
- package/dist/packages/Coupons/types/Views.js +1 -0
- package/dist/packages/Coupons/views/CouponsView.d.ts +13 -0
- package/dist/packages/Coupons/views/CouponsView.js +122 -0
- package/dist/packages/Coupons/views/EmptyCartView.d.ts +6 -0
- package/dist/packages/Coupons/views/EmptyCartView.js +37 -0
- package/dist/packages/Coupons/views/LoadingView.d.ts +7 -0
- package/dist/packages/Coupons/views/LoadingView.js +39 -0
- package/dist/packages/Coupons/views/OverwriteView.d.ts +14 -0
- package/dist/packages/Coupons/views/OverwriteView.js +58 -0
- package/dist/packages/Coupons/views/RulesView.d.ts +13 -0
- package/dist/packages/Coupons/views/RulesView.js +49 -0
- package/dist/packages/Coupons/views/index.d.ts +5 -0
- package/dist/packages/Coupons/views/index.js +12 -0
- package/dist/packages/Regionalization/Regionalization.d.ts +3 -0
- package/dist/packages/Regionalization/Regionalization.js +93 -0
- package/dist/packages/Regionalization/components/Delivery.d.ts +24 -0
- package/dist/packages/Regionalization/components/Delivery.js +48 -0
- package/dist/packages/Regionalization/components/DeliveryExpress.d.ts +9 -0
- package/dist/packages/Regionalization/components/DeliveryExpress.js +25 -0
- package/dist/packages/Regionalization/components/InfoPrices.d.ts +9 -0
- package/dist/packages/Regionalization/components/InfoPrices.js +15 -0
- package/dist/packages/Regionalization/components/Navigation.d.ts +6 -0
- package/dist/packages/Regionalization/components/Navigation.js +59 -0
- package/dist/packages/Regionalization/components/NormalDelivery.d.ts +7 -0
- package/dist/packages/Regionalization/components/NormalDelivery.js +23 -0
- package/dist/packages/Regionalization/components/PickupPoint.d.ts +7 -0
- package/dist/packages/Regionalization/components/PickupPoint.js +32 -0
- package/dist/packages/Regionalization/components/Price.d.ts +7 -0
- package/dist/packages/Regionalization/components/Price.js +10 -0
- package/dist/packages/Regionalization/components/SetViewButton.d.ts +11 -0
- package/dist/packages/Regionalization/components/SetViewButton.js +24 -0
- package/dist/packages/Regionalization/components/Title.d.ts +8 -0
- package/dist/packages/Regionalization/components/Title.js +21 -0
- package/dist/packages/Regionalization/context/RegionalizationContext.d.ts +4 -0
- package/dist/packages/Regionalization/context/RegionalizationContext.js +113 -0
- package/dist/packages/Regionalization/types/Address.d.ts +13 -0
- package/dist/packages/Regionalization/types/Address.js +1 -0
- package/dist/packages/Regionalization/types/ContextProps.d.ts +29 -0
- package/dist/packages/Regionalization/types/ContextProps.js +1 -0
- package/dist/packages/Regionalization/types/PikcupPointType.d.ts +22 -0
- package/dist/packages/Regionalization/types/PikcupPointType.js +1 -0
- package/dist/packages/Regionalization/types/PricesAndHours.d.ts +13 -0
- package/dist/packages/Regionalization/types/PricesAndHours.js +1 -0
- package/dist/packages/Regionalization/types/RegionalizationProps.d.ts +87 -0
- package/dist/packages/Regionalization/types/RegionalizationProps.js +1 -0
- package/dist/packages/Regionalization/types/index.d.ts +5 -0
- package/dist/packages/Regionalization/types/index.js +1 -0
- package/dist/packages/Regionalization/utils/constants.d.ts +1 -0
- package/dist/packages/Regionalization/utils/constants.js +4 -0
- package/dist/packages/Regionalization/utils/deliverySetData.d.ts +3 -0
- package/dist/packages/Regionalization/utils/deliverySetData.js +13 -0
- package/dist/packages/Regionalization/utils/formatPrice.d.ts +1 -0
- package/dist/packages/Regionalization/utils/formatPrice.js +8 -0
- package/dist/packages/Regionalization/utils/localStorage.d.ts +9 -0
- package/dist/packages/Regionalization/utils/localStorage.js +23 -0
- package/dist/packages/Regionalization/utils/pickupSetData.d.ts +3 -0
- package/dist/packages/Regionalization/utils/pickupSetData.js +11 -0
- package/dist/packages/Regionalization/utils/postalCode.d.ts +2 -0
- package/dist/packages/Regionalization/utils/postalCode.js +9 -0
- package/dist/packages/Regionalization/views/AllStoresScreen.d.ts +1 -0
- package/dist/packages/Regionalization/views/AllStoresScreen.js +73 -0
- package/dist/packages/Regionalization/views/ConfirmScreen.d.ts +1 -0
- package/dist/packages/Regionalization/views/ConfirmScreen.js +60 -0
- package/dist/packages/Regionalization/views/InitialView.d.ts +1 -0
- package/dist/packages/Regionalization/views/InitialView.js +49 -0
- package/dist/packages/Regionalization/views/MoreInfosScreen.d.ts +1 -0
- package/dist/packages/Regionalization/views/MoreInfosScreen.js +42 -0
- package/dist/packages/Regionalization/views/PickupPointInfoScreen.d.ts +1 -0
- package/dist/packages/Regionalization/views/PickupPointInfoScreen.js +42 -0
- package/dist/packages/Regionalization/views/PostalCodeInputScreen.d.ts +1 -0
- package/dist/packages/Regionalization/views/PostalCodeInputScreen.js +87 -0
- package/dist/packages/Regionalization/views/ViewsContainer.d.ts +1 -0
- package/dist/packages/Regionalization/views/ViewsContainer.js +22 -0
- package/dist/packages/Tour/Tour.d.ts +10 -0
- package/dist/packages/Tour/Tour.js +68 -0
- package/dist/packages/Tour/components/TooltipFooter.d.ts +11 -0
- package/dist/packages/Tour/components/TooltipFooter.js +14 -0
- package/dist/packages/Tour/components/TooltipHeader.d.ts +8 -0
- package/dist/packages/Tour/components/TooltipHeader.js +13 -0
- package/dist/packages/Tour/components/TourOverlay.d.ts +7 -0
- package/dist/packages/Tour/components/TourOverlay.js +12 -0
- package/dist/packages/Tour/components/TourTooltip.d.ts +17 -0
- package/dist/packages/Tour/components/TourTooltip.js +42 -0
- package/dist/packages/Tour/test/TooltipFooter.test.js +68 -0
- package/dist/packages/Tour/test/TooltipHeader.test.js +18 -0
- package/dist/packages/Tour/test/Tour.test.js +49 -0
- package/dist/packages/Tour/test/TourOverlay.test.js +18 -0
- package/dist/packages/Tour/test/TourTooltip.test.js +40 -0
- package/dist/packages/Tour/types/TourStep.d.ts +4 -0
- package/dist/packages/Tour/types/TourStep.js +1 -0
- package/dist/styles/carousel.global.css +1 -0
- package/dist/styles/coupons.global.css +1 -0
- package/dist/styles/regionalization.global.css +1 -0
- package/dist/styles/tour.global.css +1 -0
- package/package.json +5 -1
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { jsx as s, Fragment as V, jsxs as y } from "react/jsx-runtime";
|
|
2
|
+
import { Children as j, useState as a, useRef as N, useEffect as w } from "react";
|
|
3
|
+
import _ from "./components/Bullets.js";
|
|
4
|
+
import B from "./components/Arrows.js";
|
|
5
|
+
import { DefaultProps as L } from "./utils/defaultProps.js";
|
|
6
|
+
/* empty css */const O = ({
|
|
7
|
+
children: x,
|
|
8
|
+
id: m,
|
|
9
|
+
bullet: c,
|
|
10
|
+
arrow: r,
|
|
11
|
+
qtyItems: l,
|
|
12
|
+
gapItems: $ = 4
|
|
13
|
+
}) => {
|
|
14
|
+
const v = j.toArray(x), [k, p] = a(0), [M, S] = a(0), [u, D] = a(0), [E, I] = a(null), n = N(null), i = N(null), f = {
|
|
15
|
+
bullets: {
|
|
16
|
+
...L.styles.bullets,
|
|
17
|
+
...c == null ? void 0 : c.style
|
|
18
|
+
},
|
|
19
|
+
arrows: {
|
|
20
|
+
...L.styles.arrows,
|
|
21
|
+
...r == null ? void 0 : r.style
|
|
22
|
+
}
|
|
23
|
+
}, h = () => {
|
|
24
|
+
if (n.current) {
|
|
25
|
+
const t = n.current.scrollWidth, e = n.current.scrollLeft, o = n.current.offsetWidth, d = Math.ceil(t / o), R = Math.round(e / (t / d) - 0.3) + 1;
|
|
26
|
+
I(`${R}/${d}`);
|
|
27
|
+
}
|
|
28
|
+
}, A = () => {
|
|
29
|
+
if (n.current && i.current) {
|
|
30
|
+
const t = i.current.clientWidth, e = n.current.scrollLeft, o = Math.round(e / t);
|
|
31
|
+
S(o);
|
|
32
|
+
}
|
|
33
|
+
}, W = (t) => {
|
|
34
|
+
if (n.current && i.current) {
|
|
35
|
+
const e = i.current.clientWidth;
|
|
36
|
+
t === "prev" && (n.current.scrollLeft -= e), t === "next" && (n.current.scrollLeft += e);
|
|
37
|
+
}
|
|
38
|
+
}, C = () => {
|
|
39
|
+
if (n.current && i.current) {
|
|
40
|
+
const t = i.current.clientWidth, e = n.current.offsetWidth, o = n.current.scrollWidth, d = Math.round((o - e) / t);
|
|
41
|
+
p(l ? Math.ceil(v.length - l) : d);
|
|
42
|
+
}
|
|
43
|
+
}, F = (t) => {
|
|
44
|
+
if (n.current && i.current) {
|
|
45
|
+
const e = i.current.clientWidth;
|
|
46
|
+
n.current.scrollLeft = e * t;
|
|
47
|
+
}
|
|
48
|
+
}, g = (t) => {
|
|
49
|
+
if (n.current) {
|
|
50
|
+
const o = n.current.offsetWidth / t;
|
|
51
|
+
D(o);
|
|
52
|
+
}
|
|
53
|
+
}, Q = {
|
|
54
|
+
width: `${u < 150 ? 150 : u >= 226 ? 226 : u}px`
|
|
55
|
+
};
|
|
56
|
+
return typeof window < "u" && window.addEventListener("resize", () => {
|
|
57
|
+
h(), C(), l && g(l);
|
|
58
|
+
}), w(() => {
|
|
59
|
+
var t;
|
|
60
|
+
l && g(l), C(), h(), (t = n.current) == null || t.addEventListener("scroll", () => {
|
|
61
|
+
h(), A();
|
|
62
|
+
});
|
|
63
|
+
}, [n]), /* @__PURE__ */ s(V, { children: /* @__PURE__ */ y("div", { id: "carousel", "data-testid": "Carousel", children: [
|
|
64
|
+
/* @__PURE__ */ y("div", { className: "carousel-content", children: [
|
|
65
|
+
/* @__PURE__ */ s("div", { className: "carousel-arrow-button-prev", children: (r == null ? void 0 : r.isVisible) && /* @__PURE__ */ s(
|
|
66
|
+
B,
|
|
67
|
+
{
|
|
68
|
+
position: "prev",
|
|
69
|
+
style: f.arrows,
|
|
70
|
+
iconColor: r.iconColor ?? "#ccc",
|
|
71
|
+
onClick: () => W("prev")
|
|
72
|
+
}
|
|
73
|
+
) }),
|
|
74
|
+
/* @__PURE__ */ s(
|
|
75
|
+
"div",
|
|
76
|
+
{
|
|
77
|
+
ref: n,
|
|
78
|
+
className: "carousel-container",
|
|
79
|
+
id: `carousel-container-tracking${m ? "-" + m : ""}`,
|
|
80
|
+
children: v.map((t, e) => /* @__PURE__ */ s(
|
|
81
|
+
"div",
|
|
82
|
+
{
|
|
83
|
+
className: "container-item",
|
|
84
|
+
style: {
|
|
85
|
+
...Q,
|
|
86
|
+
transition: "all 0.5s ease-out",
|
|
87
|
+
marginRight: `${$}px`
|
|
88
|
+
},
|
|
89
|
+
ref: i,
|
|
90
|
+
children: t
|
|
91
|
+
},
|
|
92
|
+
e
|
|
93
|
+
))
|
|
94
|
+
}
|
|
95
|
+
),
|
|
96
|
+
/* @__PURE__ */ s("div", { className: "carousel-arrow-button-next", children: r != null && r.isVisible ? /* @__PURE__ */ s(
|
|
97
|
+
B,
|
|
98
|
+
{
|
|
99
|
+
position: "next",
|
|
100
|
+
style: f.arrows,
|
|
101
|
+
iconColor: r.iconColor ?? "#ccc",
|
|
102
|
+
onClick: () => W("next")
|
|
103
|
+
}
|
|
104
|
+
) : "" })
|
|
105
|
+
] }),
|
|
106
|
+
(c == null ? void 0 : c.numeric) && /* @__PURE__ */ s("div", { className: "numeric-bullets", children: E }),
|
|
107
|
+
c != null && c.isVisible ? /* @__PURE__ */ s("div", { className: "bullets-container", children: Array.from({ length: k + 1 }, (t, e) => e + 1).map(
|
|
108
|
+
(t, e) => /* @__PURE__ */ s(
|
|
109
|
+
_,
|
|
110
|
+
{
|
|
111
|
+
onClick: () => {
|
|
112
|
+
F(e);
|
|
113
|
+
},
|
|
114
|
+
index: e,
|
|
115
|
+
style: {
|
|
116
|
+
...f.bullets,
|
|
117
|
+
transition: "all 0.8s ease-out",
|
|
118
|
+
backgroundColor: `${M === e ? (c == null ? void 0 : c.bulletEnableColor) ?? "#ff0000" : (c == null ? void 0 : c.bulletDisableColor) ?? "#ccc"}`
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
e
|
|
122
|
+
)
|
|
123
|
+
) }) : ""
|
|
124
|
+
] }) });
|
|
125
|
+
};
|
|
126
|
+
export {
|
|
127
|
+
O as Carousel
|
|
128
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
const s = ({ onClick: r, style: o, position: n, iconColor: e }) => /* @__PURE__ */ t("button", { style: o, onClick: r, children: n === "prev" ? /* @__PURE__ */ t(
|
|
3
|
+
"svg",
|
|
4
|
+
{
|
|
5
|
+
width: "7",
|
|
6
|
+
height: "10",
|
|
7
|
+
viewBox: "0 0 7 10",
|
|
8
|
+
fill: "none",
|
|
9
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
10
|
+
children: /* @__PURE__ */ t(
|
|
11
|
+
"path",
|
|
12
|
+
{
|
|
13
|
+
d: "M5.5 1L1.5 5L5.5 9",
|
|
14
|
+
stroke: e,
|
|
15
|
+
strokeWidth: "1.5",
|
|
16
|
+
strokeLinecap: "round",
|
|
17
|
+
strokeLinejoin: "round"
|
|
18
|
+
}
|
|
19
|
+
)
|
|
20
|
+
}
|
|
21
|
+
) : /* @__PURE__ */ t(
|
|
22
|
+
"svg",
|
|
23
|
+
{
|
|
24
|
+
width: "7",
|
|
25
|
+
height: "10",
|
|
26
|
+
viewBox: "0 0 7 10",
|
|
27
|
+
fill: "none",
|
|
28
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
29
|
+
children: /* @__PURE__ */ t(
|
|
30
|
+
"path",
|
|
31
|
+
{
|
|
32
|
+
d: "M1.5 1L5.5 5L1.5 9",
|
|
33
|
+
stroke: e,
|
|
34
|
+
strokeWidth: "1.5",
|
|
35
|
+
strokeLinecap: "round",
|
|
36
|
+
strokeLinejoin: "round"
|
|
37
|
+
}
|
|
38
|
+
)
|
|
39
|
+
}
|
|
40
|
+
) });
|
|
41
|
+
export {
|
|
42
|
+
s as default
|
|
43
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { jsxs as l, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { render as i } from "@testing-library/react";
|
|
3
|
+
import "@testing-library/jest-dom";
|
|
4
|
+
import { Carousel as t } from "../Carousel.js";
|
|
5
|
+
const d = {
|
|
6
|
+
width: "226px",
|
|
7
|
+
height: "400px"
|
|
8
|
+
};
|
|
9
|
+
describe("Carousel", () => {
|
|
10
|
+
it("Should render Component", () => {
|
|
11
|
+
const { queryByTestId: r } = i(
|
|
12
|
+
/* @__PURE__ */ l(t, { qtyItems: 5, children: [
|
|
13
|
+
/* @__PURE__ */ e("div", { style: d, children: /* @__PURE__ */ e("p", { children: "Carousel 1" }) }),
|
|
14
|
+
",",
|
|
15
|
+
/* @__PURE__ */ e("div", { style: d, children: /* @__PURE__ */ e("p", { children: "Carousel 2" }) }),
|
|
16
|
+
",",
|
|
17
|
+
/* @__PURE__ */ e("div", { style: d, children: /* @__PURE__ */ e("p", { children: "Carousel 3" }) }),
|
|
18
|
+
",",
|
|
19
|
+
/* @__PURE__ */ e("div", { style: d, children: /* @__PURE__ */ e("p", { children: "Carousel 4" }) }),
|
|
20
|
+
",",
|
|
21
|
+
/* @__PURE__ */ e("div", { style: d, children: /* @__PURE__ */ e("p", { children: "Carousel 5" }) }),
|
|
22
|
+
",",
|
|
23
|
+
/* @__PURE__ */ e("div", { style: d, children: /* @__PURE__ */ e("p", { children: "Carousel 6" }) }),
|
|
24
|
+
",",
|
|
25
|
+
/* @__PURE__ */ e("div", { style: d, children: /* @__PURE__ */ e("p", { children: "Carousel 7" }) }),
|
|
26
|
+
",",
|
|
27
|
+
/* @__PURE__ */ e("div", { style: d, children: /* @__PURE__ */ e("p", { children: "Carousel 8" }) }),
|
|
28
|
+
",",
|
|
29
|
+
/* @__PURE__ */ e("div", { style: d, children: /* @__PURE__ */ e("p", { children: "Carousel 9" }) })
|
|
30
|
+
] })
|
|
31
|
+
);
|
|
32
|
+
expect(r("Carousel")).toBeInTheDocument();
|
|
33
|
+
}), it("Should render elements in carousel ", () => {
|
|
34
|
+
const { queryByTestId: r } = i(
|
|
35
|
+
/* @__PURE__ */ l(t, { qtyItems: 5, children: [
|
|
36
|
+
/* @__PURE__ */ e("div", { style: d, "data-testid": "Carousel 1", children: /* @__PURE__ */ e("p", { children: "Carousel 1" }) }),
|
|
37
|
+
",",
|
|
38
|
+
/* @__PURE__ */ e("div", { style: d, "data-testid": "Carousel 2", children: /* @__PURE__ */ e("p", { children: "Carousel 2" }) }),
|
|
39
|
+
",",
|
|
40
|
+
/* @__PURE__ */ e("div", { style: d, "data-testid": "Carousel 3", children: /* @__PURE__ */ e("p", { children: "Carousel 3" }) }),
|
|
41
|
+
",",
|
|
42
|
+
/* @__PURE__ */ e("div", { style: d, "data-testid": "Carousel 4", children: /* @__PURE__ */ e("p", { children: "Carousel 4" }) }),
|
|
43
|
+
",",
|
|
44
|
+
/* @__PURE__ */ e("div", { style: d, "data-testid": "Carousel 5", children: /* @__PURE__ */ e("p", { children: "Carousel 5" }) }),
|
|
45
|
+
",",
|
|
46
|
+
/* @__PURE__ */ e("div", { style: d, "data-testid": "Carousel 6", children: /* @__PURE__ */ e("p", { children: "Carousel 6" }) }),
|
|
47
|
+
",",
|
|
48
|
+
/* @__PURE__ */ e("div", { style: d, "data-testid": "Carousel 7", children: /* @__PURE__ */ e("p", { children: "Carousel 7" }) }),
|
|
49
|
+
",",
|
|
50
|
+
/* @__PURE__ */ e("div", { style: d, "data-testid": "Carousel 8", children: /* @__PURE__ */ e("p", { children: "Carousel 8" }) }),
|
|
51
|
+
",",
|
|
52
|
+
/* @__PURE__ */ e("div", { style: d, "data-testid": "Carousel 9", children: /* @__PURE__ */ e("p", { children: "Carousel 9" }) })
|
|
53
|
+
] })
|
|
54
|
+
);
|
|
55
|
+
expect(r("Carousel 5")).toBeInTheDocument(), expect(r("Carousel 10")).not.toBeInTheDocument();
|
|
56
|
+
}), it("Should render elements in carousel with label ", () => {
|
|
57
|
+
const { getAllByText: r } = i(
|
|
58
|
+
/* @__PURE__ */ l(t, { qtyItems: 5, children: [
|
|
59
|
+
/* @__PURE__ */ e("div", { style: d, "data-testid": "Carousel 1", children: /* @__PURE__ */ e("p", { children: "Carousel 1" }) }),
|
|
60
|
+
",",
|
|
61
|
+
/* @__PURE__ */ e("div", { style: d, "data-testid": "Carousel 2", children: /* @__PURE__ */ e("p", { children: "Carousel 2" }) }),
|
|
62
|
+
",",
|
|
63
|
+
/* @__PURE__ */ e("div", { style: d, "data-testid": "Carousel 3", children: /* @__PURE__ */ e("p", { children: "Carousel 3" }) }),
|
|
64
|
+
",",
|
|
65
|
+
/* @__PURE__ */ e("div", { style: d, "data-testid": "Carousel 4", children: /* @__PURE__ */ e("p", { children: "Carousel 4" }) }),
|
|
66
|
+
",",
|
|
67
|
+
/* @__PURE__ */ e("div", { style: d, "data-testid": "Carousel 5", children: /* @__PURE__ */ e("p", { children: "Carousel 5" }) }),
|
|
68
|
+
",",
|
|
69
|
+
/* @__PURE__ */ e("div", { style: d, "data-testid": "Carousel 6", children: /* @__PURE__ */ e("p", { children: "Carousel 6" }) }),
|
|
70
|
+
",",
|
|
71
|
+
/* @__PURE__ */ e("div", { style: d, "data-testid": "Carousel 7", children: /* @__PURE__ */ e("p", { children: "Carousel 7" }) }),
|
|
72
|
+
",",
|
|
73
|
+
/* @__PURE__ */ e("div", { style: d, "data-testid": "Carousel 8", children: /* @__PURE__ */ e("p", { children: "Carousel 8" }) }),
|
|
74
|
+
",",
|
|
75
|
+
/* @__PURE__ */ e("div", { style: d, "data-testid": "Carousel 9", children: /* @__PURE__ */ e("p", { children: "Carousel 9" }) })
|
|
76
|
+
] })
|
|
77
|
+
);
|
|
78
|
+
expect(r("Carousel 9").length).toBe(1);
|
|
79
|
+
});
|
|
80
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const DefaultProps: {
|
|
2
|
+
styles: {
|
|
3
|
+
bullets: {
|
|
4
|
+
width: string;
|
|
5
|
+
height: string;
|
|
6
|
+
borderStyle: string;
|
|
7
|
+
borderRadius: string;
|
|
8
|
+
margin: string;
|
|
9
|
+
};
|
|
10
|
+
arrows: {
|
|
11
|
+
width: string;
|
|
12
|
+
height: string;
|
|
13
|
+
color: string;
|
|
14
|
+
borderStyle: string;
|
|
15
|
+
borderRadius: string;
|
|
16
|
+
margin: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const e = {
|
|
2
|
+
styles: {
|
|
3
|
+
bullets: {
|
|
4
|
+
width: "15px",
|
|
5
|
+
height: "15px",
|
|
6
|
+
borderStyle: "none",
|
|
7
|
+
borderRadius: "30px",
|
|
8
|
+
margin: "7px"
|
|
9
|
+
},
|
|
10
|
+
arrows: {
|
|
11
|
+
width: "40px",
|
|
12
|
+
height: " 40px",
|
|
13
|
+
color: "white",
|
|
14
|
+
borderStyle: "none",
|
|
15
|
+
borderRadius: "30px",
|
|
16
|
+
margin: "10px"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
export {
|
|
21
|
+
e as DefaultProps
|
|
22
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
|
|
2
|
+
interface CouponsProps {
|
|
3
|
+
orderFormId: string;
|
|
4
|
+
hasItemsInCart: boolean;
|
|
5
|
+
builder: 'faststore' | 'app';
|
|
6
|
+
account: string;
|
|
7
|
+
isIO?: boolean;
|
|
8
|
+
closeIOModal?: () => void;
|
|
9
|
+
activeOrderFormCoupon?: string;
|
|
10
|
+
genericTaggingEvent?: (name: string, params: object) => void;
|
|
11
|
+
disableFirstEmptyModal?: boolean;
|
|
12
|
+
}
|
|
13
|
+
export declare const Coupons: ({ orderFormId, hasItemsInCart, builder, account, isIO, closeIOModal, activeOrderFormCoupon, genericTaggingEvent, disableFirstEmptyModal }: CouponsProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { jsx as t, jsxs as k } from "react/jsx-runtime";
|
|
2
|
+
import { useState as e, useEffect as V } from "react";
|
|
3
|
+
import { getCoupons as z } from "./api/getCoupons.js";
|
|
4
|
+
import { LoadingView as B } from "./views/LoadingView.js";
|
|
5
|
+
import { CouponsView as E } from "./views/CouponsView.js";
|
|
6
|
+
import { RulesView as G } from "./views/RulesView.js";
|
|
7
|
+
import { OverwriteView as H } from "./views/OverwriteView.js";
|
|
8
|
+
import { EmptyCartView as J } from "./views/EmptyCartView.js";
|
|
9
|
+
/* empty css */const F = ({
|
|
10
|
+
orderFormId: v,
|
|
11
|
+
hasItemsInCart: i,
|
|
12
|
+
builder: R,
|
|
13
|
+
account: a,
|
|
14
|
+
isIO: o = !1,
|
|
15
|
+
closeIOModal: p,
|
|
16
|
+
activeOrderFormCoupon: r,
|
|
17
|
+
genericTaggingEvent: s,
|
|
18
|
+
disableFirstEmptyModal: x
|
|
19
|
+
}) => {
|
|
20
|
+
const [L, c] = e(!0), [j, q] = e([]), [n, u] = e("coupons-view"), [S, f] = e(!1), [l, w] = e(!1), [C, d] = e(""), [m, y] = e(""), [h, N] = e(
|
|
21
|
+
!x
|
|
22
|
+
), [A, D] = e();
|
|
23
|
+
return V(() => {
|
|
24
|
+
r && d(r);
|
|
25
|
+
}, [r]), V(() => {
|
|
26
|
+
(async () => {
|
|
27
|
+
c(!0);
|
|
28
|
+
try {
|
|
29
|
+
const b = await z(a, R);
|
|
30
|
+
q(b);
|
|
31
|
+
} finally {
|
|
32
|
+
c(!1);
|
|
33
|
+
}
|
|
34
|
+
})();
|
|
35
|
+
}, []), L ? /* @__PURE__ */ t("div", { className: "coupons-container", children: /* @__PURE__ */ t(
|
|
36
|
+
B,
|
|
37
|
+
{
|
|
38
|
+
isIO: o,
|
|
39
|
+
closeIOModal: p,
|
|
40
|
+
genericTaggingEvent: s
|
|
41
|
+
}
|
|
42
|
+
) }) : /* @__PURE__ */ k("div", { className: "coupons-container", children: [
|
|
43
|
+
(!o || o && n === "coupons-view") && /* @__PURE__ */ t(
|
|
44
|
+
E,
|
|
45
|
+
{
|
|
46
|
+
orderFormId: v,
|
|
47
|
+
hasItemsInCart: i,
|
|
48
|
+
account: a,
|
|
49
|
+
isIO: o,
|
|
50
|
+
closeIOModal: p,
|
|
51
|
+
coupons: j,
|
|
52
|
+
firstCouponName: C,
|
|
53
|
+
secondCouponName: m,
|
|
54
|
+
replaceCoupon: l,
|
|
55
|
+
setView: u,
|
|
56
|
+
setFirstCouponName: d,
|
|
57
|
+
setSecondCouponName: y,
|
|
58
|
+
setActiveRule: f,
|
|
59
|
+
setDataItem: D,
|
|
60
|
+
setReplaceCoupon: w,
|
|
61
|
+
setIsCloseModalEmpty: N,
|
|
62
|
+
genericTaggingEvent: s
|
|
63
|
+
}
|
|
64
|
+
),
|
|
65
|
+
(!o || o && n === "rules-view") && S && /* @__PURE__ */ t(
|
|
66
|
+
G,
|
|
67
|
+
{
|
|
68
|
+
dataItem: A,
|
|
69
|
+
setActiveRule: f,
|
|
70
|
+
setView: u,
|
|
71
|
+
isIO: o,
|
|
72
|
+
closeIOModal: p,
|
|
73
|
+
genericTaggingEvent: s
|
|
74
|
+
}
|
|
75
|
+
),
|
|
76
|
+
(!o || o && n === "overwrite-view") && m && !l && /* @__PURE__ */ t(
|
|
77
|
+
H,
|
|
78
|
+
{
|
|
79
|
+
firstCouponName: C,
|
|
80
|
+
secondCouponName: m,
|
|
81
|
+
setView: u,
|
|
82
|
+
setReplaceCoupon: w,
|
|
83
|
+
setSecondCouponName: y,
|
|
84
|
+
isIO: o,
|
|
85
|
+
closeIOModal: p,
|
|
86
|
+
genericTaggingEvent: s
|
|
87
|
+
}
|
|
88
|
+
),
|
|
89
|
+
!i && h && /* @__PURE__ */ t(
|
|
90
|
+
J,
|
|
91
|
+
{
|
|
92
|
+
setIsCloseModalEmpty: N,
|
|
93
|
+
genericTaggingEvent: s
|
|
94
|
+
}
|
|
95
|
+
)
|
|
96
|
+
] });
|
|
97
|
+
};
|
|
98
|
+
export {
|
|
99
|
+
F as Coupons
|
|
100
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import p from "axios";
|
|
2
|
+
const s = async (o, t) => {
|
|
3
|
+
const {
|
|
4
|
+
data: { coupons: a }
|
|
5
|
+
} = await p.get(
|
|
6
|
+
`https://${o}.vtex.app/api/coupon/list`,
|
|
7
|
+
{
|
|
8
|
+
params: { builder: t, random: Math.random() }
|
|
9
|
+
}
|
|
10
|
+
);
|
|
11
|
+
return a;
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
s as getCoupons
|
|
15
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsxs as c, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { SuccessIcon as r } from "../../../assets/svgs/SuccessIcon.js";
|
|
3
|
+
import { ErrorIcon as e } from "../../../assets/svgs/ErrorIcon.js";
|
|
4
|
+
const m = ({ type: s }) => s === "success" || s === "removed" ? /* @__PURE__ */ c("div", { className: "applied-coupon-badge success-coupon", children: [
|
|
5
|
+
/* @__PURE__ */ o("span", { children: /* @__PURE__ */ o(r, {}) }),
|
|
6
|
+
s === "success" ? "Cupom aplicado com sucesso" : "Cupom removido com sucesso"
|
|
7
|
+
] }) : /* @__PURE__ */ c("div", { className: "applied-coupon-badge error-coupon", children: [
|
|
8
|
+
/* @__PURE__ */ o("span", { children: /* @__PURE__ */ o(e, {}) }),
|
|
9
|
+
"Não foi possível aplicar o cupom. Tente aplicar mais tarde."
|
|
10
|
+
] });
|
|
11
|
+
export {
|
|
12
|
+
m as Alert
|
|
13
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsxs as t, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { ArrowIcon as a } from "../../../assets/svgs/ArrowIcon.js";
|
|
3
|
+
const s = ({ title: c, cancelButtonAction: o }) => /* @__PURE__ */ t("div", { className: "breadcrumb-container", children: [
|
|
4
|
+
/* @__PURE__ */ t("div", { className: "breadcrumb-content-container", children: [
|
|
5
|
+
/* @__PURE__ */ r(
|
|
6
|
+
"button",
|
|
7
|
+
{
|
|
8
|
+
onClick: o,
|
|
9
|
+
"data-testid": "back-to-coupons-button",
|
|
10
|
+
children: "Meus Cupons"
|
|
11
|
+
}
|
|
12
|
+
),
|
|
13
|
+
" ",
|
|
14
|
+
/* @__PURE__ */ r(a, {}),
|
|
15
|
+
" ",
|
|
16
|
+
/* @__PURE__ */ r("span", { children: c })
|
|
17
|
+
] }),
|
|
18
|
+
/* @__PURE__ */ t(
|
|
19
|
+
"button",
|
|
20
|
+
{
|
|
21
|
+
className: "breadcrumb-back-button",
|
|
22
|
+
onClick: o,
|
|
23
|
+
"data-testid": "back-button",
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ r(a, { color: "var(--color-support-links)", rotate: "Left" }),
|
|
26
|
+
" Voltar"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
)
|
|
30
|
+
] });
|
|
31
|
+
export {
|
|
32
|
+
s as Breadcrumb
|
|
33
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CouponType } from '../types/CouponType';
|
|
2
|
+
import { View } from '../types/Views';
|
|
3
|
+
import { AlertType } from './Alert';
|
|
4
|
+
|
|
5
|
+
export interface CouponCardProps {
|
|
6
|
+
account: string;
|
|
7
|
+
orderFormId: string;
|
|
8
|
+
hasItemsInCart: boolean;
|
|
9
|
+
isIO?: boolean;
|
|
10
|
+
item: CouponType;
|
|
11
|
+
firstCouponName: string;
|
|
12
|
+
secondCouponName: string;
|
|
13
|
+
replaceCoupon: boolean;
|
|
14
|
+
setView: (view: View) => void;
|
|
15
|
+
setFirstCouponName: (firstCouponName: string) => void;
|
|
16
|
+
setSecondCouponName: (secondCouponName: string) => void;
|
|
17
|
+
setActiveRule: (activeRule: boolean) => void;
|
|
18
|
+
setDataItem: (dataItem: CouponType) => void;
|
|
19
|
+
setReplaceCoupon: (replaceCoupon: boolean) => void;
|
|
20
|
+
setAlert: (errorMessage: boolean) => void;
|
|
21
|
+
setType: (type: AlertType) => void;
|
|
22
|
+
setIsCloseModalEmpty: (isCloseModalEmpty: boolean) => void;
|
|
23
|
+
genericTaggingEvent?: (name: string, params: object) => void;
|
|
24
|
+
}
|
|
25
|
+
export declare const CouponCard: ({ account, orderFormId, hasItemsInCart, isIO, item, firstCouponName, secondCouponName, replaceCoupon, setView, setActiveRule, setDataItem, setFirstCouponName, setSecondCouponName, setReplaceCoupon, setAlert, setType, setIsCloseModalEmpty, genericTaggingEvent }: CouponCardProps) => import("react/jsx-runtime").JSX.Element;
|