@tesouro/embedded-components-react 0.2.337 → 0.2.338

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 (63) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/lib/BillPayWidget.js +1 -1
  3. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index.js +5 -5
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index10.js +103 -58
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index4.js +74 -37
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +8 -8
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +25 -20
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +64 -48
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +4 -3
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +40 -50
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +51 -5
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +5 -71
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +71 -48
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +46 -77
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +78 -33
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +33 -117
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +138 -67
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +63 -200
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +194 -184
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +180 -50
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +64 -12
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +12 -46
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +46 -30
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +26 -158
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +159 -31
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +32 -98
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +102 -11
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +13 -224
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +243 -4
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +4 -29
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +27 -80
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +76 -126
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +137 -3
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +3 -4
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +2 -43
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +45 -1
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +1 -8
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +6 -9
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +9 -92
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +94 -3
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +3 -9
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +7 -20
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +14 -51
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +59 -3
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +3 -110
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +107 -8
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +8 -40
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +40 -5
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +6 -98
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +91 -171
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +179 -4
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +5 -8
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +6 -113
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +115 -1
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +0 -24
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +25 -0
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index52.js +1 -0
  58. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +26 -26
  59. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/clientRegistry.js +11 -2
  60. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +94 -74
  61. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  62. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index7.js +1 -1
  63. package/package.json +1 -1
@@ -1,3 +1,137 @@
1
- import "./index40.js";
2
- import "./index41.js";
3
- import "./index42.js";
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 { resolveVendor as t } from "./index3.js";
8
+ import { BillDecisionDialog as n } from "../../ui/dist/index47.js";
9
+ import { BillDetailsSheet as r } from "../../ui/dist/index53.js";
10
+ import { BillDuplicateNotice as i } from "../../ui/dist/index57.js";
11
+ import "../../ui/dist/index.js";
12
+ import { useAllPayableLineItemsQuery as a } from "../../data-access/dist/index7.js";
13
+ import { usePayableQuery as o } from "../../data-access/dist/index13.js";
14
+ import "../../data-access/dist/index.js";
15
+ import { PayBillFlow as s } from "./index10.js";
16
+ import "./index11.js";
17
+ import { mergeDecisionDialogCopy as c } from "./index25.js";
18
+ import { useApprovalPolicyCardView as l } from "./index15.js";
19
+ import { useCurrentApprovalRequestId as u } from "./index16.js";
20
+ import { usePayableDetailActions as d } from "./index18.js";
21
+ import { useScheduledPayment as f } from "./index19.js";
22
+ import { BILL_DETAILS_LABELS_EN as p } from "./index41.js";
23
+ import { mapPayableToBillDetails as m } from "./index42.js";
24
+ import { useMemo as h, useRef as g } from "react";
25
+ import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
26
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js
27
+ function b(e) {
28
+ return !!(e?.bank_account?.account_holder_name && e.bank_account.routing_number && e.bank_account.account_number);
29
+ }
30
+ function x({ open: x, onOpenChange: S, payableId: C, onClose: w, onExpand: T, testId: E, labels: D, poweredByBankName: O, isPossibleDuplicate: k }) {
31
+ let A = h(() => ({
32
+ ...p,
33
+ ...D,
34
+ sheet: {
35
+ ...p.sheet,
36
+ ...D?.sheet,
37
+ statusBadge: {
38
+ ...p.sheet.statusBadge,
39
+ ...D?.sheet?.statusBadge
40
+ },
41
+ approvalPolicy: {
42
+ ...p.sheet.approvalPolicy,
43
+ ...D?.sheet?.approvalPolicy
44
+ }
45
+ },
46
+ decisionDialog: c(p.decisionDialog, D?.decisionDialog),
47
+ approvalPolicyCopy: {
48
+ ...p.approvalPolicyCopy,
49
+ ...D?.approvalPolicyCopy
50
+ }
51
+ }), [D]), j = o(C), M = a(C), N = e(), P = j.data, F = g(null), I = u({
52
+ payableId: C,
53
+ status: P?.status
54
+ }), L = l({
55
+ payableId: C,
56
+ approvalPolicyId: P?.approval_policy_id,
57
+ copy: A.approvalPolicyCopy
58
+ }), R = f({
59
+ payableId: C,
60
+ scheduledPaymentDate: P?.scheduled_payment_date
61
+ }), { actions: z, decisionDialog: B } = d({
62
+ payableId: P ? C : void 0,
63
+ status: P?.status,
64
+ currentApprovalRequestId: I.id,
65
+ isPolicyApprover: I.isPolicyApprover,
66
+ hasWaitingRequest: I.hasWaitingRequest,
67
+ hasScheduledPayment: R.hasScheduledPayment,
68
+ scheduledPaymentRecordId: R.scheduledPaymentRecordId,
69
+ isScheduledPaymentUnknown: R.isResolving,
70
+ labels: {
71
+ payBill: A.sheet.payButton,
72
+ markAsPaid: A.sheet.markAsPaidButton,
73
+ reject: A.sheet.rejectButton,
74
+ approve: A.sheet.approveButton,
75
+ cancel: A.sheet.cancelButton,
76
+ cancelScheduledPayment: A.sheet.cancelScheduledPaymentButton,
77
+ reopen: A.sheet.reopenButton,
78
+ forceApprove: A.sheet.forceApproveButton,
79
+ forceReject: A.sheet.forceRejectButton,
80
+ decisionDialog: A.decisionDialog,
81
+ actionError: A.actionError
82
+ },
83
+ onPayBillSelect: () => {
84
+ if (!b(t(P)) && T) {
85
+ T();
86
+ return;
87
+ }
88
+ F.current?.open();
89
+ }
90
+ }), V = R.hasScheduledPayment && R.scheduledDateLabel ? /* @__PURE__ */ v("p", {
91
+ className: "ttw:text-sm ttw:text-muted-foreground",
92
+ children: A.scheduledSummary(R.scheduledDateLabel)
93
+ }) : void 0, H = k ? /* @__PURE__ */ v(i, {}) : void 0, U = H || V ? /* @__PURE__ */ y(_, { children: [H, V] }) : void 0, W = h(() => P ? m({
94
+ payable: P,
95
+ lineItems: M.lineItems,
96
+ ledgerAccounts: N.data?.data ?? [],
97
+ labels: A,
98
+ hasScheduledPayment: R.hasScheduledPayment
99
+ }) : void 0, [
100
+ P,
101
+ M.lineItems,
102
+ N.data,
103
+ A,
104
+ R.hasScheduledPayment
105
+ ]), G = j.isLoading || M.isResolving || N.isResolving, K = j.isError || M.isError || N.isError;
106
+ return /* @__PURE__ */ y(_, { children: [
107
+ /* @__PURE__ */ v(r, {
108
+ open: x,
109
+ onOpenChange: S,
110
+ details: W,
111
+ actions: z,
112
+ approvalPolicy: L.view,
113
+ isLoading: G,
114
+ isError: K,
115
+ notice: U,
116
+ onClose: w,
117
+ onExpand: T,
118
+ testId: E,
119
+ labels: A.sheet
120
+ }),
121
+ /* @__PURE__ */ v(n, {
122
+ ...B,
123
+ labels: { cancelButton: A.decisionDialog.cancelButton },
124
+ testId: E ? `${E}-decision-dialog` : void 0,
125
+ confirmTestId: E ? `${E}-decision-confirm` : void 0,
126
+ reasonTestId: E ? `${E}-decision-reason` : void 0,
127
+ reasonFieldId: E ? `${E}-decision-reason-field` : void 0
128
+ }),
129
+ P ? /* @__PURE__ */ v(s, {
130
+ ref: F,
131
+ payable: P,
132
+ poweredByBankName: O
133
+ }) : null
134
+ ] });
135
+ }
136
+ //#endregion
137
+ export { x as BillDetailsContainer, x as default };
@@ -1,4 +1,3 @@
1
- //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js
2
- var e = { Mounted: "bill_pay_widget.mounted" }, t = "bill_pay_widget";
3
- //#endregion
4
- export { e as BillPayWidgetAnalyticsEvent, t as WIDGET_NAME };
1
+ import "./index41.js";
2
+ import "./index42.js";
3
+ import "./index43.js";
@@ -1,45 +1,4 @@
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 "./index44.js";
8
- import { Payables as r } from "../../../monite-sdk/dist/index438.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";
14
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js
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
- }
2
+ var e = { Mounted: "bill_pay_widget.mounted" }, t = "bill_pay_widget";
44
3
  //#endregion
45
- export { l as BillPayWidgetMonite, l as default };
4
+ export { e as BillPayWidgetAnalyticsEvent, t as WIDGET_NAME };
@@ -1 +1,45 @@
1
- import "./index45.js";
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 "./index45.js";
8
+ import { Payables as r } from "../../../monite-sdk/dist/index438.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";
14
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js
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
+ }
44
+ //#endregion
45
+ export { l as BillPayWidgetMonite, l as default };
@@ -1,8 +1 @@
1
- //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js
2
- var e = (e) => [
3
- "bill-pay",
4
- "upload-queue",
5
- e ?? ""
6
- ];
7
- //#endregion
8
- export { e as billPayUploadQueueKey };
1
+ import "./index46.js";
@@ -1,11 +1,8 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.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
- 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
- };
2
+ var e = (e) => [
3
+ "bill-pay",
4
+ "upload-queue",
5
+ e ?? ""
6
+ ];
10
7
  //#endregion
11
- export { e as BILL_UPLOAD_QUEUE_LABELS_EN };
8
+ export { e as billPayUploadQueueKey };
@@ -1,94 +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 { 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 "./index47.js";
12
- import { BILL_UPLOAD_QUEUE_LABELS_EN as a } from "./index48.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";
15
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js
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
- }
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
+ };
93
10
  //#endregion
94
- export { f as useBillUploadQueue };
11
+ export { e as BILL_UPLOAD_QUEUE_LABELS_EN };
@@ -1,3 +1,94 @@
1
- import "./index47.js";
2
- import "./index48.js";
3
- import "./index49.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 "./index48.js";
12
+ import { BILL_UPLOAD_QUEUE_LABELS_EN as a } from "./index49.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";
15
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js
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
+ }
93
+ //#endregion
94
+ export { f as useBillUploadQueue };
@@ -1,9 +1,3 @@
1
- //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js
2
- var e = {
3
- duplicateBadge: "Duplicate?",
4
- existingBadge: "Existing",
5
- selectRow: ({ vendorLabel: e, designation: t, invoiceNumberLabel: n, addedOnLabel: r }) => `Select bill — ${e}, ${t}, invoice ${n}, added ${r}`,
6
- openRow: ({ vendorLabel: e, designation: t, invoiceNumberLabel: n, addedOnLabel: r }) => `View bill — ${e}, ${t}, invoice ${n}, added ${r}`
7
- };
8
- //#endregion
9
- export { e as DUPLICATE_BILLS_LABELS_EN };
1
+ import "./index48.js";
2
+ import "./index49.js";
3
+ import "./index50.js";
@@ -1,22 +1,9 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { useCallback as e, useMemo as t, useState as n } from "react";
6
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js
7
- function r({ rowIds: r }) {
8
- let [i, a] = n([]), o = e((e) => {
9
- a((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
10
- }, []), s = t(() => r.filter((e) => i.includes(e)), [r, i]), c = r.length > 0 && s.length === r.length, l = e(() => {
11
- a(c ? [] : [...r]);
12
- }, [c, r]);
13
- return {
14
- selectedIds: s,
15
- isSelected: e((e) => i.includes(e), [i]),
16
- toggleRow: o,
17
- toggleAllRows: l,
18
- selectAllChecked: c ? !0 : s.length > 0 && "indeterminate"
19
- };
20
- }
2
+ var e = {
3
+ duplicateBadge: "Duplicate?",
4
+ existingBadge: "Existing",
5
+ selectRow: ({ vendorLabel: e, designation: t, invoiceNumberLabel: n, addedOnLabel: r }) => `Select bill — ${e}, ${t}, invoice ${n}, added ${r}`,
6
+ openRow: ({ vendorLabel: e, designation: t, invoiceNumberLabel: n, addedOnLabel: r }) => `View bill — ${e}, ${t}, invoice ${n}, added ${r}`
7
+ };
21
8
  //#endregion
22
- export { r as useDuplicateBillsSelection };
9
+ export { e as DUPLICATE_BILLS_LABELS_EN };
@@ -2,58 +2,21 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { DuplicateBillsDialog as e } from "../../ui/dist/index67.js";
6
- import "../../ui/dist/index.js";
7
- import { DUPLICATE_BILLS_LABELS_EN as t } from "./index51.js";
8
- import { useDuplicateBillsSelection as n } from "./index52.js";
9
- import { useMemo as r } from "react";
10
- import { jsx as i } from "react/jsx-runtime";
5
+ import { useCallback as e, useMemo as t, useState as n } from "react";
11
6
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js
12
- var a = [];
13
- function o({ open: o, onOpenChange: s, bills: c = a, canManageDuplicates: l = !0, onOpenBill: u, labels: d, dialogLabels: f }) {
14
- let p = r(() => ({
15
- ...t,
16
- ...d
17
- }), [d]), m = r(() => c.map((e) => e.id), [c]), { selectedIds: h, isSelected: g, toggleRow: _, toggleAllRows: v, selectAllChecked: y } = n({ rowIds: m }), b = r(() => c.map((e) => {
18
- let t = e.isPossibleDuplicate ? p.duplicateBadge : p.existingBadge, n = {
19
- vendorLabel: e.vendorLabel,
20
- designation: t,
21
- invoiceNumberLabel: e.invoiceNumberLabel,
22
- addedOnLabel: e.addedOnLabel
23
- };
24
- return {
25
- ...e,
26
- duplicateBadge: {
27
- label: t,
28
- tone: e.isPossibleDuplicate ? "warning" : "success"
29
- },
30
- selectLabel: p.selectRow(n),
31
- openLabel: p.openRow(n),
32
- isSelected: g(e.id),
33
- onToggleSelected: () => _(e.id),
34
- onOpen: () => u?.(e.id)
35
- };
36
- }), [
37
- c,
38
- g,
39
- p,
40
- _,
41
- u
42
- ]), x = () => {
43
- if (h.length === 0) throw Error("Duplicate review action taken with no bills selected — keep and cancel both need a subject.");
44
- s(!1);
7
+ function r({ rowIds: r }) {
8
+ let [i, a] = n([]), o = e((e) => {
9
+ a((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
10
+ }, []), s = t(() => r.filter((e) => i.includes(e)), [r, i]), c = r.length > 0 && s.length === r.length, l = e(() => {
11
+ a(c ? [] : [...r]);
12
+ }, [c, r]);
13
+ return {
14
+ selectedIds: s,
15
+ isSelected: e((e) => i.includes(e), [i]),
16
+ toggleRow: o,
17
+ toggleAllRows: l,
18
+ selectAllChecked: c ? !0 : s.length > 0 && "indeterminate"
45
19
  };
46
- return /* @__PURE__ */ i(e, {
47
- open: o,
48
- onOpenChange: s,
49
- rows: b,
50
- selectAllChecked: y,
51
- onToggleAllRows: v,
52
- onKeepSelected: l ? x : void 0,
53
- onCancelDuplicates: l ? x : void 0,
54
- isActionDisabled: h.length === 0,
55
- labels: f
56
- });
57
20
  }
58
21
  //#endregion
59
- export { o as DuplicateBillsContainer, o as default };
22
+ export { r as useDuplicateBillsSelection };
@@ -1,3 +1,59 @@
1
- import "./index51.js";
2
- import "./index52.js";
3
- import "./index53.js";
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { DuplicateBillsDialog as e } from "../../ui/dist/index67.js";
6
+ import "../../ui/dist/index.js";
7
+ import { DUPLICATE_BILLS_LABELS_EN as t } from "./index52.js";
8
+ import { useDuplicateBillsSelection as n } from "./index53.js";
9
+ import { useMemo as r } from "react";
10
+ import { jsx as i } from "react/jsx-runtime";
11
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js
12
+ var a = [];
13
+ function o({ open: o, onOpenChange: s, bills: c = a, canManageDuplicates: l = !0, onOpenBill: u, labels: d, dialogLabels: f }) {
14
+ let p = r(() => ({
15
+ ...t,
16
+ ...d
17
+ }), [d]), m = r(() => c.map((e) => e.id), [c]), { selectedIds: h, isSelected: g, toggleRow: _, toggleAllRows: v, selectAllChecked: y } = n({ rowIds: m }), b = r(() => c.map((e) => {
18
+ let t = e.isPossibleDuplicate ? p.duplicateBadge : p.existingBadge, n = {
19
+ vendorLabel: e.vendorLabel,
20
+ designation: t,
21
+ invoiceNumberLabel: e.invoiceNumberLabel,
22
+ addedOnLabel: e.addedOnLabel
23
+ };
24
+ return {
25
+ ...e,
26
+ duplicateBadge: {
27
+ label: t,
28
+ tone: e.isPossibleDuplicate ? "warning" : "success"
29
+ },
30
+ selectLabel: p.selectRow(n),
31
+ openLabel: p.openRow(n),
32
+ isSelected: g(e.id),
33
+ onToggleSelected: () => _(e.id),
34
+ onOpen: () => u?.(e.id)
35
+ };
36
+ }), [
37
+ c,
38
+ g,
39
+ p,
40
+ _,
41
+ u
42
+ ]), x = () => {
43
+ if (h.length === 0) throw Error("Duplicate review action taken with no bills selected — keep and cancel both need a subject.");
44
+ s(!1);
45
+ };
46
+ return /* @__PURE__ */ i(e, {
47
+ open: o,
48
+ onOpenChange: s,
49
+ rows: b,
50
+ selectAllChecked: y,
51
+ onToggleAllRows: v,
52
+ onKeepSelected: l ? x : void 0,
53
+ onCancelDuplicates: l ? x : void 0,
54
+ isActionDisabled: h.length === 0,
55
+ labels: f
56
+ });
57
+ }
58
+ //#endregion
59
+ export { o as DuplicateBillsContainer, o as default };