@tesouro/embedded-components-react 0.3.23 → 0.3.25
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.
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index10.js +10 -10
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index2.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +17 -12
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +47 -38
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +108 -93
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +14 -6
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +8 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +33 -30
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index18.js +0 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index22.js +2 -40
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index23.js +23 -266
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index25.js +46 -6
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index26.js +273 -45
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index28.js +5 -18
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index29.js +45 -282
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index31.js +19 -13
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index32.js +273 -107
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index34.js +13 -9
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index35.js +113 -92
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index37.js +9 -10
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index38.js +95 -54
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index40.js +9 -50
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index41.js +53 -137
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index43.js +52 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index44.js +138 -37
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index46.js +2 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index47.js +37 -88
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index49.js +5 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index50.js +88 -12
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index52.js +2 -77
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index53.js +11 -253
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index54.js +2 -13
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index55.js +82 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index56.js +264 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index57.js +9 -45
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index58.js +0 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index59.js +7 -36
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index60.js +47 -10
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index61.js +2 -201
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index62.js +39 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index63.js +3 -7
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index64.js +188 -301
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index65.js +3 -10
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index66.js +12 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index67.js +317 -81
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index68.js +10 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index69.js +8 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index70.js +91 -16
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index72.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index73.js +14 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index74.js +109 -26
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index76.js +3 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index77.js +26 -30
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index79.js +4 -9
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index80.js +30 -102
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index82.js +9 -14
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index83.js +85 -104
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index85.js +10 -11
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index86.js +123 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index87.js +2 -170
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index88.js +18 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index89.js +7 -11
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index90.js +163 -82
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index91.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index92.js +14 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index93.js +108 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index94.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +27 -27
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index71.js +0 -113
package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index10.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
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 {
|
|
7
|
+
import { deletePayablesId as n, deletePayablesIdFile as r, patchPayablesId as i, postPayables as a, postPayablesIdApprovePaymentOperation as o, postPayablesIdAttachFile as s, postPayablesIdCancel as c, postPayablesIdMarkAsPaid as l, postPayablesIdReject as u, postPayablesIdReopen as d, postPayablesIdSubmitForApproval as f, postPayablesIdValidate as p, postPayablesUploadFromFile as m, postPaymentRecordsIdCancel as h } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
|
|
8
8
|
import "../../../shared/data-access/dist/index.js";
|
|
9
9
|
import { invalidateDeletedPayableQueries as g, invalidatePayableQueries as _, reconcileCancelledPaymentQueries as v } from "./index4.js";
|
|
10
10
|
import { useMutation as y } from "@tanstack/react-query";
|
|
@@ -52,11 +52,11 @@ function x() {
|
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
54
|
function S() {
|
|
55
|
-
let { client:
|
|
55
|
+
let { client: r, organizationId: i } = e();
|
|
56
56
|
return y({
|
|
57
57
|
mutationFn: async ({ path: e }) => {
|
|
58
|
-
await
|
|
59
|
-
client:
|
|
58
|
+
await n({
|
|
59
|
+
client: r,
|
|
60
60
|
headers: t(i),
|
|
61
61
|
path: e,
|
|
62
62
|
throwOnError: !0
|
|
@@ -64,7 +64,7 @@ function S() {
|
|
|
64
64
|
},
|
|
65
65
|
onSuccess: async (e, t) => {
|
|
66
66
|
await g({
|
|
67
|
-
client:
|
|
67
|
+
client: r,
|
|
68
68
|
organizationId: i,
|
|
69
69
|
payableId: t.path.payable_id
|
|
70
70
|
});
|
|
@@ -126,11 +126,11 @@ function w() {
|
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
128
|
function T() {
|
|
129
|
-
let { client:
|
|
129
|
+
let { client: n, organizationId: i } = e();
|
|
130
130
|
return y({
|
|
131
131
|
mutationFn: async ({ path: e }) => {
|
|
132
|
-
await
|
|
133
|
-
client:
|
|
132
|
+
await r({
|
|
133
|
+
client: n,
|
|
134
134
|
headers: t(i),
|
|
135
135
|
path: e,
|
|
136
136
|
throwOnError: !0
|
|
@@ -138,9 +138,9 @@ function T() {
|
|
|
138
138
|
},
|
|
139
139
|
onSuccess: async (e, t) => {
|
|
140
140
|
await _({
|
|
141
|
-
client:
|
|
141
|
+
client: n,
|
|
142
142
|
organizationId: i,
|
|
143
|
-
payableId: t.
|
|
143
|
+
payableId: t.path.payable_id
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
146
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SOURCE_ACCOUNT_LABELS_EN as e } from "./index10.js";
|
|
2
|
-
import { REVIEW_TRANSACTION_DIALOG_LABELS_EN as t } from "../../ui/dist/
|
|
3
|
-
import { SCHEDULE_PAYMENT_DIALOG_LABELS_EN as n } from "../../ui/dist/
|
|
2
|
+
import { REVIEW_TRANSACTION_DIALOG_LABELS_EN as t } from "../../ui/dist/index82.js";
|
|
3
|
+
import { SCHEDULE_PAYMENT_DIALOG_LABELS_EN as n } from "../../ui/dist/index88.js";
|
|
4
4
|
import "../../ui/dist/index.js";
|
|
5
5
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js
|
|
6
6
|
var r = {
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import { resolveAmountDueMinorUnits as e } from "./index6.js";
|
|
6
6
|
import { resolveVendor as t } from "./index7.js";
|
|
7
7
|
import { payBillFlowTestIds as n } from "./index8.js";
|
|
8
|
-
import { ReviewTransactionDialog as r } from "../../ui/dist/
|
|
9
|
-
import { SchedulePaymentDialog as i } from "../../ui/dist/
|
|
8
|
+
import { ReviewTransactionDialog as r } from "../../ui/dist/index83.js";
|
|
9
|
+
import { SchedulePaymentDialog as i } from "../../ui/dist/index90.js";
|
|
10
10
|
import "../../ui/dist/index.js";
|
|
11
11
|
import { usePayBillFlow as a } from "./index12.js";
|
|
12
12
|
import { useImperativeHandle as o } from "react";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MARK_AS_PAID_DIALOG_LABELS_EN as e } from "../../ui/dist/
|
|
1
|
+
import { MARK_AS_PAID_DIALOG_LABELS_EN as e } from "../../ui/dist/index85.js";
|
|
2
2
|
import "../../ui/dist/index.js";
|
|
3
3
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index2.js
|
|
4
4
|
var t = {
|
|
@@ -12,41 +12,46 @@ function t(e, t) {
|
|
|
12
12
|
function n({ apiStatus: n, dueDate: r, scheduledPaymentDate: i, hasScheduledPayment: a = !!i, now: o = /* @__PURE__ */ new Date() }) {
|
|
13
13
|
if (e.has(n) && a) return {
|
|
14
14
|
status: "scheduled",
|
|
15
|
-
tone: "accent"
|
|
16
|
-
|
|
17
|
-
if (e.has(n) && r && t(r, o)) return {
|
|
18
|
-
status: "overdue",
|
|
19
|
-
tone: "danger"
|
|
15
|
+
tone: "accent",
|
|
16
|
+
isOverdue: !1
|
|
20
17
|
};
|
|
18
|
+
let s = !!(e.has(n) && r && t(r, o));
|
|
21
19
|
switch (n) {
|
|
22
20
|
case "draft": return {
|
|
23
21
|
status: "draft",
|
|
24
|
-
tone: "neutral"
|
|
22
|
+
tone: "neutral",
|
|
23
|
+
isOverdue: s
|
|
25
24
|
};
|
|
26
25
|
case "new":
|
|
27
26
|
case "approve_in_progress": return {
|
|
28
27
|
status: "pending_approval",
|
|
29
|
-
tone: "warning"
|
|
28
|
+
tone: "warning",
|
|
29
|
+
isOverdue: s
|
|
30
30
|
};
|
|
31
31
|
case "waiting_to_be_paid": return {
|
|
32
32
|
status: "ready_to_pay",
|
|
33
|
-
tone: "info"
|
|
33
|
+
tone: "info",
|
|
34
|
+
isOverdue: s
|
|
34
35
|
};
|
|
35
36
|
case "partially_paid": return {
|
|
36
37
|
status: "partially_paid",
|
|
37
|
-
tone: "success"
|
|
38
|
+
tone: "success",
|
|
39
|
+
isOverdue: s
|
|
38
40
|
};
|
|
39
41
|
case "paid": return {
|
|
40
42
|
status: "paid",
|
|
41
|
-
tone: "success"
|
|
43
|
+
tone: "success",
|
|
44
|
+
isOverdue: s
|
|
42
45
|
};
|
|
43
46
|
case "canceled": return {
|
|
44
47
|
status: "canceled",
|
|
45
|
-
tone: "muted"
|
|
48
|
+
tone: "muted",
|
|
49
|
+
isOverdue: s
|
|
46
50
|
};
|
|
47
51
|
case "rejected": return {
|
|
48
52
|
status: "rejected",
|
|
49
|
-
tone: "danger"
|
|
53
|
+
tone: "danger",
|
|
54
|
+
isOverdue: s
|
|
50
55
|
};
|
|
51
56
|
}
|
|
52
57
|
}
|
|
@@ -35,6 +35,7 @@ function a({ payable: a, lineItems: o, glCodeOptions: s, history: c, approvalPol
|
|
|
35
35
|
amountDue: i(t(a), f) ?? "",
|
|
36
36
|
invoiceDateLabel: g,
|
|
37
37
|
dueDateLabel: _,
|
|
38
|
+
dueDateTone: p.isOverdue ? "danger" : "default",
|
|
38
39
|
status: p.status,
|
|
39
40
|
statusTone: p.tone,
|
|
40
41
|
payTo: {
|
|
@@ -29,7 +29,9 @@ var l = {
|
|
|
29
29
|
vendorDetailsFailed: "We could not load this vendor. Try again."
|
|
30
30
|
}, d = {
|
|
31
31
|
attachFailed: "We could not attach that file. Try again.",
|
|
32
|
+
deleteFailed: "We could not remove that document. Try again.",
|
|
32
33
|
noDocument: "No document attached to this bill.",
|
|
34
|
+
pendingDeletionNotice: "This document will be removed when you save this bill.",
|
|
33
35
|
preview: c
|
|
34
36
|
}, f = {
|
|
35
37
|
notProvided: "Not provided",
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import { SourceDocumentPanel as e } from "../../ui/dist/
|
|
5
|
+
import { SourceDocumentPanel as e } from "../../ui/dist/index93.js";
|
|
6
6
|
import "../../ui/dist/index.js";
|
|
7
|
-
import { useAttachPayableFileMutation as t
|
|
7
|
+
import { useAttachPayableFileMutation as t } from "../../data-access/dist/index10.js";
|
|
8
8
|
import "../../data-access/dist/index.js";
|
|
9
|
-
import { createSourceDocumentPreview as
|
|
10
|
-
import { SOURCE_DOCUMENT_CONTAINER_LABELS_EN as
|
|
11
|
-
import { useEffect as
|
|
12
|
-
import { jsx as
|
|
9
|
+
import { createSourceDocumentPreview as n } from "./index30.js";
|
|
10
|
+
import { SOURCE_DOCUMENT_CONTAINER_LABELS_EN as r } from "./index31.js";
|
|
11
|
+
import { useEffect as i, useState as a } from "react";
|
|
12
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
13
13
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js
|
|
14
|
-
function
|
|
15
|
-
let [t, n] =
|
|
16
|
-
return
|
|
14
|
+
function s(e) {
|
|
15
|
+
let [t, n] = a();
|
|
16
|
+
return i(() => {
|
|
17
17
|
if (!e) {
|
|
18
18
|
n(void 0);
|
|
19
19
|
return;
|
|
@@ -22,50 +22,59 @@ function c(e) {
|
|
|
22
22
|
return n(t), () => URL.revokeObjectURL(t);
|
|
23
23
|
}, [e]), t;
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
let { stagedFile: m, onFileStaged: h, onClearStagedFile: g, isSaving: _ } =
|
|
27
|
-
...
|
|
25
|
+
function c({ payableId: i, file: a, isDocumentPending: c, pendingFileName: l, readOnly: u, staging: d, deletion: f, labels: p }) {
|
|
26
|
+
let { stagedFile: m, onFileStaged: h, onClearStagedFile: g, isSaving: _ } = d ?? {}, { isPending: v, onRequest: y, onDetachNow: b, isDeleting: x, hasFailed: S } = f ?? {}, C = {
|
|
27
|
+
...r,
|
|
28
28
|
...p,
|
|
29
29
|
preview: {
|
|
30
|
-
...
|
|
30
|
+
...r.preview,
|
|
31
31
|
...p?.preview
|
|
32
32
|
}
|
|
33
|
-
},
|
|
34
|
-
if (!
|
|
33
|
+
}, w = t(), T = s(m), E = !!(a && !v || m);
|
|
34
|
+
if (!E && (c || w.isPending)) return /* @__PURE__ */ o(e, {
|
|
35
35
|
mode: "loading",
|
|
36
|
-
fileName:
|
|
36
|
+
fileName: l
|
|
37
37
|
});
|
|
38
|
-
if (!
|
|
38
|
+
if (!E && u) return /* @__PURE__ */ o("div", {
|
|
39
39
|
className: "ttw:rounded-lg ttw:border ttw:border-border ttw:bg-card ttw:p-4 ttw:text-sm ttw:text-muted-foreground",
|
|
40
|
-
children:
|
|
40
|
+
children: C.noDocument
|
|
41
41
|
});
|
|
42
|
-
if (!
|
|
42
|
+
if (!E) return /* @__PURE__ */ o(e, {
|
|
43
43
|
mode: "upload",
|
|
44
|
-
uploadStatus:
|
|
45
|
-
uploadErrorMessage:
|
|
44
|
+
uploadStatus: w.isPending || x ? "uploading" : "idle",
|
|
45
|
+
uploadErrorMessage: w.isError ? C.attachFailed : S ? C.deleteFailed : void 0,
|
|
46
|
+
noticeMessage: v && !S ? C.pendingDeletionNotice : void 0,
|
|
46
47
|
onFilesSelected: (e) => {
|
|
47
48
|
let [t] = e;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
if (t) {
|
|
50
|
+
if (i) {
|
|
51
|
+
let e = () => w.mutate({
|
|
52
|
+
path: { payable_id: i },
|
|
53
|
+
file: t
|
|
54
|
+
});
|
|
55
|
+
if (v && b) {
|
|
56
|
+
b().then(e, () => void 0);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
e();
|
|
60
|
+
} else h?.(t);
|
|
61
|
+
}
|
|
52
62
|
}
|
|
53
63
|
});
|
|
54
|
-
let
|
|
55
|
-
name:
|
|
56
|
-
url:
|
|
64
|
+
let D = a?.name ?? m?.name ?? "", O = n(a || {
|
|
65
|
+
name: D,
|
|
66
|
+
url: T ?? "",
|
|
57
67
|
mimetype: m?.type ?? ""
|
|
58
|
-
},
|
|
59
|
-
return /* @__PURE__ */
|
|
68
|
+
}, C.preview);
|
|
69
|
+
return /* @__PURE__ */ o(e, {
|
|
60
70
|
mode: "document",
|
|
61
|
-
fileName:
|
|
62
|
-
preview:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}) : _ ? void 0 : g
|
|
71
|
+
fileName: D,
|
|
72
|
+
preview: O,
|
|
73
|
+
isDeleting: x,
|
|
74
|
+
deleteErrorMessage: S ? C.deleteFailed : void 0,
|
|
75
|
+
onDownload: a ? () => window.open(a.url, "_blank", "noopener,noreferrer") : void 0,
|
|
76
|
+
onDelete: u ? void 0 : a && i ? y : _ ? void 0 : g
|
|
68
77
|
});
|
|
69
78
|
}
|
|
70
79
|
//#endregion
|
|
71
|
-
export {
|
|
80
|
+
export { c as SourceDocumentContainer, c as default };
|
|
@@ -5,32 +5,32 @@
|
|
|
5
5
|
import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
6
6
|
import "../../../shared/ui/dist/index.js";
|
|
7
7
|
import { useReplacePayableLineItemsMutation as t } from "../../data-access/dist/index7.js";
|
|
8
|
-
import { useCreatePayableMutation as n,
|
|
8
|
+
import { useCreatePayableMutation as n, useDeletePayableFileMutation as r, useSubmitPayableForApprovalMutation as i, useUpdatePayableMutation as a, useValidatePayableMutation as o } from "../../data-access/dist/index10.js";
|
|
9
9
|
import "../../data-access/dist/index.js";
|
|
10
|
-
import { BILL_CREATE_MESSAGE_LABELS_EN as
|
|
11
|
-
import { encodeFileToBase64 as
|
|
12
|
-
import { mapBillFormToPayload as
|
|
13
|
-
import { validateBillCompleteness as
|
|
14
|
-
import { useCallback as
|
|
10
|
+
import { BILL_CREATE_MESSAGE_LABELS_EN as s } from "./index31.js";
|
|
11
|
+
import { encodeFileToBase64 as c } from "./index37.js";
|
|
12
|
+
import { mapBillFormToPayload as l, mapLineItemsToPayload as u } from "./index38.js";
|
|
13
|
+
import { validateBillCompleteness as d, validateBillTotals as f, validateLineItems as p } from "./index39.js";
|
|
14
|
+
import { useCallback as m, useRef as h, useState as g } from "react";
|
|
15
15
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js
|
|
16
|
-
var
|
|
16
|
+
var _ = {
|
|
17
17
|
document_id: "invoiceNumber",
|
|
18
18
|
issued_at: "invoiceDate",
|
|
19
19
|
due_date: "dueDate",
|
|
20
20
|
counterpart_id: "vendor"
|
|
21
21
|
};
|
|
22
|
-
function
|
|
22
|
+
function v(e) {
|
|
23
23
|
return e.type === "type_error.none.not_allowed" || e.msg === "none is not an allowed value";
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function y(e, t = s) {
|
|
26
26
|
let n = {}, r = [];
|
|
27
27
|
for (let i of e) {
|
|
28
|
-
let e = i.loc[0] ?? t.unknownValidationField, a =
|
|
28
|
+
let e = i.loc[0] ?? t.unknownValidationField, a = _[e], o = v(i) ? t.requiredField : i.msg;
|
|
29
29
|
a ? n[a] = o : r.push(t.unmappedValidationError(e, o));
|
|
30
30
|
}
|
|
31
31
|
return r.length && (n.form = r.join(" ")), n;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function b(e, t) {
|
|
34
34
|
if (!e && !t) return;
|
|
35
35
|
let n = {}, r = /* @__PURE__ */ new Set([...Object.keys(e ?? {}), ...Object.keys(t ?? {})]);
|
|
36
36
|
for (let i of r) n[i] = {
|
|
@@ -39,131 +39,146 @@ function y(e, t) {
|
|
|
39
39
|
};
|
|
40
40
|
return n;
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
let
|
|
44
|
-
...
|
|
45
|
-
...
|
|
46
|
-
}, [
|
|
47
|
-
let t =
|
|
48
|
-
return
|
|
49
|
-
}, [
|
|
50
|
-
let t = !
|
|
51
|
-
base64EncodedFile: await
|
|
52
|
-
fileName:
|
|
53
|
-
} : void 0, n =
|
|
54
|
-
values:
|
|
55
|
-
counterpartId:
|
|
56
|
-
clearCounterpart:
|
|
42
|
+
function x({ payableId: _, form: v, counterpartId: x, clearCounterpart: S, prepareVendorForSave: C, onSaved: w, onPayableCreated: T, onDraftSaved: E, onFinalized: D, labels: O }) {
|
|
43
|
+
let k = {
|
|
44
|
+
...s,
|
|
45
|
+
...O
|
|
46
|
+
}, [A, j] = g(), M = _ ?? A, [N, P] = g(), F = m(() => P(void 0), []), [I, L] = g(!1), R = m(() => L(!0), []), [z, B] = g(), V = h(!1), H = n(), U = r(), W = a(), G = t(), K = o(), q = i(), J = m(() => {
|
|
47
|
+
let t = p(v.lineItems, k), n = f(v.discount, v.tax, v.totalOverride, k);
|
|
48
|
+
return v.setLineItemErrors(t), !t && !n || (t ? (v.setErrors(void 0), e.error(k.lineItemsNeedAttention)) : v.setErrors(n), !1);
|
|
49
|
+
}, [v, k]), Y = m(async (e) => {
|
|
50
|
+
let t = !M && N ? {
|
|
51
|
+
base64EncodedFile: await c(N),
|
|
52
|
+
fileName: N.name
|
|
53
|
+
} : void 0, n = l({
|
|
54
|
+
values: v.values,
|
|
55
|
+
counterpartId: x,
|
|
56
|
+
clearCounterpart: S,
|
|
57
57
|
counterpartBankAccountId: e,
|
|
58
|
-
editedTotals:
|
|
59
|
-
discount:
|
|
60
|
-
tax:
|
|
61
|
-
total:
|
|
58
|
+
editedTotals: v.isTotalsDirty ? {
|
|
59
|
+
discount: v.discount,
|
|
60
|
+
tax: v.tax,
|
|
61
|
+
total: v.totalOverride
|
|
62
62
|
} : void 0,
|
|
63
63
|
document: t
|
|
64
|
-
}), r =
|
|
65
|
-
if (r ? await
|
|
64
|
+
}), r = M;
|
|
65
|
+
if (r ? await W.mutateAsync({
|
|
66
66
|
path: { payable_id: r },
|
|
67
67
|
body: n
|
|
68
|
-
}) : (r = (await
|
|
69
|
-
|
|
68
|
+
}) : (r = (await H.mutateAsync({ body: n }))?.id, r && (j(r), T?.(r), t && P(void 0))), !r) throw Error("Payable was created without an id");
|
|
69
|
+
if (I) {
|
|
70
|
+
try {
|
|
71
|
+
await U.mutateAsync({ path: { payable_id: r } });
|
|
72
|
+
} catch {}
|
|
73
|
+
L(!1);
|
|
74
|
+
}
|
|
75
|
+
return await G.mutateAsync({
|
|
70
76
|
path: { payable_id: r },
|
|
71
|
-
body: { data:
|
|
77
|
+
body: { data: u(v.lineItems) }
|
|
72
78
|
}), r;
|
|
73
79
|
}, [
|
|
74
|
-
b,
|
|
75
80
|
x,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
81
|
+
S,
|
|
82
|
+
H,
|
|
83
|
+
U,
|
|
84
|
+
I,
|
|
85
|
+
v.discount,
|
|
86
|
+
v.isTotalsDirty,
|
|
87
|
+
v.lineItems,
|
|
88
|
+
v.tax,
|
|
89
|
+
v.totalOverride,
|
|
90
|
+
v.values,
|
|
91
|
+
T,
|
|
86
92
|
M,
|
|
87
|
-
|
|
88
|
-
|
|
93
|
+
G,
|
|
94
|
+
N,
|
|
95
|
+
W
|
|
96
|
+
]), X = m(async () => {
|
|
97
|
+
M && (await U.mutateAsync({ path: { payable_id: M } }), L(!1));
|
|
98
|
+
}, [U, M]);
|
|
89
99
|
return {
|
|
90
|
-
saveDraft:
|
|
91
|
-
if (!
|
|
92
|
-
|
|
100
|
+
saveDraft: m(async () => {
|
|
101
|
+
if (!V.current && J()) {
|
|
102
|
+
V.current = !0, B("draft");
|
|
93
103
|
try {
|
|
94
|
-
let t = await
|
|
104
|
+
let t = await C?.();
|
|
95
105
|
if (t && !t.ok) return;
|
|
96
|
-
let n = await
|
|
97
|
-
|
|
106
|
+
let n = await Y(t?.counterpartBankAccountId);
|
|
107
|
+
v.setErrors(void 0), w?.(n), E?.(n), e.success(k.draftSaved);
|
|
98
108
|
} catch {
|
|
99
|
-
|
|
109
|
+
v.setErrors({ form: k.saveFailed });
|
|
100
110
|
} finally {
|
|
101
|
-
|
|
111
|
+
B(void 0), V.current = !1;
|
|
102
112
|
}
|
|
103
113
|
}
|
|
104
114
|
}, [
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
115
|
+
v,
|
|
116
|
+
J,
|
|
117
|
+
k.draftSaved,
|
|
118
|
+
k.saveFailed,
|
|
119
|
+
E,
|
|
120
|
+
w,
|
|
110
121
|
C,
|
|
111
|
-
|
|
112
|
-
W
|
|
122
|
+
Y
|
|
113
123
|
]),
|
|
114
|
-
finalize:
|
|
115
|
-
if (
|
|
116
|
-
let t =
|
|
117
|
-
|
|
124
|
+
finalize: m(async () => {
|
|
125
|
+
if (V.current) return;
|
|
126
|
+
let t = p(v.lineItems, k), n = f(v.discount, v.tax, v.totalOverride, k), { formErrors: r, lineItemErrors: i } = d(v.values, x, v.lineItems, k), a = b(i, t);
|
|
127
|
+
v.setLineItemErrors(a);
|
|
118
128
|
let o = {
|
|
119
129
|
...r,
|
|
120
130
|
...n
|
|
121
131
|
};
|
|
122
|
-
if (
|
|
123
|
-
|
|
132
|
+
if (v.setErrors(Object.keys(o).length ? o : void 0), t && e.error(k.lineItemsNeedAttention), !(a || Object.keys(o).length)) {
|
|
133
|
+
V.current = !0, B("finalize");
|
|
124
134
|
try {
|
|
125
135
|
let t;
|
|
126
136
|
try {
|
|
127
|
-
let e = await
|
|
137
|
+
let e = await C?.();
|
|
128
138
|
if (e && !e.ok) return;
|
|
129
|
-
t = await
|
|
139
|
+
t = await Y(e?.counterpartBankAccountId);
|
|
130
140
|
} catch {
|
|
131
|
-
|
|
141
|
+
v.setErrors({ form: k.saveFailed });
|
|
132
142
|
return;
|
|
133
143
|
}
|
|
134
|
-
|
|
144
|
+
w?.(t);
|
|
135
145
|
try {
|
|
136
|
-
let n = await
|
|
146
|
+
let n = await K.mutateAsync({ path: { payable_id: t } });
|
|
137
147
|
if (n.validation_errors.length) {
|
|
138
|
-
|
|
148
|
+
v.setErrors(y(n.validation_errors, k));
|
|
139
149
|
return;
|
|
140
150
|
}
|
|
141
|
-
await
|
|
151
|
+
await q.mutateAsync({ path: { payable_id: t } }), v.setErrors(void 0), D?.(t), e.success(k.billFinalized);
|
|
142
152
|
} catch {
|
|
143
|
-
|
|
153
|
+
v.setErrors({ form: k.finalizeFailed });
|
|
144
154
|
}
|
|
145
155
|
} finally {
|
|
146
|
-
|
|
156
|
+
B(void 0), V.current = !1;
|
|
147
157
|
}
|
|
148
158
|
}
|
|
149
159
|
}, [
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
160
|
+
x,
|
|
161
|
+
v,
|
|
162
|
+
k,
|
|
163
|
+
D,
|
|
164
|
+
w,
|
|
154
165
|
C,
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
V
|
|
166
|
+
Y,
|
|
167
|
+
q,
|
|
168
|
+
K
|
|
159
169
|
]),
|
|
160
|
-
payableId:
|
|
161
|
-
isSavingDraft:
|
|
162
|
-
isFinalizing:
|
|
163
|
-
stagedFile:
|
|
164
|
-
stageFile:
|
|
165
|
-
clearStagedFile:
|
|
170
|
+
payableId: M,
|
|
171
|
+
isSavingDraft: z === "draft",
|
|
172
|
+
isFinalizing: z === "finalize",
|
|
173
|
+
stagedFile: N,
|
|
174
|
+
stageFile: P,
|
|
175
|
+
clearStagedFile: F,
|
|
176
|
+
isFileDeletionPending: I,
|
|
177
|
+
requestFileDeletion: R,
|
|
178
|
+
detachFileNow: X,
|
|
179
|
+
isDeletingFile: U.isPending,
|
|
180
|
+
hasFileDeletionFailed: U.isError
|
|
166
181
|
};
|
|
167
182
|
}
|
|
168
183
|
//#endregion
|
|
169
|
-
export {
|
|
184
|
+
export { y as mapValidationErrorsToForm, x as useBillCreateController };
|
|
@@ -12,11 +12,11 @@ import { useWidgetConfig as re } from "../../../shared/feature/dist/lib/WidgetPr
|
|
|
12
12
|
import "../../../shared/feature/dist/index.js";
|
|
13
13
|
import { resolveAmountDueMinorUnits as ie } from "./index6.js";
|
|
14
14
|
import { resolveVendor as ae } from "./index7.js";
|
|
15
|
-
import { BillCreateScreen as oe } from "../../ui/dist/
|
|
16
|
-
import { BillDecisionDialog as n } from "../../ui/dist/
|
|
17
|
-
import { BillDuplicateNotice as se } from "../../ui/dist/
|
|
18
|
-
import { ExtractionNotice as ce } from "../../ui/dist/
|
|
19
|
-
import { MarkAsPaidDialog as le } from "../../ui/dist/
|
|
15
|
+
import { BillCreateScreen as oe } from "../../ui/dist/index44.js";
|
|
16
|
+
import { BillDecisionDialog as n } from "../../ui/dist/index50.js";
|
|
17
|
+
import { BillDuplicateNotice as se } from "../../ui/dist/index60.js";
|
|
18
|
+
import { ExtractionNotice as ce } from "../../ui/dist/index77.js";
|
|
19
|
+
import { MarkAsPaidDialog as le } from "../../ui/dist/index86.js";
|
|
20
20
|
import "../../ui/dist/index.js";
|
|
21
21
|
import { usePayableHistoryQuery as ue } from "../../data-access/dist/index6.js";
|
|
22
22
|
import { useAllPayableLineItemsQuery as de } from "../../data-access/dist/index7.js";
|
|
@@ -144,9 +144,10 @@ function u({ open: u, onOpenChange: d, payableId: f, readOnly: p = !1, copy: m,
|
|
|
144
144
|
D,
|
|
145
145
|
p
|
|
146
146
|
]), J = D?.source_of_payable_data === "ocr", Y = L?.name, X = p ? Y ? h.viewTitle(Y) : h.readOnlyTitle : J && Y ? h.extractedTitle(Y) : h.newTitle, Ve = p && D?.created_at ? h.addedOn(ne(D.created_at.slice(0, 10))) : void 0, Z = i(() => {
|
|
147
|
-
let e = O.isDirty || A.hasUnsavedVendorChanges || !!j.stagedFile;
|
|
147
|
+
let e = O.isDirty || A.hasUnsavedVendorChanges || !!j.stagedFile || j.isFileDeletionPending;
|
|
148
148
|
!p && e && !window.confirm(h.discardConfirm) || d(!1);
|
|
149
149
|
}, [
|
|
150
|
+
j.isFileDeletionPending,
|
|
150
151
|
j.stagedFile,
|
|
151
152
|
h.discardConfirm,
|
|
152
153
|
O.isDirty,
|
|
@@ -206,6 +207,13 @@ function u({ open: u, onOpenChange: d, payableId: f, readOnly: p = !1, copy: m,
|
|
|
206
207
|
onFileStaged: j.stageFile,
|
|
207
208
|
onClearStagedFile: j.clearStagedFile,
|
|
208
209
|
isSaving: M
|
|
210
|
+
},
|
|
211
|
+
deletion: {
|
|
212
|
+
isPending: j.isFileDeletionPending,
|
|
213
|
+
onRequest: j.requestFileDeletion,
|
|
214
|
+
onDetachNow: j.detachFileNow,
|
|
215
|
+
isDeleting: j.isDeletingFile,
|
|
216
|
+
hasFailed: j.hasFileDeletionFailed
|
|
209
217
|
}
|
|
210
218
|
}),
|
|
211
219
|
menuItems: U.menuItems,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BILL_DETAILS_SHEET_LABELS_EN as e } from "../../ui/dist/
|
|
1
|
+
import { BILL_DETAILS_SHEET_LABELS_EN as e } from "../../ui/dist/index55.js";
|
|
2
2
|
import "../../ui/dist/index.js";
|
|
3
3
|
import { MARK_AS_PAID_FLOW_LABELS_EN as t } from "./index2.js";
|
|
4
4
|
import "./index5.js";
|
|
@@ -74,6 +74,7 @@ function a({ payable: a, lineItems: o, ledgerAccounts: s, labels: c, hasSchedule
|
|
|
74
74
|
amountDueLabel: f(a.amount_due) ?? f(a.total_amount) ?? "",
|
|
75
75
|
invoiceDateLabel: g,
|
|
76
76
|
dueDateLabel: _,
|
|
77
|
+
dueDateTone: p.isOverdue ? "danger" : "default",
|
|
77
78
|
payToItems: v,
|
|
78
79
|
invoiceItems: b,
|
|
79
80
|
lineItems: S,
|
|
@@ -6,10 +6,10 @@ import { useAllLedgerAccountsQuery as e } from "../../../shared/data-access/dist
|
|
|
6
6
|
import "../../../shared/data-access/dist/index.js";
|
|
7
7
|
import { resolveAmountDueMinorUnits as t } from "./index6.js";
|
|
8
8
|
import { resolveVendor as n } from "./index7.js";
|
|
9
|
-
import { BillDecisionDialog as r } from "../../ui/dist/
|
|
10
|
-
import { BillDetailsSheet as i } from "../../ui/dist/
|
|
11
|
-
import { BillDuplicateNotice as a } from "../../ui/dist/
|
|
12
|
-
import { MarkAsPaidDialog as o } from "../../ui/dist/
|
|
9
|
+
import { BillDecisionDialog as r } from "../../ui/dist/index50.js";
|
|
10
|
+
import { BillDetailsSheet as i } from "../../ui/dist/index56.js";
|
|
11
|
+
import { BillDuplicateNotice as a } from "../../ui/dist/index60.js";
|
|
12
|
+
import { MarkAsPaidDialog as o } from "../../ui/dist/index86.js";
|
|
13
13
|
import "../../ui/dist/index.js";
|
|
14
14
|
import { useAllPayableLineItemsQuery as s } from "../../data-access/dist/index7.js";
|
|
15
15
|
import { usePayableQuery as c } from "../../data-access/dist/index13.js";
|
|
@@ -46,6 +46,10 @@ function T({ open: T, onOpenChange: E, payableId: D, onClose: O, onExpand: k, te
|
|
|
46
46
|
approvalPolicy: {
|
|
47
47
|
..._.sheet.approvalPolicy,
|
|
48
48
|
...j?.sheet?.approvalPolicy
|
|
49
|
+
},
|
|
50
|
+
dueDate: {
|
|
51
|
+
..._.sheet.dueDate,
|
|
52
|
+
...j?.sheet?.dueDate
|
|
49
53
|
}
|
|
50
54
|
},
|
|
51
55
|
decisionDialog: f(_.decisionDialog, j?.decisionDialog),
|