@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,6 +1,8 @@
|
|
|
1
1
|
import { Dispatch, SetStateAction } from 'react';
|
|
2
2
|
import { SelectedItemProps } from './components/ProductSelected';
|
|
3
3
|
import { SimilarProducts as SimilarProductsProps } from '../../types/ChangeOrderModal';
|
|
4
|
+
import { GetProductsSimilarsResponse } from './api/getProductsSimilars';
|
|
5
|
+
import { PostChangeOrderMutationResponse } from './api/postChangeOrder';
|
|
4
6
|
|
|
5
7
|
export interface ChangeOrderModalProps {
|
|
6
8
|
postalCode: string;
|
|
@@ -11,8 +13,17 @@ export interface ChangeOrderModalProps {
|
|
|
11
13
|
isClubClient?: boolean;
|
|
12
14
|
orderFormId: string;
|
|
13
15
|
saveSelectedSimilarProduct?: (similarProduct: SimilarProductsProps | undefined) => void;
|
|
16
|
+
getOrderFormMutation?: (variables: {}) => Promise<CustomDataMutationResponse>;
|
|
17
|
+
getProductsSimilarsMutation?: (variables: {}) => Promise<GetProductsSimilarsResponse>;
|
|
18
|
+
postChangeOrderMutation?: (variables: {}) => Promise<PostChangeOrderMutationResponse>;
|
|
19
|
+
}
|
|
20
|
+
interface CustomDataMutationResponse {
|
|
21
|
+
getOrderForm: {
|
|
22
|
+
data: string;
|
|
23
|
+
};
|
|
14
24
|
}
|
|
15
25
|
export interface idSubstitutionCriteriasProps {
|
|
16
26
|
[key: string]: string;
|
|
17
27
|
}
|
|
18
|
-
export declare const ChangeOrderModal: ({ selectedItem, postalCode, orderFormId, isClubClient, isOpen, environment, setIsOpen, saveSelectedSimilarProduct }: ChangeOrderModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
28
|
+
export declare const ChangeOrderModal: ({ selectedItem, postalCode, orderFormId, isClubClient, isOpen, environment, setIsOpen, saveSelectedSimilarProduct, getOrderFormMutation, getProductsSimilarsMutation, postChangeOrderMutation }: ChangeOrderModalProps) => import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
export {};
|
|
@@ -1,105 +1,116 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { Modal as
|
|
4
|
-
import { ProductSelected as
|
|
5
|
-
import { SimilarProducts as
|
|
6
|
-
import { ModalFooter as
|
|
7
|
-
/* empty css */import { getProductsSimilars as
|
|
8
|
-
import
|
|
9
|
-
import { NoSimilarProduct as
|
|
10
|
-
import { getOrderForm as
|
|
11
|
-
import { postChangeOrder as
|
|
12
|
-
import { Skeleton as
|
|
13
|
-
const
|
|
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
|
+
import { ModalFooter as T } from "./components/ModalFooter.js";
|
|
7
|
+
/* empty css */import { getProductsSimilars as $ } from "./api/getProductsSimilars.js";
|
|
8
|
+
import z from "../../hooks/useAnalitcsEvents.js";
|
|
9
|
+
import { NoSimilarProduct as B } from "./components/NoSimilarProduct.js";
|
|
10
|
+
import { getOrderForm as G } from "./api/getOrderForm.js";
|
|
11
|
+
import { postChangeOrder as H } from "./api/postChangeOrder.js";
|
|
12
|
+
import { Skeleton as K } from "../Skeleton/index.js";
|
|
13
|
+
const ao = ({
|
|
14
14
|
selectedItem: o,
|
|
15
15
|
postalCode: S,
|
|
16
|
-
orderFormId:
|
|
17
|
-
isClubClient:
|
|
16
|
+
orderFormId: d,
|
|
17
|
+
isClubClient: O,
|
|
18
18
|
isOpen: y,
|
|
19
|
-
environment:
|
|
20
|
-
setIsOpen:
|
|
21
|
-
saveSelectedSimilarProduct:
|
|
19
|
+
environment: b,
|
|
20
|
+
setIsOpen: p,
|
|
21
|
+
saveSelectedSimilarProduct: c,
|
|
22
|
+
getOrderFormMutation: l,
|
|
23
|
+
getProductsSimilarsMutation: C,
|
|
24
|
+
postChangeOrderMutation: F
|
|
22
25
|
}) => {
|
|
23
|
-
const [
|
|
24
|
-
|
|
26
|
+
const [s, P] = f(), [x, m] = f(!1), r = b === "io", { genericTaggingEvent: N } = z(), [t, g] = f({ itemId: "" });
|
|
27
|
+
M(() => {
|
|
25
28
|
(async () => {
|
|
26
|
-
|
|
29
|
+
m(!0);
|
|
27
30
|
try {
|
|
28
|
-
const
|
|
31
|
+
const i = await $({
|
|
29
32
|
postalCode: S,
|
|
30
33
|
selectedItem: o,
|
|
31
|
-
isIO:
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
isIO: r,
|
|
35
|
+
getProductsSimilarsMutation: C
|
|
36
|
+
}), u = (i == null ? void 0 : i.products) || [];
|
|
37
|
+
P(u);
|
|
34
38
|
} finally {
|
|
35
|
-
|
|
39
|
+
m(!1);
|
|
36
40
|
}
|
|
37
41
|
})(), (async () => {
|
|
38
|
-
var
|
|
39
|
-
|
|
42
|
+
var i, u;
|
|
43
|
+
m(!0);
|
|
40
44
|
try {
|
|
41
|
-
const
|
|
42
|
-
|
|
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"
|
|
43
51
|
)) || null;
|
|
44
|
-
let
|
|
45
|
-
|
|
46
|
-
|
|
52
|
+
let h = {};
|
|
53
|
+
n != null && n.fields.idSubstitutionCriterias && (h = JSON.parse(
|
|
54
|
+
n == null ? void 0 : n.fields.idSubstitutionCriterias
|
|
47
55
|
));
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
itemId: `${
|
|
56
|
+
const k = o == null ? void 0 : o.productOriginId;
|
|
57
|
+
g({
|
|
58
|
+
itemId: `${h[k]}`
|
|
51
59
|
});
|
|
52
60
|
} finally {
|
|
53
|
-
|
|
61
|
+
m(!1);
|
|
54
62
|
}
|
|
55
63
|
})();
|
|
56
|
-
}, [])
|
|
57
|
-
|
|
64
|
+
}, []);
|
|
65
|
+
const j = () => {
|
|
66
|
+
H(
|
|
67
|
+
d,
|
|
68
|
+
r,
|
|
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);
|
|
76
|
+
};
|
|
77
|
+
return /* @__PURE__ */ a(
|
|
78
|
+
_,
|
|
58
79
|
{
|
|
59
80
|
isOpen: y,
|
|
60
|
-
setIsOpen:
|
|
81
|
+
setIsOpen: p,
|
|
61
82
|
className: "change-order-modal",
|
|
62
83
|
title: "Produto com estoque baixo",
|
|
63
|
-
Footer: /* @__PURE__ */
|
|
64
|
-
|
|
84
|
+
Footer: s && s.length > 0 && /* @__PURE__ */ a(
|
|
85
|
+
T,
|
|
65
86
|
{
|
|
66
|
-
saveSelectedSimilarProduct:
|
|
67
|
-
L(
|
|
68
|
-
f,
|
|
69
|
-
a,
|
|
70
|
-
o.productOriginId,
|
|
71
|
-
r.itemId
|
|
72
|
-
), r && (m == null || m(r), C("salvar_substituto", {
|
|
73
|
-
name: o.name,
|
|
74
|
-
replacement_item: r == null ? void 0 : r.name
|
|
75
|
-
})), l(!1);
|
|
76
|
-
}
|
|
87
|
+
saveSelectedSimilarProduct: j
|
|
77
88
|
}
|
|
78
89
|
),
|
|
79
|
-
children:
|
|
80
|
-
|
|
90
|
+
children: x ? /* @__PURE__ */ a(
|
|
91
|
+
K,
|
|
81
92
|
{
|
|
82
|
-
width:
|
|
83
|
-
height:
|
|
93
|
+
width: r ? "100%" : "90%",
|
|
94
|
+
height: r ? 600 : 425,
|
|
84
95
|
backgroundColor: "var(--color-grayScale-faded)",
|
|
85
96
|
margin: "auto",
|
|
86
97
|
animation: !0
|
|
87
98
|
}
|
|
88
|
-
) : /* @__PURE__ */
|
|
89
|
-
o && /* @__PURE__ */
|
|
90
|
-
|
|
91
|
-
|
|
99
|
+
) : /* @__PURE__ */ E(J, { children: [
|
|
100
|
+
o && /* @__PURE__ */ a(v, { selectedItem: o }),
|
|
101
|
+
s && s.length > 0 ? /* @__PURE__ */ a(
|
|
102
|
+
L,
|
|
92
103
|
{
|
|
93
|
-
isClubClient:
|
|
94
|
-
similarProductSelect:
|
|
95
|
-
setSimilarProductSelect:
|
|
96
|
-
products:
|
|
104
|
+
isClubClient: O,
|
|
105
|
+
similarProductSelect: t,
|
|
106
|
+
setSimilarProductSelect: g,
|
|
107
|
+
products: s
|
|
97
108
|
}
|
|
98
|
-
) : /* @__PURE__ */
|
|
109
|
+
) : /* @__PURE__ */ a(B, {})
|
|
99
110
|
] })
|
|
100
111
|
}
|
|
101
112
|
);
|
|
102
113
|
};
|
|
103
114
|
export {
|
|
104
|
-
|
|
115
|
+
ao as ChangeOrderModal
|
|
105
116
|
};
|
|
@@ -1,21 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
const c = async (
|
|
1
|
+
import e from "axios";
|
|
2
|
+
const c = async (o, t) => {
|
|
3
3
|
try {
|
|
4
|
-
if (
|
|
5
|
-
const { data:
|
|
6
|
-
`/api/checkout/pub/orderForm/${
|
|
4
|
+
if (t) {
|
|
5
|
+
const { data: r } = await e.post(
|
|
6
|
+
`/api/checkout/pub/orderForm/${o}`
|
|
7
7
|
);
|
|
8
|
-
return
|
|
8
|
+
return r;
|
|
9
9
|
}
|
|
10
|
-
const { data: r } = await o.post("/_v/faststoreapi/proxy", {
|
|
11
|
-
targetUrl: `/api/checkout/pub/orderForm/${t}`,
|
|
12
|
-
method: "GET",
|
|
13
|
-
headers: {
|
|
14
|
-
"Content-Type": "application/json",
|
|
15
|
-
Accept: "application/json"
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
return r;
|
|
19
10
|
} catch (r) {
|
|
20
11
|
console.error("Error in Change Order Modal", r);
|
|
21
12
|
}
|
|
@@ -4,9 +4,12 @@ interface GetProductsSimilarsProps {
|
|
|
4
4
|
postalCode: string;
|
|
5
5
|
isIO: boolean;
|
|
6
6
|
selectedItem: SelectedItemProps;
|
|
7
|
+
getProductsSimilarsMutation?: (variables: {}) => Promise<GetProductsSimilarsResponse>;
|
|
7
8
|
}
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
9
|
+
export interface GetProductsSimilarsResponse {
|
|
10
|
+
getProductsSimilars: {
|
|
11
|
+
data: string;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export declare const getProductsSimilars: ({ postalCode, isIO, selectedItem, getProductsSimilarsMutation }: GetProductsSimilarsProps) => Promise<any>;
|
|
12
15
|
export {};
|
|
@@ -1,33 +1,34 @@
|
|
|
1
|
-
import
|
|
2
|
-
const
|
|
3
|
-
postalCode:
|
|
4
|
-
isIO:
|
|
5
|
-
selectedItem: r
|
|
1
|
+
import c from "axios";
|
|
2
|
+
const P = async ({
|
|
3
|
+
postalCode: n,
|
|
4
|
+
isIO: u,
|
|
5
|
+
selectedItem: r,
|
|
6
|
+
getProductsSimilarsMutation: a
|
|
6
7
|
}) => {
|
|
7
8
|
try {
|
|
8
|
-
if (
|
|
9
|
-
const { data: o } = await
|
|
10
|
-
`/_v/commerce/products/productsSimilar?postalCode=${
|
|
11
|
-
), { similarProducts:
|
|
12
|
-
return
|
|
13
|
-
(
|
|
9
|
+
if (u) {
|
|
10
|
+
const { data: o } = await c.get(
|
|
11
|
+
`/_v/commerce/products/productsSimilar?postalCode=${n}&skus=${r == null ? void 0 : r.productOriginId}&field=sku`
|
|
12
|
+
), { similarProducts: p } = o;
|
|
13
|
+
return p.find(
|
|
14
|
+
(s) => s.productOrigin === (r == null ? void 0 : r.productOriginId)
|
|
14
15
|
);
|
|
15
16
|
}
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"Content-Type": "application/json",
|
|
21
|
-
Accept: "application/json"
|
|
17
|
+
const i = a && await a({
|
|
18
|
+
input: {
|
|
19
|
+
postalCode: n,
|
|
20
|
+
productOriginId: r == null ? void 0 : r.productOriginId
|
|
22
21
|
}
|
|
23
|
-
})
|
|
24
|
-
return
|
|
22
|
+
});
|
|
23
|
+
return i ? JSON.parse(
|
|
24
|
+
i == null ? void 0 : i.getProductsSimilars.data
|
|
25
|
+
).similarProducts.find(
|
|
25
26
|
(o) => o.productOrigin === r.productOriginId
|
|
26
|
-
);
|
|
27
|
+
) : void 0;
|
|
27
28
|
} catch (i) {
|
|
28
29
|
console.error("Error in Change Order Modal", i);
|
|
29
30
|
}
|
|
30
31
|
};
|
|
31
32
|
export {
|
|
32
|
-
|
|
33
|
+
P as getProductsSimilars
|
|
33
34
|
};
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
export
|
|
1
|
+
export interface PostChangeOrderMutationResponse {
|
|
2
|
+
postChangeOrder: {
|
|
3
|
+
data: string;
|
|
4
|
+
};
|
|
5
|
+
}
|
|
6
|
+
export declare const postChangeOrder: (orderFormId: string, isIO: boolean, skuId: string, substitutionId: string, postChangeOrderMutation?: (variables: {}) => Promise<PostChangeOrderMutationResponse>) => Promise<any>;
|
|
@@ -1,28 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
const p = async (e,
|
|
1
|
+
import s from "axios";
|
|
2
|
+
const p = async (o, e, n, c, t) => {
|
|
3
3
|
try {
|
|
4
4
|
const r = {
|
|
5
|
-
orderFormId:
|
|
6
|
-
skuId:
|
|
7
|
-
substitutionId:
|
|
5
|
+
orderFormId: o,
|
|
6
|
+
skuId: n,
|
|
7
|
+
substitutionId: c
|
|
8
8
|
};
|
|
9
|
-
if (
|
|
10
|
-
const { data:
|
|
9
|
+
if (e) {
|
|
10
|
+
const { data: d } = await s.post(
|
|
11
11
|
"/_v/commerce/orderform/changeOrder",
|
|
12
12
|
r
|
|
13
13
|
);
|
|
14
|
-
return
|
|
14
|
+
return d;
|
|
15
15
|
}
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
method: "POST",
|
|
19
|
-
headers: {
|
|
20
|
-
"Content-Type": "application/json",
|
|
21
|
-
Accept: "application/json"
|
|
22
|
-
},
|
|
23
|
-
body: r
|
|
16
|
+
const a = t && await t({
|
|
17
|
+
input: r
|
|
24
18
|
});
|
|
25
|
-
return
|
|
19
|
+
return a ? JSON.parse(a == null ? void 0 : a.postChangeOrder.data) : void 0;
|
|
26
20
|
} catch (r) {
|
|
27
21
|
console.error("Error in Change Order Modal", r);
|
|
28
22
|
}
|
|
@@ -12,6 +12,9 @@ interface CouponsProps {
|
|
|
12
12
|
disableFirstEmptyModal?: boolean;
|
|
13
13
|
couponsList?: CouponType[];
|
|
14
14
|
qtdCouponsView?: number;
|
|
15
|
+
getCouponsMutation?: any;
|
|
16
|
+
addCouponMutation?: any;
|
|
17
|
+
removeCouponMutation?: any;
|
|
15
18
|
}
|
|
16
|
-
export declare const Coupons: ({ orderFormId, hasItemsInCart, builder, account, isIO, closeIOModal, activeOrderFormCoupon, genericTaggingEvent, disableFirstEmptyModal, couponsList, qtdCouponsView }: CouponsProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare const Coupons: ({ orderFormId, hasItemsInCart, builder, account, isIO, closeIOModal, activeOrderFormCoupon, genericTaggingEvent, disableFirstEmptyModal, couponsList, qtdCouponsView, getCouponsMutation, addCouponMutation, removeCouponMutation }: CouponsProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
20
|
export {};
|
|
@@ -1,103 +1,113 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { useState as e, useEffect as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
/* empty css */const
|
|
10
|
-
orderFormId:
|
|
11
|
-
hasItemsInCart:
|
|
12
|
-
builder:
|
|
13
|
-
account:
|
|
1
|
+
import { jsx as t, jsxs as P } from "react/jsx-runtime";
|
|
2
|
+
import { useState as e, useEffect as j } 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 eo = ({
|
|
10
|
+
orderFormId: A,
|
|
11
|
+
hasItemsInCart: f,
|
|
12
|
+
builder: l,
|
|
13
|
+
account: w,
|
|
14
14
|
isIO: o = !1,
|
|
15
15
|
closeIOModal: r,
|
|
16
16
|
activeOrderFormCoupon: n,
|
|
17
17
|
genericTaggingEvent: s,
|
|
18
|
-
disableFirstEmptyModal:
|
|
19
|
-
couponsList:
|
|
20
|
-
qtdCouponsView:
|
|
18
|
+
disableFirstEmptyModal: J,
|
|
19
|
+
couponsList: p,
|
|
20
|
+
qtdCouponsView: C,
|
|
21
|
+
getCouponsMutation: q,
|
|
22
|
+
addCouponMutation: D,
|
|
23
|
+
removeCouponMutation: L
|
|
21
24
|
}) => {
|
|
22
|
-
const [
|
|
23
|
-
!
|
|
24
|
-
), [
|
|
25
|
-
return
|
|
26
|
-
n &&
|
|
27
|
-
}, [n]),
|
|
25
|
+
const [k, N] = e(!0), [z, a] = e([]), [u, c] = e("coupons-view"), [B, d] = e(!1), [y, v] = e(!1), [R, V] = e(""), [m, S] = e(""), [E, x] = e(
|
|
26
|
+
!J
|
|
27
|
+
), [G, H] = e();
|
|
28
|
+
return j(() => {
|
|
29
|
+
n && V(n);
|
|
30
|
+
}, [n]), j(() => {
|
|
28
31
|
(async () => {
|
|
29
|
-
|
|
32
|
+
N(!0);
|
|
30
33
|
try {
|
|
31
|
-
const i = await
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
const i = o ? await Z(w, l, p) : await q({
|
|
35
|
+
input: {
|
|
36
|
+
builder: l,
|
|
37
|
+
couponsList: p
|
|
38
|
+
}
|
|
39
|
+
}), h = o ? i : JSON.parse(i.getCoupons.data).coupons;
|
|
40
|
+
if (C) {
|
|
41
|
+
const K = h.slice(0, C);
|
|
42
|
+
a(K);
|
|
35
43
|
return;
|
|
36
44
|
}
|
|
37
|
-
|
|
45
|
+
a(h);
|
|
38
46
|
return;
|
|
39
47
|
} catch (i) {
|
|
40
|
-
|
|
48
|
+
a([]);
|
|
41
49
|
} finally {
|
|
42
|
-
|
|
50
|
+
N(!1);
|
|
43
51
|
}
|
|
44
52
|
})();
|
|
45
|
-
}, [JSON.stringify(
|
|
46
|
-
|
|
53
|
+
}, [JSON.stringify(p)]), k ? /* @__PURE__ */ t("div", { className: "coupons-container", children: /* @__PURE__ */ t(
|
|
54
|
+
Q,
|
|
47
55
|
{
|
|
48
56
|
isIO: o,
|
|
49
57
|
closeIOModal: r,
|
|
50
58
|
genericTaggingEvent: s
|
|
51
59
|
}
|
|
52
|
-
) }) : /* @__PURE__ */
|
|
60
|
+
) }) : /* @__PURE__ */ P("div", { className: "coupons-container", children: [
|
|
53
61
|
(!o || o && u === "coupons-view") && /* @__PURE__ */ t(
|
|
54
|
-
|
|
62
|
+
U,
|
|
55
63
|
{
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
64
|
+
removeCouponMutation: L,
|
|
65
|
+
addCouponMutation: D,
|
|
66
|
+
orderFormId: A,
|
|
67
|
+
hasItemsInCart: f,
|
|
68
|
+
account: w,
|
|
59
69
|
isIO: o,
|
|
60
70
|
closeIOModal: r,
|
|
61
|
-
coupons:
|
|
62
|
-
firstCouponName:
|
|
71
|
+
coupons: z,
|
|
72
|
+
firstCouponName: R,
|
|
63
73
|
secondCouponName: m,
|
|
64
|
-
replaceCoupon:
|
|
74
|
+
replaceCoupon: y,
|
|
65
75
|
setView: c,
|
|
66
|
-
setFirstCouponName:
|
|
67
|
-
setSecondCouponName:
|
|
68
|
-
setActiveRule:
|
|
69
|
-
setDataItem:
|
|
70
|
-
setReplaceCoupon:
|
|
76
|
+
setFirstCouponName: V,
|
|
77
|
+
setSecondCouponName: S,
|
|
78
|
+
setActiveRule: d,
|
|
79
|
+
setDataItem: H,
|
|
80
|
+
setReplaceCoupon: v,
|
|
71
81
|
setIsCloseModalEmpty: x,
|
|
72
82
|
genericTaggingEvent: s
|
|
73
83
|
}
|
|
74
84
|
),
|
|
75
|
-
(!o || o && u === "rules-view") &&
|
|
76
|
-
|
|
85
|
+
(!o || o && u === "rules-view") && B && /* @__PURE__ */ t(
|
|
86
|
+
W,
|
|
77
87
|
{
|
|
78
|
-
dataItem:
|
|
79
|
-
setActiveRule:
|
|
88
|
+
dataItem: G,
|
|
89
|
+
setActiveRule: d,
|
|
80
90
|
setView: c,
|
|
81
91
|
isIO: o,
|
|
82
92
|
closeIOModal: r,
|
|
83
93
|
genericTaggingEvent: s
|
|
84
94
|
}
|
|
85
95
|
),
|
|
86
|
-
(!o || o && u === "overwrite-view") && m && !
|
|
87
|
-
|
|
96
|
+
(!o || o && u === "overwrite-view") && m && !y && /* @__PURE__ */ t(
|
|
97
|
+
X,
|
|
88
98
|
{
|
|
89
|
-
firstCouponName:
|
|
99
|
+
firstCouponName: R,
|
|
90
100
|
secondCouponName: m,
|
|
91
101
|
setView: c,
|
|
92
|
-
setReplaceCoupon:
|
|
93
|
-
setSecondCouponName:
|
|
102
|
+
setReplaceCoupon: v,
|
|
103
|
+
setSecondCouponName: S,
|
|
94
104
|
isIO: o,
|
|
95
105
|
closeIOModal: r,
|
|
96
106
|
genericTaggingEvent: s
|
|
97
107
|
}
|
|
98
108
|
),
|
|
99
|
-
!
|
|
100
|
-
|
|
109
|
+
!f && E && /* @__PURE__ */ t(
|
|
110
|
+
Y,
|
|
101
111
|
{
|
|
102
112
|
setIsCloseModalEmpty: x,
|
|
103
113
|
genericTaggingEvent: s
|
|
@@ -106,5 +116,5 @@ import { EmptyCartView as Q } from "./views/EmptyCartView.js";
|
|
|
106
116
|
] });
|
|
107
117
|
};
|
|
108
118
|
export {
|
|
109
|
-
|
|
119
|
+
eo as Coupons
|
|
110
120
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
const
|
|
3
|
-
const { data:
|
|
4
|
-
`https://${o}.
|
|
1
|
+
import r from "axios";
|
|
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
6
|
orderFormId: t,
|
|
7
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,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
return
|
|
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
|
+
return r.coupons;
|
|
5
5
|
};
|
|
6
6
|
export {
|
|
7
|
-
|
|
7
|
+
e as getCoupons
|
|
8
8
|
};
|
|
@@ -21,5 +21,7 @@ export interface CouponCardProps {
|
|
|
21
21
|
setType: (type: AlertType) => void;
|
|
22
22
|
setIsCloseModalEmpty: (isCloseModalEmpty: boolean) => void;
|
|
23
23
|
genericTaggingEvent?: (name: string, params: object) => void;
|
|
24
|
+
addCouponMutation?: any;
|
|
25
|
+
removeCouponMutation?: any;
|
|
24
26
|
}
|
|
25
|
-
export declare const CouponCard: ({ account, orderFormId, hasItemsInCart, isIO, item, firstCouponName, secondCouponName, replaceCoupon, setView, setActiveRule, setDataItem, setFirstCouponName, setSecondCouponName, setReplaceCoupon, setAlert, setType, setIsCloseModalEmpty, genericTaggingEvent }: CouponCardProps) => import("react/jsx-runtime").JSX.Element;
|
|
27
|
+
export declare const CouponCard: ({ account, 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;
|