@tesouro/embedded-components-react 0.2.330 → 0.2.331

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 (19) hide show
  1. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +1 -1
  2. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +5 -50
  3. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +9 -9
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +92 -16
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +3 -8
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +50 -77
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +8 -145
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +18 -5
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +6 -6
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +78 -7
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +142 -75
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +2 -0
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +7 -7
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index2.js +1 -0
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index3.js +21 -21
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index53.js +51 -49
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index7.js +16 -15
  18. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  19. package/package.json +1 -1
@@ -11,10 +11,10 @@ import "./index40.js";
11
11
  import "./index41.js";
12
12
  import "./index42.js";
13
13
  import "./index46.js";
14
+ import "./index47.js";
14
15
  import "./index48.js";
15
16
  import "./index49.js";
16
17
  import "./index50.js";
17
- import "./index51.js";
18
18
  import "./index52.js";
19
19
  import "./index53.js";
20
20
  import "./index54.js";
@@ -1,53 +1,8 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js
2
- var e = {
3
- Drafts: "drafts",
4
- Pending: "pending",
5
- Scheduled: "scheduled",
6
- Paid: "paid",
7
- All: "all"
8
- }, t = {
9
- [e.Drafts]: ["draft"],
10
- [e.Pending]: [
11
- "new",
12
- "approve_in_progress",
13
- "waiting_to_be_paid",
14
- "partially_paid"
15
- ],
16
- [e.Scheduled]: [
17
- "new",
18
- "approve_in_progress",
19
- "waiting_to_be_paid",
20
- "partially_paid"
21
- ],
22
- [e.Paid]: ["paid"],
23
- [e.All]: void 0
24
- }, n = {
25
- [e.Drafts]: void 0,
26
- [e.Pending]: !1,
27
- [e.Scheduled]: !0,
28
- [e.Paid]: void 0,
29
- [e.All]: void 0
30
- }, r = e.Drafts, i = [
31
- e.Drafts,
32
- e.Pending,
33
- e.Scheduled,
34
- e.Paid,
35
- e.All
2
+ var e = (e) => [
3
+ "bill-pay",
4
+ "upload-queue",
5
+ e ?? ""
36
6
  ];
37
- function a(e) {
38
- let n = t[e];
39
- return n ? [...n] : void 0;
40
- }
41
- function o(e) {
42
- return n[e];
43
- }
44
- var s = {
45
- vendorLabel: "counterpart_name",
46
- dueDateLabel: "due_date",
47
- addedOnLabel: "created_at"
48
- };
49
- function c(e) {
50
- if (e) return s[e];
51
- }
52
7
  //#endregion
53
- export { n as BILL_QUEUE_HAS_SCHEDULED_PAYMENT, i as BILL_QUEUE_ORDER, t as BILL_QUEUE_STATUSES, s as BILL_SORT_FIELDS, e as BillQueue, r as DEFAULT_BILL_QUEUE, o as billQueueHasScheduledPayment, a as billQueueStatuses, c as billSortField };
8
+ export { e as billPayUploadQueueKey };
@@ -1,11 +1,11 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js
2
- async function e(e) {
3
- if (!e.trim()) return !1;
4
- try {
5
- return await navigator.clipboard.writeText(e), !0;
6
- } catch {
7
- return !1;
8
- }
9
- }
2
+ var e = {
3
+ uploadingSummary: (e) => `Uploading and scanning ${e} ${e === 1 ? "file" : "files"}`,
4
+ completeSummary: (e) => `${e} ${e === 1 ? "upload" : "uploads"} complete`,
5
+ readyCaption: (e) => `${e} new ${e === 1 ? "bill" : "bills"} ready`,
6
+ failedCaption: (e) => `${e} failed to upload`,
7
+ tooManyFilesError: (e) => `You can only upload up to ${e} files at a time`,
8
+ remainingCapacityError: (e) => e === 0 ? "Wait for the current uploads to finish before adding more files" : `You can upload ${e} more ${e === 1 ? "file" : "files"} right now`
9
+ };
10
10
  //#endregion
11
- export { e as copyTextToClipboard };
11
+ export { e as BILL_UPLOAD_QUEUE_LABELS_EN };
@@ -1,18 +1,94 @@
1
- import { BillQueue as e } from "./index46.js";
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
+ import { useEmbedApi as t } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
7
+ import "../../../shared/ui/dist/index.js";
8
+ import { useUploadPayableFromFileMutation as n } from "../../data-access/dist/index10.js";
9
+ import { usePayableOcrQueries as r } from "../../data-access/dist/index12.js";
10
+ import "../../data-access/dist/index.js";
11
+ import { billPayUploadQueueKey as i } from "./index46.js";
12
+ import { BILL_UPLOAD_QUEUE_LABELS_EN as a } from "./index47.js";
13
+ import { useCallback as o, useEffect as s, useMemo as c, useState as l } from "react";
14
+ import { useQuery as u, useQueryClient as d } from "@tanstack/react-query";
2
15
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js
3
- var t = {
4
- [e.Drafts]: "Drafts",
5
- [e.Pending]: "Pending",
6
- [e.Scheduled]: "Scheduled",
7
- [e.Paid]: "Paid",
8
- [e.All]: "All bills"
9
- }, n = {
10
- emptyHeading: "Add your first bill",
11
- nonEmptyHeading: "Add a bill",
12
- createButton: "Add bill",
13
- emailCopiedToast: "Email address copied to clipboard",
14
- emailCopyFailedToast: "Could not copy the email address",
15
- queues: t
16
- };
16
+ function f({ onOpenBill: f, labels: p } = {}) {
17
+ let m = {
18
+ ...a,
19
+ ...p
20
+ }, h = p?.tooManyFilesError ?? a.tooManyFilesError, g = p?.remainingCapacityError ?? a.remainingCapacityError, { organizationId: _ } = t(), v = d(), y = c(() => i(_), [_]), b = n(), [x, S] = l(!1), { data: C = [] } = u({
21
+ queryKey: y,
22
+ queryFn: () => v.getQueryData(y) ?? [],
23
+ staleTime: Infinity,
24
+ gcTime: Infinity,
25
+ initialData: []
26
+ }), w = o((e, t) => {
27
+ v.setQueryData(y, (n) => (n ?? []).map((n) => n.localId === e ? {
28
+ ...n,
29
+ ...t
30
+ } : n));
31
+ }, [v, y]), T = o((t) => {
32
+ let n = (v.getQueryData(y) ?? []).filter((e) => e.status === "uploading").length;
33
+ if (t.length + n > 10) {
34
+ e.error(n > 0 ? g(10 - n) : h(10));
35
+ return;
36
+ }
37
+ S(!1);
38
+ for (let e of t) {
39
+ let t = crypto.randomUUID();
40
+ v.setQueryData(y, (n) => [...n ?? [], {
41
+ localId: t,
42
+ fileName: e.name,
43
+ status: "uploading"
44
+ }]), b.mutateAsync({ file: e }).then((e) => w(t, { payableId: e?.id })).catch(() => w(t, { status: "failed" }));
45
+ }
46
+ }, [
47
+ w,
48
+ v,
49
+ y,
50
+ g,
51
+ h,
52
+ b
53
+ ]), E = r({ payableIds: C.filter((e) => e.status === "uploading" && e.payableId).map((e) => e.payableId) });
54
+ s(() => {
55
+ for (let { payableId: e, ocrStatus: t, isError: n } of E) {
56
+ let r = C.find((t) => t.payableId === e && t.status === "uploading");
57
+ r && (t === "success" ? w(r.localId, { status: "ready" }) : (n || t === "error" || t === "canceled") && w(r.localId, { status: "failed" }));
58
+ }
59
+ }, [
60
+ C,
61
+ E,
62
+ w
63
+ ]);
64
+ let D = C.filter((e) => e.status === "uploading"), O = C.filter((e) => e.status === "ready"), k = C.filter((e) => e.status === "failed"), A = (e) => ({
65
+ id: e.localId,
66
+ fileName: e.fileName,
67
+ status: e.status,
68
+ onOpen: e.status === "ready" && e.payableId && f ? () => f(e.payableId) : void 0
69
+ }), j = D.length ? [{
70
+ id: "in-progress",
71
+ items: C.map(A)
72
+ }] : [...O.length ? [{
73
+ id: "ready",
74
+ caption: m.readyCaption(O.length),
75
+ items: O.map(A)
76
+ }] : [], ...k.length ? [{
77
+ id: "failed",
78
+ caption: m.failedCaption(k.length),
79
+ items: k.map(A)
80
+ }] : []], M = D.length ? m.uploadingSummary(C.length) : O.length ? m.completeSummary(O.length) : m.failedCaption(k.length), N = o(() => {
81
+ v.setQueryData(y, []);
82
+ }, [v, y]);
83
+ return {
84
+ enqueue: T,
85
+ sections: j,
86
+ summaryLabel: M,
87
+ collapsed: x,
88
+ onToggleCollapsed: o(() => S((e) => !e), []),
89
+ onClose: N,
90
+ isVisible: C.length > 0
91
+ };
92
+ }
17
93
  //#endregion
18
- export { n as BILLS_TAB_LABELS_EN, t as BILL_QUEUE_LABELS_EN };
94
+ export { f as useBillUploadQueue };
@@ -1,8 +1,3 @@
1
- //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js
2
- var e = {
3
- root: "bill-pay-bills-tab",
4
- uploadTray: "bill-pay-upload-tray",
5
- detailsSheet: "bill-pay-details-sheet"
6
- };
7
- //#endregion
8
- export { e as billsTabTestIds };
1
+ import "./index46.js";
2
+ import "./index47.js";
3
+ import "./index48.js";
@@ -1,80 +1,53 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { formatCalendarDate as e } from "../../../shared/util/dist/lib/formatCalendarDate.js";
6
- import { formatMoneyExact as t } from "../../../shared/util/dist/lib/formatMoneyExact.js";
7
- import { resolveVendorName as n } from "./index3.js";
8
- import { usePayablesQuery as r, usePayablesTotalCountQuery as i } from "../../data-access/dist/index13.js";
9
- import "../../data-access/dist/index.js";
10
- import { derivePayableStatus as a } from "./index20.js";
11
- import { DEFAULT_BILL_QUEUE as o, billQueueHasScheduledPayment as s, billQueueStatuses as c, billSortField as l } from "./index46.js";
12
- import { useCallback as u, useEffect as d, useMemo as f, useState as p } from "react";
13
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js
14
- var m = 10, h = [{
15
- id: "addedOnLabel",
16
- desc: !0
17
- }];
18
- function g({ enabled: g = !0, onOpenBill: _ }) {
19
- let [v, y] = p(o), [b, x] = p(h), [S, C] = p(m), [w, T] = p(), [E, D] = p(""), [O, k] = p(""), A = u(() => T(void 0), []);
20
- d(() => {
21
- let e = setTimeout(() => {
22
- k(E), A();
23
- }, 300);
24
- return () => clearTimeout(e);
25
- }, [E, A]);
26
- let j = b[0], M = l(j?.id), N = r({
27
- limit: S,
28
- pagination_token: w,
29
- status__in: c(v),
30
- has_scheduled_payment: s(v),
31
- counterpart_name__icontains: O || void 0,
32
- sort: M,
33
- order: M ? j?.desc ? "desc" : "asc" : void 0,
34
- enabled: g
35
- }), P = N.data?.data.length === 0, F = i({ enabled: g && P }), I = !P || (F.data?.count ?? 1) > 0, L = f(() => (N.data?.data ?? []).map((r) => {
36
- let i = a({
37
- apiStatus: r.status,
38
- dueDate: r.due_date,
39
- scheduledPaymentDate: r.scheduled_payment_date
40
- }), o = r.amount_due ?? r.total_amount;
41
- return {
42
- vendorLabel: n(r),
43
- dueDateLabel: e(r.due_date),
44
- amountDueLabel: o == null ? "" : t(o / 100, { currencyCode: r.currency ?? "USD" }),
45
- status: i.status,
46
- statusTone: i.tone,
47
- addedOnLabel: e(r.created_at?.slice(0, 10)),
48
- onOpen: () => _(r.id, i.status === "draft")
49
- };
50
- }), [N.data?.data, _]), R = u((e) => {
51
- y(e), A();
52
- }, [A]), z = u((e) => {
53
- x((t) => typeof e == "function" ? e(t) : e), A();
54
- }, [A]), B = u((e) => {
55
- C(e), A();
56
- }, [A]), V = u(() => T(N.data?.next_pagination_token), [N.data?.next_pagination_token]), H = u(() => T(N.data?.prev_pagination_token), [N.data?.prev_pagination_token]), U = u(() => {
57
- N.refetch();
58
- }, [N.refetch]);
59
- return {
60
- rows: L,
61
- isLoading: N.isLoading || P && F.isLoading,
62
- isError: N.isError,
63
- onRetry: U,
64
- selectedFilterTabId: v,
65
- onFilterTabChange: R,
66
- searchValue: E,
67
- onSearchChange: D,
68
- hasAnyBills: I,
69
- sorting: b,
70
- onSortingChange: z,
71
- pageSize: S,
72
- onPageSizeChange: B,
73
- hasNextPage: !!N.data?.next_pagination_token,
74
- hasPrevPage: !!N.data?.prev_pagination_token,
75
- onNextPage: V,
76
- onPrevPage: H
77
- };
2
+ var e = {
3
+ Drafts: "drafts",
4
+ Pending: "pending",
5
+ Scheduled: "scheduled",
6
+ Paid: "paid",
7
+ All: "all"
8
+ }, t = {
9
+ [e.Drafts]: ["draft"],
10
+ [e.Pending]: [
11
+ "new",
12
+ "approve_in_progress",
13
+ "waiting_to_be_paid",
14
+ "partially_paid"
15
+ ],
16
+ [e.Scheduled]: [
17
+ "new",
18
+ "approve_in_progress",
19
+ "waiting_to_be_paid",
20
+ "partially_paid"
21
+ ],
22
+ [e.Paid]: ["paid"],
23
+ [e.All]: void 0
24
+ }, n = {
25
+ [e.Drafts]: void 0,
26
+ [e.Pending]: !1,
27
+ [e.Scheduled]: !0,
28
+ [e.Paid]: void 0,
29
+ [e.All]: void 0
30
+ }, r = e.Drafts, i = [
31
+ e.Drafts,
32
+ e.Pending,
33
+ e.Scheduled,
34
+ e.Paid,
35
+ e.All
36
+ ];
37
+ function a(e) {
38
+ let n = t[e];
39
+ return n ? [...n] : void 0;
40
+ }
41
+ function o(e) {
42
+ return n[e];
43
+ }
44
+ var s = {
45
+ vendorLabel: "counterpart_name",
46
+ dueDateLabel: "due_date",
47
+ addedOnLabel: "created_at"
48
+ };
49
+ function c(e) {
50
+ if (e) return s[e];
78
51
  }
79
52
  //#endregion
80
- export { g as useBillsTable };
53
+ export { n as BILL_QUEUE_HAS_SCHEDULED_PAYMENT, i as BILL_QUEUE_ORDER, t as BILL_QUEUE_STATUSES, s as BILL_SORT_FIELDS, e as BillQueue, r as DEFAULT_BILL_QUEUE, o as billQueueHasScheduledPayment, a as billQueueStatuses, c as billSortField };
@@ -1,148 +1,11 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
- import { hasAnyScope as t } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
7
- import { Scope as n } from "../../../shared/data-access/dist/lib/scopes.js";
8
- import "../../../shared/data-access/dist/index.js";
9
- import "../../../shared/ui/dist/index.js";
10
- import { useWidgetConfig as r } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
11
- import "../../../shared/feature/dist/index.js";
12
- import { AddBillDialog as i } from "../../ui/dist/index10.js";
13
- import { BillsScreen as a } from "../../ui/dist/index53.js";
14
- import "../../ui/dist/index.js";
15
- import { BillCreateDialog as o } from "./index37.js";
16
- import "./index38.js";
17
- import { BillDetailsContainer as s } from "./index41.js";
18
- import "./index42.js";
19
- import { BILL_QUEUE_ORDER as c, BillQueue as l } from "./index46.js";
20
- import { BILLS_TAB_LABELS_EN as u } from "./index48.js";
21
- import { billsTabTestIds as d } from "./index49.js";
22
- import { useBillsTable as f } from "./index50.js";
23
- import { copyTextToClipboard as p } from "./index47.js";
24
- import { useCallback as m, useEffect as h, useMemo as g, useState as _ } from "react";
25
- import { jsx as v, jsxs as y } from "react/jsx-runtime";
26
- import { CalendarClockIcon as b, CheckIcon as x, FilePenIcon as S, ListIcon as C, LoaderCircleIcon as w } from "lucide-react";
27
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js
28
- var T = "bills@business-banking.app", E = {
29
- [l.Drafts]: /* @__PURE__ */ v(S, {
30
- className: "ttw:size-4",
31
- "aria-hidden": !0
32
- }),
33
- [l.Pending]: /* @__PURE__ */ v(w, {
34
- className: "ttw:size-4",
35
- "aria-hidden": !0
36
- }),
37
- [l.Scheduled]: /* @__PURE__ */ v(b, {
38
- className: "ttw:size-4",
39
- "aria-hidden": !0
40
- }),
41
- [l.Paid]: /* @__PURE__ */ v(x, {
42
- className: "ttw:size-4",
43
- "aria-hidden": !0
44
- }),
45
- [l.All]: /* @__PURE__ */ v(C, {
46
- className: "ttw:size-4",
47
- "aria-hidden": !0
48
- })
49
- };
50
- function D({ labels: l, onEnqueueFiles: b, openPayableId: x, onOpenPayableHandled: S, poweredByBankName: C }) {
51
- let w = g(() => ({
52
- ...u,
53
- ...l,
54
- queues: {
55
- ...u.queues,
56
- ...l?.queues
57
- }
58
- }), [l]), [D, O] = _(!1), [k, A] = _(), [j, M] = _(!1), [N, P] = _(), [F, I] = _(!1), [L, R] = _(!1), { initResponse: z } = r(), B = t(z?.scopes, [n.PayableReadOrg]), V = t(z?.scopes, [n.PayableWriteOrg]), H = !z || B, U = !z || V, W = m((e, t) => {
59
- if (t && U) {
60
- A(e), M(!0);
61
- return;
62
- }
63
- P(e), I(!0);
64
- }, [U]), G = f({
65
- enabled: H,
66
- onOpenBill: W
67
- }), K = g(() => c.map((e) => ({
68
- id: e,
69
- label: w.queues[e],
70
- icon: E[e]
71
- })), [w.queues]), q = () => {
72
- I(!1), R(!0);
73
- }, J = g(() => ({
74
- createButton: w.createButton,
75
- addBill: { heading: w.emptyHeading }
76
- }), [w.createButton, w.emptyHeading]), Y = () => {
77
- O(!1), A(void 0), M(!0);
78
- }, X = (e) => {
79
- O(!1), b?.(e);
80
- }, Z = async () => {
81
- await p(T) ? e.success(w.emailCopiedToast) : e.error(w.emailCopyFailedToast);
82
- };
83
- return h(() => {
84
- x && (A(x), M(!0), S?.());
85
- }, [S, x]), /* @__PURE__ */ y("div", {
86
- "data-testid": d.root,
87
- children: [
88
- /* @__PURE__ */ v(a, {
89
- rows: G.rows,
90
- isLoading: G.isLoading || !z,
91
- isError: G.isError,
92
- onRetry: G.onRetry,
93
- sorting: G.sorting,
94
- onSortingChange: G.onSortingChange,
95
- pageSize: G.pageSize,
96
- onPageSizeChange: G.onPageSizeChange,
97
- hasNextPage: G.hasNextPage,
98
- hasPrevPage: G.hasPrevPage,
99
- onNextPage: G.onNextPage,
100
- onPrevPage: G.onPrevPage,
101
- filterTabs: K,
102
- selectedFilterTabId: G.selectedFilterTabId,
103
- onFilterTabChange: G.onFilterTabChange,
104
- searchValue: G.searchValue,
105
- onSearchChange: G.onSearchChange,
106
- isFiltering: G.hasAnyBills,
107
- onCreateClick: U ? () => O(!0) : void 0,
108
- onEnterManually: U ? Y : void 0,
109
- onFilesSelected: U ? X : void 0,
110
- emailAddress: T,
111
- onCopyEmail: Z,
112
- labels: J
113
- }),
114
- U ? /* @__PURE__ */ v(i, {
115
- open: D,
116
- onOpenChange: O,
117
- onFilesSelected: X,
118
- onEnterManually: Y,
119
- emailAddress: T,
120
- onCopyEmail: Z,
121
- labels: { heading: G.hasAnyBills ? w.nonEmptyHeading : w.emptyHeading }
122
- }) : null,
123
- j ? /* @__PURE__ */ v(o, {
124
- open: j,
125
- onOpenChange: M,
126
- payableId: k
127
- }) : null,
128
- F ? /* @__PURE__ */ v(s, {
129
- open: F,
130
- onOpenChange: I,
131
- payableId: N,
132
- onClose: () => I(!1),
133
- onExpand: q,
134
- testId: d.detailsSheet,
135
- poweredByBankName: C
136
- }) : null,
137
- L ? /* @__PURE__ */ v(o, {
138
- open: L,
139
- onOpenChange: R,
140
- payableId: N,
141
- readOnly: !0,
142
- poweredByBankName: C
143
- }) : null
144
- ]
145
- });
2
+ async function e(e) {
3
+ if (!e.trim()) return !1;
4
+ try {
5
+ return await navigator.clipboard.writeText(e), !0;
6
+ } catch {
7
+ return !1;
8
+ }
146
9
  }
147
10
  //#endregion
148
- export { D as BillsTab, D as default };
11
+ export { e as copyTextToClipboard };
@@ -1,5 +1,18 @@
1
- import "./index46.js";
2
- import "./index48.js";
3
- import "./index49.js";
4
- import "./index50.js";
5
- import "./index51.js";
1
+ import { BillQueue as e } from "./index50.js";
2
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js
3
+ var t = {
4
+ [e.Drafts]: "Drafts",
5
+ [e.Pending]: "Pending",
6
+ [e.Scheduled]: "Scheduled",
7
+ [e.Paid]: "Paid",
8
+ [e.All]: "All bills"
9
+ }, n = {
10
+ emptyHeading: "Add your first bill",
11
+ nonEmptyHeading: "Add a bill",
12
+ createButton: "Add bill",
13
+ emailCopiedToast: "Email address copied to clipboard",
14
+ emailCopyFailedToast: "Could not copy the email address",
15
+ queues: t
16
+ };
17
+ //#endregion
18
+ export { n as BILLS_TAB_LABELS_EN, t as BILL_QUEUE_LABELS_EN };
@@ -1,8 +1,8 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js
2
- var e = (e) => [
3
- "bill-pay",
4
- "upload-queue",
5
- e ?? ""
6
- ];
2
+ var e = {
3
+ root: "bill-pay-bills-tab",
4
+ uploadTray: "bill-pay-upload-tray",
5
+ detailsSheet: "bill-pay-details-sheet"
6
+ };
7
7
  //#endregion
8
- export { e as billPayUploadQueueKey };
8
+ export { e as billsTabTestIds };
@@ -1,9 +1,80 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { formatCalendarDate as e } from "../../../shared/util/dist/lib/formatCalendarDate.js";
6
+ import { formatMoneyExact as t } from "../../../shared/util/dist/lib/formatMoneyExact.js";
7
+ import { resolveVendorName as n } from "./index3.js";
8
+ import { usePayablesQuery as r, usePayablesTotalCountQuery as i } from "../../data-access/dist/index13.js";
9
+ import "../../data-access/dist/index.js";
10
+ import { derivePayableStatus as a } from "./index20.js";
11
+ import { DEFAULT_BILL_QUEUE as o, billQueueHasScheduledPayment as s, billQueueStatuses as c, billSortField as l } from "./index50.js";
12
+ import { useCallback as u, useEffect as d, useMemo as f, useState as p } from "react";
1
13
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js
2
- var e = {
3
- uploadingSummary: (e) => `Uploading and scanning ${e} ${e === 1 ? "file" : "files"}`,
4
- completeSummary: (e) => `${e} ${e === 1 ? "upload" : "uploads"} complete`,
5
- readyCaption: (e) => `${e} new ${e === 1 ? "bill" : "bills"} ready`,
6
- failedCaption: (e) => `${e} failed to upload`
7
- };
14
+ var m = 10, h = [{
15
+ id: "addedOnLabel",
16
+ desc: !0
17
+ }];
18
+ function g({ enabled: g = !0, onOpenBill: _ }) {
19
+ let [v, y] = p(o), [b, x] = p(h), [S, C] = p(m), [w, T] = p(), [E, D] = p(""), [O, k] = p(""), A = u(() => T(void 0), []);
20
+ d(() => {
21
+ let e = setTimeout(() => {
22
+ k(E), A();
23
+ }, 300);
24
+ return () => clearTimeout(e);
25
+ }, [E, A]);
26
+ let j = b[0], M = l(j?.id), N = r({
27
+ limit: S,
28
+ pagination_token: w,
29
+ status__in: c(v),
30
+ has_scheduled_payment: s(v),
31
+ counterpart_name__icontains: O || void 0,
32
+ sort: M,
33
+ order: M ? j?.desc ? "desc" : "asc" : void 0,
34
+ enabled: g
35
+ }), P = N.data?.data.length === 0, F = i({ enabled: g && P }), I = !P || (F.data?.count ?? 1) > 0, L = f(() => (N.data?.data ?? []).map((r) => {
36
+ let i = a({
37
+ apiStatus: r.status,
38
+ dueDate: r.due_date,
39
+ scheduledPaymentDate: r.scheduled_payment_date
40
+ }), o = r.amount_due ?? r.total_amount;
41
+ return {
42
+ vendorLabel: n(r),
43
+ dueDateLabel: e(r.due_date),
44
+ amountDueLabel: o == null ? "" : t(o / 100, { currencyCode: r.currency ?? "USD" }),
45
+ status: i.status,
46
+ statusTone: i.tone,
47
+ addedOnLabel: e(r.created_at?.slice(0, 10)),
48
+ onOpen: () => _(r.id, i.status === "draft")
49
+ };
50
+ }), [N.data?.data, _]), R = u((e) => {
51
+ y(e), A();
52
+ }, [A]), z = u((e) => {
53
+ x((t) => typeof e == "function" ? e(t) : e), A();
54
+ }, [A]), B = u((e) => {
55
+ C(e), A();
56
+ }, [A]), V = u(() => T(N.data?.next_pagination_token), [N.data?.next_pagination_token]), H = u(() => T(N.data?.prev_pagination_token), [N.data?.prev_pagination_token]), U = u(() => {
57
+ N.refetch();
58
+ }, [N.refetch]);
59
+ return {
60
+ rows: L,
61
+ isLoading: N.isLoading || P && F.isLoading,
62
+ isError: N.isError,
63
+ onRetry: U,
64
+ selectedFilterTabId: v,
65
+ onFilterTabChange: R,
66
+ searchValue: E,
67
+ onSearchChange: D,
68
+ hasAnyBills: I,
69
+ sorting: b,
70
+ onSortingChange: z,
71
+ pageSize: S,
72
+ onPageSizeChange: B,
73
+ hasNextPage: !!N.data?.next_pagination_token,
74
+ hasPrevPage: !!N.data?.prev_pagination_token,
75
+ onNextPage: V,
76
+ onPrevPage: H
77
+ };
78
+ }
8
79
  //#endregion
9
- export { e as BILL_UPLOAD_QUEUE_LABELS_EN };
80
+ export { g as useBillsTable };