@plurix/ecom-components 0.0.2-beta.6 → 0.0.2-beta.7

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.
@@ -67,7 +67,7 @@ import { DefaultProps as L } from "./utils/defaultProps.js";
67
67
  {
68
68
  position: "prev",
69
69
  style: f.arrows,
70
- iconColor: r.iconColor ?? "#ccc",
70
+ iconColor: r.iconColor || "#ccc",
71
71
  onClick: () => W("prev")
72
72
  }
73
73
  ) }),
@@ -98,7 +98,7 @@ import { DefaultProps as L } from "./utils/defaultProps.js";
98
98
  {
99
99
  position: "next",
100
100
  style: f.arrows,
101
- iconColor: r.iconColor ?? "#ccc",
101
+ iconColor: r.iconColor || "#ccc",
102
102
  onClick: () => W("next")
103
103
  }
104
104
  ) : "" })
@@ -115,7 +115,7 @@ import { DefaultProps as L } from "./utils/defaultProps.js";
115
115
  style: {
116
116
  ...f.bullets,
117
117
  transition: "all 0.8s ease-out",
118
- backgroundColor: `${M === e ? (c == null ? void 0 : c.bulletEnableColor) ?? "#ff0000" : (c == null ? void 0 : c.bulletDisableColor) ?? "#ccc"}`
118
+ backgroundColor: `${M === e ? (c == null ? void 0 : c.bulletEnableColor) || "#ff0000" : (c == null ? void 0 : c.bulletDisableColor) || "#ccc"}`
119
119
  }
120
120
  },
121
121
  e
@@ -35,7 +35,7 @@ import { TIPS_LENGTH as h } from "./constants/tips.js";
35
35
  },
36
36
  handleNextStep: (o) => {
37
37
  e(o.target.innerText);
38
- const f = n ?? r;
38
+ const f = n || r;
39
39
  t < h ? m(t + 1) : f();
40
40
  }
41
41
  }
@@ -4,14 +4,14 @@ import { DeliveryExpress as S } from "./DeliveryExpress.js";
4
4
  import { useRegionalizationContext as f } from "../context/RegionalizationContext.js";
5
5
  const C = ({ containerClassName: g, delivery: e }) => {
6
6
  var o, i, p, c, m;
7
- const { customShippingData: l } = f(), { shippingList: s, isExpressEligible: D, expressShippingCmsQuantity: a } = l ?? {}, n = {
7
+ const { customShippingData: l } = f(), { shippingList: s, isExpressEligible: D, expressShippingCmsQuantity: a } = l || {}, n = {
8
8
  normalDeliveryPrice: (o = s == null ? void 0 : s.find(
9
9
  (r) => r.id === "Entrega Padrão"
10
10
  )) == null ? void 0 : o.listPrice,
11
11
  expressDeliveryPrice: (i = s == null ? void 0 : s.find(
12
12
  (r) => r.id === "Entrega Express"
13
13
  )) == null ? void 0 : i.listPrice,
14
- shippingEstimate: ((p = s == null ? void 0 : s.find((r) => r.id === "Entrega Express")) == null ? void 0 : p.shippingEstimate) ?? "",
14
+ shippingEstimate: ((p = s == null ? void 0 : s.find((r) => r.id === "Entrega Express")) == null ? void 0 : p.shippingEstimate) || "",
15
15
  expressShippingQuantity: a || ""
16
16
  }, E = (c = e == null ? void 0 : e.expressMessage) == null ? void 0 : c.replace(
17
17
  "$Q",
@@ -9,7 +9,7 @@ const d = ({ title: n, view: i }) => {
9
9
  "button",
10
10
  {
11
11
  onClick: () => {
12
- o == null || o(i ?? "InitialView"), i || e(!1);
12
+ o == null || o(i || "InitialView"), i || e(!1);
13
13
  },
14
14
  children: /* @__PURE__ */ t(l, {})
15
15
  }
@@ -30,8 +30,8 @@ const v = _(null), ae = ({
30
30
  children: j
31
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
- openingTime: (s == null ? void 0 : s.businessHours.businessHoursWeek.openingTime.slice(0, 2)) ?? "",
34
- closingTime: (s == null ? void 0 : s.businessHours.businessHoursWeek.closingTime.slice(0, 2)) ?? ""
33
+ openingTime: (s == null ? void 0 : s.businessHours.businessHoursWeek.openingTime.slice(0, 2)) || "",
34
+ closingTime: (s == null ? void 0 : s.businessHours.businessHoursWeek.closingTime.slice(0, 2)) || ""
35
35
  }, X = async () => {
36
36
  i({ loading: !0, message: "Carregando..." });
37
37
  const {
@@ -6,7 +6,7 @@ const c = (i, t, m) => {
6
6
  deliveryName: String(t == null ? void 0 : t.deliveryName),
7
7
  shippingEstimate: String(t == null ? void 0 : t.shippingEstimate)
8
8
  });
9
- g("postalCode", m ?? ""), g("method", "delivery"), g("deliveryInfos", p);
9
+ g("postalCode", m || ""), g("method", "delivery"), g("deliveryInfos", p);
10
10
  };
11
11
  export {
12
12
  c as deliverySetData
@@ -5,11 +5,11 @@ const n = (t, e) => {
5
5
  if (a)
6
6
  return localStorage.getItem(t);
7
7
  }, d = () => {
8
- const t = s("postalCode"), e = s("method"), o = JSON.parse(s("deliveryInfos") ?? "{}"), c = {
9
- postalCode: t ?? "00000-000",
8
+ const t = s("postalCode"), e = s("method"), o = JSON.parse(s("deliveryInfos") || "{}"), c = {
9
+ postalCode: t || "00000-000",
10
10
  city: o == null ? void 0 : o.city,
11
11
  uf: o == null ? void 0 : o.uf
12
- }, r = e ?? void 0;
12
+ }, r = e || void 0;
13
13
  return {
14
14
  regionalized: r,
15
15
  deliveryInfos: r ? o : void 0,
@@ -1,2 +1,3 @@
1
- export declare const postalCodeMask: (e: any) => any;
1
+ /// <reference types="react" />
2
+ export declare const postalCodeMask: (e: React.KeyboardEvent<HTMLInputElement>) => import('react').KeyboardEvent<HTMLInputElement>;
2
3
  export declare const removeSpecialCharacter: (value: string) => string;
@@ -16,7 +16,7 @@ const E = () => {
16
16
  l == null ? void 0 : l.filter(
17
17
  ({ name: t }) => {
18
18
  var c;
19
- return t.toLowerCase().includes(((c = a.current) == null ? void 0 : c.value.toLowerCase()) ?? "");
19
+ return t.toLowerCase().includes(((c = a.current) == null ? void 0 : c.value.toLowerCase()) || "");
20
20
  }
21
21
  )
22
22
  );
@@ -15,7 +15,7 @@ const I = () => {
15
15
  internalMethod: l,
16
16
  pickupTimes: a,
17
17
  pickupConfirmScreenText: c
18
- } = v(), d = `Retiradas entre ${(a == null ? void 0 : a.openingTime) ?? "08"}h e ${(a == null ? void 0 : a.closingTime) ?? "20"}h, ou agendada`, h = c && c !== "" ? c : d;
18
+ } = v(), d = `Retiradas entre ${(a == null ? void 0 : a.openingTime) || "08"}h e ${(a == null ? void 0 : a.closingTime) || "20"}h, ou agendada`, h = c && c !== "" ? c : d;
19
19
  return /* @__PURE__ */ o(m, { children: [
20
20
  /* @__PURE__ */ n(
21
21
  f,
@@ -30,7 +30,7 @@ const I = () => {
30
30
  ] }),
31
31
  l === "delivery" ? /* @__PURE__ */ o(m, { children: [
32
32
  /* @__PURE__ */ n("span", { children: t == null ? void 0 : t.cep }),
33
- /* @__PURE__ */ n("span", { className: "address-delivery", children: (t == null ? void 0 : t.logradouro) ?? (t == null ? void 0 : t.localidade) })
33
+ /* @__PURE__ */ n("span", { className: "address-delivery", children: (t == null ? void 0 : t.logradouro) || (t == null ? void 0 : t.localidade) })
34
34
  ] }) : /* @__PURE__ */ o(m, { children: [
35
35
  /* @__PURE__ */ n("span", { children: r == null ? void 0 : r.name }),
36
36
  /* @__PURE__ */ o("p", { className: "address-pickup", children: [
@@ -33,7 +33,7 @@ const R = () => {
33
33
  /* @__PURE__ */ e("h4", { children: "Receber em casa" }),
34
34
  /* @__PURE__ */ i("p", { children: [
35
35
  " A partir de ",
36
- u(m ?? 0)
36
+ u(m || 0)
37
37
  ] })
38
38
  ] }),
39
39
  /* @__PURE__ */ i(n, { view: "PickupPointInfoScreen", className: "option", children: [
@@ -42,7 +42,7 @@ const T = () => {
42
42
  type: "text",
43
43
  onChange: (i) => m(i.target.value),
44
44
  maxLength: 9,
45
- placeholder: p ?? "00000-000",
45
+ placeholder: p || "00000-000",
46
46
  onKeyUp: P
47
47
  }
48
48
  ),
@@ -2,7 +2,7 @@
2
2
  interface TourStep {
3
3
  content: string;
4
4
  }
5
- interface TourTooltipProps {
5
+ export interface TourTooltipProps {
6
6
  step: TourStep;
7
7
  position: {
8
8
  top: number;
@@ -1,49 +1,45 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
- import a from "react";
3
- import { render as c, fireEvent as d } from "@testing-library/react";
2
+ import l from "react";
3
+ import { render as i, fireEvent as a } from "@testing-library/react";
4
4
  import "@testing-library/jest-dom";
5
- import { Tour as i } from "../Tour.js";
6
- jest.mock("../components/TourTooltip", () => ({ TourTooltip: a.forwardRef(
7
- ({ stepNumber: e, totalSteps: t, onPrevious: s, onNext: o, ...l }, p) => /* @__PURE__ */ r("div", { ref: p, ...l, "data-testid": "tour-tooltip" })
5
+ import { Tour as s } from "../Tour.js";
6
+ jest.mock("../components/TourTooltip", () => ({ TourTooltip: l.forwardRef(
7
+ (e, o) => /* @__PURE__ */ r("div", { ref: o, "data-testid": "tour-tooltip" })
8
8
  ) }));
9
9
  jest.mock("../components/TourOverlay", () => ({
10
- TourOverlay: ({
11
- stepNumber: n,
12
- onClick: e,
13
- ...t
14
- }) => /* @__PURE__ */ r("div", { ...t, onClick: e, "data-testid": "tour-overlay" })
10
+ TourOverlay: ({ onClick: t }) => /* @__PURE__ */ r("div", { onClick: t, "data-testid": "tour-overlay" })
15
11
  }));
16
12
  describe("Tour", () => {
17
- const n = [
13
+ const t = [
18
14
  { selector: ".step-1", content: "Step 1 Content" },
19
15
  { selector: ".step-2", content: "Step 2 Content" },
20
16
  { selector: ".step-3", content: "Step 3 Content" }
21
- ], e = jest.fn(), t = jest.fn(), s = jest.fn();
17
+ ], e = jest.fn(), o = jest.fn(), c = jest.fn();
22
18
  it("should render correctly with initial step", () => {
23
- const { getByTestId: o } = c(
19
+ const { getByTestId: n } = i(
24
20
  /* @__PURE__ */ r(
25
- i,
21
+ s,
26
22
  {
27
- steps: n,
23
+ steps: t,
28
24
  handleCloseAction: e,
29
- handleFinishAction: t,
30
- genericTaggingEvent: s
25
+ handleFinishAction: o,
26
+ genericTaggingEvent: c
31
27
  }
32
28
  )
33
29
  );
34
- expect(o("tour-tooltip")).toBeInTheDocument(), expect(o("tour-overlay")).toBeInTheDocument();
30
+ expect(n("tour-tooltip")).toBeInTheDocument(), expect(n("tour-overlay")).toBeInTheDocument();
35
31
  }), it("should call handleCloseAction when TourOverlay is clicked", () => {
36
- const { getByTestId: o } = c(
32
+ const { getByTestId: n } = i(
37
33
  /* @__PURE__ */ r(
38
- i,
34
+ s,
39
35
  {
40
- steps: n,
36
+ steps: t,
41
37
  handleCloseAction: e,
42
- handleFinishAction: t,
43
- genericTaggingEvent: s
38
+ handleFinishAction: o,
39
+ genericTaggingEvent: c
44
40
  }
45
41
  )
46
42
  );
47
- d.click(o("tour-overlay")), expect(e).toHaveBeenCalled();
43
+ a.click(n("tour-overlay")), expect(e).toHaveBeenCalled();
48
44
  });
49
45
  });
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@plurix/ecom-components",
3
3
  "author": "Plurix",
4
4
  "private": false,
5
- "version": "0.0.2-beta.6",
5
+ "version": "0.0.2-beta.7",
6
6
  "type": "module",
7
7
  "main": "dist/main.js",
8
8
  "types": "dist/main.d.ts",