@tesouro/embedded-components-react 0.7.63 → 0.7.66

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -11,6 +11,11 @@ dependencies.
11
11
  These steps put one widget on screen: a token route on your server, a provider
12
12
  in the browser, and the widget itself. The examples use the Next.js App Router.
13
13
 
14
+ Using a coding assistant? Point it at
15
+ [`llms-full.txt`](https://components.tesouro.com/llms-full.txt), which has every
16
+ page of the docs site as Markdown in one file.
17
+ [`llms.txt`](https://components.tesouro.com/llms.txt) is the index.
18
+
14
19
  ### Before you start
15
20
 
16
21
  You need three credentials from Tesouro: a client ID, a client secret and a
@@ -0,0 +1,6 @@
1
+ //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/currencyDisplay.js
2
+ function e(e) {
3
+ return e.toUpperCase() === "USD" ? "narrowSymbol" : "symbol";
4
+ }
5
+ //#endregion
6
+ export { e as currencyDisplayFor };
@@ -1,59 +1,60 @@
1
1
  import { minorExponentForCurrency as e } from "../../../../../shared/util/dist/lib/amountOutputToMajorUnits.js";
2
- import { escapeRegex as t, getNumberSeparators as n, parseLocaleDecimal as r } from "./lineItems.js";
2
+ import { currencyDisplayFor as t } from "./currencyDisplay.js";
3
+ import { escapeRegex as n, getNumberSeparators as r, parseLocaleDecimal as i } from "./lineItems.js";
3
4
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/discount.js
4
- function i(t, n) {
5
+ function a(t, n) {
5
6
  return t === "percentage" ? 2 : e(n);
6
7
  }
7
- function a(e, r, a, o = n()) {
8
- let s = `0-9${t(o.digits.join(""))}${t(o.decimal)}${o.group ? t(o.group) : ""}`, c = e.replace(RegExp(`[^${s}]`, "gu"), ""), l = c.indexOf(o.decimal);
9
- return l === -1 ? c : c.slice(0, l + o.decimal.length) + Array.from(c.slice(l + o.decimal.length).split(o.decimal).join("")).slice(0, i(r, a)).join("");
8
+ function o(e, t, i, o = r()) {
9
+ let s = `0-9${n(o.digits.join(""))}${n(o.decimal)}${o.group ? n(o.group) : ""}`, c = e.replace(RegExp(`[^${s}]`, "gu"), ""), l = c.indexOf(o.decimal);
10
+ return l === -1 ? c : c.slice(0, l + o.decimal.length) + Array.from(c.slice(l + o.decimal.length).split(o.decimal).join("")).slice(0, a(t, i)).join("");
10
11
  }
11
- function o(e, t, a, o = n()) {
12
- return Math.round(r(e, o) * 10 ** i(t, a));
12
+ function s(e, t, n, o = r()) {
13
+ return Math.round(i(e, o) * 10 ** a(t, n));
13
14
  }
14
- function s(e, t, n) {
15
- let r = i(t, n);
15
+ function c(e, t, n) {
16
+ let r = a(t, n);
16
17
  return new Intl.NumberFormat(void 0, {
17
18
  minimumFractionDigits: r,
18
19
  maximumFractionDigits: r
19
20
  }).format(e / 10 ** r);
20
21
  }
21
- function c(e, t, n) {
22
- let r = i(t, n), a = {
23
- minimumFractionDigits: r,
24
- maximumFractionDigits: r
22
+ function l(e, n, r) {
23
+ let i = a(n, r), o = {
24
+ minimumFractionDigits: i,
25
+ maximumFractionDigits: i
25
26
  };
26
- return t === "percentage" ? new Intl.NumberFormat(void 0, {
27
- ...a,
27
+ return n === "percentage" ? new Intl.NumberFormat(void 0, {
28
+ ...o,
28
29
  style: "percent"
29
- }).format(e / 10 ** (r + 2)) : new Intl.NumberFormat(void 0, {
30
- ...a,
30
+ }).format(e / 10 ** (i + 2)) : new Intl.NumberFormat(void 0, {
31
+ ...o,
31
32
  style: "currency",
32
- currency: n,
33
- currencyDisplay: "narrowSymbol"
34
- }).format(e / 10 ** r);
33
+ currency: r,
34
+ currencyDisplay: t(r)
35
+ }).format(e / 10 ** i);
35
36
  }
36
- function l({ value: e, type: t, currency: n }) {
37
- return s(o(e, t, n), t, n);
37
+ function u({ value: e, type: t, currency: n }) {
38
+ return c(s(e, t, n), t, n);
38
39
  }
39
- function u(e) {
40
+ function d(e) {
40
41
  return {
41
42
  discountType: "amount",
42
- discount: s(0, "amount", e)
43
+ discount: c(0, "amount", e)
43
44
  };
44
45
  }
45
- function d(e) {
46
- let t = o(e.discount, e.discountType, e.currency);
46
+ function f(e) {
47
+ let t = s(e.discount, e.discountType, e.currency);
47
48
  return t > 0 ? {
48
49
  type: e.discountType,
49
50
  amount: t
50
51
  } : null;
51
52
  }
52
- function f(e, t) {
53
+ function p(e, t) {
53
54
  return e ? {
54
55
  discountType: e.type,
55
- discount: s(e.amount, e.type, t)
56
- } : u(t);
56
+ discount: c(e.amount, e.type, t)
57
+ } : d(t);
57
58
  }
58
59
  //#endregion
59
- export { l as convertDiscountInput, u as createEmptyDiscount, c as decorateDiscountInput, d as discountFromDraft, o as discountInputToMinorUnits, f as discountToDraft, s as formatDiscountInput, a as sanitizeDiscountInput };
60
+ export { u as convertDiscountInput, d as createEmptyDiscount, l as decorateDiscountInput, f as discountFromDraft, s as discountInputToMinorUnits, p as discountToDraft, c as formatDiscountInput, o as sanitizeDiscountInput };
@@ -1,30 +1,31 @@
1
1
  import { minorExponentForCurrency as e } from "../../../../../shared/util/dist/lib/amountOutputToMajorUnits.js";
2
2
  import { parseDateOrTimestamp as t } from "../../../../../shared/util/dist/lib/parseCalendarDate.js";
3
3
  import { isEmail as n } from "../../../../../../shared/util-validation/dist/index5.js";
4
- import { createLineItem as r, isBlankLineItem as i, keepsSavedTaxRates as a, lineItemToCreatePayload as o, lineItemToUpdatePayload as s, responseLineItemToFormValues as c, summarizeLineItemErrors as l, taxRateFromLineItems as u, validateLineItems as d } from "./lineItems.js";
5
- import { attachmentFormValuesToPayload as f, receivableToAttachmentFormValues as p } from "./attachments.js";
6
- import { createEmptyRecurrenceFields as m, willRecurrenceIssue as h } from "./recurrence.js";
7
- import { buildPaymentTermsPayload as g, buildPaymentTermsUpdatePayload as _, paymentTermsToFormFields as v } from "./paymentTerms.js";
8
- import { createEmptyDiscount as y, discountFromDraft as b, discountToDraft as x } from "./discount.js";
9
- import { validateDiscount as S, validateInvoiceTotals as C, validateIssuableTotal as w } from "./totals.js";
10
- import { format as T } from "date-fns";
4
+ import { currencyDisplayFor as r } from "./currencyDisplay.js";
5
+ import { createLineItem as i, isBlankLineItem as a, keepsSavedTaxRates as o, lineItemToCreatePayload as s, lineItemToUpdatePayload as c, responseLineItemToFormValues as l, summarizeLineItemErrors as u, taxRateFromLineItems as d, validateLineItems as f } from "./lineItems.js";
6
+ import { attachmentFormValuesToPayload as p, receivableToAttachmentFormValues as m } from "./attachments.js";
7
+ import { createEmptyRecurrenceFields as h, willRecurrenceIssue as g } from "./recurrence.js";
8
+ import { buildPaymentTermsPayload as _, buildPaymentTermsUpdatePayload as v, paymentTermsToFormFields as y } from "./paymentTerms.js";
9
+ import { createEmptyDiscount as b, discountFromDraft as x, discountToDraft as S } from "./discount.js";
10
+ import { validateDiscount as C, validateInvoiceTotals as w, validateIssuableTotal as T } from "./totals.js";
11
+ import { format as E } from "date-fns";
11
12
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/helpers.js
12
- function E() {
13
+ function D() {
13
14
  return {
14
15
  type: "invoice",
15
16
  customerId: "",
16
17
  customerName: "",
17
18
  customerEmail: "",
18
19
  currency: "USD",
19
- issueDate: T(/* @__PURE__ */ new Date(), "yyyy-MM-dd"),
20
+ issueDate: E(/* @__PURE__ */ new Date(), "yyyy-MM-dd"),
20
21
  dueDate: "",
21
22
  openingNote: "",
22
23
  closingNote: "",
23
24
  paymentTermsId: "",
24
25
  paymentTermsCustomDate: "",
25
26
  taxRate: "",
26
- ...y("USD"),
27
- lineItems: [r()],
27
+ ...b("USD"),
28
+ lineItems: [i()],
28
29
  bankAccountId: "",
29
30
  bankAccountType: "",
30
31
  billingAddressId: "",
@@ -33,10 +34,10 @@ function E() {
33
34
  overdueReminderId: "",
34
35
  purchaseOrder: "",
35
36
  attachments: [],
36
- ...m()
37
+ ...h()
37
38
  };
38
39
  }
39
- function D(e, n) {
40
+ function O(e, n) {
40
41
  let r = t(e);
41
42
  return r ? new Intl.DateTimeFormat(void 0, {
42
43
  day: "2-digit",
@@ -44,25 +45,26 @@ function D(e, n) {
44
45
  year: "numeric"
45
46
  }).format(r) : n;
46
47
  }
47
- function O({ amount: t, currency: n, fallback: r }) {
48
- return t == null || !n ? r : new Intl.NumberFormat(void 0, {
48
+ function k({ amount: t, currency: n, fallback: i }) {
49
+ return t == null || !n ? i : new Intl.NumberFormat(void 0, {
49
50
  currency: n,
50
- style: "currency"
51
+ style: "currency",
52
+ currencyDisplay: r(n)
51
53
  }).format(t / 10 ** e(n));
52
54
  }
53
- function k(t, n) {
55
+ function A(t, n) {
54
56
  let r = Number(t);
55
57
  if (!Number.isFinite(r)) return;
56
58
  let i = n ? e(n) : 2;
57
59
  return Math.round(r * 10 ** i);
58
60
  }
59
- function A(e, t) {
61
+ function j(e, t) {
60
62
  return e.document_id || t.untitledDocument;
61
63
  }
62
- function j(e, t) {
64
+ function M(e, t) {
63
65
  return e === "quote" ? t.quoteType : e === "credit_note" ? t.creditNoteType : t.invoiceType;
64
66
  }
65
- function M(e, t, n) {
67
+ function N(e, t, n) {
66
68
  let r = e.counterpart_name || (e.counterpart_id ? t.names.get(e.counterpart_id) : void 0);
67
69
  return r ? {
68
70
  customerLabel: r,
@@ -75,62 +77,62 @@ function M(e, t, n) {
75
77
  customerState: "missing"
76
78
  };
77
79
  }
78
- function N(e, t = /* @__PURE__ */ new Date()) {
80
+ function P(e, t = /* @__PURE__ */ new Date()) {
79
81
  if (!e) return 0;
80
82
  let n = new Date(e);
81
83
  if (Number.isNaN(n.getTime())) return 0;
82
84
  let r = Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate()), i = Date.UTC(n.getUTCFullYear(), n.getUTCMonth(), n.getUTCDate()), a = Math.floor((r - i) / 864e5);
83
85
  return a > 0 ? a : 0;
84
86
  }
85
- function P(e, t, n) {
87
+ function F(e, t, n) {
86
88
  if (e.type !== "invoice" || e.status !== "draft") return {};
87
- let r = N(e.due_date, n);
89
+ let r = P(e.due_date, n);
88
90
  return r === 0 ? {} : { dueDateOverdueLabel: (r === 1 ? t.listDayOverdue : t.listDaysOverdue).replace("{days}", String(r)) };
89
91
  }
90
- var F = {
92
+ var I = {
91
93
  names: /* @__PURE__ */ new Map(),
92
94
  isResolving: !1
93
95
  };
94
- function I(e) {
96
+ function L(e) {
95
97
  return e?.isLoading ? { kind: "loading" } : e?.status ? {
96
98
  kind: "chip",
97
99
  ...e.status
98
100
  } : { kind: "blank" };
99
101
  }
100
- function L(e, t, n) {
102
+ function R(e, t, n) {
101
103
  if (e.type !== "invoice" || e.status !== "recurring") return {};
102
104
  let r = e.recurrence_id ? t.get(e.recurrence_id) : void 0;
103
105
  return {
104
106
  documentLabel: e.document_id || n.recurringNumber,
105
- statusOverride: I(r),
107
+ statusOverride: L(r),
106
108
  showDocumentSyncIcon: !0
107
109
  };
108
110
  }
109
- function R({ receivables: e, messages: t, customerNames: n = F, seriesStatuses: r = /* @__PURE__ */ new Map(), now: i = /* @__PURE__ */ new Date() }) {
111
+ function z({ receivables: e, messages: t, customerNames: n = I, seriesStatuses: r = /* @__PURE__ */ new Map(), now: i = /* @__PURE__ */ new Date() }) {
110
112
  return e.map((e) => ({
111
113
  id: e.id,
112
114
  type: e.type,
113
115
  documentLabel: e.document_id || t.pendingValue,
114
- ...M(e, n, t),
116
+ ...N(e, n, t),
115
117
  status: e.status,
116
- issueDateLabel: D(e.issue_date, t.pendingValue),
117
- dueDateLabel: D(e.type === "invoice" ? e.due_date : void 0, t.pendingValue),
118
- ...P(e, t, i),
119
- totalLabel: O({
118
+ issueDateLabel: O(e.issue_date, t.pendingValue),
119
+ dueDateLabel: O(e.type === "invoice" ? e.due_date : void 0, t.pendingValue),
120
+ ...F(e, t, i),
121
+ totalLabel: k({
120
122
  amount: e.total_amount ?? 0,
121
123
  currency: e.currency,
122
124
  fallback: ""
123
125
  }),
124
- ...L(e, r, t)
126
+ ...R(e, r, t)
125
127
  }));
126
128
  }
127
- function z(e) {
129
+ function B(e) {
128
130
  if (e.memo || e.footer) return {
129
131
  opening: e.memo || void 0,
130
132
  closing: e.footer || void 0
131
133
  };
132
134
  }
133
- function B({ values: e, counterpart: t, addresses: n }) {
135
+ function V({ values: e, counterpart: t, addresses: n }) {
134
136
  let r = n?.length && t?.id === e.customerId ? t : void 0, i = e.billingAddressId || r?.default_billing_address_id || (n?.length === 1 ? n[0].id : ""), a = e.shippingAddressId || r?.default_shipping_address_id || "";
135
137
  return {
136
138
  billingAddressId: i,
@@ -138,101 +140,101 @@ function B({ values: e, counterpart: t, addresses: n }) {
138
140
  shippingAddressId: a
139
141
  };
140
142
  }
141
- function V({ values: e, messages: t, willIssue: r = !1, hasStartedRecurrence: i = !1, canCreateCustomer: a = !0 }) {
143
+ function H({ values: e, messages: t, willIssue: r = !1, hasStartedRecurrence: i = !1, canCreateCustomer: a = !0 }) {
142
144
  let o = {}, s = a && !!e.customerName.trim();
143
145
  !e.customerId && !s && (o.customerId = t.customerRequired);
144
146
  let c = e.customerEmail.trim();
145
147
  !e.customerId && c && !n(c) && (o.customerEmail = t.customerEmailInvalid), e.currency || (o.currency = t.currencyRequired), r && !e.paymentTermsId && (o.paymentTermsId = t.paymentTermsRequired), r && !e.bankAccountId && (o.bankAccountId = t.bankAccountRequired);
146
- let u = d(e.lineItems, {
148
+ let l = f(e.lineItems, {
147
149
  currency: e.currency,
148
150
  messages: t,
149
151
  requireComplete: r || i
150
- }), f = (r || i && h(e)) && !u && e.lineItems.length > 0 ? w(e, t) : void 0, p = l(u, C(e, t) ?? f, (r || i) && e.lineItems.length === 0 ? t.lineItemsRequired : void 0);
151
- u && (o.lineItems = u), p && (o.lineItemsSummary = p);
152
- let m = S(e, t);
152
+ }), d = (r || i && g(e)) && !l && e.lineItems.length > 0 ? T(e, t) : void 0, p = u(l, w(e, t) ?? d, (r || i) && e.lineItems.length === 0 ? t.lineItemsRequired : void 0);
153
+ l && (o.lineItems = l), p && (o.lineItemsSummary = p);
154
+ let m = C(e, t);
153
155
  return m && (o.discount = m), o;
154
156
  }
155
- function H(e) {
157
+ function U(e) {
156
158
  return Object.keys(e).length > 0;
157
159
  }
158
- function U(e, t) {
159
- return !H(V({
160
- values: K(e),
160
+ function W(e, t) {
161
+ return !U(H({
162
+ values: q(e),
161
163
  messages: t,
162
164
  willIssue: !0
163
165
  }));
164
166
  }
165
- function W({ bankAccountId: e, bankAccountType: t }) {
167
+ function G({ bankAccountId: e, bankAccountType: t }) {
166
168
  return {
167
169
  bank_account_id: e || void 0,
168
170
  bank_account_type: e && t || void 0
169
171
  };
170
172
  }
171
- function G({ values: e, billingAddressId: t, shippingAddressId: n, unitNamesById: r }) {
172
- let a = e.lineItems.filter((e) => !i(e)).map((t) => o({
173
+ function K({ values: e, billingAddressId: t, shippingAddressId: n, unitNamesById: r }) {
174
+ let i = e.lineItems.filter((e) => !a(e)).map((t) => s({
173
175
  lineItem: t,
174
176
  currency: e.currency,
175
177
  taxRate: e.taxRate,
176
178
  unitNamesById: r
177
- })), s = {
179
+ })), o = {
178
180
  counterpart_billing_address_id: t || void 0,
179
181
  counterpart_shipping_address_id: n || void 0,
180
182
  counterpart_id: e.customerId,
181
183
  currency: e.currency,
182
- line_items: a,
184
+ line_items: i,
183
185
  memo: e.openingNote,
184
186
  footer: e.closingNote,
185
- discount: b(e) ?? void 0,
186
- ...W(e)
187
+ discount: x(e) ?? void 0,
188
+ ...G(e)
187
189
  };
188
190
  return e.type === "quote" ? {
189
- ...s,
191
+ ...o,
190
192
  expiry_date: e.dueDate || void 0,
191
193
  type: "quote"
192
194
  } : {
193
- ...s,
194
- ...g(e),
195
+ ...o,
196
+ ..._(e),
195
197
  payment_reminder_id: e.paymentReminderId || void 0,
196
198
  overdue_reminder_id: e.overdueReminderId || void 0,
197
199
  purchase_order: e.purchaseOrder || void 0,
198
- attachments: f(e.attachments),
200
+ attachments: p(e.attachments),
199
201
  type: "invoice"
200
202
  };
201
203
  }
202
- function K(e, t) {
203
- let n = e.type === "quote" ? "quote" : "invoice", i = u(e.line_items), a = e.type === "invoice" ? e : void 0, o = e.line_items.map((n) => c({
204
+ function q(e, t) {
205
+ let n = e.type === "quote" ? "quote" : "invoice", r = d(e.line_items), a = e.type === "invoice" ? e : void 0, o = e.line_items.map((n) => l({
204
206
  lineItem: n,
205
207
  currency: e.currency,
206
208
  units: t
207
209
  }));
208
210
  return {
209
- ...E(),
211
+ ...D(),
210
212
  type: n,
211
213
  customerId: e.counterpart_id,
212
214
  currency: e.currency,
213
- issueDate: Z(e.issue_date),
214
- dueDate: e.type === "quote" ? Z(e.expiry_date) : "",
215
+ issueDate: Q(e.issue_date),
216
+ dueDate: e.type === "quote" ? Q(e.expiry_date) : "",
215
217
  openingNote: e.memo ?? "",
216
218
  closingNote: e.footer ?? "",
217
- ...e.type === "invoice" ? v(e.payment_terms) : {},
218
- taxRate: i,
219
- savedTaxRate: i,
220
- ...x(e.discount, e.currency),
221
- lineItems: o.length > 0 ? o : [r(e.currency)],
219
+ ...e.type === "invoice" ? y(e.payment_terms) : {},
220
+ taxRate: r,
221
+ savedTaxRate: r,
222
+ ...S(e.discount, e.currency),
223
+ lineItems: o.length > 0 ? o : [i(e.currency)],
222
224
  bankAccountId: e.bank_account_id ?? "",
223
- bankAccountType: q(e.bank_account_type),
225
+ bankAccountType: J(e.bank_account_type),
224
226
  billingAddressId: e.counterpart_billing_address?.id ?? "",
225
227
  shippingAddressId: e.counterpart_shipping_address?.id ?? "",
226
228
  paymentReminderId: a?.payment_reminder_id ?? "",
227
229
  overdueReminderId: a?.overdue_reminder_id ?? "",
228
230
  purchaseOrder: a?.purchase_order ?? "",
229
- attachments: p(e)
231
+ attachments: m(e)
230
232
  };
231
233
  }
232
- function q(e) {
234
+ function J(e) {
233
235
  return e === "BANK_DETAILS" || e === "INTERNAL" || e === "EXTERNAL" ? e : "";
234
236
  }
235
- function J({ values: e, billingAddressId: t, shippingAddressId: n, lineItemChanges: r }) {
237
+ function Y({ values: e, billingAddressId: t, shippingAddressId: n, lineItemChanges: r }) {
236
238
  let i = {
237
239
  counterpart_billing_address_id: t || null,
238
240
  counterpart_shipping_address_id: n || null,
@@ -241,35 +243,35 @@ function J({ values: e, billingAddressId: t, shippingAddressId: n, lineItemChang
241
243
  issue_date: e.issueDate || void 0,
242
244
  memo: e.openingNote,
243
245
  footer: e.closingNote,
244
- discount: b(e),
245
- ...W(e)
246
+ discount: x(e),
247
+ ...G(e)
246
248
  };
247
249
  return e.type === "quote" ? { quote: {
248
250
  ...i,
249
251
  ...r ? { line_items: r } : {},
250
252
  expiry_date: e.dueDate || void 0,
251
- ..._(e)
253
+ ...v(e)
252
254
  } } : { invoice: {
253
255
  ...i,
254
256
  ...r ? { line_items: r } : {},
255
- ..._(e),
257
+ ...v(e),
256
258
  payment_reminder_id: e.paymentReminderId || null,
257
259
  overdue_reminder_id: e.overdueReminderId || null,
258
- attachments: f(e.attachments) ?? null
260
+ attachments: p(e.attachments) ?? null
259
261
  } };
260
262
  }
261
- function Y({ values: e, originalLineItems: t, originalCurrency: n, unitNamesById: r, units: o }) {
262
- let l = u(t), d = a(e.taxRate, l), f = (e, t, n) => s({
263
+ function X({ values: e, originalLineItems: t, originalCurrency: n, unitNamesById: r, units: i }) {
264
+ let s = d(t), u = o(e.taxRate, s), f = (e, t, n) => c({
263
265
  lineItem: e,
264
266
  currency: t,
265
267
  taxRate: n,
266
- keepSavedRate: d,
268
+ keepSavedRate: u,
267
269
  unitNamesById: r
268
- }), p = new Map(t.map((e) => [e.id, JSON.stringify(f(c({
270
+ }), p = new Map(t.map((e) => [e.id, JSON.stringify(f(l({
269
271
  lineItem: e,
270
272
  currency: n,
271
- units: o
272
- }), n, l))])), m = e.lineItems.filter((e) => !i(e)), h = new Set(m.map((e) => e.id)), g = m.filter((e) => !p.has(e.id)).map((t) => f(t, e.currency, e.taxRate)), _ = m.flatMap((t) => {
273
+ units: i
274
+ }), n, s))])), m = e.lineItems.filter((e) => !a(e)), h = new Set(m.map((e) => e.id)), g = m.filter((e) => !p.has(e.id)).map((t) => f(t, e.currency, e.taxRate)), _ = m.flatMap((t) => {
273
275
  let n = p.get(t.id);
274
276
  if (n === void 0) return [];
275
277
  let r = f(t, e.currency, e.taxRate);
@@ -284,17 +286,17 @@ function Y({ values: e, originalLineItems: t, originalCurrency: n, unitNamesById
284
286
  ...v.length ? { remove: v } : {}
285
287
  };
286
288
  }
287
- function X({ values: e, originalLineItems: t, changes: n }) {
288
- let r = e.lineItems.filter((e) => !i(e)).map((e) => e.id);
289
+ function Z({ values: e, originalLineItems: t, changes: n }) {
290
+ let r = e.lineItems.filter((e) => !a(e)).map((e) => e.id);
289
291
  if (!t) return { created: r };
290
- let a = new Set(t.map((e) => e.id));
292
+ let i = new Set(t.map((e) => e.id));
291
293
  return {
292
- added: r.filter((e) => !a.has(e)),
294
+ added: r.filter((e) => !i.has(e)),
293
295
  replaced: n?.replace?.map((e) => e.id) ?? []
294
296
  };
295
297
  }
296
- function Z(e) {
298
+ function Q(e) {
297
299
  return e?.slice(0, 10) ?? "";
298
300
  }
299
301
  //#endregion
300
- export { z as buildReceivableNotesView, R as buildReceivableRows, E as createEmptyReceivableFormValues, r as createLineItem, D as formatDate, O as formatMoney, k as fromMajorUnits, N as getDaysOverdue, A as getDocumentTitle, j as getDocumentTypeLabel, H as hasReceivableFormErrors, U as isReceivableReadyToIssue, G as receivableFormValuesToCreatePayload, Y as receivableFormValuesToLineItemChanges, J as receivableFormValuesToUpdatePayload, K as receivableToFormValues, B as resolveCounterpartAddresses, X as submittedLineItemRows, V as validateReceivableForm };
302
+ export { B as buildReceivableNotesView, z as buildReceivableRows, D as createEmptyReceivableFormValues, i as createLineItem, O as formatDate, k as formatMoney, A as fromMajorUnits, P as getDaysOverdue, j as getDocumentTitle, M as getDocumentTypeLabel, U as hasReceivableFormErrors, W as isReceivableReadyToIssue, K as receivableFormValuesToCreatePayload, X as receivableFormValuesToLineItemChanges, Y as receivableFormValuesToUpdatePayload, q as receivableToFormValues, V as resolveCounterpartAddresses, Z as submittedLineItemRows, H as validateReceivableForm };