@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.
Files changed (166) hide show
  1. package/dist/assets/svgs/ArrowIcon.d.ts +9 -0
  2. package/dist/assets/svgs/ArrowIcon.js +37 -0
  3. package/dist/assets/svgs/CartEmptyCoupon.d.ts +1 -0
  4. package/dist/assets/svgs/CartEmptyCoupon.js +937 -0
  5. package/dist/assets/svgs/CloseIcon.d.ts +7 -1
  6. package/dist/assets/svgs/CloseIcon.js +13 -9
  7. package/dist/assets/svgs/CouponIcon.d.ts +4 -0
  8. package/dist/assets/svgs/CouponIcon.js +22 -0
  9. package/dist/assets/svgs/DeliveryExpressIcon.d.ts +1 -0
  10. package/dist/assets/svgs/DeliveryExpressIcon.js +21 -0
  11. package/dist/assets/svgs/DeliveryIcon.d.ts +1 -0
  12. package/dist/assets/svgs/DeliveryIcon.js +21 -0
  13. package/dist/assets/svgs/ErrorIcon.d.ts +5 -0
  14. package/dist/assets/svgs/ErrorIcon.js +29 -0
  15. package/dist/assets/svgs/GlassIcon.d.ts +1 -0
  16. package/dist/assets/svgs/GlassIcon.js +23 -0
  17. package/dist/assets/svgs/InfoIcon.d.ts +6 -0
  18. package/dist/assets/svgs/InfoIcon.js +47 -0
  19. package/dist/assets/svgs/NoCouponIcon.d.ts +1 -0
  20. package/dist/assets/svgs/NoCouponIcon.js +107 -0
  21. package/dist/assets/svgs/ShoppingBagsIcon.d.ts +1 -0
  22. package/dist/assets/svgs/ShoppingBagsIcon.js +30 -0
  23. package/dist/assets/svgs/ShoppingIcon.d.ts +1 -0
  24. package/dist/assets/svgs/ShoppingIcon.js +21 -0
  25. package/dist/assets/svgs/SuccessIcon.d.ts +6 -0
  26. package/dist/assets/svgs/SuccessIcon.js +38 -0
  27. package/dist/assets/svgs/WarningIcon.d.ts +1 -0
  28. package/dist/assets/svgs/WarningIcon.js +25 -0
  29. package/dist/main.d.ts +5 -0
  30. package/dist/main.js +11 -3
  31. package/dist/packages/Carousel/Carousel.d.ts +24 -0
  32. package/dist/packages/Carousel/Carousel.js +128 -0
  33. package/dist/packages/Carousel/components/Arrows.d.ts +8 -0
  34. package/dist/packages/Carousel/components/Arrows.js +43 -0
  35. package/dist/packages/Carousel/components/Bullets.d.ts +7 -0
  36. package/dist/packages/Carousel/components/Bullets.js +5 -0
  37. package/dist/packages/Carousel/test/Carrousel.test.js +80 -0
  38. package/dist/packages/Carousel/utils/defaultProps.d.ts +19 -0
  39. package/dist/packages/Carousel/utils/defaultProps.js +22 -0
  40. package/dist/packages/Coupons/Coupons.d.ts +14 -0
  41. package/dist/packages/Coupons/Coupons.js +100 -0
  42. package/dist/packages/Coupons/api/addCoupon.d.ts +3 -0
  43. package/dist/packages/Coupons/api/addCoupon.js +14 -0
  44. package/dist/packages/Coupons/api/getCoupons.d.ts +3 -0
  45. package/dist/packages/Coupons/api/getCoupons.js +15 -0
  46. package/dist/packages/Coupons/api/removeCoupon.d.ts +3 -0
  47. package/dist/packages/Coupons/api/removeCoupon.js +13 -0
  48. package/dist/packages/Coupons/components/Alert.d.ts +6 -0
  49. package/dist/packages/Coupons/components/Alert.js +13 -0
  50. package/dist/packages/Coupons/components/Breadcrumb.d.ts +6 -0
  51. package/dist/packages/Coupons/components/Breadcrumb.js +33 -0
  52. package/dist/packages/Coupons/components/CouponCard.d.ts +25 -0
  53. package/dist/packages/Coupons/components/CouponCard.js +132 -0
  54. package/dist/packages/Coupons/components/Modal.d.ts +8 -0
  55. package/dist/packages/Coupons/components/Modal.js +34 -0
  56. package/dist/packages/Coupons/components/ModalFooter.d.ts +8 -0
  57. package/dist/packages/Coupons/components/ModalFooter.js +14 -0
  58. package/dist/packages/Coupons/components/ModalHeader.d.ts +6 -0
  59. package/dist/packages/Coupons/components/ModalHeader.js +25 -0
  60. package/dist/packages/Coupons/components/NoCoupons.d.ts +1 -0
  61. package/dist/packages/Coupons/components/NoCoupons.js +10 -0
  62. package/dist/packages/Coupons/test/Alert.test.js +18 -0
  63. package/dist/packages/Coupons/test/Breadcrumb.test.js +41 -0
  64. package/dist/packages/Coupons/test/ModalFooter.test.js +32 -0
  65. package/dist/packages/Coupons/test/ModalHeader.test.js +23 -0
  66. package/dist/packages/Coupons/test/NoCoupons.test.js +17 -0
  67. package/dist/packages/Coupons/types/CouponType.d.ts +8 -0
  68. package/dist/packages/Coupons/types/CouponType.js +1 -0
  69. package/dist/packages/Coupons/types/SetOrderFormCouponResponse.d.ts +10 -0
  70. package/dist/packages/Coupons/types/SetOrderFormCouponResponse.js +1 -0
  71. package/dist/packages/Coupons/types/Views.d.ts +1 -0
  72. package/dist/packages/Coupons/types/Views.js +1 -0
  73. package/dist/packages/Coupons/views/CouponsView.d.ts +13 -0
  74. package/dist/packages/Coupons/views/CouponsView.js +122 -0
  75. package/dist/packages/Coupons/views/EmptyCartView.d.ts +6 -0
  76. package/dist/packages/Coupons/views/EmptyCartView.js +37 -0
  77. package/dist/packages/Coupons/views/LoadingView.d.ts +7 -0
  78. package/dist/packages/Coupons/views/LoadingView.js +39 -0
  79. package/dist/packages/Coupons/views/OverwriteView.d.ts +14 -0
  80. package/dist/packages/Coupons/views/OverwriteView.js +58 -0
  81. package/dist/packages/Coupons/views/RulesView.d.ts +13 -0
  82. package/dist/packages/Coupons/views/RulesView.js +49 -0
  83. package/dist/packages/Coupons/views/index.d.ts +5 -0
  84. package/dist/packages/Coupons/views/index.js +12 -0
  85. package/dist/packages/Regionalization/Regionalization.d.ts +3 -0
  86. package/dist/packages/Regionalization/Regionalization.js +93 -0
  87. package/dist/packages/Regionalization/components/Delivery.d.ts +24 -0
  88. package/dist/packages/Regionalization/components/Delivery.js +48 -0
  89. package/dist/packages/Regionalization/components/DeliveryExpress.d.ts +9 -0
  90. package/dist/packages/Regionalization/components/DeliveryExpress.js +25 -0
  91. package/dist/packages/Regionalization/components/InfoPrices.d.ts +9 -0
  92. package/dist/packages/Regionalization/components/InfoPrices.js +15 -0
  93. package/dist/packages/Regionalization/components/Navigation.d.ts +6 -0
  94. package/dist/packages/Regionalization/components/Navigation.js +59 -0
  95. package/dist/packages/Regionalization/components/NormalDelivery.d.ts +7 -0
  96. package/dist/packages/Regionalization/components/NormalDelivery.js +23 -0
  97. package/dist/packages/Regionalization/components/PickupPoint.d.ts +7 -0
  98. package/dist/packages/Regionalization/components/PickupPoint.js +32 -0
  99. package/dist/packages/Regionalization/components/Price.d.ts +7 -0
  100. package/dist/packages/Regionalization/components/Price.js +10 -0
  101. package/dist/packages/Regionalization/components/SetViewButton.d.ts +11 -0
  102. package/dist/packages/Regionalization/components/SetViewButton.js +24 -0
  103. package/dist/packages/Regionalization/components/Title.d.ts +8 -0
  104. package/dist/packages/Regionalization/components/Title.js +21 -0
  105. package/dist/packages/Regionalization/context/RegionalizationContext.d.ts +4 -0
  106. package/dist/packages/Regionalization/context/RegionalizationContext.js +113 -0
  107. package/dist/packages/Regionalization/types/Address.d.ts +13 -0
  108. package/dist/packages/Regionalization/types/Address.js +1 -0
  109. package/dist/packages/Regionalization/types/ContextProps.d.ts +29 -0
  110. package/dist/packages/Regionalization/types/ContextProps.js +1 -0
  111. package/dist/packages/Regionalization/types/PikcupPointType.d.ts +22 -0
  112. package/dist/packages/Regionalization/types/PikcupPointType.js +1 -0
  113. package/dist/packages/Regionalization/types/PricesAndHours.d.ts +13 -0
  114. package/dist/packages/Regionalization/types/PricesAndHours.js +1 -0
  115. package/dist/packages/Regionalization/types/RegionalizationProps.d.ts +87 -0
  116. package/dist/packages/Regionalization/types/RegionalizationProps.js +1 -0
  117. package/dist/packages/Regionalization/types/index.d.ts +5 -0
  118. package/dist/packages/Regionalization/types/index.js +1 -0
  119. package/dist/packages/Regionalization/utils/constants.d.ts +1 -0
  120. package/dist/packages/Regionalization/utils/constants.js +4 -0
  121. package/dist/packages/Regionalization/utils/deliverySetData.d.ts +3 -0
  122. package/dist/packages/Regionalization/utils/deliverySetData.js +13 -0
  123. package/dist/packages/Regionalization/utils/formatPrice.d.ts +1 -0
  124. package/dist/packages/Regionalization/utils/formatPrice.js +8 -0
  125. package/dist/packages/Regionalization/utils/localStorage.d.ts +9 -0
  126. package/dist/packages/Regionalization/utils/localStorage.js +23 -0
  127. package/dist/packages/Regionalization/utils/pickupSetData.d.ts +3 -0
  128. package/dist/packages/Regionalization/utils/pickupSetData.js +11 -0
  129. package/dist/packages/Regionalization/utils/postalCode.d.ts +2 -0
  130. package/dist/packages/Regionalization/utils/postalCode.js +9 -0
  131. package/dist/packages/Regionalization/views/AllStoresScreen.d.ts +1 -0
  132. package/dist/packages/Regionalization/views/AllStoresScreen.js +73 -0
  133. package/dist/packages/Regionalization/views/ConfirmScreen.d.ts +1 -0
  134. package/dist/packages/Regionalization/views/ConfirmScreen.js +60 -0
  135. package/dist/packages/Regionalization/views/InitialView.d.ts +1 -0
  136. package/dist/packages/Regionalization/views/InitialView.js +49 -0
  137. package/dist/packages/Regionalization/views/MoreInfosScreen.d.ts +1 -0
  138. package/dist/packages/Regionalization/views/MoreInfosScreen.js +42 -0
  139. package/dist/packages/Regionalization/views/PickupPointInfoScreen.d.ts +1 -0
  140. package/dist/packages/Regionalization/views/PickupPointInfoScreen.js +42 -0
  141. package/dist/packages/Regionalization/views/PostalCodeInputScreen.d.ts +1 -0
  142. package/dist/packages/Regionalization/views/PostalCodeInputScreen.js +87 -0
  143. package/dist/packages/Regionalization/views/ViewsContainer.d.ts +1 -0
  144. package/dist/packages/Regionalization/views/ViewsContainer.js +22 -0
  145. package/dist/packages/Tour/Tour.d.ts +10 -0
  146. package/dist/packages/Tour/Tour.js +68 -0
  147. package/dist/packages/Tour/components/TooltipFooter.d.ts +11 -0
  148. package/dist/packages/Tour/components/TooltipFooter.js +14 -0
  149. package/dist/packages/Tour/components/TooltipHeader.d.ts +8 -0
  150. package/dist/packages/Tour/components/TooltipHeader.js +13 -0
  151. package/dist/packages/Tour/components/TourOverlay.d.ts +7 -0
  152. package/dist/packages/Tour/components/TourOverlay.js +12 -0
  153. package/dist/packages/Tour/components/TourTooltip.d.ts +17 -0
  154. package/dist/packages/Tour/components/TourTooltip.js +42 -0
  155. package/dist/packages/Tour/test/TooltipFooter.test.js +68 -0
  156. package/dist/packages/Tour/test/TooltipHeader.test.js +18 -0
  157. package/dist/packages/Tour/test/Tour.test.js +49 -0
  158. package/dist/packages/Tour/test/TourOverlay.test.js +18 -0
  159. package/dist/packages/Tour/test/TourTooltip.test.js +40 -0
  160. package/dist/packages/Tour/types/TourStep.d.ts +4 -0
  161. package/dist/packages/Tour/types/TourStep.js +1 -0
  162. package/dist/styles/carousel.global.css +1 -0
  163. package/dist/styles/coupons.global.css +1 -0
  164. package/dist/styles/regionalization.global.css +1 -0
  165. package/dist/styles/tour.global.css +1 -0
  166. 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,8 @@
1
+ interface Props {
2
+ onClick: () => void;
3
+ style: object;
4
+ position: string;
5
+ iconColor: string;
6
+ }
7
+ declare const Arrows: ({ onClick, style, position, iconColor }: Props) => import("react/jsx-runtime").JSX.Element;
8
+ export default Arrows;
@@ -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,7 @@
1
+ interface Props {
2
+ index: number;
3
+ onClick: () => void;
4
+ style: object;
5
+ }
6
+ declare const Bullets: ({ index, onClick, style }: Props) => import("react/jsx-runtime").JSX.Element;
7
+ export default Bullets;
@@ -0,0 +1,5 @@
1
+ import { jsx as e } from "react/jsx-runtime";
2
+ const u = ({ index: t, onClick: o, style: r }) => /* @__PURE__ */ e("button", { style: r, onClick: o }, t);
3
+ export {
4
+ u as default
5
+ };
@@ -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,3 @@
1
+ import { SetOrderFormCouponResponse } from '../types/SetOrderFormCouponResponse';
2
+
3
+ export declare const addCoupon: (account: string, orderFormId: string, couponId: string) => Promise<SetOrderFormCouponResponse>;
@@ -0,0 +1,14 @@
1
+ import r from "axios";
2
+ const s = async (o, t, a) => {
3
+ const { data: p } = await r.post(
4
+ `https://${o}.vtex.app/api/coupon/order`,
5
+ {
6
+ orderFormId: t,
7
+ couponId: a
8
+ }
9
+ );
10
+ return p;
11
+ };
12
+ export {
13
+ s as addCoupon
14
+ };
@@ -0,0 +1,3 @@
1
+ import { CouponType } from '../types/CouponType';
2
+
3
+ export declare const getCoupons: (account: string, builder: 'app' | 'faststore') => Promise<CouponType[]>;
@@ -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,3 @@
1
+ import { SetOrderFormCouponResponse } from '../types/SetOrderFormCouponResponse';
2
+
3
+ export declare const removeCoupon: (account: string, orderFormId: string) => Promise<SetOrderFormCouponResponse>;
@@ -0,0 +1,13 @@
1
+ import e from "axios";
2
+ const r = async (o, t) => {
3
+ const { data: a } = await e.delete(
4
+ `https://${o}.vtex.app/api/coupon/order`,
5
+ {
6
+ data: { orderFormId: t }
7
+ }
8
+ );
9
+ return a;
10
+ };
11
+ export {
12
+ r as removeCoupon
13
+ };
@@ -0,0 +1,6 @@
1
+ interface AlertProps {
2
+ type: AlertType;
3
+ }
4
+ export type AlertType = '' | 'success' | 'removed' | 'error';
5
+ export declare const Alert: ({ type }: AlertProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -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,6 @@
1
+ interface BreadcrumbProps {
2
+ title: string;
3
+ cancelButtonAction: () => void;
4
+ }
5
+ export declare const Breadcrumb: ({ title, cancelButtonAction }: BreadcrumbProps) => import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -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;