@plurix/ecom-components 1.16.0-commerce.0 → 1.16.1-commerce
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/assets/svgs/CheckMarkBoxIcon.d.ts +1 -0
- package/dist/assets/svgs/CheckMarkBoxIcon.js +30 -0
- package/dist/assets/svgs/CheckMarkIcon.d.ts +1 -0
- package/dist/assets/svgs/CheckMarkIcon.js +23 -0
- package/dist/assets/svgs/CouponIcon.d.ts +1 -4
- package/dist/assets/svgs/CouponIcon.js +50 -14
- package/dist/assets/svgs/ErrorIcon.d.ts +1 -5
- package/dist/assets/svgs/ErrorIcon.js +26 -14
- package/dist/assets/svgs/ErrorIconV2.d.ts +1 -0
- package/dist/assets/svgs/ErrorIconV2.js +33 -0
- package/dist/assets/svgs/SuccessIconV2.d.ts +1 -0
- package/dist/assets/svgs/SuccessIconV2.js +30 -0
- package/dist/assets/svgs/WarningIconV2.d.ts +1 -0
- package/dist/assets/svgs/WarningIconV2.js +40 -0
- package/dist/hooks/useVerticalShelfCarouselProps.d.ts +4 -0
- package/dist/hooks/useVerticalShelfCarouselProps.js +14 -0
- package/dist/hooks/useWindowDimensions.d.ts +5 -0
- package/dist/hooks/useWindowDimensions.js +38 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +19 -17
- package/dist/packages/AdaptiveCarousel/AdaptiveCarousel.d.ts +14 -0
- package/dist/packages/AdaptiveCarousel/AdaptiveCarousel.js +69 -0
- package/dist/packages/Coupons/Coupons.d.ts +3 -17
- package/dist/packages/Coupons/Coupons.js +76 -114
- package/dist/packages/Coupons/components/Alert.d.ts +4 -2
- package/dist/packages/Coupons/components/Alert.js +10 -10
- package/dist/packages/Coupons/components/CouponCard.d.ts +5 -22
- package/dist/packages/Coupons/components/CouponCard.js +79 -133
- package/dist/packages/Coupons/components/NoCoupons.js +7 -7
- package/dist/packages/Coupons/hooks/useCoupons.d.ts +33 -0
- package/dist/packages/Coupons/hooks/useCoupons.js +108 -0
- package/dist/packages/Coupons/types/CouponType.d.ts +1 -1
- package/dist/packages/VouchersRedeemed/VouchersRedeemed.d.ts +24 -0
- package/dist/packages/VouchersRedeemed/VouchersRedeemed.js +145 -0
- package/dist/packages/VouchersRedeemed/api/getCouponsCartonistByUser.d.ts +1 -0
- package/dist/packages/VouchersRedeemed/api/getCouponsCartonistByUser.js +20 -0
- package/dist/packages/VouchersRedeemed/components/StatusMessageTryApply/StatusMessageTryApply.d.ts +12 -0
- package/dist/packages/VouchersRedeemed/components/StatusMessageTryApply/StatusMessageTryApply.js +27 -0
- package/dist/packages/VouchersRedeemed/components/StatusMessageTryApply/index.d.ts +1 -0
- package/dist/packages/VouchersRedeemed/components/StatusMessageTryApply/index.js +4 -0
- package/dist/packages/VouchersRedeemed/components/VoucherRedeemedCard/VoucherRedeemedCard.d.ts +17 -0
- package/dist/packages/VouchersRedeemed/components/VoucherRedeemedCard/VoucherRedeemedCard.js +37 -0
- package/dist/packages/VouchersRedeemed/components/VoucherRedeemedCard/index.d.ts +1 -0
- package/dist/packages/VouchersRedeemed/components/VoucherRedeemedCard/index.js +4 -0
- package/dist/packages/VouchersRedeemed/components/VouchersRedeemedSkeleton/VouchersRedeemedSkeleton.d.ts +15 -0
- package/dist/packages/VouchersRedeemed/components/VouchersRedeemedSkeleton/VouchersRedeemedSkeleton.js +49 -0
- package/dist/packages/VouchersRedeemed/components/VouchersRedeemedSkeleton/index.d.ts +1 -0
- package/dist/packages/VouchersRedeemed/components/VouchersRedeemedSkeleton/index.js +4 -0
- package/dist/packages/VouchersRedeemed/data/validVouchers.d.ts +1 -0
- package/dist/packages/VouchersRedeemed/data/validVouchers.js +20 -0
- package/dist/packages/VouchersRedeemed/utils/getCouponPrice.d.ts +1 -0
- package/dist/packages/VouchersRedeemed/utils/getCouponPrice.js +8 -0
- package/dist/styles/adaptive-carousel.global.css +1 -0
- package/dist/styles/coupons.global.css +1 -1
- package/dist/styles/regionalization.global.css +1 -1
- package/dist/styles/vouchers-redeemed.global.css +1 -0
- package/dist/utils/carousel/carouselProps.d.ts +33 -0
- package/dist/utils/carousel/carouselProps.js +59 -0
- package/dist/utils/scroll/isScrollToEnd.d.ts +1 -0
- package/dist/utils/scroll/isScrollToEnd.js +4 -0
- package/dist/utils/setBoldTextParts.d.ts +1 -0
- package/dist/utils/setBoldTextParts.js +7 -0
- package/package.json +1 -1
- package/dist/packages/Coupons/components/Breadcrumb.d.ts +0 -6
- package/dist/packages/Coupons/components/Breadcrumb.js +0 -33
- package/dist/packages/Coupons/components/Modal.d.ts +0 -8
- package/dist/packages/Coupons/components/Modal.js +0 -62
- package/dist/packages/Coupons/components/ModalFooter.d.ts +0 -9
- package/dist/packages/Coupons/components/ModalFooter.js +0 -25
- package/dist/packages/Coupons/components/ModalHeader.d.ts +0 -6
- package/dist/packages/Coupons/components/ModalHeader.js +0 -25
- package/dist/packages/Coupons/types/Views.d.ts +0 -1
- package/dist/packages/Coupons/types/Views.js +0 -1
- package/dist/packages/Coupons/views/CouponsView.d.ts +0 -15
- package/dist/packages/Coupons/views/CouponsView.js +0 -131
- package/dist/packages/Coupons/views/EmptyCartView.d.ts +0 -6
- package/dist/packages/Coupons/views/EmptyCartView.js +0 -36
- package/dist/packages/Coupons/views/LoadingView.d.ts +0 -7
- package/dist/packages/Coupons/views/LoadingView.js +0 -39
- package/dist/packages/Coupons/views/OverwriteView.d.ts +0 -14
- package/dist/packages/Coupons/views/OverwriteView.js +0 -58
- package/dist/packages/Coupons/views/RulesView.d.ts +0 -13
- package/dist/packages/Coupons/views/RulesView.js +0 -49
- package/dist/packages/Coupons/views/index.d.ts +0 -5
- package/dist/packages/Coupons/views/index.js +0 -12
|
@@ -1,120 +1,82 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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,
|
|
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,
|
|
55
23
|
{
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
24
|
+
width: "100%",
|
|
25
|
+
height: 600,
|
|
26
|
+
backgroundColor: "var(--color-grayScale-faded)",
|
|
27
|
+
margin: "auto",
|
|
28
|
+
animation: !0
|
|
59
29
|
}
|
|
60
|
-
) }) : /* @__PURE__ */
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
{
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
),
|
|
109
|
-
!f && E && /* @__PURE__ */ e(
|
|
110
|
-
Y,
|
|
111
|
-
{
|
|
112
|
-
setIsCloseModalEmpty: S,
|
|
113
|
-
genericTaggingEvent: s
|
|
114
|
-
}
|
|
115
|
-
)
|
|
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, {}) })
|
|
116
78
|
] });
|
|
117
79
|
};
|
|
118
80
|
export {
|
|
119
|
-
|
|
81
|
+
k as Coupons
|
|
120
82
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
interface AlertProps {
|
|
2
3
|
type: AlertType;
|
|
4
|
+
children: React.ReactNode;
|
|
3
5
|
}
|
|
4
|
-
export type AlertType = '' | '
|
|
5
|
-
export declare const Alert: ({ type }: AlertProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export type AlertType = '' | 'applied' | 'warning';
|
|
7
|
+
export declare const Alert: ({ type, children }: AlertProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
6
8
|
export {};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
|
10
10
|
] });
|
|
11
11
|
export {
|
|
12
|
-
|
|
12
|
+
s as Alert
|
|
13
13
|
};
|
|
@@ -1,27 +1,10 @@
|
|
|
1
1
|
import { CouponType } from '../types/CouponType';
|
|
2
|
-
import {
|
|
3
|
-
import { AlertType } from './Alert';
|
|
2
|
+
import { ChangeCouponParams } from '../hooks/useCoupons';
|
|
4
3
|
|
|
5
4
|
export interface CouponCardProps {
|
|
6
|
-
account: string;
|
|
7
|
-
orderFormId: string;
|
|
8
|
-
hasItemsInCart: boolean;
|
|
9
|
-
isIO?: boolean;
|
|
10
5
|
item: CouponType;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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;
|
|
6
|
+
currentCoupon: string;
|
|
7
|
+
changeCoupon: (params: ChangeCouponParams) => Promise<void>;
|
|
8
|
+
isLoading: boolean;
|
|
26
9
|
}
|
|
27
|
-
export declare const CouponCard: ({
|
|
10
|
+
export declare const CouponCard: ({ item, currentCoupon, changeCoupon, isLoading }: CouponCardProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,142 +1,88 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useState as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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
|
|
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
|
|
27
11
|
}) => {
|
|
28
|
-
const [
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
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, {})
|
|
72
59
|
}
|
|
73
|
-
|
|
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 })
|
|
60
|
+
)
|
|
102
61
|
] }),
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
a.couponValue
|
|
106
|
-
] }),
|
|
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
|
|
111
|
-
] })
|
|
62
|
+
/* @__PURE__ */ e("div", { className: `ellipse left ${s ? "applied" : ""}` }),
|
|
63
|
+
/* @__PURE__ */ e("div", { className: `ellipse right ${s ? "applied" : ""}` })
|
|
112
64
|
] }),
|
|
113
|
-
/* @__PURE__ */
|
|
114
|
-
/* @__PURE__ */
|
|
115
|
-
|
|
116
|
-
/* @__PURE__ */
|
|
117
|
-
"
|
|
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, {}) })
|
|
118
70
|
] }),
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
{
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
className: "apply-coupon",
|
|
132
|
-
disabled: k,
|
|
133
|
-
children: "Aplicar"
|
|
134
|
-
}
|
|
135
|
-
),
|
|
136
|
-
a.couponDescription && /* @__PURE__ */ c("a", { onClick: $, children: "Ver Regras" })
|
|
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
|
+
] })
|
|
82
|
+
] })
|
|
137
83
|
] })
|
|
138
|
-
] });
|
|
84
|
+
] }) });
|
|
139
85
|
};
|
|
140
86
|
export {
|
|
141
|
-
|
|
87
|
+
T as CouponCard
|
|
142
88
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { NoCouponsIcon as
|
|
3
|
-
const
|
|
4
|
-
/* @__PURE__ */ o("
|
|
5
|
-
/* @__PURE__ */ o(
|
|
6
|
-
/* @__PURE__ */ o("p", { className: "noCoupons-p", children: "Caso você tenha algum código de cupom em mãos, insira o código acima, ou entre no seu carrinho de compras e insira o código no campo ‘
|
|
1
|
+
import { jsxs as s, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { NoCouponsIcon as n } from "../../../assets/svgs/NoCouponIcon.js";
|
|
3
|
+
const a = () => /* @__PURE__ */ s("div", { className: "noCoupons", children: [
|
|
4
|
+
/* @__PURE__ */ o("h3", { className: "noCoupons-h3", children: "Não há cupons disponíveis no momento" }),
|
|
5
|
+
/* @__PURE__ */ o(n, {}),
|
|
6
|
+
/* @__PURE__ */ o("p", { className: "noCoupons-p", children: "Caso você tenha algum código de cupom em mãos, insira o código acima, ou entre no seu carrinho de compras e insira o código no campo ‘Meus Cupons e Vale-compras’." })
|
|
7
7
|
] });
|
|
8
8
|
export {
|
|
9
|
-
|
|
9
|
+
a as NoCoupons
|
|
10
10
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { AlertType } from '../components/Alert';
|
|
2
|
+
import { CouponType } from '../types/CouponType';
|
|
3
|
+
|
|
4
|
+
export interface UseCouponsParams {
|
|
5
|
+
orderFormId: string;
|
|
6
|
+
hasItemsInCart: boolean;
|
|
7
|
+
builder: 'faststore' | 'app';
|
|
8
|
+
isIO?: boolean;
|
|
9
|
+
activeOrderFormCoupon?: string;
|
|
10
|
+
genericTaggingEvent?: (name: string, params: object) => void;
|
|
11
|
+
couponsList?: CouponType[];
|
|
12
|
+
qtdCouponsView?: number;
|
|
13
|
+
getCouponsMutation?: any;
|
|
14
|
+
addCouponMutation?: any;
|
|
15
|
+
removeCouponMutation?: any;
|
|
16
|
+
}
|
|
17
|
+
export interface ChangeCouponParams {
|
|
18
|
+
couponName: string;
|
|
19
|
+
isAdding: boolean;
|
|
20
|
+
isFromForm: boolean;
|
|
21
|
+
}
|
|
22
|
+
export declare function useCoupons({ orderFormId, hasItemsInCart, builder, isIO, activeOrderFormCoupon, genericTaggingEvent, couponsList, qtdCouponsView, getCouponsMutation, addCouponMutation, removeCouponMutation }: UseCouponsParams): {
|
|
23
|
+
isLoadingCouponList: boolean;
|
|
24
|
+
coupons: CouponType[];
|
|
25
|
+
currentCoupon: string;
|
|
26
|
+
isLoadingButton: boolean;
|
|
27
|
+
inputCoupon: string;
|
|
28
|
+
isInputError: boolean;
|
|
29
|
+
showAlert: AlertType;
|
|
30
|
+
handleSubmit: (event: React.FormEvent<HTMLFormElement>) => Promise<void>;
|
|
31
|
+
handleChangeInput: (event: React.ChangeEvent<HTMLInputElement>) => void;
|
|
32
|
+
changeCoupon: ({ couponName, isAdding, isFromForm }: ChangeCouponParams) => Promise<void>;
|
|
33
|
+
};
|