@tesouro/embedded-components-react 0.2.333 → 0.2.336

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 (39) 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/feature/dist/index.js +6 -6
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +0 -1
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +42 -30
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +12 -46
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +46 -30
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +26 -149
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +159 -31
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +32 -98
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +102 -10
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +10 -212
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +221 -4
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +4 -29
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +27 -80
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +75 -125
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +132 -3
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +3 -4
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +2 -43
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +45 -1
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +1 -8
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +6 -9
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +9 -92
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +94 -3
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +3 -110
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +107 -8
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +8 -37
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +37 -5
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +6 -89
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +83 -154
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +161 -4
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +5 -8
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +6 -113
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +115 -1
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +0 -24
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +25 -0
  37. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  38. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index7.js +1 -1
  39. package/package.json +1 -1
@@ -1,3 +1,132 @@
1
- import "./index39.js";
2
- import "./index40.js";
3
- import "./index41.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/index46.js";
9
+ import { BillDetailsSheet as r } from "../../ui/dist/index52.js";
10
+ import "../../ui/dist/index.js";
11
+ import { useAllPayableLineItemsQuery as i } from "../../data-access/dist/index7.js";
12
+ import { usePayableQuery as a } from "../../data-access/dist/index13.js";
13
+ import "../../data-access/dist/index.js";
14
+ import { PayBillFlow as o } from "./index10.js";
15
+ import "./index11.js";
16
+ import { mergeDecisionDialogCopy as s } from "./index24.js";
17
+ import { useApprovalPolicyCardView as c } from "./index15.js";
18
+ import { useCurrentApprovalRequestId as l } from "./index16.js";
19
+ import { usePayableDetailActions as u } from "./index18.js";
20
+ import { useScheduledPayment as d } from "./index19.js";
21
+ import { BILL_DETAILS_LABELS_EN as f } from "./index40.js";
22
+ import { mapPayableToBillDetails as p } from "./index41.js";
23
+ import { useMemo as m, useRef as h } from "react";
24
+ import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
25
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js
26
+ function y(e) {
27
+ return !!(e?.bank_account?.account_holder_name && e.bank_account.routing_number && e.bank_account.account_number);
28
+ }
29
+ function b({ open: b, onOpenChange: x, payableId: S, onClose: C, onExpand: w, testId: T, labels: E, poweredByBankName: D }) {
30
+ let O = m(() => ({
31
+ ...f,
32
+ ...E,
33
+ sheet: {
34
+ ...f.sheet,
35
+ ...E?.sheet,
36
+ statusBadge: {
37
+ ...f.sheet.statusBadge,
38
+ ...E?.sheet?.statusBadge
39
+ },
40
+ approvalPolicy: {
41
+ ...f.sheet.approvalPolicy,
42
+ ...E?.sheet?.approvalPolicy
43
+ }
44
+ },
45
+ decisionDialog: s(f.decisionDialog, E?.decisionDialog),
46
+ approvalPolicyCopy: {
47
+ ...f.approvalPolicyCopy,
48
+ ...E?.approvalPolicyCopy
49
+ }
50
+ }), [E]), k = a(S), A = i(S), j = e(), M = k.data, N = h(null), P = l({
51
+ payableId: S,
52
+ status: M?.status
53
+ }), F = c({
54
+ payableId: S,
55
+ approvalPolicyId: M?.approval_policy_id,
56
+ copy: O.approvalPolicyCopy
57
+ }), I = d({
58
+ payableId: S,
59
+ scheduledPaymentDate: M?.scheduled_payment_date
60
+ }), { actions: L, decisionDialog: R } = u({
61
+ payableId: M ? S : void 0,
62
+ status: M?.status,
63
+ currentApprovalRequestId: P.id,
64
+ isPolicyApprover: P.isPolicyApprover,
65
+ hasWaitingRequest: P.hasWaitingRequest,
66
+ hasScheduledPayment: I.hasScheduledPayment,
67
+ isScheduledPaymentUnknown: I.isResolving,
68
+ labels: {
69
+ payBill: O.sheet.payButton,
70
+ markAsPaid: O.sheet.markAsPaidButton,
71
+ reject: O.sheet.rejectButton,
72
+ approve: O.sheet.approveButton,
73
+ cancel: O.sheet.cancelButton,
74
+ reopen: O.sheet.reopenButton,
75
+ forceApprove: O.sheet.forceApproveButton,
76
+ forceReject: O.sheet.forceRejectButton,
77
+ decisionDialog: O.decisionDialog,
78
+ actionError: O.actionError
79
+ },
80
+ onPayBillSelect: () => {
81
+ if (!y(t(M)) && w) {
82
+ w();
83
+ return;
84
+ }
85
+ N.current?.open();
86
+ }
87
+ }), z = I.hasScheduledPayment && I.scheduledDateLabel ? /* @__PURE__ */ _("p", {
88
+ className: "ttw:text-sm ttw:text-muted-foreground",
89
+ children: O.scheduledSummary(I.scheduledDateLabel)
90
+ }) : void 0, B = m(() => M ? p({
91
+ payable: M,
92
+ lineItems: A.lineItems,
93
+ ledgerAccounts: j.data?.data ?? [],
94
+ labels: O
95
+ }) : void 0, [
96
+ M,
97
+ A.lineItems,
98
+ j.data,
99
+ O
100
+ ]), V = k.isLoading || A.isResolving || j.isResolving, H = k.isError || A.isError || j.isError;
101
+ return /* @__PURE__ */ v(g, { children: [
102
+ /* @__PURE__ */ _(r, {
103
+ open: b,
104
+ onOpenChange: x,
105
+ details: B,
106
+ actions: L,
107
+ approvalPolicy: F.view,
108
+ isLoading: V,
109
+ isError: H,
110
+ notice: z,
111
+ onClose: C,
112
+ onExpand: w,
113
+ testId: T,
114
+ labels: O.sheet
115
+ }),
116
+ /* @__PURE__ */ _(n, {
117
+ ...R,
118
+ labels: { cancelButton: O.decisionDialog.cancelButton },
119
+ testId: T ? `${T}-decision-dialog` : void 0,
120
+ confirmTestId: T ? `${T}-decision-confirm` : void 0,
121
+ reasonTestId: T ? `${T}-decision-reason` : void 0,
122
+ reasonFieldId: T ? `${T}-decision-reason-field` : void 0
123
+ }),
124
+ M ? /* @__PURE__ */ _(o, {
125
+ ref: N,
126
+ payable: M,
127
+ poweredByBankName: D
128
+ }) : null
129
+ ] });
130
+ }
131
+ //#endregion
132
+ export { b as BillDetailsContainer, b as default };
@@ -1,4 +1,3 @@
1
- //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.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 "./index40.js";
2
+ import "./index41.js";
3
+ import "./index42.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 "./index43.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/index44.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 "./index44.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 "./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
+ //#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
+ }
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/index46.js
2
- var e = (e) => [
3
- "bill-pay",
4
- "upload-queue",
5
- e ?? ""
6
- ];
7
- //#endregion
8
- export { e as billPayUploadQueueKey };
1
+ import "./index45.js";
@@ -1,11 +1,8 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.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 "./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";
15
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.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 "./index46.js";
2
- import "./index47.js";
3
- import "./index48.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 "./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
+ //#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
+ }
93
+ //#endregion
94
+ export { f as useBillUploadQueue };
@@ -1,110 +1,3 @@
1
- import { BillColumn as e } from "../../ui/dist/index53.js";
2
- import "../../ui/dist/index.js";
3
- //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js
4
- var t = {
5
- Drafts: "drafts",
6
- Pending: "pending",
7
- Scheduled: "scheduled",
8
- Paid: "paid",
9
- All: "all"
10
- }, n = {
11
- [t.Drafts]: ["draft"],
12
- [t.Pending]: [
13
- "new",
14
- "approve_in_progress",
15
- "waiting_to_be_paid",
16
- "partially_paid"
17
- ],
18
- [t.Scheduled]: [
19
- "new",
20
- "approve_in_progress",
21
- "waiting_to_be_paid",
22
- "partially_paid"
23
- ],
24
- [t.Paid]: ["paid"],
25
- [t.All]: void 0
26
- }, r = {
27
- [t.Drafts]: void 0,
28
- [t.Pending]: !1,
29
- [t.Scheduled]: !0,
30
- [t.Paid]: void 0,
31
- [t.All]: void 0
32
- };
33
- function i(e) {
34
- return e === t.Pending || e === t.Drafts;
35
- }
36
- var a = t.Pending, o = [
37
- t.Pending,
38
- t.Drafts,
39
- t.Scheduled,
40
- t.Paid,
41
- t.All
42
- ], s = {
43
- [t.Drafts]: [
44
- e.Vendor,
45
- e.DueDate,
46
- e.Status,
47
- e.AmountDue,
48
- e.AddedOn
49
- ],
50
- [t.Pending]: [
51
- e.Vendor,
52
- e.DueDate,
53
- e.Status,
54
- e.AmountDue,
55
- e.AddedOn
56
- ],
57
- [t.Scheduled]: [
58
- e.Vendor,
59
- e.DueDate,
60
- e.ScheduledDate,
61
- e.Status,
62
- e.AmountScheduled,
63
- e.AddedOn
64
- ],
65
- [t.Paid]: [
66
- e.Vendor,
67
- e.PaidDate,
68
- e.Status,
69
- e.AmountPaid,
70
- e.AddedOn
71
- ],
72
- [t.All]: [
73
- e.Vendor,
74
- e.DueDate,
75
- e.ScheduledDate,
76
- e.Status,
77
- e.AmountDue,
78
- e.AmountPaid,
79
- e.AddedOn
80
- ]
81
- };
82
- function c(e) {
83
- return s[e];
84
- }
85
- function l(e) {
86
- let t = n[e];
87
- return t ? [...t] : void 0;
88
- }
89
- function u(e) {
90
- return r[e];
91
- }
92
- var d = {
93
- vendorLabel: "counterpart_name",
94
- dueDateLabel: "due_date",
95
- scheduledDateLabel: "scheduled_payment_date",
96
- addedOnLabel: "created_at"
97
- }, f = {
98
- [e.Vendor]: "vendorLabel",
99
- [e.DueDate]: "dueDateLabel",
100
- [e.ScheduledDate]: "scheduledDateLabel",
101
- [e.AddedOn]: "addedOnLabel"
102
- };
103
- function p(e) {
104
- return f[e];
105
- }
106
- function m(e) {
107
- if (e) return d[e];
108
- }
109
- //#endregion
110
- export { s as BILL_QUEUE_COLUMNS, r as BILL_QUEUE_HAS_SCHEDULED_PAYMENT, o as BILL_QUEUE_ORDER, n as BILL_QUEUE_STATUSES, d as BILL_SORT_FIELDS, t as BillQueue, a as DEFAULT_BILL_QUEUE, c as billQueueColumns, u as billQueueHasScheduledPayment, i as billQueueOffersAddPanel, l as billQueueStatuses, p as billSortColumnId, m as billSortField };
1
+ import "./index47.js";
2
+ import "./index48.js";
3
+ import "./index49.js";