@tesouro/embedded-components-react 0.5.252 → 0.5.255

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 (67) hide show
  1. package/dist/index.d.ts +95 -79
  2. package/dist/lib/ReceivablesWidget.d.ts +25 -9
  3. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index24.js +4 -1
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index27.js +214 -209
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index35.js +162 -145
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index14.js +2 -2
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index15.js +2 -2
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index31.js +1 -1
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index33.js +2 -2
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index34.js +3 -3
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index37.js +2 -2
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index48.js +1 -1
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index49.js +1 -1
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index5.js +2 -2
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index17.js +32 -23
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index18.js +2 -2
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index2.js +1 -1
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index20.js +5 -5
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index3.js +1 -1
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidgetNative/BillPayWidgetNative.js +48 -48
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidgetNative/BillsTab.js +32 -24
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidgetNative/labels.js +2 -2
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/pay-bill/ui/dist/index5.js +1 -1
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/pay-bill/ui/dist/index6.js +1 -1
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +19 -21
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index10.js +38 -51
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index12.js +12 -2
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index13.js +11 -39
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index14.js +18 -2
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index15.js +2 -14
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index16.js +9 -16
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index17.js +78 -2
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index19.js +2 -78
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index20.js +29 -0
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index21.js +4 -2
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index22.js +26 -25
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index23.js +2 -4
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index24.js +5 -28
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index25.js +34 -2
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index26.js +2 -7
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index6.js +16 -11
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index7.js +54 -2
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index8.js +1 -0
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index9.js +2 -16
  45. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index.js +2 -2
  46. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index10.js +16 -17
  47. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +15 -11
  48. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/details.js +89 -88
  49. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/helpers.js +55 -74
  50. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/labels.js +8 -1
  51. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/paymentRecord.js +71 -0
  52. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActions.js +123 -164
  53. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableDetails.js +40 -37
  54. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablePaymentRecord.js +91 -0
  55. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesTable.js +83 -78
  56. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesWidget.js +7 -3
  57. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/mocks/receivables.js +2 -1
  58. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +15 -8
  59. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index39.js +206 -89
  60. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +2 -2
  61. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +38 -38
  62. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  63. package/dist/packages/shared-ui-shadcn/dist/index.js +8 -7
  64. package/package.json +1 -1
  65. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index18.js +0 -11
  66. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index27.js +0 -34
  67. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index28.js +0 -2
@@ -1,2 +1,54 @@
1
- import "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
- import "react/jsx-runtime";
1
+ import { Button as e, DropdownMenu as t, DropdownMenuContent as n, DropdownMenuGroup as r, DropdownMenuItem as i, DropdownMenuLabel as a, DropdownMenuSeparator as o, DropdownMenuTrigger as s } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { groupBySectionHeading as c } from "./index6.js";
3
+ import { Fragment as l, useId as u } from "react";
4
+ import { jsx as d, jsxs as f } from "react/jsx-runtime";
5
+ import { MoreHorizontalIcon as p, MoreVerticalIcon as m } from "lucide-react";
6
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index7.js
7
+ function h({ actions: h, triggerLabel: g, placement: _ = "row", testId: v }) {
8
+ let y = u();
9
+ if (!h.length) return null;
10
+ let b = _ === "header", x = _ === "header" || _ === "table", S = b ? p : m, C = c(h);
11
+ return /* @__PURE__ */ f(t, { children: [/* @__PURE__ */ d(s, {
12
+ asChild: !0,
13
+ children: /* @__PURE__ */ d(e, {
14
+ type: "button",
15
+ variant: x ? "ghost" : "outline",
16
+ size: "icon",
17
+ "aria-label": g,
18
+ "data-testid": v,
19
+ onPointerDown: (e) => e.stopPropagation(),
20
+ onClick: (e) => e.stopPropagation(),
21
+ children: /* @__PURE__ */ d(S, { className: "ttw:size-4" })
22
+ })
23
+ }), /* @__PURE__ */ d(n, {
24
+ align: "end",
25
+ onPointerDown: (e) => e.stopPropagation(),
26
+ onClick: (e) => e.stopPropagation(),
27
+ children: C.map((e, t) => {
28
+ let n = e.items.map((e) => {
29
+ let t = e.icon;
30
+ return /* @__PURE__ */ f(i, {
31
+ disabled: e.disabled,
32
+ onClick: e.onSelect,
33
+ children: [t ? /* @__PURE__ */ d(t, { className: "ttw:size-4" }) : null, e.label]
34
+ }, e.id);
35
+ });
36
+ if (!e.heading) return /* @__PURE__ */ d(l, { children: n }, e.items[0]?.id);
37
+ let s = `${y}-${t}`;
38
+ return /* @__PURE__ */ f(l, { children: [
39
+ t > 0 ? /* @__PURE__ */ d(o, {}) : null,
40
+ /* @__PURE__ */ d(a, {
41
+ id: s,
42
+ className: "ttw:py-1 ttw:text-xs ttw:font-medium ttw:text-muted-foreground",
43
+ children: e.heading
44
+ }),
45
+ /* @__PURE__ */ d(r, {
46
+ "aria-labelledby": s,
47
+ children: n
48
+ })
49
+ ] }, e.items[0]?.id);
50
+ })
51
+ })] });
52
+ }
53
+ //#endregion
54
+ export { h as BillOverflowMenu, h as default };
@@ -1 +1,2 @@
1
+ import "./index6.js";
1
2
  import "./index7.js";
@@ -1,18 +1,4 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index9.js
2
- function e(e) {
3
- let t = [];
4
- for (let n of e) {
5
- let e = t.at(-1);
6
- if (e && e.heading === n.sectionHeading) {
7
- e.items = [...e.items, n];
8
- continue;
9
- }
10
- t.push({
11
- heading: n.sectionHeading,
12
- items: [n]
13
- });
14
- }
15
- return t;
16
- }
2
+ var e = {};
17
3
  //#endregion
18
- export { e as groupBySectionHeading };
4
+ export { e as DEFAULT_LABELS };
@@ -7,8 +7,8 @@ import { useDeleteReceivableAttachmentMutation as i, useUploadReceivableAttachme
7
7
  import { useSendReceivableEmailMutation as o } from "./index7.js";
8
8
  import { useAcceptReceivableMutation as s, useCancelReceivableMutation as c, useCloneReceivableMutation as l, useCreateReceivableMutation as u, useDeclineReceivableMutation as d, useDeleteReceivableMutation as f, useIssueReceivableMutation as p, useUpdateReceivableMutation as m } from "./index8.js";
9
9
  import { useReceivablePaymentRecordsQuery as h } from "./index9.js";
10
- import { useMarkReceivablePaidMutation as g, useMarkReceivablePartiallyPaidMutation as _, useMarkReceivableUncollectibleMutation as v } from "./index10.js";
10
+ import { useCreateReceivablePaymentRecordMutation as g, useMarkReceivablePaidMutation as _, useMarkReceivableUncollectibleMutation as v } from "./index10.js";
11
11
  import { useReceivablePdfLinkQuery as y, useReceivableQuery as b, useReceivableRequiredFieldsQuery as x, useReceivablesByIdQueries as S, useReceivablesQuery as C } from "./index11.js";
12
12
  import { useCancelRecurrenceMutation as w, useCreateOverdueReminderMutation as T, useCreatePaymentReminderMutation as E, useCreateRecurrenceMutation as D, useOverdueRemindersQuery as O, usePauseRecurrenceMutation as k, usePaymentRemindersQuery as A, useRecurrenceQuery as j, useResumeRecurrenceMutation as M, useUpdateRecurrenceMutation as N } from "./index12.js";
13
13
  import { useReceivablesAnalyticsQuery as P } from "./index13.js";
14
- export { s as useAcceptReceivableMutation, t as useAllReceivableHistoryQuery, c as useCancelReceivableMutation, w as useCancelRecurrenceMutation, l as useCloneReceivableMutation, n as useCreateEntityBankAccountMutation, T as useCreateOverdueReminderMutation, E as useCreatePaymentReminderMutation, u as useCreateReceivableMutation, D as useCreateRecurrenceMutation, d as useDeclineReceivableMutation, i as useDeleteReceivableAttachmentMutation, f as useDeleteReceivableMutation, p as useIssueReceivableMutation, g as useMarkReceivablePaidMutation, _ as useMarkReceivablePartiallyPaidMutation, v as useMarkReceivableUncollectibleMutation, O as useOverdueRemindersQuery, k as usePauseRecurrenceMutation, r as usePaymentAccountsQuery, A as usePaymentRemindersQuery, e as usePaymentTermsQuery, h as useReceivablePaymentRecordsQuery, y as useReceivablePdfLinkQuery, b as useReceivableQuery, x as useReceivableRequiredFieldsQuery, P as useReceivablesAnalyticsQuery, S as useReceivablesByIdQueries, C as useReceivablesQuery, j as useRecurrenceQuery, M as useResumeRecurrenceMutation, o as useSendReceivableEmailMutation, m as useUpdateReceivableMutation, N as useUpdateRecurrenceMutation, a as useUploadReceivableAttachmentMutation };
14
+ export { s as useAcceptReceivableMutation, t as useAllReceivableHistoryQuery, c as useCancelReceivableMutation, w as useCancelRecurrenceMutation, l as useCloneReceivableMutation, n as useCreateEntityBankAccountMutation, T as useCreateOverdueReminderMutation, E as useCreatePaymentReminderMutation, u as useCreateReceivableMutation, g as useCreateReceivablePaymentRecordMutation, D as useCreateRecurrenceMutation, d as useDeclineReceivableMutation, i as useDeleteReceivableAttachmentMutation, f as useDeleteReceivableMutation, p as useIssueReceivableMutation, _ as useMarkReceivablePaidMutation, v as useMarkReceivableUncollectibleMutation, O as useOverdueRemindersQuery, k as usePauseRecurrenceMutation, r as usePaymentAccountsQuery, A as usePaymentRemindersQuery, e as usePaymentTermsQuery, h as useReceivablePaymentRecordsQuery, y as useReceivablePdfLinkQuery, b as useReceivableQuery, x as useReceivableRequiredFieldsQuery, P as useReceivablesAnalyticsQuery, S as useReceivablesByIdQueries, C as useReceivablesQuery, j as useRecurrenceQuery, M as useResumeRecurrenceMutation, o as useSendReceivableEmailMutation, m as useUpdateReceivableMutation, N as useUpdateRecurrenceMutation, a as useUploadReceivableAttachmentMutation };
@@ -2,7 +2,7 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { postReceivablesIdMarkAsPaid as e, postReceivablesIdMarkAsPartiallyPaid as t, postReceivablesIdMarkAsUncollectible as n } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
5
+ import { postPaymentRecords as e, postReceivablesIdMarkAsPaid as t, postReceivablesIdMarkAsUncollectible as n } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
6
6
  import { invalidateAllClients as r } from "../../../shared/data-access/dist/lib/clientRegistry.js";
7
7
  import { useEmbedApi as i } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
8
8
  import { organizationHeaders as a } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
@@ -37,11 +37,11 @@ async function f({ client: e, organizationId: t, receivableId: n }) {
37
37
  ]);
38
38
  }
39
39
  function p() {
40
- let { client: t, organizationId: n } = i();
40
+ let { client: e, organizationId: n } = i();
41
41
  return d({
42
42
  mutationFn: async ({ path: r, body: i }) => {
43
- let { data: o } = await e({
44
- client: t,
43
+ let { data: o } = await t({
44
+ client: e,
45
45
  headers: a(n),
46
46
  path: r,
47
47
  body: i,
@@ -49,9 +49,9 @@ function p() {
49
49
  });
50
50
  return o;
51
51
  },
52
- onSuccess: async (e, r) => {
52
+ onSuccess: async (t, r) => {
53
53
  await f({
54
- client: t,
54
+ client: e,
55
55
  organizationId: n,
56
56
  receivableId: r.path.receivable_id
57
57
  });
@@ -59,23 +59,22 @@ function p() {
59
59
  });
60
60
  }
61
61
  function m() {
62
- let { client: e, organizationId: n } = i();
62
+ let { client: t, organizationId: n } = i();
63
63
  return d({
64
- mutationFn: async ({ path: r, body: i }) => {
65
- let { data: o } = await t({
66
- client: e,
64
+ mutationFn: async ({ body: r }) => {
65
+ let { data: i } = await e({
66
+ client: t,
67
67
  headers: a(n),
68
- path: r,
69
- body: i,
68
+ body: r,
70
69
  throwOnError: !0
71
70
  });
72
- return o;
71
+ return i;
73
72
  },
74
- onSuccess: async (t, r) => {
73
+ onSuccess: async (e, r) => {
75
74
  await f({
76
- client: e,
75
+ client: t,
77
76
  organizationId: n,
78
- receivableId: r.path.receivable_id
77
+ receivableId: r.body.object.id
79
78
  });
80
79
  }
81
80
  });
@@ -103,4 +102,4 @@ function h() {
103
102
  });
104
103
  }
105
104
  //#endregion
106
- export { p as useMarkReceivablePaidMutation, m as useMarkReceivablePartiallyPaidMutation, h as useMarkReceivableUncollectibleMutation };
105
+ export { m as useCreateReceivablePaymentRecordMutation, p as useMarkReceivablePaidMutation, h as useMarkReceivableUncollectibleMutation };
@@ -254,19 +254,23 @@ function k({ auditHistoryLabels: i, counterpartFormLabels: c, counterpartMessage
254
254
  labels: J
255
255
  }),
256
256
  /* @__PURE__ */ D(_, {
257
- open: Q.actions.paymentOpen,
257
+ open: Q.actions.payment.isOpen,
258
258
  onOpenChange: (e) => {
259
- e || Q.actions.closePayment();
259
+ e || Q.actions.payment.close();
260
260
  },
261
- values: Q.actions.paymentValues,
262
- errors: Q.actions.paymentErrors,
263
- inProgress: Q.actions.paymentInProgress || Q.actionsSuspended,
264
- onChange: (e) => Q.actions.setPaymentValues((t) => ({
265
- ...t,
266
- ...e
267
- })),
268
- onSubmit: Q.actions.submitPayment,
269
- onCancel: Q.actions.closePayment,
261
+ step: Q.actions.payment.step,
262
+ values: Q.actions.payment.values,
263
+ errors: Q.actions.payment.errors,
264
+ currencySymbol: Q.actions.payment.currencySymbol,
265
+ amountDueLabel: Q.actions.payment.amountDueLabel,
266
+ review: Q.actions.payment.review,
267
+ inProgress: Q.actions.payment.inProgress || Q.actionsSuspended,
268
+ onChange: Q.actions.payment.change,
269
+ onFillAmountDue: Q.actions.payment.fillAmountDue,
270
+ onSave: Q.actions.payment.save,
271
+ onEdit: Q.actions.payment.edit,
272
+ onConfirm: Q.actions.payment.confirm,
273
+ onCancel: Q.actions.payment.close,
270
274
  labels: G
271
275
  }),
272
276
  Q.actions.actionDialog && /* @__PURE__ */ D(f, {
@@ -116,12 +116,12 @@ var b = {
116
116
  paused: "warning",
117
117
  canceled: "danger",
118
118
  completed: "success"
119
- }, x = {
119
+ }, ee = {
120
120
  active: "forward",
121
121
  paused: "pause",
122
122
  canceled: "ban",
123
123
  completed: "check"
124
- }, S = {
124
+ }, x = {
125
125
  pending: "neutral",
126
126
  skipped: "warning",
127
127
  canceled: "danger",
@@ -129,7 +129,7 @@ var b = {
129
129
  send_failed: "danger",
130
130
  completed: "success"
131
131
  };
132
- function C(e, t) {
132
+ function S(e, t) {
133
133
  return {
134
134
  pending: t.detailsIterationStatusPending,
135
135
  skipped: t.detailsIterationStatusSkipped,
@@ -139,13 +139,13 @@ function C(e, t) {
139
139
  completed: t.detailsIterationStatusCompleted
140
140
  }[e] ?? "";
141
141
  }
142
- function w(e, t, n) {
142
+ function C(e, t, n) {
143
143
  return n.detailsSeriesTitle.replace("{name}", e.counterpart_name ?? n.invoiceType).replace("{frequency}", _(t.frequency, n));
144
144
  }
145
- function T(e, t) {
145
+ function w(e, t) {
146
146
  return t[e] ?? t.unknown;
147
147
  }
148
- function E({ invoice: e, recurrence: t, iterationInvoices: n, date: r, statusLabels: i, messages: a, onOpenReceivable: c }) {
148
+ function T({ invoice: e, recurrence: t, iterationInvoices: n, date: r, statusLabels: i, messages: a, onOpenReceivable: c }) {
149
149
  return (t.iterations ?? []).map((t, l) => {
150
150
  let u = t.issued_invoice_id, d = u ? n.get(u) : void 0, f = d ?? e;
151
151
  return {
@@ -158,12 +158,12 @@ function E({ invoice: e, recurrence: t, iterationInvoices: n, date: r, statusLab
158
158
  }),
159
159
  chip: d ? {
160
160
  kind: "invoice",
161
- label: T(d.status, i),
161
+ label: w(d.status, i),
162
162
  tone: s(d.status)
163
163
  } : {
164
164
  kind: "iteration",
165
- label: C(t.status, a),
166
- tone: S[t.status] ?? "neutral"
165
+ label: S(t.status, a),
166
+ tone: x[t.status] ?? "neutral"
167
167
  },
168
168
  numberLabel: u ? d?.document_id ?? "" : a.detailsPending,
169
169
  onOpen: d ? () => c(d.id) : void 0,
@@ -171,7 +171,7 @@ function E({ invoice: e, recurrence: t, iterationInvoices: n, date: r, statusLab
171
171
  };
172
172
  });
173
173
  }
174
- function ee(e) {
174
+ function E(e) {
175
175
  if (!e?.line1) return;
176
176
  let t = [e.city, [e.state, e.postal_code].filter(Boolean).join(" ")].filter(Boolean).join(", ");
177
177
  return [
@@ -180,7 +180,7 @@ function ee(e) {
180
180
  e.country ? l(e.country) : void 0
181
181
  ].filter(Boolean).join(", ");
182
182
  }
183
- function te(e, t, n) {
183
+ function D(e, t, n) {
184
184
  let r = {
185
185
  label: n.detailsAmountReceived,
186
186
  value: t(e.amount_paid)
@@ -242,7 +242,7 @@ function te(e, t, n) {
242
242
  };
243
243
  }
244
244
  }
245
- function ne(t, i, a) {
245
+ function te(t, i, a) {
246
246
  let o = t.line_items.reduce((t, n) => {
247
247
  let r = n.total_before_tax ?? 0;
248
248
  return e(n.tax_status) ? {
@@ -287,20 +287,20 @@ function ne(t, i, a) {
287
287
  emphasis: !0
288
288
  }), m;
289
289
  }
290
- var D = {
290
+ var ne = {
291
291
  primary: [],
292
292
  overflow: []
293
293
  };
294
- function O({ receivable: e, pdfUrl: n, paymentReminder: r, overdueReminder: s, depositAccount: l, isAccountListIncomplete: u, recurrence: h, paymentRecords: S = [], isLoadingPaymentRecords: C = !1, iterationInvoices: T = /* @__PURE__ */ new Map(), auditHistory: O, statusLabels: k, messages: A, canWrite: j = !0, onOpenReceivable: M, now: N }) {
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 }) {
295
295
  if (!e || e.type !== "invoice") return;
296
- let P = e, F = (e) => o({
296
+ let F = e, I = (e) => o({
297
297
  amount: e ?? 0,
298
- currency: P.currency,
298
+ currency: F.currency,
299
299
  fallback: ""
300
- }), I = (e) => a(e, "-"), L = (e) => e ? I(e) : A.detailsPending, { status: R } = P, z = R === "canceled", B = R === "recurring" ? h : void 0, V = P.recurrence_id && R !== "recurring" ? h : void 0, H = R === "overdue" ? m(P.due_date, N) : 0, { amountTone: U, amountRows: W } = te(P, F, A), G = P.counterpart_contact, K = ee(P.counterpart_billing_address), re = [
301
- ...P.counterpart_name ? [{
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
302
  label: A.detailsCustomerName,
303
- value: P.counterpart_name
303
+ value: F.counterpart_name
304
304
  }] : [],
305
305
  ...G?.email ? [{
306
306
  label: A.detailsCustomerEmail,
@@ -319,133 +319,134 @@ function O({ receivable: e, pdfUrl: n, paymentReminder: r, overdueReminder: s, d
319
319
  value: g({
320
320
  paymentReminder: r,
321
321
  overdueReminder: s,
322
- remindersConfigured: !!(P.payment_reminder_id || P.overdue_reminder_id),
322
+ remindersConfigured: !!(F.payment_reminder_id || F.overdue_reminder_id),
323
323
  messages: A
324
324
  })
325
325
  }, J = {
326
326
  label: A.detailsDepositAccount,
327
- value: l ? c(l, A) : u && P.bank_account_id ? "-" : A.detailsNotProvided
327
+ value: l ? c(l, A) : u && F.bank_account_id ? "-" : A.detailsNotProvided
328
328
  }, Y = {
329
329
  label: A.detailsPaymentTerms,
330
- value: P.payment_terms?.name ?? A.detailsPending
331
- }, ie = B ? [
330
+ value: F.payment_terms?.name ?? A.detailsPending
331
+ }, ae = V ? [
332
332
  {
333
333
  label: A.detailsFrequency,
334
- value: _(B.frequency, A)
334
+ value: _(V.frequency, A)
335
335
  },
336
336
  {
337
337
  label: A.detailsInvoiceAmount,
338
- value: F(P.total_amount)
338
+ value: I(F.total_amount)
339
339
  },
340
340
  Y,
341
341
  q,
342
342
  {
343
343
  label: A.detailsPoNumber,
344
- value: P.purchase_order || A.detailsNotProvided
344
+ value: F.purchase_order || A.detailsNotProvided
345
345
  },
346
346
  J
347
347
  ] : [
348
- ...P.document_id ? [{
348
+ ...F.document_id ? [{
349
349
  label: A.detailsInvoiceNumber,
350
- value: P.document_id
350
+ value: F.document_id
351
351
  }] : [],
352
352
  {
353
353
  label: A.detailsInvoiceAmount,
354
- value: F(P.total_amount)
354
+ value: I(F.total_amount)
355
355
  },
356
356
  {
357
357
  label: A.detailsInvoiceDate,
358
- value: L(P.issue_date)
358
+ value: R(F.issue_date)
359
359
  },
360
360
  {
361
361
  label: A.detailsDueDate,
362
- value: L(P.due_date)
362
+ value: R(F.due_date)
363
363
  },
364
364
  Y,
365
365
  q,
366
- ...P.purchase_order ? [{
366
+ ...F.purchase_order ? [{
367
367
  label: A.detailsPoNumber,
368
- value: P.purchase_order
368
+ value: F.purchase_order
369
369
  }] : [],
370
370
  J
371
- ], X = B ? void 0 : i(P), { primary: Z, overflow: Q } = j ? d[R] ?? {
371
+ ], X = V ? void 0 : i(F), { primary: Z, overflow: Q } = M ? d[z] ?? {
372
372
  primary: [],
373
373
  overflow: ["clone"]
374
- } : D;
375
- if (B && j) {
376
- let e = B.status === "active" || B.status === "paused";
377
- Q = B.status === "active" ? ["pauseRecurrence", "cancelRecurrence"] : B.status === "paused" ? ["resumeRecurrence", "cancelRecurrence"] : [], Z = e ? ["edit"] : [];
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
378
  }
379
- let ae = f.has(R) ? {
380
- rows: S.map((e) => ({
379
+ j || (Z = Z.filter((e) => e !== "recordPayment"));
380
+ let oe = f.has(z) ? {
381
+ rows: x.map((e) => ({
381
382
  id: e.id,
382
- dateLabel: I(e.paid_at),
383
- amountLabel: F(e.amount)
383
+ dateLabel: L(e.paid_at),
384
+ amountLabel: I(e.amount)
384
385
  })),
385
- totalLabel: F(P.amount_paid),
386
- emptyTone: R === "overdue" ? "danger" : "default",
387
- isLoading: C
388
- } : void 0, oe = B ? {
389
- statusLabel: y(B.status, A),
390
- statusTone: b[B.status] ?? "neutral",
391
- statusIcon: x[B.status],
392
- amountLabel: F(P.total_amount),
393
- amountPeriodLabel: v(B.frequency, A),
394
- startsOnLabel: L(B.start_date),
395
- endsOnLabel: I(B.end_date),
396
- scheduleTitle: A.detailsScheduleTitle.replace("{frequency}", _(B.frequency, A)),
397
- schedule: E({
398
- invoice: P,
399
- recurrence: B,
400
- iterationInvoices: T,
401
- date: I,
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,
401
+ iterationInvoices: w,
402
+ date: L,
402
403
  statusLabels: k,
403
404
  messages: A,
404
- onOpenReceivable: M
405
+ onOpenReceivable: N
405
406
  })
406
- } : void 0, $ = V ? w(P, V, A) : void 0, se = V && $ ? {
407
+ } : void 0, $ = H ? C(F, H, A) : void 0, ce = H && $ ? {
407
408
  title: $,
408
409
  backLabel: A.detailsSeriesBack.replace("{title}", $),
409
- onOpen: () => M(V.invoice_id)
410
+ onOpen: () => N(H.invoice_id)
410
411
  } : void 0;
411
412
  return {
412
- id: P.id,
413
- type: P.type,
414
- title: B ? w(P, B, A) : P.counterpart_name ?? A.invoiceType,
415
- status: R,
416
- statusTone: p[R] ?? "neutral",
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
418
  pdfUrl: n,
418
- lineItems: P.line_items.map((e, t) => ({
419
+ lineItems: F.line_items.map((e, t) => ({
419
420
  id: `${e.product.id ?? "item"}-${t}`,
420
421
  name: e.product.name,
421
422
  quantityLabel: String(e.quantity),
422
- unitPriceLabel: F(e.product.price?.value),
423
- totalLabel: F(e.total_before_tax ?? (e.product.price?.value ?? 0) * e.quantity)
423
+ unitPriceLabel: I(e.product.price?.value),
424
+ totalLabel: I(e.total_before_tax ?? (e.product.price?.value ?? 0) * e.quantity)
424
425
  })),
425
426
  panel: {
426
- subtitle: B ? A.detailsSeriesSubtitle : P.document_id ? A.detailsInvoiceSubtitle.replace("{number}", P.document_id) : void 0,
427
- statusLabel: R === "partially_paid" ? k.issued : k[R] ?? k.unknown,
428
- recurring: !!P.recurrence_id || R === "recurring",
429
- overdueLabel: H > 0 ? A.detailsDaysOverdue.replace("{days}", String(H)) : void 0,
430
- amountTone: U,
431
- amountRows: W,
432
- issueDateLabel: L(P.issue_date),
433
- dueDateLabel: z ? I(P.updated_at) : L(P.due_date),
434
- dueDateCaption: z ? A.detailsCancelledOnCaption : A.detailsDueDate,
435
- paymentHistory: ae,
436
- customerContact: re,
437
- recurringSeries: oe,
438
- seriesLink: se,
439
- billingItems: ie,
440
- lineItemsSection: B ? void 0 : {
441
- countLabel: String(P.line_items.length),
442
- totals: ne(P, F, A)
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)
443
444
  },
444
445
  notes: X && {
445
446
  ...X,
446
447
  countLabel: String([X.opening, X.closing].filter(Boolean).length)
447
448
  },
448
- attachments: t(P, A),
449
+ attachments: t(F, A),
449
450
  auditHistory: O,
450
451
  primaryActions: Z,
451
452
  overflowActions: Q