@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
@@ -1,25 +1,25 @@
1
1
  import { isLineItemTaxable as e } from "./lineItems.js";
2
2
  import { buildReceivableAttachmentDetailsView as t } from "./attachments.js";
3
3
  import { allocateDiscount as n, resolveDiscountAmount as r } from "./totals.js";
4
- import { buildReceivableNotesView as i, formatDate as a, formatMoney as o, getDaysOverdue as s } from "./helpers.js";
5
- import { getPaymentAccountLineLabel as c } from "./bankAccounts.js";
6
- import { formatCountryName as l, formatDeduction as u } from "./preview.js";
4
+ import { ITERATION_STATUS_COLOR as i, SERIES_STATUS_COLOR as a, receivableStatusColor as o } from "./statusColors.js";
5
+ import { buildReceivableNotesView as s, formatDate as c, formatMoney as l, receivableBadgeLabel as u, resolveReceivableDueDate as d } from "./helpers.js";
6
+ import { getPaymentAccountLineLabel as f } from "./bankAccounts.js";
7
+ import { formatCountryName as p, formatDeduction as m } from "./preview.js";
7
8
  // ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/details.js
8
- var d = {
9
+ var h = {
9
10
  draft: {
10
- primary: [
11
- "edit",
12
- "issue",
13
- "issueAndSend"
14
- ],
11
+ header: ["edit"],
12
+ summary: ["issue", "issueAndSend"],
15
13
  overflow: ["clone", "delete"]
16
14
  },
17
15
  issued: {
18
- primary: ["send", "recordPayment"],
16
+ header: [],
17
+ summary: ["send", "recordPayment"],
19
18
  overflow: ["clone", "cancel"]
20
19
  },
21
20
  overdue: {
22
- primary: ["send", "recordPayment"],
21
+ header: [],
22
+ summary: ["send", "recordPayment"],
23
23
  overflow: [
24
24
  "clone",
25
25
  "cancel",
@@ -27,66 +27,64 @@ var d = {
27
27
  ]
28
28
  },
29
29
  partially_paid: {
30
- primary: ["send", "recordPayment"],
30
+ header: [],
31
+ summary: ["send", "recordPayment"],
31
32
  overflow: ["clone"]
32
33
  },
33
34
  paid: {
34
- primary: [],
35
+ header: [],
36
+ summary: [],
35
37
  overflow: ["clone"]
36
38
  },
37
39
  canceled: {
38
- primary: [],
40
+ header: [],
41
+ summary: [],
39
42
  overflow: ["clone"]
40
43
  },
41
44
  uncollectible: {
42
- primary: [],
45
+ header: [],
46
+ summary: [],
43
47
  overflow: ["clone"]
44
48
  },
45
49
  recurring: {
46
- primary: [],
50
+ header: [],
51
+ summary: [],
47
52
  overflow: []
48
53
  }
49
- }, f = /* @__PURE__ */ new Set([
54
+ };
55
+ function ee(e) {
56
+ return Object.hasOwn(h, e) ? h[e] : {
57
+ header: [],
58
+ summary: [],
59
+ overflow: ["clone"]
60
+ };
61
+ }
62
+ var te = /* @__PURE__ */ new Set([
50
63
  "issued",
51
64
  "overdue",
52
65
  "partially_paid",
53
66
  "paid",
54
67
  "uncollectible"
55
- ]), p = {
56
- draft: "neutral",
57
- issuing: "info",
58
- issued: "info",
59
- partially_paid: "info",
60
- accepted: "success",
61
- paid: "success",
62
- failed: "danger",
63
- expired: "danger",
64
- declined: "danger",
65
- overdue: "danger",
66
- canceled: "neutral",
67
- uncollectible: "neutral",
68
- recurring: "neutral",
69
- deleted: "neutral"
70
- };
71
- function m(e, t) {
68
+ ]);
69
+ function g(e, t) {
72
70
  let n = e.map((e) => `${e} ${e === 1 ? t.reminderUnitDay : t.reminderUnitDays}`);
73
71
  if (n.length <= 1) return n[0] ?? "";
74
72
  let r = t.reminderNameAnd;
75
73
  return n.length === 2 ? `${n[0]} ${r} ${n[1]}` : `${n.slice(0, -1).join(", ")}, ${r} ${n[n.length - 1]}`;
76
74
  }
77
- function h({ paymentReminder: e, overdueReminder: t, remindersConfigured: n, messages: r }) {
75
+ function _({ paymentReminder: e, overdueReminder: t, remindersConfigured: n, messages: r }) {
78
76
  let i = [
79
77
  e?.term_1_reminder?.days_before,
80
78
  e?.term_2_reminder?.days_before,
81
79
  e?.term_final_reminder?.days_before
82
80
  ].filter((e) => typeof e == "number"), a = (t?.terms ?? []).map((e) => e.days_after).filter((e) => typeof e == "number"), o = [];
83
- return i.length > 0 && o.push(`${m(i, r)} ${r.detailsRemindersBefore}`), a.length > 0 && o.push(`${m(a, r)} ${r.detailsRemindersAfter}`), o.length > 0 ? o.join("\n") : n ? "-" : r.detailsRemindersNone;
81
+ return i.length > 0 && o.push(`${g(i, r)} ${r.detailsRemindersBefore}`), a.length > 0 && o.push(`${g(a, r)} ${r.detailsRemindersAfter}`), o.length > 0 ? o.join("\n") : n ? "-" : r.detailsRemindersNone;
84
82
  }
85
- function g(e, t, n) {
83
+ function v(e, t, n) {
86
84
  return ((e.interval > 1 ? n : t)[e.frequency] ?? "").replace("{interval}", String(e.interval));
87
85
  }
88
- function _(e, t) {
89
- return g(e, {
86
+ function y(e, t) {
87
+ return v(e, {
90
88
  day: t.detailsFrequencyDay,
91
89
  week: t.detailsFrequencyWeek,
92
90
  month: t.detailsFrequencyMonth,
@@ -100,8 +98,8 @@ function _(e, t) {
100
98
  year: t.listSeriesEveryYears
101
99
  });
102
100
  }
103
- function v(e, t) {
104
- return g(e, {
101
+ function b(e, t) {
102
+ return v(e, {
105
103
  day: t.detailsPeriodDay,
106
104
  week: t.detailsPeriodWeek,
107
105
  month: t.detailsPeriodMonth,
@@ -115,10 +113,10 @@ function v(e, t) {
115
113
  year: t.detailsPeriodEveryYears
116
114
  });
117
115
  }
118
- function ee(e, t) {
119
- return e.interval > 1 ? t.detailsScheduleTitleEvery.replace("{period}", v(e, t)) : t.detailsScheduleTitle.replace("{frequency}", _(e, t));
116
+ function x(e, t) {
117
+ return e.interval > 1 ? t.detailsScheduleTitleEvery.replace("{period}", b(e, t)) : t.detailsScheduleTitle.replace("{frequency}", y(e, t));
120
118
  }
121
- function y(e, t) {
119
+ function S(e, t) {
122
120
  return {
123
121
  active: t.detailsSeriesStatusActive,
124
122
  paused: t.detailsSeriesStatusPaused,
@@ -126,24 +124,6 @@ function y(e, t) {
126
124
  completed: t.detailsSeriesStatusCompleted
127
125
  }[e] ?? "";
128
126
  }
129
- var b = {
130
- active: "info",
131
- paused: "warning",
132
- canceled: "danger",
133
- completed: "success"
134
- }, x = {
135
- active: "forward",
136
- paused: "pause",
137
- canceled: "ban",
138
- completed: "check"
139
- }, S = {
140
- pending: "neutral",
141
- skipped: "warning",
142
- canceled: "danger",
143
- issue_failed: "danger",
144
- send_failed: "danger",
145
- completed: "success"
146
- };
147
127
  function C(e, t) {
148
128
  return {
149
129
  pending: t.detailsIterationStatusPending,
@@ -154,110 +134,77 @@ function C(e, t) {
154
134
  completed: t.detailsIterationStatusCompleted
155
135
  }[e] ?? "";
156
136
  }
157
- function w(e, t, n) {
158
- return n.detailsSeriesTitle.replace("{name}", e.counterpart_name ?? n.invoiceType).replace("{frequency}", _(t, n));
159
- }
160
- function T(e, t) {
161
- return t[e] ?? t.unknown;
137
+ function ne(e, t, n) {
138
+ return n.detailsSeriesTitle.replace("{name}", e.counterpart_name ?? n.invoiceType).replace("{frequency}", y(t, n));
162
139
  }
163
- function E({ invoice: e, recurrence: t, iterationInvoices: n, date: r, statusLabels: i, messages: a, onOpenReceivable: s }) {
164
- return (t.iterations ?? []).map((t, c) => {
165
- let l = t.issued_invoice_id, u = l ? n.get(l) : void 0, d = u ?? e;
140
+ function re({ invoice: e, recurrence: t, iterationInvoices: n, date: r, statusLabels: a, messages: s, onOpenReceivable: c }) {
141
+ return (t.iterations ?? []).map((t, d) => {
142
+ let f = t.issued_invoice_id, p = f ? n.get(f) : void 0, m = p ?? e;
166
143
  return {
167
- id: `iteration-${t.iteration ?? ""}-${c}`,
168
- issueDateLabel: t.issue_at ? r(t.issue_at) : a.detailsPending,
169
- amountLabel: o({
170
- amount: d.total_amount ?? 0,
171
- currency: d.currency,
144
+ id: `iteration-${t.iteration ?? ""}-${d}`,
145
+ issueDateLabel: t.issue_at ? r(t.issue_at) : s.detailsPending,
146
+ amountLabel: l({
147
+ amount: m.total_amount ?? 0,
148
+ currency: m.currency,
172
149
  fallback: ""
173
150
  }),
174
- chip: u ? {
175
- kind: "invoice",
176
- label: T(u.status, i),
177
- status: u.status
151
+ chip: p ? {
152
+ label: u(p.status, a),
153
+ color: o(p.status)
178
154
  } : {
179
- kind: "iteration",
180
- label: C(t.status, a),
181
- tone: S[t.status] ?? "neutral"
155
+ label: C(t.status, s),
156
+ color: i[t.status] ?? "neutral"
182
157
  },
183
- numberLabel: l ? u?.document_id ?? "" : a.detailsPending,
184
- onOpen: u ? () => s(u.id) : void 0,
185
- openLabel: u ? a.detailsScheduleOpenInvoice.replace("{number}", u.document_id ?? "") : void 0
158
+ numberLabel: f ? p?.document_id ?? "" : s.detailsPending,
159
+ onOpen: p ? () => c(p.id) : void 0,
160
+ openLabel: p ? s.detailsScheduleOpenInvoice.replace("{number}", p.document_id ?? "") : void 0
186
161
  };
187
162
  });
188
163
  }
189
- function te(e) {
164
+ function ie(e) {
190
165
  if (!e?.line1) return;
191
166
  let t = [e.city, [e.state, e.postal_code].filter(Boolean).join(" ")].filter(Boolean).join(", ");
192
167
  return [
193
168
  e.line2 ? `${e.line1} ${e.line2}` : e.line1,
194
169
  t,
195
- e.country ? l(e.country) : void 0
170
+ e.country ? p(e.country) : void 0
196
171
  ].filter(Boolean).join(", ");
197
172
  }
198
- function ne(e, t, n) {
173
+ function w(e, t, n) {
199
174
  let r = {
200
175
  label: n.detailsAmountReceived,
201
176
  value: t(e.amount_paid)
177
+ }, i = {
178
+ label: n.detailsBalanceDue,
179
+ value: t(e.amount_due),
180
+ emphasis: !0
202
181
  };
203
182
  switch (e.status) {
204
183
  case "issued":
205
- case "overdue": return {
206
- amountTone: e.status === "overdue" ? "danger" : "default",
207
- amountRows: [{
208
- label: n.detailsBalanceDue,
209
- value: t(e.amount_due),
210
- emphasis: !0
211
- }, ...e.amount_paid > 0 ? [{
212
- ...r,
213
- tone: "success"
214
- }] : []]
215
- };
216
- case "partially_paid": return {
217
- amountTone: "default",
218
- amountRows: [{
219
- label: n.detailsBalanceDue,
220
- value: t(e.amount_due),
221
- emphasis: !0
222
- }, {
223
- ...r,
224
- tone: "success"
225
- }]
226
- };
227
- case "paid": return {
228
- amountTone: "success",
229
- amountRows: [{
230
- ...r,
231
- emphasis: !0
232
- }]
233
- };
234
- case "canceled": return {
235
- amountTone: "muted",
236
- amountRows: [{
237
- label: n.detailsCancelledAmount,
238
- value: t(e.total_amount),
239
- emphasis: !0
240
- }]
241
- };
242
- case "uncollectible": return {
243
- amountTone: "muted",
244
- amountRows: [{
245
- label: n.detailsAmountWrittenOff,
246
- value: t(e.amount_due),
247
- emphasis: !0
248
- }]
249
- };
250
- default: return {
251
- amountTone: "default",
252
- amountRows: [{
253
- label: n.detailsInvoiceAmount,
254
- value: t(e.total_amount),
255
- emphasis: !0
256
- }]
257
- };
184
+ case "overdue": return e.amount_paid > 0 ? [i, r] : [i];
185
+ case "partially_paid": return [i, r];
186
+ case "paid": return [{
187
+ ...r,
188
+ emphasis: !0
189
+ }];
190
+ case "canceled": return [{
191
+ label: n.detailsCancelledAmount,
192
+ value: t(e.total_amount),
193
+ emphasis: !0
194
+ }];
195
+ case "uncollectible": return [{
196
+ label: n.detailsAmountWrittenOff,
197
+ value: t(e.amount_due),
198
+ emphasis: !0
199
+ }];
200
+ default: return [{
201
+ label: n.detailsInvoiceAmount,
202
+ value: t(e.total_amount),
203
+ emphasis: !0
204
+ }];
258
205
  }
259
206
  }
260
- function re(t, i, a) {
207
+ function ae(t, i, a) {
261
208
  let o = t.line_items.reduce((t, n) => {
262
209
  let r = n.total_before_tax ?? 0;
263
210
  return e(n.tax_status) ? {
@@ -276,160 +223,159 @@ function re(t, i, a) {
276
223
  }), { taxableSubtotal: c, nonTaxableSubtotal: l } = n({
277
224
  ...o,
278
225
  discountAmount: s
279
- }), d = s > 0, f = o.taxableItemsSubtotal > 0, p = o.nonTaxableItemsSubtotal > 0, m = [{
226
+ }), u = s > 0, d = o.taxableItemsSubtotal > 0, f = o.nonTaxableItemsSubtotal > 0, p = [{
280
227
  label: a.previewSubtotal,
281
228
  value: i(t.subtotal)
282
229
  }];
283
- d && m.push({
230
+ u && p.push({
284
231
  label: a.previewDiscount,
285
- value: u(s, t.currency)
286
- }), p && (f || d) && m.push({
232
+ value: m(s, t.currency)
233
+ }), f && (d || u) && p.push({
287
234
  label: a.previewNonTaxableSubtotal,
288
- value: i(l),
289
- tone: "muted"
290
- }), f && (p || d) && m.push({
235
+ value: i(l)
236
+ }), d && (f || u) && p.push({
291
237
  label: a.previewTaxableSubtotal,
292
- value: i(c),
293
- tone: "muted"
238
+ value: i(c)
294
239
  });
295
- for (let e of t.total_tax_amounts ?? []) m.push({
240
+ for (let e of t.total_tax_amounts ?? []) p.push({
296
241
  label: a.previewTaxWithRate.replace("{rate}", String((e.value ?? 0) / 100)),
297
242
  value: i(e.amount)
298
243
  });
299
- return m.push({
244
+ return p.push({
300
245
  label: a.previewTotal,
301
246
  value: i(t.total_amount),
302
247
  emphasis: !0
303
- }), m;
248
+ }), p;
304
249
  }
305
- var ie = {
306
- primary: [],
250
+ var oe = {
251
+ header: [],
252
+ summary: [],
307
253
  overflow: []
308
254
  };
309
- function D({ receivable: e, pdfUrl: n, paymentReminder: r, overdueReminder: l, depositAccount: u, isAccountListIncomplete: m, recurrence: g, paymentRecords: S = [], isLoadingPaymentRecords: C = !1, iterationInvoices: T = /* @__PURE__ */ new Map(), auditHistory: D, statusLabels: O, messages: k, canRecordPayment: ae, hasBeenSent: oe = !1, canWrite: A = !0, onOpenReceivable: j, onOpenCustomer: M, now: se }) {
255
+ function T({ receivable: e, pdfUrl: n, paymentReminder: r, overdueReminder: i, depositAccount: p, isAccountListIncomplete: m, recurrence: h, paymentRecords: g = [], isLoadingPaymentRecords: v = !1, iterationInvoices: C = /* @__PURE__ */ new Map(), auditHistory: T, statusLabels: E, messages: D, canRecordPayment: O, hasBeenSent: se = !1, canWrite: k = !0, onOpenReceivable: A, onOpenCustomer: j, now: M }) {
310
256
  if (!e || e.type !== "invoice") return;
311
- let N = e, P = (e) => o({
257
+ let N = e, P = (e) => l({
312
258
  amount: e ?? 0,
313
259
  currency: N.currency,
314
260
  fallback: ""
315
- }), F = (e) => a(e, "-"), I = (e) => e ? F(e) : k.detailsPending, { status: L } = N, R = L === "canceled", z = L === "recurring" ? g : void 0, B = N.recurrence_id && L !== "recurring" ? g : void 0, V = L === "overdue" ? s(N.due_date, se) : 0, { amountTone: H, amountRows: U } = ne(N, P, k), W = N.counterpart_contact, G = te(N.counterpart_billing_address), K = N.counterpart_id, ce = N.counterpart_name ? {
316
- label: k.detailsCustomerName,
261
+ }), F = (e) => c(e, "-"), I = (e) => e ? F(e) : D.detailsPending, { status: L } = N, R = L === "canceled", z = L === "recurring" ? h : void 0, B = N.recurrence_id && L !== "recurring" ? h : void 0, V = d({
262
+ dueDate: N.due_date,
263
+ status: L,
264
+ dateLabel: I(N.due_date),
265
+ messages: D,
266
+ now: M ?? /* @__PURE__ */ new Date()
267
+ }), H = w(N, P, D), U = N.counterpart_contact, W = ie(N.counterpart_billing_address), G = N.counterpart_id, ce = N.counterpart_name ? {
268
+ label: D.detailsCustomerName,
317
269
  name: N.counterpart_name,
318
- onOpen: M && K ? () => M(K) : void 0
270
+ onOpen: j && G ? () => j(G) : void 0
319
271
  } : void 0, le = [
320
- ...W?.email ? [{
321
- label: k.detailsCustomerEmail,
322
- value: W.email
272
+ ...U?.email ? [{
273
+ label: D.detailsCustomerEmail,
274
+ value: U.email
323
275
  }] : [],
324
- ...W?.phone ? [{
325
- label: k.detailsCustomerPhone,
326
- value: W.phone
276
+ ...U?.phone ? [{
277
+ label: D.detailsCustomerPhone,
278
+ value: U.phone
327
279
  }] : [],
328
- ...G ? [{
329
- label: k.detailsCustomerAddress,
330
- value: G
280
+ ...W ? [{
281
+ label: D.detailsCustomerAddress,
282
+ value: W
331
283
  }] : []
332
- ], q = {
333
- label: k.detailsPaymentReminders,
334
- value: h({
284
+ ], K = {
285
+ label: D.detailsPaymentReminders,
286
+ value: _({
335
287
  paymentReminder: r,
336
- overdueReminder: l,
288
+ overdueReminder: i,
337
289
  remindersConfigured: !!(N.payment_reminder_id || N.overdue_reminder_id),
338
- messages: k
290
+ messages: D
339
291
  })
292
+ }, q = {
293
+ label: D.detailsDepositAccount,
294
+ value: p ? f(p, D) : m && N.bank_account_id ? "-" : D.detailsNotProvided
340
295
  }, J = {
341
- label: k.detailsDepositAccount,
342
- value: u ? c(u, k) : m && N.bank_account_id ? "-" : k.detailsNotProvided
343
- }, Y = {
344
- label: k.detailsPaymentTerms,
345
- value: N.payment_terms?.name ?? k.detailsPending
296
+ label: D.detailsPaymentTerms,
297
+ value: N.payment_terms?.name ?? D.detailsPending
346
298
  }, ue = z ? [
347
299
  {
348
- label: k.detailsFrequency,
349
- value: _(z, k)
300
+ label: D.detailsFrequency,
301
+ value: y(z, D)
350
302
  },
351
303
  {
352
- label: k.detailsInvoiceAmount,
304
+ label: D.detailsInvoiceAmount,
353
305
  value: P(N.total_amount)
354
306
  },
355
- Y,
356
- q,
307
+ J,
308
+ K,
357
309
  {
358
- label: k.detailsPoNumber,
359
- value: N.purchase_order || k.detailsNotProvided
310
+ label: D.detailsPoNumber,
311
+ value: N.purchase_order || D.detailsNotProvided
360
312
  },
361
- J
313
+ q
362
314
  ] : [
363
315
  ...N.document_id ? [{
364
- label: k.detailsInvoiceNumber,
316
+ label: D.detailsInvoiceNumber,
365
317
  value: N.document_id
366
318
  }] : [],
367
319
  {
368
- label: k.detailsInvoiceAmount,
320
+ label: D.detailsInvoiceAmount,
369
321
  value: P(N.total_amount)
370
322
  },
371
323
  {
372
- label: k.detailsInvoiceDate,
324
+ label: D.detailsInvoiceDate,
373
325
  value: I(N.issue_date)
374
326
  },
375
327
  {
376
- label: k.detailsDueDate,
328
+ label: D.detailsDueDate,
377
329
  value: I(N.due_date)
378
330
  },
379
- Y,
380
- q,
331
+ J,
332
+ K,
381
333
  ...N.purchase_order ? [{
382
- label: k.detailsPoNumber,
334
+ label: D.detailsPoNumber,
383
335
  value: N.purchase_order
384
336
  }] : [],
385
- J
386
- ], X = z ? void 0 : i(N), { primary: Z, overflow: Q } = A ? d[L] ?? {
387
- primary: [],
388
- overflow: ["clone"]
389
- } : ie;
390
- if (z && A) {
337
+ q
338
+ ], Y = z ? void 0 : s(N), { header: X, summary: Z, overflow: Q } = k ? ee(L) : oe;
339
+ if (z && k) {
391
340
  let e = z.status === "active" || z.status === "paused";
392
- Q = z.status === "active" ? ["pauseRecurrence", "cancelRecurrence"] : z.status === "paused" ? ["resumeRecurrence", "cancelRecurrence"] : [], Z = e ? ["edit"] : [];
341
+ Q = z.status === "active" ? ["pauseRecurrence", "cancelRecurrence"] : z.status === "paused" ? ["resumeRecurrence", "cancelRecurrence"] : [], X = e ? ["edit"] : [], Z = [];
393
342
  }
394
- ae || (Z = Z.filter((e) => e !== "recordPayment"));
395
- let de = f.has(L) ? {
396
- rows: S.map((e) => ({
343
+ O || (Z = Z.filter((e) => e !== "recordPayment"));
344
+ let de = te.has(L) ? {
345
+ rows: g.map((e) => ({
397
346
  id: e.id,
398
347
  dateLabel: F(e.paid_at),
399
348
  amountLabel: P(e.amount)
400
349
  })),
401
350
  totalLabel: P(N.amount_paid),
402
- emptyTone: L === "overdue" ? "danger" : "default",
403
- isLoading: C
351
+ isLoading: v
404
352
  } : void 0, fe = z ? {
405
- statusLabel: y(z.status, k),
406
- statusTone: b[z.status] ?? "neutral",
407
- statusIcon: x[z.status],
353
+ statusLabel: S(z.status, D),
354
+ statusColor: a[z.status] ?? "neutral",
408
355
  amountLabel: P(N.total_amount),
409
- amountPeriodLabel: v(z, k),
356
+ amountPeriodLabel: b(z, D),
410
357
  startsOnLabel: I(z.start_date),
411
358
  endsOnLabel: F(z.end_date ?? (z.max_occurrences ? z.iterations?.at(-1)?.issue_at : void 0)),
412
- scheduleTitle: ee(z, k),
413
- schedule: E({
359
+ scheduleTitle: x(z, D),
360
+ schedule: re({
414
361
  invoice: N,
415
362
  recurrence: z,
416
- iterationInvoices: T,
363
+ iterationInvoices: C,
417
364
  date: F,
418
- statusLabels: O,
419
- messages: k,
420
- onOpenReceivable: j
365
+ statusLabels: E,
366
+ messages: D,
367
+ onOpenReceivable: A
421
368
  })
422
- } : void 0, $ = B ? w(N, B, k) : void 0, pe = B && $ ? {
369
+ } : void 0, $ = B ? ne(N, B, D) : void 0, pe = B && $ ? {
423
370
  title: $,
424
- backLabel: k.detailsSeriesBack.replace("{title}", $),
425
- onOpen: () => j(B.invoice_id)
371
+ backLabel: D.detailsSeriesBack.replace("{title}", $),
372
+ onOpen: () => A(B.invoice_id)
426
373
  } : void 0;
427
374
  return {
428
375
  id: N.id,
429
376
  type: N.type,
430
- title: N.counterpart_name ?? k.invoiceType,
377
+ title: N.counterpart_name ?? D.invoiceType,
431
378
  status: L,
432
- statusTone: p[L] ?? "neutral",
433
379
  pdfUrl: n,
434
380
  lineItems: N.line_items.map((e, t) => ({
435
381
  id: `${e.product.id ?? "item"}-${t}`,
@@ -439,15 +385,15 @@ function D({ receivable: e, pdfUrl: n, paymentReminder: r, overdueReminder: l, d
439
385
  totalLabel: P(e.total_before_tax ?? (e.product.price?.value ?? 0) * e.quantity)
440
386
  })),
441
387
  panel: {
442
- subtitle: z ? k.detailsSeriesSubtitle.replace("{frequency}", _(z, k)) : N.document_id ? k.detailsInvoiceSubtitle.replace("{number}", N.document_id) : void 0,
443
- statusLabel: L === "partially_paid" ? O.issued : O[L] ?? O.unknown,
388
+ subtitle: z ? D.detailsSeriesSubtitle.replace("{frequency}", y(z, D)) : N.document_id ? D.detailsInvoiceSubtitle.replace("{number}", N.document_id) : void 0,
389
+ hiddenDescription: !z && !N.document_id && L === "draft" ? D.detailsDraftDescription : void 0,
390
+ statusLabel: u(L, E),
391
+ statusColor: o(L),
444
392
  recurring: !!N.recurrence_id || L === "recurring",
445
- overdueLabel: V > 0 ? k.detailsDaysOverdue.replace("{days}", String(V)) : void 0,
446
- amountTone: H,
447
- amountRows: U,
393
+ amountRows: H,
448
394
  issueDateLabel: I(N.issue_date),
449
- dueDateLabel: R ? F(N.updated_at) : I(N.due_date),
450
- dueDateCaption: R ? k.detailsCancelledOnCaption : k.detailsDueDate,
395
+ dueDateLabel: R ? F(N.updated_at) : V.overdueLabel ? D.detailsOverdueDueDate.replace("{date}", V.label).replace("{overdue}", V.overdueLabel) : I(N.due_date),
396
+ dueDateCaption: R ? D.detailsCancelledOnCaption : D.detailsDueDate,
451
397
  paymentHistory: de,
452
398
  customerName: ce,
453
399
  customerContact: le,
@@ -456,21 +402,22 @@ function D({ receivable: e, pdfUrl: n, paymentReminder: r, overdueReminder: l, d
456
402
  billingItems: ue,
457
403
  lineItemsSection: z ? void 0 : {
458
404
  countLabel: String(N.line_items.length),
459
- totals: re(N, P, k)
405
+ totals: ae(N, P, D)
460
406
  },
461
- notes: X && {
462
- ...X,
463
- countLabel: String([X.opening, X.closing].filter(Boolean).length)
407
+ notes: Y && {
408
+ ...Y,
409
+ countLabel: String([Y.opening, Y.closing].filter(Boolean).length)
464
410
  },
465
- attachments: t(N, k),
466
- auditHistory: D,
467
- primaryActions: Z,
411
+ attachments: t(N, D),
412
+ auditHistory: T,
413
+ headerActions: X,
414
+ summaryActions: Z,
468
415
  overflowActions: Q,
469
- actionLabels: { send: oe ? k.detailsResendButton : k.detailsSendButton }
416
+ actionLabels: { send: se ? D.detailsResendButton : D.detailsSendButton }
470
417
  }
471
418
  };
472
419
  }
473
- function O(e, t, n) {
420
+ function E(e, t, n) {
474
421
  if (!e) return {
475
422
  title: n.detailsNotFoundTitle,
476
423
  description: n.detailsNotFoundDescription.replace("{invoiceId}", t)
@@ -480,4 +427,4 @@ function O(e, t, n) {
480
427
  description: n.detailsUnsupportedDescription.replace("{type}", e.type)
481
428
  };
482
429
  }
483
- export { O as buildDetailsMessageView, D as buildReceivableDetailsView, h as formatReminderSchedule, _ as frequencyLabel, y as seriesStatusLabel };
430
+ export { E as buildDetailsMessageView, T as buildReceivableDetailsView, _ as formatReminderSchedule, y as frequencyLabel, S as seriesStatusLabel };