@tesouro/embedded-components-react 0.11.167 → 0.11.169

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 (20) hide show
  1. package/dist/index.d.ts +3 -0
  2. package/dist/lib/BankAccountsWidget.d.ts +1 -0
  3. package/dist/lib/CreditCardsWidget.d.ts +1 -0
  4. package/dist/lib/DebitCardsWidget.d.ts +1 -0
  5. package/dist/lib/LinkedAccountsWidget.d.ts +1 -0
  6. package/dist/lib/WidgetSuite.d.ts +3 -0
  7. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/lib/BankAccountsWidget/BankAccountsWidget.js +1 -0
  8. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/lib/useBankAccountsWidget.js +122 -121
  9. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/lib/BankAccountsWidgetUi.js +63 -59
  10. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/lib/labels.js +1 -0
  11. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/lib/testIds.js +2 -0
  12. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/lib/useCardsWidget.js +161 -160
  13. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardsList.js +126 -122
  14. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/labels.js +1 -0
  15. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/useLinkedAccountsWidget.js +192 -191
  16. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index13.js +2 -1
  17. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index14.js +100 -96
  18. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index6.js +1 -0
  19. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  20. package/package.json +1 -1
@@ -5,51 +5,52 @@
5
5
  import { Badge as e, Button as t, DataTable as n, Switch as r, TablePagination as i, cn as a } from "../../../../../../../packages/shared-ui-shadcn/dist/index.js";
6
6
  import { EmptyState as o } from "../../../../../shared/ui/dist/lib/EmptyState/EmptyState.js";
7
7
  import { ErrorState as s } from "../../../../../shared/ui/dist/lib/ErrorState/ErrorState.js";
8
+ import { NoAccessState as c } from "../../../../../shared/ui/dist/lib/StatePanel/NoAccessState.js";
8
9
  import "../../../../../shared/ui/dist/index.js";
9
- import { resolveCardsListLabels as c } from "./labels.js";
10
- import { useId as l, useMemo as u } from "react";
11
- import { jsx as d, jsxs as f } from "react/jsx-runtime";
12
- import { CreditCardIcon as p } from "lucide-react";
10
+ import { resolveCardsListLabels as l } from "./labels.js";
11
+ import { useId as u, useMemo as d } from "react";
12
+ import { jsx as f, jsxs as p } from "react/jsx-runtime";
13
+ import { CreditCardIcon as m } from "lucide-react";
13
14
  // ../../libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardsList.js
14
- var m = [
15
+ var h = [
15
16
  10,
16
17
  25,
17
18
  50
18
- ], h = [], g = () => void 0;
19
- function _({ row: e, labels: t, isClickable: n }) {
20
- return /* @__PURE__ */ f("span", {
19
+ ], g = [], _ = () => void 0;
20
+ function v({ row: e, labels: t, isClickable: n }) {
21
+ return /* @__PURE__ */ p("span", {
21
22
  className: "ttw:flex ttw:min-w-0 ttw:flex-col ttw:gap-0.5",
22
- children: [/* @__PURE__ */ f("span", {
23
+ children: [/* @__PURE__ */ p("span", {
23
24
  className: "ttw:flex ttw:gap-1 ttw:text-sm",
24
25
  children: [
25
- /* @__PURE__ */ d("span", {
26
+ /* @__PURE__ */ f("span", {
26
27
  className: a("ttw:truncate ttw:font-medium", n ? "ttw:text-primary" : "ttw:text-foreground"),
27
28
  children: e.nickname
28
29
  }),
29
- /* @__PURE__ */ d("span", {
30
+ /* @__PURE__ */ f("span", {
30
31
  className: "ttw:text-muted-foreground",
31
32
  "aria-hidden": !0,
32
33
  children: t.cardNameSeparator
33
34
  }),
34
- /* @__PURE__ */ d("span", {
35
+ /* @__PURE__ */ f("span", {
35
36
  className: "ttw:font-normal ttw:text-muted-foreground",
36
37
  children: e.lastFour
37
38
  })
38
39
  ]
39
- }), /* @__PURE__ */ d("span", {
40
+ }), /* @__PURE__ */ f("span", {
40
41
  className: "ttw:truncate ttw:text-xs ttw:font-normal ttw:text-muted-foreground",
41
42
  children: e.typeLabel
42
43
  })]
43
44
  });
44
45
  }
45
- function v({ row: e, labels: t }) {
46
- return /* @__PURE__ */ f("span", {
46
+ function y({ row: e, labels: t }) {
47
+ return /* @__PURE__ */ p("span", {
47
48
  className: "ttw:flex ttw:min-w-0 ttw:items-baseline ttw:gap-1 ttw:text-sm ttw:font-normal",
48
- children: [/* @__PURE__ */ d("span", {
49
+ children: [/* @__PURE__ */ f("span", {
49
50
  className: "ttw:max-w-50 ttw:truncate ttw:text-foreground",
50
51
  title: e.fundingAccount,
51
52
  children: e.fundingAccount
52
- }), e.fundingAccountLastFour && /* @__PURE__ */ f("span", {
53
+ }), e.fundingAccountLastFour && /* @__PURE__ */ p("span", {
53
54
  className: "ttw:shrink-0 ttw:text-muted-foreground",
54
55
  children: [
55
56
  t.cardNameSeparator,
@@ -59,29 +60,29 @@ function v({ row: e, labels: t }) {
59
60
  })]
60
61
  });
61
62
  }
62
- function y({ row: e, labels: t }) {
63
- return e.limit ? /* @__PURE__ */ f("span", {
63
+ function b({ row: e, labels: t }) {
64
+ return e.limit ? /* @__PURE__ */ p("span", {
64
65
  className: "ttw:text-sm ttw:tabular-nums",
65
- children: [/* @__PURE__ */ d("span", {
66
+ children: [/* @__PURE__ */ f("span", {
66
67
  className: "ttw:text-foreground",
67
68
  children: e.limit
68
- }), e.limitPeriod && /* @__PURE__ */ f("span", {
69
+ }), e.limitPeriod && /* @__PURE__ */ p("span", {
69
70
  className: "ttw:font-normal ttw:text-muted-foreground",
70
71
  children: [" ", e.limitPeriod]
71
72
  })]
72
- }) : /* @__PURE__ */ d("span", {
73
+ }) : /* @__PURE__ */ f("span", {
73
74
  className: "ttw:text-sm ttw:font-normal ttw:text-muted-foreground",
74
75
  children: t.noLimit
75
76
  });
76
77
  }
77
- function b({ row: t }) {
78
- return /* @__PURE__ */ d(e, {
78
+ function x({ row: t }) {
79
+ return /* @__PURE__ */ f(e, {
79
80
  tone: t.statusTone,
80
81
  children: t.statusLabel
81
82
  });
82
83
  }
83
- function x({ row: e, labels: n }) {
84
- return e.onActivate ? /* @__PURE__ */ d(t, {
84
+ function S({ row: e, labels: n }) {
85
+ return e.onActivate ? /* @__PURE__ */ f(t, {
85
86
  size: "sm",
86
87
  variant: "outline",
87
88
  "aria-label": `${n.activateButtonForCard} ${e.nickname}`,
@@ -91,26 +92,26 @@ function x({ row: e, labels: n }) {
91
92
  children: n.activateButton
92
93
  }) : null;
93
94
  }
94
- function S(e, t, n, r) {
95
+ function C(e, t, n, r) {
95
96
  let i = {
96
- cardName: (e) => /* @__PURE__ */ d(_, {
97
+ cardName: (e) => /* @__PURE__ */ f(v, {
97
98
  row: e,
98
99
  labels: t,
99
100
  isClickable: n
100
101
  }),
101
- fundingAccount: (e) => /* @__PURE__ */ d(v, {
102
+ fundingAccount: (e) => /* @__PURE__ */ f(y, {
102
103
  row: e,
103
104
  labels: t
104
105
  }),
105
- cardholder: (e) => /* @__PURE__ */ d("span", {
106
+ cardholder: (e) => /* @__PURE__ */ f("span", {
106
107
  className: "ttw:block ttw:max-w-50 ttw:truncate ttw:text-sm ttw:font-normal ttw:text-foreground",
107
108
  title: e.cardholder,
108
109
  children: e.cardholder
109
110
  }),
110
- status: (e) => /* @__PURE__ */ d(b, { row: e }),
111
- limit: (e) => /* @__PURE__ */ d("div", {
111
+ status: (e) => /* @__PURE__ */ f(x, { row: e }),
112
+ limit: (e) => /* @__PURE__ */ f("div", {
112
113
  className: "ttw:text-right",
113
- children: /* @__PURE__ */ d(y, {
114
+ children: /* @__PURE__ */ f(b, {
114
115
  row: e,
115
116
  labels: t
116
117
  })
@@ -119,7 +120,7 @@ function S(e, t, n, r) {
119
120
  return [...e.map((e) => ({
120
121
  id: e,
121
122
  meta: { fitContent: e === "status" || e === "limit" },
122
- header: () => e === "limit" ? /* @__PURE__ */ d("div", {
123
+ header: () => e === "limit" ? /* @__PURE__ */ f("div", {
123
124
  className: "ttw:text-right",
124
125
  children: t.columnHeaders[e]
125
126
  }) : t.columnHeaders[e],
@@ -127,45 +128,45 @@ function S(e, t, n, r) {
127
128
  })), ...r ? [{
128
129
  id: "actions",
129
130
  meta: { fitContent: !0 },
130
- header: () => /* @__PURE__ */ d("span", {
131
+ header: () => /* @__PURE__ */ f("span", {
131
132
  className: "ttw:sr-only",
132
133
  children: t.rowActionsColumn
133
134
  }),
134
- cell: ({ row: e }) => /* @__PURE__ */ d("div", {
135
+ cell: ({ row: e }) => /* @__PURE__ */ f("div", {
135
136
  className: "ttw:text-right",
136
- children: /* @__PURE__ */ d(x, {
137
+ children: /* @__PURE__ */ f(S, {
137
138
  row: e.original,
138
139
  labels: t
139
140
  })
140
141
  })
141
142
  }] : []];
142
143
  }
143
- function C({ row: e, columns: t, labels: n, isClickable: r }) {
144
- return /* @__PURE__ */ f("div", {
144
+ function w({ row: e, columns: t, labels: n, isClickable: r }) {
145
+ return /* @__PURE__ */ p("div", {
145
146
  className: "ttw:flex ttw:flex-col ttw:gap-2",
146
147
  children: [
147
- /* @__PURE__ */ f("div", {
148
+ /* @__PURE__ */ p("div", {
148
149
  className: "ttw:flex ttw:items-start ttw:justify-between ttw:gap-2",
149
- children: [/* @__PURE__ */ d(_, {
150
+ children: [/* @__PURE__ */ f(v, {
150
151
  row: e,
151
152
  labels: n,
152
153
  isClickable: r
153
- }), t.includes("status") && /* @__PURE__ */ d(b, { row: e })]
154
+ }), t.includes("status") && /* @__PURE__ */ f(x, { row: e })]
154
155
  }),
155
- t.includes("cardholder") && /* @__PURE__ */ d("span", {
156
+ t.includes("cardholder") && /* @__PURE__ */ f("span", {
156
157
  className: "ttw:text-sm ttw:text-foreground",
157
158
  children: e.cardholder
158
159
  }),
159
- t.includes("fundingAccount") && /* @__PURE__ */ d(v, {
160
+ t.includes("fundingAccount") && /* @__PURE__ */ f(y, {
160
161
  row: e,
161
162
  labels: n
162
163
  }),
163
- /* @__PURE__ */ f("div", {
164
+ /* @__PURE__ */ p("div", {
164
165
  className: "ttw:flex ttw:items-center ttw:justify-between ttw:gap-2",
165
- children: [t.includes("limit") ? /* @__PURE__ */ d(y, {
166
+ children: [t.includes("limit") ? /* @__PURE__ */ f(b, {
166
167
  row: e,
167
168
  labels: n
168
- }) : null, /* @__PURE__ */ d(x, {
169
+ }) : null, /* @__PURE__ */ f(S, {
169
170
  row: e,
170
171
  labels: n
171
172
  })]
@@ -173,107 +174,110 @@ function C({ row: e, columns: t, labels: n, isClickable: r }) {
173
174
  ]
174
175
  });
175
176
  }
176
- function w({ rows: e, columns: a, isLoading: _ = !1, isError: v = !1, canToggleShowMyCards: y = !1, isShowingMyCards: b = !0, onShowMyCardsChange: x, canCreateCard: w = !1, onCreateCardClick: T, headerStart: E, onRetry: D, isPaginationVisible: O = !1, pageSize: k = 10, pageSizeOptions: A = m, rangeLabel: j = "", isPreviousPageDisabled: M = !1, isNextPageDisabled: N = !1, onPageSizeChange: P, onPreviousPageClick: F, onNextPageClick: I, labels: L, testIds: R }) {
177
- let z = l(), B = u(() => c(L), [L]), V = e.length > 0 && e.every((e) => e.onSelect !== void 0), H = e.some((e) => !!e.onActivate), U = u(() => S(a, B, V, H), [
177
+ function T({ rows: e, columns: a, isLoading: v = !1, isError: y = !1, isAccessRestricted: b = !1, canToggleShowMyCards: x = !1, isShowingMyCards: S = !0, onShowMyCardsChange: T, canCreateCard: E = !1, onCreateCardClick: D, headerStart: O, onRetry: k, isPaginationVisible: A = !1, pageSize: j = 10, pageSizeOptions: M = h, rangeLabel: N = "", isPreviousPageDisabled: P = !1, isNextPageDisabled: F = !1, onPageSizeChange: I, onPreviousPageClick: L, onNextPageClick: R, labels: z, testIds: B }) {
178
+ let V = u(), H = d(() => l(z), [z]), U = e.length > 0 && e.every((e) => e.onSelect !== void 0), W = e.some((e) => !!e.onActivate), G = d(() => C(a, H, U, W), [
178
179
  a,
179
- B,
180
- V,
181
- H
182
- ]), W = !!(w && T), G = !_ && !v && e.length === 0, K = W && !G, q = !!(O && P && F && I), J = V ? {
180
+ H,
181
+ U,
182
+ W
183
+ ]), K = !!(E && D && !b), q = !v && !y && !b && e.length === 0, J = K && !q, Y = !!(A && I && L && R), X = U ? {
183
184
  onRowClick: (e) => e.onSelect?.(),
184
- rowAriaLabel: (e) => `${B.selectCardButton} ${e.nickname} ${e.lastFour} ${e.typeLabel}`
185
+ rowAriaLabel: (e) => `${H.selectCardButton} ${e.nickname} ${e.lastFour} ${e.typeLabel}`
185
186
  } : {};
186
- return /* @__PURE__ */ f("section", {
187
- "aria-label": B.regionLabel,
188
- "aria-busy": _ || void 0,
189
- "data-testid": R?.root,
187
+ return /* @__PURE__ */ p("section", {
188
+ "aria-label": H.regionLabel,
189
+ "aria-busy": v || void 0,
190
+ "data-testid": B?.root,
190
191
  className: "ttw:flex ttw:flex-col ttw:gap-4",
191
192
  children: [
192
- (K || E) && /* @__PURE__ */ f("header", {
193
+ (J || O) && /* @__PURE__ */ p("header", {
193
194
  className: "ttw:flex ttw:items-center ttw:gap-4",
194
- children: [E, K && /* @__PURE__ */ d(t, {
195
+ children: [O, J && /* @__PURE__ */ f(t, {
195
196
  size: "sm",
196
- disabled: _,
197
- onClick: T,
197
+ disabled: v,
198
+ onClick: D,
198
199
  className: "ttw:ml-auto",
199
- children: B.createCardButton
200
+ children: H.createCardButton
200
201
  })]
201
202
  }),
202
- y && x && /* @__PURE__ */ f("div", {
203
+ x && T && /* @__PURE__ */ p("div", {
203
204
  className: "ttw:flex ttw:items-center ttw:gap-2",
204
- children: [/* @__PURE__ */ d(r, {
205
- checked: b,
206
- disabled: _,
207
- onCheckedChange: x,
208
- "aria-labelledby": z
209
- }), /* @__PURE__ */ d("span", {
210
- id: z,
205
+ children: [/* @__PURE__ */ f(r, {
206
+ checked: S,
207
+ disabled: v,
208
+ onCheckedChange: T,
209
+ "aria-labelledby": V
210
+ }), /* @__PURE__ */ f("span", {
211
+ id: V,
211
212
  className: "ttw:text-sm ttw:font-medium ttw:text-foreground",
212
- children: B.showMyCardsToggle
213
+ children: H.showMyCardsToggle
213
214
  })]
214
215
  }),
215
- v || G ? /* @__PURE__ */ f("div", {
216
+ b || y || q ? /* @__PURE__ */ p("div", {
216
217
  className: "ttw:rounded-xl ttw:border ttw:border-border ttw:bg-card",
217
- children: [v ? /* @__PURE__ */ d(s, {
218
- title: B.errorTitle,
219
- description: B.errorDescription,
220
- retryLabel: B.retryButton,
221
- onRetry: D,
222
- testId: R?.error
223
- }) : /* @__PURE__ */ d(o, {
224
- icon: /* @__PURE__ */ d(p, {}),
225
- title: B.emptyTitle,
226
- description: B.emptyDescription,
227
- actionLabel: W ? B.createCardButton : void 0,
228
- onAction: W ? T : void 0,
229
- testId: R?.empty
230
- }), !v && q ? /* @__PURE__ */ d(i, {
231
- pageSize: k,
232
- pageSizeOptions: A,
233
- onPageSizeChange: P,
234
- pageInfo: j || void 0,
235
- hasPrevPage: !M,
236
- hasNextPage: !N,
237
- onPrevPage: F ?? g,
238
- onNextPage: I ?? g,
218
+ children: [b ? /* @__PURE__ */ f(c, {
219
+ title: H.accessRestrictedTitle,
220
+ testId: B?.accessRestricted
221
+ }) : y ? /* @__PURE__ */ f(s, {
222
+ title: H.errorTitle,
223
+ description: H.errorDescription,
224
+ retryLabel: H.retryButton,
225
+ onRetry: k,
226
+ testId: B?.error
227
+ }) : /* @__PURE__ */ f(o, {
228
+ icon: /* @__PURE__ */ f(m, {}),
229
+ title: H.emptyTitle,
230
+ description: H.emptyDescription,
231
+ actionLabel: K ? H.createCardButton : void 0,
232
+ onAction: K ? D : void 0,
233
+ testId: B?.empty
234
+ }), !y && !b && Y ? /* @__PURE__ */ f(i, {
235
+ pageSize: j,
236
+ pageSizeOptions: M,
237
+ onPageSizeChange: I,
238
+ pageInfo: N || void 0,
239
+ hasPrevPage: !P,
240
+ hasNextPage: !F,
241
+ onPrevPage: L ?? _,
242
+ onNextPage: R ?? _,
239
243
  labels: {
240
- rowsPerPage: B.pagination.rowsPerPageLabel,
241
- previousPage: B.pagination.previousPageButton,
242
- nextPage: B.pagination.nextPageButton
244
+ rowsPerPage: H.pagination.rowsPerPageLabel,
245
+ previousPage: H.pagination.previousPageButton,
246
+ nextPage: H.pagination.nextPageButton
243
247
  }
244
248
  }) : null]
245
- }) : /* @__PURE__ */ d(n, {
246
- columns: U,
249
+ }) : /* @__PURE__ */ f(n, {
250
+ columns: G,
247
251
  data: e,
248
252
  getRowId: (e) => e.key,
249
- rowTestId: R?.row,
250
- sorting: h,
251
- onSortingChange: g,
252
- isLoading: _,
253
- showPagination: q,
254
- pageSize: k,
255
- pageSizeOptions: A,
256
- onPageSizeChange: P ?? g,
257
- pageInfo: j || void 0,
258
- hasPrevPage: !M && !_,
259
- hasNextPage: !N && !_,
260
- onPrevPage: F ?? g,
261
- onNextPage: I ?? g,
262
- renderCard: (e) => /* @__PURE__ */ d(C, {
253
+ rowTestId: B?.row,
254
+ sorting: g,
255
+ onSortingChange: _,
256
+ isLoading: v,
257
+ showPagination: Y,
258
+ pageSize: j,
259
+ pageSizeOptions: M,
260
+ onPageSizeChange: I ?? _,
261
+ pageInfo: N || void 0,
262
+ hasPrevPage: !P && !v,
263
+ hasNextPage: !F && !v,
264
+ onPrevPage: L ?? _,
265
+ onNextPage: R ?? _,
266
+ renderCard: (e) => /* @__PURE__ */ f(w, {
263
267
  row: e,
264
268
  columns: a,
265
- labels: B,
266
- isClickable: V
269
+ labels: H,
270
+ isClickable: U
267
271
  }),
268
272
  labels: {
269
- loading: B.loadingLabel,
270
- rowsPerPage: B.pagination.rowsPerPageLabel,
271
- previousPage: B.pagination.previousPageButton,
272
- nextPage: B.pagination.nextPageButton
273
+ loading: H.loadingLabel,
274
+ rowsPerPage: H.pagination.rowsPerPageLabel,
275
+ previousPage: H.pagination.previousPageButton,
276
+ nextPage: H.pagination.nextPageButton
273
277
  },
274
- ...J
278
+ ...X
275
279
  })
276
280
  ]
277
281
  });
278
282
  }
279
- export { w as CardsList, w as default };
283
+ export { T as CardsList, T as default };
@@ -21,6 +21,7 @@ var t = {
21
21
  loadingLabel: "Loading cards",
22
22
  emptyTitle: "No cards yet",
23
23
  emptyDescription: "Create a physical or virtual card to get started.",
24
+ accessRestrictedTitle: "You don't have access to these cards",
24
25
  errorTitle: "Couldn't load cards",
25
26
  errorDescription: "Check your connection, then try again.",
26
27
  retryButton: "Try again",