@tesouro/embedded-components-react 0.2.281 → 0.2.283

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 (52) hide show
  1. package/dist/index.css +17 -6
  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/feature/dist/index.js +9 -5
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +42 -39
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +69 -54
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +21 -2
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +46 -41
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +81 -1
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +46 -47
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +3 -11
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +2 -8
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index2.js +5 -3
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +43 -5
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +1 -102
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +11 -3
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +9 -6
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +4 -5
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +127 -76
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +6 -6
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +7 -112
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +85 -1
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index3.js +16 -12
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +2 -24
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +8 -0
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +114 -0
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +1 -0
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +25 -0
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js +50 -49
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +1 -1
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +25 -12
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +86 -69
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +2 -1
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +7 -7
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index13.js +17 -16
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index16.js +1 -0
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index21.js +1 -1
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index22.js +89 -124
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index24.js +2 -1
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index25.js +31 -26
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index27.js +1 -1
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index28.js +80 -77
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index36.js +20 -4
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index37.js +228 -6
  45. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardsList.js +4 -4
  46. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardsListRow.js +13 -15
  47. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +6 -6
  48. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/reference-data/useLedgerAccountsQuery.js +53 -11
  49. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  50. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index5.js +1 -1
  51. package/dist/packages/shared-ui-shadcn/dist/index.js +3445 -3413
  52. package/package.json +1 -1
@@ -1,50 +1,49 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { useAllLedgerAccountsQuery as e } from "../../../shared/data-access/dist/lib/reference-data/useLedgerAccountsQuery.js";
6
+ import "../../../shared/data-access/dist/index.js";
7
+ import { useAllPayableLineItemsQuery as t } from "../../data-access/dist/index6.js";
8
+ import { usePayableQuery as n } from "../../data-access/dist/index10.js";
9
+ import "../../data-access/dist/index.js";
10
+ import { BillDetailsSheet as r } from "../../ui/dist/index37.js";
11
+ import "../../ui/dist/index.js";
12
+ import { BILL_DETAILS_LABELS_EN as i } from "./index14.js";
13
+ import { mapPayableToBillDetails as a } from "./index16.js";
14
+ import { useMemo as o } from "react";
15
+ import { jsx as s } from "react/jsx-runtime";
1
16
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js
2
- var e = /* @__PURE__ */ new Set([
3
- "new",
4
- "approve_in_progress",
5
- "waiting_to_be_paid",
6
- "partially_paid"
7
- ]);
8
- function t(e, t) {
9
- let n = /* @__PURE__ */ new Date(`${e.slice(0, 10)}T00:00:00Z`), r = Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate());
10
- return n.getTime() < r;
11
- }
12
- function n(n, r, i = /* @__PURE__ */ new Date()) {
13
- if (e.has(n) && r && t(r, i)) return {
14
- status: "overdue",
15
- tone: "danger"
16
- };
17
- switch (n) {
18
- case "draft": return {
19
- status: "draft",
20
- tone: "neutral"
21
- };
22
- case "new":
23
- case "approve_in_progress": return {
24
- status: "pending_approval",
25
- tone: "warning"
26
- };
27
- case "waiting_to_be_paid": return {
28
- status: "ready_to_pay",
29
- tone: "info"
30
- };
31
- case "partially_paid": return {
32
- status: "partially_paid",
33
- tone: "success"
34
- };
35
- case "paid": return {
36
- status: "paid",
37
- tone: "success"
38
- };
39
- case "canceled": return {
40
- status: "canceled",
41
- tone: "neutral"
42
- };
43
- case "rejected": return {
44
- status: "rejected",
45
- tone: "danger"
46
- };
47
- }
17
+ function c({ open: c, onOpenChange: l, payableId: u, onClose: d, onExpand: f, testId: p, labels: m }) {
18
+ let h = o(() => ({
19
+ ...i,
20
+ ...m,
21
+ sheet: {
22
+ ...i.sheet,
23
+ ...m?.sheet
24
+ }
25
+ }), [m]), g = n(u), _ = t(u), v = e(), y = g.data, b = o(() => y ? a({
26
+ payable: y,
27
+ lineItems: _.lineItems,
28
+ ledgerAccounts: v.data?.data ?? [],
29
+ labels: h
30
+ }) : void 0, [
31
+ y,
32
+ _.lineItems,
33
+ v.data,
34
+ h
35
+ ]), x = g.isLoading || _.isResolving || v.isResolving, S = g.isError || _.isError || v.isError;
36
+ return /* @__PURE__ */ s(r, {
37
+ open: c,
38
+ onOpenChange: l,
39
+ details: b,
40
+ isLoading: x,
41
+ isError: S,
42
+ onClose: d,
43
+ onExpand: f,
44
+ testId: p,
45
+ labels: h.sheet
46
+ });
48
47
  }
49
48
  //#endregion
50
- export { n as derivePayableStatus };
49
+ export { c as BillDetailsContainer, c as default };
@@ -1,11 +1,3 @@
1
- //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.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
- }
10
- //#endregion
11
- export { e as copyTextToClipboard };
1
+ import "./index14.js";
2
+ import "./index16.js";
3
+ import "./index17.js";
@@ -1,10 +1,4 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js
2
- var e = {
3
- emptyHeading: "Add your first bill",
4
- nonEmptyHeading: "Add a bill",
5
- createButton: "Add bill",
6
- emailCopiedToast: "Email address copied to clipboard",
7
- emailCopyFailedToast: "Could not copy the email address"
8
- };
2
+ var e = { Mounted: "bill_pay_widget.mounted" }, t = "bill_pay_widget";
9
3
  //#endregion
10
- export { e as BILLS_TAB_LABELS_EN };
4
+ export { e as BillPayWidgetAnalyticsEvent, t as WIDGET_NAME };
@@ -7,10 +7,10 @@ var e = {
7
7
  finalizeFailed: "We could not submit this bill. Try again.",
8
8
  draftSaved: "Bill saved as a draft.",
9
9
  billFinalized: "Bill submitted for approval.",
10
- unreadableMoney: "Enter a number, like 285.00.",
10
+ unreadableMoney: "Enter a valid amount.",
11
11
  unusableQuantity: "Enter a quantity greater than 0.",
12
12
  lineItemsNeedAttention: "Check the highlighted line items before saving.",
13
- totalsNeedAttention: "Enter discount, tax, and total as numbers, like 285.00."
13
+ totalsNeedAttention: "Enter valid amounts for discount, tax, and total."
14
14
  }, t = {
15
15
  achMethod: "via ACH bank transfer",
16
16
  noMethod: "No payment method on file",
@@ -21,10 +21,12 @@ var e = {
21
21
  vendorDetailsFailed: "We could not load this vendor. Try again."
22
22
  }, n = {
23
23
  attachFailed: "We could not attach that file. Try again.",
24
- saveBeforeAttaching: "Save this bill before attaching a document."
24
+ saveBeforeAttaching: "Save this bill before attaching a document.",
25
+ noDocument: "No document attached to this bill."
25
26
  }, r = {
26
27
  newTitle: "New bill",
27
28
  extractedTitle: (e) => `Bill from ${e}`,
29
+ readOnlyTitle: "Bill details",
28
30
  discardConfirm: "Discard your changes to this bill?"
29
31
  }, i = {
30
32
  createTitle: "New vendor",
@@ -1,7 +1,45 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { useAnalyticsTrack as e } from "../../../shared/feature/dist/lib/analytics/hooks.js";
6
+ import "../../../shared/feature/dist/index.js";
7
+ import { BillPayWidgetAnalyticsEvent as t, WIDGET_NAME as n } from "./index19.js";
8
+ import { Payables as r } from "../../../monite-sdk/dist/index431.js";
9
+ import "../../../monite-sdk/dist/index.js";
10
+ import { MoniteRegionProvider as i } from "../../../shared/monite-wrapper/feature/dist/lib/MoniteRegionProvider.js";
11
+ import "../../../shared/monite-wrapper/feature/dist/index.js";
12
+ import { useEffect as a } from "react";
13
+ import { jsx as o } from "react/jsx-runtime";
1
14
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js
2
- var e = {
3
- root: "bill-pay-bills-tab",
4
- uploadTray: "bill-pay-upload-tray"
5
- };
15
+ var s = (e) => e;
16
+ function c(n) {
17
+ let i = e();
18
+ return a(() => {
19
+ i(t.Mounted);
20
+ }, [i]), /* @__PURE__ */ o(r, { ...n });
21
+ }
22
+ function l({ baseUrl: e, widgetToken: t, organizationId: r, configClient: a, gatewayRouting: l, linkComponent: u, implementation: d, uiFramework: f, errorFallback: p, onError: m, finopsThemeColors: h, analytics: g, disclosuresAcceptance: _, pageTitleComponent: v = s, ...y }) {
23
+ return /* @__PURE__ */ o(i, {
24
+ widgetName: n,
25
+ baseUrl: e,
26
+ widgetToken: t,
27
+ organizationId: r,
28
+ configClient: a,
29
+ gatewayRouting: l,
30
+ linkComponent: u,
31
+ implementation: d,
32
+ uiFramework: f,
33
+ errorFallback: p,
34
+ onError: m,
35
+ finopsThemeColors: h,
36
+ analytics: g,
37
+ disclosuresAcceptance: _,
38
+ children: /* @__PURE__ */ o(c, {
39
+ ...y,
40
+ pageTitleComponent: v
41
+ })
42
+ });
43
+ }
6
44
  //#endregion
7
- export { e as billsTabTestIds };
45
+ export { l as BillPayWidgetMonite, l as default };
@@ -1,102 +1 @@
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 i } from "../../../shared/util/dist/lib/formatMoneyExact.js";
12
- import { useWidgetConfig as a } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
13
- import "../../../shared/feature/dist/index.js";
14
- import { usePayablesQuery as o } from "../../data-access/dist/index10.js";
15
- import "../../data-access/dist/index.js";
16
- import { AddBillDialog as s } from "../../ui/dist/index10.js";
17
- import { BillsScreen as c } from "../../ui/dist/index38.js";
18
- import "../../ui/dist/index.js";
19
- import { BillCreateDialog as l } from "./index12.js";
20
- import "./index13.js";
21
- import { derivePayableStatus as u } from "./index17.js";
22
- import { BILLS_TAB_LABELS_EN as d } from "./index19.js";
23
- import { billsTabTestIds as f } from "./index20.js";
24
- import { copyTextToClipboard as p } from "./index18.js";
25
- import { useEffect as m, useState as h } from "react";
26
- import { jsx as g, jsxs as _ } from "react/jsx-runtime";
27
- //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js
28
- var v = 10, y = "bills@business-banking.app";
29
- function b({ labels: b, onEnqueueFiles: x, openPayableId: S, onOpenPayableHandled: C }) {
30
- let w = {
31
- ...d,
32
- ...b
33
- }, [T, E] = h(!1), [D, O] = h(), [k, A] = h(!1), [j, M] = h([]), [N, P] = h(v), [F, I] = h(), { initResponse: L } = a(), R = t(L?.scopes, [n.PayableReadOrg]), z = t(L?.scopes, [n.PayableWriteOrg]), B = !L || R, V = !L || z, H = o({
34
- limit: N,
35
- pagination_token: F,
36
- enabled: B
37
- }), U = (H.data?.data ?? []).map((e) => {
38
- let t = u(e.status, e.due_date);
39
- return {
40
- vendorLabel: e.counterpart_raw_data?.name ?? "",
41
- dueDateLabel: r(e.due_date),
42
- amountLabel: i((e.total_amount ?? 0) / 100, { currencyCode: e.currency ?? "USD" }),
43
- status: t.status,
44
- statusTone: t.tone,
45
- onOpen: () => {
46
- O(e.id), A(!0);
47
- }
48
- };
49
- }), W = () => {
50
- E(!1), O(void 0), A(!0);
51
- }, G = (e) => {
52
- E(!1), x?.(e);
53
- }, K = async () => {
54
- await p(y) ? e.success(w.emailCopiedToast) : e.error(w.emailCopyFailedToast);
55
- };
56
- return m(() => {
57
- S && (O(S), A(!0), C?.());
58
- }, [C, S]), /* @__PURE__ */ _("div", {
59
- "data-testid": f.root,
60
- children: [
61
- /* @__PURE__ */ g(c, {
62
- rows: U,
63
- isLoading: H.isLoading || !L,
64
- isError: H.isError,
65
- onRetry: () => H.refetch(),
66
- sorting: j,
67
- onSortingChange: M,
68
- pageSize: N,
69
- onPageSizeChange: P,
70
- hasNextPage: !!H.data?.next_pagination_token,
71
- hasPrevPage: !!H.data?.prev_pagination_token,
72
- onNextPage: () => I(H.data?.next_pagination_token),
73
- onPrevPage: () => I(H.data?.prev_pagination_token),
74
- onCreateClick: V ? () => E(!0) : void 0,
75
- onEnterManually: V ? W : void 0,
76
- onFilesSelected: V ? G : void 0,
77
- emailAddress: y,
78
- onCopyEmail: K,
79
- labels: {
80
- createButton: w.createButton,
81
- addBill: { heading: w.emptyHeading }
82
- }
83
- }),
84
- V ? /* @__PURE__ */ g(s, {
85
- open: T,
86
- onOpenChange: E,
87
- onFilesSelected: G,
88
- onEnterManually: W,
89
- emailAddress: y,
90
- onCopyEmail: K,
91
- labels: { heading: U.length ? w.nonEmptyHeading : w.emptyHeading }
92
- }) : null,
93
- k ? /* @__PURE__ */ g(l, {
94
- open: k,
95
- onOpenChange: A,
96
- payableId: D
97
- }) : null
98
- ]
99
- });
100
- }
101
- //#endregion
102
- export { b as BillsTab, b as default };
1
+ import "./index20.js";
@@ -1,3 +1,11 @@
1
- import "./index19.js";
2
- import "./index20.js";
3
- import "./index21.js";
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
+ }
9
+ }
10
+ //#endregion
11
+ export { e as copyTextToClipboard };
@@ -1,8 +1,11 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js
2
- var e = (e) => [
3
- "bill-pay",
4
- "upload-queue",
5
- e ?? ""
6
- ];
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
+ };
7
10
  //#endregion
8
- export { e as billPayUploadQueueKey };
11
+ export { e as BILLS_TAB_LABELS_EN };
@@ -1,9 +1,8 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js
2
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`
3
+ root: "bill-pay-bills-tab",
4
+ uploadTray: "bill-pay-upload-tray",
5
+ detailsSheet: "bill-pay-details-sheet"
7
6
  };
8
7
  //#endregion
9
- export { e as BILL_UPLOAD_QUEUE_LABELS_EN };
8
+ export { e as billsTabTestIds };
@@ -2,84 +2,135 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { useEmbedApi as e } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
6
- import { useUploadPayableFromFileMutation as t } from "../../data-access/dist/index7.js";
7
- import { usePayableOcrQueries as n } from "../../data-access/dist/index9.js";
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";
8
15
  import "../../data-access/dist/index.js";
9
- import { billPayUploadQueueKey as r } from "./index23.js";
10
- import { BILL_UPLOAD_QUEUE_LABELS_EN as i } from "./index24.js";
11
- import { useCallback as a, useEffect as o, useMemo as s, useState as c } from "react";
12
- import { useQuery as l, useQueryClient as u } from "@tanstack/react-query";
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";
13
29
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js
14
- function d({ onOpenBill: d, labels: f } = {}) {
15
- let p = {
16
- ...i,
17
- ...f
18
- }, { organizationId: m } = e(), h = u(), g = s(() => r(m), [m]), _ = t(), [v, y] = c(!1), { data: b = [] } = l({
19
- queryKey: g,
20
- queryFn: () => h.getQueryData(g) ?? [],
21
- staleTime: Infinity,
22
- gcTime: Infinity,
23
- initialData: []
24
- }), x = a((e, t) => {
25
- h.setQueryData(g, (n) => (n ?? []).map((n) => n.localId === e ? {
26
- ...n,
27
- ...t
28
- } : n));
29
- }, [h, g]), S = a((e) => {
30
- y(!1);
31
- for (let t of e) {
32
- let e = crypto.randomUUID();
33
- h.setQueryData(g, (n) => [...n ?? [], {
34
- localId: e,
35
- fileName: t.name,
36
- status: "uploading"
37
- }]), _.mutateAsync({ file: t }).then((t) => x(e, { payableId: t?.id })).catch(() => x(e, { status: "failed" }));
38
- }
39
- }, [
40
- x,
41
- h,
42
- g,
43
- _
44
- ]), C = n({ payableIds: b.filter((e) => e.status === "uploading" && e.payableId).map((e) => e.payableId) });
45
- o(() => {
46
- for (let { payableId: e, ocrStatus: t, isError: n } of C) {
47
- let r = b.find((t) => t.payableId === e && t.status === "uploading");
48
- r && (t === "success" ? x(r.localId, { status: "ready" }) : (n || t === "error" || t === "canceled") && x(r.localId, { status: "failed" }));
49
- }
50
- }, [
51
- b,
52
- C,
53
- x
54
- ]);
55
- let w = b.filter((e) => e.status === "uploading"), T = b.filter((e) => e.status === "ready"), E = b.filter((e) => e.status === "failed"), D = (e) => ({
56
- id: e.localId,
57
- fileName: e.fileName,
58
- status: e.status,
59
- onOpen: e.status === "ready" && e.payableId && d ? () => d(e.payableId) : void 0
60
- }), O = w.length ? [{
61
- id: "in-progress",
62
- items: b.map(D)
63
- }] : [...T.length ? [{
64
- id: "ready",
65
- caption: p.readyCaption(T.length),
66
- items: T.map(D)
67
- }] : [], ...E.length ? [{
68
- id: "failed",
69
- caption: p.failedCaption(E.length),
70
- items: E.map(D)
71
- }] : []], k = w.length ? p.uploadingSummary(b.length) : T.length ? p.completeSummary(T.length) : p.failedCaption(E.length), A = a(() => {
72
- h.setQueryData(g, []);
73
- }, [h, g]);
74
- return {
75
- enqueue: S,
76
- sections: O,
77
- summaryLabel: k,
78
- collapsed: v,
79
- onToggleCollapsed: a(() => y((e) => !e), []),
80
- onClose: A,
81
- isVisible: b.length > 0
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);
82
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
+ });
83
134
  }
84
135
  //#endregion
85
- export { d as useBillUploadQueue };
136
+ export { y as BillsTab, y as default };
@@ -1,8 +1,8 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js
2
- var e = {
3
- bills: "Bills",
4
- vendors: "Vendors",
5
- settings: "Settings"
6
- };
2
+ var e = (e) => [
3
+ "bill-pay",
4
+ "upload-queue",
5
+ e ?? ""
6
+ ];
7
7
  //#endregion
8
- export { e as DEFAULT_TABS_LABELS };
8
+ export { e as billPayUploadQueueKey };