@tesouro/embedded-components-react 0.5.56 → 0.5.59

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 (27) hide show
  1. package/README.md +9 -9
  2. package/dist/index.d.ts +5 -3
  3. package/dist/lib/CounterpartsWidget.d.ts +5 -3
  4. package/dist/lib/ReceivablesWidget.d.ts +3 -2
  5. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index18.js +39 -45
  6. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index4.js +9 -15
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +53 -53
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +42 -65
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +288 -226
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +104 -101
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +313 -285
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index26.js +12 -4
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index27.js +2 -0
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index28.js +41 -31
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index31.js +8 -1
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index46.js +9 -0
  17. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/index8.js +1 -1
  18. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index5.js +54 -60
  19. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/helpers.js +1 -1
  20. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/labels.js +2 -2
  21. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useDeleteController.js +4 -4
  22. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index11.js +121 -115
  23. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index2.js +2 -1
  24. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index6.js +1 -0
  25. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  26. package/dist/libs/tesouro-embedded-components-react/shared/util/dist/lib/parseCalendarDate.js +17 -0
  27. package/package.json +1 -1
@@ -12,14 +12,22 @@ function i({ paymentInstructions: i, labels: a }) {
12
12
  errors: i.errors,
13
13
  onChange: i.onChange,
14
14
  labels: a.ach
15
- }), /* @__PURE__ */ n("div", {
16
- className: "ttw:flex ttw:justify-end",
17
- children: /* @__PURE__ */ n(e, {
15
+ }), /* @__PURE__ */ r("div", {
16
+ className: "ttw:flex ttw:justify-end ttw:gap-2",
17
+ children: [/* @__PURE__ */ n(e, {
18
18
  type: "button",
19
19
  variant: "outline",
20
20
  onClick: i.onCancel,
21
+ disabled: i.isSaving,
21
22
  children: a.cancelAction
22
- })
23
+ }), i.onSave ? /* @__PURE__ */ n(e, {
24
+ type: "button",
25
+ onClick: i.onSave,
26
+ "aria-label": a.saveAriaLabel,
27
+ loading: i.isSaving,
28
+ disabled: i.isSaving,
29
+ children: a.saveAction
30
+ }) : null]
23
31
  })]
24
32
  });
25
33
  }
@@ -11,6 +11,8 @@ var t = {
11
11
  paymentInstructionsDescription: "How and where will the money be sent. This information is required to send a payment.",
12
12
  addPaymentInstructions: "Add payment instructions",
13
13
  cancelAction: "Cancel",
14
+ saveAction: "Save",
15
+ saveAriaLabel: "Save payment instructions",
14
16
  ach: e
15
17
  };
16
18
  //#endregion
@@ -5,8 +5,8 @@ import { useMemo as r } from "react";
5
5
  import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
6
  import { ChevronRightIcon as o, Plus as s } from "lucide-react";
7
7
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index28.js
8
- var c = "ttw:flex ttw:items-start ttw:gap-4 ttw:py-2.5", l = "ttw:text-sm ttw:font-medium ttw:text-muted-foreground", u = `ttw:w-[140px] ttw:shrink-0 ${l}`, d = "ttw:-mx-2 ttw:-my-1 ttw:flex ttw:flex-1 ttw:items-center ttw:justify-between ttw:gap-3 ttw:rounded-md ttw:px-2 ttw:py-1 ttw:text-left ttw:hover:bg-muted";
9
- function f({ summary: f, onEdit: p, paymentInstructions: m, testId: h, labels: g }) {
8
+ var c = "ttw:flex ttw:items-start ttw:gap-4 ttw:py-2.5", l = "ttw:w-[140px] ttw:shrink-0 ttw:text-sm ttw:font-medium ttw:text-muted-foreground", u = "ttw:-mx-2 ttw:-my-1 ttw:flex ttw:flex-1 ttw:items-center ttw:justify-between ttw:gap-3 ttw:rounded-md ttw:px-2 ttw:py-1 ttw:text-left ttw:hover:bg-muted";
9
+ function d({ summary: d, onEdit: f, paymentInstructions: p, showPaymentInstructions: m = !0, testId: h, labels: g }) {
10
10
  let _ = r(() => ({
11
11
  ...t,
12
12
  ...g,
@@ -18,34 +18,41 @@ function f({ summary: f, onEdit: p, paymentInstructions: m, testId: h, labels: g
18
18
  ...g?.ach?.fieldMarkers
19
19
  }
20
20
  }
21
- }), [g]), v = !!m?.isOpen, y = !!m?.canEditExisting && f.hasPaymentInstructions, b = /* @__PURE__ */ a("div", {
21
+ }), [g]), v = !!p?.isOpen, y = !!p?.canEditExisting && d.hasPaymentInstructions, b = /* @__PURE__ */ a("div", {
22
22
  className: "ttw:flex ttw:flex-col ttw:gap-0.5",
23
- children: [/* @__PURE__ */ i("span", {
24
- className: "ttw:text-sm ttw:font-medium ttw:text-foreground",
25
- children: f.name
26
- }), /* @__PURE__ */ i("span", {
27
- className: "ttw:text-sm ttw:text-muted-foreground",
28
- children: f.email
29
- })]
23
+ children: [
24
+ /* @__PURE__ */ i("span", {
25
+ className: "ttw:text-sm ttw:font-medium ttw:text-foreground",
26
+ children: d.name
27
+ }),
28
+ /* @__PURE__ */ i("span", {
29
+ className: "ttw:text-sm ttw:text-muted-foreground",
30
+ children: d.email
31
+ }),
32
+ d.description ? /* @__PURE__ */ i("span", {
33
+ className: "ttw:text-sm ttw:text-muted-foreground",
34
+ children: d.description
35
+ }) : null
36
+ ]
30
37
  }), x;
31
- return x = m && v ? /* @__PURE__ */ i(n, {
32
- paymentInstructions: m,
38
+ return x = p && v ? /* @__PURE__ */ i(n, {
39
+ paymentInstructions: p,
33
40
  labels: _
34
- }) : f.hasPaymentInstructions ? y ? /* @__PURE__ */ a("button", {
41
+ }) : d.hasPaymentInstructions ? y ? /* @__PURE__ */ a("button", {
35
42
  type: "button",
36
43
  "aria-label": _.editPaymentInstructionsAction,
37
- onClick: m?.onOpen,
38
- className: d,
44
+ onClick: p?.onOpen,
45
+ className: u,
39
46
  children: [/* @__PURE__ */ i("span", {
40
47
  className: "ttw:text-sm ttw:font-medium ttw:text-foreground",
41
- children: f.methodLabel
48
+ children: d.methodLabel
42
49
  }), /* @__PURE__ */ i(o, {
43
50
  "aria-hidden": "true",
44
51
  className: "ttw:size-4 ttw:shrink-0 ttw:text-muted-foreground"
45
52
  })]
46
53
  }) : /* @__PURE__ */ i("p", {
47
54
  className: "ttw:text-sm ttw:font-medium ttw:text-foreground",
48
- children: f.methodLabel
55
+ children: d.methodLabel
49
56
  }) : /* @__PURE__ */ a("div", {
50
57
  className: "ttw:flex ttw:flex-col ttw:gap-3",
51
58
  children: [/* @__PURE__ */ a("div", {
@@ -57,15 +64,15 @@ function f({ summary: f, onEdit: p, paymentInstructions: m, testId: h, labels: g
57
64
  className: "ttw:text-sm ttw:text-muted-foreground",
58
65
  children: _.paymentInstructionsDescription
59
66
  })]
60
- }), m ? /* @__PURE__ */ a(e, {
67
+ }), p ? /* @__PURE__ */ a(e, {
61
68
  type: "button",
62
69
  variant: "link",
63
70
  className: "ttw:w-fit ttw:px-0",
64
- onClick: m.onOpen,
71
+ onClick: p.onOpen,
65
72
  children: [/* @__PURE__ */ i(s, { className: "ttw:size-4" }), _.addPaymentInstructions]
66
73
  }) : /* @__PURE__ */ i("p", {
67
74
  className: "ttw:text-sm ttw:text-muted-foreground",
68
- children: f.methodLabel
75
+ children: d.methodLabel
69
76
  })]
70
77
  }), /* @__PURE__ */ a("div", {
71
78
  "data-testid": h,
@@ -77,13 +84,13 @@ function f({ summary: f, onEdit: p, paymentInstructions: m, testId: h, labels: g
77
84
  children: [/* @__PURE__ */ a("div", {
78
85
  className: c,
79
86
  children: [/* @__PURE__ */ i("span", {
80
- className: u,
87
+ className: l,
81
88
  children: _.vendorLabel
82
- }), p && !v ? /* @__PURE__ */ a("button", {
89
+ }), f && !v ? /* @__PURE__ */ a("button", {
83
90
  type: "button",
84
91
  "aria-label": _.editAction,
85
- onClick: p,
86
- className: d,
92
+ onClick: f,
93
+ className: u,
87
94
  children: [b, /* @__PURE__ */ i(o, {
88
95
  "aria-hidden": "true",
89
96
  className: "ttw:size-4 ttw:shrink-0 ttw:text-muted-foreground"
@@ -92,24 +99,27 @@ function f({ summary: f, onEdit: p, paymentInstructions: m, testId: h, labels: g
92
99
  className: "ttw:flex ttw:flex-1",
93
100
  children: b
94
101
  })]
95
- }), v ? /* @__PURE__ */ a("div", {
96
- className: "ttw:flex ttw:flex-col ttw:gap-3 ttw:py-2.5",
102
+ }), m && v ? /* @__PURE__ */ a("div", {
103
+ className: c,
97
104
  children: [/* @__PURE__ */ i("span", {
98
105
  className: l,
99
106
  children: _.achBankAccountLabel
100
- }), x]
101
- }) : /* @__PURE__ */ a("div", {
107
+ }), /* @__PURE__ */ i("div", {
108
+ className: "ttw:flex-1",
109
+ children: x
110
+ })]
111
+ }) : m ? /* @__PURE__ */ a("div", {
102
112
  className: c,
103
113
  children: [/* @__PURE__ */ i("span", {
104
- className: u,
114
+ className: l,
105
115
  children: _.achBankAccountLabel
106
116
  }), /* @__PURE__ */ i("div", {
107
117
  className: "ttw:flex ttw:flex-1",
108
118
  children: x
109
119
  })]
110
- })]
120
+ }) : null]
111
121
  })]
112
122
  });
113
123
  }
114
124
  //#endregion
115
- export { f as VendorSummaryCard, f as default };
125
+ export { d as VendorSummaryCard, d as default };
@@ -152,7 +152,14 @@ function E({ view: E, actions: D = g, scheduledSummary: O, scheduledStatusLabel:
152
152
  ]
153
153
  }),
154
154
  H?.isOpen && !N ? /* @__PURE__ */ v(n, { labels: z.requiredFieldsLegend }) : null,
155
- M?.editForm ?? /* @__PURE__ */ v(p, {
155
+ M?.editForm ? /* @__PURE__ */ y("div", {
156
+ className: "ttw:flex ttw:flex-col ttw:gap-3",
157
+ children: [M.editForm, /* @__PURE__ */ v(p, {
158
+ summary: E.payTo,
159
+ paymentInstructions: H,
160
+ labels: B
161
+ })]
162
+ }) : /* @__PURE__ */ v(p, {
156
163
  summary: E.payTo,
157
164
  onEdit: M?.onEdit,
158
165
  paymentInstructions: H,
@@ -23,6 +23,7 @@ function o(o) {
23
23
  summary: o.summary,
24
24
  onEdit: s,
25
25
  paymentInstructions: d ? void 0 : o.paymentInstructions,
26
+ showPaymentInstructions: o.showPaymentInstructions,
26
27
  labels: f.summaryCard
27
28
  }) : d ? /* @__PURE__ */ i(e, {
28
29
  variant: "body2",
@@ -31,6 +32,14 @@ function o(o) {
31
32
  }) : o.mode === "selecting" ? /* @__PURE__ */ i(n, {
32
33
  ...o.search,
33
34
  labels: f.search
35
+ }) : o.summary ? /* @__PURE__ */ a("div", {
36
+ className: "ttw:flex ttw:flex-col ttw:gap-3",
37
+ children: [o.newVendorForm, /* @__PURE__ */ i(t, {
38
+ summary: o.summary,
39
+ paymentInstructions: o.paymentInstructions,
40
+ showPaymentInstructions: o.showPaymentInstructions,
41
+ labels: f.summaryCard
42
+ })]
34
43
  }) : o.newVendorForm,
35
44
  c ? /* @__PURE__ */ i("p", {
36
45
  className: "ttw:text-sm ttw:text-destructive",
@@ -118,7 +118,7 @@ function g({ counterpartType: t, pageSizeOptions: s = c, onViewAllDocuments: g,
118
118
  onDeleteBankAccount: (e) => I.requestDelete({
119
119
  kind: "bankAccount",
120
120
  id: e,
121
- name: k.bankItems.find((t) => t.id === e)?.primary ?? ""
121
+ label: k.bankItems.find((t) => t.id === e)?.primary ?? ""
122
122
  }),
123
123
  editForm: D === "edit" ? {
124
124
  values: N.values,
@@ -1,6 +1,7 @@
1
1
  import { minorExponentForCurrency as e } from "../../../shared/util/dist/lib/amountOutputToMajorUnits.js";
2
+ import { parseDateOrTimestamp as t } from "../../../shared/util/dist/lib/parseCalendarDate.js";
2
3
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index5.js
3
- var t = /^(\d{4})-(\d{2})-(\d{2})$/, n = {
4
+ var n = {
4
5
  to: "",
5
6
  cc: "",
6
7
  bcc: "",
@@ -51,43 +52,36 @@ function c(e) {
51
52
  function l({ defaultTab: e, enabledTabs: t }) {
52
53
  return e && t.includes(e) ? e : t[0] ?? "invoices";
53
54
  }
54
- function u(e, t) {
55
- if (!e) return t;
56
- let n = d(e);
57
- return Number.isNaN(n.getTime()) ? t : new Intl.DateTimeFormat(void 0, {
55
+ function u(e, n) {
56
+ let r = t(e);
57
+ return r ? new Intl.DateTimeFormat(void 0, {
58
58
  day: "numeric",
59
59
  month: "short",
60
60
  year: "numeric"
61
- }).format(n);
61
+ }).format(r) : n;
62
62
  }
63
- function d(e) {
64
- let n = t.exec(e);
65
- if (!n) return new Date(e);
66
- let r = Number(n[1]), i = Number(n[2]) - 1, a = Number(n[3]), o = new Date(r, i, a);
67
- return o.getFullYear() !== r || o.getMonth() !== i || o.getDate() !== a ? /* @__PURE__ */ new Date(NaN) : o;
68
- }
69
- function f({ amount: t, currency: n, fallback: r }) {
63
+ function d({ amount: t, currency: n, fallback: r }) {
70
64
  return t == null || !n ? r : new Intl.NumberFormat(void 0, {
71
65
  currency: n,
72
66
  style: "currency"
73
67
  }).format(t / 10 ** e(n));
74
68
  }
75
- function p(t, n) {
69
+ function f(t, n) {
76
70
  let r = Number(t);
77
71
  if (!Number.isFinite(r)) return;
78
72
  let i = n ? e(n) : 2;
79
73
  return Math.round(r * 10 ** i);
80
74
  }
81
- function m(e, t) {
75
+ function p(e, t) {
82
76
  return e.document_id || t.untitledDocument;
83
77
  }
84
- function h(e, t) {
78
+ function m(e, t) {
85
79
  return e === "quote" ? t.quoteType : e === "credit_note" ? t.creditNoteType : t.invoiceType;
86
80
  }
87
- function g(e) {
81
+ function h(e) {
88
82
  return e === "paid" || e === "accepted" || e === "issued" || e === "recurring" ? "success" : e === "draft" || e === "issuing" ? "neutral" : e === "overdue" || e === "partially_paid" ? "warning" : e === "failed" || e === "declined" || e === "expired" || e === "uncollectible" || e === "canceled" || e === "deleted" ? "danger" : "info";
89
83
  }
90
- function _(e) {
84
+ function g(e) {
91
85
  let t = e.status === "draft", n = e.status === "issued", r = e.type === "invoice", i = e.type === "quote", a = e.type === "credit_note", o = r && [
92
86
  "issued",
93
87
  "overdue",
@@ -117,48 +111,48 @@ function _(e) {
117
111
  ].includes(e.status) && !a
118
112
  };
119
113
  }
120
- function v({ receivables: e, messages: t }) {
114
+ function _({ receivables: e, messages: t }) {
121
115
  return e.map((e) => {
122
116
  let n = e.type === "invoice" ? e.amount_due : void 0;
123
117
  return {
124
118
  id: e.id,
125
119
  type: e.type,
126
- documentLabel: m(e, t),
120
+ documentLabel: p(e, t),
127
121
  customerLabel: e.counterpart_name || t.unknownCustomer,
128
122
  status: e.status,
129
- statusTone: g(e.status),
123
+ statusTone: h(e.status),
130
124
  issueDateLabel: u(e.issue_date, t.notAvailable),
131
125
  dueDateLabel: u(e.type === "quote" ? e.expiry_date : e.due_date, t.notAvailable),
132
- totalLabel: f({
126
+ totalLabel: d({
133
127
  amount: e.total_amount,
134
128
  currency: e.currency,
135
129
  fallback: t.notAvailable
136
130
  }),
137
- amountDueLabel: f({
131
+ amountDueLabel: d({
138
132
  amount: n,
139
133
  currency: e.currency,
140
134
  fallback: t.notAvailable
141
135
  }),
142
- actions: _(e)
136
+ actions: g(e)
143
137
  };
144
138
  });
145
139
  }
146
- function y({ receivable: e, history: t, mails: n, pdfUrl: r, messages: i }) {
140
+ function v({ receivable: e, history: t, mails: n, pdfUrl: r, messages: i }) {
147
141
  if (!e) return;
148
142
  let a = e.type === "invoice" ? e.amount_due : void 0, o = e.type === "quote" ? e.expiry_date : e.due_date;
149
143
  return {
150
144
  id: e.id,
151
145
  type: e.type,
152
- title: m(e, i),
146
+ title: p(e, i),
153
147
  customerLabel: e.counterpart_name || i.unknownCustomer,
154
148
  status: e.status,
155
- statusTone: g(e.status),
156
- totalLabel: f({
149
+ statusTone: h(e.status),
150
+ totalLabel: d({
157
151
  amount: e.total_amount,
158
152
  currency: e.currency,
159
153
  fallback: i.notAvailable
160
154
  }),
161
- amountDueLabel: f({
155
+ amountDueLabel: d({
162
156
  amount: a,
163
157
  currency: e.currency,
164
158
  fallback: i.notAvailable
@@ -167,11 +161,11 @@ function y({ receivable: e, history: t, mails: n, pdfUrl: r, messages: i }) {
167
161
  summaryItems: [
168
162
  {
169
163
  label: i.summaryDocumentType,
170
- value: h(e.type, i)
164
+ value: m(e.type, i)
171
165
  },
172
166
  {
173
167
  label: i.summaryDocumentNumber,
174
- value: m(e, i)
168
+ value: p(e, i)
175
169
  },
176
170
  {
177
171
  label: i.summaryCustomer,
@@ -195,7 +189,7 @@ function y({ receivable: e, history: t, mails: n, pdfUrl: r, messages: i }) {
195
189
  },
196
190
  {
197
191
  label: i.summaryTotal,
198
- value: f({
192
+ value: d({
199
193
  amount: e.total_amount,
200
194
  currency: e.currency,
201
195
  fallback: i.notAvailable
@@ -203,7 +197,7 @@ function y({ receivable: e, history: t, mails: n, pdfUrl: r, messages: i }) {
203
197
  },
204
198
  {
205
199
  label: i.summaryAmountDue,
206
- value: f({
200
+ value: d({
207
201
  amount: a,
208
202
  currency: e.currency,
209
203
  fallback: i.notAvailable
@@ -214,12 +208,12 @@ function y({ receivable: e, history: t, mails: n, pdfUrl: r, messages: i }) {
214
208
  id: t.product.id || String(n),
215
209
  name: t.product.name,
216
210
  quantityLabel: String(t.quantity),
217
- unitPriceLabel: f({
211
+ unitPriceLabel: d({
218
212
  amount: t.product.price?.value,
219
213
  currency: t.product.price?.currency || e.currency,
220
214
  fallback: i.notAvailable
221
215
  }),
222
- totalLabel: f({
216
+ totalLabel: d({
223
217
  amount: t.total_after_tax ?? t.total_before_tax,
224
218
  currency: e.currency,
225
219
  fallback: i.notAvailable
@@ -227,23 +221,23 @@ function y({ receivable: e, history: t, mails: n, pdfUrl: r, messages: i }) {
227
221
  })),
228
222
  activityItems: t.map((e) => ({
229
223
  id: e.id,
230
- title: b(e.event_type, i),
224
+ title: y(e.event_type, i),
231
225
  description: e.event_type,
232
226
  timestampLabel: u(e.timestamp, i.notAvailable)
233
227
  })),
234
228
  mailItems: n.map((e) => ({
235
229
  id: e.id,
236
230
  statusLabel: e.status,
237
- recipientsLabel: x(e, i),
231
+ recipientsLabel: b(e, i),
238
232
  sentAtLabel: u(e.created_at, i.notAvailable)
239
233
  })),
240
- actions: _(e)
234
+ actions: g(e)
241
235
  };
242
236
  }
243
- function b(e, t) {
237
+ function y(e, t) {
244
238
  return e === "status_changed" ? t.activityStatusChanged : e === "receivable_created" ? t.activityReceivableCreated : e === "receivable_updated" ? t.activityReceivableUpdated : e === "payment_received" ? t.activityPaymentReceived : e === "mail_sent" ? t.activityMailSent : t.activityUnknown;
245
239
  }
246
- function x(e, t) {
240
+ function b(e, t) {
247
241
  let n = [
248
242
  ...e.recipients?.to ?? [],
249
243
  ...e.recipients?.cc ?? [],
@@ -251,7 +245,7 @@ function x(e, t) {
251
245
  ].map((e) => e.email).filter(Boolean);
252
246
  return n.length > 0 ? n.join(", ") : t.recipientsNone;
253
247
  }
254
- function S({ values: e, billingAddressId: t, messages: n }) {
248
+ function x({ values: e, billingAddressId: t, messages: n }) {
255
249
  let r = {};
256
250
  e.customerId ? t || (r.customerId = n.customerAddressRequired) : r.customerId = n.customerRequired, e.currency || (r.currency = n.currencyRequired);
257
251
  for (let t of e.lineItems) {
@@ -263,10 +257,10 @@ function S({ values: e, billingAddressId: t, messages: n }) {
263
257
  }
264
258
  return r;
265
259
  }
266
- function C(e) {
260
+ function S(e) {
267
261
  return Object.keys(e).length > 0;
268
262
  }
269
- function w({ values: e, billingAddressId: t }) {
263
+ function C({ values: e, billingAddressId: t }) {
270
264
  let n = e.lineItems.map((e) => ({
271
265
  product_id: e.productId,
272
266
  quantity: Number(e.quantity)
@@ -288,7 +282,7 @@ function w({ values: e, billingAddressId: t }) {
288
282
  type: "invoice"
289
283
  };
290
284
  }
291
- function T(e) {
285
+ function w(e) {
292
286
  let t = e.type === "quote" ? "quote" : "invoice", n = e.type === "invoice" ? e.payment_terms?.id ?? "" : "", r = e.line_items.map((e) => ({
293
287
  id: i().id,
294
288
  productId: e.product.id || "",
@@ -299,14 +293,14 @@ function T(e) {
299
293
  type: t,
300
294
  customerId: e.counterpart_id,
301
295
  currency: e.currency,
302
- issueDate: O(e.issue_date),
303
- dueDate: O(e.type === "quote" ? e.expiry_date : e.due_date),
296
+ issueDate: D(e.issue_date),
297
+ dueDate: D(e.type === "quote" ? e.expiry_date : e.due_date),
304
298
  memo: e.memo ?? "",
305
299
  paymentTermsId: n,
306
300
  lineItems: r.length > 0 ? r : [i()]
307
301
  };
308
302
  }
309
- function E({ values: e, billingAddressId: t }) {
303
+ function T({ values: e, billingAddressId: t }) {
310
304
  let n = {
311
305
  counterpart_billing_address_id: t,
312
306
  counterpart_id: e.customerId,
@@ -325,43 +319,43 @@ function E({ values: e, billingAddressId: t }) {
325
319
  payment_terms: !e.paymentTermsId && e.dueDate ? { term_final: { end_date: e.dueDate } } : void 0
326
320
  } };
327
321
  }
328
- function D(e) {
322
+ function E(e) {
329
323
  return { data: e.lineItems.map((e) => ({
330
324
  product_id: e.productId,
331
325
  quantity: Number(e.quantity)
332
326
  })) };
333
327
  }
334
- function O(e) {
328
+ function D(e) {
335
329
  return e?.slice(0, 10) ?? "";
336
330
  }
337
- function k(e) {
331
+ function O(e) {
338
332
  return (e ?? []).map((e) => ({
339
333
  value: e.id,
340
334
  label: e.name
341
335
  }));
342
336
  }
343
- function A(e, t) {
337
+ function k(e, t) {
344
338
  let n = {};
345
339
  return e.to.trim() || (n.to = t.sendToRequired), e.subject.trim() || (n.subject = t.sendSubjectRequired), e.body.trim() || (n.body = t.sendBodyRequired), n;
346
340
  }
347
- function j(e) {
341
+ function A(e) {
348
342
  return Object.keys(e).length > 0;
349
343
  }
350
- function M(e) {
344
+ function j(e) {
351
345
  return e.split(",").map((e) => e.trim()).filter(Boolean);
352
346
  }
353
- function N(e, t, n) {
347
+ function M(e, t, n) {
354
348
  let r = {};
355
349
  if (e.mode === "partial") {
356
- let i = p(e.amountPaid, n);
350
+ let i = f(e.amountPaid, n);
357
351
  (!i || i <= 0) && (r.amountPaid = t.paymentAmountInvalid);
358
352
  }
359
353
  return r;
360
354
  }
361
- function P(e) {
355
+ function N(e) {
362
356
  return Object.keys(e).length > 0;
363
357
  }
364
- function F(e, t) {
358
+ function P(e, t) {
365
359
  return {
366
360
  ...n,
367
361
  to: e?.counterpart_contact?.email ?? "",
@@ -369,13 +363,13 @@ function F(e, t) {
369
363
  body: t.sendBodyDefault
370
364
  };
371
365
  }
372
- function I() {
366
+ function F() {
373
367
  return {
374
368
  ...r,
375
369
  paidAt: (/* @__PURE__ */ new Date()).toISOString().slice(0, 10)
376
370
  };
377
371
  }
378
- function L() {
372
+ function I() {
379
373
  return [
380
374
  "draft",
381
375
  "issued",
@@ -395,4 +389,4 @@ function L() {
395
389
  }));
396
390
  }
397
391
  //#endregion
398
- export { r as EMPTY_RECEIVABLE_PAYMENT_VALUES, n as EMPTY_RECEIVABLE_SEND_VALUES, _ as buildReceivableActions, y as buildReceivableDetailsView, v as buildReceivableRows, c as coerceEnabledTabs, a as createEmptyReceivableFormValues, i as createLineItem, I as defaultPaymentValues, F as defaultSendValues, u as formatDate, f as formatMoney, p as fromMajorUnits, m as getDocumentTitle, h as getDocumentTypeLabel, k as getPaymentTermOptions, g as getStatusTone, P as hasPaymentErrors, C as hasReceivableFormErrors, j as hasSendErrors, w as receivableFormValuesToCreatePayload, D as receivableFormValuesToLineItemsPayload, E as receivableFormValuesToUpdatePayload, T as receivableToFormValues, l as resolveInitialTab, M as splitEmailList, L as statusFilterOptions, s as tabForType, o as typeForTab, N as validatePaymentValues, S as validateReceivableForm, A as validateSendValues };
392
+ export { r as EMPTY_RECEIVABLE_PAYMENT_VALUES, n as EMPTY_RECEIVABLE_SEND_VALUES, g as buildReceivableActions, v as buildReceivableDetailsView, _ as buildReceivableRows, c as coerceEnabledTabs, a as createEmptyReceivableFormValues, i as createLineItem, F as defaultPaymentValues, P as defaultSendValues, u as formatDate, d as formatMoney, f as fromMajorUnits, p as getDocumentTitle, m as getDocumentTypeLabel, O as getPaymentTermOptions, h as getStatusTone, N as hasPaymentErrors, S as hasReceivableFormErrors, A as hasSendErrors, C as receivableFormValuesToCreatePayload, E as receivableFormValuesToLineItemsPayload, T as receivableFormValuesToUpdatePayload, w as receivableToFormValues, l as resolveInitialTab, j as splitEmailList, I as statusFilterOptions, s as tabForType, o as typeForTab, M as validatePaymentValues, x as validateReceivableForm, k as validateSendValues };
@@ -413,7 +413,7 @@ function Z(e) {
413
413
  }
414
414
  function Q(e, t = r) {
415
415
  let n = {};
416
- return e.name.trim().length === 0 && (n.name = t.bankAccountNameRequired), e.accountNumber.trim().length === 0 && e.iban.trim().length === 0 && (n.accountNumber = t.bankAccountIdentifierRequired), e.currency.trim().length === 0 && (n.currency = t.bankAccountCurrencyRequired), n;
416
+ return e.accountNumber.trim().length === 0 && e.iban.trim().length === 0 && (n.accountNumber = t.bankAccountIdentifierRequired), e.currency.trim().length === 0 && (n.currency = t.bankAccountCurrencyRequired), n;
417
417
  }
418
418
  function $(e) {
419
419
  return q(e);
@@ -9,7 +9,6 @@ var e = {
9
9
  cityRequired: "City is required",
10
10
  stateRequired: "State is required",
11
11
  postalCodeRequired: "ZIP code is required",
12
- bankAccountNameRequired: "Account name is required",
13
12
  bankAccountIdentifierRequired: "Enter an account number or IBAN for this bank account",
14
13
  bankAccountCurrencyRequired: "Currency is required",
15
14
  accountHolderNameRequired: "Account holder name is required",
@@ -18,8 +17,9 @@ var e = {
18
17
  vatIdValueRequired: "VAT ID is required",
19
18
  genericError: "Something went wrong. Please try again.",
20
19
  deleteTitle: "Delete “{name}”?",
20
+ deleteBankAccountTitle: "Delete bank account “{account}”?",
21
21
  deleteCounterpartMessage: "This counterpart and its contacts, bank accounts, and VAT IDs will be permanently removed. You can't undo this action.",
22
- deleteSubEntityMessage: "This will be permanently removed. You can't undo this action."
22
+ deleteBankAccountMessage: "This removes these payment instructions from the vendor. The vendor will not be deleted. You can't undo this action."
23
23
  };
24
24
  //#endregion
25
25
  export { e as COUNTERPART_MESSAGE_LABELS_EN };
@@ -15,14 +15,14 @@ function i({ selectedId: i, setSelectedId: a, detailsView: o, messages: s }) {
15
15
  !i || !o || d({
16
16
  kind: "counterpart",
17
17
  id: i,
18
- name: o.name
18
+ label: o.name
19
19
  });
20
20
  }, [i, o]),
21
21
  requestDeleteCounterpartById: n(({ id: e, name: t }) => {
22
22
  d({
23
23
  kind: "counterpart",
24
24
  id: e,
25
- name: t
25
+ label: t
26
26
  });
27
27
  }, []),
28
28
  requestDelete: n((e) => d(e), []),
@@ -49,8 +49,8 @@ function i({ selectedId: i, setSelectedId: a, detailsView: o, messages: s }) {
49
49
  a
50
50
  ]),
51
51
  isDeleting: c.isPending || l.isPending,
52
- dialogTitle: u ? s.deleteTitle.replace("{name}", () => u.name) : "",
53
- dialogMessage: u?.kind === "counterpart" ? s.deleteCounterpartMessage : s.deleteSubEntityMessage
52
+ dialogTitle: u ? u.kind === "counterpart" ? s.deleteTitle.replace("{name}", () => u.label) : s.deleteBankAccountTitle.replace("{account}", () => u.label) : "",
53
+ dialogMessage: u?.kind === "counterpart" ? s.deleteCounterpartMessage : s.deleteBankAccountMessage
54
54
  };
55
55
  }
56
56
  //#endregion