@tesouro/embedded-components-react 0.4.14 → 0.4.15

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.
@@ -1,7 +1,19 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/cards-widget/feature/dist/index3.js
2
2
  var e = {
3
3
  list: "cards-list",
4
- cardFaceSwatch: "card-face-swatch"
5
- };
4
+ cardFaceSwatch: "card-face-swatch",
5
+ rowPrefix: "cards-list-row",
6
+ empty: "cards-list-empty",
7
+ error: "cards-list-error",
8
+ detailsSheet: "cards-list-details-sheet"
9
+ }, t = {
10
+ root: e.list,
11
+ empty: e.empty,
12
+ error: e.error,
13
+ row: {
14
+ rootPrefix: e.rowPrefix,
15
+ cardFaceSwatch: { root: e.cardFaceSwatch }
16
+ }
17
+ }, n = { root: e.detailsSheet };
6
18
  //#endregion
7
- export { e as cardsWidgetTestIds };
19
+ export { n as cardsListDetailsSheetTestIds, t as cardsListTestIds, e as cardsWidgetTestIds };
@@ -5,77 +5,75 @@
5
5
  import { WidgetProvider as e } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
6
6
  import "../../../shared/feature/dist/index.js";
7
7
  import { WIDGET_NAME as t } from "./index2.js";
8
- import { cardsWidgetTestIds as n } from "./index3.js";
9
- import { resolveCardsListLabels as r } from "../../ui/dist/lib/CardsList/labels.js";
10
- import { CardsList as i } from "../../ui/dist/lib/CardsList/CardsList.js";
11
- import { CardsListDetailsSheet as a } from "../../ui/dist/lib/CardsList/CardsListDetailsSheet.js";
8
+ import { cardsListDetailsSheetTestIds as n, cardsListTestIds as r } from "./index3.js";
9
+ import { resolveCardsListLabels as i } from "../../ui/dist/lib/CardsList/labels.js";
10
+ import { CardsList as a } from "../../ui/dist/lib/CardsList/CardsList.js";
11
+ import { CardsListDetailsSheet as o } from "../../ui/dist/lib/CardsList/CardsListDetailsSheet.js";
12
12
  import "../../ui/dist/index.js";
13
- import { useCardsWidget as o } from "./index8.js";
14
- import { CardDetailsWidget as s } from "../../../card-details-widget/feature/dist/index13.js";
13
+ import { useCardsWidget as s } from "./index8.js";
14
+ import { CardDetailsWidget as c } from "../../../card-details-widget/feature/dist/index13.js";
15
15
  import "../../../card-details-widget/feature/dist/index.js";
16
- import { CreateCardWidget as c } from "../../../create-card-widget/feature/dist/index8.js";
16
+ import { CreateCardWidget as l } from "../../../create-card-widget/feature/dist/index8.js";
17
17
  import "../../../create-card-widget/feature/dist/index.js";
18
- import { useCallback as l, useMemo as u, useState as d } from "react";
19
- import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
18
+ import { useCallback as u, useMemo as d, useState as f } from "react";
19
+ import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
20
20
  //#region ../../libs/tesouro-embedded-components-react/cards-widget/feature/dist/index9.js
21
- function h({ cardProgram: e, pagination: t, defaultPagination: h, onPaginationChange: g, labels: _, featureLabels: v, selectedCardId: y, defaultSelectedCardId: b, onSelectedCardIdChange: x, cardDetailsLabels: S, cardDetailsFeatureLabels: C, cardDetailsActivateLabels: w, bankLogoSrc: T, bankLogoAlt: E, cardArtSrc: D, createCardLabels: O, createCardFeatureLabels: k, onCreateCard: A, onActivateCard: j }) {
22
- let { selectedCardId: M, onSelectCard: N, onCreateCardClick: P, canCreateCard: F, canReadCards: I, ...L } = o({
21
+ function g({ cardProgram: e, pagination: t, defaultPagination: g, onPaginationChange: _, labels: v, featureLabels: y, selectedCardId: b, defaultSelectedCardId: x, onSelectedCardIdChange: S, cardDetailsLabels: C, cardDetailsFeatureLabels: w, cardDetailsActivateLabels: T, bankLogoSrc: E, bankLogoAlt: D, cardArtSrc: O, createCardLabels: k, createCardFeatureLabels: A, onCreateCard: j, onActivateCard: M }) {
22
+ let { selectedCardId: N, onSelectCard: P, onCreateCardClick: F, canCreateCard: I, canReadCards: L, ...R } = s({
23
23
  cardProgram: e,
24
24
  pagination: t,
25
- defaultPagination: h,
26
- onPaginationChange: g,
27
- featureLabels: v,
28
- selectedCardId: y,
29
- defaultSelectedCardId: b,
30
- onSelectedCardIdChange: x,
31
- onCreateCard: A,
32
- onActivateCard: j,
33
- cardArtSrc: D
34
- }), R = u(() => r(_), [_]), [z, B] = d(!1), [V, H] = d(0), [U, W] = d(M), [G, K] = d(null), q = l(() => {
35
- M !== null && N(null), H((e) => e + 1), B(!0);
36
- }, [M, N]), J = l(() => {
37
- B(!1), M !== null && N(null);
38
- }, [M, N]), Y = l((e) => {
39
- B(!1), N(e);
40
- }, [N]), X = e === "debit" && !!D && !!F && P === void 0, Z = z && M === null && X;
41
- z && (M !== null || !X) && B(!1), Z ? G !== "create" && K("create") : M !== null && (G !== "details" && K("details"), M !== U && W(M));
42
- let Q = G === "create", $ = M !== null || Z;
43
- return /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(i, {
44
- ...L,
45
- canCreateCard: F,
46
- onCreateCardClick: P ?? q,
47
- labels: R,
48
- testIds: {
49
- root: n.list,
50
- row: { cardFaceSwatch: { root: n.cardFaceSwatch } }
51
- }
52
- }), /* @__PURE__ */ p(a, {
53
- isOpen: $,
54
- labels: Q ? R.createSheet : R.detailsSheet,
55
- contentClassName: Q ? "ttw:overflow-hidden ttw:p-0 ttw:min-h-0" : void 0,
56
- onClose: J,
57
- children: Q && X && D ? /* @__PURE__ */ p(c, {
58
- cardArtSrc: D,
59
- labels: O,
60
- featureLabels: k,
61
- onClose: J,
62
- onCancel: J,
63
- onViewCard: I ? Y : void 0,
25
+ defaultPagination: g,
26
+ onPaginationChange: _,
27
+ featureLabels: y,
28
+ selectedCardId: b,
29
+ defaultSelectedCardId: x,
30
+ onSelectedCardIdChange: S,
31
+ onCreateCard: j,
32
+ onActivateCard: M,
33
+ cardArtSrc: O
34
+ }), z = d(() => i(v), [v]), [B, V] = f(!1), [H, U] = f(0), [W, G] = f(N), [K, q] = f(null), J = u(() => {
35
+ N !== null && P(null), U((e) => e + 1), V(!0);
36
+ }, [N, P]), Y = u(() => {
37
+ V(!1), N !== null && P(null);
38
+ }, [N, P]), X = u((e) => {
39
+ V(!1), P(e);
40
+ }, [P]), Z = e === "debit" && !!O && !!I && F === void 0, Q = B && N === null && Z;
41
+ B && (N !== null || !Z) && V(!1), Q ? K !== "create" && q("create") : N !== null && (K !== "details" && q("details"), N !== W && G(N));
42
+ let $ = K === "create", ee = N !== null || Q;
43
+ return /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(a, {
44
+ ...R,
45
+ canCreateCard: I,
46
+ onCreateCardClick: F ?? J,
47
+ labels: z,
48
+ testIds: r
49
+ }), /* @__PURE__ */ m(o, {
50
+ isOpen: ee,
51
+ labels: $ ? z.createSheet : z.detailsSheet,
52
+ contentClassName: $ ? "ttw:overflow-hidden ttw:p-0 ttw:min-h-0" : void 0,
53
+ onClose: Y,
54
+ testIds: n,
55
+ children: $ && Z && O ? /* @__PURE__ */ m(l, {
56
+ cardArtSrc: O,
57
+ labels: k,
58
+ featureLabels: A,
59
+ onClose: Y,
60
+ onCancel: Y,
61
+ onViewCard: L ? X : void 0,
64
62
  className: "ttw:min-h-0 ttw:flex-1"
65
- }, V) : U === null ? null : /* @__PURE__ */ p(s, {
66
- cardId: U,
63
+ }, H) : W === null ? null : /* @__PURE__ */ m(c, {
64
+ cardId: W,
67
65
  cardProgram: e,
68
- labels: S,
69
- activateLabels: w,
70
- featureLabels: C,
71
- bankLogoSrc: T,
72
- bankLogoAlt: E,
73
- onClose: J
74
- }, U)
66
+ labels: C,
67
+ activateLabels: T,
68
+ featureLabels: w,
69
+ bankLogoSrc: E,
70
+ bankLogoAlt: D,
71
+ onClose: Y
72
+ }, W)
75
73
  })] });
76
74
  }
77
- function g({ baseUrl: n, widgetToken: r, organizationId: i, configClient: a, gatewayRouting: o, linkComponent: s, implementation: c, uiFramework: l, errorFallback: u, onError: d, analytics: f, disclosuresAcceptance: m, providerLabels: g, ..._ }) {
78
- return /* @__PURE__ */ p(e, {
75
+ function _({ baseUrl: n, widgetToken: r, organizationId: i, configClient: a, gatewayRouting: o, linkComponent: s, implementation: c, uiFramework: l, errorFallback: u, onError: d, analytics: f, disclosuresAcceptance: p, providerLabels: h, ..._ }) {
76
+ return /* @__PURE__ */ m(e, {
79
77
  widgetName: t,
80
78
  baseUrl: n,
81
79
  widgetToken: r,
@@ -88,10 +86,10 @@ function g({ baseUrl: n, widgetToken: r, organizationId: i, configClient: a, gat
88
86
  errorFallback: u,
89
87
  onError: d,
90
88
  analytics: f,
91
- disclosuresAcceptance: m,
92
- providerLabels: g,
93
- children: /* @__PURE__ */ p(h, { ..._ })
89
+ disclosuresAcceptance: p,
90
+ providerLabels: h,
91
+ children: /* @__PURE__ */ m(g, { ..._ })
94
92
  });
95
93
  }
96
94
  //#endregion
97
- export { g as CardsWidget, g as default };
95
+ export { _ as CardsWidget, _ as default };
@@ -88,7 +88,8 @@ function w({ rows: t, columns: g, isLoading: S = !1, isError: w = !1, canToggleS
88
88
  title: U.errorTitle,
89
89
  description: U.errorDescription,
90
90
  retryLabel: U.retryButton,
91
- onRetry: A
91
+ onRetry: A,
92
+ testId: V?.error
92
93
  })
93
94
  })
94
95
  }) : S ? /* @__PURE__ */ _(C, { columnCount: K }) : t.length === 0 ? /* @__PURE__ */ _(c, {
@@ -105,7 +106,8 @@ function w({ rows: t, columns: g, isLoading: S = !1, isError: w = !1, canToggleS
105
106
  "aria-hidden": !0,
106
107
  className: "ttw:size-4"
107
108
  }),
108
- onAction: W ? k : void 0
109
+ onAction: W ? k : void 0,
110
+ testId: V?.empty
109
111
  })
110
112
  })
111
113
  }) : t.map((e) => /* @__PURE__ */ _(p, {
@@ -7,8 +7,8 @@ import { CARDS_LIST_LABELS_EN as a } from "./labels.js";
7
7
  import { useMemo as o } from "react";
8
8
  import { jsx as s, jsxs as c } from "react/jsx-runtime";
9
9
  //#region ../../libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardsListDetailsSheet.js
10
- function l({ isOpen: l, onClose: u, labels: d, contentClassName: f, children: p }) {
11
- let m = o(() => ({
10
+ function l({ isOpen: l, onClose: u, labels: d, contentClassName: f, testIds: p, children: m }) {
11
+ let h = o(() => ({
12
12
  ...a.detailsSheet,
13
13
  ...d
14
14
  }), [d]);
@@ -19,17 +19,18 @@ function l({ isOpen: l, onClose: u, labels: d, contentClassName: f, children: p
19
19
  },
20
20
  children: /* @__PURE__ */ c(t, {
21
21
  showCloseButton: !1,
22
+ "data-testid": p?.root,
22
23
  className: i("ttw:w-168 ttw:sm:max-w-168", "ttw:!gap-0", f ?? "ttw:overflow-y-auto"),
23
24
  children: [
24
25
  /* @__PURE__ */ s(r, {
25
26
  className: "ttw:sr-only",
26
- children: m.title
27
+ children: h.title
27
28
  }),
28
29
  /* @__PURE__ */ s(n, {
29
30
  className: "ttw:sr-only",
30
- children: m.description
31
+ children: h.description
31
32
  }),
32
- p
33
+ m
33
34
  ]
34
35
  })
35
36
  });
@@ -80,7 +80,7 @@ function l({ row: i, columns: a, labels: l, testIds: u }) {
80
80
  })
81
81
  };
82
82
  return /* @__PURE__ */ s(n, {
83
- "data-testid": `cards-list-row-${i.key}`,
83
+ "data-testid": u?.rootPrefix ? `${u.rootPrefix}-${i.key}` : void 0,
84
84
  className: f ? "ttw:relative ttw:h-18 ttw:cursor-pointer" : "ttw:h-18",
85
85
  children: [a.map((e, n) => /* @__PURE__ */ s(t, { children: [n === 0 && f ? /* @__PURE__ */ o("button", {
86
86
  type: "button",
@@ -1,5 +1,5 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
2
- var e = "@tesouro/embedded-components-react", t = "0.4.14", n = "781f727543468571a818be891ac48d7daa079a14", r = Object.freeze({
2
+ var e = "@tesouro/embedded-components-react", t = "0.4.15", n = "a15437f1c29a0b2963f6e4505115338ae1a6198c", r = Object.freeze({
3
3
  library_name: e,
4
4
  library_version: t,
5
5
  library_sha: n
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tesouro/embedded-components-react",
3
- "version": "0.4.14",
3
+ "version": "0.4.15",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "packageDepSync": {