@tesouro/embedded-components-react 0.11.65 → 0.11.68

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 (48) hide show
  1. package/README.md +28 -28
  2. package/dist/index.css +6 -27
  3. package/dist/index.d.ts +29 -41
  4. package/dist/lib/CardDetailsWidget.d.ts +1 -1
  5. package/dist/lib/CounterpartsWidget.d.ts +26 -39
  6. package/dist/lib/CounterpartsWidgetPublic.d.ts +26 -39
  7. package/dist/lib/CreditCardsWidget.d.ts +2 -2
  8. package/dist/lib/CustomersWidget.d.ts +26 -39
  9. package/dist/lib/DebitCardsWidget.d.ts +2 -2
  10. package/dist/lib/ReceivablesWidget.d.ts +14 -4
  11. package/dist/lib/WidgetSuite.d.ts +2 -2
  12. package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/lib/CardDetailsWidget.js +0 -4
  13. package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/lib/cardDetailsView.js +7 -8
  14. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/ActivateCardPanel/ActivateCardPanel.js +37 -39
  15. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/CardDetailsPanel.js +72 -73
  16. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/CardFace.js +16 -22
  17. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartDetailsContainer.js +8 -12
  18. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartDetailsPanel.js +93 -110
  19. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartsWidget.js +52 -52
  20. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartDetailsActions.js +72 -107
  21. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartDetailsSheetView.js +27 -27
  22. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartsTable.js +112 -145
  23. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartsWidget.js +13 -16
  24. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/viewModels.js +3 -122
  25. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/mocks/labels.js +5 -5
  26. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index.js +1 -1
  27. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index2.js +44 -65
  28. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index3.js +157 -134
  29. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index4.js +18 -14
  30. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index5.js +362 -55
  31. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/index.js +11 -11
  32. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/helpers.js +7 -7
  33. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/labels.js +16 -9
  34. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useAddressForm.js +2 -66
  35. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useDeleteController.js +48 -46
  36. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index.js +5 -5
  37. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index10.js +138 -149
  38. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index11.js +19 -20
  39. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index12.js +1 -0
  40. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index13.js +21 -27
  41. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index2.js +1 -1
  42. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index3.js +0 -1
  43. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index8.js +2 -2
  44. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index9.js +30 -63
  45. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  46. package/package.json +1 -1
  47. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index6.js +0 -211
  48. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index7.js +0 -509
@@ -3,91 +3,90 @@
3
3
  "use client";
4
4
  "use client";
5
5
  import { Alert as e, AlertDescription as t, Badge as n, Button as r, DescriptionList as i, Heading as a, Skeleton as o, cn as s } from "../../../../../../../packages/shared-ui-shadcn/dist/index.js";
6
- import { EmptyState as c } from "../../../../../shared/ui/dist/lib/EmptyState/EmptyState.js";
7
- import { ErrorState as l } from "../../../../../shared/ui/dist/lib/ErrorState/ErrorState.js";
8
- import { LoadingRegion as u } from "../../../../../shared/ui/dist/lib/LoadingRegion/LoadingRegion.js";
9
- import { InlineErrorAlert as d } from "../../../../../shared/ui/dist/lib/InlineErrorAlert/InlineErrorAlert.js";
6
+ import { EmptyState as ee } from "../../../../../shared/ui/dist/lib/EmptyState/EmptyState.js";
7
+ import { ErrorState as c } from "../../../../../shared/ui/dist/lib/ErrorState/ErrorState.js";
8
+ import { LoadingRegion as l } from "../../../../../shared/ui/dist/lib/LoadingRegion/LoadingRegion.js";
9
+ import { InlineErrorAlert as u } from "../../../../../shared/ui/dist/lib/InlineErrorAlert/InlineErrorAlert.js";
10
10
  import "../../../../../shared/ui/dist/index.js";
11
- import { CardDetailsHeader as ee } from "./CardDetailsHeader.js";
12
- import { CARD_FACE_WIDTH_CLASS_NAME as te } from "./cardFaceSurface.js";
13
- import { CardFace as ne } from "./CardFace.js";
14
- import { resolveCardDetailsPanelLabels as re } from "./labels.js";
15
- import { CardCredentialsFace as ie } from "./CardCredentialsFace.js";
16
- import { CardFaceFlip as ae } from "./CardFaceFlip.js";
17
- import { CopyableValue as f } from "./CopyableValue.js";
18
- import { NicknameEditor as oe } from "./NicknameEditor.js";
19
- import { useMemo as se } from "react";
20
- import { jsx as p, jsxs as m } from "react/jsx-runtime";
21
- import { CircleAlertIcon as h, CreditCardIcon as g } from "lucide-react";
11
+ import { CardDetailsHeader as d } from "./CardDetailsHeader.js";
12
+ import { CARD_FACE_WIDTH_CLASS_NAME as f } from "./cardFaceSurface.js";
13
+ import { CardFace as te } from "./CardFace.js";
14
+ import { resolveCardDetailsPanelLabels as ne } from "./labels.js";
15
+ import { CardCredentialsFace as re } from "./CardCredentialsFace.js";
16
+ import { CardFaceFlip as ie } from "./CardFaceFlip.js";
17
+ import { CopyableValue as p } from "./CopyableValue.js";
18
+ import { NicknameEditor as ae } from "./NicknameEditor.js";
19
+ import { useMemo as oe } from "react";
20
+ import { jsx as m, jsxs as h } from "react/jsx-runtime";
21
+ import { CircleAlertIcon as g, CreditCardIcon as _ } from "lucide-react";
22
22
  // ../../libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/CardDetailsPanel.js
23
- function _({ labels: _, state: v, nickname: y, statusLabel: ce, statusTone: le, formFactorLabel: ue, cardMenu: de, onClose: fe, cardArtSrc: pe, bankLogoSrc: me, bankLogoAlt: he, cardholderName: ge, maskedCardNumber: _e, programLabel: ve, cardFaceStatusLabel: ye, billingAddress: b, allowedCategories: x, spendLimitLabels: S, perTransactionMaxLabel: C, onCopy: w, onEditNickname: T, nicknameEditState: E = "closed", nicknameDraft: D, onNicknameDraftChange: O, onSaveNickname: k, onCancelNicknameEdit: A, isNicknameSaveDisabled: j, onActivate: M, onViewCard: N, onHideCard: P, revealState: F = "hidden", revealedCardNumber: be, revealedExpirationDate: xe, revealedSecurityCode: Se, isLocked: I, lockState: L = "idle", onLockCard: R, onUnlockCard: z, onRetry: Ce, testIds: B, className: we }) {
24
- let V = se(() => re(_), [_]), H = b?.addressLine1, U = b?.addressLine2, W = b?.cityState, G = b?.postalCode, Te = !!(H || U || W || G), Ee = !!x?.length, De = !!S?.length, Oe = !!C, K = F === "revealed", q = K ? P : N, J = !!(R || z), Y = I ? z : R, ke = V.fields.copiedLabel, X = [
23
+ function v({ labels: v, state: y, nickname: se, statusLabel: ce, statusTone: le, formFactorLabel: ue, cardMenu: de, onClose: fe, cardArtSrc: pe, bankLogoSrc: me, bankLogoAlt: he, cardholderName: ge, maskedCardNumber: _e, cardFaceStatusLabel: ve, billingAddress: b, allowedCategories: x, spendLimitLabels: S, perTransactionMaxLabel: C, onCopy: w, onEditNickname: T, nicknameEditState: E = "closed", nicknameDraft: D, onNicknameDraftChange: O, onSaveNickname: k, onCancelNicknameEdit: A, isNicknameSaveDisabled: j, onActivate: M, onViewCard: N, onHideCard: P, revealState: F = "hidden", revealedCardNumber: ye, revealedExpirationDate: be, revealedSecurityCode: xe, isLocked: I, lockState: L = "idle", onLockCard: R, onUnlockCard: z, onRetry: Se, testIds: B, className: Ce }) {
24
+ let V = oe(() => ne(v), [v]), H = b?.addressLine1, U = b?.addressLine2, W = b?.cityState, G = b?.postalCode, we = !!(H || U || W || G), Te = !!x?.length, Ee = !!S?.length, De = !!C, K = F === "revealed", q = K ? P : N, J = !!(R || z), Y = I ? z : R, Oe = V.fields.copiedLabel, X = [
25
25
  H,
26
26
  U,
27
27
  W,
28
28
  G
29
- ].filter((e) => !!e), Z = Te ? [{
29
+ ].filter((e) => !!e), Z = we ? [{
30
30
  label: V.fields.billingAddress,
31
- value: /* @__PURE__ */ p(f, {
31
+ value: /* @__PURE__ */ m(p, {
32
32
  copyLabel: V.fields.copyBillingAddressAriaLabel,
33
- copiedLabel: ke,
33
+ copiedLabel: Oe,
34
34
  onCopy: w ? () => w(X.join("\n")) : void 0,
35
- children: /* @__PURE__ */ p("span", {
35
+ children: /* @__PURE__ */ m("span", {
36
36
  className: "ttw:flex ttw:flex-col",
37
- children: X.map((e, t) => /* @__PURE__ */ p("span", { children: e }, t))
37
+ children: X.map((e, t) => /* @__PURE__ */ m("span", { children: e }, t))
38
38
  })
39
39
  })
40
40
  }] : [], Q = [
41
- ...Ee ? [{
41
+ ...Te ? [{
42
42
  label: V.fields.allowedCategories,
43
- value: /* @__PURE__ */ p("span", {
43
+ value: /* @__PURE__ */ m("span", {
44
44
  className: "ttw:flex ttw:flex-wrap ttw:gap-2",
45
- children: x?.map((e) => /* @__PURE__ */ p(n, {
45
+ children: x?.map((e) => /* @__PURE__ */ m(n, {
46
46
  tone: "neutral",
47
47
  children: e
48
48
  }, e))
49
49
  })
50
50
  }] : [],
51
- ...De ? [{
51
+ ...Ee ? [{
52
52
  label: V.fields.spendLimit,
53
- value: /* @__PURE__ */ p("span", {
53
+ value: /* @__PURE__ */ m("span", {
54
54
  className: "ttw:flex ttw:flex-col ttw:gap-1 ttw:tabular-nums",
55
- children: S?.map((e, t) => /* @__PURE__ */ p("span", { children: e }, `${e}-${t}`))
55
+ children: S?.map((e, t) => /* @__PURE__ */ m("span", { children: e }, `${e}-${t}`))
56
56
  })
57
57
  }] : [],
58
- ...Oe ? [{
58
+ ...De ? [{
59
59
  label: V.fields.perTransactionMax,
60
- value: /* @__PURE__ */ p("span", {
60
+ value: /* @__PURE__ */ m("span", {
61
61
  className: "ttw:tabular-nums",
62
62
  children: C
63
63
  })
64
64
  }] : []
65
- ], $ = /* @__PURE__ */ p(ne, {
65
+ ], $ = /* @__PURE__ */ m(te, {
66
66
  cardArtSrc: pe,
67
67
  bankLogoSrc: me,
68
68
  bankLogoAlt: he ?? V.cardFace.bankLogoAlt,
69
69
  cardholderName: ge ?? "",
70
70
  maskedCardNumber: _e ?? "",
71
- programLabel: ve ?? "",
72
- statusLabel: ye,
71
+ statusLabel: ve,
73
72
  isLocked: I,
74
73
  lockedLabel: V.lock.cardFaceLabel,
75
74
  testIds: B?.cardFace
76
75
  });
77
- return /* @__PURE__ */ m("div", {
76
+ return /* @__PURE__ */ h("div", {
78
77
  "data-testid": B?.root,
79
- className: s("ttw:@container/card-details ttw:flex ttw:w-full ttw:max-w-[720px] ttw:flex-col", we),
80
- children: [/* @__PURE__ */ p(ee, {
78
+ className: s("ttw:@container/card-details ttw:flex ttw:w-full ttw:max-w-[720px] ttw:flex-col", Ce),
79
+ children: [/* @__PURE__ */ m(d, {
81
80
  testIds: B?.header,
82
81
  labels: V.header,
83
- title: v === "loaded" ? y ?? V.header.untitledCard : void 0,
84
- isTitlePending: v === "loading",
85
- statusLabel: v === "loaded" ? ce : void 0,
82
+ title: y === "loaded" ? se ?? V.header.untitledCard : void 0,
83
+ isTitlePending: y === "loading",
84
+ statusLabel: y === "loaded" ? ce : void 0,
86
85
  statusTone: le,
87
- formFactorLabel: v === "loaded" ? ue : void 0,
88
- cardMenu: v === "loaded" ? de : void 0,
86
+ formFactorLabel: y === "loaded" ? ue : void 0,
87
+ cardMenu: y === "loaded" ? de : void 0,
89
88
  onClose: fe,
90
- titleAction: v === "loaded" && T && E === "closed" ? /* @__PURE__ */ p(r, {
89
+ titleAction: y === "loaded" && T && E === "closed" ? /* @__PURE__ */ m(r, {
91
90
  type: "button",
92
91
  variant: "link",
93
92
  size: "sm",
@@ -96,27 +95,27 @@ function _({ labels: _, state: v, nickname: y, statusLabel: ce, statusTone: le,
96
95
  onClick: T,
97
96
  children: V.nickname.edit
98
97
  }) : void 0
99
- }), /* @__PURE__ */ p("div", {
98
+ }), /* @__PURE__ */ m("div", {
100
99
  className: "ttw:px-4 ttw:pb-6 ttw:@md/card-details:px-6",
101
- children: v === "loading" ? /* @__PURE__ */ m(u, {
100
+ children: y === "loading" ? /* @__PURE__ */ h(l, {
102
101
  isLoading: !0,
103
102
  loadingLabel: V.status.loadingAriaLabel,
104
103
  "data-testid": B?.loading,
105
104
  className: "ttw:space-y-4",
106
- children: [/* @__PURE__ */ p(o, { className: "ttw:h-8 ttw:w-56" }), /* @__PURE__ */ p(o, { className: "ttw:h-64 ttw:w-full ttw:rounded-lg" })]
107
- }) : v === "error" ? /* @__PURE__ */ p(l, {
105
+ children: [/* @__PURE__ */ m(o, { className: "ttw:h-8 ttw:w-56" }), /* @__PURE__ */ m(o, { className: "ttw:h-64 ttw:w-full ttw:rounded-lg" })]
106
+ }) : y === "error" ? /* @__PURE__ */ m(c, {
108
107
  title: V.status.errorTitle,
109
108
  description: V.status.errorDescription,
110
109
  retryLabel: V.status.errorRetry,
111
- onRetry: Ce
112
- }) : v === "notFound" ? /* @__PURE__ */ p(c, {
113
- icon: /* @__PURE__ */ p(g, {}),
110
+ onRetry: Se
111
+ }) : y === "notFound" ? /* @__PURE__ */ m(ee, {
112
+ icon: /* @__PURE__ */ m(_, {}),
114
113
  title: V.status.notFoundTitle,
115
114
  description: V.status.notFoundDescription
116
- }) : /* @__PURE__ */ m("div", {
115
+ }) : /* @__PURE__ */ h("div", {
117
116
  className: "ttw:flex ttw:flex-col ttw:gap-4",
118
117
  children: [
119
- T && E !== "closed" ? /* @__PURE__ */ p(oe, {
118
+ T && E !== "closed" ? /* @__PURE__ */ m(ae, {
120
119
  labels: V.nickname,
121
120
  editState: E,
122
121
  onEdit: T,
@@ -126,34 +125,34 @@ function _({ labels: _, state: v, nickname: y, statusLabel: ce, statusTone: le,
126
125
  onCancel: A,
127
126
  isSaveDisabled: j
128
127
  }) : null,
129
- /* @__PURE__ */ m("div", {
128
+ /* @__PURE__ */ h("div", {
130
129
  className: "ttw:flex ttw:flex-col ttw:gap-4 ttw:@xl/card-details:flex-row ttw:@xl/card-details:items-start",
131
- children: [/* @__PURE__ */ p("div", {
130
+ children: [/* @__PURE__ */ m("div", {
132
131
  className: "ttw:flex ttw:justify-center ttw:rounded-lg ttw:bg-muted ttw:p-4 ttw:@xl/card-details:shrink-0",
133
- children: /* @__PURE__ */ m("div", {
134
- className: s("ttw:flex ttw:flex-col ttw:gap-2", te),
132
+ children: /* @__PURE__ */ h("div", {
133
+ className: s("ttw:flex ttw:flex-col ttw:gap-2", f),
135
134
  children: [
136
- N ? /* @__PURE__ */ p(ae, {
135
+ N ? /* @__PURE__ */ m(ie, {
137
136
  testIds: B?.cardFaceFlip,
138
137
  isFlipped: K,
139
138
  front: $,
140
- back: /* @__PURE__ */ p(ie, {
139
+ back: /* @__PURE__ */ m(re, {
141
140
  labels: V.credentials,
142
- cardNumber: be,
143
- expirationDate: xe,
144
- securityCode: Se,
141
+ cardNumber: ye,
142
+ expirationDate: be,
143
+ securityCode: xe,
145
144
  isLocked: I,
146
145
  onCopy: w,
147
146
  testIds: B?.credentialsFace
148
147
  })
149
148
  }) : $,
150
- M ? /* @__PURE__ */ p(r, {
149
+ M ? /* @__PURE__ */ m(r, {
151
150
  type: "button",
152
151
  className: "ttw:mt-2 ttw:w-full",
153
152
  onClick: M,
154
153
  children: V.actions.activateCard
155
154
  }) : null,
156
- N ? /* @__PURE__ */ p(r, {
155
+ N ? /* @__PURE__ */ m(r, {
157
156
  type: "button",
158
157
  variant: "ghost",
159
158
  className: "ttw:w-full",
@@ -162,7 +161,7 @@ function _({ labels: _, state: v, nickname: y, statusLabel: ce, statusTone: le,
162
161
  onClick: q,
163
162
  children: K ? V.actions.hideCard : V.actions.viewCard
164
163
  }) : null,
165
- J ? /* @__PURE__ */ p(r, {
164
+ J ? /* @__PURE__ */ m(r, {
166
165
  type: "button",
167
166
  variant: "outline",
168
167
  className: "ttw:w-full",
@@ -171,30 +170,30 @@ function _({ labels: _, state: v, nickname: y, statusLabel: ce, statusTone: le,
171
170
  onClick: Y,
172
171
  children: I ? V.lock.unlockCard : V.lock.lockCard
173
172
  }) : null,
174
- I ? /* @__PURE__ */ m(e, {
173
+ I ? /* @__PURE__ */ h(e, {
175
174
  variant: "destructive",
176
- children: [/* @__PURE__ */ p(h, { "aria-hidden": "true" }), /* @__PURE__ */ p(t, { children: J ? V.lock.lockedDescription : V.lock.lockedDescriptionWithoutUnlock })]
175
+ children: [/* @__PURE__ */ m(g, { "aria-hidden": "true" }), /* @__PURE__ */ m(t, { children: J ? V.lock.lockedDescription : V.lock.lockedDescriptionWithoutUnlock })]
177
176
  }) : null,
178
- L === "errored" ? /* @__PURE__ */ p(d, { children: V.lock.errorDescription }) : null,
179
- F === "errored" ? /* @__PURE__ */ p(d, { children: V.credentials.errorDescription }) : null
177
+ L === "errored" ? /* @__PURE__ */ m(u, { children: V.lock.errorDescription }) : null,
178
+ F === "errored" ? /* @__PURE__ */ m(u, { children: V.credentials.errorDescription }) : null
180
179
  ]
181
180
  })
182
- }), Z.length > 0 ? /* @__PURE__ */ p("div", {
181
+ }), Z.length > 0 ? /* @__PURE__ */ m("div", {
183
182
  className: "ttw:min-w-0 ttw:flex-1",
184
- children: /* @__PURE__ */ p(i, { items: Z })
183
+ children: /* @__PURE__ */ m(i, { items: Z })
185
184
  }) : null]
186
185
  }),
187
- Q.length > 0 ? /* @__PURE__ */ m("section", {
186
+ Q.length > 0 ? /* @__PURE__ */ h("section", {
188
187
  className: "ttw:flex ttw:flex-col ttw:gap-2",
189
- children: [/* @__PURE__ */ p(a, {
188
+ children: [/* @__PURE__ */ m(a, {
190
189
  variant: "card",
191
190
  level: 3,
192
191
  children: V.fields.cardControlsHeading
193
- }), /* @__PURE__ */ p(i, { items: Q })]
192
+ }), /* @__PURE__ */ m(i, { items: Q })]
194
193
  }) : null
195
194
  ]
196
195
  })
197
196
  })]
198
197
  });
199
198
  }
200
- export { _ as CardDetailsPanel };
199
+ export { v as CardDetailsPanel };
@@ -4,13 +4,13 @@ import { CardFaceGlow as r } from "./CardFaceGlow.js";
4
4
  import { jsx as i, jsxs as a } from "react/jsx-runtime";
5
5
  import { LockIcon as o } from "lucide-react";
6
6
  // ../../libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/CardFace.js
7
- function s({ cardArtSrc: s, bankLogoSrc: c, bankLogoAlt: l, cardholderName: u, maskedCardNumber: d, programLabel: f, statusLabel: p, isLocked: m, lockedLabel: h, testIds: g, className: _ }) {
7
+ function s({ cardArtSrc: s, bankLogoSrc: c, bankLogoAlt: l, cardholderName: u, maskedCardNumber: d, statusLabel: f, isLocked: p, lockedLabel: m, testIds: h, className: g }) {
8
8
  return /* @__PURE__ */ a("div", {
9
- "data-testid": g?.root,
10
- className: e(n, "ttw:justify-between", _),
9
+ "data-testid": h?.root,
10
+ className: e(n, "ttw:justify-between", g),
11
11
  children: [
12
12
  s ? /* @__PURE__ */ i("img", {
13
- "data-testid": g?.cardArt,
13
+ "data-testid": h?.cardArt,
14
14
  src: s,
15
15
  alt: "",
16
16
  "aria-hidden": "true",
@@ -25,37 +25,31 @@ function s({ cardArtSrc: s, bankLogoSrc: c, bankLogoAlt: l, cardholderName: u, m
25
25
  alt: l,
26
26
  className: "ttw:relative ttw:h-8 ttw:w-auto ttw:max-w-[60%] ttw:object-contain ttw:object-left"
27
27
  }) : /* @__PURE__ */ i("span", { className: "ttw:relative ttw:h-8" }),
28
- m ? /* @__PURE__ */ i("div", {
29
- "data-testid": g?.lockedOverlay,
28
+ p ? /* @__PURE__ */ i("div", {
29
+ "data-testid": h?.lockedOverlay,
30
30
  className: "ttw:pointer-events-none ttw:absolute ttw:inset-0 ttw:flex ttw:items-center ttw:justify-center ttw:bg-black/55",
31
- children: h ? /* @__PURE__ */ a("span", {
31
+ children: m ? /* @__PURE__ */ a("span", {
32
32
  className: e(t, "ttw:inline-flex ttw:items-center ttw:gap-1.5"),
33
33
  children: [/* @__PURE__ */ i(o, {
34
34
  className: "ttw:size-3.5",
35
35
  "aria-hidden": "true"
36
- }), h]
36
+ }), m]
37
37
  }) : null
38
- }) : p ? /* @__PURE__ */ i("div", {
38
+ }) : f ? /* @__PURE__ */ i("div", {
39
39
  className: "ttw:pointer-events-none ttw:absolute ttw:inset-0 ttw:flex ttw:items-center ttw:justify-center",
40
40
  children: /* @__PURE__ */ i("span", {
41
41
  className: t,
42
- children: p
42
+ children: f
43
43
  })
44
44
  }) : null,
45
45
  /* @__PURE__ */ a("div", {
46
- className: "ttw:relative ttw:flex ttw:flex-wrap ttw:items-end ttw:justify-between ttw:gap-x-3 ttw:gap-y-1",
47
- children: [/* @__PURE__ */ a("div", {
48
- className: "ttw:min-w-0 ttw:max-w-full ttw:flex-auto",
49
- children: [/* @__PURE__ */ i("p", {
50
- className: "ttw:truncate ttw:text-base ttw:font-medium ttw:text-white",
51
- children: u
52
- }), /* @__PURE__ */ i("p", {
53
- className: "ttw:mt-1 ttw:truncate ttw:text-lg ttw:tracking-wide ttw:text-white/90",
54
- children: d
55
- })]
46
+ className: "ttw:relative ttw:min-w-0",
47
+ children: [/* @__PURE__ */ i("p", {
48
+ className: "ttw:truncate ttw:text-base ttw:font-medium ttw:text-white",
49
+ children: u
56
50
  }), /* @__PURE__ */ i("p", {
57
- className: "ttw:shrink-0 ttw:text-[10px] ttw:font-medium ttw:text-white/90",
58
- children: f
51
+ className: "ttw:mt-1 ttw:truncate ttw:text-lg ttw:tracking-wide ttw:text-white/90",
52
+ children: d
59
53
  })]
60
54
  })
61
55
  ]
@@ -38,17 +38,13 @@ function p({ counterpartId: p, counterpartType: m, onClose: h, onViewAllDocument
38
38
  setView: D,
39
39
  details: O,
40
40
  messages: w
41
- }), { closeAddress: j } = A, { close: M } = A.bank.form, { close: N } = A.del, P = c(() => {
42
- j(), M(), N(), D("none");
43
- }, [
44
- j,
45
- M,
46
- N
47
- ]), [F, I] = u(p);
48
- F !== p && (I(p), P());
49
- let L = c(() => {
50
- P(), h();
51
- }, [P, h]);
41
+ }), { close: j } = A.bank.form, { close: M } = A.del, N = c(() => {
42
+ j(), M(), D("none");
43
+ }, [j, M]), [P, F] = u(p);
44
+ P !== p && (F(p), N());
45
+ let I = c(() => {
46
+ N(), h();
47
+ }, [N, h]);
52
48
  return /* @__PURE__ */ d(a, {
53
49
  counterpartType: m,
54
50
  open: S.canRead && p !== void 0,
@@ -60,7 +56,7 @@ function p({ counterpartId: p, counterpartType: m, onClose: h, onViewAllDocument
60
56
  stateOptions: T,
61
57
  canEdit: S.canUpdate,
62
58
  canDelete: !1,
63
- onClose: L,
59
+ onClose: I,
64
60
  onViewAllDocuments: g,
65
61
  onCreateDocument: _,
66
62
  detailsLabels: v,
@@ -2,135 +2,118 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { BankAccountFormSheet as e } from "../../../../../shared/counterpart-management/ui/dist/index11.js";
6
- import { ConfirmDeleteDialog as t } from "../../../../../shared/counterpart-management/ui/dist/index13.js";
5
+ import { CounterpartFormSheet as e } from "../../../../../shared/counterpart-management/ui/dist/index10.js";
6
+ import { BankAccountFormSheet as t } from "../../../../../shared/counterpart-management/ui/dist/index11.js";
7
+ import { ConfirmDeleteDialog as n } from "../../../../../shared/counterpart-management/ui/dist/index13.js";
8
+ import { buildCounterpartFormTaxIdField as r } from "../../../../../shared/counterpart-management/feature/dist/lib/helpers.js";
7
9
  import "../../../../../shared/counterpart-management/feature/dist/index.js";
8
- import { EDIT_FORM_FIELD_KEYS as n, addressFormLabelOverrides as r, buildCounterpartEditFormView as i, editFormLabelOverrides as a, withAddressLabelOverrides as o } from "./viewModels.js";
9
- import { COUNTERPART_DETAILS_SHEET_LABELS_EN as s } from "../../../../ui/dist/index2.js";
10
- import { CounterpartDetailsSheet as c } from "../../../../ui/dist/index7.js";
10
+ import { COUNTERPART_DETAILS_SHEET_LABELS_EN as i } from "../../../../ui/dist/index2.js";
11
+ import { CounterpartDetailsSheet as a } from "../../../../ui/dist/index5.js";
11
12
  import "../../../../ui/dist/index.js";
12
- import { useMemo as l } from "react";
13
- import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
13
+ import { useMemo as o } from "react";
14
+ import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
14
15
  // ../../libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartDetailsPanel.js
15
- function p({ counterpartType: p, open: m, selectedId: h, view: g, details: _, detailsSheetView: v, actions: y, stateOptions: b, canEdit: x, canDelete: S, onClose: C, onViewAllDocuments: w, onCreateDocument: T, formLabels: E, detailsLabels: D, bankAccountLabels: O, addressLabels: k, deleteLabels: A }) {
16
- let { form: j, bank: M, address: N, del: P, isEditDirty: F, isAddressDirty: I } = y, L = !_.isAddressesLoading && !_.isAddressesFetching && !_.isAddressesError, R = x && L, z = !_.isLoading && !_.isFetching && !_.isError && (p === "vendor" ? R : x), B = !_.isBankAccountsLoading && !_.isBankAccountsFetching && !_.isBankAccountsError, V = l(() => o(D, k), [k, D]), H = l(() => r(k), [k]), U = l(() => a(E), [E]), W = l(() => g === "edit" ? i(p, j.values, j.errors, {
17
- ...s,
18
- ...V,
19
- ...U.labels
20
- }) : void 0, [
21
- p,
22
- U,
23
- j.errors,
24
- j.values,
25
- V,
26
- g
27
- ]), G = l(() => h && v ? {
28
- id: h,
29
- name: v.name
30
- } : void 0, [v, h]);
31
- return /* @__PURE__ */ f(u, { children: [
32
- /* @__PURE__ */ d(c, {
33
- open: m,
16
+ function u({ counterpartType: u, open: d, selectedId: f, view: p, details: m, detailsSheetView: h, actions: g, stateOptions: _, canEdit: v, canDelete: y, onClose: b, onViewAllDocuments: x, onCreateDocument: S, formLabels: C, detailsLabels: w, bankAccountLabels: T, deleteLabels: E }) {
17
+ let { form: D, bank: O, del: k } = g, A = !m.isAddressesLoading && !m.isAddressesFetching && !m.isAddressesError, j = !m.isLoading && !m.isFetching && !m.isError, M = A && j, N = !m.isBankAccountsLoading && !m.isBankAccountsFetching && !m.isBankAccountsError, P = p === "edit", F = w?.reloadFailed ?? i.reloadFailed, I = m.isError || m.isAddressesError, L = o(() => f && h ? {
18
+ id: f,
19
+ name: h.name
20
+ } : void 0, [h, f]);
21
+ return /* @__PURE__ */ l(s, { children: [
22
+ /* @__PURE__ */ c(a, {
23
+ open: d && !P,
34
24
  onOpenChange: (e) => {
35
- e || C();
25
+ e || b();
36
26
  },
37
- privacyResetKey: h,
38
- mode: p,
39
- counterpart: v,
40
- isLoading: _.isLoading,
41
- isError: _.isError,
42
- canEdit: x,
43
- canEditProfile: z,
44
- canEditAddress: R,
45
- canEditPaymentMethod: x && B,
46
- canDelete: S,
47
- onEdit: y.handleEditProfile,
48
- onDelete: P.requestDeleteCounterpart,
49
- onClose: C,
50
- onAddAddress: N.openCreate,
51
- onEditAddress: N.openEdit,
52
- onAddBankAccount: M.form.openCreate,
53
- onEditBankAccount: M.form.openEdit,
54
- onViewAllDocuments: w && G ? () => w(G) : void 0,
55
- onCreateDocument: T && G ? () => T(G) : void 0,
56
- onDeleteBankAccount: (e) => P.requestDelete({
27
+ privacyResetKey: f,
28
+ mode: u,
29
+ counterpart: h,
30
+ isLoading: m.isLoading,
31
+ isError: m.isError,
32
+ canEdit: v,
33
+ canEditProfile: v && M,
34
+ canEditPaymentMethod: v && N,
35
+ canDelete: y,
36
+ onEdit: g.handleEditProfile,
37
+ onDelete: k.requestDeleteCounterpart,
38
+ onAddBankAccount: O.form.openCreate,
39
+ onEditBankAccount: O.form.openEdit,
40
+ onViewAllDocuments: x && L ? () => x(L) : void 0,
41
+ onCreateDocument: S && L ? () => S(L) : void 0,
42
+ onDeleteBankAccount: (e) => k.requestDelete({
57
43
  kind: "bankAccount",
58
44
  id: e,
59
- label: _.bankItems.find((t) => t.id === e)?.primary ?? ""
45
+ label: m.bankItems.find((t) => t.id === e)?.primary ?? ""
60
46
  }),
61
- editForm: W && {
62
- ...W,
63
- ...U,
64
- stateOptions: b,
65
- inProgress: j.isSubmitting,
66
- submitDisabled: !F || !z,
67
- onFieldChange: (e, t) => j.setValues((r) => ({
68
- ...r,
69
- [n[e]]: t
70
- })),
71
- onRemindersChange: (e) => j.setValues((t) => ({
72
- ...t,
73
- remindersEnabled: e
74
- })),
75
- onAddressChange: (e) => j.setValues((t) => ({
76
- ...t,
77
- address: {
78
- ...t.address,
79
- ...e
80
- }
81
- })),
82
- onSubmit: j.submit,
83
- onCancel: j.close
47
+ labels: w
48
+ }),
49
+ /* @__PURE__ */ c(e, {
50
+ open: d && P,
51
+ onOpenChange: (e) => {
52
+ e || D.close();
84
53
  },
85
- addressForm: N.open ? {
86
- hasExistingAddress: !!_.primaryAddress,
87
- values: N.values,
88
- errors: N.errors,
89
- stateOptions: b,
90
- inProgress: N.isPending,
91
- submitDisabled: !I || !L,
92
- formError: N.formError,
93
- ...H,
94
- onChange: (e) => N.setValues((t) => ({
95
- ...t,
54
+ mode: "edit",
55
+ counterpartMode: u,
56
+ values: D.values,
57
+ errors: I ? {
58
+ ...D.errors,
59
+ form: F
60
+ } : D.errors,
61
+ stateOptions: _,
62
+ taxIdField: r(D.values.entityType, u, C),
63
+ inProgress: D.isSubmitting,
64
+ onChange: (e) => D.setValues((t) => ({
65
+ ...t,
66
+ ...e
67
+ })),
68
+ onAddressChange: (e) => D.setValues((t) => ({
69
+ ...t,
70
+ address: {
71
+ ...t.address,
96
72
  ...e
97
- })),
98
- onSubmit: N.submit,
99
- onCancel: N.close
100
- } : void 0,
101
- labels: V
73
+ }
74
+ })),
75
+ onSubmit: () => {
76
+ M && D.submit();
77
+ },
78
+ onCancel: D.close,
79
+ labels: C
102
80
  }),
103
- /* @__PURE__ */ d(e, {
104
- open: M.form.sheet.open,
81
+ /* @__PURE__ */ c(t, {
82
+ open: O.form.sheet.open,
105
83
  onOpenChange: (e) => {
106
- e || M.form.close();
84
+ e || O.form.close();
107
85
  },
108
- mode: M.form.sheet.mode,
109
- values: M.form.values,
110
- errors: M.form.errors,
111
- highlightedFields: M.highlightedFields,
112
- inProgress: M.inProgress,
113
- submitDisabled: !M.isDirty || !B,
114
- onChange: (e) => M.form.setValues((t) => ({
86
+ mode: O.form.sheet.mode,
87
+ values: O.form.values,
88
+ errors: m.isBankAccountsError ? {
89
+ ...O.form.errors,
90
+ form: F
91
+ } : O.form.errors,
92
+ highlightedFields: O.highlightedFields,
93
+ inProgress: O.inProgress,
94
+ onChange: (e) => O.form.setValues((t) => ({
115
95
  ...t,
116
96
  ...e
117
97
  })),
118
- onSubmit: M.form.submit,
119
- onCancel: M.form.close,
120
- labels: O
98
+ onSubmit: () => {
99
+ N && g.submitBankAccount();
100
+ },
101
+ onCancel: O.form.close,
102
+ labels: T
121
103
  }),
122
- /* @__PURE__ */ d(t, {
123
- open: P.target !== null,
104
+ /* @__PURE__ */ c(n, {
105
+ open: k.target !== null,
124
106
  onOpenChange: (e) => {
125
- e || P.close();
107
+ e || k.close();
126
108
  },
127
- title: P.dialogTitle,
128
- message: P.dialogMessage,
129
- isDeleting: P.isDeleting,
130
- onConfirm: P.confirm,
131
- onCancel: P.close,
132
- labels: A
109
+ title: k.dialogTitle,
110
+ message: k.dialogMessage,
111
+ confirmLabel: k.confirmLabel,
112
+ isDeleting: k.isDeleting,
113
+ onConfirm: k.confirm,
114
+ onCancel: k.close,
115
+ labels: E
133
116
  })
134
117
  ] });
135
118
  }
136
- export { p as CounterpartDetailsPanel };
119
+ export { u as CounterpartDetailsPanel };