@tesouro/embedded-components-react 0.2.292 → 0.2.294

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 (36) hide show
  1. package/dist/index.css +3 -0
  2. package/dist/index.js +1 -1
  3. package/dist/lib/BillPayWidget.js +1 -1
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index.js +3 -3
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index10.js +28 -18
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +4 -2
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +33 -8
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +9 -9
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +15 -5
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +6 -134
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +74 -3
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +141 -6
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +5 -9
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +6 -83
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +9 -3
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +83 -6
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +2 -113
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +8 -1
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +105 -16
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +1 -0
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +25 -0
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index31.js +7 -4
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index36.js +24 -13
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index38.js +144 -97
  25. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index3.js +1 -0
  26. package/dist/libs/tesouro-embedded-components-react/gl-code-table-widget/ui/dist/index3.js +1 -0
  27. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index16.js +5 -0
  28. package/dist/libs/tesouro-embedded-components-react/products-widget/ui/dist/index4.js +1 -0
  29. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +16 -16
  30. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +131 -120
  31. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +75 -67
  32. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  33. package/dist/libs/tesouro-embedded-components-react/tags-widget/ui/dist/index3.js +2 -0
  34. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index7.js +1 -1
  35. package/dist/packages/shared-ui-shadcn/dist/index.js +3654 -3614
  36. package/package.json +1 -1
package/dist/index.css CHANGED
@@ -1403,6 +1403,9 @@
1403
1403
  .ttw\:min-w-26 {
1404
1404
  min-width: calc(var(--ttw-spacing) * 26);
1405
1405
  }
1406
+ .ttw\:min-w-28 {
1407
+ min-width: calc(var(--ttw-spacing) * 28);
1408
+ }
1406
1409
  .ttw\:min-w-29 {
1407
1410
  min-width: calc(var(--ttw-spacing) * 29);
1408
1411
  }
package/dist/index.js CHANGED
@@ -16,7 +16,7 @@ import "./lib/AcceptDisclosuresWidget.js";
16
16
  import { BankAccountsWidget as C } from "./libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/index8.js";
17
17
  import "./lib/BankAccountsWidget.js";
18
18
  import { CounterpartsWidget as w } from "./libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/index8.js";
19
- import { BillPayWidget as T } from "./libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js";
19
+ import { BillPayWidget as T } from "./libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js";
20
20
  import "./lib/BillPayWidget.js";
21
21
  import { CardDetailsWidget as E } from "./libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index6.js";
22
22
  import { CardFormatValue as D } from "./libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index3.js";
@@ -1,3 +1,3 @@
1
- import { BillPayWidget as e } from "../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js";
1
+ import { BillPayWidget as e } from "../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js";
2
2
  import "../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js";
3
3
  export { e as BillPayWidget };
@@ -5,6 +5,6 @@ import "./index5.js";
5
5
  import { useAllPayableLineItemsQuery as t, useReplacePayableLineItemsMutation as n } from "./index6.js";
6
6
  import { useAttachPayableFileMutation as r, useCreatePayableMutation as i, useDeletePayableFileMutation as a, useSubmitPayableForApprovalMutation as o, useUpdatePayableMutation as s, useUploadPayableFromFileMutation as c, useValidatePayableMutation as l } from "./index7.js";
7
7
  import { usePayableOcrQueries as u } from "./index9.js";
8
- import { usePayableQuery as d, usePayablesQuery as f } from "./index10.js";
9
- import { usePayableSuggestionsQuery as p } from "./index11.js";
10
- export { t as useAllPayableLineItemsQuery, r as useAttachPayableFileMutation, i as useCreatePayableMutation, a as useDeletePayableFileMutation, e as useEmbedApi, u as usePayableOcrQueries, d as usePayableQuery, p as usePayableSuggestionsQuery, f as usePayablesQuery, n as useReplacePayableLineItemsMutation, o as useSubmitPayableForApprovalMutation, s as useUpdatePayableMutation, c as useUploadPayableFromFileMutation, l as useValidatePayableMutation };
8
+ import { usePayableQuery as d, usePayablesQuery as f, usePayablesTotalCountQuery as p } from "./index10.js";
9
+ import { usePayableSuggestionsQuery as m } from "./index11.js";
10
+ export { t as useAllPayableLineItemsQuery, r as useAttachPayableFileMutation, i as useCreatePayableMutation, a as useDeletePayableFileMutation, e as useEmbedApi, u as usePayableOcrQueries, d as usePayableQuery, m as usePayableSuggestionsQuery, f as usePayablesQuery, p as usePayablesTotalCountQuery, n as useReplacePayableLineItemsMutation, o as useSubmitPayableForApprovalMutation, s as useUpdatePayableMutation, c as useUploadPayableFromFileMutation, l as useValidatePayableMutation };
@@ -4,37 +4,47 @@
4
4
  "use client";
5
5
  import { useEmbedApi as e } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
6
6
  import { organizationHeaders as t } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
7
- import { getPayablesIdOptions as n, getPayablesOptions as r } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
8
- import { withAuthEpoch as i } from "../../../shared/data-access/dist/lib/withAuthEpoch.js";
7
+ import { getPayablesAnalyticsOptions as n, getPayablesIdOptions as r, getPayablesOptions as i } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
8
+ import { withAuthEpoch as a } from "../../../shared/data-access/dist/lib/withAuthEpoch.js";
9
9
  import "../../../shared/data-access/dist/index.js";
10
- import { payableOcrQueryOptions as a } from "./index8.js";
11
- import { useQuery as o } from "@tanstack/react-query";
10
+ import { payableOcrQueryOptions as o } from "./index8.js";
11
+ import { useQuery as s } from "@tanstack/react-query";
12
12
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index10.js
13
- function s({ enabled: n, ...a } = {}) {
14
- let { client: s, organizationId: c, widgetToken: l, authEpoch: u } = e(), d = !!(c && l) && (n === !0 || n === void 0), f = r({
15
- client: s,
13
+ function c({ enabled: n, ...r } = {}) {
14
+ let { client: o, organizationId: c, widgetToken: l, authEpoch: u } = e(), d = !!(c && l) && (n === !0 || n === void 0), f = i({
15
+ client: o,
16
16
  headers: t(c),
17
- query: a
17
+ query: r
18
18
  });
19
- return o({
20
- ...i(f, u),
19
+ return s({
20
+ ...a(f, u),
21
21
  enabled: d
22
22
  });
23
23
  }
24
- function c(r, { enabled: s = !0, pollWhileOcrProcessing: c = !1 } = {}) {
25
- let { client: l, organizationId: u, widgetToken: d, authEpoch: f } = e(), p = !!(u && d && r) && s, m = c ? a({
24
+ function l({ enabled: r } = {}) {
25
+ let { client: i, organizationId: o, widgetToken: c, authEpoch: l } = e(), u = !!(o && c) && (r === !0 || r === void 0), d = n({
26
+ client: i,
27
+ headers: t(o)
28
+ });
29
+ return s({
30
+ ...a(d, l),
31
+ enabled: u
32
+ });
33
+ }
34
+ function u(n, { enabled: i = !0, pollWhileOcrProcessing: c = !1 } = {}) {
35
+ let { client: l, organizationId: u, widgetToken: d, authEpoch: f } = e(), p = !!(u && d && n) && i, m = c ? o({
26
36
  client: l,
27
37
  organizationId: u,
28
- payableId: r ?? ""
29
- }) : n({
38
+ payableId: n ?? ""
39
+ }) : r({
30
40
  client: l,
31
41
  headers: t(u),
32
- path: { payable_id: r ?? "" }
42
+ path: { payable_id: n ?? "" }
33
43
  });
34
- return o({
35
- ...i(m, f),
44
+ return s({
45
+ ...a(m, f),
36
46
  enabled: p
37
47
  });
38
48
  }
39
49
  //#endregion
40
- export { c as usePayableQuery, s as usePayablesQuery };
50
+ export { u as usePayableQuery, c as usePayablesQuery, l as usePayablesTotalCountQuery };
@@ -8,7 +8,7 @@ import "./index15.js";
8
8
  import "./index16.js";
9
9
  import "./index17.js";
10
10
  import "./index18.js";
11
- import "./index23.js";
11
+ import "./index22.js";
12
12
  import "./index24.js";
13
13
  import "./index25.js";
14
14
  import "./index26.js";
@@ -16,5 +16,7 @@ import "./index27.js";
16
16
  import "./index28.js";
17
17
  import "./index29.js";
18
18
  import "./index30.js";
19
- import { BillPayWidget as e } from "./index34.js";
19
+ import "./index31.js";
20
+ import "./index32.js";
21
+ import { BillPayWidget as e } from "./index36.js";
20
22
  export { e as BillPayWidget };
@@ -1,11 +1,36 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.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
- }
2
+ var e = {
3
+ Drafts: "drafts",
4
+ Pending: "pending",
5
+ Paid: "paid",
6
+ All: "all"
7
+ }, t = {
8
+ [e.Drafts]: ["draft"],
9
+ [e.Pending]: [
10
+ "new",
11
+ "approve_in_progress",
12
+ "waiting_to_be_paid",
13
+ "partially_paid"
14
+ ],
15
+ [e.Paid]: ["paid"],
16
+ [e.All]: void 0
17
+ }, n = e.Drafts, r = [
18
+ e.Drafts,
19
+ e.Pending,
20
+ e.Paid,
21
+ e.All
22
+ ];
23
+ function i(e) {
24
+ let n = t[e];
25
+ return n ? [...n] : void 0;
26
+ }
27
+ var a = {
28
+ vendorLabel: "counterpart_name",
29
+ dueDateLabel: "due_date",
30
+ addedOnLabel: "created_at"
31
+ };
32
+ function o(e) {
33
+ if (e) return a[e];
9
34
  }
10
35
  //#endregion
11
- export { e as copyTextToClipboard };
36
+ export { r as BILL_QUEUE_ORDER, t as BILL_QUEUE_STATUSES, a as BILL_SORT_FIELDS, e as BillQueue, n as DEFAULT_BILL_QUEUE, i as billQueueStatuses, o as billSortField };
@@ -1,11 +1,11 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js
2
- var e = {
3
- emptyHeading: "Add your first bill",
4
- nonEmptyHeading: "Add a bill",
5
- createButton: "Add bill",
6
- viewBillTitle: "Bill details",
7
- emailCopiedToast: "Email address copied to clipboard",
8
- emailCopyFailedToast: "Could not copy the email address"
9
- };
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
+ }
10
10
  //#endregion
11
- export { e as BILLS_TAB_LABELS_EN };
11
+ export { e as copyTextToClipboard };
@@ -1,8 +1,18 @@
1
+ import { BillQueue as e } from "./index22.js";
1
2
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js
2
- var e = {
3
- root: "bill-pay-bills-tab",
4
- uploadTray: "bill-pay-upload-tray",
5
- detailsSheet: "bill-pay-details-sheet"
3
+ var t = {
4
+ [e.Drafts]: "Drafts",
5
+ [e.Pending]: "Pending",
6
+ [e.Paid]: "Paid",
7
+ [e.All]: "All bills"
8
+ }, n = {
9
+ emptyHeading: "Add your first bill",
10
+ nonEmptyHeading: "Add a bill",
11
+ createButton: "Add bill",
12
+ viewBillTitle: "Bill details",
13
+ emailCopiedToast: "Email address copied to clipboard",
14
+ emailCopyFailedToast: "Could not copy the email address",
15
+ queues: t
6
16
  };
7
17
  //#endregion
8
- export { e as billsTabTestIds };
18
+ export { n as BILLS_TAB_LABELS_EN, t as BILL_QUEUE_LABELS_EN };
@@ -1,136 +1,8 @@
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 { formatCalendarDate as r } from "../../../shared/util/dist/lib/formatCalendarDate.js";
11
- import { formatMoneyExact as ee } from "../../../shared/util/dist/lib/formatMoneyExact.js";
12
- import { useWidgetConfig as i } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
13
- import "../../../shared/feature/dist/index.js";
14
- import { usePayablesQuery as a } from "../../data-access/dist/index10.js";
15
- import "../../data-access/dist/index.js";
16
- import { AddBillDialog as te } from "../../ui/dist/index10.js";
17
- import { BillsScreen as ne } from "../../ui/dist/index38.js";
18
- import "../../ui/dist/index.js";
19
- import { BillCreateDialog as o } from "./index12.js";
20
- import "./index13.js";
21
- import { derivePayableStatus as s } from "./index15.js";
22
- import { BillDetailsContainer as c } from "./index17.js";
23
- import "./index18.js";
24
- import { BILLS_TAB_LABELS_EN as l } from "./index23.js";
25
- import { billsTabTestIds as u } from "./index24.js";
26
- import { copyTextToClipboard as d } from "./index22.js";
27
- import { useEffect as re, useState as f } from "react";
28
- import { jsx as p, jsxs as m } from "react/jsx-runtime";
29
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js
30
- var ie = 10, h = "bills@business-banking.app", g = {
31
- vendorLabel: "counterpart_name",
32
- dueDateLabel: "due_date",
33
- amountLabel: "amount",
34
- status: "status"
35
- }, _ = "created_at", v = "desc";
36
- function y({ labels: y, onEnqueueFiles: b, openPayableId: x, onOpenPayableHandled: S }) {
37
- let C = {
38
- ...l,
39
- ...y
40
- }, [w, T] = f(!1), [ae, E] = f(), [D, O] = f(!1), [k, A] = f(), [j, M] = f(!1), [N, P] = f(!1), [F, I] = f([]), [L, R] = f(ie), [z, B] = f(), { initResponse: V } = i(), H = t(V?.scopes, [n.PayableReadOrg]), U = t(V?.scopes, [n.PayableWriteOrg]), W = !V || H, G = !V || U, [K] = F, q = K ? g[K.id] : void 0, J = a({
41
- limit: L,
42
- pagination_token: z,
43
- sort: q ?? _,
44
- order: q ? K.desc ? "desc" : "asc" : v,
45
- enabled: W
46
- }), Y = () => B(void 0), oe = (e) => {
47
- I(e), Y();
48
- }, se = (e) => {
49
- R(e), Y();
50
- }, X = (J.data?.data ?? []).map((e) => {
51
- let t = s(e.status, e.due_date);
52
- return {
53
- vendorLabel: e.counterpart_raw_data?.name ?? "",
54
- dueDateLabel: r(e.due_date),
55
- amountLabel: ee((e.total_amount ?? 0) / 100, { currencyCode: e.currency ?? "USD" }),
56
- status: t.status,
57
- statusTone: t.tone,
58
- onOpen: () => {
59
- if (e.status === "draft" && G) {
60
- E(e.id), O(!0);
61
- return;
62
- }
63
- A(e.id), M(!0);
64
- }
65
- };
66
- }), ce = () => {
67
- M(!1), P(!0);
68
- }, Z = () => {
69
- T(!1), E(void 0), O(!0);
70
- }, Q = (e) => {
71
- T(!1), b?.(e);
72
- }, $ = async () => {
73
- await d(h) ? e.success(C.emailCopiedToast) : e.error(C.emailCopyFailedToast);
74
- };
75
- return re(() => {
76
- x && (E(x), O(!0), S?.());
77
- }, [S, x]), /* @__PURE__ */ m("div", {
78
- "data-testid": u.root,
79
- children: [
80
- /* @__PURE__ */ p(ne, {
81
- rows: X,
82
- isLoading: J.isLoading || !V,
83
- isError: J.isError,
84
- onRetry: () => J.refetch(),
85
- sorting: F,
86
- onSortingChange: oe,
87
- pageSize: L,
88
- onPageSizeChange: se,
89
- hasNextPage: !!J.data?.next_pagination_token,
90
- hasPrevPage: !!J.data?.prev_pagination_token,
91
- onNextPage: () => B(J.data?.next_pagination_token),
92
- onPrevPage: () => B(J.data?.prev_pagination_token),
93
- onCreateClick: G ? () => T(!0) : void 0,
94
- onEnterManually: G ? Z : void 0,
95
- onFilesSelected: G ? Q : void 0,
96
- emailAddress: h,
97
- onCopyEmail: $,
98
- labels: {
99
- createButton: C.createButton,
100
- addBill: { heading: C.emptyHeading }
101
- }
102
- }),
103
- G ? /* @__PURE__ */ p(te, {
104
- open: w,
105
- onOpenChange: T,
106
- onFilesSelected: Q,
107
- onEnterManually: Z,
108
- emailAddress: h,
109
- onCopyEmail: $,
110
- labels: { heading: X.length ? C.nonEmptyHeading : C.emptyHeading }
111
- }) : null,
112
- D ? /* @__PURE__ */ p(o, {
113
- open: D,
114
- onOpenChange: O,
115
- payableId: ae
116
- }) : null,
117
- j ? /* @__PURE__ */ p(c, {
118
- open: j,
119
- onOpenChange: M,
120
- payableId: k,
121
- onClose: () => M(!1),
122
- onExpand: ce,
123
- testId: u.detailsSheet
124
- }) : null,
125
- N ? /* @__PURE__ */ p(o, {
126
- open: N,
127
- onOpenChange: P,
128
- payableId: k,
129
- readOnly: !0,
130
- copy: { readOnlyTitle: C.viewBillTitle }
131
- }) : null
132
- ]
133
- });
134
- }
2
+ var e = {
3
+ root: "bill-pay-bills-tab",
4
+ uploadTray: "bill-pay-upload-tray",
5
+ detailsSheet: "bill-pay-details-sheet"
6
+ };
135
7
  //#endregion
136
- export { y as BillsTab, y as default };
8
+ export { e as billsTabTestIds };
@@ -1,3 +1,74 @@
1
- import "./index23.js";
2
- import "./index24.js";
3
- import "./index25.js";
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 { usePayablesQuery as n, usePayablesTotalCountQuery as r } from "../../data-access/dist/index10.js";
8
+ import "../../data-access/dist/index.js";
9
+ import { derivePayableStatus as i } from "./index15.js";
10
+ import { DEFAULT_BILL_QUEUE as a, billQueueStatuses as o, billSortField as s } from "./index22.js";
11
+ import { useCallback as c, useEffect as l, useMemo as u, useState as d } from "react";
12
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js
13
+ var f = 10, p = [{
14
+ id: "addedOnLabel",
15
+ desc: !0
16
+ }];
17
+ function m({ enabled: m = !0, onOpenBill: h }) {
18
+ let [g, _] = d(a), [v, y] = d(p), [b, x] = d(f), [S, C] = d(), [w, T] = d(""), [E, D] = d(""), O = c(() => C(void 0), []);
19
+ l(() => {
20
+ let e = setTimeout(() => {
21
+ D(w), O();
22
+ }, 300);
23
+ return () => clearTimeout(e);
24
+ }, [w, O]);
25
+ let k = v[0], A = s(k?.id), j = n({
26
+ limit: b,
27
+ pagination_token: S,
28
+ status__in: o(g),
29
+ counterpart_name__icontains: E || void 0,
30
+ sort: A,
31
+ order: A ? k?.desc ? "desc" : "asc" : void 0,
32
+ enabled: m
33
+ }), M = j.data?.data.length === 0, N = r({ enabled: m && M }), P = !M || (N.data?.count ?? 1) > 0, F = u(() => (j.data?.data ?? []).map((n) => {
34
+ let r = i(n.status, n.due_date);
35
+ return {
36
+ vendorLabel: n.counterpart_raw_data?.name ?? "",
37
+ dueDateLabel: e(n.due_date),
38
+ amountDueLabel: t((n.amount_due ?? n.total_amount ?? 0) / 100, { currencyCode: n.currency ?? "USD" }),
39
+ status: r.status,
40
+ statusTone: r.tone,
41
+ addedOnLabel: e(n.created_at?.slice(0, 10)),
42
+ onOpen: () => h(n.id, r.status === "draft")
43
+ };
44
+ }), [j.data?.data, h]), I = c((e) => {
45
+ _(e), O();
46
+ }, [O]), L = c((e) => {
47
+ y((t) => typeof e == "function" ? e(t) : e), O();
48
+ }, [O]), R = c((e) => {
49
+ x(e), O();
50
+ }, [O]), z = c(() => C(j.data?.next_pagination_token), [j.data?.next_pagination_token]), B = c(() => C(j.data?.prev_pagination_token), [j.data?.prev_pagination_token]), V = c(() => {
51
+ j.refetch();
52
+ }, [j.refetch]);
53
+ return {
54
+ rows: F,
55
+ isLoading: j.isLoading || M && N.isLoading,
56
+ isError: j.isError,
57
+ onRetry: V,
58
+ selectedFilterTabId: g,
59
+ onFilterTabChange: I,
60
+ searchValue: w,
61
+ onSearchChange: T,
62
+ hasAnyBills: P,
63
+ sorting: v,
64
+ onSortingChange: L,
65
+ pageSize: b,
66
+ onPageSizeChange: R,
67
+ hasNextPage: !!j.data?.next_pagination_token,
68
+ hasPrevPage: !!j.data?.prev_pagination_token,
69
+ onNextPage: z,
70
+ onPrevPage: B
71
+ };
72
+ }
73
+ //#endregion
74
+ export { m as useBillsTable };
@@ -1,8 +1,143 @@
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/index38.js";
14
+ import "../../ui/dist/index.js";
15
+ import { BillCreateDialog as o } from "./index12.js";
16
+ import "./index13.js";
17
+ import { BillDetailsContainer as s } from "./index17.js";
18
+ import "./index18.js";
19
+ import { BILL_QUEUE_ORDER as c, BillQueue as l } from "./index22.js";
20
+ import { BILLS_TAB_LABELS_EN as u } from "./index24.js";
21
+ import { billsTabTestIds as d } from "./index25.js";
22
+ import { useBillsTable as f } from "./index26.js";
23
+ import { copyTextToClipboard as p } from "./index23.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 { CheckIcon as b, FilePenIcon as x, ListIcon as S, LoaderCircleIcon as C } from "lucide-react";
1
27
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js
2
- var e = (e) => [
3
- "bill-pay",
4
- "upload-queue",
5
- e ?? ""
6
- ];
28
+ var w = "bills@business-banking.app", T = {
29
+ [l.Drafts]: /* @__PURE__ */ v(x, {
30
+ className: "ttw:size-4",
31
+ "aria-hidden": !0
32
+ }),
33
+ [l.Pending]: /* @__PURE__ */ v(C, {
34
+ className: "ttw:size-4",
35
+ "aria-hidden": !0
36
+ }),
37
+ [l.Paid]: /* @__PURE__ */ v(b, {
38
+ className: "ttw:size-4",
39
+ "aria-hidden": !0
40
+ }),
41
+ [l.All]: /* @__PURE__ */ v(S, {
42
+ className: "ttw:size-4",
43
+ "aria-hidden": !0
44
+ })
45
+ };
46
+ function E({ labels: l, onEnqueueFiles: b, openPayableId: x, onOpenPayableHandled: S }) {
47
+ let C = g(() => ({
48
+ ...u,
49
+ ...l,
50
+ queues: {
51
+ ...u.queues,
52
+ ...l?.queues
53
+ }
54
+ }), [l]), [E, D] = _(!1), [O, k] = _(), [A, j] = _(!1), [M, N] = _(), [P, F] = _(!1), [I, L] = _(!1), { initResponse: R } = r(), z = t(R?.scopes, [n.PayableReadOrg]), B = t(R?.scopes, [n.PayableWriteOrg]), V = !R || z, H = !R || B, U = m((e, t) => {
55
+ if (t && H) {
56
+ k(e), j(!0);
57
+ return;
58
+ }
59
+ N(e), F(!0);
60
+ }, [H]), W = f({
61
+ enabled: V,
62
+ onOpenBill: U
63
+ }), G = g(() => c.map((e) => ({
64
+ id: e,
65
+ label: C.queues[e],
66
+ icon: T[e]
67
+ })), [C.queues]), K = () => {
68
+ F(!1), L(!0);
69
+ }, q = g(() => ({
70
+ createButton: C.createButton,
71
+ addBill: { heading: C.emptyHeading }
72
+ }), [C.createButton, C.emptyHeading]), J = () => {
73
+ D(!1), k(void 0), j(!0);
74
+ }, Y = (e) => {
75
+ D(!1), b?.(e);
76
+ }, X = async () => {
77
+ await p(w) ? e.success(C.emailCopiedToast) : e.error(C.emailCopyFailedToast);
78
+ };
79
+ return h(() => {
80
+ x && (k(x), j(!0), S?.());
81
+ }, [S, x]), /* @__PURE__ */ y("div", {
82
+ "data-testid": d.root,
83
+ children: [
84
+ /* @__PURE__ */ v(a, {
85
+ rows: W.rows,
86
+ isLoading: W.isLoading || !R,
87
+ isError: W.isError,
88
+ onRetry: W.onRetry,
89
+ sorting: W.sorting,
90
+ onSortingChange: W.onSortingChange,
91
+ pageSize: W.pageSize,
92
+ onPageSizeChange: W.onPageSizeChange,
93
+ hasNextPage: W.hasNextPage,
94
+ hasPrevPage: W.hasPrevPage,
95
+ onNextPage: W.onNextPage,
96
+ onPrevPage: W.onPrevPage,
97
+ filterTabs: G,
98
+ selectedFilterTabId: W.selectedFilterTabId,
99
+ onFilterTabChange: W.onFilterTabChange,
100
+ searchValue: W.searchValue,
101
+ onSearchChange: W.onSearchChange,
102
+ isFiltering: W.hasAnyBills,
103
+ onCreateClick: H ? () => D(!0) : void 0,
104
+ onEnterManually: H ? J : void 0,
105
+ onFilesSelected: H ? Y : void 0,
106
+ emailAddress: w,
107
+ onCopyEmail: X,
108
+ labels: q
109
+ }),
110
+ H ? /* @__PURE__ */ v(i, {
111
+ open: E,
112
+ onOpenChange: D,
113
+ onFilesSelected: Y,
114
+ onEnterManually: J,
115
+ emailAddress: w,
116
+ onCopyEmail: X,
117
+ labels: { heading: W.hasAnyBills ? C.nonEmptyHeading : C.emptyHeading }
118
+ }) : null,
119
+ A ? /* @__PURE__ */ v(o, {
120
+ open: A,
121
+ onOpenChange: j,
122
+ payableId: O
123
+ }) : null,
124
+ P ? /* @__PURE__ */ v(s, {
125
+ open: P,
126
+ onOpenChange: F,
127
+ payableId: M,
128
+ onClose: () => F(!1),
129
+ onExpand: K,
130
+ testId: d.detailsSheet
131
+ }) : null,
132
+ I ? /* @__PURE__ */ v(o, {
133
+ open: I,
134
+ onOpenChange: L,
135
+ payableId: M,
136
+ readOnly: !0,
137
+ copy: { readOnlyTitle: C.viewBillTitle }
138
+ }) : null
139
+ ]
140
+ });
141
+ }
7
142
  //#endregion
8
- export { e as billPayUploadQueueKey };
143
+ export { E as BillsTab, E as default };
@@ -1,9 +1,5 @@
1
- //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.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
- };
8
- //#endregion
9
- export { e as BILL_UPLOAD_QUEUE_LABELS_EN };
1
+ import "./index22.js";
2
+ import "./index24.js";
3
+ import "./index25.js";
4
+ import "./index26.js";
5
+ import "./index27.js";