@plurix/ecom-components 1.15.0-loyalty.1 → 1.16.0-commerce.0

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 (94) hide show
  1. package/dist/assets/svgs/CouponIcon.d.ts +4 -1
  2. package/dist/assets/svgs/CouponIcon.js +14 -50
  3. package/dist/assets/svgs/ErrorIcon.d.ts +5 -1
  4. package/dist/assets/svgs/ErrorIcon.js +14 -26
  5. package/dist/main.d.ts +0 -1
  6. package/dist/main.js +17 -19
  7. package/dist/packages/ChangeOrderModal/ChangeOrderModal.d.ts +3 -3
  8. package/dist/packages/ChangeOrderModal/ChangeOrderModal.js +71 -73
  9. package/dist/packages/ChangeOrderModal/components/ModalFooter.d.ts +4 -1
  10. package/dist/packages/ChangeOrderModal/components/ModalFooter.js +3 -1
  11. package/dist/packages/ChangeOrderModal/components/SimilarProductList.d.ts +2 -3
  12. package/dist/packages/ChangeOrderModal/components/SimilarProducts.d.ts +4 -5
  13. package/dist/packages/ChangeOrderModal/components/SimilarProducts.js +21 -21
  14. package/dist/packages/ChangeOrderModal/mocks.d.ts +1 -0
  15. package/dist/packages/ChangeOrderModal/mocks.js +1 -0
  16. package/dist/packages/Coupons/Coupons.d.ts +17 -3
  17. package/dist/packages/Coupons/Coupons.js +114 -76
  18. package/dist/packages/Coupons/components/Alert.d.ts +2 -4
  19. package/dist/packages/Coupons/components/Alert.js +10 -10
  20. package/dist/packages/Coupons/components/Breadcrumb.d.ts +6 -0
  21. package/dist/packages/Coupons/components/Breadcrumb.js +33 -0
  22. package/dist/packages/Coupons/components/CouponCard.d.ts +22 -5
  23. package/dist/packages/Coupons/components/CouponCard.js +133 -79
  24. package/dist/packages/Coupons/components/Modal.d.ts +8 -0
  25. package/dist/packages/Coupons/components/Modal.js +62 -0
  26. package/dist/packages/Coupons/components/ModalFooter.d.ts +9 -0
  27. package/dist/packages/Coupons/components/ModalFooter.js +25 -0
  28. package/dist/packages/Coupons/components/ModalHeader.d.ts +6 -0
  29. package/dist/packages/Coupons/components/ModalHeader.js +25 -0
  30. package/dist/packages/Coupons/components/NoCoupons.js +7 -7
  31. package/dist/packages/Coupons/types/CouponType.d.ts +1 -1
  32. package/dist/packages/Coupons/types/Views.d.ts +1 -0
  33. package/dist/packages/Coupons/types/Views.js +1 -0
  34. package/dist/packages/Coupons/views/CouponsView.d.ts +15 -0
  35. package/dist/packages/Coupons/views/CouponsView.js +131 -0
  36. package/dist/packages/Coupons/views/EmptyCartView.d.ts +6 -0
  37. package/dist/packages/Coupons/views/EmptyCartView.js +36 -0
  38. package/dist/packages/Coupons/views/LoadingView.d.ts +7 -0
  39. package/dist/packages/Coupons/views/LoadingView.js +39 -0
  40. package/dist/packages/Coupons/views/OverwriteView.d.ts +14 -0
  41. package/dist/packages/Coupons/views/OverwriteView.js +58 -0
  42. package/dist/packages/Coupons/views/RulesView.d.ts +13 -0
  43. package/dist/packages/Coupons/views/RulesView.js +49 -0
  44. package/dist/packages/Coupons/views/index.d.ts +5 -0
  45. package/dist/packages/Coupons/views/index.js +12 -0
  46. package/dist/styles/change-order-modal.global.css +1 -1
  47. package/dist/styles/coupons.global.css +1 -1
  48. package/package.json +1 -1
  49. package/dist/assets/svgs/CheckMarkBoxIcon.d.ts +0 -1
  50. package/dist/assets/svgs/CheckMarkBoxIcon.js +0 -30
  51. package/dist/assets/svgs/CheckMarkIcon.d.ts +0 -1
  52. package/dist/assets/svgs/CheckMarkIcon.js +0 -23
  53. package/dist/assets/svgs/ErrorIconV2.d.ts +0 -1
  54. package/dist/assets/svgs/ErrorIconV2.js +0 -33
  55. package/dist/assets/svgs/SuccessIconV2.d.ts +0 -1
  56. package/dist/assets/svgs/SuccessIconV2.js +0 -30
  57. package/dist/assets/svgs/WarningIconV2.d.ts +0 -1
  58. package/dist/assets/svgs/WarningIconV2.js +0 -40
  59. package/dist/hooks/useVerticalShelfCarouselProps.d.ts +0 -4
  60. package/dist/hooks/useVerticalShelfCarouselProps.js +0 -14
  61. package/dist/hooks/useWindowDimensions.d.ts +0 -5
  62. package/dist/hooks/useWindowDimensions.js +0 -38
  63. package/dist/packages/AdaptiveCarousel/AdaptiveCarousel.d.ts +0 -14
  64. package/dist/packages/AdaptiveCarousel/AdaptiveCarousel.js +0 -69
  65. package/dist/packages/Coupons/hooks/useCoupons.d.ts +0 -33
  66. package/dist/packages/Coupons/hooks/useCoupons.js +0 -108
  67. package/dist/packages/VouchersRedeemed/VouchersRedeemed.d.ts +0 -24
  68. package/dist/packages/VouchersRedeemed/VouchersRedeemed.js +0 -145
  69. package/dist/packages/VouchersRedeemed/api/getCouponsCartonistByUser.d.ts +0 -1
  70. package/dist/packages/VouchersRedeemed/api/getCouponsCartonistByUser.js +0 -20
  71. package/dist/packages/VouchersRedeemed/components/StatusMessageTryApply/StatusMessageTryApply.d.ts +0 -12
  72. package/dist/packages/VouchersRedeemed/components/StatusMessageTryApply/StatusMessageTryApply.js +0 -27
  73. package/dist/packages/VouchersRedeemed/components/StatusMessageTryApply/index.d.ts +0 -1
  74. package/dist/packages/VouchersRedeemed/components/StatusMessageTryApply/index.js +0 -4
  75. package/dist/packages/VouchersRedeemed/components/VoucherRedeemedCard/VoucherRedeemedCard.d.ts +0 -17
  76. package/dist/packages/VouchersRedeemed/components/VoucherRedeemedCard/VoucherRedeemedCard.js +0 -37
  77. package/dist/packages/VouchersRedeemed/components/VoucherRedeemedCard/index.d.ts +0 -1
  78. package/dist/packages/VouchersRedeemed/components/VoucherRedeemedCard/index.js +0 -4
  79. package/dist/packages/VouchersRedeemed/components/VouchersRedeemedSkeleton/VouchersRedeemedSkeleton.d.ts +0 -15
  80. package/dist/packages/VouchersRedeemed/components/VouchersRedeemedSkeleton/VouchersRedeemedSkeleton.js +0 -49
  81. package/dist/packages/VouchersRedeemed/components/VouchersRedeemedSkeleton/index.d.ts +0 -1
  82. package/dist/packages/VouchersRedeemed/components/VouchersRedeemedSkeleton/index.js +0 -4
  83. package/dist/packages/VouchersRedeemed/data/validVouchers.d.ts +0 -1
  84. package/dist/packages/VouchersRedeemed/data/validVouchers.js +0 -20
  85. package/dist/packages/VouchersRedeemed/utils/getCouponPrice.d.ts +0 -1
  86. package/dist/packages/VouchersRedeemed/utils/getCouponPrice.js +0 -8
  87. package/dist/styles/adaptive-carousel.global.css +0 -1
  88. package/dist/styles/vouchers-redeemed.global.css +0 -1
  89. package/dist/utils/carousel/carouselProps.d.ts +0 -33
  90. package/dist/utils/carousel/carouselProps.js +0 -59
  91. package/dist/utils/scroll/isScrollToEnd.d.ts +0 -1
  92. package/dist/utils/scroll/isScrollToEnd.js +0 -4
  93. package/dist/utils/setBoldTextParts.d.ts +0 -1
  94. package/dist/utils/setBoldTextParts.js +0 -7
@@ -1,82 +1,120 @@
1
- import { jsx as o, jsxs as e, Fragment as p } from "react/jsx-runtime";
2
- import { Skeleton as C } from "../Skeleton/index.js";
3
- import { ErrorIcon as f } from "../../assets/svgs/ErrorIcon.js";
4
- import { CouponCard as N } from "./components/CouponCard.js";
5
- import { Alert as v } from "./components/Alert.js";
6
- import { NoCoupons as b } from "./components/NoCoupons.js";
7
- import { useCoupons as S } from "./hooks/useCoupons.js";
8
- /* empty css */const k = (r) => {
9
- const { isIO: l } = r, {
10
- isLoadingCouponList: m,
11
- coupons: i,
12
- currentCoupon: a,
13
- inputCoupon: u,
14
- isLoadingButton: c,
15
- isInputError: s,
16
- showAlert: n,
17
- handleSubmit: d,
18
- handleChangeInput: h,
19
- changeCoupon: g
20
- } = S(r);
21
- return m ? /* @__PURE__ */ o("div", { className: "coupons-container", children: /* @__PURE__ */ o(
22
- C,
1
+ import { jsx as e, jsxs as P } from "react/jsx-runtime";
2
+ import { useState as t, useEffect as h } from "react";
3
+ import { LoadingView as Q } from "./views/LoadingView.js";
4
+ import { CouponsView as U } from "./views/CouponsView.js";
5
+ import { RulesView as W } from "./views/RulesView.js";
6
+ import { OverwriteView as X } from "./views/OverwriteView.js";
7
+ import { EmptyCartView as Y } from "./views/EmptyCartView.js";
8
+ import { getCoupons as Z } from "./api/getCoupons.js";
9
+ /* empty css */const to = ({
10
+ orderFormId: j,
11
+ hasItemsInCart: f,
12
+ builder: l,
13
+ account: A,
14
+ isIO: o = !1,
15
+ closeIOModal: r,
16
+ activeOrderFormCoupon: n,
17
+ genericTaggingEvent: s,
18
+ disableFirstEmptyModal: J,
19
+ couponsList: p,
20
+ qtdCouponsView: w,
21
+ getCouponsMutation: q,
22
+ addCouponMutation: D,
23
+ removeCouponMutation: L
24
+ }) => {
25
+ const [k, C] = t(!0), [z, a] = t([]), [u, c] = t("coupons-view"), [B, N] = t(!1), [d, y] = t(!1), [v, R] = t(""), [m, V] = t(""), [E, S] = t(
26
+ !J
27
+ ), [G, H] = t();
28
+ return h(() => {
29
+ n && R(n);
30
+ }, [n]), h(() => {
31
+ (async () => {
32
+ C(!0);
33
+ try {
34
+ const i = o ? await Z(l, p) : await q({
35
+ input: {
36
+ builder: l,
37
+ couponsList: p
38
+ }
39
+ }), x = o ? i : JSON.parse(i.getCoupons.data).coupons;
40
+ if (w) {
41
+ const K = x.slice(0, w);
42
+ a(K);
43
+ return;
44
+ }
45
+ a(x);
46
+ return;
47
+ } catch (i) {
48
+ a([]);
49
+ } finally {
50
+ C(!1);
51
+ }
52
+ })();
53
+ }, [JSON.stringify(p)]), k ? /* @__PURE__ */ e("div", { className: "coupons-container", children: /* @__PURE__ */ e(
54
+ Q,
23
55
  {
24
- width: "100%",
25
- height: 600,
26
- backgroundColor: "var(--color-grayScale-faded)",
27
- margin: "auto",
28
- animation: !0
56
+ isIO: o,
57
+ closeIOModal: r,
58
+ genericTaggingEvent: s
29
59
  }
30
- ) }) : /* @__PURE__ */ e("div", { className: "coupons-container", children: [
31
- /* @__PURE__ */ e("div", { className: "form-coupons", children: [
32
- /* @__PURE__ */ o("p", { children: "Digite o código do seu cupom ou selecione o que deseja resgatar:" }),
33
- /* @__PURE__ */ e("form", { onSubmit: d, children: [
34
- /* @__PURE__ */ o(
35
- "input",
36
- {
37
- type: "text",
38
- placeholder: "Digite o código",
39
- value: u,
40
- onChange: h,
41
- className: s ? "error" : ""
42
- }
43
- ),
44
- /* @__PURE__ */ o("button", { type: "submit", name: "Aplicar", disabled: c, children: "Aplicar" }),
45
- s && /* @__PURE__ */ e("p", { className: "error-message", children: [
46
- /* @__PURE__ */ o(f, {}),
47
- " Não foi possível aplicar o Cupom"
48
- ] })
49
- ] })
50
- ] }),
51
- /* @__PURE__ */ o("div", { className: "container-title-coupons", children: i.length > 0 ? /* @__PURE__ */ e(p, { children: [
52
- !l && /* @__PURE__ */ e(p, { children: [
53
- /* @__PURE__ */ o("h2", { className: "container-main-title", children: "Seus Cupons de Descontos" }),
54
- /* @__PURE__ */ o("p", { className: "container-main-subtitle", children: "Você precisa ter um cupom e pelo menos 1 item no carrinho para aplicar o desconto." })
55
- ] }),
56
- /* @__PURE__ */ o("div", { className: "container-coupons", children: i.map((t) => /* @__PURE__ */ o(
57
- N,
58
- {
59
- item: t,
60
- currentCoupon: a,
61
- changeCoupon: g,
62
- isLoading: c
63
- },
64
- t.couponName
65
- )) }),
66
- n && /* @__PURE__ */ e(v, { type: n, children: [
67
- n === "applied" && /* @__PURE__ */ e("p", { children: [
68
- "Cupom ",
69
- /* @__PURE__ */ o("strong", { children: a }),
70
- " aplicado com sucesso!"
71
- ] }),
72
- n === "warning" && /* @__PURE__ */ e("p", { children: [
73
- "Para adicionar o cupom, é necessário que você tenha pelo menos ",
74
- /* @__PURE__ */ o("strong", { children: "1 produto no carrinho." })
75
- ] })
76
- ] })
77
- ] }) : /* @__PURE__ */ o(b, {}) })
60
+ ) }) : /* @__PURE__ */ P("div", { className: "coupons-container", children: [
61
+ (!o || o && u === "coupons-view") && /* @__PURE__ */ e(
62
+ U,
63
+ {
64
+ removeCouponMutation: L,
65
+ addCouponMutation: D,
66
+ orderFormId: j,
67
+ hasItemsInCart: f,
68
+ account: A,
69
+ isIO: o,
70
+ closeIOModal: r,
71
+ coupons: z,
72
+ firstCouponName: v,
73
+ secondCouponName: m,
74
+ replaceCoupon: d,
75
+ setView: c,
76
+ setFirstCouponName: R,
77
+ setSecondCouponName: V,
78
+ setActiveRule: N,
79
+ setDataItem: H,
80
+ setReplaceCoupon: y,
81
+ setIsCloseModalEmpty: S,
82
+ genericTaggingEvent: s
83
+ }
84
+ ),
85
+ (!o || o && u === "rules-view") && B && /* @__PURE__ */ e(
86
+ W,
87
+ {
88
+ dataItem: G,
89
+ setActiveRule: N,
90
+ setView: c,
91
+ isIO: o,
92
+ closeIOModal: r,
93
+ genericTaggingEvent: s
94
+ }
95
+ ),
96
+ (!o || o && u === "overwrite-view") && m && !d && /* @__PURE__ */ e(
97
+ X,
98
+ {
99
+ firstCouponName: v,
100
+ secondCouponName: m,
101
+ setView: c,
102
+ setReplaceCoupon: y,
103
+ setSecondCouponName: V,
104
+ isIO: o,
105
+ closeIOModal: r,
106
+ genericTaggingEvent: s
107
+ }
108
+ ),
109
+ !f && E && /* @__PURE__ */ e(
110
+ Y,
111
+ {
112
+ setIsCloseModalEmpty: S,
113
+ genericTaggingEvent: s
114
+ }
115
+ )
78
116
  ] });
79
117
  };
80
118
  export {
81
- k as Coupons
119
+ to as Coupons
82
120
  };
@@ -1,8 +1,6 @@
1
- /// <reference types="react" />
2
1
  interface AlertProps {
3
2
  type: AlertType;
4
- children: React.ReactNode;
5
3
  }
6
- export type AlertType = '' | 'applied' | 'warning';
7
- export declare const Alert: ({ type, children }: AlertProps) => import("react/jsx-runtime").JSX.Element | null;
4
+ export type AlertType = '' | 'success' | 'removed' | 'error';
5
+ export declare const Alert: ({ type }: AlertProps) => import("react/jsx-runtime").JSX.Element;
8
6
  export {};
@@ -1,13 +1,13 @@
1
- import { jsxs as i, jsx as n } from "react/jsx-runtime";
2
- import { CheckMarkBoxIcon as t } from "../../../assets/svgs/CheckMarkBoxIcon.js";
3
- import { WarningIcon as a } from "../../../assets/svgs/WarningIcon.js";
4
- const c = {
5
- applied: /* @__PURE__ */ n(t, {}),
6
- warning: /* @__PURE__ */ n(a, {})
7
- }, s = ({ type: r, children: o }) => r === "" ? null : /* @__PURE__ */ i("div", { className: `alert ${r}`, children: [
8
- c[r],
9
- o
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
10
  ] });
11
11
  export {
12
- s as Alert
12
+ m as Alert
13
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
+ };
@@ -1,10 +1,27 @@
1
1
  import { CouponType } from '../types/CouponType';
2
- import { ChangeCouponParams } from '../hooks/useCoupons';
2
+ import { View } from '../types/Views';
3
+ import { AlertType } from './Alert';
3
4
 
4
5
  export interface CouponCardProps {
6
+ account: string;
7
+ orderFormId: string;
8
+ hasItemsInCart: boolean;
9
+ isIO?: boolean;
5
10
  item: CouponType;
6
- currentCoupon: string;
7
- changeCoupon: (params: ChangeCouponParams) => Promise<void>;
8
- isLoading: boolean;
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
+ addCouponMutation?: any;
25
+ removeCouponMutation?: any;
9
26
  }
10
- export declare const CouponCard: ({ item, currentCoupon, changeCoupon, isLoading }: CouponCardProps) => import("react/jsx-runtime").JSX.Element;
27
+ export declare const CouponCard: ({ orderFormId, hasItemsInCart, isIO, item, firstCouponName, secondCouponName, replaceCoupon, setView, setActiveRule, setDataItem, setFirstCouponName, setSecondCouponName, setReplaceCoupon, setAlert, setType, setIsCloseModalEmpty, genericTaggingEvent, addCouponMutation, removeCouponMutation }: CouponCardProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,88 +1,142 @@
1
- import { jsx as e, jsxs as n } from "react/jsx-runtime";
2
- import { useState as w, useRef as h, useEffect as m } from "react";
3
- import { CouponIcon as g } from "../../../assets/svgs/CouponIcon.js";
4
- import { CheckMarkIcon as x } from "../../../assets/svgs/CheckMarkIcon.js";
5
- import { CloseIcon as b } from "../../../assets/svgs/CloseIcon.js";
6
- const T = ({
7
- item: o,
8
- currentCoupon: t,
9
- changeCoupon: f,
10
- isLoading: N
1
+ import { jsxs as p, jsx as c } from "react/jsx-runtime";
2
+ import { useState as V, useEffect as q } from "react";
3
+ import { addCoupon as B } from "../api/addCoupon.js";
4
+ import { CouponIcon as G } from "../../../assets/svgs/CouponIcon.js";
5
+ import { SuccessIcon as H } from "../../../assets/svgs/SuccessIcon.js";
6
+ import { removeCoupon as K } from "../api/removeCoupon.js";
7
+ const Z = ({
8
+ orderFormId: t,
9
+ hasItemsInCart: D,
10
+ isIO: r = !1,
11
+ item: a,
12
+ firstCouponName: s,
13
+ secondCouponName: d,
14
+ replaceCoupon: b,
15
+ setView: R,
16
+ setActiveRule: z,
17
+ setDataItem: J,
18
+ setFirstCouponName: L,
19
+ setSecondCouponName: _,
20
+ setReplaceCoupon: j,
21
+ setAlert: f,
22
+ setType: m,
23
+ setIsCloseModalEmpty: y,
24
+ genericTaggingEvent: o,
25
+ addCouponMutation: S,
26
+ removeCouponMutation: i
11
27
  }) => {
12
- const [i, d] = w(!1), a = h(null), r = h(null), s = !!(t && t.toLowerCase() === o.couponName.toLowerCase());
13
- async function C() {
14
- await f({
15
- couponName: o.couponName,
16
- isAdding: !s,
17
- isFromForm: !1
18
- });
19
- }
20
- function p() {
21
- d(!i);
22
- }
23
- return m(() => {
24
- var c;
25
- if (i && r.current && a.current) {
26
- const l = (c = a.current.clientWidth) != null ? c : 328;
27
- r.current.style.width = `${l}px`;
28
- }
29
- }, [i]), m(() => {
30
- const c = (l) => {
31
- var u;
32
- r.current && (l == null ? void 0 : l.target) instanceof Node && !((u = r.current) != null && u.contains(l == null ? void 0 : l.target)) && d(!1);
33
- };
34
- return i ? document.addEventListener("mousedown", c) : document.removeEventListener("mousedown", c), () => {
35
- document.removeEventListener("mousedown", c);
36
- };
37
- }, [i]), /* @__PURE__ */ e("div", { className: "coupon-wrapper", ref: a, children: /* @__PURE__ */ n("div", { className: `container-card-coupon ${s ? "active" : ""}`, children: [
38
- /* @__PURE__ */ n("div", { className: "card-coupon-content", children: [
39
- /* @__PURE__ */ n("div", { className: "text-container", children: [
40
- /* @__PURE__ */ n("div", { children: [
41
- /* @__PURE__ */ n("div", { className: "container-title", children: [
42
- /* @__PURE__ */ e(g, {}),
43
- /* @__PURE__ */ e("h3", { className: "title", children: o.couponName }),
44
- o.couponValue && /* @__PURE__ */ e("p", { className: "price-badge", children: o.couponValue })
45
- ] }),
46
- o.couponDescription && /* @__PURE__ */ e("h4", { className: "subtitle", children: o.couponDescription }),
47
- o.couponExpirationDate && /* @__PURE__ */ n("h4", { className: "subtitle", children: [
48
- "Válido até ",
49
- o.couponExpirationDate
50
- ] })
51
- ] }),
52
- /* @__PURE__ */ e(
53
- "button",
54
- {
55
- className: `select-coupon ${s ? "applied" : ""}`,
56
- onClick: C,
57
- disabled: N,
58
- children: s && /* @__PURE__ */ e(x, {})
28
+ const [x, u] = V(!1), [k, w] = V(!1);
29
+ q(() => {
30
+ d.toLowerCase() !== a.couponName.toLowerCase() && u(!1), s && !d && s.toLowerCase() === a.couponName.toLowerCase() && u(!0), s && d && b && d.toLowerCase() === a.couponName.toLowerCase() && A(d);
31
+ }, [s, d, b]);
32
+ const A = async (l) => {
33
+ if (D)
34
+ try {
35
+ if (!s || s && b) {
36
+ w(!0);
37
+ const h = r ? await B(t, l) : await S({
38
+ input: {
39
+ orderFormId: t,
40
+ couponId: l
41
+ }
42
+ }), N = r ? h : JSON.parse(h.addCoupon.data);
43
+ j(!1), L(l), _(""), N.error.length <= 0 ? (o == null || o("discount_coupon", {
44
+ name: "cupom aplicado",
45
+ cupomName: l
46
+ }), m("success"), u(!0), r && window.location.reload()) : (o == null || o("discount_coupon", {
47
+ name: "cupom aplicando - cupom incorreto ou expirado",
48
+ cupomName: l,
49
+ objectError: N.error
50
+ }), m("error"), u(!1), L("")), f(!0);
51
+ } else
52
+ _(l), R("overwrite-view");
53
+ } catch (h) {
54
+ o == null || o("discount_coupon", {
55
+ name: "problema na api",
56
+ cupomName: l
57
+ }), u(!1), m("error"), f(!0);
58
+ } finally {
59
+ w(!1);
60
+ }
61
+ else
62
+ o == null || o("discount_coupon", {
63
+ name: "Modal de cart vazio acionado"
64
+ }), y(!0);
65
+ }, M = async () => {
66
+ if (D)
67
+ try {
68
+ w(!0), j(!1);
69
+ const l = r ? await K(t) : await i({
70
+ input: {
71
+ orderFormId: t
59
72
  }
60
- )
73
+ }), h = r ? l : JSON.parse(l.removeCoupon.data);
74
+ h.error.length <= 0 ? (o == null || o("discount_coupon", {
75
+ name: "cupom removido com sucesso",
76
+ cupomName: s
77
+ }), m("removed"), u(!1), L(""), _(""), r && window.location.reload()) : (o == null || o("discount_coupon", {
78
+ name: "algum problema na remoção do cupom",
79
+ cupomName: s,
80
+ objectError: h.error
81
+ }), m("error"), u(!0)), f(!0);
82
+ } catch (l) {
83
+ o == null || o("discount_coupon", {
84
+ name: "problema na api - na remoção do cupom",
85
+ cupomName: s
86
+ }), m("error"), u(!0), f(!0);
87
+ } finally {
88
+ w(!1);
89
+ }
90
+ else
91
+ o == null || o("discount_coupon", {
92
+ name: "Modal de cart vazio acionado"
93
+ }), y(!0);
94
+ }, $ = () => {
95
+ z(!0), J(a), R("rules-view");
96
+ };
97
+ return /* @__PURE__ */ p("div", { className: `container-card-coupon ${x ? "active" : ""}`, children: [
98
+ /* @__PURE__ */ p("div", { className: "text-container", children: [
99
+ /* @__PURE__ */ p("div", { className: "container-title", children: [
100
+ /* @__PURE__ */ c(G, { width: 20, height: 16 }),
101
+ /* @__PURE__ */ c("h3", { className: "title", children: a.couponName })
61
102
  ] }),
62
- /* @__PURE__ */ e("div", { className: `ellipse left ${s ? "applied" : ""}` }),
63
- /* @__PURE__ */ e("div", { className: `ellipse right ${s ? "applied" : ""}` })
64
- ] }),
65
- o.couponRules && o.couponRules.length > 0 && /* @__PURE__ */ e("button", { className: "see-rules", onClick: p, children: "*Termos & condições" }),
66
- i && /* @__PURE__ */ n("div", { className: "tooltip-rules", ref: r, children: [
67
- /* @__PURE__ */ n("div", { className: "tooltip-rules-header", children: [
68
- /* @__PURE__ */ e("h4", { children: "Termos e Condições" }),
69
- /* @__PURE__ */ e("button", { onClick: p, children: /* @__PURE__ */ e(b, {}) })
103
+ a.couponValue && /* @__PURE__ */ p("p", { className: "price-badge", children: [
104
+ "- ",
105
+ a.couponValue
70
106
  ] }),
71
- /* @__PURE__ */ e("p", { children: o.couponDescription }),
72
- /* @__PURE__ */ n("ul", { children: [
73
- o.couponRules.map((c) => /* @__PURE__ */ n("li", { children: [
74
- "• ",
75
- c
76
- ] }, c)),
77
- /* @__PURE__ */ n("li", { children: [
78
- "• Válido até ",
79
- o.couponExpirationDate,
80
- "."
81
- ] })
107
+ a.couponDescription && /* @__PURE__ */ c("h4", { className: "subtitle", children: a.couponDescription }),
108
+ a.couponExpirationDate && /* @__PURE__ */ p("h4", { className: "subtitle", children: [
109
+ "Válido até ",
110
+ a.couponExpirationDate
82
111
  ] })
112
+ ] }),
113
+ /* @__PURE__ */ c("div", { className: "vertical-line" }),
114
+ /* @__PURE__ */ p("div", { className: "buttons-container", children: [
115
+ x && /* @__PURE__ */ p("button", { className: "applied-coupon", children: [
116
+ /* @__PURE__ */ c("span", { className: "applied-coupon-span", children: /* @__PURE__ */ c(H, {}) }),
117
+ "Aplicado"
118
+ ] }),
119
+ x ? /* @__PURE__ */ c(
120
+ "button",
121
+ {
122
+ onClick: M,
123
+ className: "remove-coupon",
124
+ disabled: k,
125
+ children: "Remover"
126
+ }
127
+ ) : /* @__PURE__ */ c(
128
+ "button",
129
+ {
130
+ onClick: () => A(a.couponName),
131
+ className: "apply-coupon",
132
+ disabled: k,
133
+ children: "Aplicar"
134
+ }
135
+ ),
136
+ a.couponDescription && /* @__PURE__ */ c("a", { onClick: $, children: "Ver Regras" })
83
137
  ] })
84
- ] }) });
138
+ ] });
85
139
  };
86
140
  export {
87
- T as CouponCard
141
+ Z as CouponCard
88
142
  };
@@ -0,0 +1,8 @@
1
+ import { ModalHeaderProps } from './ModalHeader';
2
+ import { ModalFooterProps } from './ModalFooter';
3
+
4
+ interface ModalProps extends ModalHeaderProps, ModalFooterProps {
5
+ isIO?: boolean;
6
+ }
7
+ export declare const Modal: ({ children, isIO, closeModal, title, genericTaggingEvent, cancelButtonAction, ...modalFooterProps }: React.PropsWithChildren<ModalProps>) => import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,62 @@
1
+ var x = Object.defineProperty;
2
+ var m = Object.getOwnPropertySymbols;
3
+ var c = Object.prototype.hasOwnProperty, n = Object.prototype.propertyIsEnumerable;
4
+ var i = (r, e, o) => e in r ? x(r, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : r[e] = o, p = (r, e) => {
5
+ for (var o in e || (e = {}))
6
+ c.call(e, o) && i(r, o, e[o]);
7
+ if (m)
8
+ for (var o of m(e))
9
+ n.call(e, o) && i(r, o, e[o]);
10
+ return r;
11
+ };
12
+ var u = (r, e) => {
13
+ var o = {};
14
+ for (var a in r)
15
+ c.call(r, a) && e.indexOf(a) < 0 && (o[a] = r[a]);
16
+ if (r != null && m)
17
+ for (var a of m(r))
18
+ e.indexOf(a) < 0 && n.call(r, a) && (o[a] = r[a]);
19
+ return o;
20
+ };
21
+ import { jsx as l, jsxs as h } from "react/jsx-runtime";
22
+ import { ModalHeader as v } from "./ModalHeader.js";
23
+ import { Breadcrumb as M } from "./Breadcrumb.js";
24
+ import { ModalFooter as N } from "./ModalFooter.js";
25
+ const q = (j) => {
26
+ var s = j, {
27
+ children: r,
28
+ isIO: e = !1,
29
+ closeModal: o,
30
+ title: a,
31
+ genericTaggingEvent: f,
32
+ cancelButtonAction: d
33
+ } = s, t = u(s, [
34
+ "children",
35
+ "isIO",
36
+ "closeModal",
37
+ "title",
38
+ "genericTaggingEvent",
39
+ "cancelButtonAction"
40
+ ]);
41
+ return /* @__PURE__ */ l("div", { className: "modal-rule-coupon-external", children: /* @__PURE__ */ h("div", { className: "modal-rule-coupon-internal", children: [
42
+ /* @__PURE__ */ l(
43
+ v,
44
+ {
45
+ closeModal: o,
46
+ title: a,
47
+ genericTaggingEvent: f
48
+ }
49
+ ),
50
+ e && /* @__PURE__ */ l(M, { title: a, cancelButtonAction: d }),
51
+ /* @__PURE__ */ l("div", { className: "modal-rule-coupon-children", children: r }),
52
+ /* @__PURE__ */ l(
53
+ N,
54
+ p({
55
+ cancelButtonAction: d
56
+ }, t)
57
+ )
58
+ ] }) });
59
+ };
60
+ export {
61
+ q as Modal
62
+ };
@@ -0,0 +1,9 @@
1
+ export interface ModalFooterProps {
2
+ cancelButtonAction: () => void;
3
+ cancelButtonText: string;
4
+ confirmButtonAction?: () => void;
5
+ confirmButtonText?: string;
6
+ isFloating?: boolean;
7
+ redirectionClubText?: string;
8
+ }
9
+ export declare const ModalFooter: ({ cancelButtonAction, cancelButtonText, confirmButtonAction, confirmButtonText, isFloating, redirectionClubText }: ModalFooterProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,25 @@
1
+ import { jsxs as e, jsx as o } from "react/jsx-runtime";
2
+ const d = ({
3
+ cancelButtonAction: t,
4
+ cancelButtonText: r,
5
+ confirmButtonAction: c,
6
+ confirmButtonText: l,
7
+ isFloating: a,
8
+ redirectionClubText: n
9
+ }) => /* @__PURE__ */ e("div", { className: `modal-footer-container ${a ? "floating" : ""}`, children: [
10
+ c && l && /* @__PURE__ */ o("button", { onClick: c, className: "modal-confirm-button", children: l }),
11
+ /* @__PURE__ */ o("button", { onClick: t, className: "modal-cancel-button", children: r }),
12
+ n && /* @__PURE__ */ o(
13
+ "button",
14
+ {
15
+ onClick: () => {
16
+ window.location.href = "/s/?clubProducts";
17
+ },
18
+ className: "modal-confirm-button redirection-club-button",
19
+ children: n
20
+ }
21
+ )
22
+ ] });
23
+ export {
24
+ d as ModalFooter
25
+ };