@plurix/ecom-components 1.14.2-commerce.9 → 1.14.2
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/packages/ChangeOrderModal/ChangeOrderModal.d.ts +12 -1
- package/dist/packages/ChangeOrderModal/ChangeOrderModal.js +78 -67
- package/dist/packages/ChangeOrderModal/api/getOrderForm.js +6 -15
- package/dist/packages/ChangeOrderModal/api/getProductsSimilars.d.ts +7 -4
- package/dist/packages/ChangeOrderModal/api/getProductsSimilars.js +22 -21
- package/dist/packages/ChangeOrderModal/api/postChangeOrder.d.ts +6 -1
- package/dist/packages/ChangeOrderModal/api/postChangeOrder.js +11 -17
- package/dist/packages/Coupons/Coupons.d.ts +4 -1
- package/dist/packages/Coupons/Coupons.js +67 -57
- package/dist/packages/Coupons/api/addCoupon.js +6 -6
- package/dist/packages/Coupons/api/getCoupons.js +5 -5
- package/dist/packages/Coupons/components/CouponCard.d.ts +3 -1
- package/dist/packages/Coupons/components/CouponCard.js +94 -83
- package/dist/packages/Coupons/views/CouponsView.d.ts +3 -1
- package/dist/packages/Coupons/views/CouponsView.js +87 -78
- package/dist/packages/ProductCard/ProductCardBadge/ProductCardBadgeKg.js +13 -10
- package/dist/packages/ProductCard/ProductCardBadge/ProductCardDiscountBadge.d.ts +3 -2
- package/dist/packages/ProductCard/ProductCardBadge/ProductCardDiscountBadge.js +15 -31
- package/dist/packages/ProductCard/ProductCardHorizontal/index.js +31 -30
- package/dist/packages/ProductCard/ProductCardPrice/index.d.ts +8 -1
- package/dist/packages/ProductCard/ProductCardPrice/index.js +27 -31
- package/dist/packages/ProductCard/ProductCardVertical/index.js +16 -15
- package/dist/packages/Regionalization/Regionalization.d.ts +1 -1
- package/dist/packages/Regionalization/Regionalization.js +15 -13
- package/dist/packages/Regionalization/context/RegionalizationContext.d.ts +1 -1
- package/dist/packages/Regionalization/context/RegionalizationContext.js +31 -29
- package/dist/packages/Regionalization/types/RegionalizationProps.d.ts +1 -0
- package/dist/packages/Regionalization/views/AllStoresScreen.js +21 -21
- package/dist/styles/regionalization.global.css +1 -1
- package/dist/types/ProductCard.d.ts +13 -12
- package/dist/utils/changerOrderModal.js +13 -16
- package/package.json +1 -1
|
@@ -1,132 +1,143 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as z, useEffect as
|
|
3
|
-
import { addCoupon as
|
|
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
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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:
|
|
16
|
-
setView:
|
|
17
|
-
setActiveRule:
|
|
18
|
-
setDataItem:
|
|
19
|
-
setFirstCouponName:
|
|
20
|
-
setSecondCouponName:
|
|
21
|
-
setReplaceCoupon:
|
|
22
|
-
setAlert:
|
|
23
|
-
setType:
|
|
24
|
-
setIsCloseModalEmpty:
|
|
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 [
|
|
28
|
-
|
|
29
|
-
d.toLowerCase() !==
|
|
30
|
-
}, [
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
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 (!
|
|
35
|
-
|
|
36
|
-
const
|
|
37
|
-
|
|
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:
|
|
40
|
-
}),
|
|
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:
|
|
43
|
-
objectError:
|
|
44
|
-
}),
|
|
49
|
+
cupomName: l,
|
|
50
|
+
objectError: V.error
|
|
51
|
+
}), m("error"), u(!1), L("")), f(!0);
|
|
45
52
|
} else
|
|
46
|
-
|
|
47
|
-
} catch (
|
|
53
|
+
_(l), j("overwrite-view");
|
|
54
|
+
} catch (h) {
|
|
48
55
|
o == null || o("discount_coupon", {
|
|
49
56
|
name: "problema na api",
|
|
50
|
-
cupomName:
|
|
51
|
-
}),
|
|
57
|
+
cupomName: l
|
|
58
|
+
}), u(!1), m("error"), f(!0);
|
|
52
59
|
} finally {
|
|
53
|
-
|
|
60
|
+
w(!1);
|
|
54
61
|
}
|
|
55
62
|
else
|
|
56
63
|
o == null || o("discount_coupon", {
|
|
57
64
|
name: "Modal de cart vazio acionado"
|
|
58
|
-
}),
|
|
59
|
-
},
|
|
60
|
-
if (
|
|
65
|
+
}), k(!0);
|
|
66
|
+
}, $ = async () => {
|
|
67
|
+
if (R)
|
|
61
68
|
try {
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
|
|
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:
|
|
67
|
-
}),
|
|
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:
|
|
70
|
-
objectError:
|
|
71
|
-
}),
|
|
72
|
-
} catch (
|
|
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:
|
|
76
|
-
}),
|
|
86
|
+
cupomName: s
|
|
87
|
+
}), m("error"), u(!0), f(!0);
|
|
77
88
|
} finally {
|
|
78
|
-
|
|
89
|
+
w(!1);
|
|
79
90
|
}
|
|
80
91
|
else
|
|
81
92
|
o == null || o("discount_coupon", {
|
|
82
93
|
name: "Modal de cart vazio acionado"
|
|
83
|
-
}),
|
|
84
|
-
},
|
|
85
|
-
|
|
94
|
+
}), k(!0);
|
|
95
|
+
}, q = () => {
|
|
96
|
+
J(!0), S(a), j("rules-view");
|
|
86
97
|
};
|
|
87
|
-
return /* @__PURE__ */
|
|
88
|
-
/* @__PURE__ */
|
|
89
|
-
/* @__PURE__ */
|
|
90
|
-
/* @__PURE__ */
|
|
91
|
-
/* @__PURE__ */
|
|
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
|
-
|
|
104
|
+
a.couponValue && /* @__PURE__ */ p("p", { className: "price-badge", children: [
|
|
94
105
|
"- ",
|
|
95
|
-
|
|
106
|
+
a.couponValue
|
|
96
107
|
] }),
|
|
97
|
-
|
|
98
|
-
|
|
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
|
-
|
|
111
|
+
a.couponExpirationDate
|
|
101
112
|
] })
|
|
102
113
|
] }),
|
|
103
|
-
/* @__PURE__ */
|
|
104
|
-
/* @__PURE__ */
|
|
105
|
-
|
|
106
|
-
/* @__PURE__ */
|
|
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
|
-
|
|
120
|
+
x ? /* @__PURE__ */ c(
|
|
110
121
|
"button",
|
|
111
122
|
{
|
|
112
|
-
onClick:
|
|
123
|
+
onClick: $,
|
|
113
124
|
className: "remove-coupon",
|
|
114
|
-
disabled:
|
|
125
|
+
disabled: A,
|
|
115
126
|
children: "Remover"
|
|
116
127
|
}
|
|
117
|
-
) : /* @__PURE__ */
|
|
128
|
+
) : /* @__PURE__ */ c(
|
|
118
129
|
"button",
|
|
119
130
|
{
|
|
120
|
-
onClick: () =>
|
|
131
|
+
onClick: () => N(a.couponName),
|
|
121
132
|
className: "apply-coupon",
|
|
122
|
-
disabled:
|
|
133
|
+
disabled: A,
|
|
123
134
|
children: "Aplicar"
|
|
124
135
|
}
|
|
125
136
|
),
|
|
126
|
-
|
|
137
|
+
a.couponDescription && /* @__PURE__ */ c("a", { onClick: q, children: "Ver Regras" })
|
|
127
138
|
] })
|
|
128
139
|
] });
|
|
129
140
|
};
|
|
130
141
|
export {
|
|
131
|
-
|
|
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 {};
|
|
@@ -1,122 +1,131 @@
|
|
|
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
|
-
|
|
1
|
+
import { jsxs as d, Fragment as _, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { useState as l, useEffect as Q } from "react";
|
|
3
|
+
import { ModalHeader as R } from "../components/ModalHeader.js";
|
|
4
|
+
import { ModalFooter as U } from "../components/ModalFooter.js";
|
|
5
|
+
import { CouponCard as V } from "../components/CouponCard.js";
|
|
6
|
+
import { NoCoupons as W } from "../components/NoCoupons.js";
|
|
7
|
+
import { Alert as X } from "../components/Alert.js";
|
|
8
|
+
import { InfoIcon as Y } from "../../../assets/svgs/InfoIcon.js";
|
|
9
|
+
import { addCoupon as Z } from "../api/addCoupon.js";
|
|
10
|
+
const to = ({
|
|
11
|
+
addCouponMutation: w,
|
|
12
|
+
removeCouponMutation: D,
|
|
13
|
+
account: x,
|
|
14
|
+
orderFormId: c,
|
|
13
15
|
hasItemsInCart: C,
|
|
14
16
|
isIO: p,
|
|
15
|
-
closeIOModal:
|
|
16
|
-
coupons:
|
|
17
|
+
closeIOModal: s,
|
|
18
|
+
coupons: n,
|
|
17
19
|
firstCouponName: i,
|
|
18
|
-
secondCouponName:
|
|
19
|
-
replaceCoupon:
|
|
20
|
-
setView:
|
|
21
|
-
setActiveRule:
|
|
22
|
-
setDataItem:
|
|
20
|
+
secondCouponName: L,
|
|
21
|
+
replaceCoupon: A,
|
|
22
|
+
setView: B,
|
|
23
|
+
setActiveRule: q,
|
|
24
|
+
setDataItem: H,
|
|
23
25
|
setFirstCouponName: m,
|
|
24
|
-
setSecondCouponName:
|
|
25
|
-
setReplaceCoupon:
|
|
26
|
-
setIsCloseModalEmpty:
|
|
27
|
-
genericTaggingEvent:
|
|
26
|
+
setSecondCouponName: f,
|
|
27
|
+
setReplaceCoupon: N,
|
|
28
|
+
setIsCloseModalEmpty: J,
|
|
29
|
+
genericTaggingEvent: t
|
|
28
30
|
}) => {
|
|
29
|
-
const [
|
|
30
|
-
|
|
31
|
-
},
|
|
32
|
-
|
|
31
|
+
const [r, P] = l(""), [k, j] = l(!1), [z, u] = l(""), [h, e] = l(!1), [G, y] = l(!1), K = (a) => {
|
|
32
|
+
a.preventDefault(), P(a.target.value);
|
|
33
|
+
}, M = async (a) => {
|
|
34
|
+
a.preventDefault();
|
|
33
35
|
try {
|
|
34
|
-
if (!i || i &&
|
|
36
|
+
if (!i || i && A) {
|
|
35
37
|
j(!0);
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
+
const b = p ? await Z(x, c, r) : await w({
|
|
39
|
+
input: {
|
|
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", {
|
|
38
45
|
name: "Cupom aplicado do input",
|
|
39
|
-
couponName:
|
|
40
|
-
}),
|
|
46
|
+
couponName: r
|
|
47
|
+
}), u("success"), y(!0), m(r), p && window.location.reload()) : (t == null || t("discount_coupon", {
|
|
41
48
|
name: "Cupom do input expirado ou invalido",
|
|
42
|
-
couponName:
|
|
43
|
-
objectError:
|
|
44
|
-
}),
|
|
49
|
+
couponName: r,
|
|
50
|
+
objectError: S.error
|
|
51
|
+
}), u("error"), y(!1), m("")), e(!0);
|
|
45
52
|
} else
|
|
46
|
-
|
|
47
|
-
} catch (
|
|
48
|
-
|
|
53
|
+
f(r), B("overwrite-view");
|
|
54
|
+
} catch (b) {
|
|
55
|
+
t == null || t("discount_coupon", {
|
|
49
56
|
name: "Cupom do input - error na api",
|
|
50
|
-
couponName:
|
|
51
|
-
}),
|
|
57
|
+
couponName: r
|
|
58
|
+
}), u("error"), y(!1), e(!0);
|
|
52
59
|
} finally {
|
|
53
60
|
j(!1);
|
|
54
61
|
}
|
|
55
62
|
};
|
|
56
|
-
return
|
|
57
|
-
|
|
58
|
-
}, [
|
|
59
|
-
p &&
|
|
60
|
-
|
|
63
|
+
return Q(() => {
|
|
64
|
+
h && setTimeout(() => e(!1), 5e3);
|
|
65
|
+
}, [G, h]), /* @__PURE__ */ d(_, { children: [
|
|
66
|
+
p && s && /* @__PURE__ */ o(
|
|
67
|
+
R,
|
|
61
68
|
{
|
|
62
|
-
closeModal:
|
|
69
|
+
closeModal: s,
|
|
63
70
|
title: "Meus Cupons",
|
|
64
|
-
genericTaggingEvent:
|
|
71
|
+
genericTaggingEvent: t
|
|
65
72
|
}
|
|
66
73
|
),
|
|
67
|
-
C ? /* @__PURE__ */ o("div", { className: "form-coupons", children: /* @__PURE__ */
|
|
74
|
+
C ? /* @__PURE__ */ o("div", { className: "form-coupons", children: /* @__PURE__ */ d("form", { onSubmit: M, children: [
|
|
68
75
|
/* @__PURE__ */ o(
|
|
69
76
|
"input",
|
|
70
77
|
{
|
|
71
78
|
type: "text",
|
|
72
79
|
placeholder: "Insira o cupom",
|
|
73
|
-
value:
|
|
74
|
-
onChange:
|
|
80
|
+
value: r,
|
|
81
|
+
onChange: K
|
|
75
82
|
}
|
|
76
83
|
),
|
|
77
|
-
/* @__PURE__ */ o("button", { type: "submit", name: "adicionar", disabled:
|
|
78
|
-
] }) }) : /* @__PURE__ */ o("div", { className: "cart-empty-coupons-label", children: /* @__PURE__ */
|
|
79
|
-
/* @__PURE__ */ o("span", { children: /* @__PURE__ */ o(
|
|
84
|
+
/* @__PURE__ */ o("button", { type: "submit", name: "adicionar", disabled: k, children: "Adicionar" })
|
|
85
|
+
] }) }) : /* @__PURE__ */ o("div", { className: "cart-empty-coupons-label", children: /* @__PURE__ */ d("p", { children: [
|
|
86
|
+
/* @__PURE__ */ o("span", { children: /* @__PURE__ */ o(Y, {}) }),
|
|
80
87
|
"Para adicionar um cupom é necessário que você adicione pelo menos 1 produto no carrinho"
|
|
81
88
|
] }) }),
|
|
82
|
-
/* @__PURE__ */ o("div", { className: "container-title-coupons", children:
|
|
89
|
+
/* @__PURE__ */ o("div", { className: "container-title-coupons", children: n.length > 0 ? /* @__PURE__ */ d(_, { children: [
|
|
83
90
|
/* @__PURE__ */ o("h2", { children: "Cupons disponíveis" }),
|
|
84
|
-
/* @__PURE__ */ o("div", { className: "container-coupons", children:
|
|
85
|
-
|
|
91
|
+
/* @__PURE__ */ o("div", { className: "container-coupons", children: n.map((a) => /* @__PURE__ */ o(
|
|
92
|
+
V,
|
|
86
93
|
{
|
|
87
|
-
|
|
88
|
-
|
|
94
|
+
removeCouponMutation: D,
|
|
95
|
+
addCouponMutation: w,
|
|
96
|
+
account: x,
|
|
97
|
+
orderFormId: c,
|
|
89
98
|
hasItemsInCart: C,
|
|
90
99
|
isIO: p,
|
|
91
|
-
item:
|
|
100
|
+
item: a,
|
|
92
101
|
firstCouponName: i,
|
|
93
|
-
secondCouponName:
|
|
94
|
-
replaceCoupon:
|
|
95
|
-
setView:
|
|
102
|
+
secondCouponName: L,
|
|
103
|
+
replaceCoupon: A,
|
|
104
|
+
setView: B,
|
|
96
105
|
setFirstCouponName: m,
|
|
97
|
-
setSecondCouponName:
|
|
98
|
-
setActiveRule:
|
|
99
|
-
setDataItem:
|
|
100
|
-
setReplaceCoupon:
|
|
101
|
-
setAlert:
|
|
102
|
-
setType:
|
|
103
|
-
setIsCloseModalEmpty:
|
|
104
|
-
genericTaggingEvent:
|
|
106
|
+
setSecondCouponName: f,
|
|
107
|
+
setActiveRule: q,
|
|
108
|
+
setDataItem: H,
|
|
109
|
+
setReplaceCoupon: N,
|
|
110
|
+
setAlert: e,
|
|
111
|
+
setType: u,
|
|
112
|
+
setIsCloseModalEmpty: J,
|
|
113
|
+
genericTaggingEvent: t
|
|
105
114
|
},
|
|
106
|
-
|
|
115
|
+
a.couponName
|
|
107
116
|
)) })
|
|
108
|
-
] }) : /* @__PURE__ */ o(
|
|
109
|
-
|
|
110
|
-
p &&
|
|
111
|
-
|
|
117
|
+
] }) : /* @__PURE__ */ o(W, {}) }),
|
|
118
|
+
h && /* @__PURE__ */ o(X, { type: z }),
|
|
119
|
+
p && s && /* @__PURE__ */ o(
|
|
120
|
+
U,
|
|
112
121
|
{
|
|
113
|
-
isFloating:
|
|
114
|
-
cancelButtonAction:
|
|
122
|
+
isFloating: n.length > 0,
|
|
123
|
+
cancelButtonAction: s,
|
|
115
124
|
cancelButtonText: "Sair"
|
|
116
125
|
}
|
|
117
126
|
)
|
|
118
127
|
] });
|
|
119
128
|
};
|
|
120
129
|
export {
|
|
121
|
-
|
|
130
|
+
to as CouponsView
|
|
122
131
|
};
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import { jsx as a, jsxs as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { jsx as a, jsxs as g } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect as o } from "react";
|
|
3
|
+
const f = ({
|
|
4
|
+
measurementUnit: c,
|
|
5
|
+
setIsShowProductBadge: r,
|
|
6
|
+
unitMultiplier: d
|
|
7
|
+
}) => (o(() => {
|
|
8
|
+
c !== "un" && (d < 1 || d >= 1) && r(!0);
|
|
9
|
+
}, [c, d, r]), c === "un" ? null : d < 1 ? /* @__PURE__ */ a("div", { className: "product-card-badge", children: /* @__PURE__ */ g("p", { className: "product-card-badge-kg", children: [
|
|
10
|
+
d * 1e3,
|
|
8
11
|
"g"
|
|
9
|
-
] }) })
|
|
10
|
-
|
|
12
|
+
] }) }) : /* @__PURE__ */ a("div", { className: "product-card-badge", children: /* @__PURE__ */ g("p", { className: "product-card-badge-kg", children: [
|
|
13
|
+
d,
|
|
11
14
|
"kg"
|
|
12
15
|
] }) }));
|
|
13
16
|
export {
|
|
14
|
-
|
|
17
|
+
f as ProductCardBadgeKg
|
|
15
18
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SkuSpecificationsProps, ProductCardProps } from '../../../types/ProductCard';
|
|
1
|
+
import { SkuSpecificationsProps, ProductCardProps, offers } from '../../../types/ProductCard';
|
|
2
2
|
|
|
3
3
|
interface ProductCardDiscountBadge {
|
|
4
4
|
skuSpecifications: SkuSpecificationsProps[];
|
|
@@ -8,6 +8,7 @@ interface ProductCardDiscountBadge {
|
|
|
8
8
|
hasPromotionalPrice: ProductCardProps['hasPromotionalPrice'];
|
|
9
9
|
defaultScListPrice?: number;
|
|
10
10
|
setIsShowProductBadge: React.Dispatch<React.SetStateAction<boolean>>;
|
|
11
|
+
offers: offers;
|
|
11
12
|
}
|
|
12
|
-
export declare const ProductCardDiscountBadge: ({
|
|
13
|
+
export declare const ProductCardDiscountBadge: ({ offers, setIsShowProductBadge }: ProductCardDiscountBadge) => import("react/jsx-runtime").JSX.Element | null;
|
|
13
14
|
export {};
|
|
@@ -1,42 +1,26 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
skuSpecifications: n,
|
|
7
|
-
unitMultiplier: a,
|
|
8
|
-
hasPromotionalPrice: i,
|
|
9
|
-
defaultScListPrice: P,
|
|
10
|
-
setIsShowProductBadge: d
|
|
1
|
+
import { jsx as d, jsxs as i } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect as a, useMemo as m } from "react";
|
|
3
|
+
const h = ({
|
|
4
|
+
offers: n,
|
|
5
|
+
setIsShowProductBadge: c
|
|
11
6
|
}) => {
|
|
12
|
-
const { listPrice: u,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
spotPriceCustom: o
|
|
18
|
-
} : {
|
|
19
|
-
listPriceCustom: c,
|
|
20
|
-
spotPriceCustom: s
|
|
21
|
-
}, [
|
|
22
|
-
u,
|
|
23
|
-
o,
|
|
24
|
-
s,
|
|
25
|
-
c
|
|
26
|
-
]), C = "Venda por unidade", N = n == null ? void 0 : n.some((r) => r.field.originalName === C && r.values.some((e) => e.originalName === "true")), h = P || (N ? m : ((r) => Number(r.toString().match(/^\d+(?:\.\d{0,2})?/)))(m * a)), t = Math.round(
|
|
27
|
-
Number(f(h, p))
|
|
7
|
+
const { listPrice: u, price: o } = n == null ? void 0 : n.offers[0], t = Math.round(
|
|
8
|
+
Number(((r, e) => m(() => {
|
|
9
|
+
const s = (r - e) * 100 / r;
|
|
10
|
+
return Math.round(s);
|
|
11
|
+
}, [e, r]))(u, o))
|
|
28
12
|
);
|
|
29
|
-
return
|
|
13
|
+
return a(() => {
|
|
30
14
|
if (!t || t <= 0) {
|
|
31
|
-
|
|
15
|
+
c(!1);
|
|
32
16
|
return;
|
|
33
17
|
}
|
|
34
|
-
|
|
35
|
-
}, [t]), !t || t <= 0 ? null : /* @__PURE__ */
|
|
18
|
+
c(!0);
|
|
19
|
+
}, [t]), !t || t <= 0 ? null : /* @__PURE__ */ d("div", { className: "product-card-discount-badge", children: /* @__PURE__ */ i("p", { className: "product-card-discount-badge-value", children: [
|
|
36
20
|
t,
|
|
37
21
|
"%"
|
|
38
22
|
] }) });
|
|
39
23
|
};
|
|
40
24
|
export {
|
|
41
|
-
|
|
25
|
+
h as ProductCardDiscountBadge
|
|
42
26
|
};
|