@tesouro/embedded-components-react 0.2.298 → 0.2.300

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 (46) hide show
  1. package/dist/index.css +6 -0
  2. package/dist/index.d.ts +107 -87
  3. package/dist/lib/CounterpartsWidget.d.ts +24 -4
  4. package/dist/lib/ReceivablesWidget.d.ts +20 -3
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +31 -27
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index2.js +2 -0
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index4.js +122 -149
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js +163 -72
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +3 -3
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +52 -46
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index18.js +8 -2
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index19.js +98 -67
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index25.js +6 -1
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index28.js +7 -3
  15. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/data-access/dist/index2.js +2 -2
  16. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/index7.js +4 -1
  17. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/index8.js +12 -7
  18. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index4.js +1 -1
  19. package/dist/libs/tesouro-embedded-components-react/gl-code-table-widget/feature/dist/index8.js +2 -2
  20. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index10.js +1 -1
  21. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index12.js +1 -1
  22. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index5.js +1 -1
  23. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index8.js +1 -1
  24. package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/index6.js +1 -1
  25. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/index.js +17 -16
  26. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/CounterpartSelector.js +1 -1
  27. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/helpers.js +103 -50
  28. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/labels.js +2 -1
  29. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useCounterpartDetails.js +2 -0
  30. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useCounterpartForm.js +126 -76
  31. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index.js +12 -11
  32. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index10.js +6 -173
  33. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index11.js +173 -5
  34. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index12.js +5 -57
  35. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index13.js +51 -22
  36. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index14.js +24 -72
  37. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index15.js +76 -0
  38. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index2.js +13 -7
  39. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index5.js +53 -110
  40. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index6.js +115 -51
  41. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index7.js +53 -47
  42. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index8.js +44 -504
  43. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index9.js +480 -6
  44. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/zod.gen.js +2939 -2975
  45. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  46. package/package.json +1 -1
@@ -38,113 +38,119 @@ function v(e, t) {
38
38
  };
39
39
  return n;
40
40
  }
41
- function y({ payableId: h, form: g, counterpartId: y, onSaved: b, onPayableCreated: x, onDraftSaved: S, onFinalized: C, labels: w }) {
42
- let T = {
41
+ function y({ payableId: h, form: g, counterpartId: y, clearCounterpart: b, prepareVendorForSave: x, onSaved: S, onPayableCreated: C, onDraftSaved: w, onFinalized: T, labels: E }) {
42
+ let D = {
43
43
  ...t,
44
- ...w
45
- }, [E, D] = m(), O = h ?? E, [k, A] = m(), j = p(!1), M = r(), N = a(), P = n(), F = o(), I = i(), L = f(() => {
46
- let t = d(g.lineItems, T), n = u(g.discount, g.tax, g.totalOverride, T);
47
- return g.setLineItemErrors(t), !t && !n || (t ? (g.setErrors(void 0), e.error(T.lineItemsNeedAttention)) : g.setErrors(n), !1);
48
- }, [g, T]), R = f(async () => {
44
+ ...E
45
+ }, [O, k] = m(), A = h ?? O, [j, M] = m(), N = p(!1), P = r(), F = a(), I = n(), L = o(), R = i(), z = f(() => {
46
+ let t = d(g.lineItems, D), n = u(g.discount, g.tax, g.totalOverride, D);
47
+ return g.setLineItemErrors(t), !t && !n || (t ? (g.setErrors(void 0), e.error(D.lineItemsNeedAttention)) : g.setErrors(n), !1);
48
+ }, [g, D]), B = f(async () => {
49
49
  let e = s({
50
50
  values: g.values,
51
51
  counterpartId: y,
52
+ clearCounterpart: b,
52
53
  editedTotals: g.isTotalsDirty ? {
53
54
  discount: g.discount,
54
55
  tax: g.tax,
55
56
  total: g.totalOverride
56
57
  } : void 0
57
- }), t = O;
58
- if (t ? await N.mutateAsync({
58
+ }), t = A;
59
+ if (t ? await F.mutateAsync({
59
60
  path: { payable_id: t },
60
61
  body: e
61
- }) : (t = (await M.mutateAsync({ body: e }))?.id, t && (D(t), x?.(t))), !t) throw Error("Payable was created without an id");
62
- return await P.mutateAsync({
62
+ }) : (t = (await P.mutateAsync({ body: e }))?.id, t && (k(t), C?.(t))), !t) throw Error("Payable was created without an id");
63
+ return await I.mutateAsync({
63
64
  path: { payable_id: t },
64
65
  body: { data: c(g.lineItems) }
65
66
  }), t;
66
67
  }, [
67
68
  y,
68
- M,
69
+ b,
70
+ P,
69
71
  g.discount,
70
72
  g.isTotalsDirty,
71
73
  g.lineItems,
72
74
  g.tax,
73
75
  g.totalOverride,
74
76
  g.values,
75
- x,
76
- O,
77
- P,
78
- N
77
+ C,
78
+ A,
79
+ I,
80
+ F
79
81
  ]);
80
82
  return {
81
83
  saveDraft: f(async () => {
82
- if (!j.current && L()) {
83
- j.current = !0, A("draft");
84
+ if (!N.current && z()) {
85
+ N.current = !0, M("draft");
84
86
  try {
85
- let t = await R();
86
- g.setErrors(void 0), b?.(t), S?.(t), e.success(T.draftSaved);
87
+ if (await x?.() === !1) return;
88
+ let t = await B();
89
+ g.setErrors(void 0), S?.(t), w?.(t), e.success(D.draftSaved);
87
90
  } catch {
88
- g.setErrors({ form: T.saveFailed });
91
+ g.setErrors({ form: D.saveFailed });
89
92
  } finally {
90
- A(void 0), j.current = !1;
93
+ M(void 0), N.current = !1;
91
94
  }
92
95
  }
93
96
  }, [
94
97
  g,
95
- L,
96
- T.draftSaved,
97
- T.saveFailed,
98
+ z,
99
+ D.draftSaved,
100
+ D.saveFailed,
101
+ w,
98
102
  S,
99
- b,
100
- R
103
+ x,
104
+ B
101
105
  ]),
102
106
  finalize: f(async () => {
103
- if (j.current) return;
104
- let t = d(g.lineItems, T), n = u(g.discount, g.tax, g.totalOverride, T), { formErrors: r, lineItemErrors: i } = l(g.values, y, g.lineItems, T), a = v(i, t);
107
+ if (N.current) return;
108
+ let t = d(g.lineItems, D), n = u(g.discount, g.tax, g.totalOverride, D), { formErrors: r, lineItemErrors: i } = l(g.values, y, g.lineItems, D), a = v(i, t);
105
109
  g.setLineItemErrors(a);
106
110
  let o = {
107
111
  ...r,
108
112
  ...n
109
113
  };
110
- if (g.setErrors(Object.keys(o).length ? o : void 0), t && e.error(T.lineItemsNeedAttention), !(a || Object.keys(o).length)) {
111
- j.current = !0, A("finalize");
114
+ if (g.setErrors(Object.keys(o).length ? o : void 0), t && e.error(D.lineItemsNeedAttention), !(a || Object.keys(o).length)) {
115
+ N.current = !0, M("finalize");
112
116
  try {
113
117
  let t;
114
118
  try {
115
- t = await R();
119
+ if (await x?.() === !1) return;
120
+ t = await B();
116
121
  } catch {
117
- g.setErrors({ form: T.saveFailed });
122
+ g.setErrors({ form: D.saveFailed });
118
123
  return;
119
124
  }
120
- b?.(t);
125
+ S?.(t);
121
126
  try {
122
- let n = await F.mutateAsync({ path: { payable_id: t } });
127
+ let n = await L.mutateAsync({ path: { payable_id: t } });
123
128
  if (n.validation_errors.length) {
124
- g.setErrors(_(n.validation_errors, T));
129
+ g.setErrors(_(n.validation_errors, D));
125
130
  return;
126
131
  }
127
- await I.mutateAsync({ path: { payable_id: t } }), g.setErrors(void 0), C?.(t), e.success(T.billFinalized);
132
+ await R.mutateAsync({ path: { payable_id: t } }), g.setErrors(void 0), T?.(t), e.success(D.billFinalized);
128
133
  } catch {
129
- g.setErrors({ form: T.finalizeFailed });
134
+ g.setErrors({ form: D.finalizeFailed });
130
135
  }
131
136
  } finally {
132
- A(void 0), j.current = !1;
137
+ M(void 0), N.current = !1;
133
138
  }
134
139
  }
135
140
  }, [
136
141
  y,
137
142
  g,
143
+ D,
138
144
  T,
139
- C,
140
- b,
145
+ S,
146
+ x,
147
+ B,
141
148
  R,
142
- I,
143
- F
149
+ L
144
150
  ]),
145
- payableId: O,
146
- isSavingDraft: k === "draft",
147
- isFinalizing: k === "finalize"
151
+ payableId: A,
152
+ isSavingDraft: j === "draft",
153
+ isFinalizing: j === "finalize"
148
154
  };
149
155
  }
150
156
  //#endregion
@@ -1,10 +1,16 @@
1
+ import { ACH_FIELD_GROUP_LABELS_EN as e } from "../../../shared/counterpart-management/ui/dist/index2.js";
2
+ import "../../../shared/counterpart-management/ui/dist/index.js";
1
3
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index18.js
2
- var e = {
4
+ var t = {
3
5
  payToHeading: "Pay to",
4
6
  editAction: "Edit",
5
7
  clearAction: "Clear",
8
+ paymentInstructionsHeading: "Payment instructions",
9
+ paymentInstructionsDescription: "How and where will the money be sent. This information is required to send a payment.",
10
+ addPaymentInstructions: "Add payment instructions",
11
+ ach: e,
6
12
  revealField: (e) => `Show ${e.toLowerCase()}`,
7
13
  hideField: (e) => `Hide ${e.toLowerCase()}`
8
14
  };
9
15
  //#endregion
10
- export { e as VENDOR_SUMMARY_CARD_LABELS_EN };
16
+ export { t as VENDOR_SUMMARY_CARD_LABELS_EN };
@@ -1,89 +1,120 @@
1
1
  import { Button as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
- import { VENDOR_SUMMARY_CARD_LABELS_EN as t } from "./index18.js";
3
- import { useState as n } from "react";
4
- import { jsx as r, jsxs as i } from "react/jsx-runtime";
5
- import { Eye as a, EyeOff as o } from "lucide-react";
2
+ import { AchFieldGroup as t } from "../../../shared/counterpart-management/ui/dist/index5.js";
3
+ import "../../../shared/counterpart-management/ui/dist/index.js";
4
+ import { VENDOR_SUMMARY_CARD_LABELS_EN as n } from "./index18.js";
5
+ import { useState as r } from "react";
6
+ import { Fragment as i, jsx as a, jsxs as o } from "react/jsx-runtime";
7
+ import { Eye as s, EyeOff as c, Pencil as l, Plus as u, X as d } from "lucide-react";
6
8
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index19.js
7
- function s({ field: e, labels: t }) {
8
- let [s, c] = n(!1), l = !!e.maskedValue, u = l && !s ? e.maskedValue : e.value;
9
- return /* @__PURE__ */ i("div", {
9
+ function f({ field: e, labels: t }) {
10
+ let [n, i] = r(!1), l = !!e.maskedValue, u = l && !n ? e.maskedValue : e.value;
11
+ return /* @__PURE__ */ o("div", {
10
12
  className: "ttw:flex ttw:items-center ttw:gap-2 ttw:text-sm",
11
13
  children: [
12
- /* @__PURE__ */ r("span", {
14
+ /* @__PURE__ */ a("span", {
13
15
  className: "ttw:w-44 ttw:shrink-0 ttw:text-muted-foreground",
14
16
  children: e.label
15
17
  }),
16
- /* @__PURE__ */ r("span", {
18
+ /* @__PURE__ */ a("span", {
17
19
  className: "ttw:text-foreground",
18
20
  children: u
19
21
  }),
20
- l ? /* @__PURE__ */ r("button", {
22
+ l ? /* @__PURE__ */ a("button", {
21
23
  type: "button",
22
- onClick: () => c((e) => !e),
23
- "aria-label": s ? t.hideField(e.label) : t.revealField(e.label),
24
+ onClick: () => i((e) => !e),
25
+ "aria-label": n ? t.hideField(e.label) : t.revealField(e.label),
24
26
  className: "ttw:text-muted-foreground ttw:hover:text-foreground",
25
- children: r(s ? o : a, { className: "ttw:size-4" })
27
+ children: a(n ? c : s, { className: "ttw:size-4" })
26
28
  }) : null
27
29
  ]
28
30
  });
29
31
  }
30
- function c({ summary: n, onEdit: a, onClear: o, testId: c, labels: l }) {
31
- let u = {
32
- ...t,
33
- ...l
32
+ function p({ summary: r, onEdit: s, onClear: c, paymentInstructions: p, testId: m, labels: h }) {
33
+ let g = {
34
+ ...n,
35
+ ...h,
36
+ ach: {
37
+ ...n.ach,
38
+ ...h?.ach
39
+ }
34
40
  };
35
- return /* @__PURE__ */ i("div", {
41
+ return /* @__PURE__ */ o("div", {
36
42
  className: "ttw:rounded-lg ttw:border ttw:border-border ttw:bg-muted/30 ttw:p-4",
37
- "data-testid": c,
38
- children: [
39
- /* @__PURE__ */ i("div", {
40
- className: "ttw:flex ttw:items-start ttw:justify-between",
41
- children: [/* @__PURE__ */ i("div", {
42
- className: "ttw:flex ttw:flex-col ttw:gap-0.5",
43
- children: [
44
- /* @__PURE__ */ r("span", {
45
- className: "ttw:text-xs ttw:text-muted-foreground",
46
- children: u.payToHeading
47
- }),
48
- /* @__PURE__ */ r("span", {
49
- className: "ttw:text-base ttw:font-semibold ttw:text-foreground",
50
- children: n.name
51
- }),
52
- /* @__PURE__ */ r("span", {
53
- className: "ttw:text-sm ttw:text-muted-foreground",
54
- children: n.email
55
- })
56
- ]
57
- }), /* @__PURE__ */ i("div", {
58
- className: "ttw:flex ttw:items-center ttw:gap-1",
59
- children: [a ? /* @__PURE__ */ r(e, {
60
- type: "button",
61
- variant: "ghost",
62
- size: "sm",
63
- onClick: a,
64
- children: u.editAction
65
- }) : null, o ? /* @__PURE__ */ r(e, {
66
- type: "button",
67
- variant: "ghost",
68
- size: "sm",
69
- onClick: o,
70
- children: u.clearAction
71
- }) : null]
43
+ "data-testid": m,
44
+ children: [/* @__PURE__ */ o("div", {
45
+ className: "ttw:flex ttw:items-start ttw:justify-between",
46
+ children: [/* @__PURE__ */ o("div", {
47
+ className: "ttw:flex ttw:flex-col ttw:gap-0.5",
48
+ children: [
49
+ /* @__PURE__ */ a("span", {
50
+ className: "ttw:text-xs ttw:text-muted-foreground",
51
+ children: g.payToHeading
52
+ }),
53
+ /* @__PURE__ */ a("span", {
54
+ className: "ttw:text-base ttw:font-semibold ttw:text-foreground",
55
+ children: r.name
56
+ }),
57
+ /* @__PURE__ */ a("span", {
58
+ className: "ttw:text-sm ttw:text-muted-foreground",
59
+ children: r.email
60
+ })
61
+ ]
62
+ }), /* @__PURE__ */ o("div", {
63
+ className: "ttw:flex ttw:items-center ttw:gap-1",
64
+ children: [s ? /* @__PURE__ */ a(e, {
65
+ type: "button",
66
+ variant: "ghost",
67
+ size: "icon",
68
+ "aria-label": g.editAction,
69
+ onClick: s,
70
+ children: /* @__PURE__ */ a(l, { className: "ttw:size-4" })
71
+ }) : null, c ? /* @__PURE__ */ a(e, {
72
+ type: "button",
73
+ variant: "ghost",
74
+ size: "icon",
75
+ "aria-label": g.clearAction,
76
+ onClick: c,
77
+ children: /* @__PURE__ */ a(d, { className: "ttw:size-4" })
78
+ }) : null]
79
+ })]
80
+ }), r.fields.length ? /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a("p", {
81
+ className: "ttw:mt-3 ttw:text-xs ttw:text-muted-foreground",
82
+ children: r.methodLabel
83
+ }), /* @__PURE__ */ a("div", {
84
+ className: "ttw:mt-2 ttw:flex ttw:flex-col ttw:gap-1",
85
+ children: r.fields.map((e) => /* @__PURE__ */ a(f, {
86
+ field: e,
87
+ labels: g
88
+ }, `${e.label}:${e.value}:${e.maskedValue ?? ""}`))
89
+ })] }) : /* @__PURE__ */ o("div", {
90
+ className: "ttw:mt-4 ttw:flex ttw:flex-col ttw:gap-3",
91
+ children: [/* @__PURE__ */ o("div", {
92
+ className: "ttw:flex ttw:flex-col ttw:gap-1",
93
+ children: [/* @__PURE__ */ a("p", {
94
+ className: "ttw:text-sm ttw:font-semibold ttw:text-foreground",
95
+ children: g.paymentInstructionsHeading
96
+ }), /* @__PURE__ */ a("p", {
97
+ className: "ttw:text-sm ttw:text-muted-foreground",
98
+ children: g.paymentInstructionsDescription
72
99
  })]
73
- }),
74
- /* @__PURE__ */ r("p", {
75
- className: "ttw:mt-3 ttw:text-xs ttw:text-muted-foreground",
76
- children: n.methodLabel
77
- }),
78
- /* @__PURE__ */ r("div", {
79
- className: "ttw:mt-2 ttw:flex ttw:flex-col ttw:gap-1",
80
- children: n.fields.map((e) => /* @__PURE__ */ r(s, {
81
- field: e,
82
- labels: u
83
- }, `${e.label}:${e.value}:${e.maskedValue ?? ""}`))
84
- })
85
- ]
100
+ }), p?.isOpen ? /* @__PURE__ */ a(t, {
101
+ idPrefix: "vendor-summary-ach",
102
+ values: p.values,
103
+ errors: p.errors,
104
+ onChange: p.onChange,
105
+ labels: g.ach
106
+ }) : p ? /* @__PURE__ */ o(e, {
107
+ type: "button",
108
+ variant: "link",
109
+ className: "ttw:w-fit ttw:px-0",
110
+ onClick: p.onOpen,
111
+ children: [/* @__PURE__ */ a(u, { className: "ttw:size-4" }), g.addPaymentInstructions]
112
+ }) : /* @__PURE__ */ a("p", {
113
+ className: "ttw:text-sm ttw:text-muted-foreground",
114
+ children: r.methodLabel
115
+ })]
116
+ })]
86
117
  });
87
118
  }
88
119
  //#endregion
89
- export { c as VendorSummaryCard, c as default };
120
+ export { p as VendorSummaryCard, p as default };
@@ -12,7 +12,11 @@ function o(o) {
12
12
  ...d,
13
13
  summaryCard: {
14
14
  ...r.summaryCard,
15
- ...d?.summaryCard
15
+ ...d?.summaryCard,
16
+ ach: {
17
+ ...r.summaryCard.ach,
18
+ ...d?.summaryCard?.ach
19
+ }
16
20
  },
17
21
  search: {
18
22
  ...r.search,
@@ -33,6 +37,7 @@ function o(o) {
33
37
  summary: o.summary,
34
38
  onEdit: s,
35
39
  onClear: c,
40
+ paymentInstructions: f ? void 0 : o.paymentInstructions,
36
41
  labels: p.summaryCard
37
42
  }) : f ? /* @__PURE__ */ i(e, {
38
43
  variant: "body2",
@@ -20,7 +20,11 @@ function b({ open: b, onOpenChange: x, title: S, subtitle: C, notice: w, vendor:
20
20
  ...V?.vendorSection,
21
21
  summaryCard: {
22
22
  ...m.vendorSection.summaryCard,
23
- ...V?.vendorSection?.summaryCard
23
+ ...V?.vendorSection?.summaryCard,
24
+ ach: {
25
+ ...m.vendorSection.summaryCard.ach,
26
+ ...V?.vendorSection?.summaryCard?.ach
27
+ }
24
28
  },
25
29
  search: {
26
30
  ...m.vendorSection.search,
@@ -137,13 +141,13 @@ function b({ open: b, onOpenChange: x, title: S, subtitle: C, notice: w, vendor:
137
141
  variant: "secondary",
138
142
  onClick: R,
139
143
  loading: F,
140
- disabled: I || N,
144
+ disabled: I || N || T.mode === "creating",
141
145
  children: H.saveDraftButton
142
146
  }), /* @__PURE__ */ g(e, {
143
147
  type: "button",
144
148
  onClick: z,
145
149
  loading: I,
146
- disabled: F || N,
150
+ disabled: F || N || T.mode === "creating",
147
151
  children: H.finalizeButton
148
152
  })] })]
149
153
  })
@@ -10,7 +10,7 @@ import "../../../shared/data-access/dist/index.js";
10
10
  import { useQuery as a } from "@tanstack/react-query";
11
11
  //#region ../../libs/tesouro-embedded-components-react/counterparts-widget/data-access/dist/index2.js
12
12
  function o({ metric: n = "total_amount", type: o, statusIn: s, counterpartIdIn: c, enabled: l } = {}) {
13
- let { client: u, organizationId: d, widgetToken: f, authEpoch: p } = e(), m = c === void 0 || c.length > 0, h = !!(d && f) && m && (l === !0 || l === void 0), g = r({
13
+ let { client: u, organizationId: d, widgetToken: f, authEpoch: p } = e(), m = c == null || c.length > 0, h = !!(d && f) && m && (l === !0 || l === void 0), g = r({
14
14
  client: u,
15
15
  headers: t(d),
16
16
  query: {
@@ -28,7 +28,7 @@ function o({ metric: n = "total_amount", type: o, statusIn: s, counterpartIdIn:
28
28
  });
29
29
  }
30
30
  function s({ metric: r = "total_amount", statusIn: o, counterpartIdIn: s, enabled: c } = {}) {
31
- let { client: l, organizationId: u, widgetToken: d, authEpoch: f } = e(), p = s === void 0 || s.length > 0, m = !!(u && d) && p && (c === !0 || c === void 0), h = n({
31
+ let { client: l, organizationId: u, widgetToken: d, authEpoch: f } = e(), p = s == null || s.length > 0, m = !!(u && d) && p && (c === !0 || c === void 0), h = n({
32
32
  client: l,
33
33
  headers: t(u),
34
34
  query: {
@@ -79,7 +79,10 @@ function T({ counterpartType: T, detailsLabels: E, messageLabels: D }) {
79
79
  messages: M,
80
80
  counterpartType: T,
81
81
  counterpart: W.counterpart,
82
- primaryAddress: W.primaryAddress
82
+ primaryAddress: W.primaryAddress,
83
+ bankAccounts: W.bankAccounts,
84
+ isBankAccountsLoading: W.isBankAccountsLoading,
85
+ isBankAccountsError: W.isBankAccountsError
83
86
  }), ce = f({
84
87
  items: W.bankAccounts,
85
88
  selectedId: H,
@@ -5,10 +5,10 @@
5
5
  import { useAnalyticsTrack as e } from "../../../shared/feature/dist/lib/analytics/hooks.js";
6
6
  import { WidgetProvider as t } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
7
7
  import "../../../shared/feature/dist/index.js";
8
- import { CounterpartFormSheet as n } from "../../../shared/counterpart-management/ui/dist/index8.js";
9
- import { BankAccountFormSheet as r } from "../../../shared/counterpart-management/ui/dist/index10.js";
10
- import { AddressFormSheet as i } from "../../../shared/counterpart-management/ui/dist/index12.js";
11
- import { ConfirmDeleteDialog as a } from "../../../shared/counterpart-management/ui/dist/index13.js";
8
+ import { CounterpartFormSheet as n } from "../../../shared/counterpart-management/ui/dist/index9.js";
9
+ import { BankAccountFormSheet as r } from "../../../shared/counterpart-management/ui/dist/index11.js";
10
+ import { AddressFormSheet as i } from "../../../shared/counterpart-management/ui/dist/index13.js";
11
+ import { ConfirmDeleteDialog as a } from "../../../shared/counterpart-management/ui/dist/index14.js";
12
12
  import "../../../shared/counterpart-management/feature/dist/index.js";
13
13
  import { CounterpartsWidgetAnalyticsEvent as o, WIDGET_NAME as s } from "./index2.js";
14
14
  import { PAGE_SIZE_OPTIONS as c } from "./index3.js";
@@ -70,7 +70,7 @@ function g({ counterpartType: t, pageSizeOptions: s = c, showTitle: g, onViewAll
70
70
  errors: P.errors,
71
71
  stateOptions: E,
72
72
  inProgress: P.isSubmitting,
73
- submitDisabled: P.isSubmitDisabled,
73
+ submitDisabled: P.isSubmitting,
74
74
  onChange: (e) => P.setValues((t) => ({
75
75
  ...t,
76
76
  ...e
@@ -91,6 +91,9 @@ function g({ counterpartType: t, pageSizeOptions: s = c, showTitle: g, onViewAll
91
91
  })),
92
92
  onSubmit: P.submit,
93
93
  onCancel: P.close,
94
+ sections: { address: "collapsible" },
95
+ sectionsToExpand: P.sectionsToExpand,
96
+ onAddressExpand: P.expandAddress,
94
97
  labels: y
95
98
  }),
96
99
  /* @__PURE__ */ m(u, {
@@ -103,7 +106,7 @@ function g({ counterpartType: t, pageSizeOptions: s = c, showTitle: g, onViewAll
103
106
  counterpart: j,
104
107
  isLoading: A.isLoading,
105
108
  isError: A.isError,
106
- canEdit: M.canUpdate,
109
+ canEdit: M.canUpdate && !(t === "vendor" && (A.isBankAccountsLoading || A.isBankAccountsError)),
107
110
  canDelete: M.canDelete,
108
111
  onEdit: P.openEdit,
109
112
  onDelete: L.requestDeleteCounterpart,
@@ -123,7 +126,7 @@ function g({ counterpartType: t, pageSizeOptions: s = c, showTitle: g, onViewAll
123
126
  errors: P.errors,
124
127
  stateOptions: E,
125
128
  inProgress: P.isSubmitting,
126
- submitDisabled: P.isSubmitDisabled,
129
+ submitDisabled: P.isSubmitting,
127
130
  onChange: (e) => P.setValues((t) => ({
128
131
  ...t,
129
132
  ...e
@@ -144,6 +147,8 @@ function g({ counterpartType: t, pageSizeOptions: s = c, showTitle: g, onViewAll
144
147
  })),
145
148
  onSubmit: P.submit,
146
149
  onCancel: P.close,
150
+ sections: { address: "collapsible" },
151
+ sectionsToExpand: P.sectionsToExpand,
147
152
  labels: y
148
153
  } : void 0,
149
154
  labels: b
@@ -3,7 +3,7 @@ import { EmptyState as ee } from "../../../shared/ui/dist/lib/EmptyState/EmptySt
3
3
  import { ErrorState as te } from "../../../shared/ui/dist/lib/ErrorState/ErrorState.js";
4
4
  import "../../../shared/ui/dist/index.js";
5
5
  import { COUNTERPART_FORM_SHEET_LABELS_EN as m } from "../../../shared/counterpart-management/ui/dist/index2.js";
6
- import { CounterpartFormFields as h } from "../../../shared/counterpart-management/ui/dist/index8.js";
6
+ import { CounterpartFormFields as h } from "../../../shared/counterpart-management/ui/dist/index9.js";
7
7
  import "../../../shared/counterpart-management/ui/dist/index.js";
8
8
  import { COUNTERPART_DETAILS_SHEET_LABELS_EN as g } from "./index2.js";
9
9
  import { useEffect as ne, useState as re } from "react";
@@ -56,9 +56,9 @@ function b({ onEdit: r, onDelete: o, onAdd: b, screenLabels: x, formLabels: S, d
56
56
  }, [P, B]), K = f((e) => {
57
57
  L(e), z(void 0);
58
58
  }, []), q = f(() => {
59
- z(U?.next_pagination_token);
59
+ z(U?.next_pagination_token ?? void 0);
60
60
  }, [U?.next_pagination_token]), J = f(() => {
61
- z(U?.prev_pagination_token);
61
+ z(U?.prev_pagination_token ?? void 0);
62
62
  }, [U?.prev_pagination_token]);
63
63
  return /* @__PURE__ */ v(g, { children: [/* @__PURE__ */ _(c, {
64
64
  ...T,
@@ -38,7 +38,7 @@ function l({ activeTab: l, messages: d }) {
38
38
  h(e), _(void 0);
39
39
  }, []), F = i((e) => {
40
40
  C(e), _(void 0);
41
- }, []), I = i(() => _(D.data?.next_pagination_token), [D.data?.next_pagination_token]), L = i(() => _(D.data?.prev_pagination_token), [D.data?.prev_pagination_token]), R = i(() => {
41
+ }, []), I = i(() => _(D.data?.next_pagination_token ?? void 0), [D.data?.next_pagination_token]), L = i(() => _(D.data?.prev_pagination_token ?? void 0), [D.data?.prev_pagination_token]), R = i(() => {
42
42
  D.refetch();
43
43
  }, [D]);
44
44
  return {
@@ -5,7 +5,7 @@
5
5
  import { useAnalyticsTrack as e } from "../../../shared/feature/dist/lib/analytics/hooks.js";
6
6
  import { WidgetProvider as t } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
7
7
  import "../../../shared/feature/dist/index.js";
8
- import { CounterpartFormSheet as n } from "../../../shared/counterpart-management/ui/dist/index8.js";
8
+ import { CounterpartFormSheet as n } from "../../../shared/counterpart-management/ui/dist/index9.js";
9
9
  import { CounterpartSelector as r } from "../../../shared/counterpart-management/feature/dist/lib/CounterpartSelector.js";
10
10
  import "../../../shared/counterpart-management/feature/dist/index.js";
11
11
  import { ReceivablesWidgetAnalyticsEvent as i, WIDGET_NAME as a } from "./index2.js";
@@ -160,7 +160,7 @@ function v({ receivable: e, history: t, mails: n, pdfUrl: r, messages: i }) {
160
160
  currency: e.currency,
161
161
  fallback: i.notAvailable
162
162
  }),
163
- pdfUrl: r || e.file_url || e.original_file_url,
163
+ pdfUrl: r || e.file_url || e.original_file_url || void 0,
164
164
  summaryItems: [
165
165
  {
166
166
  label: i.summaryDocumentType,
@@ -22,7 +22,7 @@ function o({ selectedReceivableId: o, enabled: s = !0, messages: c }) {
22
22
  receivable: l.data,
23
23
  history: u.data?.data ?? [],
24
24
  mails: d.data?.data ?? [],
25
- pdfUrl: f.data?.file_url || f.data?.original_file_url,
25
+ pdfUrl: f.data?.file_url || f.data?.original_file_url || void 0,
26
26
  messages: c
27
27
  }), [
28
28
  l.data,
@@ -33,7 +33,7 @@ function o({ unitNamesById: o }) {
33
33
  c(t), f(void 0);
34
34
  }, [s]), D = n((e) => {
35
35
  u(e), f(void 0);
36
- }, []), O = n(() => f(C.data?.next_pagination_token), [C.data?.next_pagination_token]), k = n(() => f(C.data?.prev_pagination_token), [C.data?.prev_pagination_token]), A = n(() => {
36
+ }, []), O = n(() => f(C.data?.next_pagination_token ?? void 0), [C.data?.next_pagination_token]), k = n(() => f(C.data?.prev_pagination_token ?? void 0), [C.data?.prev_pagination_token]), A = n(() => {
37
37
  C.refetch();
38
38
  }, [C]), j = n((e) => (t) => {
39
39
  e(t), f(void 0);
@@ -1,21 +1,22 @@
1
1
  import "../../../util/dist/lib/apiErrors.js";
2
- import { COUNTERPART_MESSAGE_LABELS_EN as e } from "./lib/labels.js";
3
- import { CounterpartFormFields as t, CounterpartFormSheet as n } from "../../ui/dist/index8.js";
4
- import { BankAccountFormSheet as r } from "../../ui/dist/index10.js";
5
- import { AddressFormSheet as i } from "../../ui/dist/index12.js";
6
- import { ConfirmDeleteDialog as a } from "../../ui/dist/index13.js";
2
+ import { AchFieldGroup as e } from "../../ui/dist/index5.js";
3
+ import { CounterpartFormFields as t, CounterpartFormSheet as n, useFocusFirstInvalidField as r } from "../../ui/dist/index9.js";
4
+ import { BankAccountFormSheet as i } from "../../ui/dist/index11.js";
5
+ import { AddressFormSheet as a } from "../../ui/dist/index13.js";
6
+ import { ConfirmDeleteDialog as o } from "../../ui/dist/index14.js";
7
7
  import "../../ui/dist/index.js";
8
- import { buildAnalyticsMap as o, buildCounterpartRows as s, formatCounterpartDate as c, formatMoney as l, getCounterpartEmail as u, getCounterpartName as d, hasSelectedText as f } from "./lib/helpers.js";
9
- import { useCounterpartsQuery as p } from "../../data-access/dist/index3.js";
10
- import "../../data-access/dist/index5.js";
11
- import { useCounterpartAddressesForRowsQuery as m, useCounterpartAddressesQuery as h } from "../../data-access/dist/index7.js";
8
+ import { COUNTERPART_MESSAGE_LABELS_EN as s } from "./lib/labels.js";
9
+ import { buildAnalyticsMap as c, buildCounterpartRows as l, counterpartFormBankAccountToCreatePayload as u, counterpartFormBankAccountToUpdatePayload as d, formatCounterpartDate as f, formatMoney as p, getAchInstructions as m, getCounterpartEmail as h, getCounterpartName as g, getPayableAchInstructions as _, hasAchFormValues as v, hasSelectedText as y, resolveCounterpartBankAccountWrite as b, validateAchFormValues as x } from "./lib/helpers.js";
10
+ import { useCounterpartsQuery as S } from "../../data-access/dist/index3.js";
11
+ import { useCreateCounterpartBankAccountMutation as C, useUpdateCounterpartBankAccountMutation as w } from "../../data-access/dist/index5.js";
12
+ import { useCounterpartAddressesForRowsQuery as T, useCounterpartAddressesQuery as E } from "../../data-access/dist/index7.js";
12
13
  import "../../data-access/dist/index.js";
13
- import { useAddressForm as g } from "./lib/useAddressForm.js";
14
- import { useCounterpartDetails as _ } from "./lib/useCounterpartDetails.js";
15
- import { useCounterpartForm as v } from "./lib/useCounterpartForm.js";
14
+ import { useAddressForm as D } from "./lib/useAddressForm.js";
15
+ import { useCounterpartDetails as O } from "./lib/useCounterpartDetails.js";
16
+ import { useCounterpartForm as k } from "./lib/useCounterpartForm.js";
16
17
  import "./lib/useCounterpartSelector.js";
17
- import { CounterpartSelector as y } from "./lib/CounterpartSelector.js";
18
- import { useDeleteController as b } from "./lib/useDeleteController.js";
18
+ import { CounterpartSelector as A } from "./lib/CounterpartSelector.js";
19
+ import { useDeleteController as j } from "./lib/useDeleteController.js";
19
20
  import "./lib/useSubEntityForm.js";
20
- import { useBankAccountForm as x } from "./lib/subEntityForms.js";
21
- export { i as AddressFormSheet, r as BankAccountFormSheet, e as COUNTERPART_MESSAGE_LABELS_EN, a as ConfirmDeleteDialog, t as CounterpartFormFields, n as CounterpartFormSheet, y as CounterpartSelector, o as buildAnalyticsMap, s as buildCounterpartRows, c as formatCounterpartDate, l as formatMoney, u as getCounterpartEmail, d as getCounterpartName, f as hasSelectedText, g as useAddressForm, x as useBankAccountForm, m as useCounterpartAddressesForRowsQuery, h as useCounterpartAddressesQuery, _ as useCounterpartDetails, v as useCounterpartForm, p as useCounterpartsQuery, b as useDeleteController };
21
+ import { useBankAccountForm as M } from "./lib/subEntityForms.js";
22
+ export { e as AchFieldGroup, a as AddressFormSheet, i as BankAccountFormSheet, s as COUNTERPART_MESSAGE_LABELS_EN, o as ConfirmDeleteDialog, t as CounterpartFormFields, n as CounterpartFormSheet, A as CounterpartSelector, c as buildAnalyticsMap, l as buildCounterpartRows, u as counterpartFormBankAccountToCreatePayload, d as counterpartFormBankAccountToUpdatePayload, f as formatCounterpartDate, p as formatMoney, m as getAchInstructions, h as getCounterpartEmail, g as getCounterpartName, _ as getPayableAchInstructions, v as hasAchFormValues, y as hasSelectedText, b as resolveCounterpartBankAccountWrite, D as useAddressForm, M as useBankAccountForm, T as useCounterpartAddressesForRowsQuery, E as useCounterpartAddressesQuery, O as useCounterpartDetails, k as useCounterpartForm, S as useCounterpartsQuery, C as useCreateCounterpartBankAccountMutation, j as useDeleteController, r as useFocusFirstInvalidField, w as useUpdateCounterpartBankAccountMutation, x as validateAchFormValues };