@tesouro/embedded-components-react 0.5.139 → 0.5.142
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/index.js +1 -1
- package/dist/lib/BillPayWidget.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +11 -11
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +9 -24
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +21 -37
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +21 -14
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +41 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +16 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +8 -98
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +4 -83
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +98 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +78 -135
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +4 -45
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +139 -109
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +44 -186
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +108 -72
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +188 -29
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +71 -83
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +27 -406
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +88 -12
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +403 -77
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +13 -80
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +77 -221
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +78 -41
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +212 -234
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +44 -21
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +234 -557
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +23 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +581 -40
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +4 -251
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +45 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +261 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +3 -46
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +4 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +44 -6
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +1 -13
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +6 -127
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js +13 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +126 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +3 -127
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js +3 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +124 -7
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js +8 -46
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index77.js +8 -21
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index78.js +51 -20
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index79.js +20 -28
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index80.js +19 -83
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index81.js +28 -47
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index82.js +76 -252
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index83.js +48 -33
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index84.js +249 -142
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index85.js +27 -206
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index86.js +160 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index87.js +217 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index88.js +3 -112
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index89.js +7 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index90.js +104 -18
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index91.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index92.js +27 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +48 -48
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index100.js +12 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index101.js +102 -27
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index102.js +2 -128
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index103.js +31 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index104.js +125 -30
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index105.js +2 -10
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index106.js +29 -177
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index107.js +10 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index108.js +178 -11
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index109.js +2 -108
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index110.js +14 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index111.js +106 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index112.js +2 -52
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index113.js +10 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index114.js +52 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index115.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index16.js +26 -16
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index17.js +14 -19
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index18.js +16 -11
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index19.js +19 -14
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index20.js +14 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index21.js +16 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index22.js +2 -30
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index23.js +4 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index24.js +26 -28
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index25.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index26.js +28 -31
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index27.js +1 -19
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index28.js +27 -117
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index29.js +19 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index30.js +123 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index31.js +2 -16
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index32.js +4 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index33.js +14 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index34.js +2 -22
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index35.js +4 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index36.js +20 -99
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index37.js +2 -79
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index38.js +97 -273
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index39.js +79 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index40.js +273 -18
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index41.js +2 -56
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index42.js +21 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index43.js +52 -14
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index44.js +2 -50
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index45.js +18 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index46.js +47 -32
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index47.js +2 -374
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index48.js +35 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index49.js +369 -18
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index50.js +2 -96
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index51.js +23 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index52.js +93 -29
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index53.js +1 -51
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index54.js +31 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index55.js +49 -53
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index56.js +2 -13
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index57.js +53 -194
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index58.js +13 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index59.js +195 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index60.js +2 -41
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index61.js +4 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index62.js +37 -15
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index63.js +2 -88
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index64.js +19 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index65.js +78 -308
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index66.js +2 -9
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index67.js +311 -27
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index68.js +9 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index69.js +33 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index70.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index71.js +2 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index72.js +1 -39
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index73.js +8 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index74.js +37 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index75.js +2 -36
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index76.js +4 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index77.js +34 -37
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index78.js +2 -12
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index79.js +37 -199
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index80.js +12 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index81.js +199 -15
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index82.js +2 -402
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index83.js +13 -6
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index84.js +413 -6
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index85.js +8 -91
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index86.js +9 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index87.js +93 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index89.js +2 -28
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index90.js +118 -87
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index91.js +28 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index92.js +92 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index93.js +2 -30
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index94.js +7 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index95.js +28 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index96.js +2 -34
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index97.js +7 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index98.js +32 -10
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index99.js +1 -105
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/zod.gen.js +855 -831
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/util/dist/lib/relativeCalendarDay.js +12 -0
- package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index8.js +1 -1
- package/package.json +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index88.js +0 -125
|
@@ -2,253 +2,231 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
5
|
+
import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
6
|
+
import "../../../shared/ui/dist/index.js";
|
|
7
|
+
import { extractApiErrorMessage as t } from "../../../shared/util/dist/lib/apiErrors.js";
|
|
8
|
+
import { useReplacePayableLineItemsMutation as n } from "../../data-access/dist/index10.js";
|
|
9
|
+
import { useCreatePayableMutation as r, useDeletePayableFileMutation as i, useSubmitPayableForApprovalMutation as a, useUpdatePayableMutation as o, useValidatePayableMutation as s } from "../../data-access/dist/index13.js";
|
|
10
|
+
import "../../data-access/dist/index.js";
|
|
11
|
+
import { BILL_CREATE_MESSAGE_LABELS_EN as c } from "./index50.js";
|
|
12
|
+
import { encodeFileToBase64 as l } from "./index55.js";
|
|
13
|
+
import { mapBillFormToPayload as u, mapLineItemsToPayload as ee, mapPayableAmountFieldsToPayload as te } from "./index56.js";
|
|
14
|
+
import { validateBillCompleteness as ne, validateBillTotalIsPayable as d, validateBillTotals as re, validateBillValues as f, validateLineItems as p, validateStoredAmountDue as m } from "./index57.js";
|
|
15
|
+
import { useCallback as h, useRef as ie, useState as g } from "react";
|
|
10
16
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
17
|
+
var _ = {
|
|
18
|
+
document_id: "invoiceNumber",
|
|
19
|
+
issued_at: "invoiceDate",
|
|
20
|
+
due_date: "dueDate",
|
|
21
|
+
counterpart_id: "vendor",
|
|
22
|
+
purchase_order_number: "poNumber"
|
|
23
|
+
}, v = { tax_amount: "tax" };
|
|
24
|
+
function y(e) {
|
|
25
|
+
return e.type === "type_error.none.not_allowed" || e.msg === "none is not an allowed value";
|
|
15
26
|
}
|
|
16
|
-
var
|
|
17
|
-
|
|
18
|
-
"
|
|
19
|
-
"amount"
|
|
20
|
-
];
|
|
21
|
-
function _(e) {
|
|
22
|
-
let t = e.trim(), n = /[.,]$/.test(t) ? t.slice(0, -1) : t;
|
|
23
|
-
return t && !n ? null : n;
|
|
27
|
+
var ae = "pending-vendor";
|
|
28
|
+
function b(e) {
|
|
29
|
+
return !!t(e)?.includes("line_items_enabled");
|
|
24
30
|
}
|
|
25
|
-
function
|
|
26
|
-
|
|
27
|
-
let r = _(t);
|
|
28
|
-
if (r !== null) return o(e === "discount" ? r : "", e === "tax" ? r : "", e === "total" ? r : void 0, n)?.[e];
|
|
31
|
+
function x(e) {
|
|
32
|
+
return !!t(e)?.includes("A vendor could not be linked or created for this payable");
|
|
29
33
|
}
|
|
30
|
-
function
|
|
31
|
-
let n = {}, r = {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
for (let a of ["price", "amount"]) {
|
|
36
|
-
let o = _(e[a]);
|
|
37
|
-
o !== null && (r[a] = i(o), o && r[a] === null && (n[a] = t.unreadableMoney));
|
|
38
|
-
}
|
|
39
|
-
let o = _(e.quantity);
|
|
40
|
-
if (o !== null) {
|
|
41
|
-
let e = r.price !== null || r.amount !== null;
|
|
42
|
-
a(o) === null && (o || e) && (n.quantity = t.unusableQuantity);
|
|
34
|
+
function S(e, t = c) {
|
|
35
|
+
let n = {}, r = {}, i = [];
|
|
36
|
+
for (let a of e) {
|
|
37
|
+
let e = a.loc[0] ?? t.unknownValidationField, o = _[e], s = v[e], c = y(a) ? t.requiredField : a.msg;
|
|
38
|
+
o ? n[o] = c : s ? r[s] = c : i.push(t.unmappedValidationError(e, c));
|
|
43
39
|
}
|
|
44
|
-
return n
|
|
40
|
+
return i.length && (n.form = i.join(" ")), {
|
|
41
|
+
formErrors: n,
|
|
42
|
+
totalsErrors: Object.keys(r).length ? r : void 0
|
|
43
|
+
};
|
|
45
44
|
}
|
|
46
|
-
function
|
|
47
|
-
|
|
45
|
+
function C(e, t) {
|
|
46
|
+
if (!e && !t) return;
|
|
47
|
+
let n = {}, r = /* @__PURE__ */ new Set([...Object.keys(e ?? {}), ...Object.keys(t ?? {})]);
|
|
48
|
+
for (let i of r) n[i] = {
|
|
49
|
+
...e?.[i],
|
|
50
|
+
...t?.[i]
|
|
51
|
+
};
|
|
52
|
+
return n;
|
|
48
53
|
}
|
|
49
|
-
function
|
|
50
|
-
let
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return n?.form !== A.current && (A.current = void 0), n;
|
|
57
|
-
});
|
|
58
|
-
}, []), ne = l((e) => {
|
|
59
|
-
A.current = e, k((t) => ({
|
|
60
|
-
...t,
|
|
61
|
-
form: e
|
|
62
|
-
}));
|
|
63
|
-
}, []), j = l(() => {
|
|
64
|
-
k((e) => {
|
|
65
|
-
if (!e?.form || e.form !== A.current) return e;
|
|
66
|
-
A.current = void 0;
|
|
67
|
-
let t = { ...e };
|
|
68
|
-
return delete t.form, Object.keys(t).length ? t : void 0;
|
|
69
|
-
});
|
|
70
|
-
}, []), [re, M] = p(), [N, P] = p(), [F, I] = p(!1), [L, R] = p(!1), [z, B] = p(!1);
|
|
71
|
-
u(() => {
|
|
72
|
-
F || _(o.values);
|
|
73
|
-
}, [o]), u(() => {
|
|
74
|
-
L || S(o.lineItems);
|
|
75
|
-
}, [o]), u(() => {
|
|
76
|
-
z || (w(o.discount), E(o.tax), O(o.total || void 0));
|
|
77
|
-
}, [o]);
|
|
78
|
-
let ie = l((e) => {
|
|
79
|
-
_((t) => ({
|
|
80
|
-
...t,
|
|
81
|
-
...e
|
|
82
|
-
})), I(!0), k((t) => {
|
|
83
|
-
if (!t) return t;
|
|
84
|
-
let n = { ...t };
|
|
85
|
-
for (let t of Object.keys(e)) delete n[t];
|
|
86
|
-
return Object.keys(n).length ? n : void 0;
|
|
87
|
-
}), j();
|
|
88
|
-
}, [j]), V = l((e, t) => {
|
|
89
|
-
M((n) => {
|
|
90
|
-
if (!n?.[e] && !t) return n;
|
|
91
|
-
let r = {
|
|
92
|
-
...n,
|
|
93
|
-
[e]: t
|
|
94
|
-
};
|
|
95
|
-
return t || delete r[e], Object.keys(r).length ? r : void 0;
|
|
96
|
-
});
|
|
97
|
-
}, []), H = l((e, t) => {
|
|
98
|
-
V(e, v(e, t, a));
|
|
99
|
-
}, [a, V]), U = l(() => {
|
|
100
|
-
O(void 0), H("total", void 0), j();
|
|
101
|
-
}, [H, j]), W = l((e, t = []) => {
|
|
102
|
-
let n = y(e, a);
|
|
103
|
-
P((r) => {
|
|
104
|
-
let i = r?.[e.id], a = { ...i };
|
|
105
|
-
for (let e of [
|
|
106
|
-
"price",
|
|
107
|
-
"amount",
|
|
108
|
-
"quantity"
|
|
109
|
-
]) n[e] ? a[e] = n[e] : delete a[e];
|
|
110
|
-
t.includes("description") && delete a.description;
|
|
111
|
-
let o = Object.keys(a).length > 0;
|
|
112
|
-
if (!i && !o) return r;
|
|
113
|
-
let s = { ...r };
|
|
114
|
-
return o ? s[e.id] = a : delete s[e.id], Object.keys(s).length ? s : void 0;
|
|
115
|
-
});
|
|
116
|
-
}, [a]), G = l((e, t, n) => {
|
|
117
|
-
P((r) => ({
|
|
118
|
-
...r,
|
|
119
|
-
[e]: {
|
|
120
|
-
...r?.[e],
|
|
121
|
-
[t]: n
|
|
122
|
-
}
|
|
123
|
-
}));
|
|
124
|
-
}, []), K = l((e, t, n = []) => {
|
|
125
|
-
let r = x.find((t) => t.id === e);
|
|
126
|
-
if (!r) return;
|
|
127
|
-
let i = t(r);
|
|
128
|
-
S(x.map((t) => t.id === e ? i : t)), W(i, n), R(!0), U();
|
|
54
|
+
function w({ payableId: t, form: _, counterpartId: v, isVendorPending: y, clearCounterpart: w, prepareVendorForSave: T, onSaved: E, onPayableCreated: D, readSavedStatus: O, onDraftSaved: k, onFinalized: A, labels: j }) {
|
|
55
|
+
let M = {
|
|
56
|
+
...c,
|
|
57
|
+
...j
|
|
58
|
+
}, [N, P] = g(), F = t ?? N, [I, L] = g(), R = h(() => L(void 0), []), [z, B] = g(!1), oe = h(() => B(!0), []), [V, H] = g(), U = ie(!1), [se, ce] = g(0), W = h(() => ce((e) => e + 1), []), G = r(), K = i(), q = o(), J = n(), Y = s(), X = a(), Z = h(() => _.isTotalsDirty ? re(_.discount, _.tax, _.totalOverride, M) : void 0, [_, M]), Q = h(() => {
|
|
59
|
+
let t = f(_.values, M), n = p(_.lineItems, M), r = Z();
|
|
60
|
+
return _.setErrors(t), _.setLineItemErrors(n), _.setTotalsErrors(r), !t && !n && !r || (n && e.error(M.lineItemsNeedAttention), W(), !1);
|
|
129
61
|
}, [
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
W
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
62
|
+
_,
|
|
63
|
+
M,
|
|
64
|
+
W,
|
|
65
|
+
Z
|
|
66
|
+
]), $ = h(async (e, t) => {
|
|
67
|
+
let n = !F && I ? {
|
|
68
|
+
base64EncodedFile: await l(I),
|
|
69
|
+
fileName: I.name
|
|
70
|
+
} : void 0, r = _.isTotalsDirty ? {
|
|
71
|
+
discount: _.discount,
|
|
72
|
+
tax: _.tax,
|
|
73
|
+
total: _.totalOverride
|
|
74
|
+
} : void 0, i = u({
|
|
75
|
+
values: _.values,
|
|
76
|
+
initialLineItems: F ? void 0 : _.lineItems,
|
|
77
|
+
counterpartId: t ?? v,
|
|
78
|
+
clearCounterpart: w,
|
|
79
|
+
counterpartBankAccountId: e,
|
|
80
|
+
currentTotals: {
|
|
81
|
+
discount: _.discount,
|
|
82
|
+
tax: _.tax,
|
|
83
|
+
total: _.totalOverride
|
|
84
|
+
},
|
|
85
|
+
lineItems: _.lineItems,
|
|
86
|
+
editedTotals: r,
|
|
87
|
+
document: n
|
|
88
|
+
}), a = F;
|
|
89
|
+
if (a ? await q.mutateAsync({
|
|
90
|
+
path: { payable_id: a },
|
|
91
|
+
body: i
|
|
92
|
+
}) : (a = (await G.mutateAsync({ body: i }))?.id, a && (P(a), D?.(a), n && L(void 0))), !a) throw Error("Payable was created without an id");
|
|
93
|
+
if (z) {
|
|
94
|
+
try {
|
|
95
|
+
await K.mutateAsync({ path: { payable_id: a } });
|
|
96
|
+
} catch {}
|
|
97
|
+
B(!1);
|
|
144
98
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
},
|
|
99
|
+
return await J.mutateAsync({
|
|
100
|
+
path: { payable_id: a },
|
|
101
|
+
body: { data: ee(_.lineItems) }
|
|
102
|
+
}), r && await q.mutateAsync({
|
|
103
|
+
path: { payable_id: a },
|
|
104
|
+
body: te({
|
|
105
|
+
lineItems: _.lineItems,
|
|
106
|
+
editedTotals: r
|
|
107
|
+
})
|
|
108
|
+
}), a;
|
|
155
109
|
}, [
|
|
110
|
+
v,
|
|
111
|
+
w,
|
|
112
|
+
G,
|
|
156
113
|
K,
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
let n = Number.parseFloat(e.quantity), r = String(Math.max(1, (Number.isFinite(n) ? n : 0) + t));
|
|
167
|
-
return {
|
|
168
|
-
...e,
|
|
169
|
-
quantity: r,
|
|
170
|
-
amount: b(r, e.price, e.amount)
|
|
171
|
-
};
|
|
172
|
-
});
|
|
173
|
-
}, [K]), X = l((e) => {
|
|
174
|
-
P((t) => {
|
|
175
|
-
if (!t?.[e]) return t;
|
|
176
|
-
let n = { ...t };
|
|
177
|
-
return delete n[e], Object.keys(n).length ? n : void 0;
|
|
178
|
-
});
|
|
179
|
-
}, []), Z = l((e) => {
|
|
180
|
-
X(e), S((t) => t.length <= 1 ? t : t.filter((t) => t.id !== e)), R(!0), U();
|
|
181
|
-
}, [X, U]), ae = l(() => {
|
|
182
|
-
S((e) => [...e, s()]), R(!0), U();
|
|
183
|
-
}, [U]), Q = l((e, t, n) => {
|
|
184
|
-
let r = h(t);
|
|
185
|
-
if (r === null) {
|
|
186
|
-
V(e, a.numbersOnly);
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
n(r), B(!0), U(), H(e, r);
|
|
190
|
-
}, [
|
|
191
|
-
U,
|
|
192
|
-
a,
|
|
193
|
-
H,
|
|
194
|
-
V
|
|
195
|
-
]), oe = l((e) => Q("discount", e, w), [Q]), se = l((e) => Q("tax", e, E), [Q]), $ = l(() => w((e) => r(e)), []), ce = l(() => E((e) => r(e)), []), le = l((e) => {
|
|
196
|
-
let t = h(e);
|
|
197
|
-
if (t === null) {
|
|
198
|
-
V("total", a.numbersOnly);
|
|
199
|
-
return;
|
|
200
|
-
}
|
|
201
|
-
O(t), B(!0), H("total", t), j();
|
|
202
|
-
}, [
|
|
203
|
-
j,
|
|
204
|
-
a,
|
|
205
|
-
H,
|
|
206
|
-
V
|
|
207
|
-
]), ue = l(() => {
|
|
208
|
-
O((e) => e === void 0 ? e : r(e));
|
|
209
|
-
}, []), de = d(() => x.map((e) => ({
|
|
210
|
-
...e,
|
|
211
|
-
onChange: (t) => q(e.id, t),
|
|
212
|
-
onBlur: (t) => J(e.id, t),
|
|
213
|
-
onQuantityStep: (t) => Y(e.id, t),
|
|
214
|
-
onRemove: () => Z(e.id)
|
|
215
|
-
})), [
|
|
114
|
+
z,
|
|
115
|
+
_.discount,
|
|
116
|
+
_.isTotalsDirty,
|
|
117
|
+
_.lineItems,
|
|
118
|
+
_.tax,
|
|
119
|
+
_.totalOverride,
|
|
120
|
+
_.values,
|
|
121
|
+
D,
|
|
122
|
+
F,
|
|
216
123
|
J,
|
|
217
|
-
|
|
218
|
-
q
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
x,
|
|
223
|
-
T,
|
|
224
|
-
C
|
|
225
|
-
]);
|
|
124
|
+
I,
|
|
125
|
+
q
|
|
126
|
+
]), le = h(async () => {
|
|
127
|
+
F && (await K.mutateAsync({ path: { payable_id: F } }), B(!1));
|
|
128
|
+
}, [K, F]);
|
|
226
129
|
return {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
130
|
+
saveDraft: h(async () => {
|
|
131
|
+
if (!U.current && Q()) {
|
|
132
|
+
U.current = !0, H("draft");
|
|
133
|
+
try {
|
|
134
|
+
let t = await T?.();
|
|
135
|
+
if (t && !t.ok) return;
|
|
136
|
+
let n = await $(t?.counterpartBankAccountId, t?.counterpartId);
|
|
137
|
+
_.setErrors(void 0), E?.(n), k?.(n);
|
|
138
|
+
let r = await O?.();
|
|
139
|
+
return e.success(r === "draft" ? M.submittedDemoted : M.draftSaved), n;
|
|
140
|
+
} catch (e) {
|
|
141
|
+
_.setSaveFailureMessage(b(e) ? M.discountTaxBlockedByLineItems : M.saveFailed), W();
|
|
142
|
+
return;
|
|
143
|
+
} finally {
|
|
144
|
+
H(void 0), U.current = !1;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}, [
|
|
148
|
+
_,
|
|
149
|
+
Q,
|
|
150
|
+
M.discountTaxBlockedByLineItems,
|
|
151
|
+
M.draftSaved,
|
|
152
|
+
M.saveFailed,
|
|
153
|
+
M.submittedDemoted,
|
|
154
|
+
k,
|
|
155
|
+
E,
|
|
156
|
+
O,
|
|
157
|
+
T,
|
|
158
|
+
$,
|
|
159
|
+
W
|
|
160
|
+
]),
|
|
161
|
+
finalize: h(async () => {
|
|
162
|
+
if (U.current) return;
|
|
163
|
+
let t = p(_.lineItems, M), n = f(_.values, M), r = Z(), i = d(_.total, M), a = _.isTotalsDirty ? m(_.totalOverride, M) : void 0, o = r || i || a ? {
|
|
164
|
+
...a,
|
|
165
|
+
...i,
|
|
166
|
+
...r
|
|
167
|
+
} : void 0, { formErrors: s, lineItemErrors: c } = ne(_.values, v ?? (y ? ae : void 0), _.lineItems, M), l = C(c, t);
|
|
168
|
+
_.setLineItemErrors(l), _.setTotalsErrors(o);
|
|
169
|
+
let u = {
|
|
170
|
+
...s,
|
|
171
|
+
...n
|
|
172
|
+
};
|
|
173
|
+
if (_.setErrors(Object.keys(u).length ? u : void 0), t && e.error(M.lineItemsNeedAttention), l || o || Object.keys(u).length) {
|
|
174
|
+
W();
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
U.current = !0, H("finalize");
|
|
178
|
+
try {
|
|
179
|
+
let t;
|
|
180
|
+
try {
|
|
181
|
+
let e = await T?.();
|
|
182
|
+
if (e && !e.ok) return;
|
|
183
|
+
t = await $(e?.counterpartBankAccountId, e?.counterpartId);
|
|
184
|
+
} catch (e) {
|
|
185
|
+
_.setSaveFailureMessage(b(e) ? M.discountTaxBlockedByLineItems : M.saveFailed), W();
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
E?.(t);
|
|
189
|
+
try {
|
|
190
|
+
let n = await Y.mutateAsync({ path: { payable_id: t } });
|
|
191
|
+
if (n.validation_errors.length) {
|
|
192
|
+
let e = S(n.validation_errors, M);
|
|
193
|
+
_.setErrors(e.formErrors), _.setTotalsErrors(e.totalsErrors), W();
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
await X.mutateAsync({ path: { payable_id: t } }), _.setErrors(void 0), A?.(t), e.success(M.billFinalized);
|
|
197
|
+
} catch (e) {
|
|
198
|
+
x(e) ? _.setErrors({ vendor: M.vendorResolutionFailed }) : _.setSaveFailureMessage(M.finalizeFailed), W();
|
|
199
|
+
}
|
|
200
|
+
} finally {
|
|
201
|
+
H(void 0), U.current = !1;
|
|
202
|
+
}
|
|
203
|
+
}, [
|
|
204
|
+
v,
|
|
205
|
+
y,
|
|
206
|
+
_,
|
|
207
|
+
M,
|
|
208
|
+
A,
|
|
209
|
+
E,
|
|
210
|
+
T,
|
|
211
|
+
$,
|
|
212
|
+
W,
|
|
213
|
+
X,
|
|
214
|
+
Z,
|
|
215
|
+
Y
|
|
216
|
+
]),
|
|
217
|
+
payableId: F,
|
|
218
|
+
isSavingDraft: V === "draft",
|
|
219
|
+
isFinalizing: V === "finalize",
|
|
220
|
+
stagedFile: I,
|
|
221
|
+
stageFile: L,
|
|
222
|
+
clearStagedFile: R,
|
|
223
|
+
scrollToErrorToken: se,
|
|
224
|
+
isFileDeletionPending: z,
|
|
225
|
+
requestFileDeletion: oe,
|
|
226
|
+
detachFileNow: le,
|
|
227
|
+
isDeletingFile: K.isPending,
|
|
228
|
+
hasFileDeletionFailed: K.isError
|
|
251
229
|
};
|
|
252
230
|
}
|
|
253
231
|
//#endregion
|
|
254
|
-
export {
|
|
232
|
+
export { S as mapValidationErrorsToForm, w as useBillCreateController };
|
|
@@ -1,23 +1,46 @@
|
|
|
1
|
+
import { resolveLineItemAmountMinorUnits as e } from "./index42.js";
|
|
2
|
+
import { resolveLineItemQuantity as t } from "./index43.js";
|
|
1
3
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
4
|
+
function n() {
|
|
5
|
+
return {
|
|
6
|
+
id: crypto.randomUUID(),
|
|
7
|
+
description: "",
|
|
8
|
+
glCode: "",
|
|
9
|
+
quantity: "1",
|
|
10
|
+
price: "",
|
|
11
|
+
amount: ""
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
function r(e) {
|
|
15
|
+
return typeof e == "number" ? (e / 100).toFixed(2) : "";
|
|
16
|
+
}
|
|
17
|
+
function i(e) {
|
|
18
|
+
return typeof e == "string" ? e : "";
|
|
19
|
+
}
|
|
20
|
+
function a(e) {
|
|
21
|
+
return e.total_amount ?? e.amount_due ?? void 0;
|
|
22
|
+
}
|
|
23
|
+
function o({ payable: o, lineItems: s }) {
|
|
24
|
+
let c = {
|
|
25
|
+
invoiceNumber: o.document_id ?? "",
|
|
26
|
+
invoiceDate: o.issued_at ?? "",
|
|
27
|
+
dueDate: o.due_date ?? "",
|
|
28
|
+
poNumber: i(o.purchase_order_number)
|
|
29
|
+
}, l = s.map((n) => ({
|
|
30
|
+
id: n.id,
|
|
31
|
+
description: n.name ?? "",
|
|
32
|
+
glCode: n.ledger_account_id ?? "",
|
|
33
|
+
quantity: String(t(n)),
|
|
34
|
+
price: r(n.unit_price),
|
|
35
|
+
amount: r(e(n))
|
|
36
|
+
})), u = a(o);
|
|
37
|
+
return {
|
|
38
|
+
values: c,
|
|
39
|
+
lineItems: l.length ? l : [n()],
|
|
40
|
+
discount: r(o.discount),
|
|
41
|
+
tax: r(o.tax_amount),
|
|
42
|
+
total: u ? r(u) : ""
|
|
43
|
+
};
|
|
44
|
+
}
|
|
22
45
|
//#endregion
|
|
23
|
-
export {
|
|
46
|
+
export { n as emptyLineItem, o as mapPayableToBillForm };
|