@tesouro/embedded-components-react 0.5.267 → 0.5.270

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 (56) hide show
  1. package/dist/index.css +4 -10
  2. package/dist/index.d.ts +13 -9
  3. package/dist/lib/ReceivablesWidget.d.ts +13 -9
  4. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/index.js +3 -1
  5. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartDetailsContainer.js +44 -0
  6. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartDetailsSheetView.js +97 -0
  7. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartsWidget.js +76 -150
  8. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +63 -57
  9. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/actionsModal.js +1 -1
  10. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/auditHistory/labels.js +1 -1
  11. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/details.js +161 -152
  12. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/helpers.js +30 -34
  13. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/labels.js +12 -8
  14. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/statusCards.js +18 -19
  15. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActions.js +208 -158
  16. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableDetails.js +91 -85
  17. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableForm.js +197 -196
  18. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesWidget.js +147 -115
  19. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +14 -14
  20. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +3 -5
  21. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index14.js +37 -34
  22. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index22.js +22 -7
  23. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index23.js +17 -15
  24. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index24.js +17 -13
  25. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index26.js +37 -31
  26. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index27.js +29 -23
  27. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index29.js +38 -11
  28. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index30.js +26 -28
  29. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index31.js +20 -14
  30. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index32.js +8 -24
  31. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index33.js +34 -83
  32. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index34.js +14 -404
  33. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index35.js +28 -2
  34. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index36.js +79 -39
  35. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index37.js +490 -68
  36. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index38.js +2 -502
  37. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index39.js +41 -216
  38. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index40.js +70 -21
  39. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index41.js +484 -5
  40. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index42.js +224 -0
  41. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index43.js +21 -263
  42. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index44.js +8 -2
  43. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index46.js +261 -24
  44. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index47.js +2 -237
  45. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index48.js +100 -3
  46. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index49.js +21 -242
  47. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index50.js +226 -82
  48. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index51.js +3 -59
  49. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index52.js +233 -178
  50. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index53.js +85 -37
  51. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index54.js +60 -0
  52. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index55.js +194 -0
  53. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index56.js +45 -0
  54. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  55. package/package.json +1 -1
  56. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index45.js +0 -100
@@ -1,13 +1,17 @@
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, getStatusTone 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 { buildReceivableNotesView as i, formatDate as a, formatMoney as o } from "./helpers.js";
5
+ import { getPaymentAccountLineLabel as s } from "./bankAccounts.js";
6
+ import { formatCountryName as c, formatDeduction as l } from "./preview.js";
7
7
  //#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/details.js
8
- var d = {
8
+ var u = {
9
9
  draft: {
10
- primary: ["edit", "issue"],
10
+ primary: [
11
+ "edit",
12
+ "issue",
13
+ "issueAndSend"
14
+ ],
11
15
  overflow: ["clone", "delete"]
12
16
  },
13
17
  issued: {
@@ -42,13 +46,13 @@ var d = {
42
46
  primary: [],
43
47
  overflow: []
44
48
  }
45
- }, f = /* @__PURE__ */ new Set([
49
+ }, d = /* @__PURE__ */ new Set([
46
50
  "issued",
47
51
  "overdue",
48
52
  "partially_paid",
49
53
  "paid",
50
54
  "uncollectible"
51
- ]), p = {
55
+ ]), f = {
52
56
  draft: "neutral",
53
57
  issuing: "info",
54
58
  issued: "info",
@@ -64,28 +68,28 @@ var d = {
64
68
  recurring: "neutral",
65
69
  deleted: "neutral"
66
70
  };
67
- function m(e, t = /* @__PURE__ */ new Date()) {
71
+ function p(e, t = /* @__PURE__ */ new Date()) {
68
72
  if (!e) return 0;
69
73
  let n = new Date(e);
70
74
  if (Number.isNaN(n.getTime())) return 0;
71
75
  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);
72
76
  return a > 0 ? a : 0;
73
77
  }
74
- function h(e, t) {
78
+ function m(e, t) {
75
79
  let n = e.map((e) => `${e} ${e === 1 ? t.reminderUnitDay : t.reminderUnitDays}`);
76
80
  if (n.length <= 1) return n[0] ?? "";
77
81
  let r = t.reminderNameAnd;
78
82
  return n.length === 2 ? `${n[0]} ${r} ${n[1]}` : `${n.slice(0, -1).join(", ")}, ${r} ${n[n.length - 1]}`;
79
83
  }
80
- function g({ paymentReminder: e, overdueReminder: t, remindersConfigured: n, messages: r }) {
84
+ function h({ paymentReminder: e, overdueReminder: t, remindersConfigured: n, messages: r }) {
81
85
  let i = [
82
86
  e?.term_1_reminder?.days_before,
83
87
  e?.term_2_reminder?.days_before,
84
88
  e?.term_final_reminder?.days_before
85
89
  ].filter((e) => typeof e == "number"), a = (t?.terms ?? []).map((e) => e.days_after).filter((e) => typeof e == "number"), o = [];
86
- return i.length > 0 && o.push(`${h(i, r)} ${r.detailsRemindersBefore}`), a.length > 0 && o.push(`${h(a, r)} ${r.detailsRemindersAfter}`), o.length > 0 ? o.join("\n") : n ? "-" : r.detailsRemindersNone;
90
+ 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;
87
91
  }
88
- function _(e, t) {
92
+ function g(e, t) {
89
93
  return {
90
94
  day: t.detailsFrequencyDay,
91
95
  week: t.detailsFrequencyWeek,
@@ -94,7 +98,7 @@ function _(e, t) {
94
98
  year: t.detailsFrequencyYear
95
99
  }[e] ?? "";
96
100
  }
97
- function v(e, t) {
101
+ function ee(e, t) {
98
102
  return {
99
103
  day: t.detailsPeriodDay,
100
104
  week: t.detailsPeriodWeek,
@@ -103,7 +107,7 @@ function v(e, t) {
103
107
  year: t.detailsPeriodYear
104
108
  }[e] ?? "";
105
109
  }
106
- function y(e, t) {
110
+ function te(e, t) {
107
111
  return {
108
112
  active: t.detailsSeriesStatusActive,
109
113
  paused: t.detailsSeriesStatusPaused,
@@ -111,17 +115,17 @@ function y(e, t) {
111
115
  completed: t.detailsSeriesStatusCompleted
112
116
  }[e] ?? "";
113
117
  }
114
- var b = {
118
+ var ne = {
115
119
  active: "info",
116
120
  paused: "warning",
117
121
  canceled: "danger",
118
122
  completed: "success"
119
- }, ee = {
123
+ }, _ = {
120
124
  active: "forward",
121
125
  paused: "pause",
122
126
  canceled: "ban",
123
127
  completed: "check"
124
- }, x = {
128
+ }, v = {
125
129
  pending: "neutral",
126
130
  skipped: "warning",
127
131
  canceled: "danger",
@@ -129,7 +133,7 @@ var b = {
129
133
  send_failed: "danger",
130
134
  completed: "success"
131
135
  };
132
- function S(e, t) {
136
+ function y(e, t) {
133
137
  return {
134
138
  pending: t.detailsIterationStatusPending,
135
139
  skipped: t.detailsIterationStatusSkipped,
@@ -139,48 +143,48 @@ function S(e, t) {
139
143
  completed: t.detailsIterationStatusCompleted
140
144
  }[e] ?? "";
141
145
  }
142
- function C(e, t, n) {
143
- return n.detailsSeriesTitle.replace("{name}", e.counterpart_name ?? n.invoiceType).replace("{frequency}", _(t.frequency, n));
146
+ function b(e, t, n) {
147
+ return n.detailsSeriesTitle.replace("{name}", e.counterpart_name ?? n.invoiceType).replace("{frequency}", g(t.frequency, n));
144
148
  }
145
- function w(e, t) {
149
+ function x(e, t) {
146
150
  return t[e] ?? t.unknown;
147
151
  }
148
- function T({ invoice: e, recurrence: t, iterationInvoices: n, date: r, statusLabels: i, messages: a, onOpenReceivable: c }) {
149
- return (t.iterations ?? []).map((t, l) => {
150
- let u = t.issued_invoice_id, d = u ? n.get(u) : void 0, f = d ?? e;
152
+ function S({ invoice: e, recurrence: t, iterationInvoices: n, date: r, statusLabels: i, messages: a, onOpenReceivable: s }) {
153
+ return (t.iterations ?? []).map((t, c) => {
154
+ let l = t.issued_invoice_id, u = l ? n.get(l) : void 0, d = u ?? e;
151
155
  return {
152
- id: `iteration-${t.iteration ?? ""}-${l}`,
156
+ id: `iteration-${t.iteration ?? ""}-${c}`,
153
157
  issueDateLabel: t.issue_at ? r(t.issue_at) : a.detailsPending,
154
158
  amountLabel: o({
155
- amount: f.total_amount ?? 0,
156
- currency: f.currency,
159
+ amount: d.total_amount ?? 0,
160
+ currency: d.currency,
157
161
  fallback: ""
158
162
  }),
159
- chip: d ? {
163
+ chip: u ? {
160
164
  kind: "invoice",
161
- label: w(d.status, i),
162
- tone: s(d.status)
165
+ label: x(u.status, i),
166
+ status: u.status
163
167
  } : {
164
168
  kind: "iteration",
165
- label: S(t.status, a),
166
- tone: x[t.status] ?? "neutral"
169
+ label: y(t.status, a),
170
+ tone: v[t.status] ?? "neutral"
167
171
  },
168
- numberLabel: u ? d?.document_id ?? "" : a.detailsPending,
169
- onOpen: d ? () => c(d.id) : void 0,
170
- openLabel: d ? a.detailsScheduleOpenInvoice.replace("{number}", d.document_id ?? "") : void 0
172
+ numberLabel: l ? u?.document_id ?? "" : a.detailsPending,
173
+ onOpen: u ? () => s(u.id) : void 0,
174
+ openLabel: u ? a.detailsScheduleOpenInvoice.replace("{number}", u.document_id ?? "") : void 0
171
175
  };
172
176
  });
173
177
  }
174
- function E(e) {
178
+ function re(e) {
175
179
  if (!e?.line1) return;
176
180
  let t = [e.city, [e.state, e.postal_code].filter(Boolean).join(" ")].filter(Boolean).join(", ");
177
181
  return [
178
182
  e.line2 ? `${e.line1} ${e.line2}` : e.line1,
179
183
  t,
180
- e.country ? l(e.country) : void 0
184
+ e.country ? c(e.country) : void 0
181
185
  ].filter(Boolean).join(", ");
182
186
  }
183
- function D(e, t, n) {
187
+ function C(e, t, n) {
184
188
  let r = {
185
189
  label: n.detailsAmountReceived,
186
190
  value: t(e.amount_paid)
@@ -242,7 +246,7 @@ function D(e, t, n) {
242
246
  };
243
247
  }
244
248
  }
245
- function te(t, i, a) {
249
+ function ie(t, i, a) {
246
250
  let o = t.line_items.reduce((t, n) => {
247
251
  let r = n.total_before_tax ?? 0;
248
252
  return e(n.tax_status) ? {
@@ -258,7 +262,7 @@ function te(t, i, a) {
258
262
  }), s = r({
259
263
  discount: t.discount,
260
264
  subtotal: o.taxableItemsSubtotal + o.nonTaxableItemsSubtotal
261
- }), { taxableSubtotal: c, nonTaxableSubtotal: l } = n({
265
+ }), { taxableSubtotal: c, nonTaxableSubtotal: u } = n({
262
266
  ...o,
263
267
  discountAmount: s
264
268
  }), d = s > 0, f = o.taxableItemsSubtotal > 0, p = o.nonTaxableItemsSubtotal > 0, m = [{
@@ -267,10 +271,10 @@ function te(t, i, a) {
267
271
  }];
268
272
  d && m.push({
269
273
  label: a.previewDiscount,
270
- value: u(s, t.currency)
274
+ value: l(s, t.currency)
271
275
  }), p && (f || d) && m.push({
272
276
  label: a.previewNonTaxableSubtotal,
273
- value: i(l),
277
+ value: i(u),
274
278
  tone: "muted"
275
279
  }), f && (p || d) && m.push({
276
280
  label: a.previewTaxableSubtotal,
@@ -287,177 +291,182 @@ function te(t, i, a) {
287
291
  emphasis: !0
288
292
  }), m;
289
293
  }
290
- var ne = {
294
+ var ae = {
291
295
  primary: [],
292
296
  overflow: []
293
297
  };
294
- function O({ receivable: e, pdfUrl: n, paymentReminder: r, overdueReminder: s, depositAccount: l, isAccountListIncomplete: u, recurrence: h, paymentRecords: x = [], isLoadingPaymentRecords: S = !1, iterationInvoices: w = /* @__PURE__ */ new Map(), auditHistory: O, statusLabels: k, messages: A, canRecordPayment: j, canWrite: M = !0, onOpenReceivable: N, now: P }) {
298
+ function w({ receivable: e, pdfUrl: n, paymentReminder: r, overdueReminder: c, depositAccount: l, isAccountListIncomplete: m, recurrence: v, paymentRecords: y = [], isLoadingPaymentRecords: x = !1, iterationInvoices: w = /* @__PURE__ */ new Map(), auditHistory: T, statusLabels: E, messages: D, canRecordPayment: O, canWrite: k = !0, onOpenReceivable: A, onOpenCustomer: j, now: oe }) {
295
299
  if (!e || e.type !== "invoice") return;
296
- let F = e, I = (e) => o({
300
+ let M = e, N = (e) => o({
297
301
  amount: e ?? 0,
298
- currency: F.currency,
302
+ currency: M.currency,
299
303
  fallback: ""
300
- }), L = (e) => a(e, "-"), R = (e) => e ? L(e) : A.detailsPending, { status: z } = F, B = z === "canceled", V = z === "recurring" ? h : void 0, H = F.recurrence_id && z !== "recurring" ? h : void 0, U = z === "overdue" ? m(F.due_date, P) : 0, { amountTone: W, amountRows: re } = D(F, I, A), G = F.counterpart_contact, K = E(F.counterpart_billing_address), ie = [
301
- ...F.counterpart_name ? [{
302
- label: A.detailsCustomerName,
303
- value: F.counterpart_name
304
+ }), P = (e) => a(e, "-"), F = (e) => e ? P(e) : D.detailsPending, { status: I } = M, L = I === "canceled", R = I === "recurring" ? v : void 0, z = M.recurrence_id && I !== "recurring" ? v : void 0, B = I === "overdue" ? p(M.due_date, oe) : 0, { amountTone: V, amountRows: H } = C(M, N, D), U = M.counterpart_contact, W = re(M.counterpart_billing_address), G = M.counterpart_id, K = M.counterpart_name ? {
305
+ label: D.detailsCustomerName,
306
+ name: M.counterpart_name,
307
+ onOpen: j && G ? () => j(G) : void 0
308
+ } : void 0, se = [
309
+ ...U?.email ? [{
310
+ label: D.detailsCustomerEmail,
311
+ value: U.email
304
312
  }] : [],
305
- ...G?.email ? [{
306
- label: A.detailsCustomerEmail,
307
- value: G.email
313
+ ...U?.phone ? [{
314
+ label: D.detailsCustomerPhone,
315
+ value: U.phone
308
316
  }] : [],
309
- ...G?.phone ? [{
310
- label: A.detailsCustomerPhone,
311
- value: G.phone
312
- }] : [],
313
- ...K ? [{
314
- label: A.detailsCustomerAddress,
315
- value: K
317
+ ...W ? [{
318
+ label: D.detailsCustomerAddress,
319
+ value: W
316
320
  }] : []
317
321
  ], q = {
318
- label: A.detailsPaymentReminders,
319
- value: g({
322
+ label: D.detailsPaymentReminders,
323
+ value: h({
320
324
  paymentReminder: r,
321
- overdueReminder: s,
322
- remindersConfigured: !!(F.payment_reminder_id || F.overdue_reminder_id),
323
- messages: A
325
+ overdueReminder: c,
326
+ remindersConfigured: !!(M.payment_reminder_id || M.overdue_reminder_id),
327
+ messages: D
324
328
  })
325
329
  }, J = {
326
- label: A.detailsDepositAccount,
327
- value: l ? c(l, A) : u && F.bank_account_id ? "-" : A.detailsNotProvided
330
+ label: D.detailsDepositAccount,
331
+ value: l ? s(l, D) : m && M.bank_account_id ? "-" : D.detailsNotProvided
328
332
  }, Y = {
329
- label: A.detailsPaymentTerms,
330
- value: F.payment_terms?.name ?? A.detailsPending
331
- }, ae = V ? [
333
+ label: D.detailsPaymentTerms,
334
+ value: M.payment_terms?.name ?? D.detailsPending
335
+ }, ce = R ? [
332
336
  {
333
- label: A.detailsFrequency,
334
- value: _(V.frequency, A)
337
+ label: D.detailsFrequency,
338
+ value: g(R.frequency, D)
335
339
  },
336
340
  {
337
- label: A.detailsInvoiceAmount,
338
- value: I(F.total_amount)
341
+ label: D.detailsInvoiceAmount,
342
+ value: N(M.total_amount)
339
343
  },
340
344
  Y,
341
345
  q,
342
346
  {
343
- label: A.detailsPoNumber,
344
- value: F.purchase_order || A.detailsNotProvided
347
+ label: D.detailsPoNumber,
348
+ value: M.purchase_order || D.detailsNotProvided
345
349
  },
346
350
  J
347
351
  ] : [
348
- ...F.document_id ? [{
349
- label: A.detailsInvoiceNumber,
350
- value: F.document_id
352
+ ...M.document_id ? [{
353
+ label: D.detailsInvoiceNumber,
354
+ value: M.document_id
351
355
  }] : [],
352
356
  {
353
- label: A.detailsInvoiceAmount,
354
- value: I(F.total_amount)
357
+ label: D.detailsInvoiceAmount,
358
+ value: N(M.total_amount)
355
359
  },
356
360
  {
357
- label: A.detailsInvoiceDate,
358
- value: R(F.issue_date)
361
+ label: D.detailsInvoiceDate,
362
+ value: F(M.issue_date)
359
363
  },
360
364
  {
361
- label: A.detailsDueDate,
362
- value: R(F.due_date)
365
+ label: D.detailsDueDate,
366
+ value: F(M.due_date)
363
367
  },
364
368
  Y,
365
369
  q,
366
- ...F.purchase_order ? [{
367
- label: A.detailsPoNumber,
368
- value: F.purchase_order
370
+ ...M.purchase_order ? [{
371
+ label: D.detailsPoNumber,
372
+ value: M.purchase_order
369
373
  }] : [],
370
374
  J
371
- ], X = V ? void 0 : i(F), { primary: Z, overflow: Q } = M ? d[z] ?? {
375
+ ], X = R ? void 0 : i(M), { primary: Z, overflow: Q } = k ? u[I] ?? {
372
376
  primary: [],
373
377
  overflow: ["clone"]
374
- } : ne;
375
- if (V && M) {
376
- let e = V.status === "active" || V.status === "paused";
377
- Q = V.status === "active" ? ["pauseRecurrence", "cancelRecurrence"] : V.status === "paused" ? ["resumeRecurrence", "cancelRecurrence"] : [], Z = e ? ["edit"] : [];
378
+ } : ae;
379
+ if (R && k) {
380
+ let e = R.status === "active" || R.status === "paused";
381
+ Q = R.status === "active" ? ["pauseRecurrence", "cancelRecurrence"] : R.status === "paused" ? ["resumeRecurrence", "cancelRecurrence"] : [], Z = e ? ["edit"] : [];
378
382
  }
379
- j || (Z = Z.filter((e) => e !== "recordPayment"));
380
- let oe = f.has(z) ? {
381
- rows: x.map((e) => ({
383
+ O || (Z = Z.filter((e) => e !== "recordPayment"));
384
+ let le = d.has(I) ? {
385
+ rows: y.map((e) => ({
382
386
  id: e.id,
383
- dateLabel: L(e.paid_at),
384
- amountLabel: I(e.amount)
387
+ dateLabel: P(e.paid_at),
388
+ amountLabel: N(e.amount)
385
389
  })),
386
- totalLabel: I(F.amount_paid),
387
- emptyTone: z === "overdue" ? "danger" : "default",
388
- isLoading: S
389
- } : void 0, se = V ? {
390
- statusLabel: y(V.status, A),
391
- statusTone: b[V.status] ?? "neutral",
392
- statusIcon: ee[V.status],
393
- amountLabel: I(F.total_amount),
394
- amountPeriodLabel: v(V.frequency, A),
395
- startsOnLabel: R(V.start_date),
396
- endsOnLabel: L(V.end_date),
397
- scheduleTitle: A.detailsScheduleTitle.replace("{frequency}", _(V.frequency, A)),
398
- schedule: T({
399
- invoice: F,
400
- recurrence: V,
390
+ totalLabel: N(M.amount_paid),
391
+ emptyTone: I === "overdue" ? "danger" : "default",
392
+ isLoading: x
393
+ } : void 0, ue = R ? {
394
+ statusLabel: te(R.status, D),
395
+ statusTone: ne[R.status] ?? "neutral",
396
+ statusIcon: _[R.status],
397
+ amountLabel: N(M.total_amount),
398
+ amountPeriodLabel: ee(R.frequency, D),
399
+ startsOnLabel: F(R.start_date),
400
+ endsOnLabel: P(R.end_date),
401
+ scheduleTitle: D.detailsScheduleTitle.replace("{frequency}", g(R.frequency, D)),
402
+ schedule: S({
403
+ invoice: M,
404
+ recurrence: R,
401
405
  iterationInvoices: w,
402
- date: L,
403
- statusLabels: k,
404
- messages: A,
405
- onOpenReceivable: N
406
+ date: P,
407
+ statusLabels: E,
408
+ messages: D,
409
+ onOpenReceivable: A
406
410
  })
407
- } : void 0, $ = H ? C(F, H, A) : void 0, ce = H && $ ? {
411
+ } : void 0, $ = z ? b(M, z, D) : void 0, de = z && $ ? {
408
412
  title: $,
409
- backLabel: A.detailsSeriesBack.replace("{title}", $),
410
- onOpen: () => N(H.invoice_id)
413
+ backLabel: D.detailsSeriesBack.replace("{title}", $),
414
+ onOpen: () => A(z.invoice_id)
411
415
  } : void 0;
412
416
  return {
413
- id: F.id,
414
- type: F.type,
415
- title: V ? C(F, V, A) : F.counterpart_name ?? A.invoiceType,
416
- status: z,
417
- statusTone: p[z] ?? "neutral",
417
+ id: M.id,
418
+ type: M.type,
419
+ title: R ? b(M, R, D) : M.counterpart_name ?? D.invoiceType,
420
+ status: I,
421
+ statusTone: f[I] ?? "neutral",
418
422
  pdfUrl: n,
419
- lineItems: F.line_items.map((e, t) => ({
423
+ lineItems: M.line_items.map((e, t) => ({
420
424
  id: `${e.product.id ?? "item"}-${t}`,
421
425
  name: e.product.name,
422
426
  quantityLabel: String(e.quantity),
423
- unitPriceLabel: I(e.product.price?.value),
424
- totalLabel: I(e.total_before_tax ?? (e.product.price?.value ?? 0) * e.quantity)
427
+ unitPriceLabel: N(e.product.price?.value),
428
+ totalLabel: N(e.total_before_tax ?? (e.product.price?.value ?? 0) * e.quantity)
425
429
  })),
426
430
  panel: {
427
- subtitle: V ? A.detailsSeriesSubtitle : F.document_id ? A.detailsInvoiceSubtitle.replace("{number}", F.document_id) : void 0,
428
- statusLabel: z === "partially_paid" ? k.issued : k[z] ?? k.unknown,
429
- recurring: !!F.recurrence_id || z === "recurring",
430
- overdueLabel: U > 0 ? A.detailsDaysOverdue.replace("{days}", String(U)) : void 0,
431
- amountTone: W,
432
- amountRows: re,
433
- issueDateLabel: R(F.issue_date),
434
- dueDateLabel: B ? L(F.updated_at) : R(F.due_date),
435
- dueDateCaption: B ? A.detailsCancelledOnCaption : A.detailsDueDate,
436
- paymentHistory: oe,
437
- customerContact: ie,
438
- recurringSeries: se,
439
- seriesLink: ce,
440
- billingItems: ae,
441
- lineItemsSection: V ? void 0 : {
442
- countLabel: String(F.line_items.length),
443
- totals: te(F, I, A)
431
+ subtitle: R ? D.detailsSeriesSubtitle : M.document_id ? D.detailsInvoiceSubtitle.replace("{number}", M.document_id) : void 0,
432
+ statusLabel: I === "partially_paid" ? E.issued : E[I] ?? E.unknown,
433
+ recurring: !!M.recurrence_id || I === "recurring",
434
+ overdueLabel: B > 0 ? D.detailsDaysOverdue.replace("{days}", String(B)) : void 0,
435
+ amountTone: V,
436
+ amountRows: H,
437
+ issueDateLabel: F(M.issue_date),
438
+ dueDateLabel: L ? P(M.updated_at) : F(M.due_date),
439
+ dueDateCaption: L ? D.detailsCancelledOnCaption : D.detailsDueDate,
440
+ paymentHistory: le,
441
+ customerName: K,
442
+ customerContact: se,
443
+ recurringSeries: ue,
444
+ seriesLink: de,
445
+ billingItems: ce,
446
+ lineItemsSection: R ? void 0 : {
447
+ countLabel: String(M.line_items.length),
448
+ totals: ie(M, N, D)
444
449
  },
445
450
  notes: X && {
446
451
  ...X,
447
452
  countLabel: String([X.opening, X.closing].filter(Boolean).length)
448
453
  },
449
- attachments: t(F, A),
450
- auditHistory: O,
454
+ attachments: t(M, D),
455
+ auditHistory: T,
451
456
  primaryActions: Z,
452
457
  overflowActions: Q
453
458
  }
454
459
  };
455
460
  }
456
- function k(e, t) {
457
- if (e && e.type !== "invoice") return {
458
- title: t.detailsUnsupportedTitle,
459
- description: t.detailsUnsupportedDescription.replace("{type}", e.type)
461
+ function T(e, t, n) {
462
+ if (!e) return {
463
+ title: n.detailsNotFoundTitle,
464
+ description: n.detailsNotFoundDescription.replace("{invoiceId}", t)
465
+ };
466
+ if (e.type !== "invoice") return {
467
+ title: n.detailsUnsupportedTitle,
468
+ description: n.detailsUnsupportedDescription.replace("{type}", e.type)
460
469
  };
461
470
  }
462
471
  //#endregion
463
- export { O as buildReceivableDetailsView, k as buildUnsupportedDetailsView, g as formatReminderSchedule, m as getDaysOverdue };
472
+ export { T as buildDetailsMessageView, w as buildReceivableDetailsView, h as formatReminderSchedule, p as getDaysOverdue };