@tesouro/embedded-components-react 0.11.188 → 0.11.190

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 (55) hide show
  1. package/README.md +12 -8
  2. package/dist/fixtures/index.d.ts +13 -46
  3. package/dist/index.css +3 -0
  4. package/dist/index.d.ts +18 -1
  5. package/dist/index.js +40 -39
  6. package/dist/lib/BankAccountsWidget.d.ts +2 -0
  7. package/dist/lib/BillPayWidget.d.ts +16 -1
  8. package/dist/lib/BillPayWidget.js +3 -1
  9. package/dist/lib/WidgetSuite.d.ts +2 -0
  10. package/dist/libs/tesouro-embedded-components-react/balance-history-widget/feature/dist/lib/BalanceHistoryWidget/BalanceHistoryWidgetFeature.js +2 -2
  11. package/dist/libs/tesouro-embedded-components-react/balances-widget/feature/dist/lib/BalancesWidget/BalancesWidgetContext.js +2 -2
  12. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index2.js +17 -14
  13. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/lib/formatters.js +1 -1
  14. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/lib/labels.js +2 -0
  15. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/lib/useBankAccountsWidget.js +9 -3
  16. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/lib/AccountCard.js +76 -58
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index27.js +4 -4
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index32.js +8 -8
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index35.js +1 -1
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index36.js +180 -180
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index45.js +62 -62
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index48.js +32 -32
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index14.js +7 -7
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index15.js +20 -20
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index33.js +5 -5
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index34.js +16 -16
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index37.js +7 -7
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index.js +3 -1
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index10.js +101 -58
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index11.js +19 -17
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index14.js +2 -0
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index15.js +169 -138
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index17.js +227 -204
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index18.js +208 -204
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index19.js +1 -0
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index21.js +10 -10
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index23.js +212 -212
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index9.js +9 -5
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +3 -1
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidget/BillPayWidget.js +43 -39
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidget/BillsTab.js +66 -64
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidget/index.js +1 -0
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/pay-bill/feature/dist/index8.js +1 -1
  44. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/viewModels.js +9 -9
  45. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/index.js +5 -5
  46. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/helpers.js +21 -21
  47. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +20 -20
  48. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +17 -17
  49. package/dist/libs/tesouro-embedded-components-react/shared/document-status/ui/dist/index7.js +4 -4
  50. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  51. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/TransfersWidgetInner.js +77 -77
  52. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/transferViews.js +2 -2
  53. package/dist/libs/tesouro-embedded-components-react/transfers-widget/feature/dist/lib/TransfersWidget/useTransferMoneyModalController.js +129 -122
  54. package/dist/packages/shared-ui-shadcn/dist/index.js +1 -1
  55. package/package.json +1 -1
@@ -21,29 +21,30 @@ import { resolveVendorName as ee } from "../../../util/dist/lib/resolveVendor.js
21
21
  import { buildGroupCollapse as h } from "../../../util/dist/lib/groupCollapse.js";
22
22
  import "../../../util/dist/index.js";
23
23
  import { derivePayableStatus as te } from "../../../../shared/document-status/util/dist/lib/derivePayableStatus.js";
24
- import { useApplyDuplicateVerdictsMutation as g } from "../../../data-access/dist/lib/useApplyDuplicateVerdictsMutation.js";
25
- import "../../../data-access/dist/index.js";
26
- import { BillColumn as _ } from "../../ui/dist/index22.js";
24
+ import { BillColumn as g } from "../../ui/dist/index22.js";
27
25
  import "../../ui/dist/index.js";
28
- import { BillQueue as v, DEFAULT_BILL_QUEUE as y, billQueueColumns as b, billQueueFilters as x, billQueueOffersAddPanel as ne, billSortColumnId as re, billSortField as ie } from "./index5.js";
29
- import { duplicateRemovalPrompt as ae } from "./index12.js";
30
- import { useBillsFilters as oe } from "./index15.js";
31
- import { BillVendorLookup as se, useBillVendorNames as ce } from "./index16.js";
32
- import { useFirstPayablesPagesQuery as le } from "../../data-access/dist/index2.js";
33
- import { usePayablesQuery as ue } from "../../data-access/dist/index4.js";
34
- import { usePayablesTotalCountQuery as de } from "../../data-access/dist/index5.js";
26
+ import { BillQueue as _, DEFAULT_BILL_QUEUE as ne, billQueueColumns as v, billQueueFilters as re, billQueueOffersAddPanel as ie, billSortColumnId as ae, billSortField as oe } from "./index5.js";
27
+ import { BillSummaryCard as se, isBillSummaryCard as ce } from "./index10.js";
28
+ import { duplicateRemovalPrompt as le } from "./index12.js";
29
+ import { useBillsFilters as ue } from "./index15.js";
30
+ import { BillVendorLookup as de, useBillVendorNames as fe } from "./index16.js";
31
+ import { useFirstPayablesPagesQuery as pe } from "../../data-access/dist/index2.js";
32
+ import { useApplyDuplicateVerdictsMutation as me } from "../../../data-access/dist/lib/useApplyDuplicateVerdictsMutation.js";
33
+ import "../../../data-access/dist/index.js";
34
+ import { usePayablesQuery as he } from "../../data-access/dist/index4.js";
35
+ import { usePayablesTotalCountQuery as ge } from "../../data-access/dist/index5.js";
35
36
  import "../../data-access/dist/index.js";
36
- import { useCallback as S, useEffect as fe, useMemo as C, useState as w } from "react";
37
- import { BanIcon as pe, FileCheckIcon as me, Trash2Icon as he } from "lucide-react";
37
+ import { useCallback as y, useEffect as b, useMemo as x, useRef as _e, useState as S } from "react";
38
+ import { BanIcon as ve, FileCheckIcon as ye, Trash2Icon as be } from "lucide-react";
38
39
  // ../../libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index17.js
39
- var ge = 10, T = 100, _e = 3, ve = [{
40
+ var xe = 10, C = 100, Se = 3, Ce = [{
40
41
  id: "addedOnLabel",
41
42
  desc: !0
42
- }], E = {
43
+ }], w = {
43
44
  AllBills: "allBills",
44
45
  PossibleDuplicates: "possibleDuplicates"
45
46
  };
46
- function ye(e, t) {
47
+ function we(e, t) {
47
48
  let n = new Map(e.map((e) => [e.id, e])), r = /* @__PURE__ */ new Map(), i = (e) => {
48
49
  r.has(e) || r.set(e, /* @__PURE__ */ new Set());
49
50
  }, a = (e, t) => {
@@ -96,68 +97,71 @@ function ye(e, t) {
96
97
  }
97
98
  return f;
98
99
  }
99
- function be({ enabled: c = !0, canPay: d, canReadVendors: h = !0, isVendorFilterPaused: se = !1, filterLabels: be, onOpenBill: we, duplicateRowNote: Te, attachmentLabel: Ee, duplicateGroupLabels: D, canManageDuplicates: De = !1, duplicateView: O = E.AllBills, scheduledRelativeDayLabels: Oe, dueDateLabels: ke }) {
100
- let k = i(), [A, Ae] = w(y), [je, Me] = w(ve), [j, Ne] = w(ge), [Pe, M] = w(), [Fe, Ie] = w(d);
101
- d !== void 0 && Fe !== d && (Ie(d), M(void 0));
102
- let Le = d ?? Fe, [Re, ze] = w(0), [N, Be] = w(""), [P, Ve] = w(""), [F, He] = w(), [I, Ue] = w(), L = S(() => {
103
- M(void 0), ze(0);
100
+ function Te({ enabled: c = !0, canPay: d, canReadVendors: h = !0, isVendorFilterPaused: de = !1, filterLabels: Te, onOpenBill: ke, duplicateRowNote: Ae, attachmentLabel: je, duplicateGroupLabels: T, canManageDuplicates: Me = !1, duplicateView: E = w.AllBills, scheduledRelativeDayLabels: Ne, dueDateLabels: Pe, selectedSummaryCard: D, onSummaryCardChange: Fe }) {
101
+ let O = i(), [k, Ie] = S(D ? _.All : ne), [Le, Re] = S(Ce), [ze, Be] = S(xe), [Ve, A] = S(), [He, Ue] = S(d);
102
+ d !== void 0 && He !== d && (Ue(d), A(void 0));
103
+ let We = d ?? He, [Ge, Ke] = S(0), [j, qe] = S(""), [M, Je] = S(""), [N, Ye] = S(), [P, Xe] = S(), F = y(() => {
104
+ A(void 0), Ke(0);
104
105
  }, []);
105
- fe(() => {
106
- if (N === P) return;
106
+ b(() => {
107
+ if (j === M) return;
107
108
  let e = setTimeout(() => {
108
- Ve(N), L();
109
+ Je(j), F();
109
110
  }, 300);
110
111
  return () => clearTimeout(e);
111
112
  }, [
112
- N,
113
- P,
114
- L
115
- ]), fe(() => {
116
- L();
117
- }, [O, L]);
118
- let R = O === E.PossibleDuplicates, z = oe({
119
- offersStatusFilter: A === v.All && !R,
113
+ j,
114
+ M,
115
+ F
116
+ ]), b(() => {
117
+ F();
118
+ }, [E, F]);
119
+ let I = E === w.PossibleDuplicates, L = ue({
120
+ offersStatusFilter: k === _.All && !I,
120
121
  offersVendorFilter: h,
121
- isVendorFilterPaused: se,
122
- labels: be,
123
- onFiltersChange: L
124
- }), { clearAll: We, filterByVendor: Ge } = z, Ke = je[0], qe = ie(Ke?.id), Je = qe ? Ke?.desc ? "desc" : "asc" : void 0, B = R ? v.All : A, Ye = C(() => {
125
- let e = x(B, Le ?? !1);
122
+ isVendorFilterPaused: de,
123
+ labels: Te,
124
+ onFiltersChange: F,
125
+ initialSummaryCard: D,
126
+ onSummaryCardChange: Fe,
127
+ today: O
128
+ }), { clearAll: Ze, filterByVendor: Qe, summaryCard: R, selectSummaryCard: z, applySummaryCard: $e } = L, et = R === se.Overdue && !O, tt = Le[0], nt = oe(tt?.id), rt = nt ? tt?.desc ? "desc" : "asc" : void 0, B = I ? _.All : k, it = x(() => {
129
+ let e = re(B, We ?? !1);
126
130
  return {
127
- ...z.query,
131
+ ...L.query,
128
132
  ...e,
129
- limit: R ? T : j,
130
- pagination_token: R ? void 0 : Pe,
131
- status__in: R ? void 0 : e.status__in ?? z.query.status__in,
132
- duplicate_match_status: R ? "suspected" : void 0,
133
- counterpart_name__icontains: P || void 0,
134
- sort: qe,
135
- order: Je
133
+ limit: I ? C : ze,
134
+ pagination_token: I ? void 0 : Ve,
135
+ status__in: I ? void 0 : e.status__in ?? L.query.status__in,
136
+ duplicate_match_status: I ? "suspected" : void 0,
137
+ counterpart_name__icontains: M || void 0,
138
+ sort: nt,
139
+ order: rt
136
140
  };
137
141
  }, [
138
- z.query,
139
- j,
140
- Pe,
141
- R,
142
+ L.query,
143
+ ze,
144
+ Ve,
145
+ I,
142
146
  B,
143
- Le,
144
- P,
145
- qe,
146
- Je
147
- ]), { organizationId: Xe } = r(), V = JSON.stringify([Xe, Ye]), H = ue({
148
- ...Ye,
149
- enabled: c && d !== void 0 && !R,
147
+ We,
148
+ M,
149
+ nt,
150
+ rt
151
+ ]), { organizationId: at } = r(), V = JSON.stringify([at, it]), H = he({
152
+ ...it,
153
+ enabled: c && d !== void 0 && !I && !et,
150
154
  pollWhileOcrProcessing: !0
151
- }), U = le({
152
- ...Ye,
153
- enabled: c && R,
154
- maxPages: _e
155
- }), W = R ? {
155
+ }), U = pe({
156
+ ...it,
157
+ enabled: c && I,
158
+ maxPages: Se
159
+ }), W = I ? {
156
160
  ...U,
157
161
  data: { data: U.payables },
158
162
  isLoading: U.isResolving,
159
163
  isFetching: U.isFetching || U.isResolving
160
- } : H, G = (W.data?.data ?? []).filter((e) => e.ocr_status !== "processing"), K = g(), q = S(async (t, n, r, i) => {
164
+ } : H, G = (W.data?.data ?? []).filter((e) => e.ocr_status !== "processing"), K = me(), q = y(async (t, n, r, i) => {
161
165
  let a = u(t, n, i);
162
166
  if (a.length) try {
163
167
  await K.mutateAsync({
@@ -170,54 +174,54 @@ function be({ enabled: c = !0, canPay: d, canReadVendors: h = !0, isVendorFilter
170
174
  }))
171
175
  }), e.success(r);
172
176
  } catch {
173
- e.error(D.actionFailedToast);
177
+ e.error(T.actionFailedToast);
174
178
  }
175
- }, [K, D.actionFailedToast]), J = C(() => ({
179
+ }, [K, T.actionFailedToast]), J = x(() => ({
176
180
  delete: {
177
- action: D.deleteAction,
178
- title: D.deleteConfirmTitle,
179
- description: D.deleteConfirmDescription,
180
- confirmButton: D.deleteConfirmButton,
181
- backButton: D.cancelConfirmBackButton,
182
- toast: D.deletedToast
181
+ action: T.deleteAction,
182
+ title: T.deleteConfirmTitle,
183
+ description: T.deleteConfirmDescription,
184
+ confirmButton: T.deleteConfirmButton,
185
+ backButton: T.cancelConfirmBackButton,
186
+ toast: T.deletedToast
183
187
  },
184
188
  cancel: {
185
- action: D.cancelAction,
186
- title: D.cancelConfirmTitle,
187
- description: D.cancelConfirmDescription,
188
- confirmButton: D.cancelConfirmButton,
189
- backButton: D.cancelConfirmBackButton,
190
- toast: D.cancelledToast
189
+ action: T.cancelAction,
190
+ title: T.cancelConfirmTitle,
191
+ description: T.cancelConfirmDescription,
192
+ confirmButton: T.cancelConfirmButton,
193
+ backButton: T.cancelConfirmBackButton,
194
+ toast: T.cancelledToast
191
195
  },
192
196
  confirm: {
193
- action: D.confirmAction,
194
- title: D.confirmDuplicateTitle,
195
- description: D.confirmDuplicateDescription,
196
- confirmButton: D.confirmDuplicateButton,
197
- backButton: D.cancelConfirmBackButton,
198
- toast: D.confirmedToast
197
+ action: T.confirmAction,
198
+ title: T.confirmDuplicateTitle,
199
+ description: T.confirmDuplicateDescription,
200
+ confirmButton: T.confirmDuplicateButton,
201
+ backButton: T.cancelConfirmBackButton,
202
+ toast: T.confirmedToast
199
203
  }
200
- }), [D]), Ze = F?.removeBy ?? "cancel", Qe = S(async () => {
201
- F && (await q(F.payable, a.Remove, J[F.removeBy].toast), He(void 0));
204
+ }), [T]), ot = N?.removeBy ?? "cancel", st = y(async () => {
205
+ N && (await q(N.payable, a.Remove, J[N.removeBy].toast), Ye(void 0));
202
206
  }, [
203
207
  q,
204
- F,
208
+ N,
205
209
  J
206
- ]), $e = S(async () => {
207
- I && (await q(I.payable, a.Keep, D.dismissedToast, I.originalPayableId), Ue(void 0));
210
+ ]), ct = y(async () => {
211
+ P && (await q(P.payable, a.Keep, T.dismissedToast, P.originalPayableId), Xe(void 0));
208
212
  }, [
209
213
  q,
210
- D.dismissedToast,
211
- I
212
- ]), [et, tt] = w(V);
213
- fe(() => {
214
- W.isFetching || tt(V);
214
+ T.dismissedToast,
215
+ P
216
+ ]), [lt, ut] = S(V);
217
+ b(() => {
218
+ W.isFetching || ut(V);
215
219
  }, [W.isFetching, V]);
216
- let nt = W.data?.data.length, rt = nt === 0, it = de({ enabled: c && rt }), at = !rt || (it.data?.count ?? 1) > 0, Y = C(() => O === E.PossibleDuplicates ? ye(G, D) : /* @__PURE__ */ new Map(), [
217
- O,
220
+ let dt = W.data?.data.length, ft = dt === 0, pt = ge({ enabled: c && ft }), mt = !ft || (pt.data?.count ?? 1) > 0, Y = x(() => E === w.PossibleDuplicates ? we(G, T) : /* @__PURE__ */ new Map(), [
221
+ E,
218
222
  G,
219
- D
220
- ]), ot = C(() => {
223
+ T
224
+ ]), ht = x(() => {
221
225
  if (Y.size === 0) return G;
222
226
  let e = /* @__PURE__ */ new Map();
223
227
  return G.forEach((t, n) => {
@@ -228,199 +232,218 @@ function be({ enabled: c = !0, canPay: d, canReadVendors: h = !0, isVendorFilter
228
232
  index: n,
229
233
  order: e.get(Y.get(t.id)?.key ?? "") ?? n
230
234
  })).sort((e, t) => e.order - t.order || l(e.payable, t.payable) || e.index - t.index).map(({ payable: e }) => e);
231
- }, [G, Y]), { vendorNames: X, lookup: st } = ce({
235
+ }, [G, Y]), { vendorNames: X, lookup: gt } = fe({
232
236
  payables: W.data?.data,
233
237
  enabled: c,
234
238
  canReadVendors: h,
235
- isPaused: se
236
- }), ct = S((e) => {
239
+ isPaused: de
240
+ }), _t = y((e) => {
237
241
  let t = e.title || (e.vendorCounterpartId ? X.get(e.vendorCounterpartId) ?? "" : "");
238
242
  return {
239
243
  key: e.key,
240
- label: t === e.title ? e.label : D.groupHeader({
244
+ label: t === e.title ? e.label : T.groupHeader({
241
245
  vendorLabel: t,
242
246
  invoiceNumberLabel: e.invoiceNumberLabel
243
247
  }),
244
248
  title: t,
245
249
  meta: e.meta
246
250
  };
247
- }, [X, D]), Z = C(() => xe(ot.map((e) => {
251
+ }, [X, T]), Z = x(() => Ee(ht.map((e) => {
248
252
  let r = te({
249
253
  apiStatus: e.status,
250
254
  dueDate: e.due_date,
251
255
  scheduledPaymentDate: e.scheduled_payment_date
252
- }), i = e.amount_due ?? e.total_amount, a = e.status === "partially_paid" || e.status === "paid", c = (t) => t == null ? "" : n(t / 100, { currencyCode: e.currency ?? "USD" }), l = o(e.scheduled_payment_date, Oe, k), u = m({
256
+ }), i = e.amount_due ?? e.total_amount, a = e.status === "partially_paid" || e.status === "paid", c = (t) => t == null ? "" : n(t / 100, { currencyCode: e.currency ?? "USD" }), l = o(e.scheduled_payment_date, Ne, O), u = m({
253
257
  status: e.status,
254
258
  dueDate: e.due_date,
255
- today: k,
259
+ today: O,
256
260
  isScheduled: r.status === "scheduled",
257
- labels: ke
258
- }), d = Y.get(e.id), h = s(e), g = ee(e) || (e.counterpart_id ? X.get(e.counterpart_id) ?? "" : ""), _ = e.document_id ?? "", y = p(e.status), b = d?.originalPayableId !== void 0 && d.originalPayableId === e.id, x = R && h && De && d ? {
259
- triggerLabel: D.menuTrigger({
261
+ labels: Pe
262
+ }), d = Y.get(e.id), h = s(e), g = ee(e) || (e.counterpart_id ? X.get(e.counterpart_id) ?? "" : ""), ne = e.document_id ?? "", v = p(e.status), re = d?.originalPayableId !== void 0 && d.originalPayableId === e.id, ie = I && h && Me && d ? {
263
+ triggerLabel: T.menuTrigger({
260
264
  vendorLabel: g,
261
- invoiceNumberLabel: _
265
+ invoiceNumberLabel: ne
262
266
  }),
263
267
  items: [{
264
268
  id: "not-duplicate",
265
- label: D.notDuplicateAction,
266
- icon: me,
269
+ label: T.notDuplicateAction,
270
+ icon: ye,
267
271
  disabled: K.isPending,
268
- onSelect: () => Ue({
272
+ onSelect: () => Xe({
269
273
  payable: e,
270
- originalPayableId: b ? void 0 : d.originalPayableId
274
+ originalPayableId: re ? void 0 : d.originalPayableId
271
275
  })
272
- }, ...y ? [{
276
+ }, ...v ? [{
273
277
  id: "cancel-duplicate",
274
- label: J[y].action,
275
- icon: y === "delete" ? he : pe,
278
+ label: J[v].action,
279
+ icon: v === "delete" ? be : ve,
276
280
  disabled: K.isPending,
277
- onSelect: () => He({
281
+ onSelect: () => Ye({
278
282
  payable: e,
279
- removeBy: y
283
+ removeBy: v
280
284
  })
281
285
  }] : []]
282
286
  } : void 0;
283
287
  return {
284
288
  rowKey: e.id,
285
289
  vendorLabel: g,
286
- vendorLookup: g || !e.counterpart_id ? void 0 : Ce(st),
287
- invoiceNumberLabel: _,
290
+ vendorLookup: g || !e.counterpart_id ? void 0 : Oe(gt),
291
+ invoiceNumberLabel: ne,
288
292
  issueDateLabel: t(e.issued_at),
289
293
  dueDateLabel: u.label,
290
294
  dueDateOverdueLabel: u.overdueLabel,
291
295
  dueDateAccessibleLabel: u.accessibleLabel,
292
296
  scheduledDateLabel: l.label,
293
297
  scheduledDateExact: l.absoluteLabel,
294
- scheduledDateIsGap: B === v.Scheduled,
298
+ scheduledDateIsGap: B === _.Scheduled,
295
299
  paidDateLabel: t(e.paid_at?.slice(0, 10)),
296
300
  amountDueLabel: c(i),
297
301
  amountPaidLabel: a ? c(e.amount_paid) : "",
298
- amountPaidIsGap: B === v.Paid,
302
+ amountPaidIsGap: B === _.Paid,
299
303
  amountScheduledLabel: c(e.amount_to_pay ?? i),
300
304
  totalAmountLabel: c(e.total_amount),
301
- attachment: e.file_id ? { label: Ee } : void 0,
305
+ attachment: e.file_id ? { label: je } : void 0,
302
306
  status: r.status,
303
307
  statusTone: r.tone,
304
308
  addedOnLabel: t(e.created_at?.slice(0, 10)),
305
- ...d ? { group: ct(d) } : {},
306
- ...x ? { menu: x } : {},
307
- ...!R && !d && h ? {
309
+ ...d ? { group: _t(d) } : {},
310
+ ...ie ? { menu: ie } : {},
311
+ ...!I && !d && h ? {
308
312
  marker: "duplicate",
309
- rowNote: Te
313
+ rowNote: Ae
310
314
  } : {},
311
- onOpen: () => we(e.id, f(e.status))
315
+ onOpen: () => ke(e.id, f(e.status))
312
316
  };
313
- }), D), [
314
- ot,
317
+ }), T), [
318
+ ht,
315
319
  Y,
316
- D,
320
+ T,
317
321
  J,
318
322
  K.isPending,
319
- De,
320
- R,
321
- Te,
322
- Ee,
323
- Oe,
323
+ Me,
324
+ I,
325
+ Ae,
326
+ je,
327
+ Ne,
328
+ Pe,
329
+ O,
324
330
  ke,
325
- k,
326
- we,
327
331
  B,
328
332
  X,
329
- st,
330
- ct
331
- ]), lt = C(() => R ? Se(Z, T) : [], [Z, R]), Q = Math.min(Re, Math.max(0, lt.length - 1)), ut = R ? lt[Q] ?? [] : Z, $ = S((e) => {
333
+ gt,
334
+ _t
335
+ ]), vt = x(() => I ? De(Z, C) : [], [Z, I]), Q = Math.min(Ge, Math.max(0, vt.length - 1)), yt = I ? vt[Q] ?? [] : Z, $ = y((e) => {
332
336
  let t = e;
333
- Ae(t), Me((e) => {
337
+ Ie(t), t !== _.All && z(null), Re((e) => {
334
338
  let n = e[0]?.id;
335
- return n ? b(t).some((e) => re(e) === n) ? e : ve : e;
336
- }), L();
337
- }, [L]), dt = S((e) => {
338
- $(v.All), Be(""), Ge(e);
339
- }, [Ge, $]), ft = S(() => {
340
- Be(""), Ve(""), We(), L();
341
- }, [We, L]), pt = S((e) => {
342
- Me((t) => typeof e == "function" ? e(t) : e), L();
343
- }, [L]), mt = S((e) => {
344
- Ne(e), L();
345
- }, [L]), ht = S(() => {
346
- R ? ze(Q + 1) : M(H.data?.next_pagination_token ?? void 0);
339
+ return n ? v(t).some((e) => ae(e) === n) ? e : Ce : e;
340
+ }), F();
341
+ }, [F, z]), bt = y((e) => {
342
+ if (!ce(e)) return;
343
+ let t = e === R ? null : e;
344
+ t && $(_.All), z(t);
345
+ }, [
346
+ $,
347
+ z,
348
+ R
349
+ ]), xt = _e(D);
350
+ b(() => {
351
+ D !== void 0 && D !== xt.current && (xt.current = D, D !== R && (D && $(_.All), $e(D)));
352
+ }, [
353
+ $e,
354
+ $,
355
+ D,
356
+ R
357
+ ]);
358
+ let St = y((e) => {
359
+ $(_.All), qe(""), Qe(e);
360
+ }, [Qe, $]), Ct = y(() => {
361
+ qe(""), Je(""), Ze(), F();
362
+ }, [Ze, F]), wt = y((e) => {
363
+ Re((t) => typeof e == "function" ? e(t) : e), F();
364
+ }, [F]), Tt = y((e) => {
365
+ Be(e), F();
366
+ }, [F]), Et = y(() => {
367
+ I ? Ke(Q + 1) : A(H.data?.next_pagination_token ?? void 0);
347
368
  }, [
348
369
  Q,
349
- R,
370
+ I,
350
371
  H.data?.next_pagination_token
351
- ]), gt = S(() => {
352
- R ? ze(Math.max(0, Q - 1)) : M(H.data?.prev_pagination_token ?? void 0);
372
+ ]), Dt = y(() => {
373
+ I ? Ke(Math.max(0, Q - 1)) : A(H.data?.prev_pagination_token ?? void 0);
353
374
  }, [
354
375
  Q,
355
- R,
376
+ I,
356
377
  H.data?.prev_pagination_token
357
- ]), _t = S(() => {
378
+ ]), Ot = y(() => {
358
379
  W.refetch();
359
380
  }, [W.refetch]);
360
381
  return {
361
- rows: ut,
362
- isLoading: W.isLoading || !R && Le === void 0 || V !== et || rt && it.isLoading || (nt ?? 0) > 0 && ut.length === 0,
382
+ rows: yt,
383
+ isLoading: W.isLoading || !I && We === void 0 || et || V !== lt || ft && pt.isLoading || (dt ?? 0) > 0 && yt.length === 0,
363
384
  isError: W.isError,
364
- onRetry: _t,
365
- selectedFilterTabId: A,
385
+ onRetry: Ot,
386
+ selectedFilterTabId: k,
366
387
  onFilterTabChange: $,
367
- showVendorBills: dt,
368
- clearQueryConstraints: ft,
369
- searchValue: N,
370
- onSearchChange: Be,
371
- hasAnyBills: at,
372
- isSearchActive: P.length > 0 || z.isFilterActive,
373
- filterBarProps: z.filterBarProps,
374
- visibleColumns: R ? [
375
- _.AddedOn,
376
- _.DueDate,
377
- _.AmountDue,
378
- _.Status
379
- ] : b(A),
380
- keepsColumnOrder: R,
381
- isSortable: !R,
382
- pageInfo: R ? D.pageInfo({
388
+ showVendorBills: St,
389
+ clearQueryConstraints: Ct,
390
+ summaryCard: R,
391
+ onSummaryCardSelect: bt,
392
+ searchValue: j,
393
+ onSearchChange: qe,
394
+ hasAnyBills: mt,
395
+ isSearchActive: M.length > 0 || L.isFilterActive,
396
+ filterBarProps: L.filterBarProps,
397
+ visibleColumns: I ? [
398
+ g.AddedOn,
399
+ g.DueDate,
400
+ g.AmountDue,
401
+ g.Status
402
+ ] : v(k),
403
+ keepsColumnOrder: I,
404
+ isSortable: !I,
405
+ pageInfo: I ? T.pageInfo({
383
406
  billCount: Z.length,
384
407
  invoiceCount: new Set(Z.map((e) => e.group?.key ?? e.rowKey)).size
385
408
  }) : void 0,
386
- showAddPanelWhenEmpty: !R && ne(A),
387
- sorting: je,
388
- onSortingChange: pt,
389
- pageSize: R ? T : j,
390
- pageSizeOptions: R ? [T] : void 0,
391
- onPageSizeChange: mt,
392
- hasNextPage: R ? Q < lt.length - 1 : !!H.data?.next_pagination_token,
393
- hasPrevPage: R ? Q > 0 : !!H.data?.prev_pagination_token,
394
- onNextPage: ht,
395
- onPrevPage: gt,
409
+ showAddPanelWhenEmpty: !I && ie(k),
410
+ sorting: Le,
411
+ onSortingChange: wt,
412
+ pageSize: I ? C : ze,
413
+ pageSizeOptions: I ? [C] : void 0,
414
+ onPageSizeChange: Tt,
415
+ hasNextPage: I ? Q < vt.length - 1 : !!H.data?.next_pagination_token,
416
+ hasPrevPage: I ? Q > 0 : !!H.data?.prev_pagination_token,
417
+ onNextPage: Et,
418
+ onPrevPage: Dt,
396
419
  cancelConfirmation: {
397
- open: !!F,
398
- copy: ae(J[Ze], Ze),
399
- onConfirm: () => void Qe(),
400
- onCancel: () => He(void 0),
420
+ open: !!N,
421
+ copy: le(J[ot], ot),
422
+ onConfirm: () => void st(),
423
+ onCancel: () => Ye(void 0),
401
424
  isPending: K.isPending,
402
- cancelButtonLabel: J[Ze].backButton
425
+ cancelButtonLabel: J[ot].backButton
403
426
  },
404
427
  keepConfirmation: {
405
- open: !!I,
428
+ open: !!P,
406
429
  copy: {
407
- title: D.notDuplicateConfirmTitle,
408
- description: D.notDuplicateConfirmDescription,
409
- confirmButton: D.notDuplicateConfirmButton,
430
+ title: T.notDuplicateConfirmTitle,
431
+ description: T.notDuplicateConfirmDescription,
432
+ confirmButton: T.notDuplicateConfirmButton,
410
433
  presentation: {
411
434
  alignment: "center",
412
- icon: me,
435
+ icon: ye,
413
436
  actionWidth: "equal"
414
437
  }
415
438
  },
416
- onConfirm: () => void $e(),
417
- onCancel: () => Ue(void 0),
439
+ onConfirm: () => void ct(),
440
+ onCancel: () => Xe(void 0),
418
441
  isPending: K.isPending,
419
- cancelButtonLabel: D.notDuplicateConfirmBackButton
442
+ cancelButtonLabel: T.notDuplicateConfirmBackButton
420
443
  }
421
444
  };
422
445
  }
423
- function xe(e, t) {
446
+ function Ee(e, t) {
424
447
  let n = /* @__PURE__ */ new Map();
425
448
  for (let t of e) {
426
449
  if (!t.group) continue;
@@ -447,14 +470,14 @@ function xe(e, t) {
447
470
  } : e;
448
471
  });
449
472
  }
450
- function Se(e, t) {
473
+ function De(e, t) {
451
474
  let n = [], r = [];
452
475
  return e.forEach((i, a) => {
453
476
  let o = i.group !== void 0 && i.group.key === e[a - 1]?.group?.key;
454
477
  r.length >= t && !o && (n.push(r), r = []), r.push(i);
455
478
  }), r.length && n.push(r), n;
456
479
  }
457
- function Ce(e) {
458
- return e === se.Settled ? void 0 : e;
480
+ function Oe(e) {
481
+ return e === de.Settled ? void 0 : e;
459
482
  }
460
- export { E as BillDuplicateView, be as useBillsTable };
483
+ export { w as BillDuplicateView, Te as useBillsTable };