@plurix/ecom-components 1.14.2-commerce.8 → 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.
Files changed (33) hide show
  1. package/dist/packages/ChangeOrderModal/ChangeOrderModal.d.ts +12 -2
  2. package/dist/packages/ChangeOrderModal/ChangeOrderModal.js +79 -71
  3. package/dist/packages/ChangeOrderModal/api/getOrderForm.d.ts +1 -1
  4. package/dist/packages/ChangeOrderModal/api/getOrderForm.js +7 -9
  5. package/dist/packages/ChangeOrderModal/api/getProductsSimilars.d.ts +7 -5
  6. package/dist/packages/ChangeOrderModal/api/getProductsSimilars.js +18 -11
  7. package/dist/packages/ChangeOrderModal/api/postChangeOrder.d.ts +6 -1
  8. package/dist/packages/ChangeOrderModal/api/postChangeOrder.js +11 -11
  9. package/dist/packages/Coupons/Coupons.d.ts +4 -1
  10. package/dist/packages/Coupons/Coupons.js +67 -57
  11. package/dist/packages/Coupons/api/addCoupon.js +6 -6
  12. package/dist/packages/Coupons/api/getCoupons.js +5 -5
  13. package/dist/packages/Coupons/components/CouponCard.d.ts +3 -1
  14. package/dist/packages/Coupons/components/CouponCard.js +94 -83
  15. package/dist/packages/Coupons/views/CouponsView.d.ts +3 -1
  16. package/dist/packages/Coupons/views/CouponsView.js +87 -78
  17. package/dist/packages/ProductCard/ProductCardBadge/ProductCardBadgeKg.js +13 -10
  18. package/dist/packages/ProductCard/ProductCardBadge/ProductCardDiscountBadge.d.ts +3 -2
  19. package/dist/packages/ProductCard/ProductCardBadge/ProductCardDiscountBadge.js +15 -31
  20. package/dist/packages/ProductCard/ProductCardHorizontal/index.js +31 -30
  21. package/dist/packages/ProductCard/ProductCardPrice/index.d.ts +8 -1
  22. package/dist/packages/ProductCard/ProductCardPrice/index.js +27 -31
  23. package/dist/packages/ProductCard/ProductCardVertical/index.js +16 -15
  24. package/dist/packages/Regionalization/Regionalization.d.ts +1 -1
  25. package/dist/packages/Regionalization/Regionalization.js +15 -13
  26. package/dist/packages/Regionalization/context/RegionalizationContext.d.ts +1 -1
  27. package/dist/packages/Regionalization/context/RegionalizationContext.js +31 -29
  28. package/dist/packages/Regionalization/types/RegionalizationProps.d.ts +1 -0
  29. package/dist/packages/Regionalization/views/AllStoresScreen.js +21 -21
  30. package/dist/styles/regionalization.global.css +1 -1
  31. package/dist/types/ProductCard.d.ts +13 -12
  32. package/dist/utils/changerOrderModal.js +13 -16
  33. package/package.json +1 -1
@@ -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
  };
@@ -1,4 +1,4 @@
1
- import { jsx as e, jsxs as t } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as s } from "react/jsx-runtime";
2
2
  import { useState as v } from "react";
3
3
  import { ProductCardUnavailable as O } from "../ProducCardUnavailable/index.js";
4
4
  import { ProductCardBadgeKg as M } from "../ProductCardBadge/ProductCardBadgeKg.js";
@@ -9,12 +9,12 @@ import { ProductCardName as U } from "../ProductCardName/index.js";
9
9
  import { ProductCardPrice as b } from "../ProductCardPrice/index.js";
10
10
  const V = ({
11
11
  hasPlusFriendBadge: r,
12
- promotion: d,
12
+ promotion: f,
13
13
  product: i,
14
14
  hasPromotionalPrice: o,
15
- clubPrice: f,
15
+ clubPrice: d,
16
16
  outOfStock: P,
17
- variant: s,
17
+ variant: t,
18
18
  defaultScListPrice: a,
19
19
  isClubClient: c,
20
20
  hasClub: p,
@@ -31,23 +31,23 @@ const V = ({
31
31
  {
32
32
  image: (u = i.image) == null ? void 0 : u[0],
33
33
  name: i.name,
34
- variant: s
34
+ variant: t
35
35
  }
36
36
  );
37
37
  const n = c && i.hasClubPrice;
38
- return /* @__PURE__ */ t("div", { id: "product-card", children: [
39
- /* @__PURE__ */ e("div", { className: "product-card", children: /* @__PURE__ */ t("div", { className: "product-card-container", onClick: C, children: [
38
+ return /* @__PURE__ */ s("div", { id: "product-card", children: [
39
+ /* @__PURE__ */ e("div", { className: "product-card", children: /* @__PURE__ */ s("div", { className: "product-card-container", onClick: C, children: [
40
40
  /* @__PURE__ */ e(
41
41
  D,
42
42
  {
43
43
  isProductClubAndClient: n,
44
- variant: s,
44
+ variant: t,
45
45
  hasPlusFriendBadge: r,
46
- promotion: d,
46
+ promotion: f,
47
47
  image: (l = i.image) == null ? void 0 : l[0]
48
48
  }
49
49
  ),
50
- /* @__PURE__ */ t(
50
+ /* @__PURE__ */ s(
51
51
  "div",
52
52
  {
53
53
  className: "product-card-description",
@@ -55,9 +55,9 @@ const V = ({
55
55
  backgroundColor: n ? "#FDF3DE" : "var(--color-grayScale-faded)"
56
56
  },
57
57
  children: [
58
- /* @__PURE__ */ t("div", { className: "product-card-section-name", children: [
58
+ /* @__PURE__ */ s("div", { className: "product-card-section-name", children: [
59
59
  /* @__PURE__ */ e(U, { name: i.name }),
60
- /* @__PURE__ */ t(
60
+ /* @__PURE__ */ s(
61
61
  "div",
62
62
  {
63
63
  className: "product-card-section-badge",
@@ -75,6 +75,7 @@ const V = ({
75
75
  /* @__PURE__ */ e(
76
76
  N,
77
77
  {
78
+ offers: i.offers,
78
79
  defaultScListPrice: a,
79
80
  nativeListPrice: i.customOffers.listPriceCustom,
80
81
  nativeSpotPrice: i.customOffers.spotPriceCustom,
@@ -101,10 +102,10 @@ const V = ({
101
102
  listPriceCustom: i.customOffers.listPriceCustom,
102
103
  hasDiscount: i.customOffers.hasDiscount,
103
104
  spotPriceCustom: i.customOffers.spotPriceCustom,
104
- spotPriceKg: i.customOffers.spotPriceCustom
105
+ spotPriceKg: i.customOffers.spotPriceKg
105
106
  },
106
107
  defaultScListPrice: a,
107
- clubPrice: f,
108
+ clubPrice: d,
108
109
  hasPlusFriendBadge: r
109
110
  }
110
111
  )
@@ -118,7 +119,7 @@ const V = ({
118
119
  addToCartAction: g,
119
120
  quantitySelectorAction: S,
120
121
  productInCart: h,
121
- layout: s
122
+ layout: t
122
123
  }
123
124
  )
124
125
  ] });
@@ -1,3 +1,3 @@
1
1
  import { RegionalizationProps } from './types/RegionalizationProps';
2
2
 
3
- export declare const Regionalization: ({ setMethod, setPickupName, setCity, deliveryPrice, setUf, setPickupTimes, pricesAndHours, setModalOpen, inputPostalCode, setInputPostalCode, sendPostalCode, status, setStatus, pickupPoints, pickupConfirmScreenText, regionalizeCatalog, titleText, priceStockInformation, moreInfosText, textBackButton, confirmButton, editAddress, delivery, pickup }: RegionalizationProps) => import("react/jsx-runtime").JSX.Element;
3
+ export declare const Regionalization: ({ setMethod, setPickupName, setCity, deliveryPrice, setUf, setPickupTimes, pricesAndHours, setModalOpen, inputPostalCode, setInputPostalCode, sendPostalCode, status, setStatus, pickupPoints, pickupConfirmScreenText, regionalizeCatalog, titleText, priceStockInformation, moreInfosText, textBackButton, confirmButton, editAddress, delivery, pickup, disabledSearch }: RegionalizationProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,7 +1,7 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
- import { RegionalizationContextProvider as C } from "./context/RegionalizationContext.js";
3
- import { ViewsContainer as S } from "./views/ViewsContainer.js";
4
- /* empty css */const z = ({
2
+ import { RegionalizationContextProvider as S } from "./context/RegionalizationContext.js";
3
+ import { ViewsContainer as k } from "./views/ViewsContainer.js";
4
+ /* empty css */const H = ({
5
5
  setMethod: r,
6
6
  setPickupName: a,
7
7
  setCity: o,
@@ -22,9 +22,9 @@ import { ViewsContainer as S } from "./views/ViewsContainer.js";
22
22
  priceStockInformation: x = " Preços e estoque podem variar de acordo com a loja que irá te atender",
23
23
  moreInfosText: E = "Horários de atendimento e entrega",
24
24
  textBackButton: R = "Voltar",
25
- confirmButton: v = "Ok, Entendi",
26
- editAddress: P = "Alterar",
27
- delivery: f = {
25
+ confirmButton: f = "Ok, Entendi",
26
+ editAddress: v = "Alterar",
27
+ delivery: P = {
28
28
  title: "Receber em Casa",
29
29
  normalDelivery: "Entrega Agendada",
30
30
  expressDelivery: "Entrega Express",
@@ -57,9 +57,10 @@ import { ViewsContainer as S } from "./views/ViewsContainer.js";
57
57
  titleOk: "Retirar na Loja",
58
58
  labelAddress: "Retirar em:",
59
59
  confirmButton: "Retirar na loja"
60
- }
60
+ },
61
+ disabledSearch: C = !1
61
62
  }) => /* @__PURE__ */ e(
62
- C,
63
+ S,
63
64
  {
64
65
  priceStockInformation: x,
65
66
  setMethod: r,
@@ -76,18 +77,19 @@ import { ViewsContainer as S } from "./views/ViewsContainer.js";
76
77
  titleText: j,
77
78
  moreInfosText: E,
78
79
  textBackButton: R,
79
- editAddress: P,
80
+ editAddress: v,
80
81
  deliveryPrice: t,
81
- confirmButton: v,
82
+ confirmButton: f,
82
83
  pickupConfirmScreenText: b,
83
- delivery: f,
84
+ delivery: P,
84
85
  pickup: A,
85
86
  setStatus: u,
86
87
  status: p,
87
88
  regionalizeCatalog: h,
88
- children: /* @__PURE__ */ e(S, {})
89
+ disabledSearch: C,
90
+ children: /* @__PURE__ */ e(k, {})
89
91
  }
90
92
  );
91
93
  export {
92
- z as Regionalization
94
+ H as Regionalization
93
95
  };
@@ -1,4 +1,4 @@
1
1
  import { RegionalizationProps, ContextProps } from '../types';
2
2
 
3
- export declare const RegionalizationContextProvider: ({ setMethod, setPickupName, setCity, setUf, setPickupTimes, pricesAndHours, setModalOpen, inputPostalCode, setInputPostalCode, sendPostalCode, status, setStatus, priceStockInformation, pickupPoints, titleText, moreInfosText, textBackButton, confirmButton, editAddress, delivery, deliveryPrice, pickup, regionalizeCatalog, pickupConfirmScreenText, children }: RegionalizationProps & ContextProps) => import("react/jsx-runtime").JSX.Element;
3
+ export declare const RegionalizationContextProvider: ({ setMethod, setPickupName, setCity, setUf, setPickupTimes, pricesAndHours, setModalOpen, inputPostalCode, setInputPostalCode, sendPostalCode, status, setStatus, priceStockInformation, pickupPoints, titleText, moreInfosText, textBackButton, confirmButton, editAddress, delivery, deliveryPrice, pickup, regionalizeCatalog, pickupConfirmScreenText, disabledSearch, children }: RegionalizationProps & ContextProps) => import("react/jsx-runtime").JSX.Element;
4
4
  export declare const useRegionalizationContext: () => RegionalizationProps & ContextProps;
@@ -1,8 +1,8 @@
1
- import { jsx as Z } from "react/jsx-runtime";
2
- import { createContext as _, useState as e, useEffect as M, useContext as ee } from "react";
3
- import { removeSpecialCharacter as oe } from "../utils/postalCode.js";
1
+ import { jsx as _ } from "react/jsx-runtime";
2
+ import { createContext as M, useState as e, useEffect as ee, useContext as oe } from "react";
3
+ import { removeSpecialCharacter as se } from "../utils/postalCode.js";
4
4
  import { getFullLocalStorage as c } from "../utils/localStorage.js";
5
- const v = _(null), ae = ({
5
+ const v = M(null), re = ({
6
6
  setMethod: o,
7
7
  setPickupName: C,
8
8
  setCity: p,
@@ -27,12 +27,13 @@ const v = _(null), ae = ({
27
27
  pickup: q,
28
28
  regionalizeCatalog: E,
29
29
  pickupConfirmScreenText: W,
30
- children: j
30
+ disabledSearch: j,
31
+ children: B
31
32
  }) => {
32
- const [B, u] = e(), [F, g] = e("InitialView"), [L, m] = e(""), [Q, $] = e(), [s, A] = e(), [G, f] = e(), [J, K] = e(), [N, O] = e(!1), U = {
33
+ const [F, u] = e(), [L, g] = e("InitialView"), [Q, m] = e(""), [$, A] = e(), [s, G] = e(), [J, f] = e(), [K, N] = e(), [O, U] = e(!1), X = {
33
34
  openingTime: (s == null ? void 0 : s.businessHours.businessHoursWeek.openingTime.slice(0, 2)) || "",
34
35
  closingTime: (s == null ? void 0 : s.businessHours.businessHoursWeek.closingTime.slice(0, 2)) || ""
35
- }, X = async () => {
36
+ }, Y = async () => {
36
37
  i({ loading: !0, message: "Carregando..." });
37
38
  const {
38
39
  isValid: n,
@@ -40,32 +41,32 @@ const v = _(null), ae = ({
40
41
  deliveryInfos: a,
41
42
  customShipping: r
42
43
  } = await d();
43
- n && (i({ loading: !1 }), u("delivery"), $(t), i({}), m(l), f(a), g("ConfirmScreen"), K(r));
44
- }, Y = () => {
44
+ n && (i({ loading: !1 }), u("delivery"), A(t), i({}), m(l), f(a), g("ConfirmScreen"), N(r));
45
+ }, Z = () => {
45
46
  /\d{8}$/.test(
46
- oe(l)
47
- ) ? X() : i({
47
+ se(l)
48
+ ) ? Y() : i({
48
49
  status: "failed",
49
50
  loading: !1,
50
51
  message: "Que Pena, ainda não entregamos na sua região."
51
52
  });
52
53
  };
53
- return M(() => {
54
+ return ee(() => {
54
55
  var n, t, a, r;
55
56
  m((t = (n = c()) == null ? void 0 : n.userAddressInfos) == null ? void 0 : t.postalCode), o == null || o((a = c()) == null ? void 0 : a.regionalized), f((r = c()) == null ? void 0 : r.deliveryInfos);
56
- }, []), /* @__PURE__ */ Z(
57
+ }, []), /* @__PURE__ */ _(
57
58
  v.Provider,
58
59
  {
59
60
  value: {
60
- backToDelivery: N,
61
- setBackToDelivery: O,
61
+ backToDelivery: O,
62
+ setBackToDelivery: U,
62
63
  setMethod: o,
63
64
  priceStockInformation: T,
64
65
  setPickupName: C,
65
66
  setCity: p,
66
67
  setUf: x,
67
68
  setPickupTimes: y,
68
- pickupTimes: U,
69
+ pickupTimes: X,
69
70
  pickupConfirmScreenText: W,
70
71
  pricesAndHours: R,
71
72
  setModalOpen: w,
@@ -77,30 +78,31 @@ const v = _(null), ae = ({
77
78
  pickupPoints: b,
78
79
  titleText: z,
79
80
  moreInfosText: P,
80
- customShippingData: J,
81
+ customShippingData: K,
81
82
  textBackButton: S,
82
83
  confirmButton: h,
83
84
  editAddress: H,
84
85
  delivery: V,
85
86
  pickup: q,
86
- view: F,
87
+ view: L,
87
88
  setView: g,
88
- postalCodeValidation: Y,
89
- address: Q,
89
+ postalCodeValidation: Z,
90
+ address: $,
90
91
  pickupAddress: s,
91
- setPickupAddress: A,
92
- deliveryRequestInfos: G,
93
- postalCode: L,
94
- internalMethod: B,
92
+ setPickupAddress: G,
93
+ deliveryRequestInfos: J,
94
+ postalCode: Q,
95
+ internalMethod: F,
95
96
  setInternalMethod: u,
96
97
  regionalizeCatalog: E,
98
+ disabledSearch: j,
97
99
  deliveryPrice: k
98
100
  },
99
- children: j
101
+ children: B
100
102
  }
101
103
  );
102
- }, re = () => {
103
- const o = ee(v);
104
+ }, le = () => {
105
+ const o = oe(v);
104
106
  if (!o)
105
107
  throw new Error(
106
108
  "useRegionalizationContext must be used within a RegionalizationContextProvider"
@@ -108,6 +110,6 @@ const v = _(null), ae = ({
108
110
  return o;
109
111
  };
110
112
  export {
111
- ae as RegionalizationContextProvider,
112
- re as useRegionalizationContext
113
+ re as RegionalizationContextProvider,
114
+ le as useRegionalizationContext
113
115
  };
@@ -78,6 +78,7 @@ export interface RegionalizationProps {
78
78
  confirmButton?: string;
79
79
  };
80
80
  regionalizeCatalog?: (postalCodeChoiced?: string) => void;
81
+ disabledSearch?: boolean;
81
82
  children?: ReactNode;
82
83
  }
83
84
  export interface Status {
@@ -1,15 +1,15 @@
1
- import { jsxs as o, Fragment as h, jsx as e } from "react/jsx-runtime";
2
- import { useRef as f, useState as v, useEffect as b } from "react";
3
- import { Title as S } from "../components/Title.js";
4
- import { PickupPoint as w } from "../components/PickupPoint.js";
5
- import { GlassIcon as x } from "../../../assets/svgs/GlassIcon.js";
6
- import { SetViewButton as N } from "../components/SetViewButton.js";
7
- import { ArrowIcon as u } from "../../../assets/svgs/ArrowIcon.js";
8
- import { useRegionalizationContext as C } from "../context/RegionalizationContext.js";
9
- const E = () => {
10
- const { pickup: r, pickupPoints: l, textBackButton: m } = C(), a = f(null), [n, s] = v(l), d = l.length > 0 ? l : [];
11
- b(() => {
12
- s(d);
1
+ import { jsxs as o, Fragment as f, jsx as e } from "react/jsx-runtime";
2
+ import { useRef as v, useState as b, useEffect as S } from "react";
3
+ import { Title as w } from "../components/Title.js";
4
+ import { PickupPoint as x } from "../components/PickupPoint.js";
5
+ import { GlassIcon as N } from "../../../assets/svgs/GlassIcon.js";
6
+ import { SetViewButton as u } from "../components/SetViewButton.js";
7
+ import { ArrowIcon as C } from "../../../assets/svgs/ArrowIcon.js";
8
+ import { useRegionalizationContext as F } from "../context/RegionalizationContext.js";
9
+ const z = () => {
10
+ const { pickup: r, pickupPoints: l, textBackButton: d, disabledSearch: m } = F(), a = v(null), [n, s] = b(l), h = l.length > 0 ? l : [];
11
+ S(() => {
12
+ s(h);
13
13
  }, [l]);
14
14
  const i = () => {
15
15
  s(
@@ -21,9 +21,9 @@ const E = () => {
21
21
  )
22
22
  );
23
23
  };
24
- return /* @__PURE__ */ o(h, { children: [
25
- /* @__PURE__ */ e(S, { title: r == null ? void 0 : r.title }),
26
- /* @__PURE__ */ o("div", { className: "stores-filter", children: [
24
+ return /* @__PURE__ */ o(f, { children: [
25
+ /* @__PURE__ */ e(w, { title: r == null ? void 0 : r.title }),
26
+ !m && /* @__PURE__ */ o("div", { className: "stores-filter", children: [
27
27
  /* @__PURE__ */ e("p", { children: r == null ? void 0 : r.labelFilter }),
28
28
  /* @__PURE__ */ o("div", { children: [
29
29
  /* @__PURE__ */ e(
@@ -40,7 +40,7 @@ const E = () => {
40
40
  {
41
41
  className: "filter-ico-container",
42
42
  onClick: () => i(),
43
- children: /* @__PURE__ */ e(x, {})
43
+ children: /* @__PURE__ */ e(N, {})
44
44
  }
45
45
  )
46
46
  ] }),
@@ -48,7 +48,7 @@ const E = () => {
48
48
  ] }),
49
49
  /* @__PURE__ */ e("p", { className: "stores-label", children: r == null ? void 0 : r.labelStores }),
50
50
  /* @__PURE__ */ e("div", { className: "stores-container", children: n == null ? void 0 : n.map((t) => /* @__PURE__ */ e(
51
- w,
51
+ x,
52
52
  {
53
53
  pickupPointInfos: t
54
54
  },
@@ -56,18 +56,18 @@ const E = () => {
56
56
  )) }),
57
57
  /* @__PURE__ */ e("br", {}),
58
58
  /* @__PURE__ */ o(
59
- N,
59
+ u,
60
60
  {
61
61
  view: "PickupPointInfoScreen",
62
62
  className: "back-button-all-store",
63
63
  children: [
64
- /* @__PURE__ */ e("span", { children: /* @__PURE__ */ e(u, { color: "var(--color-main)" }) }),
65
- m
64
+ /* @__PURE__ */ e("span", { children: /* @__PURE__ */ e(C, { color: "var(--color-main)" }) }),
65
+ d
66
66
  ]
67
67
  }
68
68
  )
69
69
  ] });
70
70
  };
71
71
  export {
72
- E as AllStoresScreen
72
+ z as AllStoresScreen
73
73
  };