@tesouro/embedded-components-react 0.11.206 → 0.11.211

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 (89) hide show
  1. package/dist/index.css +13 -126
  2. package/dist/index.d.ts +6 -5
  3. package/dist/lib/ReceivablesWidget.d.ts +6 -5
  4. package/dist/lib/WidgetSuite.d.ts +6 -5
  5. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivableAttachmentsSection.js +1 -1
  6. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivableCustomerSection.js +1 -1
  7. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +16 -18
  8. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/details.js +186 -239
  9. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/helpers.js +59 -52
  10. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/labels.js +5 -4
  11. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/paymentRecord.js +5 -5
  12. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/paymentTerms.js +1 -1
  13. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/preview.js +1 -1
  14. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/recurrence.js +1 -1
  15. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/recurringSeries.js +19 -23
  16. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/reminders.js +1 -1
  17. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/statusColors.js +34 -0
  18. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActions.js +2 -6
  19. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActionsModal.js +5 -1
  20. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableDetails.js +16 -16
  21. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableForm.js +1 -1
  22. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablePaymentRecord.js +1 -2
  23. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesTable.js +2 -0
  24. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +28 -27
  25. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index11.js +18 -120
  26. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index12.js +89 -84
  27. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +91 -36
  28. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index14.js +41 -2
  29. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index15.js +2 -12
  30. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index16.js +9 -9
  31. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index17.js +9 -25
  32. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index18.js +26 -208
  33. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index19.js +209 -52
  34. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index20.js +50 -208
  35. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index21.js +186 -138
  36. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index22.js +157 -12
  37. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index23.js +10 -19
  38. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index24.js +23 -2
  39. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index25.js +2 -116
  40. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index26.js +117 -3
  41. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index27.js +3 -198
  42. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index28.js +198 -2
  43. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index29.js +2 -54
  44. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index30.js +14 -19
  45. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index31.js +22 -8
  46. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index32.js +40 -77
  47. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index33.js +17 -37
  48. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index34.js +8 -18
  49. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index35.js +61 -38
  50. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index36.js +27 -27
  51. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index37.js +26 -15
  52. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index38.js +14 -6
  53. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index39.js +19 -35
  54. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index40.js +31 -14
  55. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index41.js +67 -24
  56. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index42.js +391 -84
  57. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index43.js +2 -494
  58. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index44.js +47 -2
  59. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index45.js +62 -38
  60. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index46.js +433 -61
  61. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index47.js +176 -428
  62. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index48.js +20 -224
  63. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index49.js +6 -21
  64. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index51.js +264 -0
  65. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index52.js +2 -264
  66. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index53.js +131 -2
  67. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index54.js +22 -126
  68. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index55.js +235 -23
  69. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index56.js +3 -239
  70. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index57.js +247 -3
  71. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index58.js +26 -244
  72. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index59.js +183 -26
  73. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index60.js +21 -194
  74. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index61.js +143 -21
  75. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index62.js +2 -143
  76. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index63.js +47 -2
  77. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index16.js +47 -48
  78. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index17.js +127 -144
  79. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index3.js +0 -3
  80. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index16.js +107 -111
  81. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index5.js +1 -1
  82. package/dist/libs/tesouro-embedded-components-react/shared/document-status/ui/dist/index.js +2 -2
  83. package/dist/libs/tesouro-embedded-components-react/shared/document-status/ui/dist/index7.js +2 -31
  84. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  85. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/helpers.js +1 -1
  86. package/dist/packages/shared-ui-shadcn/dist/index.js +1554 -1544
  87. package/package.json +1 -1
  88. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index50.js +0 -7
  89. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index64.js +0 -47
@@ -7,26 +7,27 @@ import { isEmail as i } from "../../../../../../shared/util-validation/dist/inde
7
7
  import { createLineItem as a, isBlankLineItem as o, keepsSavedTaxRates as s, lineItemToCreatePayload as c, lineItemToUpdatePayload as l, responseLineItemToFormValues as u, summarizeLineItemErrors as d, taxRateFromLineItems as f, validateLineItems as p } from "./lineItems.js";
8
8
  import { attachmentFormValuesToPayload as m, receivableToAttachmentFormValues as h } from "./attachments.js";
9
9
  import { createEmptyRecurrenceFields as g, willRecurrenceIssue as _ } from "./recurrence.js";
10
- import { buildPaymentTermsPayload as v, buildPaymentTermsUpdatePayload as y, paymentTermsToFormFields as ee } from "./paymentTerms.js";
11
- import { createEmptyDiscount as b, discountFromDraft as x, discountToDraft as S } from "./discount.js";
12
- import { validateDiscount as C, validateInvoiceTotals as w, validateIssuableTotal as T } from "./totals.js";
13
- import { differenceInCalendarDays as E, format as D } from "date-fns";
10
+ import { buildPaymentTermsPayload as v, buildPaymentTermsUpdatePayload as y, paymentTermsToFormFields as b } from "./paymentTerms.js";
11
+ import { createEmptyDiscount as x, discountFromDraft as S, discountToDraft as C } from "./discount.js";
12
+ import { validateDiscount as w, validateInvoiceTotals as T, validateIssuableTotal as E } from "./totals.js";
13
+ import { receivableStatusColor as D } from "./statusColors.js";
14
+ import { format as O } from "date-fns";
14
15
  // ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/helpers.js
15
- function O() {
16
+ function k() {
16
17
  return {
17
18
  type: "invoice",
18
19
  customerId: "",
19
20
  customerName: "",
20
21
  customerEmail: "",
21
22
  currency: "USD",
22
- issueDate: D(/* @__PURE__ */ new Date(), "yyyy-MM-dd"),
23
+ issueDate: O(/* @__PURE__ */ new Date(), "yyyy-MM-dd"),
23
24
  dueDate: "",
24
25
  openingNote: "",
25
26
  closingNote: "",
26
27
  paymentTermsId: "",
27
28
  paymentTermsCustomDate: "",
28
29
  taxRate: "",
29
- ...b("USD"),
30
+ ...x("USD"),
30
31
  lineItems: [a()],
31
32
  bankAccountId: "",
32
33
  bankAccountType: "",
@@ -39,27 +40,27 @@ function O() {
39
40
  ...g()
40
41
  };
41
42
  }
42
- function k(e, t) {
43
+ function A(e, t) {
43
44
  let r = n(e);
44
45
  return r ? new Intl.DateTimeFormat(void 0, {
45
- day: "2-digit",
46
+ day: "numeric",
46
47
  month: "short",
47
48
  year: "numeric"
48
49
  }).format(r) : t;
49
50
  }
50
- function A({ amount: n, currency: r, fallback: i }) {
51
+ function j({ amount: n, currency: r, fallback: i }) {
51
52
  return n == null || !r ? i : e(r).format(n / 10 ** t(r));
52
53
  }
53
- function j(e, n) {
54
+ function M(e, n) {
54
55
  let r = Number(e);
55
56
  if (!Number.isFinite(r)) return;
56
57
  let i = n ? t(n) : 2;
57
58
  return Math.round(r * 10 ** i);
58
59
  }
59
- function M(e, t) {
60
+ function N(e, t) {
60
61
  return e.document_id || t.untitledDocument;
61
62
  }
62
- function N(e, t) {
63
+ function ee(e, t) {
63
64
  return e === "quote" ? t.quoteType : e === "credit_note" ? t.creditNoteType : t.invoiceType;
64
65
  }
65
66
  function P(e, t, n) {
@@ -75,38 +76,42 @@ function P(e, t, n) {
75
76
  customerState: "missing"
76
77
  };
77
78
  }
78
- function F(e, t) {
79
- let r = n(e);
80
- return r ? E(r, t) : void 0;
81
- }
82
- function I(e, t = /* @__PURE__ */ new Date()) {
83
- let n = F(e, t) ?? 0;
84
- return n < 0 ? -n : 0;
85
- }
86
- var L = /* @__PURE__ */ new Set([
79
+ var F = /* @__PURE__ */ new Set([
87
80
  "issued",
88
81
  "partially_paid",
89
82
  "overdue"
90
83
  ]);
91
- function R(e, t, n) {
92
- let i = e.type === "invoice" ? e.due_date : null, { label: a, overdueLabel: o, accessibleLabel: s } = r({
93
- dueDate: i,
94
- dateLabel: k(i, t.pendingValue),
95
- today: D(n, "yyyy-MM-dd"),
96
- isUnpaid: L.has(e.status),
84
+ function I(e, t) {
85
+ return Object.hasOwn(t, e) ? t[e] : t.unknown;
86
+ }
87
+ function L({ dueDate: e, status: t, dateLabel: n, messages: i, now: a }) {
88
+ return r({
89
+ dueDate: e,
90
+ dateLabel: n,
91
+ today: O(a, "yyyy-MM-dd"),
92
+ isUnpaid: F.has(t),
97
93
  labels: {
98
- today: t.listDueToday,
99
- tomorrow: t.listDueTomorrow,
100
- dayOverdue: t.listDayOverdue,
101
- daysOverdue: t.listDaysOverdue,
102
- overdueAccessibleName: t.listOverdueAccessibleName
94
+ today: i.listDueToday,
95
+ tomorrow: i.listDueTomorrow,
96
+ dayOverdue: i.listDayOverdue,
97
+ daysOverdue: i.listDaysOverdue,
98
+ overdueAccessibleName: i.listOverdueAccessibleName
103
99
  }
104
100
  });
105
- return o ? {
106
- dueDateLabel: a,
107
- dueDateOverdueLabel: o,
108
- dueDateAccessibleLabel: s
109
- } : { dueDateLabel: a };
101
+ }
102
+ function R(e, t, n) {
103
+ let r = e.type === "invoice" ? e.due_date : null, { label: i, overdueLabel: a, accessibleLabel: o } = L({
104
+ dueDate: r,
105
+ status: e.status,
106
+ dateLabel: A(r, t.pendingValue),
107
+ messages: t,
108
+ now: n
109
+ });
110
+ return a ? {
111
+ dueDateLabel: i,
112
+ dueDateOverdueLabel: a,
113
+ dueDateAccessibleLabel: o
114
+ } : { dueDateLabel: i };
110
115
  }
111
116
  var z = {
112
117
  names: /* @__PURE__ */ new Map(),
@@ -115,21 +120,23 @@ var z = {
115
120
  function B(e, t) {
116
121
  return e.type !== "invoice" || !e.recurrence_id ? {} : { recurringBadgeLabel: t.listRecurringBadge };
117
122
  }
118
- function V({ receivables: e, messages: t, customerNames: n = z, now: r = /* @__PURE__ */ new Date() }) {
123
+ function V({ receivables: e, messages: t, statusLabels: n, customerNames: r = z, now: i = /* @__PURE__ */ new Date() }) {
119
124
  return e.map((e) => ({
120
125
  id: e.id,
121
126
  type: e.type,
122
127
  documentLabel: e.document_id || t.pendingValue,
123
- ...P(e, n, t),
128
+ ...P(e, r, t),
124
129
  status: e.status,
125
- issueDateLabel: k(e.issue_date, t.pendingValue),
126
- ...R(e, t, r),
127
- balanceDueLabel: A({
130
+ statusLabel: I(e.status, n),
131
+ statusColor: D(e.status),
132
+ issueDateLabel: A(e.issue_date, t.pendingValue),
133
+ ...R(e, t, i),
134
+ balanceDueLabel: j({
128
135
  amount: "amount_due" in e ? e.amount_due ?? 0 : 0,
129
136
  currency: e.currency,
130
137
  fallback: ""
131
138
  }),
132
- totalLabel: A({
139
+ totalLabel: j({
133
140
  amount: e.total_amount ?? 0,
134
141
  currency: e.currency,
135
142
  fallback: ""
@@ -160,9 +167,9 @@ function W({ values: e, messages: t, willIssue: n = !1, hasStartedRecurrence: r
160
167
  currency: e.currency,
161
168
  messages: t,
162
169
  requireComplete: n || r
163
- }), u = (n || r && _(e)) && !l && e.lineItems.length > 0 ? T(e, t) : void 0, f = d(l, w(e, t) ?? u, (n || r) && e.lineItems.length === 0 ? t.lineItemsRequired : void 0);
170
+ }), u = (n || r && _(e)) && !l && e.lineItems.length > 0 ? E(e, t) : void 0, f = d(l, T(e, t) ?? u, (n || r) && e.lineItems.length === 0 ? t.lineItemsRequired : void 0);
164
171
  l && (o.lineItems = l), f && (o.lineItemsSummary = f);
165
- let m = C(e, t);
172
+ let m = w(e, t);
166
173
  return m && (o.discount = m), o;
167
174
  }
168
175
  function G(e) {
@@ -195,7 +202,7 @@ function J({ values: e, billingAddressId: t, shippingAddressId: n, unitNamesById
195
202
  line_items: i,
196
203
  memo: e.openingNote,
197
204
  footer: e.closingNote,
198
- discount: x(e) ?? void 0,
205
+ discount: S(e) ?? void 0,
199
206
  ...q(e)
200
207
  };
201
208
  return e.type === "quote" ? {
@@ -219,7 +226,7 @@ function Y(e, t) {
219
226
  units: t
220
227
  }));
221
228
  return {
222
- ...O(),
229
+ ...k(),
223
230
  type: n,
224
231
  customerId: e.counterpart_id,
225
232
  currency: e.currency,
@@ -227,10 +234,10 @@ function Y(e, t) {
227
234
  dueDate: e.type === "quote" ? $(e.expiry_date) : "",
228
235
  openingNote: e.memo ?? "",
229
236
  closingNote: e.footer ?? "",
230
- ...e.type === "invoice" ? ee(e.payment_terms) : {},
237
+ ...e.type === "invoice" ? b(e.payment_terms) : {},
231
238
  taxRate: r,
232
239
  savedTaxRate: r,
233
- ...S(e.discount, e.currency),
240
+ ...C(e.discount, e.currency),
234
241
  lineItems: o.length > 0 ? o : [a(e.currency)],
235
242
  bankAccountId: e.bank_account_id ?? "",
236
243
  bankAccountType: X(e.bank_account_type),
@@ -254,7 +261,7 @@ function Z({ values: e, billingAddressId: t, shippingAddressId: n, lineItemChang
254
261
  issue_date: e.issueDate || void 0,
255
262
  memo: e.openingNote,
256
263
  footer: e.closingNote,
257
- discount: x(e),
264
+ discount: S(e),
258
265
  ...q(e)
259
266
  };
260
267
  return e.type === "quote" ? { quote: {
@@ -309,4 +316,4 @@ function te({ values: e, originalLineItems: t, changes: n }) {
309
316
  function $(e) {
310
317
  return e?.slice(0, 10) ?? "";
311
318
  }
312
- export { H as buildReceivableNotesView, V as buildReceivableRows, O as createEmptyReceivableFormValues, a as createLineItem, k as formatDate, A as formatMoney, j as fromMajorUnits, I as getDaysOverdue, M as getDocumentTitle, N as getDocumentTypeLabel, G as hasReceivableFormErrors, K as isReceivableReadyToIssue, J as receivableFormValuesToCreatePayload, Q as receivableFormValuesToLineItemChanges, Z as receivableFormValuesToUpdatePayload, Y as receivableToFormValues, U as resolveCounterpartAddresses, P as resolveCustomer, te as submittedLineItemRows, W as validateReceivableForm };
319
+ export { H as buildReceivableNotesView, V as buildReceivableRows, k as createEmptyReceivableFormValues, a as createLineItem, A as formatDate, j as formatMoney, M as fromMajorUnits, N as getDocumentTitle, ee as getDocumentTypeLabel, G as hasReceivableFormErrors, K as isReceivableReadyToIssue, I as receivableBadgeLabel, J as receivableFormValuesToCreatePayload, Q as receivableFormValuesToLineItemChanges, Z as receivableFormValuesToUpdatePayload, Y as receivableToFormValues, U as resolveCounterpartAddresses, P as resolveCustomer, L as resolveReceivableDueDate, te as submittedLineItemRows, W as validateReceivableForm };
@@ -24,9 +24,8 @@ var e = {
24
24
  paymentRecordAmountZero: "Amount must be greater than 0",
25
25
  paymentRecordDateRequired: "Date is required",
26
26
  paymentRecordTimeRequired: "Time is required",
27
- paymentRecordFrom: "from {name}",
28
- paymentRecordCreated: "Payment record was created",
29
- paymentRecordCreateFailed: "Failed to create payment record: {errorMessage}",
27
+ paymentRecordCreated: "Payment recorded",
28
+ paymentRecordCreateFailed: "Couldn't record the payment: {errorMessage}",
30
29
  genericError: "Something went wrong. Please try again.",
31
30
  lineItemsLoading: "Please wait for invoice details to finish loading.",
32
31
  paymentTermsCustomDatePlaceholder: "Mon DD, YYYY",
@@ -80,7 +79,8 @@ var e = {
80
79
  detailsNotFoundTitle: "Invoice not found",
81
80
  detailsNotFoundDescription: "There is no invoice for the provided id: {invoiceId}",
82
81
  detailsInvoiceSubtitle: "Invoice: {number}",
83
- detailsDaysOverdue: "{days} days overdue",
82
+ detailsDraftDescription: "Draft invoice",
83
+ detailsOverdueDueDate: "{date} · {overdue}",
84
84
  detailsInvoiceAmount: "Invoice amount",
85
85
  detailsBalanceDue: "Balance due",
86
86
  detailsAmountReceived: "Amount received",
@@ -288,6 +288,7 @@ var e = {
288
288
  unknownError: "Unknown",
289
289
  apiErrorsSummary: "{message} (+{count} more)",
290
290
  actionsIssueTitle: "Invoice issued. Send a copy to {name}?",
291
+ actionsStepLabel: "Step {current} of {total}",
291
292
  actionsResendTitle: "Send a copy to {name}?",
292
293
  actionsIssueDismiss: "Skip",
293
294
  actionsResendDismiss: "Cancel",
@@ -45,26 +45,26 @@ function f({ invoice: e, values: t, entityUserId: n }) {
45
45
  status: "succeeded"
46
46
  };
47
47
  }
48
- function p({ invoice: e, values: t, user: n, isUserLoading: o, messages: s }) {
49
- let c = `${n?.first_name ?? ""} ${n?.last_name ?? ""}`.trim();
48
+ function p({ invoice: e, values: t, user: n, isUserLoading: o }) {
49
+ let s = `${n?.first_name ?? ""} ${n?.last_name ?? ""}`.trim();
50
50
  return {
51
51
  amountLabel: r({
52
52
  amount: i(t.amount, e.currency) ?? 0,
53
53
  currency: e.currency,
54
54
  fallback: a
55
55
  }),
56
- fromLabel: s.paymentRecordFrom.replace("{name}", e.counterpart_name ?? ""),
56
+ fromLabel: e.counterpart_name ?? a,
57
57
  receivedLabel: t.paymentDate ? new Intl.DateTimeFormat(void 0, {
58
58
  year: "numeric",
59
59
  month: "short",
60
- day: "2-digit",
60
+ day: "numeric",
61
61
  hour: "2-digit",
62
62
  minute: "2-digit",
63
63
  timeZone: "UTC",
64
64
  timeZoneName: "short"
65
65
  }).format(d(t)) : a,
66
66
  referenceLabel: e.id || a,
67
- createdByLabel: c || a,
67
+ createdByLabel: s || a,
68
68
  isCreatedByLoading: o
69
69
  };
70
70
  }
@@ -1,4 +1,4 @@
1
- import { RECEIVABLE_PAYMENT_TERMS_CUSTOM_DATE as e, RECEIVABLE_PAYMENT_TERMS_RECEIPT_DUE as t } from "../../../../ui/dist/index24.js";
1
+ import { RECEIVABLE_PAYMENT_TERMS_CUSTOM_DATE as e, RECEIVABLE_PAYMENT_TERMS_RECEIPT_DUE as t } from "../../../../ui/dist/index25.js";
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
  // ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/paymentTerms.js
@@ -1,7 +1,7 @@
1
1
  import { createCurrencyFormatter as e } from "../../../../../shared/util/dist/lib/createCurrencyFormatter.js";
2
2
  import { minorExponentForCurrency as t } from "../../../../../shared/util/dist/lib/amountOutputToMajorUnits.js";
3
3
  import "../../../../../shared/util/dist/index.js";
4
- import "../../../../ui/dist/index24.js";
4
+ import "../../../../ui/dist/index25.js";
5
5
  import "../../../../ui/dist/index.js";
6
6
  import { isBlankLineItem as n, keepsSavedTaxRates as r, lineItemTaxRateMinorUnits as i, parseQuantity as a, priceInputToMinorUnits as o, taxRateToMinorUnits as s } from "./lineItems.js";
7
7
  import { formatPreviewDate as c, resolveIssueDate as l, termDueDate as u } from "./paymentTerms.js";
@@ -1,5 +1,5 @@
1
1
  import { isEmail as e } from "../../../../../../shared/util-validation/dist/index5.js";
2
- import { RECEIVABLE_PAYMENT_TERMS_RECEIPT_DUE as t } from "../../../../ui/dist/index24.js";
2
+ import { RECEIVABLE_PAYMENT_TERMS_RECEIPT_DUE as t } from "../../../../ui/dist/index25.js";
3
3
  import "../../../../ui/dist/index.js";
4
4
  import { addDays as n, format as r, max as i, parseISO as a, startOfDay as o } from "date-fns";
5
5
  // ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/recurrence.js
@@ -3,37 +3,33 @@ import "../../../../../shared/util/dist/index.js";
3
3
  import { InvoicesFilterField as t } from "../../../../ui/dist/index3.js";
4
4
  import "../../../../ui/dist/index.js";
5
5
  import { ordinalDay as n } from "./recurrence.js";
6
- import { formatDate as r, formatMoney as i, resolveCustomer as a } from "./helpers.js";
7
- import { frequencyLabel as o, seriesStatusLabel as s } from "./details.js";
8
- import { buildInvoicesFilterQuery as c } from "./invoicesFilter.js";
6
+ import { SERIES_STATUS_COLOR as r } from "./statusColors.js";
7
+ import { formatDate as i, formatMoney as a, resolveCustomer as o } from "./helpers.js";
8
+ import { frequencyLabel as s, seriesStatusLabel as c } from "./details.js";
9
+ import { buildInvoicesFilterQuery as l } from "./invoicesFilter.js";
9
10
  // ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/recurringSeries.js
10
- var l = [
11
+ var u = [
11
12
  t.Status,
12
13
  t.Amount,
13
14
  t.Customer
14
- ], u = [
15
+ ], d = [
15
16
  "active",
16
17
  "paused",
17
18
  "canceled",
18
19
  "completed"
19
- ], d = {
20
- active: "info",
21
- paused: "warning",
22
- canceled: "destructive",
23
- completed: "success"
24
- };
20
+ ];
25
21
  function f(e) {
26
- return Object.fromEntries(u.map((t) => [t, s(t, e)]));
22
+ return Object.fromEntries(d.map((t) => [t, c(t, e)]));
27
23
  }
28
24
  function p(e) {
29
- return u.map((t) => ({
25
+ return d.map((t) => ({
30
26
  value: t,
31
- label: s(t, e)
27
+ label: c(t, e)
32
28
  }));
33
29
  }
34
30
  function m(e, t) {
35
31
  let n = {
36
- ...c({
32
+ ...l({
37
33
  ...e,
38
34
  statuses: []
39
35
  }),
@@ -67,7 +63,7 @@ function g(t, r) {
67
63
  return o.every(h) && o.some((e) => e.getDate() > a) ? r.listSeriesLastDay : n(a);
68
64
  }
69
65
  function _(e, t) {
70
- let n = o(e, t);
66
+ let n = s(e, t);
71
67
  if (e.frequency !== "month") return n;
72
68
  let r = g(e, t);
73
69
  return r ? t.listSeriesMonthDay.replace("{cadence}", n).replace("{day}", r) : n;
@@ -78,7 +74,7 @@ function v(e) {
78
74
  function y(e, t) {
79
75
  if (!e) return { nextInvoiceLabel: t.listSeriesNoValue };
80
76
  let n = v(e);
81
- return n ? { nextInvoiceLabel: r(n, t.listSeriesNoValue) } : {
77
+ return n ? { nextInvoiceLabel: i(n, t.listSeriesNoValue) } : {
82
78
  nextInvoiceLabel: t.listSeriesNoNextInvoice,
83
79
  nextInvoiceMuted: !0
84
80
  };
@@ -86,20 +82,20 @@ function y(e, t) {
86
82
  function b(e, t, n) {
87
83
  return e ? {
88
84
  kind: "badge",
89
- label: s(e.status, n),
90
- tone: d[e.status] ?? "neutral"
85
+ label: c(e.status, n),
86
+ color: r[e.status] ?? "neutral"
91
87
  } : t ? { kind: "loading" } : { kind: "blank" };
92
88
  }
93
- function x({ receivables: e, recurrences: t, isRecurrencesLoading: n, messages: r, customerNames: o }) {
89
+ function x({ receivables: e, recurrences: t, isRecurrencesLoading: n, messages: r, customerNames: i }) {
94
90
  return e.map((e) => {
95
91
  let s = e.type === "invoice" && e.recurrence_id ? t.get(e.recurrence_id) : void 0;
96
92
  return {
97
93
  id: e.id,
98
- ...a(e, o, r),
94
+ ...o(e, i, r),
99
95
  repeatsLabel: s ? _(s, r) : r.listSeriesNoValue,
100
96
  ...y(s, r),
101
97
  status: b(s, n, r),
102
- amountLabel: i({
98
+ amountLabel: a({
103
99
  amount: e.total_amount ?? 0,
104
100
  currency: e.currency,
105
101
  fallback: ""
@@ -107,4 +103,4 @@ function x({ receivables: e, recurrences: t, isRecurrencesLoading: n, messages:
107
103
  };
108
104
  });
109
105
  }
110
- export { l as SERIES_FILTER_FIELDS, x as buildRecurringSeriesRows, m as buildSeriesFilterQuery, f as buildSeriesStatusLabels, p as buildSeriesStatusOptions };
106
+ export { u as SERIES_FILTER_FIELDS, x as buildRecurringSeriesRows, m as buildSeriesFilterQuery, f as buildSeriesStatusLabels, p as buildSeriesStatusOptions };
@@ -3,7 +3,7 @@ import { Scope as t } from "../../../../../shared/data-access/dist/lib/scopes.js
3
3
  import "../../../../../shared/data-access/dist/index.js";
4
4
  import { getCounterpartEmail as n } from "../../../../../shared/counterpart-management/feature/dist/lib/helpers.js";
5
5
  import "../../../../../shared/counterpart-management/feature/dist/index.js";
6
- import { RECEIVABLE_PAYMENT_TERMS_RECEIPT_DUE as r } from "../../../../ui/dist/index24.js";
6
+ import { RECEIVABLE_PAYMENT_TERMS_RECEIPT_DUE as r } from "../../../../ui/dist/index25.js";
7
7
  import "../../../../ui/dist/index.js";
8
8
  // ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/reminders.js
9
9
  var i = 1e4, a = 864e5;
@@ -0,0 +1,34 @@
1
+ // ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/statusColors.js
2
+ var e = {
3
+ draft: "neutral",
4
+ recurring: "neutral",
5
+ issuing: "info",
6
+ issued: "info",
7
+ partially_paid: "violet",
8
+ overdue: "destructive",
9
+ paid: "success",
10
+ accepted: "success",
11
+ failed: "destructive",
12
+ declined: "destructive",
13
+ expired: "neutral",
14
+ uncollectible: "neutral",
15
+ canceled: "neutral",
16
+ deleted: "neutral"
17
+ };
18
+ function t(t) {
19
+ return Object.hasOwn(e, t) ? e[t] : "neutral";
20
+ }
21
+ var n = {
22
+ active: "info",
23
+ paused: "warning",
24
+ canceled: "neutral",
25
+ completed: "success"
26
+ }, r = {
27
+ pending: "cyan",
28
+ skipped: "neutral",
29
+ canceled: "neutral",
30
+ issue_failed: "destructive",
31
+ send_failed: "destructive",
32
+ completed: "success"
33
+ };
34
+ export { r as ITERATION_STATUS_COLOR, n as SERIES_STATUS_COLOR, t as receivableStatusColor };
@@ -237,7 +237,6 @@ function oe({ action: e, description: t, title: n }, r) {
237
237
  description: t ?? [],
238
238
  confirmLabel: r.cancelRecurrenceConfirm,
239
239
  cancelLabel: r.cancelRecurrenceClose,
240
- cancelVariant: "outline",
241
240
  destructive: !0
242
241
  } : e === "accept" ? {
243
242
  title: r.acceptTitle,
@@ -246,20 +245,17 @@ function oe({ action: e, description: t, title: n }, r) {
246
245
  } : e === "decline" ? {
247
246
  title: r.declineTitle,
248
247
  description: r.declineDescription,
249
- confirmLabel: r.declineConfirm,
250
- destructive: !0
248
+ confirmLabel: r.declineConfirm
251
249
  } : e === "cancel" ? {
252
250
  title: n && n !== r.untitledDocument ? r.cancelNumberedTitle.replace("{number}", n) : r.cancelTitle,
253
251
  description: r.cancelDescription,
254
252
  confirmLabel: r.cancelConfirm,
255
253
  cancelLabel: r.cancelClose,
256
- cancelVariant: "outline",
257
254
  destructive: !0
258
255
  } : e === "delete" ? {
259
256
  title: n && n !== r.untitledDocument ? r.deleteNumberedTitle.replace("{number}", n) : r.deleteTitle,
260
257
  description: r.deleteDescription,
261
258
  confirmLabel: r.deleteConfirm,
262
- cancelVariant: "outline",
263
259
  destructive: !0
264
260
  } : e === "markPaid" ? {
265
261
  title: r.markPaidTitle,
@@ -269,7 +265,7 @@ function oe({ action: e, description: t, title: n }, r) {
269
265
  title: r.markUncollectibleTitle,
270
266
  description: r.markUncollectibleDescription,
271
267
  confirmLabel: r.markUncollectibleConfirm,
272
- cancelVariant: "outline"
268
+ destructive: !0
273
269
  };
274
270
  }
275
271
  export { v as useReceivableActions };
@@ -76,8 +76,11 @@ function g({ messages: g }) {
76
76
  D,
77
77
  _
78
78
  ]), ee = m(() => {
79
- if (_) return y === "issue" ? {
79
+ if (!_) return;
80
+ let e = _.showEmailStep && _.inlineItems.length > 0, t = (t) => e ? g.actionsStepLabel.replace("{current}", String(t)).replace("{total}", "2") : void 0;
81
+ return y === "issue" ? {
80
82
  step: "issue",
83
+ stepLabel: t(1),
81
84
  icon: _.isResend ? "send" : "check",
82
85
  title: (_.isResend ? g.actionsResendTitle : g.actionsIssueTitle).replace("{name}", z),
83
86
  recipient: B ? `${z} <${B}>` : z,
@@ -89,6 +92,7 @@ function g({ messages: g }) {
89
92
  inProgress: I
90
93
  } : {
91
94
  step: "products",
95
+ stepLabel: t(2),
92
96
  title: d(_.action, x, g),
93
97
  items: J.map((e) => ({
94
98
  key: e.key,
@@ -5,35 +5,35 @@
5
5
  import { buildReceivableAuditHistory as e } from "../../../../../shared/util/dist/lib/auditHistory/buildReceivableAuditHistory.js";
6
6
  import "../../../../../shared/util/dist/index.js";
7
7
  import { hasAnyScope as t } from "../../../../../shared/data-access/dist/lib/hasAnyScope.js";
8
- import { Scope as n } from "../../../../../shared/data-access/dist/lib/scopes.js";
8
+ import { Scope as ee } from "../../../../../shared/data-access/dist/lib/scopes.js";
9
9
  import "../../../../../shared/data-access/dist/index.js";
10
- import { useWidgetConfig as r } from "../../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
11
- import { useOrganizationUserNames as i } from "../../../../../shared/feature/dist/lib/user/useOrganizationUserNames.js";
10
+ import { useWidgetConfig as te } from "../../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
11
+ import { useOrganizationUserNames as ne } from "../../../../../shared/feature/dist/lib/user/useOrganizationUserNames.js";
12
12
  import "../../../../../shared/feature/dist/index.js";
13
- import { RECEIVABLE_DETAILS_SECTION as a } from "../../../../ui/dist/index31.js";
13
+ import { RECEIVABLE_DETAILS_SECTION as n } from "../../../../ui/dist/index34.js";
14
14
  import "../../../../ui/dist/index.js";
15
- import { useAllReceivableHistoryQuery as ee } from "../../../../data-access/dist/index4.js";
16
- import { usePaymentAccountsQuery as o } from "../../../../data-access/dist/index6.js";
17
- import { useReceivablePaymentRecordsQuery as s } from "../../../../data-access/dist/index12.js";
18
- import { useReceivablePdfLinkQuery as te, useReceivableQuery as ne, useReceivablesByIdQueries as re } from "../../../../data-access/dist/index15.js";
19
- import { useOverdueRemindersQuery as ie, usePaymentRemindersQuery as c, useRecurrenceQuery as l } from "../../../../data-access/dist/index16.js";
15
+ import { useAllReceivableHistoryQuery as r } from "../../../../data-access/dist/index4.js";
16
+ import { usePaymentAccountsQuery as i } from "../../../../data-access/dist/index6.js";
17
+ import { useReceivablePaymentRecordsQuery as a } from "../../../../data-access/dist/index12.js";
18
+ import { useReceivablePdfLinkQuery as o, useReceivableQuery as re, useReceivablesByIdQueries as ie } from "../../../../data-access/dist/index15.js";
19
+ import { useOverdueRemindersQuery as s, usePaymentRemindersQuery as ae, useRecurrenceQuery as c } from "../../../../data-access/dist/index16.js";
20
20
  import "../../../../data-access/dist/index.js";
21
- import { canRecordPayments as u } from "./paymentRecord.js";
22
- import { buildReceivableAuditHistoryLabels as ae } from "./auditHistory/labels.js";
21
+ import { canRecordPayments as l } from "./paymentRecord.js";
22
+ import { buildReceivableAuditHistoryLabels as u } from "./auditHistory/labels.js";
23
23
  import { getBankAccountPermissions as oe } from "./bankAccounts.js";
24
24
  import { buildDetailsMessageView as se, buildReceivableDetailsView as ce } from "./details.js";
25
25
  import { useMemo as d, useState as f } from "react";
26
26
  // ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableDetails.js
27
- var p = [a.attachments];
27
+ var p = [n.billing, n.lineItems];
28
28
  function m({ selectedReceivableId: m, enabled: h = !0, canWrite: g = !0, messages: _, statusLabels: v, auditHistoryLabels: y, onOpenReceivable: b, onOpenCustomer: x }) {
29
- let { initResponse: S } = r(), C = d(() => oe(S?.scopes), [S?.scopes]), w = u(S?.scopes), T = ne(m, { enabled: h }), E = T.data, D = E?.type === "invoice" ? E : void 0, le = te(m, { enabled: h && !!D }), ue = c({ enabled: h && !!D?.payment_reminder_id }), de = ie({ enabled: h && !!D?.overdue_reminder_id }), O = o({
29
+ let { initResponse: S } = te(), C = d(() => oe(S?.scopes), [S?.scopes]), w = l(S?.scopes), T = re(m, { enabled: h }), E = T.data, D = E?.type === "invoice" ? E : void 0, le = o(m, { enabled: h && !!D }), ue = ae({ enabled: h && !!D?.payment_reminder_id }), de = s({ enabled: h && !!D?.overdue_reminder_id }), O = i({
30
30
  enabled: h && !!D,
31
31
  canReadEmbedded: C.canReadEmbedded,
32
32
  canReadExternal: C.canReadExternal
33
- }), k = l(h ? D?.recurrence_id : void 0), A = k.data, j = s(D?.id, { enabled: h }), M = ee(D?.id, { enabled: h && !!D }), N = d(() => D?.status === "recurring" ? (A?.iterations ?? []).flatMap((e) => e.issued_invoice_id ? [e.issued_invoice_id] : []) : [], [D?.status, A?.iterations]), P = re(N, { enabled: h }), F = d(() => new Map(P.filter((e) => !!e).map((e) => [e.id, e])), [P]), [I, L] = f(p), [R, z] = f(m);
33
+ }), k = c(h ? D?.recurrence_id : void 0), A = k.data, j = a(D?.id, { enabled: h }), M = r(D?.id, { enabled: h && !!D }), N = d(() => D?.status === "recurring" ? (A?.iterations ?? []).flatMap((e) => e.issued_invoice_id ? [e.issued_invoice_id] : []) : [], [D?.status, A?.iterations]), P = ie(N, { enabled: h }), F = d(() => new Map(P.filter((e) => !!e).map((e) => [e.id, e])), [P]), [I, L] = f(p), [R, z] = f(m);
34
34
  R !== m && (z(m), L(p));
35
- let B = I.includes(a.auditHistory), V = d(() => M.data?.data ?? [], [M.data]), H = V.some((e) => e.event_type === "mail_sent"), U = V.some((e) => e.recorded_by === "user" && !!e.entity_user_id), W = t(S?.scopes, [n.UserReadOrg]), { userNames: G, isError: K } = i({ enabled: h && B && W && U }), q = d(() => ({
36
- ...ae(_, v),
35
+ let B = I.includes(n.auditHistory), V = d(() => M.data?.data ?? [], [M.data]), H = V.some((e) => e.event_type === "mail_sent"), U = V.some((e) => e.recorded_by === "user" && !!e.entity_user_id), W = t(S?.scopes, [ee.UserReadOrg]), { userNames: G, isError: K } = ne({ enabled: h && B && W && U }), q = d(() => ({
36
+ ...u(_, v),
37
37
  ...y
38
38
  }), [
39
39
  _,
@@ -14,7 +14,7 @@ import { useCounterpartQuery as a, useCreateCounterpartMutation as o } from "../
14
14
  import { useCounterpartAddressesQuery as s } from "../../../../../shared/counterpart-management/data-access/dist/index5.js";
15
15
  import { useCounterpartForm as c } from "../../../../../shared/counterpart-management/feature/dist/lib/useCounterpartForm.js";
16
16
  import "../../../../../shared/counterpart-management/feature/dist/index.js";
17
- import "../../../../ui/dist/index24.js";
17
+ import "../../../../ui/dist/index25.js";
18
18
  import "../../../../ui/dist/index.js";
19
19
  import { buildLineItemControls as te, commitLineItemField as ne, commitTaxRateInput as l, convertPriceInput as u, createLineItem as re, getCurrencySymbol as ie, lineItemFromProduct as ae, reconcileLineItemIds as oe, reconcileMeasureUnits as se, sanitizeLineItemPatch as ce, sanitizeTaxRateInput as le, stepLineItemQuantity as ue, stripBlankLineItems as de, summarizeLineItemErrors as fe, toSheetLineItem as pe, validateLineItems as me } from "./lineItems.js";
20
20
  import { buildReceivableAttachmentsView as he } from "./attachments.js";
@@ -76,8 +76,7 @@ function h({ messages: h }) {
76
76
  invoice: g,
77
77
  values: b,
78
78
  user: k.data,
79
- isUserLoading: k.isLoading,
80
- messages: h
79
+ isUserLoading: k.isLoading
81
80
  }) : void 0,
82
81
  inProgress: O.isPending || v === "review" && k.isLoading,
83
82
  change: M,
@@ -60,11 +60,13 @@ function p({ initialCounterpartId: p, selectedStatusCard: h, onStatusCardChange:
60
60
  }), H = B.data?.data ?? d, U = l(() => new Map(H.map((e) => [e.id, e])), [H]), W = s((e) => U.get(e), [U]), G = i(H), K = l(() => e({
61
61
  receivables: H,
62
62
  messages: _,
63
+ statusLabels: v,
63
64
  customerNames: G,
64
65
  now: new Date(N)
65
66
  }), [
66
67
  G,
67
68
  _,
69
+ v,
68
70
  H,
69
71
  N
70
72
  ]), q = s((e) => {