@tesouro/embedded-components-react 0.5.292 → 0.5.294

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +1 -1
  2. package/dist/index.d.ts +26 -1
  3. package/dist/lib/CounterpartsWidget.d.ts +2 -0
  4. package/dist/lib/CounterpartsWidgetPublic.d.ts +2 -0
  5. package/dist/lib/CustomersWidget.d.ts +2 -0
  6. package/dist/lib/ReceivablesWidget.d.ts +26 -1
  7. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index.js +4 -4
  8. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index11.js +3 -2
  9. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index14.js +5 -88
  10. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index15.js +70 -173
  11. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index16.js +210 -17
  12. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index17.js +29 -0
  13. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +6 -7
  14. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/details.js +142 -141
  15. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/helpers.js +84 -54
  16. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/labels.js +21 -3
  17. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/paymentTerms.js +27 -27
  18. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/recurrence.js +2 -1
  19. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/reminders.js +1 -1
  20. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/totals.js +13 -10
  21. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActions.js +84 -80
  22. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActionsModal.js +1 -1
  23. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableDetails.js +32 -30
  24. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableForm.js +417 -414
  25. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableIssuePreflight.js +1 -1
  26. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableReminders.js +1 -1
  27. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableStatusCards.js +1 -1
  28. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesTable.js +83 -66
  29. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesWidget.js +133 -129
  30. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useSendReceivableWithPaymentLink.js +26 -22
  31. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useUtcDayStart.js +16 -0
  32. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +0 -1
  33. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index15.js +20 -22
  34. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index23.js +2 -2
  35. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index40.js +1 -1
  36. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index44.js +91 -85
  37. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index45.js +1 -0
  38. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index51.js +119 -88
  39. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index53.js +19 -16
  40. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index57.js +130 -96
  41. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/helpers.js +24 -8
  42. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/labels.js +2 -0
  43. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useCounterpartForm.js +101 -98
  44. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index9.js +34 -20
  45. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  46. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index6.js +4 -3
  47. package/dist/packages/shared-ui-shadcn/dist/index.js +15 -10
  48. package/package.json +1 -1
@@ -3,26 +3,27 @@ import { parseDateOrTimestamp as t } from "../../../../../shared/util/dist/lib/p
3
3
  import { isEmail as n } from "../../../../../../shared/util-validation/dist/index5.js";
4
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
5
  import { attachmentFormValuesToPayload as f, receivableToAttachmentFormValues as p } from "./attachments.js";
6
- import { createEmptyRecurrenceFields as m } from "./recurrence.js";
7
- import { buildPaymentTermsPayload as h, buildPaymentTermsUpdatePayload as g, paymentTermsToFormFields as _ } from "./paymentTerms.js";
8
- import { createEmptyDiscount as v, discountFromDraft as y, discountToDraft as b } from "./discount.js";
9
- import { validateDiscount as x, validateInvoiceTotals as S } from "./totals.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";
10
11
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/helpers.js
11
- function C() {
12
+ function E() {
12
13
  return {
13
14
  type: "invoice",
14
15
  customerId: "",
15
16
  customerName: "",
16
17
  customerEmail: "",
17
18
  currency: "USD",
18
- issueDate: (/* @__PURE__ */ new Date()).toISOString().slice(0, 10),
19
+ issueDate: T(/* @__PURE__ */ new Date(), "yyyy-MM-dd"),
19
20
  dueDate: "",
20
21
  openingNote: "",
21
22
  closingNote: "",
22
23
  paymentTermsId: "",
23
24
  paymentTermsCustomDate: "",
24
25
  taxRate: "",
25
- ...v("USD"),
26
+ ...y("USD"),
26
27
  lineItems: [r()],
27
28
  bankAccountId: "",
28
29
  bankAccountType: "",
@@ -35,7 +36,7 @@ function C() {
35
36
  ...m()
36
37
  };
37
38
  }
38
- function w(e, n) {
39
+ function D(e, n) {
39
40
  let r = t(e);
40
41
  return r ? new Intl.DateTimeFormat(void 0, {
41
42
  day: "2-digit",
@@ -43,25 +44,25 @@ function w(e, n) {
43
44
  year: "numeric"
44
45
  }).format(r) : n;
45
46
  }
46
- function T({ amount: t, currency: n, fallback: r }) {
47
+ function O({ amount: t, currency: n, fallback: r }) {
47
48
  return t == null || !n ? r : new Intl.NumberFormat(void 0, {
48
49
  currency: n,
49
50
  style: "currency"
50
51
  }).format(t / 10 ** e(n));
51
52
  }
52
- function E(t, n) {
53
+ function k(t, n) {
53
54
  let r = Number(t);
54
55
  if (!Number.isFinite(r)) return;
55
56
  let i = n ? e(n) : 2;
56
57
  return Math.round(r * 10 ** i);
57
58
  }
58
- function D(e, t) {
59
+ function A(e, t) {
59
60
  return e.document_id || t.untitledDocument;
60
61
  }
61
- function O(e, t) {
62
+ function j(e, t) {
62
63
  return e === "quote" ? t.quoteType : e === "credit_note" ? t.creditNoteType : t.invoiceType;
63
64
  }
64
- function k(e, t, n) {
65
+ function M(e, t, n) {
65
66
  let r = e.counterpart_name || (e.counterpart_id ? t.names.get(e.counterpart_id) : void 0);
66
67
  return r ? {
67
68
  customerLabel: r,
@@ -74,33 +75,62 @@ function k(e, t, n) {
74
75
  customerState: "missing"
75
76
  };
76
77
  }
77
- var A = {
78
+ function N(e, t = /* @__PURE__ */ new Date()) {
79
+ if (!e) return 0;
80
+ let n = new Date(e);
81
+ if (Number.isNaN(n.getTime())) return 0;
82
+ 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
+ return a > 0 ? a : 0;
84
+ }
85
+ function P(e, t, n) {
86
+ if (e.type !== "invoice" || e.status !== "draft") return {};
87
+ let r = N(e.due_date, n);
88
+ return r === 0 ? {} : { dueDateOverdueLabel: (r === 1 ? t.listDayOverdue : t.listDaysOverdue).replace("{days}", String(r)) };
89
+ }
90
+ var F = {
78
91
  names: /* @__PURE__ */ new Map(),
79
92
  isResolving: !1
80
93
  };
81
- function j({ receivables: e, messages: t, customerNames: n = A }) {
94
+ function I(e) {
95
+ return e?.isLoading ? { kind: "loading" } : e?.status ? {
96
+ kind: "chip",
97
+ ...e.status
98
+ } : { kind: "blank" };
99
+ }
100
+ function L(e, t, n) {
101
+ if (e.type !== "invoice" || e.status !== "recurring") return {};
102
+ let r = e.recurrence_id ? t.get(e.recurrence_id) : void 0;
103
+ return {
104
+ documentLabel: e.document_id || n.recurringNumber,
105
+ statusOverride: I(r),
106
+ showDocumentSyncIcon: !0
107
+ };
108
+ }
109
+ function R({ receivables: e, messages: t, customerNames: n = F, seriesStatuses: r = /* @__PURE__ */ new Map(), now: i = /* @__PURE__ */ new Date() }) {
82
110
  return e.map((e) => ({
83
111
  id: e.id,
84
112
  type: e.type,
85
113
  documentLabel: e.document_id || t.pendingValue,
86
- ...k(e, n, t),
114
+ ...M(e, n, t),
87
115
  status: e.status,
88
- issueDateLabel: w(e.issue_date, t.pendingValue),
89
- dueDateLabel: w(e.type === "invoice" ? e.due_date : void 0, t.pendingValue),
90
- totalLabel: T({
91
- amount: e.total_amount,
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({
120
+ amount: e.total_amount ?? 0,
92
121
  currency: e.currency,
93
122
  fallback: ""
94
- })
123
+ }),
124
+ ...L(e, r, t)
95
125
  }));
96
126
  }
97
- function M(e) {
127
+ function z(e) {
98
128
  if (e.memo || e.footer) return {
99
129
  opening: e.memo || void 0,
100
130
  closing: e.footer || void 0
101
131
  };
102
132
  }
103
- function N({ values: e, counterpart: t, addresses: n }) {
133
+ function B({ values: e, counterpart: t, addresses: n }) {
104
134
  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 || "";
105
135
  return {
106
136
  billingAddressId: i,
@@ -108,7 +138,7 @@ function N({ values: e, counterpart: t, addresses: n }) {
108
138
  shippingAddressId: a
109
139
  };
110
140
  }
111
- function P({ values: e, messages: t, willIssue: r = !1, hasStartedRecurrence: i = !1, canCreateCustomer: a = !0 }) {
141
+ function V({ values: e, messages: t, willIssue: r = !1, hasStartedRecurrence: i = !1, canCreateCustomer: a = !0 }) {
112
142
  let o = {}, s = a && !!e.customerName.trim();
113
143
  !e.customerId && !s && (o.customerId = t.customerRequired);
114
144
  let c = e.customerEmail.trim();
@@ -117,28 +147,28 @@ function P({ values: e, messages: t, willIssue: r = !1, hasStartedRecurrence: i
117
147
  currency: e.currency,
118
148
  messages: t,
119
149
  requireComplete: r || i
120
- }), f = l(u, S(e, t), (r || i) && e.lineItems.length === 0 ? t.lineItemsRequired : void 0);
121
- u && (o.lineItems = u), f && (o.lineItemsSummary = f);
122
- let p = x(e, t);
123
- return p && (o.discount = p), o;
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);
153
+ return m && (o.discount = m), o;
124
154
  }
125
- function F(e) {
155
+ function H(e) {
126
156
  return Object.keys(e).length > 0;
127
157
  }
128
- function I(e, t) {
129
- return !F(P({
130
- values: z(e),
158
+ function U(e, t) {
159
+ return !H(V({
160
+ values: K(e),
131
161
  messages: t,
132
162
  willIssue: !0
133
163
  }));
134
164
  }
135
- function L({ bankAccountId: e, bankAccountType: t }) {
165
+ function W({ bankAccountId: e, bankAccountType: t }) {
136
166
  return {
137
167
  bank_account_id: e || void 0,
138
168
  bank_account_type: e && t || void 0
139
169
  };
140
170
  }
141
- function R({ values: e, billingAddressId: t, shippingAddressId: n, unitNamesById: r }) {
171
+ function G({ values: e, billingAddressId: t, shippingAddressId: n, unitNamesById: r }) {
142
172
  let a = e.lineItems.filter((e) => !i(e)).map((t) => o({
143
173
  lineItem: t,
144
174
  currency: e.currency,
@@ -152,8 +182,8 @@ function R({ values: e, billingAddressId: t, shippingAddressId: n, unitNamesById
152
182
  line_items: a,
153
183
  memo: e.openingNote,
154
184
  footer: e.closingNote,
155
- discount: y(e) ?? void 0,
156
- ...L(e)
185
+ discount: b(e) ?? void 0,
186
+ ...W(e)
157
187
  };
158
188
  return e.type === "quote" ? {
159
189
  ...s,
@@ -161,7 +191,7 @@ function R({ values: e, billingAddressId: t, shippingAddressId: n, unitNamesById
161
191
  type: "quote"
162
192
  } : {
163
193
  ...s,
164
- ...h(e),
194
+ ...g(e),
165
195
  payment_reminder_id: e.paymentReminderId || void 0,
166
196
  overdue_reminder_id: e.overdueReminderId || void 0,
167
197
  purchase_order: e.purchaseOrder || void 0,
@@ -169,28 +199,28 @@ function R({ values: e, billingAddressId: t, shippingAddressId: n, unitNamesById
169
199
  type: "invoice"
170
200
  };
171
201
  }
172
- function z(e, t) {
202
+ function K(e, t) {
173
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({
174
204
  lineItem: n,
175
205
  currency: e.currency,
176
206
  units: t
177
207
  }));
178
208
  return {
179
- ...C(),
209
+ ...E(),
180
210
  type: n,
181
211
  customerId: e.counterpart_id,
182
212
  currency: e.currency,
183
- issueDate: W(e.issue_date),
184
- dueDate: e.type === "quote" ? W(e.expiry_date) : "",
213
+ issueDate: Z(e.issue_date),
214
+ dueDate: e.type === "quote" ? Z(e.expiry_date) : "",
185
215
  openingNote: e.memo ?? "",
186
216
  closingNote: e.footer ?? "",
187
- ...e.type === "invoice" ? _(e.payment_terms) : {},
217
+ ...e.type === "invoice" ? v(e.payment_terms) : {},
188
218
  taxRate: i,
189
219
  savedTaxRate: i,
190
- ...b(e.discount, e.currency),
220
+ ...x(e.discount, e.currency),
191
221
  lineItems: o.length > 0 ? o : [r(e.currency)],
192
222
  bankAccountId: e.bank_account_id ?? "",
193
- bankAccountType: B(e.bank_account_type),
223
+ bankAccountType: q(e.bank_account_type),
194
224
  billingAddressId: e.counterpart_billing_address?.id ?? "",
195
225
  shippingAddressId: e.counterpart_shipping_address?.id ?? "",
196
226
  paymentReminderId: a?.payment_reminder_id ?? "",
@@ -199,10 +229,10 @@ function z(e, t) {
199
229
  attachments: p(e)
200
230
  };
201
231
  }
202
- function B(e) {
232
+ function q(e) {
203
233
  return e === "BANK_DETAILS" || e === "INTERNAL" || e === "EXTERNAL" ? e : "";
204
234
  }
205
- function V({ values: e, billingAddressId: t, shippingAddressId: n, lineItemChanges: r }) {
235
+ function J({ values: e, billingAddressId: t, shippingAddressId: n, lineItemChanges: r }) {
206
236
  let i = {
207
237
  counterpart_billing_address_id: t || null,
208
238
  counterpart_shipping_address_id: n || null,
@@ -211,24 +241,24 @@ function V({ values: e, billingAddressId: t, shippingAddressId: n, lineItemChang
211
241
  issue_date: e.issueDate || void 0,
212
242
  memo: e.openingNote,
213
243
  footer: e.closingNote,
214
- discount: y(e),
215
- ...L(e)
244
+ discount: b(e),
245
+ ...W(e)
216
246
  };
217
247
  return e.type === "quote" ? { quote: {
218
248
  ...i,
219
249
  ...r ? { line_items: r } : {},
220
250
  expiry_date: e.dueDate || void 0,
221
- ...g(e)
251
+ ..._(e)
222
252
  } } : { invoice: {
223
253
  ...i,
224
254
  ...r ? { line_items: r } : {},
225
- ...g(e),
255
+ ..._(e),
226
256
  payment_reminder_id: e.paymentReminderId || null,
227
257
  overdue_reminder_id: e.overdueReminderId || null,
228
258
  attachments: f(e.attachments) ?? null
229
259
  } };
230
260
  }
231
- function H({ values: e, originalLineItems: t, originalCurrency: n, unitNamesById: r, units: o }) {
261
+ function Y({ values: e, originalLineItems: t, originalCurrency: n, unitNamesById: r, units: o }) {
232
262
  let l = u(t), d = a(e.taxRate, l), f = (e, t, n) => s({
233
263
  lineItem: e,
234
264
  currency: t,
@@ -254,7 +284,7 @@ function H({ values: e, originalLineItems: t, originalCurrency: n, unitNamesById
254
284
  ...v.length ? { remove: v } : {}
255
285
  };
256
286
  }
257
- function U({ values: e, originalLineItems: t, changes: n }) {
287
+ function X({ values: e, originalLineItems: t, changes: n }) {
258
288
  let r = e.lineItems.filter((e) => !i(e)).map((e) => e.id);
259
289
  if (!t) return { created: r };
260
290
  let a = new Set(t.map((e) => e.id));
@@ -263,8 +293,8 @@ function U({ values: e, originalLineItems: t, changes: n }) {
263
293
  replaced: n?.replace?.map((e) => e.id) ?? []
264
294
  };
265
295
  }
266
- function W(e) {
296
+ function Z(e) {
267
297
  return e?.slice(0, 10) ?? "";
268
298
  }
269
299
  //#endregion
270
- export { M as buildReceivableNotesView, j as buildReceivableRows, C as createEmptyReceivableFormValues, r as createLineItem, w as formatDate, T as formatMoney, E as fromMajorUnits, D as getDocumentTitle, O as getDocumentTypeLabel, F as hasReceivableFormErrors, I as isReceivableReadyToIssue, R as receivableFormValuesToCreatePayload, H as receivableFormValuesToLineItemChanges, V as receivableFormValuesToUpdatePayload, z as receivableToFormValues, N as resolveCounterpartAddresses, U as submittedLineItemRows, P as validateReceivableForm };
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 };
@@ -18,6 +18,7 @@ var e = {
18
18
  discountExceedsSubtotal: "Discount amount cannot exceed subtotal",
19
19
  invoiceSubtotalTooHigh: "Invoice subtotal must be {maxAmount} or less",
20
20
  invoiceTotalTooHigh: "Invoice total must be {maxAmount} or less",
21
+ invoiceTotalZero: "Invoice total must be greater than 0 to issue",
21
22
  paymentRecordAmountRequired: "Amount is required",
22
23
  paymentRecordAmountNegative: "Can't be a negative number",
23
24
  paymentRecordAmountZero: "Amount must be greater than 0",
@@ -45,6 +46,9 @@ var e = {
45
46
  bankAccountCreateFailed: "Failed to create Bank Account.",
46
47
  untitledDocument: "Untitled document",
47
48
  pendingValue: "Pending",
49
+ recurringNumber: "Recurring",
50
+ listDayOverdue: "{days} day overdue",
51
+ listDaysOverdue: "{days} days overdue",
48
52
  unknownCustomer: "-",
49
53
  notAvailable: "Not available",
50
54
  invoiceType: "Invoice",
@@ -60,6 +64,8 @@ var e = {
60
64
  detailsBalanceDue: "Balance due",
61
65
  detailsAmountReceived: "Amount received",
62
66
  detailsCancelledAmount: "Canceled amount",
67
+ detailsSendButton: "Send",
68
+ detailsResendButton: "Resend",
63
69
  detailsAmountWrittenOff: "Amount written off",
64
70
  detailsCancelledOnCaption: "Canceled on",
65
71
  detailsPending: "Pending",
@@ -112,23 +118,32 @@ var e = {
112
118
  declineDescription: "This marks the quote as declined.",
113
119
  declineConfirm: "Decline",
114
120
  issueFailed: "Failed to issue invoice. Add any missing information to your draft invoice and try again.",
121
+ unrecognizedError: "Unrecognized error. Please contact support.",
115
122
  sendNoEmail: "This customer has no email address. Add one in the customer details to send the invoice.",
116
123
  cancelTitle: "Cancel receivable?",
117
124
  cancelNumberedTitle: "Cancel receivable \"{number}\"?",
118
125
  cancelDescription: "This action can't be undone.",
119
126
  cancelConfirm: "Cancel",
120
127
  cancelClose: "Close",
128
+ cancelSucceeded: "This invoice has been canceled",
121
129
  cloneSuccess: "Invoice duplicate has been created.",
122
130
  cloneError: "Failed to duplicate invoice.",
123
- deleteTitle: "Delete draft?",
124
- deleteDescription: "This permanently deletes the draft document. You cannot undo this action.",
131
+ deleteTitle: "Delete receivable?",
132
+ deleteNumberedTitle: "Delete receivable “{number}”?",
133
+ deleteDescription: "This action can't be undone.",
125
134
  deleteConfirm: "Delete",
135
+ deleteSucceeded: "This invoice has been deleted",
126
136
  markPaidTitle: "Mark invoice as paid?",
127
137
  markPaidDescription: "This records the invoice as fully paid.",
128
138
  markPaidConfirm: "Mark paid",
129
139
  markUncollectibleTitle: "Mark invoice as uncollectible?",
130
140
  markUncollectibleDescription: "This invoice will change its status, and you won't be able to receive or log any payment against it.\n\nFor bookkeeping purposes, this is a write-off and has tax implications.",
131
141
  markUncollectibleConfirm: "Mark as uncollectible",
142
+ markUncollectibleSucceeded: "Marked as uncollectible",
143
+ createSucceeded: "Invoice to {customer} was created",
144
+ updateSucceeded: "Invoice has been updated",
145
+ recurrenceActivated: "Recurring billing activated",
146
+ recurrenceUpdated: "Recurring billing updated",
132
147
  cancelRecurrenceTitle: "Cancel Recurring Invoice",
133
148
  cancelRecurrenceQuestion: "Are you sure you want to cancel this recurring invoice?",
134
149
  cancelRecurrenceFutureIterations: "All future iterations of this invoice will be canceled.",
@@ -161,6 +176,8 @@ var e = {
161
176
  recurrenceFrequencyAnnually: "Annually",
162
177
  recurrenceFirstDay: "First day",
163
178
  recurrenceLastDay: "Last day",
179
+ recurrenceMonthDayTrail: "day of every month",
180
+ recurrenceMonthEdgeTrail: "of every month",
164
181
  recurrenceWeekdayMo: "Mo",
165
182
  recurrenceWeekdayTu: "Tu",
166
183
  recurrenceWeekdayWe: "We",
@@ -252,6 +269,7 @@ var e = {
252
269
  actionsSendSucceeded: "Invoice sent successfully",
253
270
  actionsSendFailed: "Failed to send invoice.",
254
271
  actionsSendWithoutPaymentLink: "You haven't onboarded for any payment method. Invoice is sent without a payment link.",
272
+ actionsSendWithoutPaymentLinkScope: "You don't have permission to create payment links. Invoice is sent without a payment link.",
255
273
  actionsTitleSent: "Invoice sent",
256
274
  actionsTitleIssued: "Invoice issued",
257
275
  actionsTitleRecurrence: "Recurring billing activated",
@@ -261,7 +279,7 @@ var e = {
261
279
  actionsDeselectAll: "Deselect all",
262
280
  actionsProductsSaved: "Products and services saved.",
263
281
  actionsProductsSaveFailed: "Failed to save products and services.",
264
- previewTaxId: "Tax: {taxId}",
282
+ previewTaxId: "Tax ID: {taxId}",
265
283
  previewTaxableYes: "Yes",
266
284
  previewTaxableNo: "No",
267
285
  previewSubtotal: "Subtotal",
@@ -2,8 +2,8 @@ import { RECEIVABLE_PAYMENT_TERMS_CUSTOM_DATE as e, RECEIVABLE_PAYMENT_TERMS_REC
2
2
  import "../../../../ui/dist/index.js";
3
3
  import { addDays as n, addYears as r, format as i, isValid as a, max as o, min as s, parseISO as c, subYears as l } from "date-fns";
4
4
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/paymentTerms.js
5
- var u = "MMM d, yyyy", d = "MMM dd, yyyy", f = "yyyy-MM-dd", p = 10, m = 5;
6
- function h(e) {
5
+ var u = "MMM d, yyyy", d = "yyyy-MM-dd", f = 10, p = 5;
6
+ function m(e) {
7
7
  let t = (e) => e ? {
8
8
  number_of_days: e.number_of_days ?? null,
9
9
  discount: e.discount ?? null
@@ -16,46 +16,46 @@ function h(e) {
16
16
  term_2: t(e.term_2)
17
17
  });
18
18
  }
19
- function g(e) {
19
+ function h(e) {
20
20
  let t = /* @__PURE__ */ new Set();
21
21
  return e.filter((e) => {
22
- let n = h(e);
22
+ let n = m(e);
23
23
  return !t.has(n) && (t.add(n), !0);
24
24
  });
25
25
  }
26
- function _(e) {
26
+ function g(e) {
27
27
  return i(e, u);
28
28
  }
29
- function v(e) {
30
- return i(e, d);
29
+ function _(e) {
30
+ return i(e, u);
31
31
  }
32
- function y(e, t) {
32
+ function v(e, t) {
33
33
  let r = e.term_final?.number_of_days;
34
34
  return r ? n(t, r) : void 0;
35
35
  }
36
- function b(e, t = /* @__PURE__ */ new Date()) {
36
+ function y(e, t = /* @__PURE__ */ new Date()) {
37
37
  let n = c(e);
38
38
  return a(n) ? n : t;
39
39
  }
40
- function x(e, t) {
41
- let n = y(e, t);
40
+ function b(e, t) {
41
+ let n = v(e, t);
42
42
  return {
43
43
  value: e.id,
44
44
  label: e.name,
45
- ...n ? { dueDateLabel: _(n) } : {}
45
+ ...n ? { dueDateLabel: g(n) } : {}
46
46
  };
47
47
  }
48
- function S(e) {
48
+ function x(e) {
49
49
  return e ? c(e) : void 0;
50
50
  }
51
- function C({ terms: e, isLoading: t, fields: n, customDatePickerOpen: r, isRecurring: i = !1, messages: a, issueDate: o = /* @__PURE__ */ new Date() }) {
51
+ function S({ terms: e, isLoading: t, fields: n, customDatePickerOpen: r, isRecurring: i = !1, messages: a, issueDate: o = /* @__PURE__ */ new Date() }) {
52
52
  if (t) return { kind: "loading" };
53
- let s = g(e ?? []).map((e) => x(e, o)), c = S(n.paymentTermsCustomDate), l;
53
+ let s = h(e ?? []).map((e) => b(e, o)), c = x(n.paymentTermsCustomDate), l;
54
54
  if (n.paymentTermsId === "receipt_due") l = { kind: "receiptDue" };
55
55
  else if (n.paymentTermsId === "custom") l = {
56
56
  kind: "customDate",
57
57
  hasDate: !!c,
58
- dateLabel: c ? _(c) : a.paymentTermsCustomDatePlaceholder
58
+ dateLabel: c ? g(c) : a.paymentTermsCustomDatePlaceholder
59
59
  };
60
60
  else {
61
61
  let e = s.find((e) => e.value === n.paymentTermsId);
@@ -74,15 +74,15 @@ function C({ terms: e, isLoading: t, fields: n, customDatePickerOpen: r, isRecur
74
74
  ...i ? { description: a.recurrenceSeriesPaymentTerms } : {}
75
75
  };
76
76
  }
77
- function w(e, t = /* @__PURE__ */ new Date()) {
78
- let n = S(e), i = l(t, p), a = r(t, m);
77
+ function C(e, t = /* @__PURE__ */ new Date()) {
78
+ let n = x(e), i = l(t, f), a = r(t, p);
79
79
  return {
80
80
  selected: n,
81
81
  startMonth: n ? s([i, n]) : i,
82
82
  endMonth: n ? o([a, n]) : a
83
83
  };
84
84
  }
85
- function T(e, t) {
85
+ function w(e, t) {
86
86
  return t === "custom" ? {
87
87
  paymentTermsId: t,
88
88
  paymentTermsCustomDate: e.paymentTermsId === "custom" ? e.paymentTermsCustomDate : ""
@@ -91,25 +91,25 @@ function T(e, t) {
91
91
  paymentTermsCustomDate: ""
92
92
  };
93
93
  }
94
- function E(e) {
94
+ function T(e) {
95
95
  return e.paymentTermsId === "custom" && !e.paymentTermsCustomDate ? {
96
96
  paymentTermsId: "",
97
97
  paymentTermsCustomDate: ""
98
98
  } : e;
99
99
  }
100
- function D(e) {
101
- return e ? i(e, f) : "";
100
+ function E(e) {
101
+ return e ? i(e, d) : "";
102
102
  }
103
- function O(e) {
103
+ function D(e) {
104
104
  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 } : {};
105
105
  }
106
- function k(e) {
107
- return e.paymentTermsId ? O(e) : {
106
+ function O(e) {
107
+ return e.paymentTermsId ? D(e) : {
108
108
  payment_terms_id: null,
109
109
  payment_terms: null
110
110
  };
111
111
  }
112
- function A(n) {
112
+ function k(n) {
113
113
  if (n?.id) return {
114
114
  paymentTermsId: n.id,
115
115
  paymentTermsCustomDate: ""
@@ -127,4 +127,4 @@ function A(n) {
127
127
  };
128
128
  }
129
129
  //#endregion
130
- export { w as buildCustomDateCalendar, O as buildPaymentTermsPayload, k as buildPaymentTermsUpdatePayload, C as buildPaymentTermsView, E as closeCustomDatePickerFields, g as dedupePaymentTerms, v as formatPreviewDate, _ as formatTermDate, A as paymentTermsToFormFields, b as resolveIssueDate, T as selectPaymentTermsFields, y as termDueDate, D as toCustomDateValue };
130
+ export { C as buildCustomDateCalendar, D as buildPaymentTermsPayload, O as buildPaymentTermsUpdatePayload, S as buildPaymentTermsView, T as closeCustomDatePickerFields, h as dedupePaymentTerms, _ as formatPreviewDate, g as formatTermDate, k as paymentTermsToFormFields, y as resolveIssueDate, w as selectPaymentTermsFields, v as termDueDate, E as toCustomDateValue };
@@ -284,7 +284,8 @@ function B({ fields: e, errors: t, lockSchedule: n, messages: r, today: i = /* @
284
284
  dayOptions: Array.from({ length: 31 }, (e, t) => ({
285
285
  value: String(t + 1),
286
286
  label: L(t + 1)
287
- }))
287
+ })),
288
+ trailLabel: e.recurrenceIssueMode === "first_day" || e.recurrenceIssueMode === "last_day" ? r.recurrenceMonthEdgeTrail : r.recurrenceMonthDayTrail
288
289
  }), a === "week") {
289
290
  let i = {
290
291
  mo: r.recurrenceWeekdayMo,
@@ -93,7 +93,7 @@ function C({ terms: e, dueDate: t, messages: n }) {
93
93
  };
94
94
  }
95
95
  function w(e) {
96
- return !!(e.paymentTermsId || e.paymentReminderId || e.overdueReminderId);
96
+ return !!(e.paymentReminderId || e.overdueReminderId);
97
97
  }
98
98
  function T({ showReminders: e, paymentTermsId: t, paymentTermsCustomDate: n, paymentReminderId: a, overdueReminderId: o, paymentReminders: s, overdueReminders: c, canCreate: l, disabled: u, beforeDueInput: p, overdueTerms: g, isCreatingPaymentReminder: _, isCreatingOverdueReminder: v, today: S, messages: C }) {
99
99
  let w = {
@@ -94,6 +94,9 @@ function _(e, n) {
94
94
  if (a > 9e15) return n.invoiceTotalTooHigh.replace("{maxAmount}", s);
95
95
  }
96
96
  function v(e, t) {
97
+ return h(e).total > 0 ? void 0 : t.invoiceTotalZero;
98
+ }
99
+ function y(e, t) {
97
100
  let n = e.formatToParts(t), r = (e) => e.type !== "currency" && e.type !== "literal", i = n.findIndex(r);
98
101
  if (i === -1) return e.format(t);
99
102
  let a = n.length - 1;
@@ -101,23 +104,23 @@ function v(e, t) {
101
104
  let o = (e) => e.map((e) => e.value).join("");
102
105
  return `${o(n.slice(0, i))}(${o(n.slice(i, a + 1))})${o(n.slice(a + 1))}`;
103
106
  }
104
- function y(t, n, r = !1) {
107
+ function b(t, n, r = !1) {
105
108
  let i = new Intl.NumberFormat(void 0, {
106
109
  style: "currency",
107
110
  currency: n,
108
111
  currencyDisplay: "narrowSymbol"
109
112
  }), a = t / 10 ** e(n);
110
- return r ? v(i, a) : i.format(a);
113
+ return r ? y(i, a) : i.format(a);
111
114
  }
112
- function b(e, t) {
115
+ function x(e, t) {
113
116
  return {
114
- subtotal: y(e.subtotal, t),
115
- discount: e.discountAmount > 0 ? y(e.discountAmount, t, !0) : y(0, t),
116
- nonTaxableSubtotal: y(e.nonTaxableSubtotal, t),
117
- taxableSubtotal: y(e.taxableSubtotal, t),
118
- tax: y(e.totalTaxes, t),
119
- total: y(e.total, t)
117
+ subtotal: b(e.subtotal, t),
118
+ discount: e.discountAmount > 0 ? b(e.discountAmount, t, !0) : b(0, t),
119
+ nonTaxableSubtotal: b(e.nonTaxableSubtotal, t),
120
+ taxableSubtotal: b(e.taxableSubtotal, t),
121
+ tax: b(e.totalTaxes, t),
122
+ total: b(e.total, t)
120
123
  };
121
124
  }
122
125
  //#endregion
123
- export { c as FULL_PERCENT_MINOR_UNITS, f as allocateDiscount, v as bracketAmount, b as buildFormTotalsView, h as calculateFormTotals, m as calculateInvoiceTotals, u as calculateItemsSubtotals, d as resolveDiscountAmount, g as validateDiscount, _ as validateInvoiceTotals };
126
+ export { c as FULL_PERCENT_MINOR_UNITS, f as allocateDiscount, y as bracketAmount, x as buildFormTotalsView, h as calculateFormTotals, m as calculateInvoiceTotals, u as calculateItemsSubtotals, d as resolveDiscountAmount, g as validateDiscount, _ as validateInvoiceTotals, v as validateIssuableTotal };