@tesouro/embedded-components-react 0.5.279 → 0.5.281
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.css +8 -0
- package/dist/index.d.ts +23 -8
- package/dist/lib/BankAccountOnboardingWidget.d.ts +2 -2
- package/dist/lib/ReceivablesWidget.d.ts +21 -6
- package/dist/lib/WidgetSuite.d.ts +2 -2
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/BankAccountOnboardingWidget/labels.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index30.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index18.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index.js +6 -6
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index13.js +8 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index14.js +7 -28
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index15.js +8 -160
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index16.js +20 -13
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index17.js +148 -27
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index18.js +21 -96
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index19.js +37 -79
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index20.js +98 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index21.js +83 -54
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index22.js +3 -113
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index23.js +54 -184
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index24.js +108 -75
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index25.js +181 -29
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index26.js +74 -83
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index27.js +27 -412
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index28.js +88 -12
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index29.js +413 -77
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index30.js +13 -80
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index31.js +77 -226
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index32.js +78 -41
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index33.js +216 -234
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index34.js +44 -23
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index35.js +233 -611
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index36.js +25 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index37.js +647 -39
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index38.js +4 -243
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index39.js +42 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index40.js +250 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index41.js +2 -66
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index42.js +5 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index43.js +67 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index44.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index12.js +11 -11
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index15.js +47 -47
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/lib/invalidatePayableQueries/invalidatePayableQueries.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/lib/invalidatePayableQueries/reconcileCancelledPaymentQueries.js +19 -19
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidgetNative/BillsTab.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/pay-bill/data-access/dist/index4.js +15 -15
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index.js +14 -13
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index10.js +24 -168
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index11.js +173 -44
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index12.js +42 -94
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index13.js +91 -76
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index14.js +67 -173
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index15.js +186 -17
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index16.js +27 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index3.js +11 -13
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index4.js +42 -27
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index5.js +28 -132
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index6.js +137 -16
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index7.js +16 -62
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index8.js +66 -28
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index9.js +28 -34
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivableAttachmentsSection.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivableCustomerSection.js +38 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +304 -287
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/auditHistory/labels.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/customer.js +58 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/helpers.js +15 -15
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/labels.js +14 -6
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/paymentTerms.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/permissions.js +2 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/preview.js +62 -62
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/recurrence.js +41 -35
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/reminders.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/totals.js +21 -13
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActions.js +124 -124
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActionsModal.js +11 -11
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableAttachmentUploads.js +13 -13
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableBankAccount.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableCustomerPicker.js +109 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableDetails.js +6 -6
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableForm.js +520 -476
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableIssuePreflight.js +10 -10
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablePaymentRecord.js +6 -6
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablePaymentTerms.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablePreview.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableRecurrence.js +92 -77
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableReminders.js +11 -11
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableStatusCards.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesTable.js +4 -4
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesWidget.js +79 -75
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useSendReceivableWithPaymentLink.js +3 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +26 -23
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index12.js +9 -25
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +26 -228
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index14.js +227 -52
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index15.js +50 -212
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index16.js +193 -138
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index17.js +157 -12
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index18.js +10 -19
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index19.js +23 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index20.js +2 -116
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index21.js +118 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index22.js +3 -39
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index23.js +209 -53
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index24.js +2 -23
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index25.js +36 -7
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index26.js +53 -77
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index27.js +17 -35
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index28.js +8 -18
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index29.js +73 -37
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index30.js +36 -26
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index31.js +17 -19
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index32.js +39 -8
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index33.js +26 -33
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index34.js +20 -14
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index35.js +8 -24
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index36.js +34 -84
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index37.js +14 -492
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index38.js +28 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index39.js +79 -39
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index40.js +490 -68
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index41.js +2 -487
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index42.js +41 -217
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index43.js +70 -21
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index44.js +440 -5
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index45.js +224 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index46.js +21 -263
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index47.js +8 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index49.js +261 -24
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index50.js +2 -237
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index51.js +100 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index52.js +21 -242
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index53.js +226 -82
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index54.js +3 -60
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index55.js +233 -178
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index56.js +85 -37
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index57.js +60 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index58.js +194 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index59.js +45 -0
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/index.js +9 -9
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/CounterpartSelector.js +2 -23
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useCounterpartSelector.js +2 -51
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index.js +8 -8
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index15.js +4 -80
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index2.js +10 -22
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/zod.gen.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/user/useAllOrganizationUsersQuery.js +1 -0
- 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/ui/dist/lib/OnboardingShell/OnboardingShell.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/OnboardingShell/labels.js +2 -2
- package/package.json +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index48.js +0 -100
|
@@ -2,253 +2,235 @@
|
|
|
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 { extractApiErrorMessage as t } from "../../../../shared/util/dist/lib/apiErrors.js";
|
|
7
|
+
import "../../../../shared/ui/dist/index.js";
|
|
8
|
+
import { BILL_CREATE_MESSAGE_LABELS_EN as n } from "./index25.js";
|
|
9
|
+
import { encodeFileToBase64 as r } from "./index30.js";
|
|
10
|
+
import { mapBillFormToPayload as i, mapLineItemsToPayload as a, mapPayableAmountFieldsToPayload as o } from "./index31.js";
|
|
11
|
+
import { validateBillCompleteness as s, validateBillTotalIsPayable as c, validateBillTotals as l, validateBillValues as u, validateLineItems as d, validateStoredAmountDue as ee } from "./index32.js";
|
|
12
|
+
import { useReplacePayableLineItemsMutation as f } from "../../data-access/dist/index4.js";
|
|
13
|
+
import { useCreatePayableMutation as p } from "../../data-access/dist/index8.js";
|
|
14
|
+
import { useDeletePayableFileMutation as m } from "../../data-access/dist/index9.js";
|
|
15
|
+
import { useSubmitPayableForApprovalMutation as te } from "../../data-access/dist/index14.js";
|
|
16
|
+
import { useUpdatePayableMutation as h } from "../../data-access/dist/index15.js";
|
|
17
|
+
import { useValidatePayableMutation as g } from "../../data-access/dist/index16.js";
|
|
18
|
+
import "../../data-access/dist/index.js";
|
|
19
|
+
import { useCallback as _, useRef as ne, useState as v } from "react";
|
|
10
20
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index33.js
|
|
11
|
-
var
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
21
|
+
var y = {
|
|
22
|
+
document_id: "invoiceNumber",
|
|
23
|
+
issued_at: "invoiceDate",
|
|
24
|
+
due_date: "dueDate",
|
|
25
|
+
counterpart_id: "vendor",
|
|
26
|
+
purchase_order_number: "poNumber"
|
|
27
|
+
}, b = { tax_amount: "tax" };
|
|
28
|
+
function x(e) {
|
|
29
|
+
return e.type === "type_error.none.not_allowed" || e.msg === "none is not an allowed value";
|
|
15
30
|
}
|
|
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;
|
|
31
|
+
var re = "pending-vendor";
|
|
32
|
+
function S(e) {
|
|
33
|
+
return !!t(e)?.includes("line_items_enabled");
|
|
24
34
|
}
|
|
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];
|
|
35
|
+
function C(e) {
|
|
36
|
+
return !!t(e)?.includes("A vendor could not be linked or created for this payable");
|
|
29
37
|
}
|
|
30
|
-
function
|
|
31
|
-
let
|
|
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);
|
|
38
|
+
function w(e, t = n) {
|
|
39
|
+
let r = {}, i = {}, a = [];
|
|
40
|
+
for (let n of e) {
|
|
41
|
+
let e = n.loc[0] ?? t.unknownValidationField, o = y[e], s = b[e], c = x(n) ? t.requiredField : n.msg;
|
|
42
|
+
o ? r[o] = c : s ? i[s] = c : a.push(t.unmappedValidationError(e, c));
|
|
43
43
|
}
|
|
44
|
-
return
|
|
44
|
+
return a.length && (r.form = a.join(" ")), {
|
|
45
|
+
formErrors: r,
|
|
46
|
+
totalsErrors: Object.keys(i).length ? i : void 0
|
|
47
|
+
};
|
|
45
48
|
}
|
|
46
|
-
function
|
|
47
|
-
|
|
49
|
+
function ie(e, t) {
|
|
50
|
+
if (!e && !t) return;
|
|
51
|
+
let n = {}, r = /* @__PURE__ */ new Set([...Object.keys(e ?? {}), ...Object.keys(t ?? {})]);
|
|
52
|
+
for (let i of r) n[i] = {
|
|
53
|
+
...e?.[i],
|
|
54
|
+
...t?.[i]
|
|
55
|
+
};
|
|
56
|
+
return n;
|
|
48
57
|
}
|
|
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();
|
|
58
|
+
function T({ payableId: t, form: y, counterpartId: b, isVendorPending: x, clearCounterpart: T, prepareVendorForSave: E, onSaved: D, onPayableCreated: O, readSavedStatus: k, onDraftSaved: A, onFinalized: j, labels: M }) {
|
|
59
|
+
let N = {
|
|
60
|
+
...n,
|
|
61
|
+
...M
|
|
62
|
+
}, [P, F] = v(), I = t ?? P, [L, R] = v(), ae = _(() => R(void 0), []), [z, B] = v(!1), oe = _(() => B(!0), []), [V, H] = v(), U = ne(!1), [se, ce] = v(0), W = _(() => ce((e) => e + 1), []), G = p(), K = m(), q = h(), J = f(), Y = g(), X = te(), Z = _(() => y.isTotalsDirty ? l(y.discount, y.tax, y.totalOverride, N) : void 0, [y, N]), Q = _(() => {
|
|
63
|
+
let t = u(y.values, N), n = d(y.lineItems, N), r = Z();
|
|
64
|
+
return y.setErrors(t), y.setLineItemErrors(n), y.setTotalsErrors(r), !t && !n && !r || (n && e.error(N.lineItemsNeedAttention), W(), !1);
|
|
129
65
|
}, [
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
W
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
66
|
+
y,
|
|
67
|
+
N,
|
|
68
|
+
W,
|
|
69
|
+
Z
|
|
70
|
+
]), $ = _(async (e, t) => {
|
|
71
|
+
let n = !I && L ? {
|
|
72
|
+
base64EncodedFile: await r(L),
|
|
73
|
+
fileName: L.name
|
|
74
|
+
} : void 0, s = y.isTotalsDirty ? {
|
|
75
|
+
discount: y.discount,
|
|
76
|
+
tax: y.tax,
|
|
77
|
+
total: y.totalOverride
|
|
78
|
+
} : void 0, c = i({
|
|
79
|
+
values: y.values,
|
|
80
|
+
initialLineItems: I ? void 0 : y.lineItems,
|
|
81
|
+
counterpartId: t ?? b,
|
|
82
|
+
clearCounterpart: T,
|
|
83
|
+
counterpartBankAccountId: e,
|
|
84
|
+
currentTotals: {
|
|
85
|
+
discount: y.discount,
|
|
86
|
+
tax: y.tax,
|
|
87
|
+
total: y.totalOverride
|
|
88
|
+
},
|
|
89
|
+
lineItems: y.lineItems,
|
|
90
|
+
editedTotals: s,
|
|
91
|
+
document: n
|
|
92
|
+
}), l = I;
|
|
93
|
+
if (l ? await q.mutateAsync({
|
|
94
|
+
path: { payable_id: l },
|
|
95
|
+
body: c
|
|
96
|
+
}) : (l = (await G.mutateAsync({ body: c }))?.id, l && (F(l), O?.(l), n && R(void 0))), !l) throw Error("Payable was created without an id");
|
|
97
|
+
if (z) {
|
|
98
|
+
try {
|
|
99
|
+
await K.mutateAsync({ path: { payable_id: l } });
|
|
100
|
+
} catch {}
|
|
101
|
+
B(!1);
|
|
144
102
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
},
|
|
103
|
+
return await J.mutateAsync({
|
|
104
|
+
path: { payable_id: l },
|
|
105
|
+
body: { data: a(y.lineItems) }
|
|
106
|
+
}), s && await q.mutateAsync({
|
|
107
|
+
path: { payable_id: l },
|
|
108
|
+
body: o({
|
|
109
|
+
lineItems: y.lineItems,
|
|
110
|
+
editedTotals: s
|
|
111
|
+
})
|
|
112
|
+
}), l;
|
|
155
113
|
}, [
|
|
114
|
+
b,
|
|
115
|
+
T,
|
|
116
|
+
G,
|
|
156
117
|
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
|
-
})), [
|
|
118
|
+
z,
|
|
119
|
+
y.discount,
|
|
120
|
+
y.isTotalsDirty,
|
|
121
|
+
y.lineItems,
|
|
122
|
+
y.tax,
|
|
123
|
+
y.totalOverride,
|
|
124
|
+
y.values,
|
|
125
|
+
O,
|
|
126
|
+
I,
|
|
216
127
|
J,
|
|
217
|
-
|
|
218
|
-
q
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
x,
|
|
223
|
-
T,
|
|
224
|
-
C
|
|
225
|
-
]);
|
|
128
|
+
L,
|
|
129
|
+
q
|
|
130
|
+
]), le = _(async () => {
|
|
131
|
+
I && (await K.mutateAsync({ path: { payable_id: I } }), B(!1));
|
|
132
|
+
}, [K, I]);
|
|
226
133
|
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
|
-
|
|
134
|
+
saveDraft: _(async () => {
|
|
135
|
+
if (!U.current && Q()) {
|
|
136
|
+
U.current = !0, H("draft");
|
|
137
|
+
try {
|
|
138
|
+
let t = await E?.();
|
|
139
|
+
if (t && !t.ok) return;
|
|
140
|
+
let n = await $(t?.counterpartBankAccountId, t?.counterpartId);
|
|
141
|
+
y.setErrors(void 0), D?.(n), A?.(n);
|
|
142
|
+
let r = await k?.();
|
|
143
|
+
return e.success(r === "draft" ? N.submittedDemoted : N.draftSaved), n;
|
|
144
|
+
} catch (e) {
|
|
145
|
+
y.setSaveFailureMessage(S(e) ? N.discountTaxBlockedByLineItems : N.saveFailed), W();
|
|
146
|
+
return;
|
|
147
|
+
} finally {
|
|
148
|
+
H(void 0), U.current = !1;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}, [
|
|
152
|
+
y,
|
|
153
|
+
Q,
|
|
154
|
+
N.discountTaxBlockedByLineItems,
|
|
155
|
+
N.draftSaved,
|
|
156
|
+
N.saveFailed,
|
|
157
|
+
N.submittedDemoted,
|
|
158
|
+
A,
|
|
159
|
+
D,
|
|
160
|
+
k,
|
|
161
|
+
E,
|
|
162
|
+
$,
|
|
163
|
+
W
|
|
164
|
+
]),
|
|
165
|
+
finalize: _(async () => {
|
|
166
|
+
if (U.current) return;
|
|
167
|
+
let t = d(y.lineItems, N), n = u(y.values, N), r = Z(), i = c(y.total, N), a = y.isTotalsDirty ? ee(y.totalOverride, N) : void 0, o = r || i || a ? {
|
|
168
|
+
...a,
|
|
169
|
+
...i,
|
|
170
|
+
...r
|
|
171
|
+
} : void 0, { formErrors: l, lineItemErrors: f } = s(y.values, b ?? (x ? re : void 0), y.lineItems, N), p = ie(f, t);
|
|
172
|
+
y.setLineItemErrors(p), y.setTotalsErrors(o);
|
|
173
|
+
let m = {
|
|
174
|
+
...l,
|
|
175
|
+
...n
|
|
176
|
+
};
|
|
177
|
+
if (y.setErrors(Object.keys(m).length ? m : void 0), t && e.error(N.lineItemsNeedAttention), p || o || Object.keys(m).length) {
|
|
178
|
+
W();
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
U.current = !0, H("finalize");
|
|
182
|
+
try {
|
|
183
|
+
let t;
|
|
184
|
+
try {
|
|
185
|
+
let e = await E?.();
|
|
186
|
+
if (e && !e.ok) return;
|
|
187
|
+
t = await $(e?.counterpartBankAccountId, e?.counterpartId);
|
|
188
|
+
} catch (e) {
|
|
189
|
+
y.setSaveFailureMessage(S(e) ? N.discountTaxBlockedByLineItems : N.saveFailed), W();
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
D?.(t);
|
|
193
|
+
try {
|
|
194
|
+
let n = await Y.mutateAsync({ path: { payable_id: t } });
|
|
195
|
+
if (n.validation_errors.length) {
|
|
196
|
+
let e = w(n.validation_errors, N);
|
|
197
|
+
y.setErrors(e.formErrors), y.setTotalsErrors(e.totalsErrors), W();
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
await X.mutateAsync({ path: { payable_id: t } }), y.setErrors(void 0), j?.(t), e.success(N.billFinalized);
|
|
201
|
+
} catch (e) {
|
|
202
|
+
C(e) ? y.setErrors({ vendor: N.vendorResolutionFailed }) : y.setSaveFailureMessage(N.finalizeFailed), W();
|
|
203
|
+
}
|
|
204
|
+
} finally {
|
|
205
|
+
H(void 0), U.current = !1;
|
|
206
|
+
}
|
|
207
|
+
}, [
|
|
208
|
+
b,
|
|
209
|
+
x,
|
|
210
|
+
y,
|
|
211
|
+
N,
|
|
212
|
+
j,
|
|
213
|
+
D,
|
|
214
|
+
E,
|
|
215
|
+
$,
|
|
216
|
+
W,
|
|
217
|
+
X,
|
|
218
|
+
Z,
|
|
219
|
+
Y
|
|
220
|
+
]),
|
|
221
|
+
payableId: I,
|
|
222
|
+
isSavingDraft: V === "draft",
|
|
223
|
+
isFinalizing: V === "finalize",
|
|
224
|
+
stagedFile: L,
|
|
225
|
+
stageFile: R,
|
|
226
|
+
clearStagedFile: ae,
|
|
227
|
+
scrollToErrorToken: se,
|
|
228
|
+
isFileDeletionPending: z,
|
|
229
|
+
requestFileDeletion: oe,
|
|
230
|
+
detachFileNow: le,
|
|
231
|
+
isDeletingFile: K.isPending,
|
|
232
|
+
hasFileDeletionFailed: K.isError
|
|
251
233
|
};
|
|
252
234
|
}
|
|
253
235
|
//#endregion
|
|
254
|
-
export {
|
|
236
|
+
export { w as mapValidationErrorsToForm, T as useBillCreateController };
|
|
@@ -1,25 +1,46 @@
|
|
|
1
|
+
import { resolveLineItemAmountMinorUnits as e } from "../../../util/dist/lib/resolveLineItemAmount.js";
|
|
2
|
+
import { resolveLineItemQuantity as t } from "../../../util/dist/lib/resolveLineItemQuantity.js";
|
|
1
3
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index34.js
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
+
}
|
|
24
45
|
//#endregion
|
|
25
|
-
export {
|
|
46
|
+
export { n as emptyLineItem, o as mapPayableToBillForm };
|