@tesouro/embedded-components-react 0.3.6 → 0.3.11

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.
package/dist/index.css CHANGED
@@ -3342,6 +3342,9 @@
3342
3342
  .ttw\:text-\[\#175CD3\] {
3343
3343
  color: #175CD3;
3344
3344
  }
3345
+ .ttw\:text-\[\#101317\] {
3346
+ color: #101317;
3347
+ }
3345
3348
  .ttw\:text-\[\#344054\] {
3346
3349
  color: #344054;
3347
3350
  }
@@ -19,13 +19,14 @@ import { useMemo as h } from "react";
19
19
  import { jsx as g, jsxs as _ } from "react/jsx-runtime";
20
20
  import { CreditCardIcon as v, EyeIcon as y, EyeOffIcon as b, PowerIcon as x } from "lucide-react";
21
21
  //#region ../../libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/CardDetailsPanel.js
22
- function S({ labels: S, state: C, nickname: w, statusLabel: T, statusTone: E, formFactorLabel: D, cardMenu: O, onClose: k, bankLogoSrc: A, bankLogoAlt: j, cardholderName: M, maskedCardNumber: N, programLabel: P, billingAddress: F, allowedCategories: I, onCopy: L, onActivate: R, onViewCard: z, onHideCard: B, isViewCardDisabled: V, revealState: H = "hidden", revealedCardNumber: U, revealedExpirationDate: W, revealedSecurityCode: G, onRetry: K, className: q }) {
23
- let J = h(() => f(S), [S]), Y = !!I?.length, X = H === "revealed", Z = X ? B : z, Q = /* @__PURE__ */ g(u, {
22
+ function S({ labels: S, state: C, nickname: w, statusLabel: T, statusTone: E, formFactorLabel: D, cardMenu: O, onClose: k, bankLogoSrc: A, bankLogoAlt: j, cardholderName: M, maskedCardNumber: N, programLabel: P, cardFaceStatusLabel: F, billingAddress: I, allowedCategories: L, onCopy: R, onActivate: z, onViewCard: B, onHideCard: V, revealState: H = "hidden", revealedCardNumber: U, revealedExpirationDate: W, revealedSecurityCode: G, onRetry: K, className: q }) {
23
+ let J = h(() => f(S), [S]), Y = !!L?.length, X = H === "revealed", Z = X ? V : B, Q = /* @__PURE__ */ g(u, {
24
24
  bankLogoSrc: A,
25
25
  bankLogoAlt: j ?? J.cardFace.bankLogoAlt,
26
26
  cardholderName: M ?? "",
27
27
  maskedCardNumber: N ?? "",
28
- programLabel: P ?? ""
28
+ programLabel: P ?? "",
29
+ statusLabel: F
29
30
  });
30
31
  return /* @__PURE__ */ _("div", {
31
32
  "data-testid": s.panel,
@@ -62,7 +63,7 @@ function S({ labels: S, state: C, nickname: w, statusLabel: T, statusTone: E, fo
62
63
  className: "ttw:flex ttw:items-center ttw:justify-center ttw:bg-muted ttw:px-4 ttw:py-5",
63
64
  children: /* @__PURE__ */ _("div", {
64
65
  className: r("ttw:flex ttw:flex-col ttw:gap-4", l),
65
- children: [z ? /* @__PURE__ */ g(m, {
66
+ children: [B ? /* @__PURE__ */ g(m, {
66
67
  isFlipped: X,
67
68
  front: Q,
68
69
  back: /* @__PURE__ */ g(p, {
@@ -70,26 +71,27 @@ function S({ labels: S, state: C, nickname: w, statusLabel: T, statusTone: E, fo
70
71
  cardNumber: U,
71
72
  expirationDate: W,
72
73
  securityCode: G,
73
- onCopy: L
74
+ onCopy: R
74
75
  })
75
- }) : Q, R || z ? /* @__PURE__ */ _("div", {
76
+ }) : Q, z || B ? /* @__PURE__ */ _("div", {
76
77
  className: "ttw:flex ttw:flex-col ttw:gap-2",
77
78
  children: [
78
- R ? /* @__PURE__ */ _(t, {
79
+ z ? /* @__PURE__ */ _(t, {
79
80
  type: "button",
80
- onClick: R,
81
+ className: "ttw:self-center",
82
+ onClick: z,
81
83
  children: [/* @__PURE__ */ g(x, {
82
84
  className: "ttw:size-4",
83
85
  "aria-hidden": "true"
84
86
  }), J.actions.activateCard]
85
87
  }) : null,
86
- z ? /* @__PURE__ */ g("div", {
88
+ B ? /* @__PURE__ */ g("div", {
87
89
  className: "ttw:flex ttw:gap-2",
88
90
  children: /* @__PURE__ */ _(t, {
89
91
  type: "button",
90
92
  variant: "outline",
91
93
  className: "ttw:flex-1",
92
- disabled: V || !Z,
94
+ disabled: !Z,
93
95
  loading: H === "revealing",
94
96
  onClick: Z,
95
97
  children: [g(X ? b : y, {
@@ -107,30 +109,30 @@ function S({ labels: S, state: C, nickname: w, statusLabel: T, statusTone: E, fo
107
109
  children: [
108
110
  /* @__PURE__ */ g(d, {
109
111
  label: J.fields.cardholder,
110
- copyAriaLabel: M && L ? J.fields.copyCardholderAriaLabel : void 0,
111
- onCopy: M && L ? () => L(M) : void 0,
112
+ copyAriaLabel: M && R ? J.fields.copyCardholderAriaLabel : void 0,
113
+ onCopy: M && R ? () => R(M) : void 0,
112
114
  children: M ?? J.fields.emptyValue
113
115
  }),
114
116
  /* @__PURE__ */ g(d, {
115
117
  label: J.fields.nickname,
116
- copyAriaLabel: w && L ? J.fields.copyNicknameAriaLabel : void 0,
117
- onCopy: w && L ? () => L(w) : void 0,
118
- isLast: !F && !Y,
118
+ copyAriaLabel: w && R ? J.fields.copyNicknameAriaLabel : void 0,
119
+ onCopy: w && R ? () => R(w) : void 0,
120
+ isLast: !I && !Y,
119
121
  children: w ?? J.fields.emptyValue
120
122
  }),
121
- F ? /* @__PURE__ */ g(d, {
123
+ I ? /* @__PURE__ */ g(d, {
122
124
  label: J.fields.billingAddress,
123
- copyAriaLabel: L ? J.fields.copyBillingAddressAriaLabel : void 0,
124
- onCopy: L ? () => L(F) : void 0,
125
+ copyAriaLabel: R ? J.fields.copyBillingAddressAriaLabel : void 0,
126
+ onCopy: R ? () => R(I) : void 0,
125
127
  isLast: !Y,
126
- children: F
128
+ children: I
127
129
  }) : null,
128
130
  Y ? /* @__PURE__ */ g(d, {
129
131
  label: J.fields.allowedCategories,
130
132
  isLast: !0,
131
133
  children: /* @__PURE__ */ g("div", {
132
134
  className: "ttw:flex ttw:flex-wrap ttw:gap-2",
133
- children: I?.map((t) => /* @__PURE__ */ g(e, {
135
+ children: L?.map((t) => /* @__PURE__ */ g(e, {
134
136
  variant: "secondary",
135
137
  children: t
136
138
  }, t))
@@ -1,38 +1,45 @@
1
1
  import { cn as e } from "../../../../../../../packages/shared-ui-shadcn/dist/index.js";
2
2
  import { cardDetailsWidgetUiTestIds as t } from "./testIds.js";
3
- import { CARD_FACE_SURFACE_CLASS_NAME as n } from "./cardFaceSurface.js";
4
- import { CardFaceGlow as r } from "./CardFaceGlow.js";
5
- import { jsx as i, jsxs as a } from "react/jsx-runtime";
3
+ import { CARD_FACE_STATUS_PILL_CLASS_NAME as n, CARD_FACE_SURFACE_CLASS_NAME as r } from "./cardFaceSurface.js";
4
+ import { CardFaceGlow as i } from "./CardFaceGlow.js";
5
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
6
6
  //#region ../../libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/CardFace.js
7
- function o({ bankLogoSrc: o, bankLogoAlt: s, cardholderName: c, maskedCardNumber: l, programLabel: u, className: d }) {
8
- return /* @__PURE__ */ a("div", {
7
+ function s({ bankLogoSrc: s, bankLogoAlt: c, cardholderName: l, maskedCardNumber: u, programLabel: d, statusLabel: f, className: p }) {
8
+ return /* @__PURE__ */ o("div", {
9
9
  "data-testid": t.cardFace,
10
- className: e(n, "ttw:justify-between", d),
10
+ className: e(r, "ttw:justify-between", p),
11
11
  children: [
12
- /* @__PURE__ */ i(r, {}),
13
- o ? /* @__PURE__ */ i("img", {
14
- src: o,
15
- alt: s,
12
+ /* @__PURE__ */ a(i, {}),
13
+ s ? /* @__PURE__ */ a("img", {
14
+ src: s,
15
+ alt: c,
16
16
  className: "ttw:relative ttw:h-8 ttw:w-auto ttw:max-w-[60%] ttw:object-contain ttw:object-left"
17
- }) : /* @__PURE__ */ i("span", { className: "ttw:relative ttw:h-8" }),
18
- /* @__PURE__ */ a("div", {
17
+ }) : /* @__PURE__ */ a("span", { className: "ttw:relative ttw:h-8" }),
18
+ f ? /* @__PURE__ */ a("div", {
19
+ className: "ttw:pointer-events-none ttw:absolute ttw:inset-0 ttw:flex ttw:items-center ttw:justify-center",
20
+ children: /* @__PURE__ */ a("span", {
21
+ className: n,
22
+ children: f
23
+ })
24
+ }) : null,
25
+ /* @__PURE__ */ o("div", {
19
26
  className: "ttw:relative ttw:flex ttw:items-end ttw:justify-between ttw:gap-3",
20
- children: [/* @__PURE__ */ a("div", {
27
+ children: [/* @__PURE__ */ o("div", {
21
28
  className: "ttw:min-w-0",
22
- children: [/* @__PURE__ */ i("p", {
29
+ children: [/* @__PURE__ */ a("p", {
23
30
  className: "ttw:truncate ttw:text-base ttw:font-medium ttw:text-white",
24
- children: c
25
- }), /* @__PURE__ */ i("p", {
26
- className: "ttw:mt-1 ttw:truncate ttw:text-lg ttw:tracking-wide ttw:text-white/90",
27
31
  children: l
32
+ }), /* @__PURE__ */ a("p", {
33
+ className: "ttw:mt-1 ttw:truncate ttw:text-lg ttw:tracking-wide ttw:text-white/90",
34
+ children: u
28
35
  })]
29
- }), /* @__PURE__ */ i("p", {
36
+ }), /* @__PURE__ */ a("p", {
30
37
  className: "ttw:shrink-0 ttw:text-[10px] ttw:font-medium ttw:text-white/90",
31
- children: u
38
+ children: d
32
39
  })]
33
40
  })
34
41
  ]
35
42
  });
36
43
  }
37
44
  //#endregion
38
- export { o as CardFace };
45
+ export { s as CardFace };
@@ -1,4 +1,4 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/cardFaceSurface.js
2
- var e = "ttw:w-[300px]", t = "ttw:h-[190px]", n = `ttw:relative ttw:flex ${t} ${e} ttw:flex-col ttw:overflow-hidden ttw:rounded-xl ttw:bg-[#101317] ttw:p-4`;
2
+ var e = "ttw:w-[300px]", t = "ttw:h-[190px]", n = `ttw:relative ttw:flex ${t} ${e} ttw:flex-col ttw:overflow-hidden ttw:rounded-xl ttw:bg-[#101317] ttw:p-4`, r = "ttw:rounded-full ttw:bg-white/90 ttw:px-4 ttw:py-2 ttw:text-sm ttw:font-medium ttw:text-[#101317]";
3
3
  //#endregion
4
- export { t as CARD_FACE_HEIGHT_CLASS_NAME, n as CARD_FACE_SURFACE_CLASS_NAME, e as CARD_FACE_WIDTH_CLASS_NAME };
4
+ export { t as CARD_FACE_HEIGHT_CLASS_NAME, r as CARD_FACE_STATUS_PILL_CLASS_NAME, n as CARD_FACE_SURFACE_CLASS_NAME, e as CARD_FACE_WIDTH_CLASS_NAME };
@@ -96,20 +96,21 @@ function d({ cardProgram: c, pagination: d, defaultPagination: f, onPaginationCh
96
96
  A,
97
97
  k
98
98
  ]);
99
- let L = A ? Se : ke ? j : E, Ae = L.paginationToken, R = L.pageSize, z = {
99
+ let L = A ? Se : ke ? j : E, Ae = L.paginationToken, R = L.pageSize, z = I ? x : void 0, B = {
100
100
  limit: R,
101
- paginationToken: Ae,
102
- userId: I ? x : void 0
103
- }, B = ue({
104
- ...z,
101
+ paginationToken: Ae
102
+ }, V = ue({
103
+ ...B,
104
+ userId: z,
105
105
  enabled: T && c === r.Credit
106
- }), V = de({
107
- ...z,
106
+ }), H = de({
107
+ ...B,
108
+ cardholderUserId: z,
108
109
  enabled: T && c === r.Debit
109
- }), H = c === r.Credit ? B : V, U = T && w.canReadFundingAccounts, W = e({ enabled: U }), G = o(() => {
110
+ }), U = c === r.Credit ? V : H, W = T && w.canReadFundingAccounts, G = e({ enabled: W }), K = o(() => {
110
111
  let e = /* @__PURE__ */ new Map();
111
112
  if (!w.canReadFundingAccounts) return e;
112
- for (let t of W.data?.data ?? []) {
113
+ for (let t of G.data?.data ?? []) {
113
114
  let n = t.nickname?.trim();
114
115
  e.set(t.id, n ? {
115
116
  name: n,
@@ -118,28 +119,28 @@ function d({ cardProgram: c, pagination: d, defaultPagination: f, onPaginationCh
118
119
  }
119
120
  return e;
120
121
  }, [
121
- W.data?.data,
122
+ G.data?.data,
122
123
  _.untitledFundingAccount,
123
124
  w.canReadFundingAccounts
124
- ]), K = U && W.isError, je = U && !K && (W.isLoading || W.isFetchingNextPage || !!W.hasNextPage), q = o(() => T ? c === r.Credit ? ce(B.data?.data ?? []) : le(V.data?.data ?? []) : [], [
125
+ ]), q = W && G.isError, je = W && !q && (G.isLoading || G.isFetchingNextPage || !!G.hasNextPage), J = o(() => T ? c === r.Credit ? ce(V.data?.data ?? []) : le(H.data?.data ?? []) : [], [
125
126
  T,
126
127
  c,
127
- B.data?.data,
128
- V.data?.data
129
- ]), Me = o(() => se(q, {
128
+ V.data?.data,
129
+ H.data?.data
130
+ ]), Me = o(() => se(J, {
130
131
  labels: _,
131
- fundingAccountNames: G,
132
+ fundingAccountNames: K,
132
133
  canActivate: w.canActivate,
133
134
  onCardSelect: F,
134
135
  onActivateCard: g
135
136
  }), [
136
- q,
137
- G,
137
+ J,
138
+ K,
138
139
  F,
139
140
  _,
140
141
  g,
141
142
  w.canActivate
142
- ]), J = H.data?.nextPaginationToken ?? void 0, Y = H.data?.prevPaginationToken ?? void 0, Ne = !!H.data, X = T && (H.isError || K), Z = i((e) => {
143
+ ]), Y = U.data?.nextPaginationToken ?? void 0, X = U.data?.prevPaginationToken ?? void 0, Ne = !!U.data, Z = T && (U.isError || q), Q = i((e) => {
143
144
  A || M({
144
145
  resetKey: k,
145
146
  paginationToken: e.paginationToken,
@@ -149,42 +150,42 @@ function d({ cardProgram: c, pagination: d, defaultPagination: f, onPaginationCh
149
150
  A,
150
151
  p,
151
152
  k
152
- ]), Q = i(() => {
153
- Z({
153
+ ]), $ = i(() => {
154
+ Q({
154
155
  paginationToken: void 0,
155
156
  pageSize: R
156
157
  });
157
- }, [Z, R]), Pe = i((e) => {
158
- Z({
158
+ }, [Q, R]), Pe = i((e) => {
159
+ Q({
159
160
  paginationToken: void 0,
160
161
  pageSize: e
161
162
  });
162
- }, [Z]), Fe = i((e) => {
163
- Ee(e), Q();
164
- }, [Q]), Ie = i(() => {
165
- Z({
166
- paginationToken: Y,
163
+ }, [Q]), Fe = i((e) => {
164
+ Ee(e), $();
165
+ }, [$]), Ie = i(() => {
166
+ Q({
167
+ paginationToken: X,
167
168
  pageSize: R
168
169
  });
169
170
  }, [
170
- Z,
171
+ Q,
171
172
  R,
172
- Y
173
+ X
173
174
  ]), Le = i(() => {
174
- Z({
175
- paginationToken: J,
175
+ Q({
176
+ paginationToken: Y,
176
177
  pageSize: R
177
178
  });
178
179
  }, [
179
- Z,
180
- J,
180
+ Q,
181
+ Y,
181
182
  R
182
- ]), $ = H.refetch, Re = W.refetch, ze = i(() => {
183
- $(), U && Re();
183
+ ]), Re = U.refetch, ze = G.refetch, Be = i(() => {
184
+ Re(), W && ze();
184
185
  }, [
185
- U,
186
- $,
187
- Re
186
+ W,
187
+ Re,
188
+ ze
188
189
  ]);
189
190
  return {
190
191
  rows: Me,
@@ -192,19 +193,19 @@ function d({ cardProgram: c, pagination: d, defaultPagination: f, onPaginationCh
192
193
  onSelectCard: F,
193
194
  canReadCards: w.canRead,
194
195
  columns: oe[c],
195
- isLoading: !S && (!C || xe && !b || T && (H.isLoading || je)),
196
- isError: S || X,
196
+ isLoading: !S && (!C || xe && !b || T && (U.isLoading || je)),
197
+ isError: S || Z,
197
198
  canToggleShowMyCards: w.canRead && !!x,
198
199
  isShowingMyCards: I,
199
200
  onShowMyCardsChange: Fe,
200
201
  canCreateCard: w.canCreate && (!!h || !!ye && w.canComposeDebitCreate),
201
202
  onCreateCardClick: h,
202
- onRetry: ze,
203
- isPaginationVisible: T && Ne && !X,
203
+ onRetry: Be,
204
+ isPaginationVisible: T && Ne && !Z,
204
205
  pageSize: R,
205
206
  pageSizeOptions: me,
206
- isPreviousPageDisabled: !Y,
207
- isNextPageDisabled: !J,
207
+ isPreviousPageDisabled: !X,
208
+ isNextPageDisabled: !Y,
208
209
  onPageSizeChange: Pe,
209
210
  onPreviousPageClick: Ie,
210
211
  onNextPageClick: Le