@plurix/ecom-components 1.14.2-commerce.8 → 1.14.2-shlo1445.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.
Files changed (75) hide show
  1. package/dist/assets/svgs/ErrorIconV2.d.ts +1 -0
  2. package/dist/assets/svgs/ErrorIconV2.js +33 -0
  3. package/dist/assets/svgs/SuccessIconV2.d.ts +1 -0
  4. package/dist/assets/svgs/SuccessIconV2.js +30 -0
  5. package/dist/assets/svgs/WarningIconV2.d.ts +1 -0
  6. package/dist/assets/svgs/WarningIconV2.js +40 -0
  7. package/dist/hooks/useVerticalShelfCarouselProps.d.ts +4 -0
  8. package/dist/hooks/useVerticalShelfCarouselProps.js +14 -0
  9. package/dist/hooks/useWindowDimensions.d.ts +5 -0
  10. package/dist/hooks/useWindowDimensions.js +38 -0
  11. package/dist/main.d.ts +1 -0
  12. package/dist/main.js +19 -17
  13. package/dist/packages/AdaptiveCarousel/AdaptiveCarousel.d.ts +14 -0
  14. package/dist/packages/AdaptiveCarousel/AdaptiveCarousel.js +69 -0
  15. package/dist/packages/ChangeOrderModal/ChangeOrderModal.d.ts +12 -2
  16. package/dist/packages/ChangeOrderModal/ChangeOrderModal.js +79 -71
  17. package/dist/packages/ChangeOrderModal/api/getOrderForm.d.ts +1 -1
  18. package/dist/packages/ChangeOrderModal/api/getOrderForm.js +7 -9
  19. package/dist/packages/ChangeOrderModal/api/getProductsSimilars.d.ts +7 -5
  20. package/dist/packages/ChangeOrderModal/api/getProductsSimilars.js +18 -11
  21. package/dist/packages/ChangeOrderModal/api/postChangeOrder.d.ts +6 -1
  22. package/dist/packages/ChangeOrderModal/api/postChangeOrder.js +11 -11
  23. package/dist/packages/Coupons/Coupons.d.ts +4 -1
  24. package/dist/packages/Coupons/Coupons.js +67 -57
  25. package/dist/packages/Coupons/api/addCoupon.js +6 -6
  26. package/dist/packages/Coupons/api/getCoupons.js +5 -5
  27. package/dist/packages/Coupons/components/CouponCard.d.ts +3 -1
  28. package/dist/packages/Coupons/components/CouponCard.js +94 -83
  29. package/dist/packages/Coupons/views/CouponsView.d.ts +3 -1
  30. package/dist/packages/Coupons/views/CouponsView.js +87 -78
  31. package/dist/packages/ProductCard/ProductCardBadge/ProductCardBadgeKg.js +13 -10
  32. package/dist/packages/ProductCard/ProductCardBadge/ProductCardDiscountBadge.d.ts +3 -2
  33. package/dist/packages/ProductCard/ProductCardBadge/ProductCardDiscountBadge.js +15 -31
  34. package/dist/packages/ProductCard/ProductCardHorizontal/index.js +31 -30
  35. package/dist/packages/ProductCard/ProductCardPrice/index.d.ts +8 -1
  36. package/dist/packages/ProductCard/ProductCardPrice/index.js +27 -31
  37. package/dist/packages/ProductCard/ProductCardVertical/index.js +16 -15
  38. package/dist/packages/Regionalization/Regionalization.d.ts +1 -1
  39. package/dist/packages/Regionalization/Regionalization.js +15 -13
  40. package/dist/packages/Regionalization/context/RegionalizationContext.d.ts +1 -1
  41. package/dist/packages/Regionalization/context/RegionalizationContext.js +31 -29
  42. package/dist/packages/Regionalization/types/RegionalizationProps.d.ts +1 -0
  43. package/dist/packages/Regionalization/views/AllStoresScreen.js +21 -21
  44. package/dist/packages/VouchersRedeemed/VouchersRedeemed.d.ts +22 -0
  45. package/dist/packages/VouchersRedeemed/VouchersRedeemed.js +121 -0
  46. package/dist/packages/VouchersRedeemed/api/getCouponsCartonistByUser.d.ts +1 -0
  47. package/dist/packages/VouchersRedeemed/api/getCouponsCartonistByUser.js +20 -0
  48. package/dist/packages/VouchersRedeemed/components/StatusMessageTryApply/StatusMessageTryApply.d.ts +12 -0
  49. package/dist/packages/VouchersRedeemed/components/StatusMessageTryApply/StatusMessageTryApply.js +27 -0
  50. package/dist/packages/VouchersRedeemed/components/StatusMessageTryApply/index.d.ts +1 -0
  51. package/dist/packages/VouchersRedeemed/components/StatusMessageTryApply/index.js +4 -0
  52. package/dist/packages/VouchersRedeemed/components/VoucherRedeemedCard/VoucherRedeemedCard.d.ts +17 -0
  53. package/dist/packages/VouchersRedeemed/components/VoucherRedeemedCard/VoucherRedeemedCard.js +37 -0
  54. package/dist/packages/VouchersRedeemed/components/VoucherRedeemedCard/index.d.ts +1 -0
  55. package/dist/packages/VouchersRedeemed/components/VoucherRedeemedCard/index.js +4 -0
  56. package/dist/packages/VouchersRedeemed/components/VouchersRedeemedSkeleton/VouchersRedeemedSkeleton.d.ts +14 -0
  57. package/dist/packages/VouchersRedeemed/components/VouchersRedeemedSkeleton/VouchersRedeemedSkeleton.js +48 -0
  58. package/dist/packages/VouchersRedeemed/components/VouchersRedeemedSkeleton/index.d.ts +1 -0
  59. package/dist/packages/VouchersRedeemed/components/VouchersRedeemedSkeleton/index.js +4 -0
  60. package/dist/packages/VouchersRedeemed/data/validVouchers.d.ts +1 -0
  61. package/dist/packages/VouchersRedeemed/data/validVouchers.js +20 -0
  62. package/dist/packages/VouchersRedeemed/utils/getCouponPrice.d.ts +1 -0
  63. package/dist/packages/VouchersRedeemed/utils/getCouponPrice.js +8 -0
  64. package/dist/styles/adaptive-carousel.global.css +1 -0
  65. package/dist/styles/regionalization.global.css +1 -1
  66. package/dist/styles/vouchers-redeemed.global.css +1 -0
  67. package/dist/types/ProductCard.d.ts +13 -12
  68. package/dist/utils/carousel/carouselProps.d.ts +33 -0
  69. package/dist/utils/carousel/carouselProps.js +59 -0
  70. package/dist/utils/changerOrderModal.js +13 -16
  71. package/dist/utils/scroll/isScrollToEnd.d.ts +1 -0
  72. package/dist/utils/scroll/isScrollToEnd.js +4 -0
  73. package/dist/utils/setBoldTextParts.d.ts +1 -0
  74. package/dist/utils/setBoldTextParts.js +7 -0
  75. package/package.json +69 -69
@@ -1,26 +1,26 @@
1
- import o from "axios";
2
- const h = async (e, t, a, c, n) => {
1
+ import s from "axios";
2
+ const p = async (o, e, n, c, t) => {
3
3
  try {
4
4
  const r = {
5
- orderFormId: e,
6
- skuId: a,
5
+ orderFormId: o,
6
+ skuId: n,
7
7
  substitutionId: c
8
8
  };
9
- if (t) {
10
- const { data: s } = await o.post(
9
+ if (e) {
10
+ const { data: d } = await s.post(
11
11
  "/_v/commerce/orderform/changeOrder",
12
12
  r
13
13
  );
14
- return s;
14
+ return d;
15
15
  }
16
- const { data: d } = await o.post(`https://${n}.myvtex.com/_v/commerce/orderform/changeOrder`, {
17
- body: r
16
+ const a = t && await t({
17
+ input: r
18
18
  });
19
- return d;
19
+ return a ? JSON.parse(a == null ? void 0 : a.postChangeOrder.data) : void 0;
20
20
  } catch (r) {
21
21
  console.error("Error in Change Order Modal", r);
22
22
  }
23
23
  };
24
24
  export {
25
- h as postChangeOrder
25
+ p as postChangeOrder
26
26
  };
@@ -12,6 +12,9 @@ interface CouponsProps {
12
12
  disableFirstEmptyModal?: boolean;
13
13
  couponsList?: CouponType[];
14
14
  qtdCouponsView?: number;
15
+ getCouponsMutation?: any;
16
+ addCouponMutation?: any;
17
+ removeCouponMutation?: any;
15
18
  }
16
- export declare const Coupons: ({ orderFormId, hasItemsInCart, builder, account, isIO, closeIOModal, activeOrderFormCoupon, genericTaggingEvent, disableFirstEmptyModal, couponsList, qtdCouponsView }: CouponsProps) => import("react/jsx-runtime").JSX.Element;
19
+ export declare const Coupons: ({ orderFormId, hasItemsInCart, builder, account, isIO, closeIOModal, activeOrderFormCoupon, genericTaggingEvent, disableFirstEmptyModal, couponsList, qtdCouponsView, getCouponsMutation, addCouponMutation, removeCouponMutation }: CouponsProps) => import("react/jsx-runtime").JSX.Element;
17
20
  export {};
@@ -1,103 +1,113 @@
1
- import { jsx as t, jsxs as B } from "react/jsx-runtime";
2
- import { useState as e, useEffect as S } from "react";
3
- import { getCoupons as E } from "./api/getCoupons.js";
4
- import { LoadingView as G } from "./views/LoadingView.js";
5
- import { CouponsView as H } from "./views/CouponsView.js";
6
- import { RulesView as K } from "./views/RulesView.js";
7
- import { OverwriteView as P } from "./views/OverwriteView.js";
8
- import { EmptyCartView as Q } from "./views/EmptyCartView.js";
9
- /* empty css */const I = ({
10
- orderFormId: h,
11
- hasItemsInCart: a,
12
- builder: j,
13
- account: f,
1
+ import { jsx as t, jsxs as P } from "react/jsx-runtime";
2
+ import { useState as e, useEffect as j } 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 eo = ({
10
+ orderFormId: A,
11
+ hasItemsInCart: f,
12
+ builder: l,
13
+ account: w,
14
14
  isIO: o = !1,
15
15
  closeIOModal: r,
16
16
  activeOrderFormCoupon: n,
17
17
  genericTaggingEvent: s,
18
- disableFirstEmptyModal: A,
19
- couponsList: l,
20
- qtdCouponsView: w
18
+ disableFirstEmptyModal: J,
19
+ couponsList: p,
20
+ qtdCouponsView: C,
21
+ getCouponsMutation: q,
22
+ addCouponMutation: D,
23
+ removeCouponMutation: L
21
24
  }) => {
22
- const [L, C] = e(!0), [q, p] = e([]), [u, c] = e("coupons-view"), [D, y] = e(!1), [N, d] = e(!1), [v, R] = e(""), [m, V] = e(""), [J, x] = e(
23
- !A
24
- ), [b, k] = e();
25
- return S(() => {
26
- n && R(n);
27
- }, [n]), S(() => {
25
+ const [k, N] = e(!0), [z, a] = e([]), [u, c] = e("coupons-view"), [B, d] = e(!1), [y, v] = e(!1), [R, V] = e(""), [m, S] = e(""), [E, x] = e(
26
+ !J
27
+ ), [G, H] = e();
28
+ return j(() => {
29
+ n && V(n);
30
+ }, [n]), j(() => {
28
31
  (async () => {
29
- C(!0);
32
+ N(!0);
30
33
  try {
31
- const i = await E(f, j, l);
32
- if (w) {
33
- const z = i.slice(0, w);
34
- p(z);
34
+ const i = o ? await Z(w, l, p) : await q({
35
+ input: {
36
+ builder: l,
37
+ couponsList: p
38
+ }
39
+ }), h = o ? i : JSON.parse(i.getCoupons.data).coupons;
40
+ if (C) {
41
+ const K = h.slice(0, C);
42
+ a(K);
35
43
  return;
36
44
  }
37
- p(i);
45
+ a(h);
38
46
  return;
39
47
  } catch (i) {
40
- p([]);
48
+ a([]);
41
49
  } finally {
42
- C(!1);
50
+ N(!1);
43
51
  }
44
52
  })();
45
- }, [JSON.stringify(l)]), L ? /* @__PURE__ */ t("div", { className: "coupons-container", children: /* @__PURE__ */ t(
46
- G,
53
+ }, [JSON.stringify(p)]), k ? /* @__PURE__ */ t("div", { className: "coupons-container", children: /* @__PURE__ */ t(
54
+ Q,
47
55
  {
48
56
  isIO: o,
49
57
  closeIOModal: r,
50
58
  genericTaggingEvent: s
51
59
  }
52
- ) }) : /* @__PURE__ */ B("div", { className: "coupons-container", children: [
60
+ ) }) : /* @__PURE__ */ P("div", { className: "coupons-container", children: [
53
61
  (!o || o && u === "coupons-view") && /* @__PURE__ */ t(
54
- H,
62
+ U,
55
63
  {
56
- orderFormId: h,
57
- hasItemsInCart: a,
58
- account: f,
64
+ removeCouponMutation: L,
65
+ addCouponMutation: D,
66
+ orderFormId: A,
67
+ hasItemsInCart: f,
68
+ account: w,
59
69
  isIO: o,
60
70
  closeIOModal: r,
61
- coupons: q,
62
- firstCouponName: v,
71
+ coupons: z,
72
+ firstCouponName: R,
63
73
  secondCouponName: m,
64
- replaceCoupon: N,
74
+ replaceCoupon: y,
65
75
  setView: c,
66
- setFirstCouponName: R,
67
- setSecondCouponName: V,
68
- setActiveRule: y,
69
- setDataItem: k,
70
- setReplaceCoupon: d,
76
+ setFirstCouponName: V,
77
+ setSecondCouponName: S,
78
+ setActiveRule: d,
79
+ setDataItem: H,
80
+ setReplaceCoupon: v,
71
81
  setIsCloseModalEmpty: x,
72
82
  genericTaggingEvent: s
73
83
  }
74
84
  ),
75
- (!o || o && u === "rules-view") && D && /* @__PURE__ */ t(
76
- K,
85
+ (!o || o && u === "rules-view") && B && /* @__PURE__ */ t(
86
+ W,
77
87
  {
78
- dataItem: b,
79
- setActiveRule: y,
88
+ dataItem: G,
89
+ setActiveRule: d,
80
90
  setView: c,
81
91
  isIO: o,
82
92
  closeIOModal: r,
83
93
  genericTaggingEvent: s
84
94
  }
85
95
  ),
86
- (!o || o && u === "overwrite-view") && m && !N && /* @__PURE__ */ t(
87
- P,
96
+ (!o || o && u === "overwrite-view") && m && !y && /* @__PURE__ */ t(
97
+ X,
88
98
  {
89
- firstCouponName: v,
99
+ firstCouponName: R,
90
100
  secondCouponName: m,
91
101
  setView: c,
92
- setReplaceCoupon: d,
93
- setSecondCouponName: V,
102
+ setReplaceCoupon: v,
103
+ setSecondCouponName: S,
94
104
  isIO: o,
95
105
  closeIOModal: r,
96
106
  genericTaggingEvent: s
97
107
  }
98
108
  ),
99
- !a && J && /* @__PURE__ */ t(
100
- Q,
109
+ !f && E && /* @__PURE__ */ t(
110
+ Y,
101
111
  {
102
112
  setIsCloseModalEmpty: x,
103
113
  genericTaggingEvent: s
@@ -106,5 +116,5 @@ import { EmptyCartView as Q } from "./views/EmptyCartView.js";
106
116
  ] });
107
117
  };
108
118
  export {
109
- I as Coupons
119
+ eo as Coupons
110
120
  };
@@ -1,14 +1,14 @@
1
- import s from "axios";
2
- const n = async (o, t, a) => {
3
- const { data: r } = await s.post(
4
- `https://${o}.myvtex.com/_v/faststoreapi/coupon/order`,
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
5
  {
6
6
  orderFormId: t,
7
7
  couponId: a
8
8
  }
9
9
  );
10
- return r;
10
+ return p;
11
11
  };
12
12
  export {
13
- n as addCoupon
13
+ s as addCoupon
14
14
  };
@@ -1,8 +1,8 @@
1
- import a from "axios";
2
- const m = async (s, n, t) => {
3
- const o = `https://${s}.myvtex.com/_v/faststoreapi/coupon/list`, r = Math.random(), { data: p } = t ? await a.post(o, { couponsList: t }) : await a.get(o, { params: { builder: n, random: r } });
4
- return p.coupons;
1
+ import o from "axios";
2
+ const e = async (n, p, t) => {
3
+ const a = `https://${n}.vtex.app/api/coupon/list`, s = Math.random(), { data: r } = t ? await o.post(a, { couponsList: t }) : await o.get(a, { params: { builder: p, random: s } });
4
+ return r.coupons;
5
5
  };
6
6
  export {
7
- m as getCoupons
7
+ e as getCoupons
8
8
  };
@@ -21,5 +21,7 @@ export interface CouponCardProps {
21
21
  setType: (type: AlertType) => void;
22
22
  setIsCloseModalEmpty: (isCloseModalEmpty: boolean) => void;
23
23
  genericTaggingEvent?: (name: string, params: object) => void;
24
+ addCouponMutation?: any;
25
+ removeCouponMutation?: any;
24
26
  }
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;
27
+ export declare const CouponCard: ({ account, 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,132 +1,143 @@
1
- import { jsxs as u, jsx as s } from "react/jsx-runtime";
2
- import { useState as z, useEffect as q } from "react";
3
- import { addCoupon as B } from "../api/addCoupon.js";
4
- import { removeCoupon as G } from "../api/removeCoupon.js";
1
+ import { jsxs as p, jsx as c } from "react/jsx-runtime";
2
+ import { useState as z, useEffect as B } from "react";
3
+ import { addCoupon as G } from "../api/addCoupon.js";
5
4
  import { CouponIcon as H } from "../../../assets/svgs/CouponIcon.js";
6
- import { SuccessIcon as J } from "../../../assets/svgs/SuccessIcon.js";
7
- const X = ({
8
- account: _,
9
- orderFormId: x,
10
- hasItemsInCart: D,
11
- isIO: j = !1,
12
- item: l,
13
- firstCouponName: c,
5
+ import { SuccessIcon as K } from "../../../assets/svgs/SuccessIcon.js";
6
+ import { removeCoupon as P } from "../api/removeCoupon.js";
7
+ const C = ({
8
+ account: D,
9
+ orderFormId: t,
10
+ hasItemsInCart: R,
11
+ isIO: r = !1,
12
+ item: a,
13
+ firstCouponName: s,
14
14
  secondCouponName: d,
15
- replaceCoupon: f,
16
- setView: y,
17
- setActiveRule: N,
18
- setDataItem: i,
19
- setFirstCouponName: t,
20
- setSecondCouponName: w,
21
- setReplaceCoupon: k,
22
- setAlert: m,
23
- setType: p,
24
- setIsCloseModalEmpty: A,
25
- genericTaggingEvent: o
15
+ replaceCoupon: b,
16
+ setView: j,
17
+ setActiveRule: J,
18
+ setDataItem: S,
19
+ setFirstCouponName: L,
20
+ setSecondCouponName: _,
21
+ setReplaceCoupon: y,
22
+ setAlert: f,
23
+ setType: m,
24
+ setIsCloseModalEmpty: k,
25
+ genericTaggingEvent: o,
26
+ addCouponMutation: i,
27
+ removeCouponMutation: M
26
28
  }) => {
27
- const [b, r] = z(!1), [R, h] = z(!1);
28
- q(() => {
29
- d.toLowerCase() !== l.couponName.toLowerCase() && r(!1), c && !d && c.toLowerCase() === l.couponName.toLowerCase() && r(!0), c && d && f && d.toLowerCase() === l.couponName.toLowerCase() && V(d);
30
- }, [c, d, f]);
31
- const V = async (a) => {
32
- if (D)
29
+ const [x, u] = z(!1), [A, w] = z(!1);
30
+ B(() => {
31
+ d.toLowerCase() !== a.couponName.toLowerCase() && u(!1), s && !d && s.toLowerCase() === a.couponName.toLowerCase() && u(!0), s && d && b && d.toLowerCase() === a.couponName.toLowerCase() && N(d);
32
+ }, [s, d, b]);
33
+ const N = async (l) => {
34
+ if (R)
33
35
  try {
34
- if (!c || c && f) {
35
- h(!0);
36
- const L = await B(_, x, a);
37
- k(!1), t(a), w(""), L.error.length <= 0 ? (o == null || o("discount_coupon", {
36
+ if (!s || s && b) {
37
+ w(!0);
38
+ const h = r ? await G(D, t, l) : await i({
39
+ input: {
40
+ orderFormId: t,
41
+ couponId: l
42
+ }
43
+ }), V = r ? h : JSON.parse(h.addCoupon.data);
44
+ y(!1), L(l), _(""), V.error.length <= 0 ? (o == null || o("discount_coupon", {
38
45
  name: "cupom aplicado",
39
- cupomName: a
40
- }), p("success"), r(!0), j && window.location.reload()) : (o == null || o("discount_coupon", {
46
+ cupomName: l
47
+ }), m("success"), u(!0), r && window.location.reload()) : (o == null || o("discount_coupon", {
41
48
  name: "cupom aplicando - cupom incorreto ou expirado",
42
- cupomName: a,
43
- objectError: L.error
44
- }), p("error"), r(!1), t("")), m(!0);
49
+ cupomName: l,
50
+ objectError: V.error
51
+ }), m("error"), u(!1), L("")), f(!0);
45
52
  } else
46
- w(a), y("overwrite-view");
47
- } catch (L) {
53
+ _(l), j("overwrite-view");
54
+ } catch (h) {
48
55
  o == null || o("discount_coupon", {
49
56
  name: "problema na api",
50
- cupomName: a
51
- }), r(!1), p("error"), m(!0);
57
+ cupomName: l
58
+ }), u(!1), m("error"), f(!0);
52
59
  } finally {
53
- h(!1);
60
+ w(!1);
54
61
  }
55
62
  else
56
63
  o == null || o("discount_coupon", {
57
64
  name: "Modal de cart vazio acionado"
58
- }), A(!0);
59
- }, M = async () => {
60
- if (D)
65
+ }), k(!0);
66
+ }, $ = async () => {
67
+ if (R)
61
68
  try {
62
- h(!0), k(!1);
63
- const a = await G(_, x);
64
- a.error.length <= 0 ? (o == null || o("discount_coupon", {
69
+ w(!0), y(!1);
70
+ const l = r ? await P(D, t) : await M({
71
+ input: {
72
+ orderFormId: t
73
+ }
74
+ }), h = r ? l : JSON.parse(l.removeCoupon.data);
75
+ h.error.length <= 0 ? (o == null || o("discount_coupon", {
65
76
  name: "cupom removido com sucesso",
66
- cupomName: c
67
- }), p("removed"), r(!1), t(""), w(""), j && window.location.reload()) : (o == null || o("discount_coupon", {
77
+ cupomName: s
78
+ }), m("removed"), u(!1), L(""), _(""), r && window.location.reload()) : (o == null || o("discount_coupon", {
68
79
  name: "algum problema na remoção do cupom",
69
- cupomName: c,
70
- objectError: a.error
71
- }), p("error"), r(!0)), m(!0);
72
- } catch (a) {
80
+ cupomName: s,
81
+ objectError: h.error
82
+ }), m("error"), u(!0)), f(!0);
83
+ } catch (l) {
73
84
  o == null || o("discount_coupon", {
74
85
  name: "problema na api - na remoção do cupom",
75
- cupomName: c
76
- }), p("error"), r(!0), m(!0);
86
+ cupomName: s
87
+ }), m("error"), u(!0), f(!0);
77
88
  } finally {
78
- h(!1);
89
+ w(!1);
79
90
  }
80
91
  else
81
92
  o == null || o("discount_coupon", {
82
93
  name: "Modal de cart vazio acionado"
83
- }), A(!0);
84
- }, $ = () => {
85
- N(!0), i(l), y("rules-view");
94
+ }), k(!0);
95
+ }, q = () => {
96
+ J(!0), S(a), j("rules-view");
86
97
  };
87
- return /* @__PURE__ */ u("div", { className: `container-card-coupon ${b ? "active" : ""}`, children: [
88
- /* @__PURE__ */ u("div", { className: "text-container", children: [
89
- /* @__PURE__ */ u("div", { className: "container-title", children: [
90
- /* @__PURE__ */ s(H, { width: 20, height: 16 }),
91
- /* @__PURE__ */ s("h3", { className: "title", children: l.couponName })
98
+ return /* @__PURE__ */ p("div", { className: `container-card-coupon ${x ? "active" : ""}`, children: [
99
+ /* @__PURE__ */ p("div", { className: "text-container", children: [
100
+ /* @__PURE__ */ p("div", { className: "container-title", children: [
101
+ /* @__PURE__ */ c(H, { width: 20, height: 16 }),
102
+ /* @__PURE__ */ c("h3", { className: "title", children: a.couponName })
92
103
  ] }),
93
- l.couponValue && /* @__PURE__ */ u("p", { className: "price-badge", children: [
104
+ a.couponValue && /* @__PURE__ */ p("p", { className: "price-badge", children: [
94
105
  "- ",
95
- l.couponValue
106
+ a.couponValue
96
107
  ] }),
97
- l.couponDescription && /* @__PURE__ */ s("h4", { className: "subtitle", children: l.couponDescription }),
98
- l.couponExpirationDate && /* @__PURE__ */ u("h4", { className: "subtitle", children: [
108
+ a.couponDescription && /* @__PURE__ */ c("h4", { className: "subtitle", children: a.couponDescription }),
109
+ a.couponExpirationDate && /* @__PURE__ */ p("h4", { className: "subtitle", children: [
99
110
  "Válido até ",
100
- l.couponExpirationDate
111
+ a.couponExpirationDate
101
112
  ] })
102
113
  ] }),
103
- /* @__PURE__ */ s("div", { className: "vertical-line" }),
104
- /* @__PURE__ */ u("div", { className: "buttons-container", children: [
105
- b && /* @__PURE__ */ u("button", { className: "applied-coupon", children: [
106
- /* @__PURE__ */ s("span", { className: "applied-coupon-span", children: /* @__PURE__ */ s(J, {}) }),
114
+ /* @__PURE__ */ c("div", { className: "vertical-line" }),
115
+ /* @__PURE__ */ p("div", { className: "buttons-container", children: [
116
+ x && /* @__PURE__ */ p("button", { className: "applied-coupon", children: [
117
+ /* @__PURE__ */ c("span", { className: "applied-coupon-span", children: /* @__PURE__ */ c(K, {}) }),
107
118
  "Aplicado"
108
119
  ] }),
109
- b ? /* @__PURE__ */ s(
120
+ x ? /* @__PURE__ */ c(
110
121
  "button",
111
122
  {
112
- onClick: M,
123
+ onClick: $,
113
124
  className: "remove-coupon",
114
- disabled: R,
125
+ disabled: A,
115
126
  children: "Remover"
116
127
  }
117
- ) : /* @__PURE__ */ s(
128
+ ) : /* @__PURE__ */ c(
118
129
  "button",
119
130
  {
120
- onClick: () => V(l.couponName),
131
+ onClick: () => N(a.couponName),
121
132
  className: "apply-coupon",
122
- disabled: R,
133
+ disabled: A,
123
134
  children: "Aplicar"
124
135
  }
125
136
  ),
126
- l.couponDescription && /* @__PURE__ */ s("a", { onClick: $, children: "Ver Regras" })
137
+ a.couponDescription && /* @__PURE__ */ c("a", { onClick: q, children: "Ver Regras" })
127
138
  ] })
128
139
  ] });
129
140
  };
130
141
  export {
131
- X as CouponCard
142
+ C as CouponCard
132
143
  };
@@ -8,6 +8,8 @@ interface CouponsViewProps extends Omit<CouponCardProps, OmittedProps> {
8
8
  hasItemsInCart: boolean;
9
9
  closeIOModal?: () => void;
10
10
  coupons: CouponType[];
11
+ addCouponMutation?: any;
12
+ removeCouponMutation?: any;
11
13
  }
12
- export declare const CouponsView: ({ account, orderFormId, hasItemsInCart, isIO, closeIOModal, coupons, firstCouponName, secondCouponName, replaceCoupon, setView, setActiveRule, setDataItem, setFirstCouponName, setSecondCouponName, setReplaceCoupon, setIsCloseModalEmpty, genericTaggingEvent }: CouponsViewProps) => import("react/jsx-runtime").JSX.Element;
14
+ export declare const CouponsView: ({ addCouponMutation, removeCouponMutation, account, orderFormId, hasItemsInCart, isIO, closeIOModal, coupons, firstCouponName, secondCouponName, replaceCoupon, setView, setActiveRule, setDataItem, setFirstCouponName, setSecondCouponName, setReplaceCoupon, setIsCloseModalEmpty, genericTaggingEvent }: CouponsViewProps) => import("react/jsx-runtime").JSX.Element;
13
15
  export {};