@plurix/ecom-components 1.15.0-loyalty.1 → 1.16.0-commerce.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/svgs/CouponIcon.d.ts +4 -1
- package/dist/assets/svgs/CouponIcon.js +14 -50
- package/dist/assets/svgs/ErrorIcon.d.ts +5 -1
- package/dist/assets/svgs/ErrorIcon.js +14 -26
- package/dist/main.d.ts +0 -1
- package/dist/main.js +17 -19
- package/dist/packages/ChangeOrderModal/ChangeOrderModal.d.ts +3 -3
- package/dist/packages/ChangeOrderModal/ChangeOrderModal.js +71 -73
- package/dist/packages/ChangeOrderModal/components/ModalFooter.d.ts +4 -1
- package/dist/packages/ChangeOrderModal/components/ModalFooter.js +3 -1
- package/dist/packages/ChangeOrderModal/components/SimilarProductList.d.ts +2 -3
- package/dist/packages/ChangeOrderModal/components/SimilarProducts.d.ts +4 -5
- package/dist/packages/ChangeOrderModal/components/SimilarProducts.js +21 -21
- package/dist/packages/ChangeOrderModal/mocks.d.ts +1 -0
- package/dist/packages/ChangeOrderModal/mocks.js +1 -0
- package/dist/packages/Coupons/Coupons.d.ts +17 -3
- package/dist/packages/Coupons/Coupons.js +114 -76
- package/dist/packages/Coupons/components/Alert.d.ts +2 -4
- package/dist/packages/Coupons/components/Alert.js +10 -10
- package/dist/packages/Coupons/components/Breadcrumb.d.ts +6 -0
- package/dist/packages/Coupons/components/Breadcrumb.js +33 -0
- package/dist/packages/Coupons/components/CouponCard.d.ts +22 -5
- package/dist/packages/Coupons/components/CouponCard.js +133 -79
- package/dist/packages/Coupons/components/Modal.d.ts +8 -0
- package/dist/packages/Coupons/components/Modal.js +62 -0
- package/dist/packages/Coupons/components/ModalFooter.d.ts +9 -0
- package/dist/packages/Coupons/components/ModalFooter.js +25 -0
- package/dist/packages/Coupons/components/ModalHeader.d.ts +6 -0
- package/dist/packages/Coupons/components/ModalHeader.js +25 -0
- package/dist/packages/Coupons/components/NoCoupons.js +7 -7
- package/dist/packages/Coupons/types/CouponType.d.ts +1 -1
- package/dist/packages/Coupons/types/Views.d.ts +1 -0
- package/dist/packages/Coupons/types/Views.js +1 -0
- package/dist/packages/Coupons/views/CouponsView.d.ts +15 -0
- package/dist/packages/Coupons/views/CouponsView.js +131 -0
- package/dist/packages/Coupons/views/EmptyCartView.d.ts +6 -0
- package/dist/packages/Coupons/views/EmptyCartView.js +36 -0
- package/dist/packages/Coupons/views/LoadingView.d.ts +7 -0
- package/dist/packages/Coupons/views/LoadingView.js +39 -0
- package/dist/packages/Coupons/views/OverwriteView.d.ts +14 -0
- package/dist/packages/Coupons/views/OverwriteView.js +58 -0
- package/dist/packages/Coupons/views/RulesView.d.ts +13 -0
- package/dist/packages/Coupons/views/RulesView.js +49 -0
- package/dist/packages/Coupons/views/index.d.ts +5 -0
- package/dist/packages/Coupons/views/index.js +12 -0
- package/dist/styles/change-order-modal.global.css +1 -1
- package/dist/styles/coupons.global.css +1 -1
- package/package.json +1 -1
- package/dist/assets/svgs/CheckMarkBoxIcon.d.ts +0 -1
- package/dist/assets/svgs/CheckMarkBoxIcon.js +0 -30
- package/dist/assets/svgs/CheckMarkIcon.d.ts +0 -1
- package/dist/assets/svgs/CheckMarkIcon.js +0 -23
- package/dist/assets/svgs/ErrorIconV2.d.ts +0 -1
- package/dist/assets/svgs/ErrorIconV2.js +0 -33
- package/dist/assets/svgs/SuccessIconV2.d.ts +0 -1
- package/dist/assets/svgs/SuccessIconV2.js +0 -30
- package/dist/assets/svgs/WarningIconV2.d.ts +0 -1
- package/dist/assets/svgs/WarningIconV2.js +0 -40
- package/dist/hooks/useVerticalShelfCarouselProps.d.ts +0 -4
- package/dist/hooks/useVerticalShelfCarouselProps.js +0 -14
- package/dist/hooks/useWindowDimensions.d.ts +0 -5
- package/dist/hooks/useWindowDimensions.js +0 -38
- package/dist/packages/AdaptiveCarousel/AdaptiveCarousel.d.ts +0 -14
- package/dist/packages/AdaptiveCarousel/AdaptiveCarousel.js +0 -69
- package/dist/packages/Coupons/hooks/useCoupons.d.ts +0 -33
- package/dist/packages/Coupons/hooks/useCoupons.js +0 -108
- package/dist/packages/VouchersRedeemed/VouchersRedeemed.d.ts +0 -24
- package/dist/packages/VouchersRedeemed/VouchersRedeemed.js +0 -145
- package/dist/packages/VouchersRedeemed/api/getCouponsCartonistByUser.d.ts +0 -1
- package/dist/packages/VouchersRedeemed/api/getCouponsCartonistByUser.js +0 -20
- package/dist/packages/VouchersRedeemed/components/StatusMessageTryApply/StatusMessageTryApply.d.ts +0 -12
- package/dist/packages/VouchersRedeemed/components/StatusMessageTryApply/StatusMessageTryApply.js +0 -27
- package/dist/packages/VouchersRedeemed/components/StatusMessageTryApply/index.d.ts +0 -1
- package/dist/packages/VouchersRedeemed/components/StatusMessageTryApply/index.js +0 -4
- package/dist/packages/VouchersRedeemed/components/VoucherRedeemedCard/VoucherRedeemedCard.d.ts +0 -17
- package/dist/packages/VouchersRedeemed/components/VoucherRedeemedCard/VoucherRedeemedCard.js +0 -37
- package/dist/packages/VouchersRedeemed/components/VoucherRedeemedCard/index.d.ts +0 -1
- package/dist/packages/VouchersRedeemed/components/VoucherRedeemedCard/index.js +0 -4
- package/dist/packages/VouchersRedeemed/components/VouchersRedeemedSkeleton/VouchersRedeemedSkeleton.d.ts +0 -15
- package/dist/packages/VouchersRedeemed/components/VouchersRedeemedSkeleton/VouchersRedeemedSkeleton.js +0 -49
- package/dist/packages/VouchersRedeemed/components/VouchersRedeemedSkeleton/index.d.ts +0 -1
- package/dist/packages/VouchersRedeemed/components/VouchersRedeemedSkeleton/index.js +0 -4
- package/dist/packages/VouchersRedeemed/data/validVouchers.d.ts +0 -1
- package/dist/packages/VouchersRedeemed/data/validVouchers.js +0 -20
- package/dist/packages/VouchersRedeemed/utils/getCouponPrice.d.ts +0 -1
- package/dist/packages/VouchersRedeemed/utils/getCouponPrice.js +0 -8
- package/dist/styles/adaptive-carousel.global.css +0 -1
- package/dist/styles/vouchers-redeemed.global.css +0 -1
- package/dist/utils/carousel/carouselProps.d.ts +0 -33
- package/dist/utils/carousel/carouselProps.js +0 -59
- package/dist/utils/scroll/isScrollToEnd.d.ts +0 -1
- package/dist/utils/scroll/isScrollToEnd.js +0 -4
- package/dist/utils/setBoldTextParts.d.ts +0 -1
- package/dist/utils/setBoldTextParts.js +0 -7
|
@@ -1,82 +1,120 @@
|
|
|
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
|
-
|
|
1
|
+
import { jsx as e, jsxs as P } from "react/jsx-runtime";
|
|
2
|
+
import { useState as t, useEffect as h } from "react";
|
|
3
|
+
import { LoadingView as Q } from "./views/LoadingView.js";
|
|
4
|
+
import { CouponsView as U } from "./views/CouponsView.js";
|
|
5
|
+
import { RulesView as W } from "./views/RulesView.js";
|
|
6
|
+
import { OverwriteView as X } from "./views/OverwriteView.js";
|
|
7
|
+
import { EmptyCartView as Y } from "./views/EmptyCartView.js";
|
|
8
|
+
import { getCoupons as Z } from "./api/getCoupons.js";
|
|
9
|
+
/* empty css */const to = ({
|
|
10
|
+
orderFormId: j,
|
|
11
|
+
hasItemsInCart: f,
|
|
12
|
+
builder: l,
|
|
13
|
+
account: A,
|
|
14
|
+
isIO: o = !1,
|
|
15
|
+
closeIOModal: r,
|
|
16
|
+
activeOrderFormCoupon: n,
|
|
17
|
+
genericTaggingEvent: s,
|
|
18
|
+
disableFirstEmptyModal: J,
|
|
19
|
+
couponsList: p,
|
|
20
|
+
qtdCouponsView: w,
|
|
21
|
+
getCouponsMutation: q,
|
|
22
|
+
addCouponMutation: D,
|
|
23
|
+
removeCouponMutation: L
|
|
24
|
+
}) => {
|
|
25
|
+
const [k, C] = t(!0), [z, a] = t([]), [u, c] = t("coupons-view"), [B, N] = t(!1), [d, y] = t(!1), [v, R] = t(""), [m, V] = t(""), [E, S] = t(
|
|
26
|
+
!J
|
|
27
|
+
), [G, H] = t();
|
|
28
|
+
return h(() => {
|
|
29
|
+
n && R(n);
|
|
30
|
+
}, [n]), h(() => {
|
|
31
|
+
(async () => {
|
|
32
|
+
C(!0);
|
|
33
|
+
try {
|
|
34
|
+
const i = o ? await Z(l, p) : await q({
|
|
35
|
+
input: {
|
|
36
|
+
builder: l,
|
|
37
|
+
couponsList: p
|
|
38
|
+
}
|
|
39
|
+
}), x = o ? i : JSON.parse(i.getCoupons.data).coupons;
|
|
40
|
+
if (w) {
|
|
41
|
+
const K = x.slice(0, w);
|
|
42
|
+
a(K);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
a(x);
|
|
46
|
+
return;
|
|
47
|
+
} catch (i) {
|
|
48
|
+
a([]);
|
|
49
|
+
} finally {
|
|
50
|
+
C(!1);
|
|
51
|
+
}
|
|
52
|
+
})();
|
|
53
|
+
}, [JSON.stringify(p)]), k ? /* @__PURE__ */ e("div", { className: "coupons-container", children: /* @__PURE__ */ e(
|
|
54
|
+
Q,
|
|
23
55
|
{
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
margin: "auto",
|
|
28
|
-
animation: !0
|
|
56
|
+
isIO: o,
|
|
57
|
+
closeIOModal: r,
|
|
58
|
+
genericTaggingEvent: s
|
|
29
59
|
}
|
|
30
|
-
) }) : /* @__PURE__ */
|
|
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
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
60
|
+
) }) : /* @__PURE__ */ P("div", { className: "coupons-container", children: [
|
|
61
|
+
(!o || o && u === "coupons-view") && /* @__PURE__ */ e(
|
|
62
|
+
U,
|
|
63
|
+
{
|
|
64
|
+
removeCouponMutation: L,
|
|
65
|
+
addCouponMutation: D,
|
|
66
|
+
orderFormId: j,
|
|
67
|
+
hasItemsInCart: f,
|
|
68
|
+
account: A,
|
|
69
|
+
isIO: o,
|
|
70
|
+
closeIOModal: r,
|
|
71
|
+
coupons: z,
|
|
72
|
+
firstCouponName: v,
|
|
73
|
+
secondCouponName: m,
|
|
74
|
+
replaceCoupon: d,
|
|
75
|
+
setView: c,
|
|
76
|
+
setFirstCouponName: R,
|
|
77
|
+
setSecondCouponName: V,
|
|
78
|
+
setActiveRule: N,
|
|
79
|
+
setDataItem: H,
|
|
80
|
+
setReplaceCoupon: y,
|
|
81
|
+
setIsCloseModalEmpty: S,
|
|
82
|
+
genericTaggingEvent: s
|
|
83
|
+
}
|
|
84
|
+
),
|
|
85
|
+
(!o || o && u === "rules-view") && B && /* @__PURE__ */ e(
|
|
86
|
+
W,
|
|
87
|
+
{
|
|
88
|
+
dataItem: G,
|
|
89
|
+
setActiveRule: N,
|
|
90
|
+
setView: c,
|
|
91
|
+
isIO: o,
|
|
92
|
+
closeIOModal: r,
|
|
93
|
+
genericTaggingEvent: s
|
|
94
|
+
}
|
|
95
|
+
),
|
|
96
|
+
(!o || o && u === "overwrite-view") && m && !d && /* @__PURE__ */ e(
|
|
97
|
+
X,
|
|
98
|
+
{
|
|
99
|
+
firstCouponName: v,
|
|
100
|
+
secondCouponName: m,
|
|
101
|
+
setView: c,
|
|
102
|
+
setReplaceCoupon: y,
|
|
103
|
+
setSecondCouponName: V,
|
|
104
|
+
isIO: o,
|
|
105
|
+
closeIOModal: r,
|
|
106
|
+
genericTaggingEvent: s
|
|
107
|
+
}
|
|
108
|
+
),
|
|
109
|
+
!f && E && /* @__PURE__ */ e(
|
|
110
|
+
Y,
|
|
111
|
+
{
|
|
112
|
+
setIsCloseModalEmpty: S,
|
|
113
|
+
genericTaggingEvent: s
|
|
114
|
+
}
|
|
115
|
+
)
|
|
78
116
|
] });
|
|
79
117
|
};
|
|
80
118
|
export {
|
|
81
|
-
|
|
119
|
+
to as Coupons
|
|
82
120
|
};
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
interface AlertProps {
|
|
3
2
|
type: AlertType;
|
|
4
|
-
children: React.ReactNode;
|
|
5
3
|
}
|
|
6
|
-
export type AlertType = '' | '
|
|
7
|
-
export declare const Alert: ({ type
|
|
4
|
+
export type AlertType = '' | 'success' | 'removed' | 'error';
|
|
5
|
+
export declare const Alert: ({ type }: AlertProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
6
|
export {};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
o
|
|
1
|
+
import { jsxs as c, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { SuccessIcon as r } from "../../../assets/svgs/SuccessIcon.js";
|
|
3
|
+
import { ErrorIcon as e } from "../../../assets/svgs/ErrorIcon.js";
|
|
4
|
+
const m = ({ type: s }) => s === "success" || s === "removed" ? /* @__PURE__ */ c("div", { className: "applied-coupon-badge success-coupon", children: [
|
|
5
|
+
/* @__PURE__ */ o("span", { children: /* @__PURE__ */ o(r, {}) }),
|
|
6
|
+
s === "success" ? "Cupom aplicado com sucesso" : "Cupom removido com sucesso"
|
|
7
|
+
] }) : /* @__PURE__ */ c("div", { className: "applied-coupon-badge error-coupon", children: [
|
|
8
|
+
/* @__PURE__ */ o("span", { children: /* @__PURE__ */ o(e, {}) }),
|
|
9
|
+
"Não foi possível aplicar o cupom. Tente aplicar mais tarde."
|
|
10
10
|
] });
|
|
11
11
|
export {
|
|
12
|
-
|
|
12
|
+
m as Alert
|
|
13
13
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsxs as t, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { ArrowIcon as a } from "../../../assets/svgs/ArrowIcon.js";
|
|
3
|
+
const s = ({ title: c, cancelButtonAction: o }) => /* @__PURE__ */ t("div", { className: "breadcrumb-container", children: [
|
|
4
|
+
/* @__PURE__ */ t("div", { className: "breadcrumb-content-container", children: [
|
|
5
|
+
/* @__PURE__ */ r(
|
|
6
|
+
"button",
|
|
7
|
+
{
|
|
8
|
+
onClick: o,
|
|
9
|
+
"data-testid": "back-to-coupons-button",
|
|
10
|
+
children: "Meus Cupons"
|
|
11
|
+
}
|
|
12
|
+
),
|
|
13
|
+
" ",
|
|
14
|
+
/* @__PURE__ */ r(a, {}),
|
|
15
|
+
" ",
|
|
16
|
+
/* @__PURE__ */ r("span", { children: c })
|
|
17
|
+
] }),
|
|
18
|
+
/* @__PURE__ */ t(
|
|
19
|
+
"button",
|
|
20
|
+
{
|
|
21
|
+
className: "breadcrumb-back-button",
|
|
22
|
+
onClick: o,
|
|
23
|
+
"data-testid": "back-button",
|
|
24
|
+
children: [
|
|
25
|
+
/* @__PURE__ */ r(a, { color: "var(--color-support-links)", rotate: "Left" }),
|
|
26
|
+
" Voltar"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
)
|
|
30
|
+
] });
|
|
31
|
+
export {
|
|
32
|
+
s as Breadcrumb
|
|
33
|
+
};
|
|
@@ -1,10 +1,27 @@
|
|
|
1
1
|
import { CouponType } from '../types/CouponType';
|
|
2
|
-
import {
|
|
2
|
+
import { View } from '../types/Views';
|
|
3
|
+
import { AlertType } from './Alert';
|
|
3
4
|
|
|
4
5
|
export interface CouponCardProps {
|
|
6
|
+
account: string;
|
|
7
|
+
orderFormId: string;
|
|
8
|
+
hasItemsInCart: boolean;
|
|
9
|
+
isIO?: boolean;
|
|
5
10
|
item: CouponType;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
11
|
+
firstCouponName: string;
|
|
12
|
+
secondCouponName: string;
|
|
13
|
+
replaceCoupon: boolean;
|
|
14
|
+
setView: (view: View) => void;
|
|
15
|
+
setFirstCouponName: (firstCouponName: string) => void;
|
|
16
|
+
setSecondCouponName: (secondCouponName: string) => void;
|
|
17
|
+
setActiveRule: (activeRule: boolean) => void;
|
|
18
|
+
setDataItem: (dataItem: CouponType) => void;
|
|
19
|
+
setReplaceCoupon: (replaceCoupon: boolean) => void;
|
|
20
|
+
setAlert: (errorMessage: boolean) => void;
|
|
21
|
+
setType: (type: AlertType) => void;
|
|
22
|
+
setIsCloseModalEmpty: (isCloseModalEmpty: boolean) => void;
|
|
23
|
+
genericTaggingEvent?: (name: string, params: object) => void;
|
|
24
|
+
addCouponMutation?: any;
|
|
25
|
+
removeCouponMutation?: any;
|
|
9
26
|
}
|
|
10
|
-
export declare const CouponCard: ({ item,
|
|
27
|
+
export declare const CouponCard: ({ orderFormId, hasItemsInCart, isIO, item, firstCouponName, secondCouponName, replaceCoupon, setView, setActiveRule, setDataItem, setFirstCouponName, setSecondCouponName, setReplaceCoupon, setAlert, setType, setIsCloseModalEmpty, genericTaggingEvent, addCouponMutation, removeCouponMutation }: CouponCardProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,88 +1,142 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useState as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import { jsxs as p, jsx as c } from "react/jsx-runtime";
|
|
2
|
+
import { useState as V, useEffect as q } from "react";
|
|
3
|
+
import { addCoupon as B } from "../api/addCoupon.js";
|
|
4
|
+
import { CouponIcon as G } from "../../../assets/svgs/CouponIcon.js";
|
|
5
|
+
import { SuccessIcon as H } from "../../../assets/svgs/SuccessIcon.js";
|
|
6
|
+
import { removeCoupon as K } from "../api/removeCoupon.js";
|
|
7
|
+
const Z = ({
|
|
8
|
+
orderFormId: t,
|
|
9
|
+
hasItemsInCart: D,
|
|
10
|
+
isIO: r = !1,
|
|
11
|
+
item: a,
|
|
12
|
+
firstCouponName: s,
|
|
13
|
+
secondCouponName: d,
|
|
14
|
+
replaceCoupon: b,
|
|
15
|
+
setView: R,
|
|
16
|
+
setActiveRule: z,
|
|
17
|
+
setDataItem: J,
|
|
18
|
+
setFirstCouponName: L,
|
|
19
|
+
setSecondCouponName: _,
|
|
20
|
+
setReplaceCoupon: j,
|
|
21
|
+
setAlert: f,
|
|
22
|
+
setType: m,
|
|
23
|
+
setIsCloseModalEmpty: y,
|
|
24
|
+
genericTaggingEvent: o,
|
|
25
|
+
addCouponMutation: S,
|
|
26
|
+
removeCouponMutation: i
|
|
11
27
|
}) => {
|
|
12
|
-
const [
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
onClick: C,
|
|
57
|
-
disabled: N,
|
|
58
|
-
children: s && /* @__PURE__ */ e(x, {})
|
|
28
|
+
const [x, u] = V(!1), [k, w] = V(!1);
|
|
29
|
+
q(() => {
|
|
30
|
+
d.toLowerCase() !== a.couponName.toLowerCase() && u(!1), s && !d && s.toLowerCase() === a.couponName.toLowerCase() && u(!0), s && d && b && d.toLowerCase() === a.couponName.toLowerCase() && A(d);
|
|
31
|
+
}, [s, d, b]);
|
|
32
|
+
const A = async (l) => {
|
|
33
|
+
if (D)
|
|
34
|
+
try {
|
|
35
|
+
if (!s || s && b) {
|
|
36
|
+
w(!0);
|
|
37
|
+
const h = r ? await B(t, l) : await S({
|
|
38
|
+
input: {
|
|
39
|
+
orderFormId: t,
|
|
40
|
+
couponId: l
|
|
41
|
+
}
|
|
42
|
+
}), N = r ? h : JSON.parse(h.addCoupon.data);
|
|
43
|
+
j(!1), L(l), _(""), N.error.length <= 0 ? (o == null || o("discount_coupon", {
|
|
44
|
+
name: "cupom aplicado",
|
|
45
|
+
cupomName: l
|
|
46
|
+
}), m("success"), u(!0), r && window.location.reload()) : (o == null || o("discount_coupon", {
|
|
47
|
+
name: "cupom aplicando - cupom incorreto ou expirado",
|
|
48
|
+
cupomName: l,
|
|
49
|
+
objectError: N.error
|
|
50
|
+
}), m("error"), u(!1), L("")), f(!0);
|
|
51
|
+
} else
|
|
52
|
+
_(l), R("overwrite-view");
|
|
53
|
+
} catch (h) {
|
|
54
|
+
o == null || o("discount_coupon", {
|
|
55
|
+
name: "problema na api",
|
|
56
|
+
cupomName: l
|
|
57
|
+
}), u(!1), m("error"), f(!0);
|
|
58
|
+
} finally {
|
|
59
|
+
w(!1);
|
|
60
|
+
}
|
|
61
|
+
else
|
|
62
|
+
o == null || o("discount_coupon", {
|
|
63
|
+
name: "Modal de cart vazio acionado"
|
|
64
|
+
}), y(!0);
|
|
65
|
+
}, M = async () => {
|
|
66
|
+
if (D)
|
|
67
|
+
try {
|
|
68
|
+
w(!0), j(!1);
|
|
69
|
+
const l = r ? await K(t) : await i({
|
|
70
|
+
input: {
|
|
71
|
+
orderFormId: t
|
|
59
72
|
}
|
|
60
|
-
)
|
|
73
|
+
}), h = r ? l : JSON.parse(l.removeCoupon.data);
|
|
74
|
+
h.error.length <= 0 ? (o == null || o("discount_coupon", {
|
|
75
|
+
name: "cupom removido com sucesso",
|
|
76
|
+
cupomName: s
|
|
77
|
+
}), m("removed"), u(!1), L(""), _(""), r && window.location.reload()) : (o == null || o("discount_coupon", {
|
|
78
|
+
name: "algum problema na remoção do cupom",
|
|
79
|
+
cupomName: s,
|
|
80
|
+
objectError: h.error
|
|
81
|
+
}), m("error"), u(!0)), f(!0);
|
|
82
|
+
} catch (l) {
|
|
83
|
+
o == null || o("discount_coupon", {
|
|
84
|
+
name: "problema na api - na remoção do cupom",
|
|
85
|
+
cupomName: s
|
|
86
|
+
}), m("error"), u(!0), f(!0);
|
|
87
|
+
} finally {
|
|
88
|
+
w(!1);
|
|
89
|
+
}
|
|
90
|
+
else
|
|
91
|
+
o == null || o("discount_coupon", {
|
|
92
|
+
name: "Modal de cart vazio acionado"
|
|
93
|
+
}), y(!0);
|
|
94
|
+
}, $ = () => {
|
|
95
|
+
z(!0), J(a), R("rules-view");
|
|
96
|
+
};
|
|
97
|
+
return /* @__PURE__ */ p("div", { className: `container-card-coupon ${x ? "active" : ""}`, children: [
|
|
98
|
+
/* @__PURE__ */ p("div", { className: "text-container", children: [
|
|
99
|
+
/* @__PURE__ */ p("div", { className: "container-title", children: [
|
|
100
|
+
/* @__PURE__ */ c(G, { width: 20, height: 16 }),
|
|
101
|
+
/* @__PURE__ */ c("h3", { className: "title", children: a.couponName })
|
|
61
102
|
] }),
|
|
62
|
-
/* @__PURE__ */
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
o.couponRules && o.couponRules.length > 0 && /* @__PURE__ */ e("button", { className: "see-rules", onClick: p, children: "*Termos & condições" }),
|
|
66
|
-
i && /* @__PURE__ */ n("div", { className: "tooltip-rules", ref: r, children: [
|
|
67
|
-
/* @__PURE__ */ n("div", { className: "tooltip-rules-header", children: [
|
|
68
|
-
/* @__PURE__ */ e("h4", { children: "Termos e Condições" }),
|
|
69
|
-
/* @__PURE__ */ e("button", { onClick: p, children: /* @__PURE__ */ e(b, {}) })
|
|
103
|
+
a.couponValue && /* @__PURE__ */ p("p", { className: "price-badge", children: [
|
|
104
|
+
"- ",
|
|
105
|
+
a.couponValue
|
|
70
106
|
] }),
|
|
71
|
-
/* @__PURE__ */
|
|
72
|
-
/* @__PURE__ */
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
c
|
|
76
|
-
] }, c)),
|
|
77
|
-
/* @__PURE__ */ n("li", { children: [
|
|
78
|
-
"• Válido até ",
|
|
79
|
-
o.couponExpirationDate,
|
|
80
|
-
"."
|
|
81
|
-
] })
|
|
107
|
+
a.couponDescription && /* @__PURE__ */ c("h4", { className: "subtitle", children: a.couponDescription }),
|
|
108
|
+
a.couponExpirationDate && /* @__PURE__ */ p("h4", { className: "subtitle", children: [
|
|
109
|
+
"Válido até ",
|
|
110
|
+
a.couponExpirationDate
|
|
82
111
|
] })
|
|
112
|
+
] }),
|
|
113
|
+
/* @__PURE__ */ c("div", { className: "vertical-line" }),
|
|
114
|
+
/* @__PURE__ */ p("div", { className: "buttons-container", children: [
|
|
115
|
+
x && /* @__PURE__ */ p("button", { className: "applied-coupon", children: [
|
|
116
|
+
/* @__PURE__ */ c("span", { className: "applied-coupon-span", children: /* @__PURE__ */ c(H, {}) }),
|
|
117
|
+
"Aplicado"
|
|
118
|
+
] }),
|
|
119
|
+
x ? /* @__PURE__ */ c(
|
|
120
|
+
"button",
|
|
121
|
+
{
|
|
122
|
+
onClick: M,
|
|
123
|
+
className: "remove-coupon",
|
|
124
|
+
disabled: k,
|
|
125
|
+
children: "Remover"
|
|
126
|
+
}
|
|
127
|
+
) : /* @__PURE__ */ c(
|
|
128
|
+
"button",
|
|
129
|
+
{
|
|
130
|
+
onClick: () => A(a.couponName),
|
|
131
|
+
className: "apply-coupon",
|
|
132
|
+
disabled: k,
|
|
133
|
+
children: "Aplicar"
|
|
134
|
+
}
|
|
135
|
+
),
|
|
136
|
+
a.couponDescription && /* @__PURE__ */ c("a", { onClick: $, children: "Ver Regras" })
|
|
83
137
|
] })
|
|
84
|
-
] })
|
|
138
|
+
] });
|
|
85
139
|
};
|
|
86
140
|
export {
|
|
87
|
-
|
|
141
|
+
Z as CouponCard
|
|
88
142
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ModalHeaderProps } from './ModalHeader';
|
|
2
|
+
import { ModalFooterProps } from './ModalFooter';
|
|
3
|
+
|
|
4
|
+
interface ModalProps extends ModalHeaderProps, ModalFooterProps {
|
|
5
|
+
isIO?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export declare const Modal: ({ children, isIO, closeModal, title, genericTaggingEvent, cancelButtonAction, ...modalFooterProps }: React.PropsWithChildren<ModalProps>) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
var x = Object.defineProperty;
|
|
2
|
+
var m = Object.getOwnPropertySymbols;
|
|
3
|
+
var c = Object.prototype.hasOwnProperty, n = Object.prototype.propertyIsEnumerable;
|
|
4
|
+
var i = (r, e, o) => e in r ? x(r, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : r[e] = o, p = (r, e) => {
|
|
5
|
+
for (var o in e || (e = {}))
|
|
6
|
+
c.call(e, o) && i(r, o, e[o]);
|
|
7
|
+
if (m)
|
|
8
|
+
for (var o of m(e))
|
|
9
|
+
n.call(e, o) && i(r, o, e[o]);
|
|
10
|
+
return r;
|
|
11
|
+
};
|
|
12
|
+
var u = (r, e) => {
|
|
13
|
+
var o = {};
|
|
14
|
+
for (var a in r)
|
|
15
|
+
c.call(r, a) && e.indexOf(a) < 0 && (o[a] = r[a]);
|
|
16
|
+
if (r != null && m)
|
|
17
|
+
for (var a of m(r))
|
|
18
|
+
e.indexOf(a) < 0 && n.call(r, a) && (o[a] = r[a]);
|
|
19
|
+
return o;
|
|
20
|
+
};
|
|
21
|
+
import { jsx as l, jsxs as h } from "react/jsx-runtime";
|
|
22
|
+
import { ModalHeader as v } from "./ModalHeader.js";
|
|
23
|
+
import { Breadcrumb as M } from "./Breadcrumb.js";
|
|
24
|
+
import { ModalFooter as N } from "./ModalFooter.js";
|
|
25
|
+
const q = (j) => {
|
|
26
|
+
var s = j, {
|
|
27
|
+
children: r,
|
|
28
|
+
isIO: e = !1,
|
|
29
|
+
closeModal: o,
|
|
30
|
+
title: a,
|
|
31
|
+
genericTaggingEvent: f,
|
|
32
|
+
cancelButtonAction: d
|
|
33
|
+
} = s, t = u(s, [
|
|
34
|
+
"children",
|
|
35
|
+
"isIO",
|
|
36
|
+
"closeModal",
|
|
37
|
+
"title",
|
|
38
|
+
"genericTaggingEvent",
|
|
39
|
+
"cancelButtonAction"
|
|
40
|
+
]);
|
|
41
|
+
return /* @__PURE__ */ l("div", { className: "modal-rule-coupon-external", children: /* @__PURE__ */ h("div", { className: "modal-rule-coupon-internal", children: [
|
|
42
|
+
/* @__PURE__ */ l(
|
|
43
|
+
v,
|
|
44
|
+
{
|
|
45
|
+
closeModal: o,
|
|
46
|
+
title: a,
|
|
47
|
+
genericTaggingEvent: f
|
|
48
|
+
}
|
|
49
|
+
),
|
|
50
|
+
e && /* @__PURE__ */ l(M, { title: a, cancelButtonAction: d }),
|
|
51
|
+
/* @__PURE__ */ l("div", { className: "modal-rule-coupon-children", children: r }),
|
|
52
|
+
/* @__PURE__ */ l(
|
|
53
|
+
N,
|
|
54
|
+
p({
|
|
55
|
+
cancelButtonAction: d
|
|
56
|
+
}, t)
|
|
57
|
+
)
|
|
58
|
+
] }) });
|
|
59
|
+
};
|
|
60
|
+
export {
|
|
61
|
+
q as Modal
|
|
62
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface ModalFooterProps {
|
|
2
|
+
cancelButtonAction: () => void;
|
|
3
|
+
cancelButtonText: string;
|
|
4
|
+
confirmButtonAction?: () => void;
|
|
5
|
+
confirmButtonText?: string;
|
|
6
|
+
isFloating?: boolean;
|
|
7
|
+
redirectionClubText?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const ModalFooter: ({ cancelButtonAction, cancelButtonText, confirmButtonAction, confirmButtonText, isFloating, redirectionClubText }: ModalFooterProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsxs as e, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
const d = ({
|
|
3
|
+
cancelButtonAction: t,
|
|
4
|
+
cancelButtonText: r,
|
|
5
|
+
confirmButtonAction: c,
|
|
6
|
+
confirmButtonText: l,
|
|
7
|
+
isFloating: a,
|
|
8
|
+
redirectionClubText: n
|
|
9
|
+
}) => /* @__PURE__ */ e("div", { className: `modal-footer-container ${a ? "floating" : ""}`, children: [
|
|
10
|
+
c && l && /* @__PURE__ */ o("button", { onClick: c, className: "modal-confirm-button", children: l }),
|
|
11
|
+
/* @__PURE__ */ o("button", { onClick: t, className: "modal-cancel-button", children: r }),
|
|
12
|
+
n && /* @__PURE__ */ o(
|
|
13
|
+
"button",
|
|
14
|
+
{
|
|
15
|
+
onClick: () => {
|
|
16
|
+
window.location.href = "/s/?clubProducts";
|
|
17
|
+
},
|
|
18
|
+
className: "modal-confirm-button redirection-club-button",
|
|
19
|
+
children: n
|
|
20
|
+
}
|
|
21
|
+
)
|
|
22
|
+
] });
|
|
23
|
+
export {
|
|
24
|
+
d as ModalFooter
|
|
25
|
+
};
|