@plurix/ecom-components 1.14.3-com2034.0 → 1.15.0-loyalty.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/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/ChangeOrderModal/ChangeOrderModal.d.ts +3 -3
- package/dist/packages/ChangeOrderModal/ChangeOrderModal.js +73 -71
- package/dist/packages/ChangeOrderModal/components/ModalFooter.d.ts +1 -4
- package/dist/packages/ChangeOrderModal/components/ModalFooter.js +1 -3
- package/dist/packages/ChangeOrderModal/components/SimilarProductList.d.ts +3 -2
- package/dist/packages/ChangeOrderModal/components/SimilarProducts.d.ts +5 -4
- package/dist/packages/ChangeOrderModal/components/SimilarProducts.js +21 -21
- package/dist/packages/ChangeOrderModal/mocks.d.ts +0 -1
- package/dist/packages/ChangeOrderModal/mocks.js +0 -1
- package/dist/packages/Coupons/Coupons.d.ts +3 -17
- package/dist/packages/Coupons/Coupons.js +76 -114
- package/dist/packages/Coupons/api/addCoupon.d.ts +1 -1
- package/dist/packages/Coupons/api/addCoupon.js +7 -7
- package/dist/packages/Coupons/api/getCoupons.d.ts +1 -1
- package/dist/packages/Coupons/api/getCoupons.js +4 -4
- package/dist/packages/Coupons/api/removeCoupon.d.ts +1 -1
- package/dist/packages/Coupons/api/removeCoupon.js +6 -6
- 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 +34 -0
- package/dist/packages/Coupons/hooks/useCoupons.js +109 -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/change-order-modal.global.css +1 -1
- package/dist/styles/coupons.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 +69 -69
- 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,8 +1,8 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { Modal as
|
|
4
|
-
import { ProductSelected as
|
|
5
|
-
import { SimilarProducts as
|
|
1
|
+
import { jsx as a, jsxs as E, Fragment as J } from "react/jsx-runtime";
|
|
2
|
+
import { useState as f, useEffect as M } from "react";
|
|
3
|
+
import { Modal as _ } from "../Modal/Modal.js";
|
|
4
|
+
import { ProductSelected as v } from "./components/ProductSelected.js";
|
|
5
|
+
import { SimilarProducts as L } from "./components/SimilarProducts.js";
|
|
6
6
|
import { ModalFooter as T } from "./components/ModalFooter.js";
|
|
7
7
|
/* empty css */import { getProductsSimilars as $ } from "./api/getProductsSimilars.js";
|
|
8
8
|
import z from "../../hooks/useAnalitcsEvents.js";
|
|
@@ -10,82 +10,84 @@ import { NoSimilarProduct as B } from "./components/NoSimilarProduct.js";
|
|
|
10
10
|
import { getOrderForm as G } from "./api/getOrderForm.js";
|
|
11
11
|
import { postChangeOrder as H } from "./api/postChangeOrder.js";
|
|
12
12
|
import { Skeleton as K } from "../Skeleton/index.js";
|
|
13
|
-
const
|
|
14
|
-
selectedItem:
|
|
15
|
-
postalCode:
|
|
16
|
-
orderFormId:
|
|
17
|
-
isClubClient:
|
|
18
|
-
isOpen:
|
|
19
|
-
environment:
|
|
20
|
-
setIsOpen:
|
|
21
|
-
saveSelectedSimilarProduct:
|
|
13
|
+
const ao = ({
|
|
14
|
+
selectedItem: o,
|
|
15
|
+
postalCode: S,
|
|
16
|
+
orderFormId: d,
|
|
17
|
+
isClubClient: O,
|
|
18
|
+
isOpen: y,
|
|
19
|
+
environment: b,
|
|
20
|
+
setIsOpen: p,
|
|
21
|
+
saveSelectedSimilarProduct: c,
|
|
22
22
|
getOrderFormMutation: l,
|
|
23
|
-
getProductsSimilarsMutation:
|
|
24
|
-
postChangeOrderMutation:
|
|
23
|
+
getProductsSimilarsMutation: C,
|
|
24
|
+
postChangeOrderMutation: F
|
|
25
25
|
}) => {
|
|
26
|
-
const [
|
|
27
|
-
|
|
26
|
+
const [s, P] = f(), [x, m] = f(!1), r = b === "io", { genericTaggingEvent: N } = z(), [t, g] = f({ itemId: "" });
|
|
27
|
+
M(() => {
|
|
28
28
|
(async () => {
|
|
29
|
-
|
|
30
|
-
h(!0);
|
|
29
|
+
m(!0);
|
|
31
30
|
try {
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
31
|
+
const i = await $({
|
|
32
|
+
postalCode: S,
|
|
33
|
+
selectedItem: o,
|
|
34
|
+
isIO: r,
|
|
35
|
+
getProductsSimilarsMutation: C
|
|
36
|
+
}), u = (i == null ? void 0 : i.products) || [];
|
|
37
|
+
P(u);
|
|
38
|
+
} finally {
|
|
39
|
+
m(!1);
|
|
40
|
+
}
|
|
41
|
+
})(), (async () => {
|
|
42
|
+
var i, u;
|
|
43
|
+
m(!0);
|
|
44
|
+
try {
|
|
45
|
+
const q = r && G(d, r), w = l && await l({
|
|
46
|
+
input: {
|
|
47
|
+
orderFormId: d
|
|
48
|
+
}
|
|
49
|
+
}) || { getOrderForm: { data: "" } }, e = r ? q : JSON.parse(w.getOrderForm.data), n = ((u = (i = e == null ? void 0 : e.customData) == null ? void 0 : i.customApps) == null ? void 0 : u.find(
|
|
50
|
+
(A) => A.id === "janis"
|
|
49
51
|
)) || null;
|
|
50
|
-
let
|
|
51
|
-
n != null && n.fields.idSubstitutionCriterias && (
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
let h = {};
|
|
53
|
+
n != null && n.fields.idSubstitutionCriterias && (h = JSON.parse(
|
|
54
|
+
n == null ? void 0 : n.fields.idSubstitutionCriterias
|
|
55
|
+
));
|
|
56
|
+
const k = o == null ? void 0 : o.productOriginId;
|
|
57
|
+
g({
|
|
58
|
+
itemId: `${h[k]}`
|
|
55
59
|
});
|
|
56
60
|
} finally {
|
|
57
|
-
|
|
61
|
+
m(!1);
|
|
58
62
|
}
|
|
59
63
|
})();
|
|
60
64
|
}, []);
|
|
61
|
-
const
|
|
62
|
-
var u;
|
|
65
|
+
const j = () => {
|
|
63
66
|
H(
|
|
64
|
-
|
|
67
|
+
d,
|
|
65
68
|
r,
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
),
|
|
70
|
-
name:
|
|
71
|
-
replacement_item:
|
|
72
|
-
})),
|
|
69
|
+
o.productOriginId,
|
|
70
|
+
t.itemId,
|
|
71
|
+
F
|
|
72
|
+
), t && (c == null || c(t), N("salvar_substituto", {
|
|
73
|
+
name: o.name,
|
|
74
|
+
replacement_item: t == null ? void 0 : t.name
|
|
75
|
+
})), p(!1);
|
|
73
76
|
};
|
|
74
|
-
return /* @__PURE__ */
|
|
75
|
-
|
|
77
|
+
return /* @__PURE__ */ a(
|
|
78
|
+
_,
|
|
76
79
|
{
|
|
77
|
-
isOpen:
|
|
78
|
-
setIsOpen:
|
|
80
|
+
isOpen: y,
|
|
81
|
+
setIsOpen: p,
|
|
79
82
|
className: "change-order-modal",
|
|
80
83
|
title: "Produto com estoque baixo",
|
|
81
|
-
Footer:
|
|
84
|
+
Footer: s && s.length > 0 && /* @__PURE__ */ a(
|
|
82
85
|
T,
|
|
83
86
|
{
|
|
84
|
-
saveSelectedSimilarProduct:
|
|
85
|
-
similarProductSelect: o
|
|
87
|
+
saveSelectedSimilarProduct: j
|
|
86
88
|
}
|
|
87
89
|
),
|
|
88
|
-
children:
|
|
90
|
+
children: x ? /* @__PURE__ */ a(
|
|
89
91
|
K,
|
|
90
92
|
{
|
|
91
93
|
width: r ? "100%" : "90%",
|
|
@@ -94,21 +96,21 @@ const no = ({
|
|
|
94
96
|
margin: "auto",
|
|
95
97
|
animation: !0
|
|
96
98
|
}
|
|
97
|
-
) : /* @__PURE__ */
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
) : /* @__PURE__ */ E(J, { children: [
|
|
100
|
+
o && /* @__PURE__ */ a(v, { selectedItem: o }),
|
|
101
|
+
s && s.length > 0 ? /* @__PURE__ */ a(
|
|
102
|
+
L,
|
|
101
103
|
{
|
|
102
|
-
isClubClient:
|
|
103
|
-
similarProductSelect:
|
|
104
|
-
setSimilarProductSelect:
|
|
105
|
-
products:
|
|
104
|
+
isClubClient: O,
|
|
105
|
+
similarProductSelect: t,
|
|
106
|
+
setSimilarProductSelect: g,
|
|
107
|
+
products: s
|
|
106
108
|
}
|
|
107
|
-
) : /* @__PURE__ */
|
|
109
|
+
) : /* @__PURE__ */ a(B, {})
|
|
108
110
|
] })
|
|
109
111
|
}
|
|
110
112
|
);
|
|
111
113
|
};
|
|
112
114
|
export {
|
|
113
|
-
|
|
115
|
+
ao as ChangeOrderModal
|
|
114
116
|
};
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare const ModalFooter: ({ saveSelectedSimilarProduct, similarProductSelect }: {
|
|
1
|
+
export declare const ModalFooter: ({ saveSelectedSimilarProduct }: {
|
|
4
2
|
saveSelectedSimilarProduct?: () => void;
|
|
5
|
-
similarProductSelect: SimilarProducts | undefined;
|
|
6
3
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { jsx as n } from "react/jsx-runtime";
|
|
2
2
|
const t = ({
|
|
3
|
-
saveSelectedSimilarProduct: o
|
|
4
|
-
similarProductSelect: r
|
|
3
|
+
saveSelectedSimilarProduct: o
|
|
5
4
|
}) => /* @__PURE__ */ n("div", { className: "change-order-moda-footer", children: /* @__PURE__ */ n(
|
|
6
5
|
"button",
|
|
7
6
|
{
|
|
8
7
|
onClick: () => o == null ? void 0 : o(),
|
|
9
8
|
className: "change-order-save-buttom",
|
|
10
|
-
disabled: !r,
|
|
11
9
|
children: "Salvar Substituto"
|
|
12
10
|
}
|
|
13
11
|
) });
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
1
2
|
import { SimilarProducts } from '../../../types/ChangeOrderModal';
|
|
2
3
|
|
|
3
4
|
export declare const SimilarProductItem: ({ similarProduct, similarProductSelect, setSimilarProductSelect, isClubClient }: {
|
|
4
|
-
similarProductSelect: SimilarProducts
|
|
5
|
-
setSimilarProductSelect:
|
|
5
|
+
similarProductSelect: SimilarProducts;
|
|
6
|
+
setSimilarProductSelect: Dispatch<SetStateAction<SimilarProducts>>;
|
|
6
7
|
similarProduct: SimilarProducts;
|
|
7
8
|
isClubClient?: boolean;
|
|
8
9
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { Dispatch, SetStateAction } from 'react';
|
|
1
2
|
import { SimilarProducts as SimilarProductProps } from '../../../types/ChangeOrderModal';
|
|
2
3
|
|
|
3
4
|
interface Props {
|
|
4
|
-
products
|
|
5
|
-
similarProductSelect: SimilarProductProps
|
|
6
|
-
setSimilarProductSelect:
|
|
5
|
+
products?: SimilarProductProps[];
|
|
6
|
+
similarProductSelect: SimilarProductProps;
|
|
7
|
+
setSimilarProductSelect: Dispatch<SetStateAction<SimilarProductProps>>;
|
|
7
8
|
isClubClient?: boolean;
|
|
8
9
|
}
|
|
9
|
-
export declare const SimilarProducts: ({ products, isClubClient, similarProductSelect, setSimilarProductSelect }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const SimilarProducts: ({ products, isClubClient, similarProductSelect, setSimilarProductSelect }: Props) => import("react/jsx-runtime").JSX.Element | null;
|
|
10
11
|
export {};
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { Icons as
|
|
3
|
-
import { SimilarProductItem as
|
|
4
|
-
const
|
|
1
|
+
import { jsxs as r, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { Icons as h } from "../assets/icons.js";
|
|
3
|
+
import { SimilarProductItem as t } from "./SimilarProductList.js";
|
|
4
|
+
const I = ({
|
|
5
5
|
products: m,
|
|
6
|
-
isClubClient:
|
|
7
|
-
similarProductSelect:
|
|
8
|
-
setSimilarProductSelect:
|
|
9
|
-
}) => /* @__PURE__ */
|
|
10
|
-
/* @__PURE__ */
|
|
11
|
-
/* @__PURE__ */
|
|
12
|
-
|
|
6
|
+
isClubClient: s,
|
|
7
|
+
similarProductSelect: a,
|
|
8
|
+
setSimilarProductSelect: n
|
|
9
|
+
}) => m != null && m.length ? /* @__PURE__ */ r("section", { className: "change-order-similar-products", children: [
|
|
10
|
+
/* @__PURE__ */ i("h3", { className: "title", children: "Na falta substitua por:" }),
|
|
11
|
+
/* @__PURE__ */ i("div", { className: "similar-product-list", children: m.map((o) => /* @__PURE__ */ i(
|
|
12
|
+
t,
|
|
13
13
|
{
|
|
14
|
-
isClubClient:
|
|
15
|
-
similarProductSelect:
|
|
16
|
-
setSimilarProductSelect:
|
|
17
|
-
similarProduct:
|
|
14
|
+
isClubClient: s,
|
|
15
|
+
similarProductSelect: a,
|
|
16
|
+
setSimilarProductSelect: n,
|
|
17
|
+
similarProduct: o
|
|
18
18
|
},
|
|
19
|
-
|
|
19
|
+
o.itemId
|
|
20
20
|
)) }),
|
|
21
|
-
|
|
21
|
+
a && /* @__PURE__ */ r(
|
|
22
22
|
"button",
|
|
23
23
|
{
|
|
24
|
-
onClick: () =>
|
|
24
|
+
onClick: () => n == null ? void 0 : n({ itemId: "" }),
|
|
25
25
|
className: "remove-buttom",
|
|
26
26
|
children: [
|
|
27
|
-
/* @__PURE__ */
|
|
27
|
+
/* @__PURE__ */ i(h, { iconId: "Trash" }),
|
|
28
28
|
" Remover substituto"
|
|
29
29
|
]
|
|
30
30
|
}
|
|
31
31
|
)
|
|
32
|
-
] });
|
|
32
|
+
] }) : null;
|
|
33
33
|
export {
|
|
34
|
-
|
|
34
|
+
I as SimilarProducts
|
|
35
35
|
};
|
|
@@ -1,20 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { UseCouponsParams } from './hooks/useCoupons';
|
|
2
2
|
|
|
3
|
-
interface CouponsProps {
|
|
4
|
-
orderFormId: string;
|
|
5
|
-
hasItemsInCart: boolean;
|
|
6
|
-
builder: 'faststore' | 'app';
|
|
7
|
-
account: string;
|
|
8
|
-
isIO?: boolean;
|
|
9
|
-
closeIOModal?: () => void;
|
|
10
|
-
activeOrderFormCoupon?: string;
|
|
11
|
-
genericTaggingEvent?: (name: string, params: object) => void;
|
|
12
|
-
disableFirstEmptyModal?: boolean;
|
|
13
|
-
couponsList?: CouponType[];
|
|
14
|
-
qtdCouponsView?: number;
|
|
15
|
-
getCouponsMutation?: any;
|
|
16
|
-
addCouponMutation?: any;
|
|
17
|
-
removeCouponMutation?: any;
|
|
3
|
+
interface CouponsProps extends UseCouponsParams {
|
|
18
4
|
}
|
|
19
|
-
export declare const Coupons: (
|
|
5
|
+
export declare const Coupons: (props: CouponsProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
6
|
export {};
|
|
@@ -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,3 +1,3 @@
|
|
|
1
1
|
import { SetOrderFormCouponResponse } from '../types/SetOrderFormCouponResponse';
|
|
2
2
|
|
|
3
|
-
export declare const addCoupon: (orderFormId: string, couponId: string) => Promise<SetOrderFormCouponResponse>;
|
|
3
|
+
export declare const addCoupon: (account: string, orderFormId: string, couponId: string) => Promise<SetOrderFormCouponResponse>;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import r from "axios";
|
|
2
|
-
const
|
|
3
|
-
const { data:
|
|
4
|
-
|
|
2
|
+
const s = async (o, t, a) => {
|
|
3
|
+
const { data: p } = await r.post(
|
|
4
|
+
`https://${o}.vtex.app/api/coupon/order`,
|
|
5
5
|
{
|
|
6
|
-
orderFormId:
|
|
7
|
-
couponId:
|
|
6
|
+
orderFormId: t,
|
|
7
|
+
couponId: a
|
|
8
8
|
}
|
|
9
9
|
);
|
|
10
|
-
return
|
|
10
|
+
return p;
|
|
11
11
|
};
|
|
12
12
|
export {
|
|
13
|
-
|
|
13
|
+
s as addCoupon
|
|
14
14
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { CouponType } from '../types/CouponType';
|
|
2
2
|
|
|
3
|
-
export declare const getCoupons: (builder: 'app' | 'faststore', couponsList?: CouponType[]) => Promise<CouponType[]>;
|
|
3
|
+
export declare const getCoupons: (account: string, builder: 'app' | 'faststore', couponsList?: CouponType[]) => Promise<CouponType[]>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
const
|
|
3
|
-
const
|
|
1
|
+
import o from "axios";
|
|
2
|
+
const e = async (n, p, t) => {
|
|
3
|
+
const a = `https://${n}.vtex.app/api/coupon/list`, s = Math.random(), { data: r } = t ? await o.post(a, { couponsList: t }) : await o.get(a, { params: { builder: p, random: s } });
|
|
4
4
|
return r.coupons;
|
|
5
5
|
};
|
|
6
6
|
export {
|
|
7
|
-
|
|
7
|
+
e as getCoupons
|
|
8
8
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { SetOrderFormCouponResponse } from '../types/SetOrderFormCouponResponse';
|
|
2
2
|
|
|
3
|
-
export declare const removeCoupon: (orderFormId: string) => Promise<SetOrderFormCouponResponse>;
|
|
3
|
+
export declare const removeCoupon: (account: string, orderFormId: string) => Promise<SetOrderFormCouponResponse>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
const r = async (o) => {
|
|
3
|
-
const { data:
|
|
4
|
-
|
|
1
|
+
import e from "axios";
|
|
2
|
+
const r = async (o, t) => {
|
|
3
|
+
const { data: a } = await e.delete(
|
|
4
|
+
`https://${o}.vtex.app/api/coupon/order`,
|
|
5
5
|
{
|
|
6
|
-
data: { orderFormId:
|
|
6
|
+
data: { orderFormId: t }
|
|
7
7
|
}
|
|
8
8
|
);
|
|
9
|
-
return
|
|
9
|
+
return a;
|
|
10
10
|
};
|
|
11
11
|
export {
|
|
12
12
|
r as removeCoupon
|
|
@@ -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 {};
|