@tesouro/embedded-components-react 0.5.205 → 0.5.206

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/dist/index.d.ts +11 -4
  2. package/dist/index.js +1 -1
  3. package/dist/lib/ReceivablesWidget.d.ts +11 -4
  4. package/dist/lib/ReceivablesWidget.js +1 -1
  5. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index.js +1 -1
  6. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index10.js +88 -193
  7. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index11.js +184 -31
  8. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index12.js +32 -145
  9. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index13.js +150 -58
  10. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index14.js +35 -89
  11. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index15.js +53 -42
  12. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index16.js +82 -299
  13. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index17.js +47 -70
  14. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index18.js +321 -100
  15. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index19.js +68 -246
  16. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index20.js +115 -0
  17. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index21.js +270 -0
  18. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index5.js +1 -1
  19. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index8.js +93 -407
  20. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index9.js +422 -86
  21. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +16 -12
  22. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index10.js +92 -16
  23. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index11.js +3 -1
  24. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index12.js +24 -4
  25. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +0 -10
  26. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index14.js +2 -0
  27. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index15.js +3 -264
  28. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index16.js +16 -70
  29. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index17.js +1 -424
  30. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index18.js +4 -106
  31. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index19.js +12 -93
  32. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index2.js +5 -179
  33. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index20.js +1 -344
  34. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index21.js +264 -0
  35. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index22.js +72 -0
  36. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index23.js +401 -0
  37. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index24.js +106 -0
  38. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index25.js +93 -0
  39. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index26.js +344 -0
  40. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index3.js +182 -32
  41. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index4.js +29 -202
  42. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index5.js +183 -137
  43. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index6.js +157 -20
  44. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index7.js +16 -1
  45. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index8.js +25 -3
  46. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index9.js +4 -3
  47. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  48. package/package.json +1 -1
@@ -1,432 +1,118 @@
1
- import { minorExponentForCurrency as e } from "../../../shared/util/dist/lib/amountOutputToMajorUnits.js";
2
- import { parseDateOrTimestamp as t } from "../../../shared/util/dist/lib/parseCalendarDate.js";
3
- import { createLineItem as n, isBlankLineItem as r, lineItemToCreatePayload as i, lineItemToUpdatePayload as a, responseLineItemToFormValues as o, summarizeLineItemErrors as s, taxRateFromLineItems as c, validateLineItems as l } from "./index6.js";
4
- import { attachmentFormValuesToPayload as u, receivableToAttachmentFormValues as d } from "./index7.js";
1
+ import { RECEIVABLE_PAYMENT_TERMS_CUSTOM_DATE as e, RECEIVABLE_PAYMENT_TERMS_RECEIPT_DUE as t } from "../../ui/dist/index9.js";
2
+ import "../../ui/dist/index.js";
3
+ import { addDays as n, addYears as r, format as i, max as a, min as o, parseISO as s, subYears as c } from "date-fns";
5
4
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index8.js
6
- var f = {
7
- to: "",
8
- cc: "",
9
- bcc: "",
10
- subject: "",
11
- body: ""
12
- }, p = {
13
- mode: "full",
14
- amountPaid: "",
15
- paidAt: "",
16
- comment: ""
17
- };
18
- function m() {
19
- return {
20
- type: "invoice",
21
- customerId: "",
22
- currency: "USD",
23
- issueDate: (/* @__PURE__ */ new Date()).toISOString().slice(0, 10),
24
- dueDate: "",
25
- openingNote: "",
26
- closingNote: "",
27
- paymentTermsId: "",
28
- taxRate: "",
29
- lineItems: [n()],
30
- bankAccountId: "",
31
- bankAccountType: "",
32
- attachments: []
33
- };
34
- }
35
- function h(e) {
36
- return e === "quotes" ? "quote" : e === "credit_notes" ? "credit_note" : "invoice";
37
- }
38
- function g(e) {
39
- return e === "quote" ? "quotes" : e === "credit_note" ? "credit_notes" : "invoices";
40
- }
41
- function _(e) {
42
- return (e?.length ? e : [
43
- "invoices",
44
- "quotes",
45
- "credit_notes"
46
- ]).filter((e, t, n) => [
47
- "invoices",
48
- "quotes",
49
- "credit_notes"
50
- ].includes(e) && n.indexOf(e) === t);
51
- }
52
- function v({ defaultTab: e, enabledTabs: t }) {
53
- return e && t.includes(e) ? e : t[0] ?? "invoices";
54
- }
55
- function y(e, n) {
56
- let r = t(e);
57
- return r ? new Intl.DateTimeFormat(void 0, {
58
- day: "numeric",
59
- month: "short",
60
- year: "numeric"
61
- }).format(r) : n;
62
- }
63
- function b({ amount: t, currency: n, fallback: r }) {
64
- return t == null || !n ? r : new Intl.NumberFormat(void 0, {
65
- currency: n,
66
- style: "currency"
67
- }).format(t / 10 ** e(n));
68
- }
69
- function x(t, n) {
70
- let r = Number(t);
71
- if (!Number.isFinite(r)) return;
72
- let i = n ? e(n) : 2;
73
- return Math.round(r * 10 ** i);
74
- }
75
- function S(e, t) {
76
- return e.document_id || t.untitledDocument;
77
- }
78
- function C(e, t) {
79
- return e === "quote" ? t.quoteType : e === "credit_note" ? t.creditNoteType : t.invoiceType;
80
- }
81
- function w(e) {
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";
83
- }
84
- function T(e) {
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 && [
86
- "issued",
87
- "overdue",
88
- "partially_paid"
89
- ].includes(e.status);
90
- return {
91
- edit: t && !a,
92
- accept: i && n,
93
- cancel: ![
94
- "paid",
95
- "canceled",
96
- "deleted",
97
- "uncollectible"
98
- ].includes(e.status) && !t,
99
- clone: !a && e.status !== "deleted",
100
- decline: i && n,
101
- delete: t,
102
- issue: t,
103
- markPaid: o,
104
- markUncollectible: o,
105
- recordPayment: o,
106
- send: [
107
- "issued",
108
- "accepted",
109
- "overdue",
110
- "partially_paid"
111
- ].includes(e.status) && !a
112
- };
113
- }
114
- function E({ receivables: e, messages: t }) {
115
- return e.map((e) => {
116
- let n = e.type === "invoice" ? e.amount_due : void 0;
117
- return {
118
- id: e.id,
119
- type: e.type,
120
- documentLabel: S(e, t),
121
- customerLabel: e.counterpart_name || t.unknownCustomer,
122
- status: e.status,
123
- statusTone: w(e.status),
124
- issueDateLabel: y(e.issue_date, t.notAvailable),
125
- dueDateLabel: y(e.type === "quote" ? e.expiry_date : e.due_date, t.notAvailable),
126
- totalLabel: b({
127
- amount: e.total_amount,
128
- currency: e.currency,
129
- fallback: t.notAvailable
130
- }),
131
- amountDueLabel: b({
132
- amount: n,
133
- currency: e.currency,
134
- fallback: t.notAvailable
135
- }),
136
- actions: T(e)
137
- };
5
+ var l = "MMM d, yyyy", u = "yyyy-MM-dd", d = 10, f = 5;
6
+ function p(e) {
7
+ let t = (e) => e ? {
8
+ number_of_days: e.number_of_days ?? null,
9
+ discount: e.discount ?? null
10
+ } : null;
11
+ return JSON.stringify({
12
+ name: e.name,
13
+ description: e.description ?? null,
14
+ term_final: { number_of_days: e.term_final?.number_of_days ?? null },
15
+ term_1: t(e.term_1),
16
+ term_2: t(e.term_2)
138
17
  });
139
18
  }
140
- function D({ receivable: e, history: t, mails: n, pdfUrl: r, messages: i }) {
141
- if (!e) return;
142
- let a = e.type === "invoice" ? e.amount_due : void 0, o = e.type === "quote" ? e.expiry_date : e.due_date;
143
- return {
144
- id: e.id,
145
- type: e.type,
146
- title: S(e, i),
147
- customerLabel: e.counterpart_name || i.unknownCustomer,
148
- status: e.status,
149
- statusTone: w(e.status),
150
- totalLabel: b({
151
- amount: e.total_amount,
152
- currency: e.currency,
153
- fallback: i.notAvailable
154
- }),
155
- amountDueLabel: b({
156
- amount: a,
157
- currency: e.currency,
158
- fallback: i.notAvailable
159
- }),
160
- pdfUrl: r || e.file_url || e.original_file_url || void 0,
161
- summaryItems: [
162
- {
163
- label: i.summaryDocumentType,
164
- value: C(e.type, i)
165
- },
166
- {
167
- label: i.summaryDocumentNumber,
168
- value: S(e, i)
169
- },
170
- {
171
- label: i.summaryCustomer,
172
- value: e.counterpart_name || i.unknownCustomer
173
- },
174
- {
175
- label: i.summaryIssued,
176
- value: y(e.issue_date, i.notAvailable)
177
- },
178
- {
179
- label: i.summaryDue,
180
- value: y(o, i.notAvailable)
181
- },
182
- {
183
- label: i.summaryCreated,
184
- value: y(e.created_at, i.notAvailable)
185
- },
186
- {
187
- label: i.summaryUpdated,
188
- value: y(e.updated_at, i.notAvailable)
189
- },
190
- {
191
- label: i.summaryTotal,
192
- value: b({
193
- amount: e.total_amount,
194
- currency: e.currency,
195
- fallback: i.notAvailable
196
- })
197
- },
198
- {
199
- label: i.summaryAmountDue,
200
- value: b({
201
- amount: a,
202
- currency: e.currency,
203
- fallback: i.notAvailable
204
- })
205
- }
206
- ],
207
- lineItems: e.line_items.map((t, n) => ({
208
- id: t.product.id || String(n),
209
- name: t.product.name,
210
- quantityLabel: String(t.quantity),
211
- unitPriceLabel: b({
212
- amount: t.product.price?.value,
213
- currency: t.product.price?.currency || e.currency,
214
- fallback: i.notAvailable
215
- }),
216
- totalLabel: b({
217
- amount: t.total_after_tax ?? t.total_before_tax,
218
- currency: e.currency,
219
- fallback: i.notAvailable
220
- })
221
- })),
222
- activityItems: t.map((e) => ({
223
- id: e.id,
224
- title: O(e.event_type, i),
225
- description: e.event_type,
226
- timestampLabel: y(e.timestamp, i.notAvailable)
227
- })),
228
- mailItems: n.map((e) => ({
229
- id: e.id,
230
- statusLabel: e.status,
231
- recipientsLabel: k(e, i),
232
- sentAtLabel: y(e.created_at, i.notAvailable)
233
- })),
234
- actions: T(e)
235
- };
236
- }
237
- function O(e, t) {
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;
239
- }
240
- function k(e, t) {
241
- let n = [
242
- ...e.recipients?.to ?? [],
243
- ...e.recipients?.cc ?? [],
244
- ...e.recipients?.bcc ?? []
245
- ].map((e) => e.email).filter(Boolean);
246
- return n.length > 0 ? n.join(", ") : t.recipientsNone;
247
- }
248
- function A({ values: e, billingAddressId: t, messages: n }) {
249
- let r = {};
250
- e.customerId ? t || (r.customerId = n.customerAddressRequired) : r.customerId = n.customerRequired, e.currency || (r.currency = n.currencyRequired);
251
- let i = l(e.lineItems, {
252
- currency: e.currency,
253
- messages: n
19
+ function m(e) {
20
+ let t = /* @__PURE__ */ new Set();
21
+ return e.filter((e) => {
22
+ let n = p(e);
23
+ return !t.has(n) && (t.add(n), !0);
254
24
  });
255
- return i && (r.lineItems = i, r.lineItemsSummary = s(i)), r;
256
25
  }
257
- function j(e) {
258
- return Object.keys(e).length > 0;
26
+ function h(e, t) {
27
+ let r = e.term_final?.number_of_days;
28
+ return r ? n(t, r) : void 0;
259
29
  }
260
- function M({ bankAccountId: e, bankAccountType: t }) {
30
+ function g(e, t) {
31
+ let n = h(e, t);
261
32
  return {
262
- bank_account_id: e || void 0,
263
- bank_account_type: e && t || void 0
33
+ value: e.id,
34
+ label: e.name,
35
+ ...n ? { dueDateLabel: i(n, l) } : {}
264
36
  };
265
37
  }
266
- function N({ values: e, billingAddressId: t, unitNamesById: n }) {
267
- let a = e.lineItems.filter((e) => !r(e)).map((t) => i({
268
- lineItem: t,
269
- currency: e.currency,
270
- taxRate: e.taxRate,
271
- unitNamesById: n
272
- })), o = {
273
- counterpart_billing_address_id: t,
274
- counterpart_id: e.customerId,
275
- currency: e.currency,
276
- line_items: a,
277
- memo: e.openingNote,
278
- footer: e.closingNote,
279
- ...M(e)
280
- };
281
- return e.type === "quote" ? {
282
- ...o,
283
- expiry_date: e.dueDate || void 0,
284
- type: "quote"
285
- } : {
286
- ...o,
287
- payment_terms_id: e.paymentTermsId || void 0,
288
- payment_terms: !e.paymentTermsId && e.dueDate ? { term_final: { end_date: e.dueDate } } : void 0,
289
- attachments: u(e.attachments),
290
- type: "invoice"
38
+ function _(e) {
39
+ return e ? s(e) : void 0;
40
+ }
41
+ function v({ terms: e, isLoading: t, fields: n, customDatePickerOpen: r, messages: a, today: o = /* @__PURE__ */ new Date() }) {
42
+ if (t) return { kind: "loading" };
43
+ let s = m(e ?? []).map((e) => g(e, o)), c = _(n.paymentTermsCustomDate), u;
44
+ if (n.paymentTermsId === "receipt_due") u = { kind: "receiptDue" };
45
+ else if (n.paymentTermsId === "custom") u = {
46
+ kind: "customDate",
47
+ hasDate: !!c,
48
+ dateLabel: c ? i(c, l) : a.paymentTermsCustomDatePlaceholder
291
49
  };
292
- }
293
- function P(e, t) {
294
- let r = e.type === "quote" ? "quote" : "invoice", i = e.type === "invoice" ? e.payment_terms?.id ?? "" : "", a = e.line_items.map((n) => o({
295
- lineItem: n,
296
- currency: e.currency,
297
- units: t
298
- }));
50
+ else {
51
+ let e = s.find((e) => e.value === n.paymentTermsId);
52
+ e && (u = {
53
+ kind: "term",
54
+ option: e
55
+ });
56
+ }
299
57
  return {
300
- ...m(),
301
- type: r,
302
- customerId: e.counterpart_id,
303
- currency: e.currency,
304
- issueDate: R(e.issue_date),
305
- dueDate: R(e.type === "quote" ? e.expiry_date : e.due_date),
306
- openingNote: e.memo ?? "",
307
- closingNote: e.footer ?? "",
308
- paymentTermsId: i,
309
- taxRate: c(e.line_items),
310
- lineItems: a.length > 0 ? a : [n(e.currency)],
311
- bankAccountId: e.bank_account_id ?? "",
312
- bankAccountType: F(e.bank_account_type),
313
- attachments: d(e)
58
+ kind: "ready",
59
+ value: n.paymentTermsId,
60
+ options: s,
61
+ selection: u,
62
+ customDatePicker: { open: r }
314
63
  };
315
64
  }
316
- function F(e) {
317
- return e === "BANK_DETAILS" || e === "INTERNAL" || e === "EXTERNAL" ? e : "";
318
- }
319
- function I({ values: e, billingAddressId: t, lineItemChanges: n }) {
320
- let r = {
321
- counterpart_billing_address_id: t,
322
- counterpart_id: e.customerId,
323
- currency: e.currency,
324
- issue_date: e.issueDate || void 0,
325
- memo: e.openingNote,
326
- footer: e.closingNote,
327
- ...M(e)
65
+ function y(e, t = /* @__PURE__ */ new Date()) {
66
+ let n = _(e), i = c(t, d), s = r(t, f);
67
+ return {
68
+ selected: n,
69
+ startMonth: n ? o([i, n]) : i,
70
+ endMonth: n ? a([s, n]) : s
328
71
  };
329
- return e.type === "quote" ? { quote: {
330
- ...r,
331
- ...n ? { line_items: n } : {},
332
- expiry_date: e.dueDate || void 0,
333
- payment_terms_id: e.paymentTermsId || void 0
334
- } } : { invoice: {
335
- ...r,
336
- ...n ? { line_items: n } : {},
337
- due_date: e.dueDate || void 0,
338
- payment_terms_id: e.paymentTermsId || void 0,
339
- payment_terms: !e.paymentTermsId && e.dueDate ? { term_final: { end_date: e.dueDate } } : void 0,
340
- attachments: u(e.attachments) ?? null
341
- } };
342
72
  }
343
- function L({ values: e, originalLineItems: t, originalCurrency: n, unitNamesById: i, units: s }) {
344
- let l = (e, t, n) => a({
345
- lineItem: e,
346
- currency: t,
347
- taxRate: n,
348
- unitNamesById: i
349
- }), u = c(t), d = new Map(t.map((e) => [e.id, JSON.stringify(l(o({
350
- lineItem: e,
351
- currency: n,
352
- units: s
353
- }), n, u))])), f = e.lineItems.filter((e) => !r(e)), p = new Set(f.map((e) => e.id)), m = f.filter((e) => !d.has(e.id)).map((t) => l(t, e.currency, e.taxRate)), h = f.flatMap((t) => {
354
- let n = d.get(t.id);
355
- if (n === void 0) return [];
356
- let r = l(t, e.currency, e.taxRate);
357
- return n === JSON.stringify(r) ? [] : [{
358
- id: t.id,
359
- data: r
360
- }];
361
- }), g = t.filter((e) => !p.has(e.id)).map((e) => e.id);
362
- if (m.length || h.length || g.length) return {
363
- ...m.length ? { add: m } : {},
364
- ...h.length ? { replace: h } : {},
365
- ...g.length ? { remove: g } : {}
73
+ function b(e, t) {
74
+ return t === "custom" ? {
75
+ paymentTermsId: t,
76
+ paymentTermsCustomDate: e.paymentTermsId === "custom" ? e.paymentTermsCustomDate : ""
77
+ } : {
78
+ paymentTermsId: t,
79
+ paymentTermsCustomDate: ""
366
80
  };
367
81
  }
368
- function R(e) {
369
- return e?.slice(0, 10) ?? "";
370
- }
371
- function z(e) {
372
- return (e ?? []).map((e) => ({
373
- value: e.id,
374
- label: e.name
375
- }));
376
- }
377
- function B(e, t) {
378
- let n = {};
379
- return e.to.trim() || (n.to = t.sendToRequired), e.subject.trim() || (n.subject = t.sendSubjectRequired), e.body.trim() || (n.body = t.sendBodyRequired), n;
380
- }
381
- function V(e) {
382
- return Object.keys(e).length > 0;
383
- }
384
- function H(e) {
385
- return e.split(",").map((e) => e.trim()).filter(Boolean);
82
+ function x(e) {
83
+ return e.paymentTermsId === "custom" && !e.paymentTermsCustomDate ? {
84
+ paymentTermsId: "",
85
+ paymentTermsCustomDate: ""
86
+ } : e;
386
87
  }
387
- function U(e, t, n) {
388
- let r = {};
389
- if (e.mode === "partial") {
390
- let i = x(e.amountPaid, n);
391
- (!i || i <= 0) && (r.amountPaid = t.paymentAmountInvalid);
392
- }
393
- return r;
88
+ function S(e) {
89
+ return e ? i(e, u) : "";
394
90
  }
395
- function W(e) {
396
- return Object.keys(e).length > 0;
91
+ function C(e) {
92
+ return e.paymentTermsId === "custom" ? e.paymentTermsCustomDate ? { payment_terms: { term_final: { end_date: e.paymentTermsCustomDate } } } : { payment_terms: { term_final: { number_of_days: 0 } } } : e.paymentTermsId === "receipt_due" ? { payment_terms: { term_final: { number_of_days: 0 } } } : e.paymentTermsId ? { payment_terms_id: e.paymentTermsId } : {};
397
93
  }
398
- function G(e, t) {
399
- return {
400
- ...f,
401
- to: e?.counterpart_contact?.email ?? "",
402
- subject: e?.document_id ? `${t.sendSubjectDefault} ${e.document_id}` : t.sendSubjectDefault,
403
- body: t.sendBodyDefault
94
+ function w(e) {
95
+ return e.paymentTermsId ? C(e) : {
96
+ payment_terms_id: null,
97
+ payment_terms: null
404
98
  };
405
99
  }
406
- function K() {
407
- return {
408
- ...p,
409
- paidAt: (/* @__PURE__ */ new Date()).toISOString().slice(0, 10)
100
+ function T(n) {
101
+ if (n?.id) return {
102
+ paymentTermsId: n.id,
103
+ paymentTermsCustomDate: ""
104
+ };
105
+ let r = n?.term_final?.end_date;
106
+ return r ? {
107
+ paymentTermsId: e,
108
+ paymentTermsCustomDate: r.slice(0, 10)
109
+ } : n?.term_final?.number_of_days === 0 ? {
110
+ paymentTermsId: t,
111
+ paymentTermsCustomDate: ""
112
+ } : {
113
+ paymentTermsId: "",
114
+ paymentTermsCustomDate: ""
410
115
  };
411
- }
412
- function q() {
413
- return [
414
- "draft",
415
- "issued",
416
- "failed",
417
- "accepted",
418
- "expired",
419
- "declined",
420
- "recurring",
421
- "partially_paid",
422
- "paid",
423
- "overdue",
424
- "uncollectible",
425
- "canceled"
426
- ].map((e) => ({
427
- value: e,
428
- label: e.split("_").map((e) => `${e.slice(0, 1).toUpperCase()}${e.slice(1)}`).join(" ")
429
- }));
430
116
  }
431
117
  //#endregion
432
- export { p as EMPTY_RECEIVABLE_PAYMENT_VALUES, f as EMPTY_RECEIVABLE_SEND_VALUES, T as buildReceivableActions, D as buildReceivableDetailsView, E as buildReceivableRows, _ as coerceEnabledTabs, m as createEmptyReceivableFormValues, n as createLineItem, K as defaultPaymentValues, G as defaultSendValues, y as formatDate, b as formatMoney, x as fromMajorUnits, S as getDocumentTitle, C as getDocumentTypeLabel, z as getPaymentTermOptions, w as getStatusTone, W as hasPaymentErrors, j as hasReceivableFormErrors, V as hasSendErrors, N as receivableFormValuesToCreatePayload, L as receivableFormValuesToLineItemChanges, I as receivableFormValuesToUpdatePayload, P as receivableToFormValues, v as resolveInitialTab, H as splitEmailList, q as statusFilterOptions, g as tabForType, h as typeForTab, U as validatePaymentValues, A as validateReceivableForm, B as validateSendValues };
118
+ export { y as buildCustomDateCalendar, C as buildPaymentTermsPayload, w as buildPaymentTermsUpdatePayload, v as buildPaymentTermsView, x as closeCustomDatePickerFields, m as dedupePaymentTerms, T as paymentTermsToFormFields, b as selectPaymentTermsFields, S as toCustomDateValue };