@tesouro/embedded-components-react 0.11.180 → 0.11.183

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 (31) hide show
  1. package/README.md +5 -0
  2. package/dist/index.css +22 -0
  3. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index.js +4 -4
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index10.js +14 -17
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index11.js +82 -13
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index12.js +47 -83
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index13.js +261 -47
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index14.js +23 -251
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index15.js +450 -25
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index16.js +286 -442
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index17.js +4 -300
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index18.js +5 -4
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index19.js +37 -4
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index20.js +1 -38
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index5.js +11 -11
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index7.js +88 -7
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index8.js +17 -89
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index9.js +18 -18
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index10.js +4 -4
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index18.js +0 -1
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index20.js +263 -262
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidget/BillsTab.js +1 -1
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/mocks/labels.js +1 -1
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index14.js +1 -1
  25. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index7.js +2 -2
  26. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  27. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/index.js +7 -5
  28. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/AttentionStrip/AttentionStrip.js +29 -0
  29. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/AttentionStrip/AttentionViewBar.js +33 -0
  30. package/package.json +3 -1
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index21.js +0 -1
@@ -3,458 +3,302 @@
3
3
  "use client";
4
4
  "use client";
5
5
  import { toast as e } from "../../../../../../node_modules/sonner/dist/index.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 "../../../../shared/util/dist/index.js";
9
- import { useEmbedApi as r } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
6
+ import { hasAnyScope as t } from "../../../../shared/data-access/dist/lib/hasAnyScope.js";
7
+ import { useMailboxAddress as ee } from "../../../../shared/data-access/dist/lib/useMailboxAddress.js";
8
+ import { Scope as n } from "../../../../shared/data-access/dist/lib/scopes.js";
9
+ import "../../../../shared/data-access/dist/index.js";
10
10
  import "../../../../shared/ui/dist/index.js";
11
- import { useLocalCalendarDay as i } from "../../../../shared/feature/dist/lib/calendar/useLocalCalendarDay.js";
11
+ import { useWidgetConfig as te, useWidgetInitStaleForToken as ne } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
12
12
  import "../../../../shared/feature/dist/index.js";
13
- import { DuplicateVerdict as a } from "../../../util/dist/lib/duplicateVerdict.js";
14
- import { formatScheduledDateLabel as o } from "../../../util/dist/lib/formatScheduledDateLabel.js";
15
- import { hasSuspectedPayableDuplicate as s, suspectedPayableDuplicates as c } from "../../../util/dist/lib/payableDuplicates.js";
16
- import { compareByArrival as l, duplicateVerdictMatches as u, resolveDuplicateOriginalId as d } from "../../../util/dist/lib/groupDuplicates.js";
17
- import { isEditablePayableStatus as f } from "../../../util/dist/lib/isEditablePayableStatus.js";
18
- import { payableRemoval as p } from "../../../util/dist/lib/payableRemoval.js";
19
- import { resolveBillDueDate as m } from "../../../util/dist/lib/resolveBillDueDate.js";
20
- import { resolveVendorName as ee } from "../../../util/dist/lib/resolveVendor.js";
21
- import { buildGroupCollapse as h } from "../../../util/dist/lib/groupCollapse.js";
22
- import "../../../util/dist/index.js";
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/index19.js";
13
+ import { BILL_STATUS_BADGE_LABELS_EN as re } from "../../../../shared/document-status/ui/dist/index2.js";
14
+ import "../../../../shared/document-status/ui/dist/index.js";
15
+ import { BillDecisionDialog as r } from "../../../ui/dist/index4.js";
16
+ import { BillDuplicateIcon as i } from "../../../ui/dist/index6.js";
17
+ import "../../../ui/dist/index.js";
18
+ import { AddBillDialog as ie } from "../../ui/dist/index6.js";
19
+ import { BillsScreen as ae } from "../../ui/dist/index20.js";
27
20
  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 "./index11.js";
30
- import { useBillsFilters as oe } from "./index14.js";
31
- import { BillVendorLookup as se, useBillVendorNames as ce } from "./index15.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";
35
- 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";
21
+ import { BILL_QUEUE_ORDER as a, BillQueue as o } from "./index5.js";
22
+ import { BILLS_TAB_LABELS_EN as s } from "./index7.js";
23
+ import { BillDuplicateView as c, useBillsTable as l } from "./index15.js";
24
+ import { useDuplicateBillsCount as u } from "./index2.js";
25
+ import { formatBillQueueBadge as d } from "./index3.js";
26
+ import { copyTextToClipboard as oe } from "./index6.js";
27
+ import { billsTableCellTestIds as se } from "./index8.js";
28
+ import { useBillQueueCounts as ce } from "./index9.js";
29
+ import { useCallback as f, useImperativeHandle as le, useMemo as p, useState as m } from "react";
30
+ import { Fragment as ue, jsx as h, jsxs as de } from "react/jsx-runtime";
38
31
  // ../../libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index16.js
39
- var ge = 10, T = 100, _e = 3, ve = [{
40
- id: "addedOnLabel",
41
- desc: !0
42
- }], E = {
43
- AllBills: "allBills",
44
- PossibleDuplicates: "possibleDuplicates"
45
- };
46
- function ye(e, t) {
47
- let n = new Map(e.map((e) => [e.id, e])), r = /* @__PURE__ */ new Map(), i = (e) => {
48
- r.has(e) || r.set(e, /* @__PURE__ */ new Set());
49
- }, a = (e, t) => {
50
- i(e), i(t), r.get(e)?.add(t), r.get(t)?.add(e);
51
- };
52
- for (let t of e) {
53
- let e = c(t);
54
- if (e.length !== 0) {
55
- i(t.id);
56
- for (let n of e) a(t.id, n.matched_payable_id);
57
- }
58
- }
59
- let o = [], s = /* @__PURE__ */ new Set();
60
- for (let e of r.keys()) {
61
- if (s.has(e)) continue;
62
- let i = [], a = [e];
63
- for (s.add(e); a.length > 0;) {
64
- let e = a.pop();
65
- n.has(e) && i.push(e);
66
- for (let t of r.get(e) ?? []) s.has(t) || (s.add(t), a.push(t));
67
- }
68
- if (i.length === 0) continue;
69
- let c = i.map((e) => n.get(e)).filter((e) => !!e).sort(l), u = d(c), [f] = c, p = ee(f), m = f?.document_id ?? "", h = u ?? f?.id ?? e, te = `duplicate-group:${p || m ? `${p}|${m}` : h}`;
70
- o.push({
71
- componentIds: i,
72
- baseKey: te,
73
- anchorId: h,
74
- group: {
75
- label: t.groupHeader({
76
- vendorLabel: p,
77
- invoiceNumberLabel: m
78
- }),
79
- title: p,
80
- meta: m ? t.groupInvoice(m) : void 0,
81
- invoiceNumberLabel: m,
82
- vendorCounterpartId: f?.counterpart_id ?? void 0,
83
- originalPayableId: u
32
+ var fe = () => void 0;
33
+ function g({ labels: g, onOpenBill: _, onEnterManually: v, onFilesSelected: y, maxFiles: b, headerActionContainer: pe, ref: me }) {
34
+ let x = p(() => ({
35
+ ...s,
36
+ ...g,
37
+ queues: {
38
+ ...s.queues,
39
+ ...g?.queues
40
+ },
41
+ scheduledRelativeDay: {
42
+ ...s.scheduledRelativeDay,
43
+ ...g?.scheduledRelativeDay
44
+ },
45
+ dueDate: {
46
+ ...s.dueDate,
47
+ ...g?.dueDate
48
+ },
49
+ filters: {
50
+ ...s.filters,
51
+ ...g?.filters,
52
+ presets: {
53
+ ...s.filters.presets,
54
+ ...g?.filters?.presets
55
+ },
56
+ statuses: {
57
+ ...s.filters.statuses,
58
+ ...g?.filters?.statuses
59
+ },
60
+ dateFieldNames: {
61
+ ...s.filters.dateFieldNames,
62
+ ...g?.filters?.dateFieldNames
84
63
  }
85
- });
86
- }
87
- let u = /* @__PURE__ */ new Map();
88
- for (let { baseKey: e } of o) u.set(e, (u.get(e) ?? 0) + 1);
89
- let f = /* @__PURE__ */ new Map();
90
- for (let { componentIds: e, baseKey: t, anchorId: n, group: r } of o) {
91
- let i = (u.get(t) ?? 0) > 1 ? `${t}:${n}` : t, a = {
92
- ...r,
93
- key: i
94
- };
95
- for (let t of e) f.set(t, a);
96
- }
97
- return f;
98
- }
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);
104
- }, []);
105
- fe(() => {
106
- if (N === P) return;
107
- let e = setTimeout(() => {
108
- Ve(N), L();
109
- }, 300);
110
- return () => clearTimeout(e);
111
- }, [
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,
120
- 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);
126
- return {
127
- ...z.query,
64
+ },
65
+ filterBar: {
66
+ ...s.filterBar,
67
+ ...g?.filterBar
68
+ },
69
+ duplicatesEmptyState: {
70
+ ...s.duplicatesEmptyState,
71
+ ...g?.duplicatesEmptyState
72
+ },
73
+ queueEmptyStates: a.reduce((e, t) => ({
128
74
  ...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
136
- };
137
- }, [
138
- z.query,
139
- j,
140
- Pe,
141
- R,
142
- B,
143
- Le,
75
+ [t]: {
76
+ ...s.queueEmptyStates[t],
77
+ ...g?.queueEmptyStates?.[t]
78
+ }
79
+ }), {})
80
+ }), [g]), [he, S] = m(!1), [C, w] = m(c.AllBills), { initResponse: T } = te(), E = ne(), D = t(T?.scopes, [n.PayableReadOrg]), O = t(T?.scopes, [n.PayableWriteOrg]), k = !T || D, A = !T || O, j = T && !E ? t(T.scopes, [n.PayablePayOrg]) : void 0, M = t(T?.scopes, [n.CounterpartReadOrg]), N = g?.screen?.statusBadge, P = p(() => ({
81
+ ...re,
82
+ ...N
83
+ }), [N]), F = p(() => ({
84
+ menuTrigger: x.duplicateMenuTrigger,
85
+ notDuplicateAction: x.duplicateNotDuplicateAction,
86
+ notDuplicateConfirmTitle: x.duplicateNotDuplicateConfirmTitle,
87
+ notDuplicateConfirmDescription: x.duplicateNotDuplicateConfirmDescription,
88
+ notDuplicateConfirmButton: x.duplicateNotDuplicateConfirmButton,
89
+ notDuplicateConfirmBackButton: x.duplicateNotDuplicateConfirmBackButton,
90
+ deleteAction: x.duplicateDeleteAction,
91
+ deleteConfirmTitle: x.duplicateDeleteConfirmTitle,
92
+ deleteConfirmDescription: x.duplicateDeleteConfirmDescription,
93
+ deleteConfirmButton: x.duplicateDeleteConfirmButton,
94
+ deletedToast: x.duplicateDeletedToast,
95
+ confirmAction: x.duplicateConfirmAction,
96
+ confirmDuplicateTitle: x.duplicateConfirmDuplicateTitle,
97
+ confirmDuplicateDescription: x.duplicateConfirmDuplicateDescription,
98
+ confirmDuplicateButton: x.duplicateConfirmDuplicateButton,
99
+ confirmedToast: x.duplicateConfirmedToast,
100
+ cancelAction: x.duplicateCancelAction,
101
+ cancelConfirmTitle: x.duplicateCancelConfirmTitle,
102
+ cancelConfirmDescription: x.duplicateCancelConfirmDescription,
103
+ cancelConfirmButton: x.duplicateCancelConfirmButton,
104
+ cancelConfirmBackButton: x.duplicateCancelConfirmBackButton,
105
+ dismissedToast: x.duplicateDismissedToast,
106
+ cancelledToast: x.duplicateCancelledToast,
107
+ actionFailedToast: x.duplicateActionFailedToast,
108
+ groupHeader: x.duplicateGroupHeader,
109
+ groupInvoice: x.duplicateGroupInvoice,
110
+ showMore: x.duplicateShowMore,
111
+ showLess: x.duplicateShowLess,
112
+ statusSummary: x.duplicateStatusSummary,
113
+ statusLabels: P,
114
+ pageInfo: x.duplicatePageInfo
115
+ }), [
116
+ x.duplicateMenuTrigger,
117
+ x.duplicateNotDuplicateAction,
118
+ x.duplicateNotDuplicateConfirmTitle,
119
+ x.duplicateNotDuplicateConfirmDescription,
120
+ x.duplicateNotDuplicateConfirmButton,
121
+ x.duplicateNotDuplicateConfirmBackButton,
122
+ x.duplicateDeleteAction,
123
+ x.duplicateDeleteConfirmTitle,
124
+ x.duplicateDeleteConfirmDescription,
125
+ x.duplicateDeleteConfirmButton,
126
+ x.duplicateDeletedToast,
127
+ x.duplicateConfirmAction,
128
+ x.duplicateConfirmDuplicateTitle,
129
+ x.duplicateConfirmDuplicateDescription,
130
+ x.duplicateConfirmDuplicateButton,
131
+ x.duplicateConfirmedToast,
132
+ x.duplicateCancelAction,
133
+ x.duplicateCancelConfirmTitle,
134
+ x.duplicateCancelConfirmDescription,
135
+ x.duplicateCancelConfirmButton,
136
+ x.duplicateCancelConfirmBackButton,
137
+ x.duplicateDismissedToast,
138
+ x.duplicateCancelledToast,
139
+ x.duplicateActionFailedToast,
140
+ x.duplicateGroupHeader,
141
+ x.duplicateGroupInvoice,
142
+ x.duplicateShowMore,
143
+ x.duplicateShowLess,
144
+ x.duplicateStatusSummary,
144
145
  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,
150
- pollWhileOcrProcessing: !0
151
- }), U = le({
152
- ...Ye,
153
- enabled: c && R,
154
- maxPages: _e
155
- }), W = R ? {
156
- ...U,
157
- data: { data: U.payables },
158
- isLoading: U.isResolving,
159
- 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) => {
161
- let a = u(t, n, i);
162
- if (a.length) try {
163
- await K.mutateAsync({
164
- verdict: n,
165
- targets: a.map((e) => ({
166
- payableId: t.id,
167
- duplicateId: e.id,
168
- matchedPayableId: e.matched_payable_id,
169
- removeBy: p(t.status)
170
- }))
171
- }), e.success(r);
172
- } catch {
173
- e.error(D.actionFailedToast);
174
- }
175
- }, [K, D.actionFailedToast]), J = C(() => ({
176
- 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
183
- },
184
- 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
146
+ x.duplicatePageInfo
147
+ ]), I = t(T?.scopes, [n.MailboxReadOrg]), { mailboxAddress: L } = ee({
148
+ relatedObjectType: "payable",
149
+ enabled: I && !E
150
+ }), R = I ? L : void 0, z = l({
151
+ enabled: k,
152
+ canPay: j,
153
+ canReadVendors: M,
154
+ isVendorFilterPaused: E,
155
+ filterLabels: x.filters,
156
+ onOpenBill: _ ?? fe,
157
+ duplicateRowNote: x.duplicateRowNote,
158
+ attachmentLabel: x.attachmentIndicator,
159
+ duplicateGroupLabels: F,
160
+ canManageDuplicates: A,
161
+ duplicateView: C,
162
+ scheduledRelativeDayLabels: x.scheduledRelativeDay,
163
+ dueDateLabels: x.dueDate
164
+ }), B = u({ enabled: k }), V = C === c.PossibleDuplicates, H = ce({
165
+ enabled: k,
166
+ canPay: j
167
+ }), ge = p(() => a.map((e) => ({
168
+ id: e,
169
+ label: x.queues[e],
170
+ badge: d(H[e])
171
+ })), [x.queues, H]), { clearQueryConstraints: U, onFilterTabChange: W } = z, _e = f(() => {
172
+ U(), w(c.PossibleDuplicates);
173
+ }, [U]), G = f(() => {
174
+ w(c.AllBills), W(o.All);
175
+ }, [W]), ve = f((e) => {
176
+ w(c.AllBills), W(e);
177
+ }, [W]), ye = !B.isError && B.groupCount > 0, K = A && ye, be = !B.isLoading && !B.isError && B.count === 0;
178
+ V && be && G();
179
+ let xe = K ? [{
180
+ id: "duplicates",
181
+ label: x.attentionDuplicates(B.groupCount, B.isCapped),
182
+ tone: "warning",
183
+ icon: /* @__PURE__ */ h(i, {}),
184
+ pressed: V,
185
+ onToggle: V ? G : _e
186
+ }] : [], q = g?.screen, Se = p(() => ({
187
+ ...q,
188
+ createButton: x.createButton,
189
+ addBill: {
190
+ ...q?.addBill,
191
+ heading: x.nonEmptyHeading
191
192
  },
192
- 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
199
- }
200
- }), [D]), Ze = F?.removeBy ?? "cancel", Qe = S(async () => {
201
- F && (await q(F.payable, a.Remove, J[F.removeBy].toast), He(void 0));
202
- }, [
193
+ ...V ? {
194
+ columnAddedOn: x.duplicateColumnCreated,
195
+ columnAmountDue: x.duplicateColumnAmount
196
+ } : {}
197
+ }), [
198
+ V,
199
+ x.duplicateColumnCreated,
200
+ x.duplicateColumnAmount,
203
201
  q,
204
- F,
205
- J
206
- ]), $e = S(async () => {
207
- I && (await q(I.payable, a.Keep, D.dismissedToast, I.originalPayableId), Ue(void 0));
208
- }, [
209
- q,
210
- D.dismissedToast,
211
- I
212
- ]), [et, tt] = w(V);
213
- fe(() => {
214
- W.isFetching || tt(V);
215
- }, [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,
218
- G,
219
- D
220
- ]), ot = C(() => {
221
- if (Y.size === 0) return G;
222
- let e = /* @__PURE__ */ new Map();
223
- return G.forEach((t, n) => {
224
- let r = Y.get(t.id)?.key;
225
- r !== void 0 && !e.has(r) && e.set(r, n);
226
- }), G.map((t, n) => ({
227
- payable: t,
228
- index: n,
229
- order: e.get(Y.get(t.id)?.key ?? "") ?? n
230
- })).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({
232
- payables: W.data?.data,
233
- enabled: c,
234
- canReadVendors: h,
235
- isPaused: se
236
- }), ct = S((e) => {
237
- let t = e.title || (e.vendorCounterpartId ? X.get(e.vendorCounterpartId) ?? "" : "");
238
- return {
239
- key: e.key,
240
- label: t === e.title ? e.label : D.groupHeader({
241
- vendorLabel: t,
242
- invoiceNumberLabel: e.invoiceNumberLabel
243
- }),
244
- title: t,
245
- meta: e.meta
246
- };
247
- }, [X, D]), Z = C(() => xe(ot.map((e) => {
248
- let r = te({
249
- apiStatus: e.status,
250
- dueDate: e.due_date,
251
- 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({
253
- status: e.status,
254
- dueDate: e.due_date,
255
- today: k,
256
- 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({
260
- vendorLabel: g,
261
- invoiceNumberLabel: _
262
- }),
263
- items: [{
264
- id: "not-duplicate",
265
- label: D.notDuplicateAction,
266
- icon: me,
267
- disabled: K.isPending,
268
- onSelect: () => Ue({
269
- payable: e,
270
- originalPayableId: b ? void 0 : d.originalPayableId
271
- })
272
- }, ...y ? [{
273
- id: "cancel-duplicate",
274
- label: J[y].action,
275
- icon: y === "delete" ? he : pe,
276
- disabled: K.isPending,
277
- onSelect: () => He({
278
- payable: e,
279
- removeBy: y
280
- })
281
- }] : []]
282
- } : void 0;
283
- return {
284
- rowKey: e.id,
285
- vendorLabel: g,
286
- vendorLookup: g || !e.counterpart_id ? void 0 : Ce(st),
287
- invoiceNumberLabel: _,
288
- issueDateLabel: t(e.issued_at),
289
- dueDateLabel: u.label,
290
- dueDateOverdueLabel: u.overdueLabel,
291
- dueDateAccessibleLabel: u.accessibleLabel,
292
- scheduledDateLabel: l.label,
293
- scheduledDateExact: l.absoluteLabel,
294
- scheduledDateIsGap: B === v.Scheduled,
295
- paidDateLabel: t(e.paid_at?.slice(0, 10)),
296
- amountDueLabel: c(i),
297
- amountPaidLabel: a ? c(e.amount_paid) : "",
298
- amountPaidIsGap: B === v.Paid,
299
- amountScheduledLabel: c(e.amount_to_pay ?? i),
300
- totalAmountLabel: c(e.total_amount),
301
- attachment: e.file_id ? { label: Ee } : void 0,
302
- status: r.status,
303
- statusTone: r.tone,
304
- addedOnLabel: t(e.created_at?.slice(0, 10)),
305
- ...d ? { group: ct(d) } : {},
306
- ...x ? { menu: x } : {},
307
- ...!R && !d && h ? {
308
- marker: "duplicate",
309
- rowNote: Te
310
- } : {},
311
- onOpen: () => we(e.id, f(e.status))
312
- };
313
- }), D), [
314
- ot,
315
- Y,
316
- D,
317
- J,
318
- K.isPending,
319
- De,
320
- R,
321
- Te,
322
- Ee,
323
- Oe,
324
- ke,
325
- k,
326
- we,
327
- B,
328
- 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) => {
332
- let t = e;
333
- Ae(t), Me((e) => {
334
- 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);
347
- }, [
348
- Q,
349
- R,
350
- H.data?.next_pagination_token
351
- ]), gt = S(() => {
352
- R ? ze(Math.max(0, Q - 1)) : M(H.data?.prev_pagination_token ?? void 0);
353
- }, [
354
- Q,
355
- R,
356
- H.data?.prev_pagination_token
357
- ]), _t = S(() => {
358
- W.refetch();
359
- }, [W.refetch]);
360
- return {
361
- rows: ut,
362
- isLoading: W.isLoading || !R && Le === void 0 || V !== et || rt && it.isLoading || (nt ?? 0) > 0 && ut.length === 0,
363
- isError: W.isError,
364
- onRetry: _t,
365
- selectedFilterTabId: A,
366
- 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({
383
- billCount: Z.length,
384
- invoiceCount: new Set(Z.map((e) => e.group?.key ?? e.rowKey)).size
385
- }) : 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,
396
- cancelConfirmation: {
397
- open: !!F,
398
- copy: ae(J[Ze], Ze),
399
- onConfirm: () => void Qe(),
400
- onCancel: () => He(void 0),
401
- isPending: K.isPending,
402
- cancelButtonLabel: J[Ze].backButton
403
- },
404
- keepConfirmation: {
405
- open: !!I,
406
- copy: {
407
- title: D.notDuplicateConfirmTitle,
408
- description: D.notDuplicateConfirmDescription,
409
- confirmButton: D.notDuplicateConfirmButton,
410
- presentation: {
411
- alignment: "center",
412
- icon: me,
413
- actionWidth: "equal"
414
- }
415
- },
416
- onConfirm: () => void $e(),
417
- onCancel: () => Ue(void 0),
418
- isPending: K.isPending,
419
- cancelButtonLabel: D.notDuplicateConfirmBackButton
202
+ x.createButton,
203
+ x.nonEmptyHeading
204
+ ]), Ce = p(() => ({
205
+ ...z.filterBarProps,
206
+ labels: x.filterBar
207
+ }), [z.filterBarProps, x.filterBar]), J = () => {
208
+ S(!1), v?.();
209
+ }, Y = (e) => {
210
+ S(!1), y?.(e);
211
+ }, X = R ? {
212
+ emailAddress: R,
213
+ onCopyEmail: async () => {
214
+ R && (await oe(R) ? e.success(x.emailCopiedToast) : e.error(x.emailCopyFailedToast));
420
215
  }
421
- };
422
- }
423
- function xe(e, t) {
424
- let n = /* @__PURE__ */ new Map();
425
- for (let t of e) {
426
- if (!t.group) continue;
427
- let e = n.get(t.group.key) ?? [];
428
- e.push(t.status), n.set(t.group.key, e);
429
- }
430
- return e.map((e) => {
431
- if (!e.group) return e;
432
- let r = h({
433
- statuses: n.get(e.group.key) ?? [],
434
- statusLabels: t.statusLabels,
216
+ } : {
217
+ emailAddress: void 0,
218
+ onCopyEmail: void 0
219
+ }, { showVendorBills: Z } = z, Q = f((e) => {
220
+ w(c.AllBills), Z(e);
221
+ }, [Z]), $ = f(() => S(!0), []);
222
+ return le(me, () => ({
223
+ showVendorBills: Q,
224
+ openAddBill: $
225
+ }), [Q, $]), /* @__PURE__ */ de(ue, { children: [
226
+ /* @__PURE__ */ h(ae, {
227
+ rows: z.rows,
228
+ isLoading: z.isLoading || !T,
229
+ isError: z.isError,
230
+ onRetry: z.onRetry,
231
+ sorting: z.sorting,
232
+ onSortingChange: z.onSortingChange,
233
+ pageSize: z.pageSize,
234
+ onPageSizeChange: z.onPageSizeChange,
235
+ pageSizeOptions: z.pageSizeOptions,
236
+ hasNextPage: z.hasNextPage,
237
+ hasPrevPage: z.hasPrevPage,
238
+ onNextPage: z.onNextPage,
239
+ onPrevPage: z.onPrevPage,
240
+ filterTabs: ge,
241
+ selectedFilterTabId: z.selectedFilterTabId,
242
+ onFilterTabChange: ve,
243
+ searchValue: z.searchValue,
244
+ onSearchChange: z.onSearchChange,
245
+ filters: Ce,
246
+ visibleColumns: z.visibleColumns,
247
+ keepsColumnOrder: z.keepsColumnOrder,
248
+ isSortable: z.isSortable,
249
+ pageInfo: z.pageInfo,
250
+ cellTestIds: se,
251
+ isSearchActive: z.isSearchActive,
252
+ showAddPanelWhenEmpty: z.showAddPanelWhenEmpty,
253
+ emptyState: V ? x.duplicatesEmptyState : x.queueEmptyStates[z.selectedFilterTabId],
254
+ onCreateClick: A ? () => S(!0) : void 0,
255
+ headerActionContainer: pe,
256
+ onEnterManually: A ? J : void 0,
257
+ onFilesSelected: A ? Y : void 0,
258
+ maxFiles: b,
259
+ ...X,
260
+ attentionStrip: {
261
+ label: x.attentionStripLabel,
262
+ items: xe
263
+ },
264
+ attentionView: V ? {
265
+ backLabel: x.queues[o.All],
266
+ backAccessibleLabel: x.attentionBackAccessible,
267
+ title: x.duplicatesViewTitle,
268
+ tone: "warning",
269
+ onBack: G
270
+ } : void 0,
271
+ labels: Se
272
+ }),
273
+ /* @__PURE__ */ h(r, {
274
+ open: z.cancelConfirmation.open,
275
+ copy: z.cancelConfirmation.copy,
276
+ onConfirm: z.cancelConfirmation.onConfirm,
277
+ onCancel: z.cancelConfirmation.onCancel,
278
+ isPending: z.cancelConfirmation.isPending,
279
+ labels: { cancelButton: z.cancelConfirmation.cancelButtonLabel }
280
+ }),
281
+ /* @__PURE__ */ h(r, {
282
+ open: z.keepConfirmation.open,
283
+ copy: z.keepConfirmation.copy,
284
+ onConfirm: z.keepConfirmation.onConfirm,
285
+ onCancel: z.keepConfirmation.onCancel,
286
+ isPending: z.keepConfirmation.isPending,
287
+ labels: { cancelButton: z.keepConfirmation.cancelButtonLabel }
288
+ }),
289
+ A ? /* @__PURE__ */ h(ie, {
290
+ open: he,
291
+ onOpenChange: S,
292
+ onFilesSelected: Y,
293
+ maxFiles: b,
294
+ onEnterManually: J,
295
+ ...X,
296
+ dialogLabels: g?.addBillDialog?.dialog,
435
297
  labels: {
436
- showMore: t.showMore,
437
- showLess: t.showLess,
438
- statusSummary: t.statusSummary
439
- }
440
- });
441
- return r ? {
442
- ...e,
443
- group: {
444
- ...e.group,
445
- collapse: r
298
+ ...g?.addBillDialog?.panel,
299
+ heading: z.hasAnyBills ? x.nonEmptyHeading : x.emptyHeading
446
300
  }
447
- } : e;
448
- });
449
- }
450
- function Se(e, t) {
451
- let n = [], r = [];
452
- return e.forEach((i, a) => {
453
- let o = i.group !== void 0 && i.group.key === e[a - 1]?.group?.key;
454
- r.length >= t && !o && (n.push(r), r = []), r.push(i);
455
- }), r.length && n.push(r), n;
456
- }
457
- function Ce(e) {
458
- return e === se.Settled ? void 0 : e;
301
+ }) : null
302
+ ] });
459
303
  }
460
- export { E as BillDuplicateView, be as useBillsTable };
304
+ export { g as BillsList, g as default };