@plurix/ecom-components 1.14.1-COM-1442.2 → 1.14.1-bugfix-1891.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.
- package/dist/node_modules/@faststore/components/dist/esm/atoms/Button/Button.js +45 -0
- package/dist/node_modules/@faststore/components/dist/esm/atoms/Loader/Loader.js +34 -0
- package/dist/node_modules/@faststore/components/dist/esm/molecules/IconButton/IconButton.js +29 -0
- package/dist/packages/Carousel/Carousel.js +1 -1
- package/dist/packages/CartClubAlert/CartClubAlert.js +1 -1
- package/dist/packages/ChangeOrderModal/ChangeOrderModal.d.ts +1 -12
- package/dist/packages/ChangeOrderModal/ChangeOrderModal.js +67 -78
- package/dist/packages/ChangeOrderModal/api/getOrderForm.js +15 -6
- package/dist/packages/ChangeOrderModal/api/getProductsSimilars.d.ts +4 -7
- package/dist/packages/ChangeOrderModal/api/getProductsSimilars.js +21 -22
- package/dist/packages/ChangeOrderModal/api/postChangeOrder.d.ts +1 -6
- package/dist/packages/ChangeOrderModal/api/postChangeOrder.js +17 -11
- package/dist/packages/Coupons/Coupons.d.ts +1 -4
- package/dist/packages/Coupons/Coupons.js +57 -67
- package/dist/packages/Coupons/components/CouponCard.d.ts +1 -3
- package/dist/packages/Coupons/components/CouponCard.js +83 -94
- package/dist/packages/Coupons/views/CouponsView.d.ts +1 -3
- package/dist/packages/Coupons/views/CouponsView.js +78 -87
- package/dist/packages/Coupons/views/LoadingView.js +6 -6
- package/dist/packages/Modal/Modal.js +1 -1
- package/dist/packages/Onboarding/Onboarding.js +1 -1
- package/dist/packages/ProductCard/ProductCardBadge/ProductCardBadgeKg.js +10 -13
- package/dist/packages/ProductCard/ProductCardBadge/ProductCardDiscountBadge.d.ts +2 -3
- package/dist/packages/ProductCard/ProductCardBadge/ProductCardDiscountBadge.js +31 -15
- package/dist/packages/ProductCard/ProductCardButton/AddToCartButton.js +1 -1
- package/dist/packages/ProductCard/ProductCardButton/CustomQuantitySelector/index.d.ts +2 -17
- package/dist/packages/ProductCard/ProductCardButton/CustomQuantitySelector/index.js +1 -1
- package/dist/packages/ProductCard/ProductCardButton/QuantitySelector.js +6 -6
- package/dist/packages/ProductCard/ProductCardHorizontal/index.js +30 -31
- package/dist/packages/ProductCard/ProductCardPrice/index.d.ts +1 -8
- package/dist/packages/ProductCard/ProductCardPrice/index.js +31 -27
- package/dist/packages/ProductCard/ProductCardVertical/index.js +15 -16
- package/dist/packages/ProductCard/index.js +1 -1
- package/dist/packages/ProductCardSeeMore/ProductCardSeeMore.js +1 -1
- package/dist/packages/Regionalization/Regionalization.d.ts +1 -1
- package/dist/packages/Regionalization/Regionalization.js +13 -15
- package/dist/packages/Regionalization/context/RegionalizationContext.d.ts +1 -1
- package/dist/packages/Regionalization/context/RegionalizationContext.js +29 -31
- package/dist/packages/Regionalization/types/RegionalizationProps.d.ts +0 -1
- package/dist/packages/Regionalization/views/AllStoresScreen.js +21 -21
- package/dist/packages/Regionalization/views/InitialView.js +26 -24
- package/dist/packages/Tour/Tour.js +1 -1
- package/dist/styles/product-card.global.css +1 -1
- package/dist/styles/regionalization.global.css +1 -1
- package/dist/types/ProductCard.d.ts +12 -13
- package/dist/utils/changerOrderModal.js +16 -13
- package/package.json +71 -69
- package/dist/packages/ProductCard/ProductCardButton/CustomQuantitySelector/Button.d.ts +0 -18
- package/dist/packages/ProductCard/ProductCardButton/CustomQuantitySelector/Button.js +0 -80
- package/dist/packages/ProductCard/ProductCardButton/CustomQuantitySelector/IconButton.d.ts +0 -10
- package/dist/packages/ProductCard/ProductCardButton/CustomQuantitySelector/IconButton.js +0 -61
- package/dist/packages/ProductCard/ProductCardButton/CustomQuantitySelector/Loader.d.ts +0 -8
- package/dist/packages/ProductCard/ProductCardButton/CustomQuantitySelector/Loader.js +0 -44
|
@@ -1,113 +1,103 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { useState as e, useEffect as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
/* empty css
|
|
10
|
-
orderFormId:
|
|
11
|
-
hasItemsInCart:
|
|
12
|
-
builder:
|
|
13
|
-
account:
|
|
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,
|
|
14
14
|
isIO: o = !1,
|
|
15
15
|
closeIOModal: r,
|
|
16
16
|
activeOrderFormCoupon: n,
|
|
17
17
|
genericTaggingEvent: s,
|
|
18
|
-
disableFirstEmptyModal:
|
|
19
|
-
couponsList:
|
|
20
|
-
qtdCouponsView:
|
|
21
|
-
getCouponsMutation: q,
|
|
22
|
-
addCouponMutation: D,
|
|
23
|
-
removeCouponMutation: L
|
|
18
|
+
disableFirstEmptyModal: A,
|
|
19
|
+
couponsList: l,
|
|
20
|
+
qtdCouponsView: w
|
|
24
21
|
}) => {
|
|
25
|
-
const [
|
|
26
|
-
!
|
|
27
|
-
), [
|
|
28
|
-
return
|
|
29
|
-
n &&
|
|
30
|
-
}, [n]),
|
|
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(() => {
|
|
31
28
|
(async () => {
|
|
32
|
-
|
|
29
|
+
C(!0);
|
|
33
30
|
try {
|
|
34
|
-
const i =
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
}), h = o ? i : JSON.parse(i.getCoupons.data).coupons;
|
|
40
|
-
if (C) {
|
|
41
|
-
const K = h.slice(0, C);
|
|
42
|
-
a(K);
|
|
31
|
+
const i = await E(f, j, l);
|
|
32
|
+
if (w) {
|
|
33
|
+
const z = i.slice(0, w);
|
|
34
|
+
p(z);
|
|
43
35
|
return;
|
|
44
36
|
}
|
|
45
|
-
|
|
37
|
+
p(i);
|
|
46
38
|
return;
|
|
47
39
|
} catch (i) {
|
|
48
|
-
|
|
40
|
+
p([]);
|
|
49
41
|
} finally {
|
|
50
|
-
|
|
42
|
+
C(!1);
|
|
51
43
|
}
|
|
52
44
|
})();
|
|
53
|
-
}, [JSON.stringify(
|
|
54
|
-
|
|
45
|
+
}, [JSON.stringify(l)]), L ? /* @__PURE__ */ t("div", { className: "coupons-container", children: /* @__PURE__ */ t(
|
|
46
|
+
G,
|
|
55
47
|
{
|
|
56
48
|
isIO: o,
|
|
57
49
|
closeIOModal: r,
|
|
58
50
|
genericTaggingEvent: s
|
|
59
51
|
}
|
|
60
|
-
) }) : /* @__PURE__ */
|
|
52
|
+
) }) : /* @__PURE__ */ B("div", { className: "coupons-container", children: [
|
|
61
53
|
(!o || o && u === "coupons-view") && /* @__PURE__ */ t(
|
|
62
|
-
|
|
54
|
+
H,
|
|
63
55
|
{
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
hasItemsInCart: f,
|
|
68
|
-
account: w,
|
|
56
|
+
orderFormId: h,
|
|
57
|
+
hasItemsInCart: a,
|
|
58
|
+
account: f,
|
|
69
59
|
isIO: o,
|
|
70
60
|
closeIOModal: r,
|
|
71
|
-
coupons:
|
|
72
|
-
firstCouponName:
|
|
61
|
+
coupons: q,
|
|
62
|
+
firstCouponName: v,
|
|
73
63
|
secondCouponName: m,
|
|
74
|
-
replaceCoupon:
|
|
64
|
+
replaceCoupon: N,
|
|
75
65
|
setView: c,
|
|
76
|
-
setFirstCouponName:
|
|
77
|
-
setSecondCouponName:
|
|
78
|
-
setActiveRule:
|
|
79
|
-
setDataItem:
|
|
80
|
-
setReplaceCoupon:
|
|
66
|
+
setFirstCouponName: R,
|
|
67
|
+
setSecondCouponName: V,
|
|
68
|
+
setActiveRule: y,
|
|
69
|
+
setDataItem: k,
|
|
70
|
+
setReplaceCoupon: d,
|
|
81
71
|
setIsCloseModalEmpty: x,
|
|
82
72
|
genericTaggingEvent: s
|
|
83
73
|
}
|
|
84
74
|
),
|
|
85
|
-
(!o || o && u === "rules-view") &&
|
|
86
|
-
|
|
75
|
+
(!o || o && u === "rules-view") && D && /* @__PURE__ */ t(
|
|
76
|
+
K,
|
|
87
77
|
{
|
|
88
|
-
dataItem:
|
|
89
|
-
setActiveRule:
|
|
78
|
+
dataItem: b,
|
|
79
|
+
setActiveRule: y,
|
|
90
80
|
setView: c,
|
|
91
81
|
isIO: o,
|
|
92
82
|
closeIOModal: r,
|
|
93
83
|
genericTaggingEvent: s
|
|
94
84
|
}
|
|
95
85
|
),
|
|
96
|
-
(!o || o && u === "overwrite-view") && m && !
|
|
97
|
-
|
|
86
|
+
(!o || o && u === "overwrite-view") && m && !N && /* @__PURE__ */ t(
|
|
87
|
+
P,
|
|
98
88
|
{
|
|
99
|
-
firstCouponName:
|
|
89
|
+
firstCouponName: v,
|
|
100
90
|
secondCouponName: m,
|
|
101
91
|
setView: c,
|
|
102
|
-
setReplaceCoupon:
|
|
103
|
-
setSecondCouponName:
|
|
92
|
+
setReplaceCoupon: d,
|
|
93
|
+
setSecondCouponName: V,
|
|
104
94
|
isIO: o,
|
|
105
95
|
closeIOModal: r,
|
|
106
96
|
genericTaggingEvent: s
|
|
107
97
|
}
|
|
108
98
|
),
|
|
109
|
-
!
|
|
110
|
-
|
|
99
|
+
!a && J && /* @__PURE__ */ t(
|
|
100
|
+
Q,
|
|
111
101
|
{
|
|
112
102
|
setIsCloseModalEmpty: x,
|
|
113
103
|
genericTaggingEvent: s
|
|
@@ -116,5 +106,5 @@ import { getCoupons as Z } from "./api/getCoupons.js";
|
|
|
116
106
|
] });
|
|
117
107
|
};
|
|
118
108
|
export {
|
|
119
|
-
|
|
109
|
+
I as Coupons
|
|
120
110
|
};
|
|
@@ -21,7 +21,5 @@ 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;
|
|
26
24
|
}
|
|
27
|
-
export declare const CouponCard: ({ account, orderFormId, hasItemsInCart, isIO, item, firstCouponName, secondCouponName, replaceCoupon, setView, setActiveRule, setDataItem, setFirstCouponName, setSecondCouponName, setReplaceCoupon, setAlert, setType, setIsCloseModalEmpty, genericTaggingEvent
|
|
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;
|
|
@@ -1,143 +1,132 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as z, useEffect as
|
|
3
|
-
import { addCoupon as
|
|
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";
|
|
4
5
|
import { CouponIcon as H } from "../../../assets/svgs/CouponIcon.js";
|
|
5
|
-
import { SuccessIcon as
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
firstCouponName: s,
|
|
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,
|
|
14
14
|
secondCouponName: d,
|
|
15
|
-
replaceCoupon:
|
|
16
|
-
setView:
|
|
17
|
-
setActiveRule:
|
|
18
|
-
setDataItem:
|
|
19
|
-
setFirstCouponName:
|
|
20
|
-
setSecondCouponName:
|
|
21
|
-
setReplaceCoupon:
|
|
22
|
-
setAlert:
|
|
23
|
-
setType:
|
|
24
|
-
setIsCloseModalEmpty:
|
|
25
|
-
genericTaggingEvent: o
|
|
26
|
-
addCouponMutation: i,
|
|
27
|
-
removeCouponMutation: M
|
|
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
|
|
28
26
|
}) => {
|
|
29
|
-
const [
|
|
30
|
-
|
|
31
|
-
d.toLowerCase() !==
|
|
32
|
-
}, [
|
|
33
|
-
const
|
|
34
|
-
if (
|
|
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)
|
|
35
33
|
try {
|
|
36
|
-
if (!
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
|
|
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", {
|
|
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", {
|
|
45
38
|
name: "cupom aplicado",
|
|
46
|
-
cupomName:
|
|
47
|
-
}),
|
|
39
|
+
cupomName: a
|
|
40
|
+
}), p("success"), r(!0), j && window.location.reload()) : (o == null || o("discount_coupon", {
|
|
48
41
|
name: "cupom aplicando - cupom incorreto ou expirado",
|
|
49
|
-
cupomName:
|
|
50
|
-
objectError:
|
|
51
|
-
}),
|
|
42
|
+
cupomName: a,
|
|
43
|
+
objectError: L.error
|
|
44
|
+
}), p("error"), r(!1), t("")), m(!0);
|
|
52
45
|
} else
|
|
53
|
-
|
|
54
|
-
} catch (
|
|
46
|
+
w(a), y("overwrite-view");
|
|
47
|
+
} catch (L) {
|
|
55
48
|
o == null || o("discount_coupon", {
|
|
56
49
|
name: "problema na api",
|
|
57
|
-
cupomName:
|
|
58
|
-
}),
|
|
50
|
+
cupomName: a
|
|
51
|
+
}), r(!1), p("error"), m(!0);
|
|
59
52
|
} finally {
|
|
60
|
-
|
|
53
|
+
h(!1);
|
|
61
54
|
}
|
|
62
55
|
else
|
|
63
56
|
o == null || o("discount_coupon", {
|
|
64
57
|
name: "Modal de cart vazio acionado"
|
|
65
|
-
}),
|
|
66
|
-
},
|
|
67
|
-
if (
|
|
58
|
+
}), A(!0);
|
|
59
|
+
}, M = async () => {
|
|
60
|
+
if (D)
|
|
68
61
|
try {
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
orderFormId: t
|
|
73
|
-
}
|
|
74
|
-
}), h = r ? l : JSON.parse(l.removeCoupon.data);
|
|
75
|
-
h.error.length <= 0 ? (o == null || o("discount_coupon", {
|
|
62
|
+
h(!0), k(!1);
|
|
63
|
+
const a = await G(_, x);
|
|
64
|
+
a.error.length <= 0 ? (o == null || o("discount_coupon", {
|
|
76
65
|
name: "cupom removido com sucesso",
|
|
77
|
-
cupomName:
|
|
78
|
-
}),
|
|
66
|
+
cupomName: c
|
|
67
|
+
}), p("removed"), r(!1), t(""), w(""), j && window.location.reload()) : (o == null || o("discount_coupon", {
|
|
79
68
|
name: "algum problema na remoção do cupom",
|
|
80
|
-
cupomName:
|
|
81
|
-
objectError:
|
|
82
|
-
}),
|
|
83
|
-
} catch (
|
|
69
|
+
cupomName: c,
|
|
70
|
+
objectError: a.error
|
|
71
|
+
}), p("error"), r(!0)), m(!0);
|
|
72
|
+
} catch (a) {
|
|
84
73
|
o == null || o("discount_coupon", {
|
|
85
74
|
name: "problema na api - na remoção do cupom",
|
|
86
|
-
cupomName:
|
|
87
|
-
}),
|
|
75
|
+
cupomName: c
|
|
76
|
+
}), p("error"), r(!0), m(!0);
|
|
88
77
|
} finally {
|
|
89
|
-
|
|
78
|
+
h(!1);
|
|
90
79
|
}
|
|
91
80
|
else
|
|
92
81
|
o == null || o("discount_coupon", {
|
|
93
82
|
name: "Modal de cart vazio acionado"
|
|
94
|
-
}),
|
|
95
|
-
},
|
|
96
|
-
|
|
83
|
+
}), A(!0);
|
|
84
|
+
}, $ = () => {
|
|
85
|
+
N(!0), i(l), y("rules-view");
|
|
97
86
|
};
|
|
98
|
-
return /* @__PURE__ */
|
|
99
|
-
/* @__PURE__ */
|
|
100
|
-
/* @__PURE__ */
|
|
101
|
-
/* @__PURE__ */
|
|
102
|
-
/* @__PURE__ */
|
|
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 })
|
|
103
92
|
] }),
|
|
104
|
-
|
|
93
|
+
l.couponValue && /* @__PURE__ */ u("p", { className: "price-badge", children: [
|
|
105
94
|
"- ",
|
|
106
|
-
|
|
95
|
+
l.couponValue
|
|
107
96
|
] }),
|
|
108
|
-
|
|
109
|
-
|
|
97
|
+
l.couponDescription && /* @__PURE__ */ s("h4", { className: "subtitle", children: l.couponDescription }),
|
|
98
|
+
l.couponExpirationDate && /* @__PURE__ */ u("h4", { className: "subtitle", children: [
|
|
110
99
|
"Válido até ",
|
|
111
|
-
|
|
100
|
+
l.couponExpirationDate
|
|
112
101
|
] })
|
|
113
102
|
] }),
|
|
114
|
-
/* @__PURE__ */
|
|
115
|
-
/* @__PURE__ */
|
|
116
|
-
|
|
117
|
-
/* @__PURE__ */
|
|
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, {}) }),
|
|
118
107
|
"Aplicado"
|
|
119
108
|
] }),
|
|
120
|
-
|
|
109
|
+
b ? /* @__PURE__ */ s(
|
|
121
110
|
"button",
|
|
122
111
|
{
|
|
123
|
-
onClick:
|
|
112
|
+
onClick: M,
|
|
124
113
|
className: "remove-coupon",
|
|
125
|
-
disabled:
|
|
114
|
+
disabled: R,
|
|
126
115
|
children: "Remover"
|
|
127
116
|
}
|
|
128
|
-
) : /* @__PURE__ */
|
|
117
|
+
) : /* @__PURE__ */ s(
|
|
129
118
|
"button",
|
|
130
119
|
{
|
|
131
|
-
onClick: () =>
|
|
120
|
+
onClick: () => V(l.couponName),
|
|
132
121
|
className: "apply-coupon",
|
|
133
|
-
disabled:
|
|
122
|
+
disabled: R,
|
|
134
123
|
children: "Aplicar"
|
|
135
124
|
}
|
|
136
125
|
),
|
|
137
|
-
|
|
126
|
+
l.couponDescription && /* @__PURE__ */ s("a", { onClick: $, children: "Ver Regras" })
|
|
138
127
|
] })
|
|
139
128
|
] });
|
|
140
129
|
};
|
|
141
130
|
export {
|
|
142
|
-
|
|
131
|
+
X as CouponCard
|
|
143
132
|
};
|
|
@@ -8,8 +8,6 @@ interface CouponsViewProps extends Omit<CouponCardProps, OmittedProps> {
|
|
|
8
8
|
hasItemsInCart: boolean;
|
|
9
9
|
closeIOModal?: () => void;
|
|
10
10
|
coupons: CouponType[];
|
|
11
|
-
addCouponMutation?: any;
|
|
12
|
-
removeCouponMutation?: any;
|
|
13
11
|
}
|
|
14
|
-
export declare const CouponsView: ({
|
|
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;
|
|
15
13
|
export {};
|
|
@@ -1,131 +1,122 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
account: x,
|
|
14
|
-
orderFormId: c,
|
|
1
|
+
import { jsxs as e, Fragment as N, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useState as a, useEffect as F } from "react";
|
|
3
|
+
import { addCoupon as G } from "../api/addCoupon.js";
|
|
4
|
+
import { ModalHeader as J } from "../components/ModalHeader.js";
|
|
5
|
+
import { ModalFooter as K } from "../components/ModalFooter.js";
|
|
6
|
+
import { CouponCard as Q } from "../components/CouponCard.js";
|
|
7
|
+
import { NoCoupons as U } from "../components/NoCoupons.js";
|
|
8
|
+
import { Alert as V } from "../components/Alert.js";
|
|
9
|
+
import { InfoIcon as W } from "../../../assets/svgs/InfoIcon.js";
|
|
10
|
+
const E = ({
|
|
11
|
+
account: b,
|
|
12
|
+
orderFormId: x,
|
|
15
13
|
hasItemsInCart: C,
|
|
16
14
|
isIO: p,
|
|
17
|
-
closeIOModal:
|
|
18
|
-
coupons:
|
|
15
|
+
closeIOModal: u,
|
|
16
|
+
coupons: c,
|
|
19
17
|
firstCouponName: i,
|
|
20
|
-
secondCouponName:
|
|
21
|
-
replaceCoupon:
|
|
22
|
-
setView:
|
|
23
|
-
setActiveRule:
|
|
24
|
-
setDataItem:
|
|
18
|
+
secondCouponName: _,
|
|
19
|
+
replaceCoupon: w,
|
|
20
|
+
setView: A,
|
|
21
|
+
setActiveRule: D,
|
|
22
|
+
setDataItem: L,
|
|
25
23
|
setFirstCouponName: m,
|
|
26
|
-
setSecondCouponName:
|
|
27
|
-
setReplaceCoupon:
|
|
28
|
-
setIsCloseModalEmpty:
|
|
29
|
-
genericTaggingEvent:
|
|
24
|
+
setSecondCouponName: n,
|
|
25
|
+
setReplaceCoupon: B,
|
|
26
|
+
setIsCloseModalEmpty: S,
|
|
27
|
+
genericTaggingEvent: r
|
|
30
28
|
}) => {
|
|
31
|
-
const [
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
|
|
29
|
+
const [t, q] = a(""), [H, j] = a(!1), [M, s] = a(""), [f, d] = a(!1), [P, h] = a(!1), k = (l) => {
|
|
30
|
+
l.preventDefault(), q(l.target.value);
|
|
31
|
+
}, z = async (l) => {
|
|
32
|
+
l.preventDefault();
|
|
35
33
|
try {
|
|
36
|
-
if (!i || i &&
|
|
34
|
+
if (!i || i && w) {
|
|
37
35
|
j(!0);
|
|
38
|
-
const
|
|
39
|
-
|
|
40
|
-
orderFormId: c,
|
|
41
|
-
couponId: r
|
|
42
|
-
}
|
|
43
|
-
}), S = p ? b : JSON.parse(b.addCoupon.data);
|
|
44
|
-
N(!1), f(""), S.error.length <= 0 ? (t == null || t("discount_coupon", {
|
|
36
|
+
const y = await G(b, x, t);
|
|
37
|
+
B(!1), n(""), y.error.length <= 0 ? (r == null || r("discount_coupon", {
|
|
45
38
|
name: "Cupom aplicado do input",
|
|
46
|
-
couponName:
|
|
47
|
-
}),
|
|
39
|
+
couponName: t
|
|
40
|
+
}), s("success"), h(!0), m(t), p && window.location.reload()) : (r == null || r("discount_coupon", {
|
|
48
41
|
name: "Cupom do input expirado ou invalido",
|
|
49
|
-
couponName:
|
|
50
|
-
objectError:
|
|
51
|
-
}),
|
|
42
|
+
couponName: t,
|
|
43
|
+
objectError: y.error
|
|
44
|
+
}), s("error"), h(!1), m("")), d(!0);
|
|
52
45
|
} else
|
|
53
|
-
|
|
54
|
-
} catch (
|
|
55
|
-
|
|
46
|
+
n(t), A("overwrite-view");
|
|
47
|
+
} catch (y) {
|
|
48
|
+
r == null || r("discount_coupon", {
|
|
56
49
|
name: "Cupom do input - error na api",
|
|
57
|
-
couponName:
|
|
58
|
-
}),
|
|
50
|
+
couponName: t
|
|
51
|
+
}), s("error"), h(!1), d(!0);
|
|
59
52
|
} finally {
|
|
60
53
|
j(!1);
|
|
61
54
|
}
|
|
62
55
|
};
|
|
63
|
-
return
|
|
64
|
-
|
|
65
|
-
}, [
|
|
66
|
-
p &&
|
|
67
|
-
|
|
56
|
+
return F(() => {
|
|
57
|
+
f && setTimeout(() => d(!1), 5e3);
|
|
58
|
+
}, [P, f]), /* @__PURE__ */ e(N, { children: [
|
|
59
|
+
p && u && /* @__PURE__ */ o(
|
|
60
|
+
J,
|
|
68
61
|
{
|
|
69
|
-
closeModal:
|
|
62
|
+
closeModal: u,
|
|
70
63
|
title: "Meus Cupons",
|
|
71
|
-
genericTaggingEvent:
|
|
64
|
+
genericTaggingEvent: r
|
|
72
65
|
}
|
|
73
66
|
),
|
|
74
|
-
C ? /* @__PURE__ */ o("div", { className: "form-coupons", children: /* @__PURE__ */
|
|
67
|
+
C ? /* @__PURE__ */ o("div", { className: "form-coupons", children: /* @__PURE__ */ e("form", { onSubmit: z, children: [
|
|
75
68
|
/* @__PURE__ */ o(
|
|
76
69
|
"input",
|
|
77
70
|
{
|
|
78
71
|
type: "text",
|
|
79
72
|
placeholder: "Insira o cupom",
|
|
80
|
-
value:
|
|
81
|
-
onChange:
|
|
73
|
+
value: t,
|
|
74
|
+
onChange: k
|
|
82
75
|
}
|
|
83
76
|
),
|
|
84
|
-
/* @__PURE__ */ o("button", { type: "submit", name: "adicionar", disabled:
|
|
85
|
-
] }) }) : /* @__PURE__ */ o("div", { className: "cart-empty-coupons-label", children: /* @__PURE__ */
|
|
86
|
-
/* @__PURE__ */ o("span", { children: /* @__PURE__ */ o(
|
|
77
|
+
/* @__PURE__ */ o("button", { type: "submit", name: "adicionar", disabled: H, children: "Adicionar" })
|
|
78
|
+
] }) }) : /* @__PURE__ */ o("div", { className: "cart-empty-coupons-label", children: /* @__PURE__ */ e("p", { children: [
|
|
79
|
+
/* @__PURE__ */ o("span", { children: /* @__PURE__ */ o(W, {}) }),
|
|
87
80
|
"Para adicionar um cupom é necessário que você adicione pelo menos 1 produto no carrinho"
|
|
88
81
|
] }) }),
|
|
89
|
-
/* @__PURE__ */ o("div", { className: "container-title-coupons", children:
|
|
82
|
+
/* @__PURE__ */ o("div", { className: "container-title-coupons", children: c.length > 0 ? /* @__PURE__ */ e(N, { children: [
|
|
90
83
|
/* @__PURE__ */ o("h2", { children: "Cupons disponíveis" }),
|
|
91
|
-
/* @__PURE__ */ o("div", { className: "container-coupons", children:
|
|
92
|
-
|
|
84
|
+
/* @__PURE__ */ o("div", { className: "container-coupons", children: c.map((l) => /* @__PURE__ */ o(
|
|
85
|
+
Q,
|
|
93
86
|
{
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
account: x,
|
|
97
|
-
orderFormId: c,
|
|
87
|
+
account: b,
|
|
88
|
+
orderFormId: x,
|
|
98
89
|
hasItemsInCart: C,
|
|
99
90
|
isIO: p,
|
|
100
|
-
item:
|
|
91
|
+
item: l,
|
|
101
92
|
firstCouponName: i,
|
|
102
|
-
secondCouponName:
|
|
103
|
-
replaceCoupon:
|
|
104
|
-
setView:
|
|
93
|
+
secondCouponName: _,
|
|
94
|
+
replaceCoupon: w,
|
|
95
|
+
setView: A,
|
|
105
96
|
setFirstCouponName: m,
|
|
106
|
-
setSecondCouponName:
|
|
107
|
-
setActiveRule:
|
|
108
|
-
setDataItem:
|
|
109
|
-
setReplaceCoupon:
|
|
110
|
-
setAlert:
|
|
111
|
-
setType:
|
|
112
|
-
setIsCloseModalEmpty:
|
|
113
|
-
genericTaggingEvent:
|
|
97
|
+
setSecondCouponName: n,
|
|
98
|
+
setActiveRule: D,
|
|
99
|
+
setDataItem: L,
|
|
100
|
+
setReplaceCoupon: B,
|
|
101
|
+
setAlert: d,
|
|
102
|
+
setType: s,
|
|
103
|
+
setIsCloseModalEmpty: S,
|
|
104
|
+
genericTaggingEvent: r
|
|
114
105
|
},
|
|
115
|
-
|
|
106
|
+
l.couponName
|
|
116
107
|
)) })
|
|
117
|
-
] }) : /* @__PURE__ */ o(
|
|
118
|
-
|
|
119
|
-
p &&
|
|
120
|
-
|
|
108
|
+
] }) : /* @__PURE__ */ o(U, {}) }),
|
|
109
|
+
f && /* @__PURE__ */ o(V, { type: M }),
|
|
110
|
+
p && u && /* @__PURE__ */ o(
|
|
111
|
+
K,
|
|
121
112
|
{
|
|
122
|
-
isFloating:
|
|
123
|
-
cancelButtonAction:
|
|
113
|
+
isFloating: c.length > 0,
|
|
114
|
+
cancelButtonAction: u,
|
|
124
115
|
cancelButtonText: "Sair"
|
|
125
116
|
}
|
|
126
117
|
)
|
|
127
118
|
] });
|
|
128
119
|
};
|
|
129
120
|
export {
|
|
130
|
-
|
|
121
|
+
E as CouponsView
|
|
131
122
|
};
|