@tesouro/embedded-components-react 0.5.74 → 0.5.76

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 (97) hide show
  1. package/dist/experimental/InvoiceSettings.d.ts +660 -0
  2. package/dist/experimental/InvoiceSettings.js +3 -0
  3. package/dist/experimental/index.d.ts +31 -2
  4. package/dist/experimental/index.js +4 -2
  5. package/dist/index.css +0 -8
  6. package/dist/index.js +1 -1
  7. package/dist/lib/BillPayWidget.js +1 -1
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +8 -8
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +140 -7
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +46 -140
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +114 -47
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +163 -112
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +75 -164
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +21 -75
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +71 -23
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +376 -65
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +12 -381
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +84 -12
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +54 -79
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +223 -54
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +37 -223
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +245 -37
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +21 -252
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +571 -21
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +4 -572
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +44 -4
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +247 -38
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +3 -234
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +4 -3
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +44 -2
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +1 -46
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +8 -1
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +11 -6
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +127 -11
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js +3 -129
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +127 -3
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +8 -124
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js +7 -8
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +47 -8
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js +18 -44
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index77.js +28 -20
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index78.js +82 -27
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index79.js +47 -83
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index80.js +250 -47
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index81.js +123 -241
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index82.js +211 -126
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index83.js +3 -219
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index84.js +7 -4
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index85.js +98 -5
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index86.js +1 -100
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index87.js +26 -0
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +10 -10
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index30.js +2 -72
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index31.js +12 -269
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index33.js +2 -19
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index34.js +16 -50
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index36.js +97 -15
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index37.js +76 -47
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index38.js +277 -2
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index39.js +2 -35
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index40.js +16 -369
  62. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index41.js +56 -2
  63. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index42.js +2 -23
  64. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index43.js +15 -93
  65. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index44.js +50 -2
  66. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index45.js +1 -31
  67. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index46.js +32 -49
  68. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index47.js +374 -2
  69. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index48.js +1 -55
  70. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index49.js +20 -10
  71. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index50.js +87 -188
  72. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index51.js +1 -1
  73. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index52.js +30 -2
  74. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index53.js +48 -37
  75. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index55.js +47 -10
  76. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index56.js +10 -85
  77. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index57.js +197 -2
  78. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index58.js +2 -4
  79. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index59.js +2 -14
  80. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index60.js +41 -2
  81. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index61.js +2 -4
  82. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index62.js +14 -17
  83. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index63.js +88 -2
  84. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index64.js +1 -94
  85. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index65.js +167 -161
  86. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index82.js +5 -5
  87. package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/index.js +3 -1
  88. package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index.js +4 -0
  89. package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index2.js +5 -0
  90. package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index3.js +29 -0
  91. package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index4.js +2 -0
  92. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  93. package/dist/libs/tesouro-embedded-components-react/shared/util/dist/lib/auditHistory/buildPayableAuditHistory.js +5 -1
  94. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index8.js +1 -1
  95. package/dist/packages/shared-ui-shadcn/dist/index.js +1391 -1369
  96. package/package.json +1 -1
  97. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index88.js +0 -27
@@ -2,252 +2,134 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { formatMoneyExact as e } from "../../../shared/util/dist/lib/formatMoneyExact.js";
6
- import { useCounterpartsQuery as t } from "../../../shared/counterpart-management/data-access/dist/index3.js";
5
+ import { useEmbedApi as e } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
6
+ import { formatCalendarDate as t } from "../../../shared/util/dist/lib/formatCalendarDate.js";
7
+ import { formatMoneyExact as n } from "../../../shared/util/dist/lib/formatMoneyExact.js";
8
+ import { hasSuspectedPayableDuplicate as ee } from "../../data-access/dist/index7.js";
9
+ import { usePayablesQuery as r, usePayablesTotalCountQuery as i } from "../../data-access/dist/index17.js";
7
10
  import "../../data-access/dist/index.js";
8
- import { BillsFilterField as n } from "../../ui/dist/index78.js";
9
- import "../../ui/dist/index.js";
10
- import { getCounterpartName as r } from "../../../shared/counterpart-management/feature/dist/lib/helpers.js";
11
- import "../../../shared/counterpart-management/feature/dist/index.js";
12
- import { BILL_STATUS_FILTER_ORDER as i, billStatusFilterApiValues as a } from "./index78.js";
13
- import { BillsDatePreset as o, resolveDatePreset as s } from "./index79.js";
14
- import { BILLS_FILTER_LABELS_EN as c } from "./index80.js";
15
- import { useCallback as l, useEffect as u, useMemo as d, useState as f } from "react";
16
- import { format as p, formatISO as m } from "date-fns";
11
+ import { derivePayableStatus as te } from "./index7.js";
12
+ import { resolveVendorName as ne } from "./index8.js";
13
+ import { isEditablePayableStatus as re } from "./index19.js";
14
+ import { BillQueue as a, DEFAULT_BILL_QUEUE as o, billQueueColumns as s, billQueueHasScheduledPayment as c, billQueueOffersAddPanel as l, billQueueStatuses as u, billSortColumnId as d, billSortField as f } from "./index72.js";
15
+ import { useBillsFilters as p } from "./index80.js";
16
+ import { useCallback as m, useEffect as h, useMemo as g, useState as _ } from "react";
17
17
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index81.js
18
- var h = {
19
- Date: "date",
20
- Status: "status",
21
- Amount: "amount",
22
- Vendor: "vendor",
23
- Attachment: "attachment"
24
- }, g = 50, _ = 300, v = "MMM d, yyyy", y = 864e5, b = {
25
- [n.IssueDate]: "issued_at",
26
- [n.DueDate]: "due_date",
27
- [n.AddedOn]: "created_at"
28
- }, x = {
29
- [o.Today]: "current",
30
- [o.ThisWeek]: "current",
31
- [o.ThisMonth]: "current",
32
- [o.ThisQuarter]: "current",
33
- [o.ThisYear]: "current",
34
- [o.Yesterday]: "past",
35
- [o.LastWeek]: "past",
36
- [o.LastMonth]: "past",
37
- [o.Last30Days]: "past",
38
- [o.Last90Days]: "past",
39
- [o.LastQuarter]: "past",
40
- [o.LastYear]: "past"
41
- };
42
- function S() {
43
- return {
44
- dateField: n.DueDate,
45
- statuses: [],
46
- amountMode: "any",
47
- amountMin: "",
48
- amountMax: "",
49
- vendorIds: []
50
- };
51
- }
52
- function C(e) {
53
- let t = Number.parseFloat(e);
54
- return Number.isFinite(t) ? Math.round(t * 100) : void 0;
55
- }
56
- function w({ offersStatusFilter: o = !1, offersVendorFilter: w = !0, isVendorFilterPaused: T = !1, onFiltersChange: E, labels: D } = {}) {
57
- let O = d(() => ({
58
- ...c,
59
- ...D,
60
- presets: {
61
- ...c.presets,
62
- ...D?.presets
63
- },
64
- statuses: {
65
- ...c.statuses,
66
- ...D?.statuses
67
- },
68
- dateFieldNames: {
69
- ...c.dateFieldNames,
70
- ...D?.dateFieldNames
71
- }
72
- }), [D]), [k, A] = f(S), [j, M] = f({}), [N, P] = f(""), [F, I] = f(""), L = l((e) => {
73
- A((t) => ({
74
- ...t,
75
- ...e
76
- })), E?.();
77
- }, [E]);
78
- u(() => {
79
- w || A((e) => e.vendorIds.length === 0 ? e : (E?.(), {
80
- ...e,
81
- vendorIds: []
82
- }));
83
- }, [w, E]), u(() => {
84
- o || A((e) => e.statuses.length === 0 ? e : (E?.(), {
85
- ...e,
86
- statuses: []
87
- }));
88
- }, [o, E]), u(() => {
89
- let e = setTimeout(() => I(N.trim()), _);
18
+ var v = 10, y = [{
19
+ id: "addedOnLabel",
20
+ desc: !0
21
+ }];
22
+ function b({ enabled: b = !0, canReadVendors: x = !0, isVendorFilterPaused: S = !1, filterLabels: C, onOpenBill: w, duplicateRowNote: T, attachmentLabel: E }) {
23
+ let [D, O] = _(o), [k, A] = _(y), [j, ie] = _(v), [M, N] = _(), [P, F] = _(""), [I, L] = _(""), R = m(() => N(void 0), []);
24
+ h(() => {
25
+ let e = setTimeout(() => {
26
+ L(P), R();
27
+ }, 300);
90
28
  return () => clearTimeout(e);
91
- }, [N]);
92
- let R = t({
93
- enabled: w && !T,
94
- is_vendor: !0,
95
- sort: "counterpart_name",
96
- order: "asc",
97
- limit: g,
98
- counterpart_name__icontains: F || void 0
99
- }), z = d(() => (R.data?.data ?? []).map((e) => ({
100
- value: e.id,
101
- label: r(e)
102
- })), [R.data?.data]), B = d(() => i.map((e) => ({
103
- value: e,
104
- label: O.statuses[e]
105
- })), [O.statuses]), V = d(() => Object.entries(x).map(([e, t]) => ({
106
- value: e,
107
- label: O.presets[e],
108
- group: t === "current" ? O.presetGroupCurrent : O.presetGroupPast
109
- })), [
110
- O.presetGroupCurrent,
111
- O.presetGroupPast,
112
- O.presets
113
- ]), H = d(() => {
114
- let e = {}, t = b[k.dateField], n = (e) => Date.UTC(e.getFullYear(), e.getMonth(), e.getDate());
115
- if (k.dateFrom && (e[`${t}__gte`] = t === "created_at" ? new Date(n(k.dateFrom)).toISOString() : m(k.dateFrom, { representation: "date" })), k.dateTo && (t === "created_at" ? e.created_at__lt = new Date(n(k.dateTo) + y).toISOString() : e[`${t}__lte`] = m(k.dateTo, { representation: "date" })), k.statuses.length > 0 && (e.status__in = a(k.statuses)), k.amountMode !== "any") {
116
- let t = "total_amount__gte", n = "total_amount__lte", r = C(k.amountMin), i = C(k.amountMax);
117
- k.amountMode === "exact" ? r !== void 0 && (e[t] = r, e[n] = r) : (r !== void 0 && (e[t] = r), i !== void 0 && (e[n] = i));
118
- }
119
- return k.vendorIds.length > 0 && (e.counterpart_id__in = [...k.vendorIds]), k.hasFile !== void 0 && (e.has_file = k.hasFile), e;
120
- }, [k]), U = d(() => {
121
- let t = [], n = (e) => p(e, v), r = (e) => {
122
- let [t, ...n] = e;
123
- return t ? n.length === 0 ? t : O.moreSelected(t, n.length) : "";
29
+ }, [P, R]);
30
+ let z = p({
31
+ offersStatusFilter: D === a.All,
32
+ offersVendorFilter: x,
33
+ isVendorFilterPaused: S,
34
+ labels: C,
35
+ onFiltersChange: R
36
+ }), B = k[0], V = f(B?.id), H = V ? B?.desc ? "desc" : "asc" : void 0, U = g(() => ({
37
+ ...z.query,
38
+ limit: j,
39
+ pagination_token: M,
40
+ status__in: u(D) ?? z.query.status__in,
41
+ has_scheduled_payment: c(D),
42
+ counterpart_name__icontains: I || void 0,
43
+ sort: V,
44
+ order: H
45
+ }), [
46
+ z.query,
47
+ j,
48
+ M,
49
+ D,
50
+ I,
51
+ V,
52
+ H
53
+ ]), { organizationId: W } = e(), G = JSON.stringify([W, U]), K = r({
54
+ ...U,
55
+ enabled: b,
56
+ pollWhileOcrProcessing: !0
57
+ }), [q, J] = _(G);
58
+ h(() => {
59
+ K.isFetching || J(G);
60
+ }, [K.isFetching, G]);
61
+ let Y = K.data?.data.length, X = Y === 0, Z = i({ enabled: b && X }), ae = !X || (Z.data?.count ?? 1) > 0, Q = g(() => (K.data?.data ?? []).filter((e) => e.ocr_status !== "processing").map((e) => {
62
+ let r = te({
63
+ apiStatus: e.status,
64
+ dueDate: e.due_date,
65
+ scheduledPaymentDate: e.scheduled_payment_date
66
+ }), i = e.amount_due ?? e.total_amount, o = e.status === "partially_paid" || e.status === "paid", s = (t) => t == null ? "" : n(t / 100, { currencyCode: e.currency ?? "USD" });
67
+ return {
68
+ rowKey: e.id,
69
+ vendorLabel: ne(e),
70
+ issueDateLabel: t(e.issued_at),
71
+ dueDateLabel: t(e.due_date),
72
+ dueDateTone: r.isOverdue ? "danger" : "default",
73
+ scheduledDateLabel: t(e.scheduled_payment_date),
74
+ scheduledDateIsGap: D === a.Scheduled,
75
+ paidDateLabel: t(e.paid_at?.slice(0, 10)),
76
+ amountDueLabel: s(i),
77
+ amountPaidLabel: o ? s(e.amount_paid) : "",
78
+ amountPaidIsGap: D === a.Paid,
79
+ amountScheduledLabel: s(e.amount_to_pay ?? i),
80
+ totalAmountLabel: s(e.total_amount),
81
+ attachment: e.file_id ? { label: E } : void 0,
82
+ status: r.status,
83
+ statusTone: r.tone,
84
+ addedOnLabel: t(e.created_at?.slice(0, 10)),
85
+ ...ee(e) ? {
86
+ rowTone: "warning",
87
+ rowNote: T
88
+ } : {},
89
+ onOpen: () => w(e.id, re(e.status))
124
90
  };
125
- if (k.dateFrom || k.dateTo) {
126
- let e = (k.datePreset ? O.presets[k.datePreset] : void 0) ?? (k.dateFrom && k.dateTo ? O.dateRange(n(k.dateFrom), n(k.dateTo)) : k.dateFrom ? O.dateFrom(n(k.dateFrom)) : O.dateTo(n(k.dateTo)));
127
- t.push({
128
- key: h.Date,
129
- label: O.dateChip(O.dateFieldNames[k.dateField], e)
130
- });
131
- }
132
- if (k.statuses.length > 0 && t.push({
133
- key: h.Status,
134
- label: O.statusChip(r(k.statuses.map((e) => O.statuses[e] ?? e)))
135
- }), k.vendorIds.length > 0 && t.push({
136
- key: h.Vendor,
137
- label: O.vendorChip(r(k.vendorIds.map((e) => j[e] ?? e)))
138
- }), k.amountMode !== "any") {
139
- let n = (t) => {
140
- let n = Number.parseFloat(t);
141
- return Number.isFinite(n) ? e(n, { currencyCode: "USD" }) : "";
142
- }, r = n(k.amountMin), i = n(k.amountMax), a = k.amountMode === "exact" ? r : r && i ? O.amountBetween(r, i) : r ? O.amountAtLeast(r) : i ? O.amountAtMost(i) : "";
143
- a && t.push({
144
- key: h.Amount,
145
- label: O.amountChip(a)
146
- });
147
- }
148
- return k.hasFile !== void 0 && t.push({
149
- key: h.Attachment,
150
- label: k.hasFile ? O.attachmentChipHas : O.attachmentChipNone
151
- }), t;
152
- }, [
153
- O,
154
- k,
155
- j
156
- ]), W = l((e) => {
157
- switch (e) {
158
- case h.Date:
159
- L({
160
- datePreset: void 0,
161
- dateFrom: void 0,
162
- dateTo: void 0
163
- });
164
- break;
165
- case h.Status:
166
- L({ statuses: [] });
167
- break;
168
- case h.Vendor:
169
- L({ vendorIds: [] });
170
- break;
171
- case h.Amount:
172
- L({
173
- amountMode: "any",
174
- amountMin: "",
175
- amountMax: ""
176
- });
177
- break;
178
- case h.Attachment: L({ hasFile: void 0 });
179
- }
180
- }, [L]), G = l(() => {
181
- A(S()), E?.();
182
- }, [E]), K = l((e) => {
183
- M((t) => {
184
- let n = { ...t };
185
- for (let t of z) e.includes(t.value) && (n[t.value] = t.label);
186
- return n;
187
- }), L({ vendorIds: e });
188
- }, [L, z]);
91
+ }), [
92
+ K.data?.data,
93
+ T,
94
+ E,
95
+ w,
96
+ D
97
+ ]), oe = m((e) => {
98
+ let t = e;
99
+ O(t), A((e) => {
100
+ let n = e[0]?.id;
101
+ return n ? s(t).some((e) => d(e) === n) ? e : y : e;
102
+ }), R();
103
+ }, [R]), se = m((e) => {
104
+ A((t) => typeof e == "function" ? e(t) : e), R();
105
+ }, [R]), ce = m((e) => {
106
+ ie(e), R();
107
+ }, [R]), le = m(() => N(K.data?.next_pagination_token ?? void 0), [K.data?.next_pagination_token]), $ = m(() => N(K.data?.prev_pagination_token ?? void 0), [K.data?.prev_pagination_token]), ue = m(() => {
108
+ K.refetch();
109
+ }, [K.refetch]);
189
110
  return {
190
- filterBarProps: {
191
- fields: [...d(() => [
192
- ...w ? [n.Vendor] : [],
193
- n.IssueDate,
194
- n.DueDate,
195
- ...o ? [n.Status] : [],
196
- n.TotalAmount,
197
- n.AddedOn,
198
- n.Attachment
199
- ], [o, w])],
200
- activeFilterCount: U.length,
201
- chips: U,
202
- onRemoveChip: W,
203
- onClearAll: G,
204
- dateField: k.dateField,
205
- onDateFieldChange: (e) => {
206
- let t = !!(k.dateFrom || k.dateTo);
207
- A((t) => ({
208
- ...t,
209
- dateField: e
210
- })), t && E?.();
211
- },
212
- datePresets: V,
213
- selectedDatePreset: k.datePreset,
214
- dateFrom: k.dateFrom,
215
- dateTo: k.dateTo,
216
- onDateRangeChange: ({ from: e, to: t }) => L({
217
- datePreset: void 0,
218
- dateFrom: e,
219
- dateTo: t
220
- }),
221
- onDatePresetChange: (e) => {
222
- let t = /* @__PURE__ */ new Date(), r = k.dateField === n.AddedOn ? new Date(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate()) : t, { from: i, to: a } = s(e, r);
223
- L({
224
- datePreset: e,
225
- dateFrom: i,
226
- dateTo: a
227
- });
228
- },
229
- statusOptions: B,
230
- selectedStatuses: k.statuses,
231
- onStatusChange: (e) => L({ statuses: e }),
232
- amountMode: k.amountMode,
233
- onAmountModeChange: (e) => L({ amountMode: e }),
234
- amountMin: k.amountMin,
235
- amountMax: k.amountMax,
236
- onAmountMinChange: (e) => L({ amountMin: e }),
237
- onAmountMaxChange: (e) => L({ amountMax: e }),
238
- vendorOptions: z,
239
- selectedVendors: k.vendorIds,
240
- onVendorChange: K,
241
- vendorSearchValue: N,
242
- onVendorSearchChange: P,
243
- isVendorLoading: R.isLoading || T,
244
- isVendorError: R.isError,
245
- hasAttachment: k.hasFile,
246
- onHasAttachmentChange: (e) => L({ hasFile: e })
247
- },
248
- query: H,
249
- isFilterActive: U.length > 0
111
+ rows: Q,
112
+ isLoading: K.isLoading || G !== q || X && Z.isLoading || (Y ?? 0) > 0 && Q.length === 0,
113
+ isError: K.isError,
114
+ onRetry: ue,
115
+ selectedFilterTabId: D,
116
+ onFilterTabChange: oe,
117
+ searchValue: P,
118
+ onSearchChange: F,
119
+ hasAnyBills: ae,
120
+ isSearchActive: I.length > 0 || z.isFilterActive,
121
+ filterBarProps: z.filterBarProps,
122
+ visibleColumns: s(D),
123
+ showAddPanelWhenEmpty: l(D),
124
+ sorting: k,
125
+ onSortingChange: se,
126
+ pageSize: j,
127
+ onPageSizeChange: ce,
128
+ hasNextPage: !!K.data?.next_pagination_token,
129
+ hasPrevPage: !!K.data?.prev_pagination_token,
130
+ onNextPage: le,
131
+ onPrevPage: $
250
132
  };
251
133
  }
252
134
  //#endregion
253
- export { h as BillsFilterChipKey, w as useBillsFilters };
135
+ export { b as useBillsTable };