@plurix/ecom-components 1.14.2-commerce.8 → 1.14.2-shlo1445.1

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.
Files changed (75) hide show
  1. package/dist/assets/svgs/ErrorIconV2.d.ts +1 -0
  2. package/dist/assets/svgs/ErrorIconV2.js +33 -0
  3. package/dist/assets/svgs/SuccessIconV2.d.ts +1 -0
  4. package/dist/assets/svgs/SuccessIconV2.js +30 -0
  5. package/dist/assets/svgs/WarningIconV2.d.ts +1 -0
  6. package/dist/assets/svgs/WarningIconV2.js +40 -0
  7. package/dist/hooks/useVerticalShelfCarouselProps.d.ts +4 -0
  8. package/dist/hooks/useVerticalShelfCarouselProps.js +14 -0
  9. package/dist/hooks/useWindowDimensions.d.ts +5 -0
  10. package/dist/hooks/useWindowDimensions.js +38 -0
  11. package/dist/main.d.ts +1 -0
  12. package/dist/main.js +19 -17
  13. package/dist/packages/AdaptiveCarousel/AdaptiveCarousel.d.ts +14 -0
  14. package/dist/packages/AdaptiveCarousel/AdaptiveCarousel.js +69 -0
  15. package/dist/packages/ChangeOrderModal/ChangeOrderModal.d.ts +12 -2
  16. package/dist/packages/ChangeOrderModal/ChangeOrderModal.js +79 -71
  17. package/dist/packages/ChangeOrderModal/api/getOrderForm.d.ts +1 -1
  18. package/dist/packages/ChangeOrderModal/api/getOrderForm.js +7 -9
  19. package/dist/packages/ChangeOrderModal/api/getProductsSimilars.d.ts +7 -5
  20. package/dist/packages/ChangeOrderModal/api/getProductsSimilars.js +18 -11
  21. package/dist/packages/ChangeOrderModal/api/postChangeOrder.d.ts +6 -1
  22. package/dist/packages/ChangeOrderModal/api/postChangeOrder.js +11 -11
  23. package/dist/packages/Coupons/Coupons.d.ts +4 -1
  24. package/dist/packages/Coupons/Coupons.js +67 -57
  25. package/dist/packages/Coupons/api/addCoupon.js +6 -6
  26. package/dist/packages/Coupons/api/getCoupons.js +5 -5
  27. package/dist/packages/Coupons/components/CouponCard.d.ts +3 -1
  28. package/dist/packages/Coupons/components/CouponCard.js +94 -83
  29. package/dist/packages/Coupons/views/CouponsView.d.ts +3 -1
  30. package/dist/packages/Coupons/views/CouponsView.js +87 -78
  31. package/dist/packages/ProductCard/ProductCardBadge/ProductCardBadgeKg.js +13 -10
  32. package/dist/packages/ProductCard/ProductCardBadge/ProductCardDiscountBadge.d.ts +3 -2
  33. package/dist/packages/ProductCard/ProductCardBadge/ProductCardDiscountBadge.js +15 -31
  34. package/dist/packages/ProductCard/ProductCardHorizontal/index.js +31 -30
  35. package/dist/packages/ProductCard/ProductCardPrice/index.d.ts +8 -1
  36. package/dist/packages/ProductCard/ProductCardPrice/index.js +27 -31
  37. package/dist/packages/ProductCard/ProductCardVertical/index.js +16 -15
  38. package/dist/packages/Regionalization/Regionalization.d.ts +1 -1
  39. package/dist/packages/Regionalization/Regionalization.js +15 -13
  40. package/dist/packages/Regionalization/context/RegionalizationContext.d.ts +1 -1
  41. package/dist/packages/Regionalization/context/RegionalizationContext.js +31 -29
  42. package/dist/packages/Regionalization/types/RegionalizationProps.d.ts +1 -0
  43. package/dist/packages/Regionalization/views/AllStoresScreen.js +21 -21
  44. package/dist/packages/VouchersRedeemed/VouchersRedeemed.d.ts +22 -0
  45. package/dist/packages/VouchersRedeemed/VouchersRedeemed.js +121 -0
  46. package/dist/packages/VouchersRedeemed/api/getCouponsCartonistByUser.d.ts +1 -0
  47. package/dist/packages/VouchersRedeemed/api/getCouponsCartonistByUser.js +20 -0
  48. package/dist/packages/VouchersRedeemed/components/StatusMessageTryApply/StatusMessageTryApply.d.ts +12 -0
  49. package/dist/packages/VouchersRedeemed/components/StatusMessageTryApply/StatusMessageTryApply.js +27 -0
  50. package/dist/packages/VouchersRedeemed/components/StatusMessageTryApply/index.d.ts +1 -0
  51. package/dist/packages/VouchersRedeemed/components/StatusMessageTryApply/index.js +4 -0
  52. package/dist/packages/VouchersRedeemed/components/VoucherRedeemedCard/VoucherRedeemedCard.d.ts +17 -0
  53. package/dist/packages/VouchersRedeemed/components/VoucherRedeemedCard/VoucherRedeemedCard.js +37 -0
  54. package/dist/packages/VouchersRedeemed/components/VoucherRedeemedCard/index.d.ts +1 -0
  55. package/dist/packages/VouchersRedeemed/components/VoucherRedeemedCard/index.js +4 -0
  56. package/dist/packages/VouchersRedeemed/components/VouchersRedeemedSkeleton/VouchersRedeemedSkeleton.d.ts +14 -0
  57. package/dist/packages/VouchersRedeemed/components/VouchersRedeemedSkeleton/VouchersRedeemedSkeleton.js +48 -0
  58. package/dist/packages/VouchersRedeemed/components/VouchersRedeemedSkeleton/index.d.ts +1 -0
  59. package/dist/packages/VouchersRedeemed/components/VouchersRedeemedSkeleton/index.js +4 -0
  60. package/dist/packages/VouchersRedeemed/data/validVouchers.d.ts +1 -0
  61. package/dist/packages/VouchersRedeemed/data/validVouchers.js +20 -0
  62. package/dist/packages/VouchersRedeemed/utils/getCouponPrice.d.ts +1 -0
  63. package/dist/packages/VouchersRedeemed/utils/getCouponPrice.js +8 -0
  64. package/dist/styles/adaptive-carousel.global.css +1 -0
  65. package/dist/styles/regionalization.global.css +1 -1
  66. package/dist/styles/vouchers-redeemed.global.css +1 -0
  67. package/dist/types/ProductCard.d.ts +13 -12
  68. package/dist/utils/carousel/carouselProps.d.ts +33 -0
  69. package/dist/utils/carousel/carouselProps.js +59 -0
  70. package/dist/utils/changerOrderModal.js +13 -16
  71. package/dist/utils/scroll/isScrollToEnd.d.ts +1 -0
  72. package/dist/utils/scroll/isScrollToEnd.js +4 -0
  73. package/dist/utils/setBoldTextParts.d.ts +1 -0
  74. package/dist/utils/setBoldTextParts.js +7 -0
  75. package/package.json +69 -69
@@ -1,122 +1,131 @@
1
- import { jsxs as e, Fragment as N, jsx as o } from "react/jsx-runtime";
2
- import { useState as a, useEffect as F } from "react";
3
- import { addCoupon as G } from "../api/addCoupon.js";
4
- import { ModalHeader as J } from "../components/ModalHeader.js";
5
- import { ModalFooter as K } from "../components/ModalFooter.js";
6
- import { CouponCard as Q } from "../components/CouponCard.js";
7
- import { NoCoupons as U } from "../components/NoCoupons.js";
8
- import { Alert as V } from "../components/Alert.js";
9
- import { InfoIcon as W } from "../../../assets/svgs/InfoIcon.js";
10
- const E = ({
11
- account: b,
12
- orderFormId: x,
1
+ import { jsxs as d, Fragment as _, jsx as o } from "react/jsx-runtime";
2
+ import { useState as l, useEffect as Q } from "react";
3
+ import { ModalHeader as R } from "../components/ModalHeader.js";
4
+ import { ModalFooter as U } from "../components/ModalFooter.js";
5
+ import { CouponCard as V } from "../components/CouponCard.js";
6
+ import { NoCoupons as W } from "../components/NoCoupons.js";
7
+ import { Alert as X } from "../components/Alert.js";
8
+ import { InfoIcon as Y } from "../../../assets/svgs/InfoIcon.js";
9
+ import { addCoupon as Z } from "../api/addCoupon.js";
10
+ const to = ({
11
+ addCouponMutation: w,
12
+ removeCouponMutation: D,
13
+ account: x,
14
+ orderFormId: c,
13
15
  hasItemsInCart: C,
14
16
  isIO: p,
15
- closeIOModal: u,
16
- coupons: c,
17
+ closeIOModal: s,
18
+ coupons: n,
17
19
  firstCouponName: i,
18
- secondCouponName: _,
19
- replaceCoupon: w,
20
- setView: A,
21
- setActiveRule: D,
22
- setDataItem: L,
20
+ secondCouponName: L,
21
+ replaceCoupon: A,
22
+ setView: B,
23
+ setActiveRule: q,
24
+ setDataItem: H,
23
25
  setFirstCouponName: m,
24
- setSecondCouponName: n,
25
- setReplaceCoupon: B,
26
- setIsCloseModalEmpty: S,
27
- genericTaggingEvent: r
26
+ setSecondCouponName: f,
27
+ setReplaceCoupon: N,
28
+ setIsCloseModalEmpty: J,
29
+ genericTaggingEvent: t
28
30
  }) => {
29
- const [t, q] = a(""), [H, j] = a(!1), [M, s] = a(""), [f, d] = a(!1), [P, h] = a(!1), k = (l) => {
30
- l.preventDefault(), q(l.target.value);
31
- }, z = async (l) => {
32
- l.preventDefault();
31
+ const [r, P] = l(""), [k, j] = l(!1), [z, u] = l(""), [h, e] = l(!1), [G, y] = l(!1), K = (a) => {
32
+ a.preventDefault(), P(a.target.value);
33
+ }, M = async (a) => {
34
+ a.preventDefault();
33
35
  try {
34
- if (!i || i && w) {
36
+ if (!i || i && A) {
35
37
  j(!0);
36
- const y = await G(b, x, t);
37
- B(!1), n(""), y.error.length <= 0 ? (r == null || r("discount_coupon", {
38
+ const b = p ? await Z(x, c, r) : await w({
39
+ input: {
40
+ orderFormId: c,
41
+ couponId: r
42
+ }
43
+ }), S = p ? b : JSON.parse(b.addCoupon.data);
44
+ N(!1), f(""), S.error.length <= 0 ? (t == null || t("discount_coupon", {
38
45
  name: "Cupom aplicado do input",
39
- couponName: t
40
- }), s("success"), h(!0), m(t), p && window.location.reload()) : (r == null || r("discount_coupon", {
46
+ couponName: r
47
+ }), u("success"), y(!0), m(r), p && window.location.reload()) : (t == null || t("discount_coupon", {
41
48
  name: "Cupom do input expirado ou invalido",
42
- couponName: t,
43
- objectError: y.error
44
- }), s("error"), h(!1), m("")), d(!0);
49
+ couponName: r,
50
+ objectError: S.error
51
+ }), u("error"), y(!1), m("")), e(!0);
45
52
  } else
46
- n(t), A("overwrite-view");
47
- } catch (y) {
48
- r == null || r("discount_coupon", {
53
+ f(r), B("overwrite-view");
54
+ } catch (b) {
55
+ t == null || t("discount_coupon", {
49
56
  name: "Cupom do input - error na api",
50
- couponName: t
51
- }), s("error"), h(!1), d(!0);
57
+ couponName: r
58
+ }), u("error"), y(!1), e(!0);
52
59
  } finally {
53
60
  j(!1);
54
61
  }
55
62
  };
56
- return F(() => {
57
- f && setTimeout(() => d(!1), 5e3);
58
- }, [P, f]), /* @__PURE__ */ e(N, { children: [
59
- p && u && /* @__PURE__ */ o(
60
- J,
63
+ return Q(() => {
64
+ h && setTimeout(() => e(!1), 5e3);
65
+ }, [G, h]), /* @__PURE__ */ d(_, { children: [
66
+ p && s && /* @__PURE__ */ o(
67
+ R,
61
68
  {
62
- closeModal: u,
69
+ closeModal: s,
63
70
  title: "Meus Cupons",
64
- genericTaggingEvent: r
71
+ genericTaggingEvent: t
65
72
  }
66
73
  ),
67
- C ? /* @__PURE__ */ o("div", { className: "form-coupons", children: /* @__PURE__ */ e("form", { onSubmit: z, children: [
74
+ C ? /* @__PURE__ */ o("div", { className: "form-coupons", children: /* @__PURE__ */ d("form", { onSubmit: M, children: [
68
75
  /* @__PURE__ */ o(
69
76
  "input",
70
77
  {
71
78
  type: "text",
72
79
  placeholder: "Insira o cupom",
73
- value: t,
74
- onChange: k
80
+ value: r,
81
+ onChange: K
75
82
  }
76
83
  ),
77
- /* @__PURE__ */ o("button", { type: "submit", name: "adicionar", disabled: H, children: "Adicionar" })
78
- ] }) }) : /* @__PURE__ */ o("div", { className: "cart-empty-coupons-label", children: /* @__PURE__ */ e("p", { children: [
79
- /* @__PURE__ */ o("span", { children: /* @__PURE__ */ o(W, {}) }),
84
+ /* @__PURE__ */ o("button", { type: "submit", name: "adicionar", disabled: k, children: "Adicionar" })
85
+ ] }) }) : /* @__PURE__ */ o("div", { className: "cart-empty-coupons-label", children: /* @__PURE__ */ d("p", { children: [
86
+ /* @__PURE__ */ o("span", { children: /* @__PURE__ */ o(Y, {}) }),
80
87
  "Para adicionar um cupom é necessário que você adicione pelo menos 1 produto no carrinho"
81
88
  ] }) }),
82
- /* @__PURE__ */ o("div", { className: "container-title-coupons", children: c.length > 0 ? /* @__PURE__ */ e(N, { children: [
89
+ /* @__PURE__ */ o("div", { className: "container-title-coupons", children: n.length > 0 ? /* @__PURE__ */ d(_, { children: [
83
90
  /* @__PURE__ */ o("h2", { children: "Cupons disponíveis" }),
84
- /* @__PURE__ */ o("div", { className: "container-coupons", children: c.map((l) => /* @__PURE__ */ o(
85
- Q,
91
+ /* @__PURE__ */ o("div", { className: "container-coupons", children: n.map((a) => /* @__PURE__ */ o(
92
+ V,
86
93
  {
87
- account: b,
88
- orderFormId: x,
94
+ removeCouponMutation: D,
95
+ addCouponMutation: w,
96
+ account: x,
97
+ orderFormId: c,
89
98
  hasItemsInCart: C,
90
99
  isIO: p,
91
- item: l,
100
+ item: a,
92
101
  firstCouponName: i,
93
- secondCouponName: _,
94
- replaceCoupon: w,
95
- setView: A,
102
+ secondCouponName: L,
103
+ replaceCoupon: A,
104
+ setView: B,
96
105
  setFirstCouponName: m,
97
- setSecondCouponName: n,
98
- setActiveRule: D,
99
- setDataItem: L,
100
- setReplaceCoupon: B,
101
- setAlert: d,
102
- setType: s,
103
- setIsCloseModalEmpty: S,
104
- genericTaggingEvent: r
106
+ setSecondCouponName: f,
107
+ setActiveRule: q,
108
+ setDataItem: H,
109
+ setReplaceCoupon: N,
110
+ setAlert: e,
111
+ setType: u,
112
+ setIsCloseModalEmpty: J,
113
+ genericTaggingEvent: t
105
114
  },
106
- l.couponName
115
+ a.couponName
107
116
  )) })
108
- ] }) : /* @__PURE__ */ o(U, {}) }),
109
- f && /* @__PURE__ */ o(V, { type: M }),
110
- p && u && /* @__PURE__ */ o(
111
- K,
117
+ ] }) : /* @__PURE__ */ o(W, {}) }),
118
+ h && /* @__PURE__ */ o(X, { type: z }),
119
+ p && s && /* @__PURE__ */ o(
120
+ U,
112
121
  {
113
- isFloating: c.length > 0,
114
- cancelButtonAction: u,
122
+ isFloating: n.length > 0,
123
+ cancelButtonAction: s,
115
124
  cancelButtonText: "Sair"
116
125
  }
117
126
  )
118
127
  ] });
119
128
  };
120
129
  export {
121
- E as CouponsView
130
+ to as CouponsView
122
131
  };
@@ -1,15 +1,18 @@
1
- import { jsx as a, jsxs as c } from "react/jsx-runtime";
2
- const g = ({
3
- measurementUnit: e,
4
- setIsShowProductBadge: d,
5
- unitMultiplier: r
6
- }) => e === "un" ? null : r < 1 ? (d(!0), /* @__PURE__ */ a("div", { className: "product-card-badge", children: /* @__PURE__ */ c("p", { className: "product-card-badge-kg", children: [
7
- r * 1e3,
1
+ import { jsx as a, jsxs as g } from "react/jsx-runtime";
2
+ import { useEffect as o } from "react";
3
+ const f = ({
4
+ measurementUnit: c,
5
+ setIsShowProductBadge: r,
6
+ unitMultiplier: d
7
+ }) => (o(() => {
8
+ c !== "un" && (d < 1 || d >= 1) && r(!0);
9
+ }, [c, d, r]), c === "un" ? null : d < 1 ? /* @__PURE__ */ a("div", { className: "product-card-badge", children: /* @__PURE__ */ g("p", { className: "product-card-badge-kg", children: [
10
+ d * 1e3,
8
11
  "g"
9
- ] }) })) : (r >= 1 && d(!0), /* @__PURE__ */ a("div", { className: "product-card-badge", children: /* @__PURE__ */ c("p", { className: "product-card-badge-kg", children: [
10
- r,
12
+ ] }) }) : /* @__PURE__ */ a("div", { className: "product-card-badge", children: /* @__PURE__ */ g("p", { className: "product-card-badge-kg", children: [
13
+ d,
11
14
  "kg"
12
15
  ] }) }));
13
16
  export {
14
- g as ProductCardBadgeKg
17
+ f as ProductCardBadgeKg
15
18
  };
@@ -1,4 +1,4 @@
1
- import { SkuSpecificationsProps, ProductCardProps } from '../../../types/ProductCard';
1
+ import { SkuSpecificationsProps, ProductCardProps, offers } from '../../../types/ProductCard';
2
2
 
3
3
  interface ProductCardDiscountBadge {
4
4
  skuSpecifications: SkuSpecificationsProps[];
@@ -8,6 +8,7 @@ interface ProductCardDiscountBadge {
8
8
  hasPromotionalPrice: ProductCardProps['hasPromotionalPrice'];
9
9
  defaultScListPrice?: number;
10
10
  setIsShowProductBadge: React.Dispatch<React.SetStateAction<boolean>>;
11
+ offers: offers;
11
12
  }
12
- export declare const ProductCardDiscountBadge: ({ nativeListPrice, nativeSpotPrice, skuSpecifications, unitMultiplier, hasPromotionalPrice, defaultScListPrice, setIsShowProductBadge }: ProductCardDiscountBadge) => import("react/jsx-runtime").JSX.Element | null;
13
+ export declare const ProductCardDiscountBadge: ({ offers, setIsShowProductBadge }: ProductCardDiscountBadge) => import("react/jsx-runtime").JSX.Element | null;
13
14
  export {};
@@ -1,42 +1,26 @@
1
- import { jsx as b, jsxs as x } from "react/jsx-runtime";
2
- import { useMemo as l, useEffect as D } from "react";
3
- const E = ({
4
- nativeListPrice: c,
5
- nativeSpotPrice: s,
6
- skuSpecifications: n,
7
- unitMultiplier: a,
8
- hasPromotionalPrice: i,
9
- defaultScListPrice: P,
10
- setIsShowProductBadge: d
1
+ import { jsx as d, jsxs as i } from "react/jsx-runtime";
2
+ import { useEffect as a, useMemo as m } from "react";
3
+ const h = ({
4
+ offers: n,
5
+ setIsShowProductBadge: c
11
6
  }) => {
12
- const { listPrice: u, spotPrice: o } = i || {}, f = (r, e) => l(() => {
13
- const g = (r - e) * 100 / r;
14
- return Math.round(g);
15
- }, [e, r]), { listPriceCustom: m, spotPriceCustom: p } = l(() => u && o && o !== s ? {
16
- listPriceCustom: u,
17
- spotPriceCustom: o
18
- } : {
19
- listPriceCustom: c,
20
- spotPriceCustom: s
21
- }, [
22
- u,
23
- o,
24
- s,
25
- c
26
- ]), C = "Venda por unidade", N = n == null ? void 0 : n.some((r) => r.field.originalName === C && r.values.some((e) => e.originalName === "true")), h = P || (N ? m : ((r) => Number(r.toString().match(/^\d+(?:\.\d{0,2})?/)))(m * a)), t = Math.round(
27
- Number(f(h, p))
7
+ const { listPrice: u, price: o } = n == null ? void 0 : n.offers[0], t = Math.round(
8
+ Number(((r, e) => m(() => {
9
+ const s = (r - e) * 100 / r;
10
+ return Math.round(s);
11
+ }, [e, r]))(u, o))
28
12
  );
29
- return D(() => {
13
+ return a(() => {
30
14
  if (!t || t <= 0) {
31
- d(!1);
15
+ c(!1);
32
16
  return;
33
17
  }
34
- d(!0);
35
- }, [t]), !t || t <= 0 ? null : /* @__PURE__ */ b("div", { className: "product-card-discount-badge", children: /* @__PURE__ */ x("p", { className: "product-card-discount-badge-value", children: [
18
+ c(!0);
19
+ }, [t]), !t || t <= 0 ? null : /* @__PURE__ */ d("div", { className: "product-card-discount-badge", children: /* @__PURE__ */ i("p", { className: "product-card-discount-badge-value", children: [
36
20
  t,
37
21
  "%"
38
22
  ] }) });
39
23
  };
40
24
  export {
41
- E as ProductCardDiscountBadge
25
+ h as ProductCardDiscountBadge
42
26
  };
@@ -1,4 +1,4 @@
1
- import { jsx as t, jsxs as r } from "react/jsx-runtime";
1
+ import { jsx as r, jsxs as s } from "react/jsx-runtime";
2
2
  import { useState as v } from "react";
3
3
  import { ProductCardUnavailable as x } from "../ProducCardUnavailable/index.js";
4
4
  import { ProductCardBadgeKg as y } from "../ProductCardBadge/ProductCardBadgeKg.js";
@@ -7,7 +7,7 @@ import { ProductCardButton as b } from "../ProductCardButton/index.js";
7
7
  import { ProductCardImage as M } from "../ProductCardImage/index.js";
8
8
  import { ProductCardName as N } from "../ProductCardName/index.js";
9
9
  import { ProductCardPrice as O } from "../ProductCardPrice/index.js";
10
- import { ProductCardPromotionFlag as p } from "../ProductCardPromotionFlag/index.js";
10
+ import { ProductCardPromotionFlag as B } from "../ProductCardPromotionFlag/index.js";
11
11
  const G = ({
12
12
  hasPlusFriendBadge: a,
13
13
  promotion: i,
@@ -15,7 +15,7 @@ const G = ({
15
15
  hasPromotionalPrice: c,
16
16
  clubPrice: C,
17
17
  outOfStock: o,
18
- variant: s,
18
+ variant: t,
19
19
  defaultScListPrice: l,
20
20
  isClubClient: u,
21
21
  addToCartAction: P,
@@ -23,19 +23,19 @@ const G = ({
23
23
  productInCart: h,
24
24
  openModal: S
25
25
  }) => {
26
- var d, f;
27
- const [k, m] = v(!1);
26
+ var f, d;
27
+ const [k, n] = v(!1);
28
28
  if (o)
29
- return /* @__PURE__ */ t(
29
+ return /* @__PURE__ */ r(
30
30
  x,
31
31
  {
32
- image: (d = e.image) == null ? void 0 : d[0],
32
+ image: (f = e.image) == null ? void 0 : f[0],
33
33
  name: e.name,
34
34
  variant: "horizontal"
35
35
  }
36
36
  );
37
- const n = u && e.hasClubPrice;
38
- return /* @__PURE__ */ r(
37
+ const m = u && e.hasClubPrice;
38
+ return /* @__PURE__ */ s(
39
39
  "div",
40
40
  {
41
41
  className: "product-card-horizontal",
@@ -43,67 +43,68 @@ const G = ({
43
43
  backgroundColor: o ? "var(--color-grayScale-faded" : "#fff"
44
44
  },
45
45
  children: [
46
- /* @__PURE__ */ r(
46
+ /* @__PURE__ */ s(
47
47
  "div",
48
48
  {
49
49
  onClick: S,
50
50
  className: "product-card-section-product-horizontal",
51
51
  children: [
52
- /* @__PURE__ */ t(
52
+ /* @__PURE__ */ r(
53
53
  M,
54
54
  {
55
- isProductClubAndClient: n,
56
- variant: s,
55
+ isProductClubAndClient: m,
56
+ variant: t,
57
57
  hasPlusFriendBadge: a,
58
58
  promotion: i,
59
- image: (f = e.image) == null ? void 0 : f[0]
59
+ image: (d = e.image) == null ? void 0 : d[0]
60
60
  }
61
61
  ),
62
- /* @__PURE__ */ r(
62
+ /* @__PURE__ */ s(
63
63
  "div",
64
64
  {
65
65
  className: "product-card-horizontal-description",
66
66
  style: {
67
- backgroundColor: n ? "#FDF3DE" : "var(--color-grayScale-faded)"
67
+ backgroundColor: m ? "#FDF3DE" : "var(--color-grayScale-faded)"
68
68
  },
69
69
  children: [
70
- /* @__PURE__ */ r("div", { className: "product-card-section-name", children: [
71
- /* @__PURE__ */ t(N, { name: e.name }),
72
- /* @__PURE__ */ r(
70
+ /* @__PURE__ */ s("div", { className: "product-card-section-name", children: [
71
+ /* @__PURE__ */ r(N, { name: e.name }),
72
+ /* @__PURE__ */ s(
73
73
  "div",
74
74
  {
75
75
  className: "product-card-section-badge-horizontal",
76
76
  style: { display: k ? "" : "none" },
77
77
  children: [
78
- /* @__PURE__ */ t(
78
+ /* @__PURE__ */ r(
79
79
  y,
80
80
  {
81
81
  unitMultiplier: e.unitMultiplier,
82
82
  skuSpecifications: e.skuSpecifications,
83
83
  measurementUnit: e.measurementUnit,
84
- setIsShowProductBadge: m
84
+ setIsShowProductBadge: n
85
85
  }
86
86
  ),
87
- /* @__PURE__ */ t(
87
+ /* @__PURE__ */ r(
88
88
  z,
89
89
  {
90
+ offers: e.offers,
90
91
  defaultScListPrice: l,
91
92
  nativeListPrice: e.customOffers.listPriceCustom,
92
93
  nativeSpotPrice: e.customOffers.spotPriceCustom,
93
94
  skuSpecifications: e.skuSpecifications,
94
95
  unitMultiplier: e.unitMultiplier,
95
96
  hasPromotionalPrice: c,
96
- setIsShowProductBadge: m
97
+ setIsShowProductBadge: n
97
98
  }
98
99
  )
99
100
  ]
100
101
  }
101
102
  )
102
103
  ] }),
103
- s === "horizontal" && /* @__PURE__ */ t(
104
- p,
104
+ t === "horizontal" && /* @__PURE__ */ r(
105
+ B,
105
106
  {
106
- variant: s,
107
+ variant: t,
107
108
  productSectionBadge: {
108
109
  text: i == null ? void 0 : i.flagText,
109
110
  color: {
@@ -113,7 +114,7 @@ const G = ({
113
114
  }
114
115
  }
115
116
  ),
116
- /* @__PURE__ */ t(
117
+ /* @__PURE__ */ r(
117
118
  O,
118
119
  {
119
120
  isClubClient: u,
@@ -125,7 +126,7 @@ const G = ({
125
126
  listPriceCustom: e.customOffers.listPriceCustom,
126
127
  hasDiscount: e.customOffers.hasDiscount,
127
128
  spotPriceCustom: e.customOffers.spotPriceCustom,
128
- spotPriceKg: e.customOffers.spotPriceCustom
129
+ spotPriceKg: e.customOffers.spotPriceKg
129
130
  },
130
131
  defaultScListPrice: l,
131
132
  clubPrice: C,
@@ -138,13 +139,13 @@ const G = ({
138
139
  ]
139
140
  }
140
141
  ),
141
- /* @__PURE__ */ t(
142
+ /* @__PURE__ */ r(
142
143
  b,
143
144
  {
144
145
  addToCartAction: P,
145
146
  quantitySelectorAction: g,
146
147
  productInCart: h,
147
- layout: s
148
+ layout: t
148
149
  }
149
150
  )
150
151
  ]
@@ -20,5 +20,12 @@ interface ProductCardPricesProps {
20
20
  unitMultiplier: number;
21
21
  hasPlusFriendBadge?: boolean;
22
22
  }
23
- export declare const ProductCardPrice: ({ skuSpecifications, hasPromotionalPrice, clubPrice, unitMultiplier, defaultScListPrice, customOffers, measurementUnit, isClubClient, hasPlusFriendBadge }: ProductCardPricesProps) => import("react/jsx-runtime").JSX.Element;
23
+ export declare const ProductCardPrice: ({ clubPrice, unitMultiplier, customOffers, measurementUnit, isClubClient, hasPlusFriendBadge }: ProductCardPricesProps) => import("react/jsx-runtime").JSX.Element;
24
+ interface getPriceToShowParams {
25
+ spotPriceKg: number | undefined | null;
26
+ unitMultiplier: number;
27
+ measurementUnit?: string;
28
+ spotPriceCustom: number;
29
+ }
30
+ export declare const getPriceToShow: ({ spotPriceKg, unitMultiplier, measurementUnit, spotPriceCustom }: getPriceToShowParams) => number | null | undefined;
24
31
  export {};
@@ -1,39 +1,35 @@
1
- import { jsx as e, Fragment as j, jsxs as p } from "react/jsx-runtime";
2
- import { useMemo as I } from "react";
3
- const U = ({
4
- skuSpecifications: t,
5
- hasPromotionalPrice: C,
6
- clubPrice: i,
7
- unitMultiplier: h,
8
- defaultScListPrice: n,
1
+ import { jsx as e, Fragment as g, jsxs as a } from "react/jsx-runtime";
2
+ const m = ({
3
+ clubPrice: c,
4
+ unitMultiplier: t,
9
5
  customOffers: r,
10
- measurementUnit: N,
11
- isClubClient: g,
12
- hasPlusFriendBadge: v
6
+ measurementUnit: n,
7
+ isClubClient: d,
8
+ hasPlusFriendBadge: p
13
9
  }) => {
14
- const { listPrice: s, spotPrice: c } = C || {}, { listPriceCustom: m, spotPriceCustom: P } = I(() => s && c && c !== r.spotPriceCustom ? {
15
- listPriceCustom: s,
16
- spotPriceCustom: c
17
- } : {
18
- listPriceCustom: r.listPriceCustom,
19
- spotPriceCustom: r.spotPriceCustom
20
- }, [
21
- s,
22
- c,
23
- r.spotPriceCustom,
24
- r.listPriceCustom
25
- ]), b = !!(i && i !== r.spotPriceCustom), B = !!(n && n !== P), l = (o) => o.toLocaleString("pt-br", { style: "currency", currency: "BRL" }), w = "Venda por unidade", u = t == null ? void 0 : t.some((o) => o.field.originalName === w && o.values.some((F) => F.originalName === "true")), x = N !== "un", a = n || (u ? m : ((o) => Number(o.toString().match(/^\d+(?:\.\d{0,2})?/)))(m * h)), y = v ? "no + Amigo" : "no clube", d = x && r.spotPriceKg && u ? r.spotPriceKg : P, D = (a > d || B) && a && d;
26
- return /* @__PURE__ */ e(j, { children: /* @__PURE__ */ p("div", { className: "product-card-price", children: [
27
- !g && b && /* @__PURE__ */ e("div", { className: "product-card-club-price-container", children: /* @__PURE__ */ e("p", { className: "product-card-club-price", children: `${l(i || 0)} ${y}` }) }),
28
- /* @__PURE__ */ p("div", { className: "product-card-price-container", children: [
29
- D && /* @__PURE__ */ e("p", { className: "product-card-old-price", children: /* @__PURE__ */ p("span", { children: [
10
+ const l = !!(c && c !== r.spotPriceCustom), o = (u) => u.toLocaleString("pt-br", { style: "currency", currency: "BRL" }), i = h({
11
+ measurementUnit: n,
12
+ spotPriceCustom: r.spotPriceCustom,
13
+ spotPriceKg: r == null ? void 0 : r.spotPriceKg,
14
+ unitMultiplier: t
15
+ }), s = p ? "no + Amigo" : "no clube";
16
+ return /* @__PURE__ */ e(g, { children: /* @__PURE__ */ a("div", { className: "product-card-price", children: [
17
+ !d && l && c !== i && /* @__PURE__ */ e("div", { className: "product-card-club-price-container", children: /* @__PURE__ */ e("p", { className: "product-card-club-price", children: `${o(c || 0)} ${s}` }) }),
18
+ /* @__PURE__ */ a("div", { className: "product-card-price-container", children: [
19
+ r.listPriceCustom !== i && /* @__PURE__ */ e("p", { className: "product-card-old-price", children: /* @__PURE__ */ a("span", { children: [
30
20
  " ",
31
- l(a)
21
+ o(r.listPriceCustom)
32
22
  ] }) }),
33
- /* @__PURE__ */ e("p", { className: "product-card-new-price", children: l(d) })
23
+ /* @__PURE__ */ e("p", { className: "product-card-new-price", children: o(i != null ? i : 0) })
34
24
  ] })
35
25
  ] }) });
36
- };
26
+ }, h = ({
27
+ spotPriceKg: c,
28
+ unitMultiplier: t,
29
+ measurementUnit: r,
30
+ spotPriceCustom: n
31
+ }) => r === "kg" && t < 1 ? n : r === "kg" ? c : n;
37
32
  export {
38
- U as ProductCardPrice
33
+ m as ProductCardPrice,
34
+ h as getPriceToShow
39
35
  };