@tesouro/embedded-components-react 0.11.19 → 0.11.21

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.
@@ -9,7 +9,11 @@ var a = "PENDING_ACTIVATION", o = {
9
9
  [e.Credit]: i.filter((e) => e !== "fundingAccount" && e !== "limit"),
10
10
  [e.Debit]: i.filter((e) => e !== "limit")
11
11
  };
12
- function s(e) {
12
+ function s({ cardProgram: e, canReadFundingAccounts: t }) {
13
+ let n = o[e];
14
+ return t ? n : n.filter((e) => e !== "fundingAccount");
15
+ }
16
+ function c(e) {
13
17
  return e.map((e) => ({
14
18
  id: e.id,
15
19
  userId: e.userId,
@@ -22,7 +26,7 @@ function s(e) {
22
26
  limitCurrencyCode: e.currentBalance?.currencyCode
23
27
  }));
24
28
  }
25
- function c(e) {
29
+ function l(e) {
26
30
  return e.map((e) => ({
27
31
  id: e.id,
28
32
  userId: e.userId,
@@ -34,7 +38,7 @@ function c(e) {
34
38
  fundingAccountId: e.bankAccountId
35
39
  }));
36
40
  }
37
- function l(e, { labels: i, fundingAccountNames: o, canActivate: s, onCardSelect: c, onActivateCard: l }) {
41
+ function u(e, { labels: i, fundingAccountNames: o, canActivate: s, onCardSelect: c, onActivateCard: l }) {
38
42
  return e.map((e) => {
39
43
  let u = s && e.status === a, d = e.fundingAccountId ? o?.get(e.fundingAccountId) : void 0;
40
44
  return {
@@ -56,4 +60,4 @@ function l(e, { labels: i, fundingAccountNames: o, canActivate: s, onCardSelect:
56
60
  };
57
61
  });
58
62
  }
59
- export { o as CARD_COLUMNS_BY_PROGRAM, l as toCardRows, s as toCreditCardListItems, c as toDebitCardListItems };
63
+ export { o as CARD_COLUMNS_BY_PROGRAM, u as toCardRows, c as toCreditCardListItems, l as toDebitCardListItems, s as visibleCardColumns };
@@ -14,7 +14,7 @@ import { resolveCardsFeatureLabels as ae } from "./labels.js";
14
14
  import { getCardsPermissions as oe } from "./permissions.js";
15
15
  import { CardsWidgetAnalyticsEvent as se } from "./analytics/events.js";
16
16
  import { maskAccountNumber as ce } from "./formatters.js";
17
- import { CARD_COLUMNS_BY_PROGRAM as le, toCardRows as ue, toCreditCardListItems as de, toDebitCardListItems as fe } from "./rows.js";
17
+ import { toCardRows as le, toCreditCardListItems as ue, toDebitCardListItems as de, visibleCardColumns as fe } from "./rows.js";
18
18
  import { useCreditCardsQuery as pe } from "../../../data-access/dist/index2.js";
19
19
  import { useDebitCardsQuery as me } from "../../../data-access/dist/index3.js";
20
20
  import "../../../data-access/dist/index.js";
@@ -36,18 +36,18 @@ function u(e) {
36
36
  pageSize: t
37
37
  };
38
38
  }
39
- function d({ cardProgram: c, pagination: d, defaultPagination: f, onPaginationChange: ye, featureLabels: p, selectedCardId: be, defaultSelectedCardId: xe, onSelectedCardIdChange: Se, onCreateCard: m, onActivateCard: h }) {
40
- let g = o(() => ae(p), [p]), _ = te();
39
+ function d({ cardProgram: c, pagination: d, defaultPagination: f, onPaginationChange: p, featureLabels: m, selectedCardId: ye, defaultSelectedCardId: be, onSelectedCardIdChange: xe, onCreateCard: Se, onActivateCard: Ce }) {
40
+ let h = o(() => ae(m), [m]), g = te();
41
41
  a(() => {
42
- _(se.Mounted);
43
- }, [_]);
44
- let { organizationId: v, widgetToken: Ce, initResponse: y } = ne(), b = y?.userId ?? void 0, we = ie(), { organizationStatus: x } = n(), Te = t(x), S = !!re(), Ee = !!(v && Ce) || !!Ce && x === e.Rotating, C = o(() => oe({
42
+ g(se.Mounted);
43
+ }, [g]);
44
+ let { organizationId: _, widgetToken: v, initResponse: y } = ne(), b = y?.userId ?? void 0, we = ie(), { organizationStatus: x } = n(), Te = t(x), S = !!re(), Ee = !!(_ && v) || !!v && x === e.Rotating, C = o(() => oe({
45
45
  cardProgram: c,
46
46
  scopes: y?.scopes
47
47
  }), [c, y?.scopes]), w = Ee && C.canRead && !!y, De = o(() => u(d), [d?.pageSize, d?.paginationToken]), T = o(() => u(f), [f?.pageSize, f?.paginationToken]), [E, Oe] = s(b);
48
48
  b !== void 0 && b !== E && Oe(b);
49
- let [D, ke] = s(v);
50
- v !== void 0 && v !== D && ke(v);
49
+ let [D, ke] = s(_);
50
+ _ !== void 0 && _ !== D && ke(_);
51
51
  let O = [
52
52
  c,
53
53
  D === null ? ve : D ?? "",
@@ -61,9 +61,9 @@ function d({ cardProgram: c, pagination: d, defaultPagination: f, onPaginationCh
61
61
  paginationToken: T.paginationToken,
62
62
  pageSize: T.pageSize
63
63
  })), [Ae, N] = s(!1), [je, P] = ge({
64
- prop: be,
65
- defaultProp: xe ?? null,
66
- onChange: Se,
64
+ prop: ye,
65
+ defaultProp: be ?? null,
66
+ onChange: xe,
67
67
  caller: "CardsWidget"
68
68
  }), F = he({
69
69
  cardProgram: c,
@@ -117,114 +117,117 @@ function d({ cardProgram: c, pagination: d, defaultPagination: f, onPaginationCh
117
117
  e.set(t.id, n ? {
118
118
  name: n,
119
119
  lastFour: t.accountNumber?.trim().slice(-4) || void 0
120
- } : { name: ce(t.accountNumber) ?? g.untitledFundingAccount });
120
+ } : { name: ce(t.accountNumber) ?? h.untitledFundingAccount });
121
121
  }
122
122
  return e;
123
123
  }, [
124
124
  K.data?.data,
125
- g.untitledFundingAccount,
125
+ h.untitledFundingAccount,
126
126
  C.canReadFundingAccounts
127
- ]), J = G && K.isError, Fe = G && !J && (K.isLoading || K.isFetchingNextPage || !!K.hasNextPage), Y = o(() => w ? c === r.Credit ? de(H.data?.data ?? []) : fe(U.data?.data ?? []) : [], [
127
+ ]), Fe = G && K.isError, Ie = G && !Fe && (K.isLoading || K.isFetchingNextPage || !!K.hasNextPage), J = o(() => w ? c === r.Credit ? ue(H.data?.data ?? []) : de(U.data?.data ?? []) : [], [
128
128
  w,
129
129
  c,
130
130
  H.data?.data,
131
131
  U.data?.data
132
- ]), Ie = o(() => ue(Y, {
133
- labels: g,
132
+ ]), Le = o(() => fe({
133
+ cardProgram: c,
134
+ canReadFundingAccounts: C.canReadFundingAccounts
135
+ }), [c, C.canReadFundingAccounts]), Re = o(() => le(J, {
136
+ labels: h,
134
137
  fundingAccountNames: q,
135
138
  canActivate: C.canActivate,
136
139
  onCardSelect: I,
137
- onActivateCard: h
140
+ onActivateCard: Ce
138
141
  }), [
139
- Y,
142
+ J,
140
143
  q,
141
144
  I,
142
- g,
143
145
  h,
146
+ Ce,
144
147
  C.canActivate
145
- ]), X = W.data?.nextPaginationToken ?? void 0, Z = W.data?.prevPaginationToken ?? void 0, Le = !!W.data, Re = w && (W.isError || J), [Q, ze] = s({
148
+ ]), Y = W.data?.nextPaginationToken ?? void 0, X = W.data?.prevPaginationToken ?? void 0, ze = !!W.data, Z = w && (W.isError || Fe), [Q, Be] = s({
146
149
  key: O,
147
150
  value: !1
148
151
  });
149
- if (w && !L && Le) {
150
- let e = Q.key !== O, t = !!b && Y.some((e) => e.userId !== b) || !e && Q.value;
151
- (e || Q.value !== t) && ze({
152
+ if (w && !L && ze) {
153
+ let e = Q.key !== O, t = !!b && J.some((e) => e.userId !== b) || !e && Q.value;
154
+ (e || Q.value !== t) && Be({
152
155
  key: O,
153
156
  value: t
154
157
  });
155
- } else Q.key !== O && ze({
158
+ } else Q.key !== O && Be({
156
159
  key: O,
157
160
  value: !1
158
161
  });
159
- let Be = Q.value, $ = i((e) => {
162
+ let Ve = Q.value, $ = i((e) => {
160
163
  A || M({
161
164
  resetKey: k,
162
165
  paginationToken: e.paginationToken,
163
166
  pageSize: e.pageSize
164
- }), ye?.(e);
167
+ }), p?.(e);
165
168
  }, [
166
169
  A,
167
- ye,
170
+ p,
168
171
  k
169
- ]), Ve = i(() => {
172
+ ]), He = i(() => {
170
173
  $({
171
174
  paginationToken: void 0,
172
175
  pageSize: z
173
176
  });
174
- }, [$, z]), He = i((e) => {
177
+ }, [$, z]), Ue = i((e) => {
175
178
  $({
176
179
  paginationToken: void 0,
177
180
  pageSize: e
178
181
  });
179
- }, [$]), Ue = i((e) => {
180
- N(e), Ve();
181
- }, [Ve]), We = i(() => {
182
+ }, [$]), We = i((e) => {
183
+ N(e), He();
184
+ }, [He]), Ge = i(() => {
182
185
  $({
183
- paginationToken: Z,
186
+ paginationToken: X,
184
187
  pageSize: z
185
188
  });
186
189
  }, [
187
190
  $,
188
191
  z,
189
- Z
190
- ]), Ge = i(() => {
192
+ X
193
+ ]), Ke = i(() => {
191
194
  $({
192
- paginationToken: X,
195
+ paginationToken: Y,
193
196
  pageSize: z
194
197
  });
195
198
  }, [
196
199
  $,
197
- X,
200
+ Y,
198
201
  z
199
- ]), Ke = W.refetch, qe = K.refetch, Je = i(() => {
200
- Ke(), G && qe();
202
+ ]), qe = W.refetch, Je = K.refetch, Ye = i(() => {
203
+ qe(), G && Je();
201
204
  }, [
202
205
  G,
203
- Ke,
204
- qe
206
+ qe,
207
+ Je
205
208
  ]);
206
209
  return {
207
- rows: Ie,
210
+ rows: Re,
208
211
  selectedCardId: Me ? null : je,
209
212
  onSelectCard: I,
210
213
  canReadCards: C.canRead,
211
- columns: le[c],
212
- isLoading: !S && (Te && !W.data || we && !y || w && (W.isLoading || Fe)),
213
- isError: S || Re,
214
- canToggleShowMyCards: C.canRead && !!b && Be,
214
+ columns: Le,
215
+ isLoading: !S && (Te && !W.data || we && !y || w && (W.isLoading || Ie)),
216
+ isError: S || Z,
217
+ canToggleShowMyCards: C.canRead && !!b && Ve,
215
218
  isShowingMyCards: L,
216
- onShowMyCardsChange: Ue,
217
- canCreateCard: C.canCreate && (!!m || C.canComposeDebitCreate),
218
- onCreateCardClick: m,
219
- onRetry: Je,
220
- isPaginationVisible: w && Le && !Re,
219
+ onShowMyCardsChange: We,
220
+ canCreateCard: C.canCreate && (!!Se || C.canComposeDebitCreate),
221
+ onCreateCardClick: Se,
222
+ onRetry: Ye,
223
+ isPaginationVisible: w && ze && !Z,
221
224
  pageSize: z,
222
225
  pageSizeOptions: _e,
223
- isPreviousPageDisabled: !Z,
224
- isNextPageDisabled: !X,
225
- onPageSizeChange: He,
226
- onPreviousPageClick: We,
227
- onNextPageClick: Ge
226
+ isPreviousPageDisabled: !X,
227
+ isNextPageDisabled: !Y,
228
+ onPageSizeChange: Ue,
229
+ onPreviousPageClick: Ge,
230
+ onNextPageClick: Ke
228
231
  };
229
232
  }
230
233
  export { d as useCardsWidget };
@@ -1,5 +1,5 @@
1
1
  // ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
2
- var e = "@tesouro/embedded-components-react", t = "0.11.19", n = "810658288be16dc038561c916563461b8a4cd161", r = Object.freeze({
2
+ var e = "@tesouro/embedded-components-react", t = "0.11.21", n = "c679ff5861e72ab093600c95f18af84dbb20f020", r = Object.freeze({
3
3
  library_name: e,
4
4
  library_version: t,
5
5
  library_sha: n
@@ -10231,29 +10231,29 @@ function kx({ className: e, ...t }) {
10231
10231
  ...t
10232
10232
  });
10233
10233
  }
10234
- function Ax({ className: e, children: t, side: n = "right", showCloseButton: r = !0, closeButtonTestId: i, closeDisabled: a = !1, onEscapeKeyDown: o, onInteractOutside: s, labels: c, onOpenAutoFocus: l, ...u }) {
10235
- let d = {
10234
+ function Ax({ className: e, children: t, side: n = "right", showCloseButton: r = !0, closeButtonTestId: i, closeDisabled: a = !1, onEscapeKeyDown: o, onInteractOutside: s, labels: c, overlayClassName: l, onOpenAutoFocus: u, ...d }) {
10235
+ let f = {
10236
10236
  ...Tx,
10237
10237
  ...c
10238
10238
  };
10239
- return /* @__PURE__ */ v(Ox, { children: [/* @__PURE__ */ _(kx, {}), /* @__PURE__ */ v(Gd, {
10239
+ return /* @__PURE__ */ v(Ox, { children: [/* @__PURE__ */ _(kx, { className: l }), /* @__PURE__ */ v(Gd, {
10240
10240
  "data-slot": "sheet-content",
10241
10241
  className: Y("ttw:fixed ttw:z-50 ttw:flex ttw:flex-col ttw:gap-4 ttw:border-border ttw:bg-background ttw:shadow-lg ttw:transition ttw:ease-in-out ttw:data-[state=closed]:animate-out ttw:data-[state=closed]:duration-300 ttw:data-[state=open]:animate-in ttw:data-[state=open]:duration-500", n === "right" && "ttw:inset-y-0 ttw:right-0 ttw:h-full ttw:w-full ttw:border-l ttw:data-[state=closed]:slide-out-to-right ttw:data-[state=open]:slide-in-from-right ttw:sm:max-w-150", n === "left" && "ttw:inset-y-0 ttw:left-0 ttw:h-full ttw:w-full ttw:border-r ttw:data-[state=closed]:slide-out-to-left ttw:data-[state=open]:slide-in-from-left ttw:sm:max-w-150", n === "top" && "ttw:inset-x-0 ttw:top-0 ttw:h-auto ttw:border-b ttw:data-[state=closed]:slide-out-to-top ttw:data-[state=open]:slide-in-from-top", n === "bottom" && "ttw:inset-x-0 ttw:bottom-0 ttw:h-auto ttw:border-t ttw:data-[state=closed]:slide-out-to-bottom ttw:data-[state=open]:slide-in-from-bottom", e),
10242
10242
  onOpenAutoFocus: (e) => {
10243
- if (l?.(e), e.defaultPrevented) return;
10243
+ if (u?.(e), e.defaultPrevented) return;
10244
10244
  let t = e.target.querySelector("[data-autofocus]");
10245
10245
  t && (t.focus(), document.activeElement === t && e.preventDefault());
10246
10246
  },
10247
10247
  onEscapeKeyDown: ry(a, o),
10248
10248
  onInteractOutside: ry(a, s),
10249
- ...u,
10249
+ ...d,
10250
10250
  children: [t, r && /* @__PURE__ */ _(ef, {
10251
10251
  "data-slot": "sheet-close-button",
10252
10252
  "data-testid": i,
10253
10253
  disabled: a,
10254
- title: d.close,
10254
+ title: f.close,
10255
10255
  className: Y(ty, "ttw:absolute ttw:top-4 ttw:right-4"),
10256
- children: /* @__PURE__ */ _(iy, { label: d.close })
10256
+ children: /* @__PURE__ */ _(iy, { label: f.close })
10257
10257
  })]
10258
10258
  })] });
10259
10259
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tesouro/embedded-components-react",
3
- "version": "0.11.19",
3
+ "version": "0.11.21",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": [