@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
|
@@ -1,87 +1,423 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import { toast as e } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
6
|
+
import { hasAnyScope as t } from "../../../../shared/data-access/dist/lib/hasAnyScope.js";
|
|
7
|
+
import { Scope as n } from "../../../../shared/data-access/dist/lib/scopes.js";
|
|
8
|
+
import "../../../../shared/data-access/dist/index.js";
|
|
9
|
+
import "../../../../shared/ui/dist/index.js";
|
|
10
|
+
import { useWidgetConfig as r } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
11
|
+
import "../../../../shared/feature/dist/index.js";
|
|
12
|
+
import { VENDOR_SECTION_PROPS_LABELS_EN as i } from "./index25.js";
|
|
13
|
+
import { usePayableSuggestionsQuery as ee } from "../../data-access/dist/index19.js";
|
|
14
|
+
import "../../data-access/dist/index.js";
|
|
15
|
+
import { resolvePaymentInstructionsGestures as a } from "./index14.js";
|
|
16
|
+
import { buildVendorPrefill as o } from "./index27.js";
|
|
17
|
+
import { COUNTERPART_MESSAGE_LABELS_EN as te } from "../../../../shared/counterpart-management/feature/dist/lib/labels.js";
|
|
18
|
+
import { counterpartFormBankAccountToCreatePayload as ne, counterpartFormBankAccountToUpdatePayload as re, getAchInstructions as ie, getCounterpartEmail as s, getCounterpartName as c, getPayableAchInstructions as ae, isAchCompatibleBankAccount as l, resolveCounterpartBankAccountWrite as oe, validateAchFormValues as se } from "../../../../shared/counterpart-management/feature/dist/lib/helpers.js";
|
|
19
|
+
import { useCounterpartsQuery as ce } from "../../../../shared/counterpart-management/data-access/dist/index3.js";
|
|
20
|
+
import { useCreateCounterpartBankAccountMutation as le, useUpdateCounterpartBankAccountMutation as ue } from "../../../../shared/counterpart-management/data-access/dist/index5.js";
|
|
21
|
+
import { useCounterpartDetails as de } from "../../../../shared/counterpart-management/feature/dist/lib/useCounterpartDetails.js";
|
|
22
|
+
import { useCounterpartForm as fe } from "../../../../shared/counterpart-management/feature/dist/lib/useCounterpartForm.js";
|
|
23
|
+
import "../../../../shared/counterpart-management/feature/dist/index.js";
|
|
24
|
+
import { VendorInlineForm as pe } from "./index28.js";
|
|
25
|
+
import { useCallback as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
|
|
26
|
+
import { jsx as me } from "react/jsx-runtime";
|
|
2
27
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index29.js
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return !!(e.description.trim() || e.glCode.trim() || n(e.price) !== null || n(e.amount) !== null);
|
|
15
|
-
}
|
|
16
|
-
function a(e) {
|
|
17
|
-
return n(e) ?? 0;
|
|
18
|
-
}
|
|
19
|
-
function o(e) {
|
|
20
|
-
let t = Number.parseFloat(e);
|
|
21
|
-
return Number.isFinite(t) ? t : 0;
|
|
28
|
+
var he = 10, ge = 300, h = {
|
|
29
|
+
accountHolderName: "",
|
|
30
|
+
routingNumber: "",
|
|
31
|
+
accountNumber: ""
|
|
32
|
+
};
|
|
33
|
+
function _e(e) {
|
|
34
|
+
return {
|
|
35
|
+
accountHolderName: e.account_holder_name ?? "",
|
|
36
|
+
routingNumber: e.routing_number ?? "",
|
|
37
|
+
accountNumber: e.account_number ?? ""
|
|
38
|
+
};
|
|
22
39
|
}
|
|
23
|
-
function
|
|
24
|
-
|
|
25
|
-
return t === null ? e : c(t);
|
|
40
|
+
function g(e, t) {
|
|
41
|
+
return e.accountHolderName.trim() === t.accountHolderName.trim() && e.routingNumber.trim() === t.routingNumber.trim() && e.accountNumber.trim() === t.accountNumber.trim();
|
|
26
42
|
}
|
|
27
|
-
function
|
|
28
|
-
return (e
|
|
43
|
+
function ve(e, t) {
|
|
44
|
+
return e?.find((e) => e.id === t && l(e)) ?? ie(e);
|
|
29
45
|
}
|
|
30
|
-
function
|
|
31
|
-
let
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
46
|
+
function _({ payableId: ie, counterpartId: l, payableCounterpartId: _, payableCounterpartBankAccountId: ye, isVendorKnown: be = !0, onCounterpartChange: xe, requiredError: Se, extractedVendor: v, readOnly: y = !1, canEditVendor: b = !0, canEditPaymentInstructions: Ce = !0, canAddPaymentInstructions: we = !0, confirmDiscard: x = (e) => e(), labels: Te }) {
|
|
47
|
+
let S = {
|
|
48
|
+
...i,
|
|
49
|
+
...Te
|
|
50
|
+
}, Ee = Te?.messages, C = f(() => ({
|
|
51
|
+
...te,
|
|
52
|
+
...Ee
|
|
53
|
+
}), [Ee]), { initResponse: De } = r(), Oe = t(De?.scopes, [n.CounterpartReadOrg]), [w, ke] = m(""), [T, Ae] = m(""), je = p(T), [E, Me] = m(), [Ne, Pe] = m("none"), [Fe, Ie] = m(), [Le, D] = m(!1), [O, k] = m(!1), [A, j] = m(h), Re = p(A);
|
|
54
|
+
Re.current = A;
|
|
55
|
+
let M = p(h), [ze, N] = m(), [Be, Ve] = m(), He = Be?.bankAccountId, P = p(void 0), Ue = p(l), [We, Ge] = m(!1), [Ke, qe] = m(!1), F = p(void 0), I = (O || E === "create") && !g(A, M.current), L = u(() => {
|
|
56
|
+
k(!1), j(h), M.current = h, N(void 0);
|
|
57
|
+
}, []), R = u((e) => {
|
|
58
|
+
Ge(!0), xe(e);
|
|
59
|
+
}, [xe]), Je = ee(ie, { enabled: !y && !!ie && !l && !_ }).data?.suggested_counterpart?.id, Ye = v?.name;
|
|
60
|
+
d(() => {
|
|
61
|
+
!y && !We && !l && !_ && Je && R(Je);
|
|
62
|
+
}, [
|
|
63
|
+
l,
|
|
64
|
+
_,
|
|
65
|
+
y,
|
|
66
|
+
We,
|
|
67
|
+
Je,
|
|
68
|
+
R
|
|
69
|
+
]), d(() => {
|
|
70
|
+
Ue.current !== l && (Ue.current = l, L(), Ve((e) => e?.counterpartId === l ? e : void 0));
|
|
71
|
+
}, [l, L]), d(() => {
|
|
72
|
+
let e = setTimeout(() => {
|
|
73
|
+
Ae(w.trim());
|
|
74
|
+
}, ge);
|
|
75
|
+
return () => clearTimeout(e);
|
|
76
|
+
}, [w]);
|
|
77
|
+
let z = ce({
|
|
78
|
+
sort: "counterpart_name",
|
|
79
|
+
order: "asc",
|
|
80
|
+
limit: he,
|
|
81
|
+
counterpart_name__icontains: T || void 0,
|
|
82
|
+
is_vendor: !0,
|
|
83
|
+
enabled: !y && (E === "edit" || !E && !l) && be && Oe
|
|
84
|
+
});
|
|
85
|
+
d(() => {
|
|
86
|
+
z.isPlaceholderData || (je.current = T);
|
|
87
|
+
}, [T, z.isPlaceholderData]);
|
|
88
|
+
let Xe = z.isPlaceholderData && je.current !== T, B = de({
|
|
89
|
+
selectedId: l,
|
|
90
|
+
enabled: Oe
|
|
91
|
+
}), Ze = le(), Qe = ue(), V = fe({
|
|
92
|
+
view: Ne,
|
|
93
|
+
setView: Pe,
|
|
94
|
+
selectedId: Fe,
|
|
95
|
+
setSelectedId: Ie,
|
|
96
|
+
messages: C,
|
|
97
|
+
counterpartType: "vendor",
|
|
98
|
+
counterpart: B.counterpart,
|
|
99
|
+
primaryAddress: B.primaryAddress,
|
|
100
|
+
includeBankAccount: !1
|
|
101
|
+
}), { openCreate: $e, openEdit: et, close: tt, setValues: H, submit: nt } = V, U = f(() => o(v), [v]), W = U?.bankAccount, G = f(() => {
|
|
102
|
+
let e = B.counterpart;
|
|
103
|
+
if (!e) return;
|
|
104
|
+
if (B.isBankAccountsLoading) return {
|
|
105
|
+
name: c(e),
|
|
106
|
+
email: s(e),
|
|
107
|
+
methodLabel: S.paymentMethodLoading,
|
|
108
|
+
hasPaymentInstructions: !1
|
|
109
|
+
};
|
|
110
|
+
if (B.isBankAccountsError) return {
|
|
111
|
+
name: c(e),
|
|
112
|
+
email: s(e),
|
|
113
|
+
methodLabel: S.paymentMethodUnavailable,
|
|
114
|
+
hasPaymentInstructions: !1
|
|
115
|
+
};
|
|
116
|
+
let t = ae(B.bankAccounts);
|
|
117
|
+
return {
|
|
118
|
+
name: c(e),
|
|
119
|
+
email: s(e),
|
|
120
|
+
methodLabel: t ? S.paymentInstructionsValue(t.account_number?.slice(-4) ?? "") : S.noMethod,
|
|
121
|
+
hasPaymentInstructions: !!t
|
|
122
|
+
};
|
|
123
|
+
}, [
|
|
124
|
+
B.bankAccounts,
|
|
125
|
+
B.counterpart,
|
|
126
|
+
B.isBankAccountsError,
|
|
127
|
+
B.isBankAccountsLoading,
|
|
128
|
+
S
|
|
129
|
+
]), K = f(() => {
|
|
130
|
+
let e = Ye?.trim();
|
|
131
|
+
if (!e || l || E) return;
|
|
132
|
+
let t = W?.accountNumber;
|
|
133
|
+
return {
|
|
134
|
+
name: e,
|
|
135
|
+
email: v?.email ?? "",
|
|
136
|
+
description: S.pendingVendorDescription,
|
|
137
|
+
methodLabel: t ? S.paymentInstructionsValue(t.slice(-4)) : "",
|
|
138
|
+
hasPaymentInstructions: !!t
|
|
139
|
+
};
|
|
140
|
+
}, [
|
|
141
|
+
l,
|
|
142
|
+
W?.accountNumber,
|
|
143
|
+
v?.email,
|
|
144
|
+
Ye,
|
|
145
|
+
E,
|
|
146
|
+
S.paymentInstructionsValue,
|
|
147
|
+
S.pendingVendorDescription
|
|
148
|
+
]), q = l === _ ? ye : void 0, J = f(() => ve(B.bankAccounts, q), [B.bankAccounts, q]), rt = f(() => ae(B.bankAccounts)?.id, [B.bankAccounts]), it = !B.counterpart || B.isLoading || B.isFetching || B.isError || B.isBankAccountsLoading || B.isBankAccountsFetching || B.isBankAccountsError, at = it || B.isAddressesLoading || B.isAddressesFetching || B.isAddressesError, ot = b && !it && B.isAddressesError ? { onRetry: B.refetchAddresses } : void 0, Y = u(() => {
|
|
149
|
+
tt(), Me(void 0), D(!1), P.current = void 0;
|
|
150
|
+
}, [tt]), st = u((e) => {
|
|
151
|
+
if (D(!1), P.current = void 0, e === "edit") Ie(l), et();
|
|
152
|
+
else {
|
|
153
|
+
$e();
|
|
154
|
+
let e = w.trim();
|
|
155
|
+
H((t) => ({
|
|
156
|
+
...t,
|
|
157
|
+
entityType: "organization",
|
|
158
|
+
legalName: e || U?.legalName || t.legalName,
|
|
159
|
+
email: U?.email || t.email,
|
|
160
|
+
phone: U?.phone || t.phone,
|
|
161
|
+
address: U?.address ?? t.address
|
|
162
|
+
})), j(W ?? h), N(void 0), M.current = h;
|
|
163
|
+
}
|
|
164
|
+
Me(e);
|
|
165
|
+
}, [
|
|
166
|
+
l,
|
|
167
|
+
W,
|
|
168
|
+
$e,
|
|
169
|
+
et,
|
|
170
|
+
w,
|
|
171
|
+
H,
|
|
172
|
+
U
|
|
173
|
+
]), ct = u(() => {
|
|
174
|
+
let e = J ? _e(J) : h;
|
|
175
|
+
M.current = e, j(e), N(void 0), k(!0);
|
|
176
|
+
}, [J]), lt = u((e) => {
|
|
177
|
+
j((t) => ({
|
|
178
|
+
...t,
|
|
179
|
+
...e
|
|
180
|
+
})), N(void 0);
|
|
181
|
+
}, []), ut = u(() => {
|
|
182
|
+
I ? x(L) : L();
|
|
183
|
+
}, [
|
|
184
|
+
L,
|
|
185
|
+
x,
|
|
186
|
+
I
|
|
187
|
+
]), X = u(() => {
|
|
188
|
+
Y(), L();
|
|
189
|
+
}, [L, Y]), Z = Le || I, Q = u((e) => {
|
|
190
|
+
let t = () => {
|
|
191
|
+
X(), e();
|
|
192
|
+
};
|
|
193
|
+
Z ? x(t) : t();
|
|
194
|
+
}, [
|
|
195
|
+
x,
|
|
196
|
+
X,
|
|
197
|
+
Z
|
|
198
|
+
]), dt = u(() => {
|
|
199
|
+
Z ? x(X) : X();
|
|
200
|
+
}, [
|
|
201
|
+
x,
|
|
202
|
+
X,
|
|
203
|
+
Z
|
|
204
|
+
]), ft = u(async (t) => {
|
|
205
|
+
let n = l, r = !1, i = Re.current;
|
|
206
|
+
if (!g(i, M.current)) {
|
|
207
|
+
let e = se(i, C);
|
|
208
|
+
if (Object.keys(e).length > 0) return N(e), E !== "create" && k(!0), { ok: !1 };
|
|
209
|
+
}
|
|
210
|
+
if (E === "edit" && at) return { ok: !1 };
|
|
211
|
+
if (E) {
|
|
212
|
+
if (E === "create" && P.current) n = P.current;
|
|
213
|
+
else {
|
|
214
|
+
let e = await nt();
|
|
215
|
+
if (!e.ok) return { ok: !1 };
|
|
216
|
+
E === "create" ? (n = e.counterpartId, P.current = n) : n = e.counterpartId ?? n;
|
|
217
|
+
}
|
|
218
|
+
E === "create" && (r = !0);
|
|
219
|
+
}
|
|
220
|
+
if (!n) return { ok: !0 };
|
|
221
|
+
let ee = B.isBankAccountsLoading || B.isBankAccountsFetching || B.isBankAccountsError;
|
|
222
|
+
if (g(i, M.current)) {
|
|
223
|
+
let e = He ?? q;
|
|
224
|
+
return e ? (t && (k(!1), E && Y()), r && R(n), {
|
|
225
|
+
ok: !0,
|
|
226
|
+
counterpartId: n,
|
|
227
|
+
counterpartBankAccountId: e
|
|
228
|
+
}) : r ? (t && Y(), R(n), {
|
|
229
|
+
ok: !0,
|
|
230
|
+
counterpartId: n
|
|
231
|
+
}) : ee ? { ok: !1 } : (t && (k(!1), E && Y()), {
|
|
232
|
+
ok: !0,
|
|
233
|
+
counterpartId: n,
|
|
234
|
+
counterpartBankAccountId: rt
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
if (ee) return { ok: !1 };
|
|
238
|
+
N(void 0);
|
|
239
|
+
let a = oe(B.bankAccounts, He ?? J?.id), o;
|
|
240
|
+
try {
|
|
241
|
+
a.kind === "update" ? (await Qe.mutateAsync({
|
|
242
|
+
path: {
|
|
243
|
+
counterpart_id: n,
|
|
244
|
+
bank_account_id: a.bankAccountId
|
|
245
|
+
},
|
|
246
|
+
body: re(i, { includeAchDefaults: a.includeAchDefaults })
|
|
247
|
+
}), o = a.bankAccountId) : o = (await Ze.mutateAsync({
|
|
248
|
+
path: { counterpart_id: n },
|
|
249
|
+
body: ne(i, { isDefaultForCurrency: a.isDefaultForCurrency })
|
|
250
|
+
}))?.id;
|
|
251
|
+
} catch {
|
|
252
|
+
return e.error(S.bankAccountSaveFailed), {
|
|
253
|
+
ok: !1,
|
|
254
|
+
counterpartId: n
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
return M.current = i, Ve(o ? {
|
|
258
|
+
counterpartId: n,
|
|
259
|
+
bankAccountId: o
|
|
260
|
+
} : void 0), t && (k(!1), E && Y()), r && R(n), {
|
|
261
|
+
ok: !0,
|
|
262
|
+
counterpartId: n,
|
|
263
|
+
counterpartBankAccountId: o
|
|
264
|
+
};
|
|
265
|
+
}, [
|
|
266
|
+
Y,
|
|
267
|
+
l,
|
|
268
|
+
Ze,
|
|
269
|
+
B.bankAccounts,
|
|
270
|
+
B.isBankAccountsError,
|
|
271
|
+
B.isBankAccountsFetching,
|
|
272
|
+
B.isBankAccountsLoading,
|
|
273
|
+
E,
|
|
274
|
+
at,
|
|
275
|
+
q,
|
|
276
|
+
C,
|
|
277
|
+
rt,
|
|
278
|
+
R,
|
|
279
|
+
J,
|
|
280
|
+
nt,
|
|
281
|
+
Qe,
|
|
282
|
+
He
|
|
283
|
+
]), pt = u((e) => {
|
|
284
|
+
if (F.current) return F.current;
|
|
285
|
+
let t = e?.closeOnSuccess ?? !0, n = (async () => {
|
|
286
|
+
qe(!0);
|
|
287
|
+
try {
|
|
288
|
+
return await ft(t);
|
|
289
|
+
} finally {
|
|
290
|
+
F.current = void 0, qe(!1);
|
|
291
|
+
}
|
|
292
|
+
})();
|
|
293
|
+
return F.current = n, n;
|
|
294
|
+
}, [ft]), mt = u(() => {
|
|
295
|
+
k(!1), E && Y();
|
|
296
|
+
}, [E, Y]), ht = f(() => (z.data?.data ?? []).map((e) => ({
|
|
297
|
+
name: c(e),
|
|
298
|
+
email: s(e),
|
|
299
|
+
onSelect: () => {
|
|
300
|
+
Q(() => R(e.id));
|
|
301
|
+
}
|
|
302
|
+
})), [
|
|
303
|
+
z.data,
|
|
304
|
+
Q,
|
|
305
|
+
R
|
|
306
|
+
]), gt = u((e) => {
|
|
307
|
+
D(!0), H((t) => e.entityType === "individual" && t.entityType !== "individual" ? {
|
|
308
|
+
...t,
|
|
309
|
+
...e,
|
|
310
|
+
firstName: t.firstName || t.legalName,
|
|
311
|
+
legalName: t.legalName
|
|
312
|
+
} : e.entityType === "organization" && t.entityType !== "organization" ? {
|
|
313
|
+
...t,
|
|
314
|
+
...e,
|
|
315
|
+
legalName: t.legalName || [t.firstName, t.lastName].filter(Boolean).join(" ")
|
|
316
|
+
} : {
|
|
317
|
+
...t,
|
|
318
|
+
...e
|
|
41
319
|
});
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
320
|
+
}, [H]), _t = u((e) => {
|
|
321
|
+
D(!0), H((t) => ({
|
|
322
|
+
...t,
|
|
323
|
+
address: {
|
|
324
|
+
...t.address,
|
|
325
|
+
...e
|
|
326
|
+
}
|
|
327
|
+
}));
|
|
328
|
+
}, [H]), vt = {
|
|
329
|
+
query: w,
|
|
330
|
+
onQueryChange: ke,
|
|
331
|
+
isLoading: !be || !De || !!l && B.isLoading || z.isLoading || z.isFetching && Xe,
|
|
332
|
+
onAddVendor: () => {
|
|
333
|
+
Q(() => st("create"));
|
|
334
|
+
},
|
|
335
|
+
results: ht
|
|
336
|
+
}, yt = we && (E === "create" || !it) ? {
|
|
337
|
+
isOpen: O,
|
|
338
|
+
values: A,
|
|
339
|
+
errors: ze,
|
|
340
|
+
onOpen: ct,
|
|
341
|
+
onCancel: ut,
|
|
342
|
+
onChange: lt
|
|
343
|
+
} : void 0, bt = E !== "create" && yt ? {
|
|
344
|
+
...yt,
|
|
345
|
+
onOpen: E === "edit" ? () => Q(ct) : yt.onOpen,
|
|
346
|
+
canEditExisting: Ce
|
|
347
|
+
} : void 0, xt = V.isSubmitting || Ze.isPending || Qe.isPending, $ = {
|
|
348
|
+
prepareVendorForSave: pt,
|
|
349
|
+
isVendorSavePending: Ke || xt,
|
|
350
|
+
hasUnsavedVendorChanges: Z,
|
|
351
|
+
isPendingVendor: !!K,
|
|
352
|
+
isEditingPayTo: !!E || O,
|
|
353
|
+
activePayToOperation: E ? "vendor" : O ? G?.hasPaymentInstructions ? "existingInstructions" : "missingInstructions" : void 0,
|
|
354
|
+
discardPayToEdits: X,
|
|
355
|
+
finalizePayToSave: mt,
|
|
356
|
+
openPaymentInstructions: ct,
|
|
357
|
+
paymentInstructions: a(bt, !!G?.hasPaymentInstructions),
|
|
358
|
+
paymentInstructionsEditor: bt,
|
|
359
|
+
detailsWarning: ot
|
|
360
|
+
}, St = E === "create" && we ? {
|
|
361
|
+
values: A,
|
|
362
|
+
errors: ze,
|
|
363
|
+
onChange: lt,
|
|
364
|
+
isExtracted: !!(W && g(A, W))
|
|
365
|
+
} : void 0;
|
|
366
|
+
if (E) return {
|
|
367
|
+
mode: "creating",
|
|
368
|
+
summary: G,
|
|
369
|
+
newVendorForm: /* @__PURE__ */ me(pe, {
|
|
370
|
+
mode: E,
|
|
371
|
+
values: V.values,
|
|
372
|
+
errors: V.errors,
|
|
373
|
+
onChange: gt,
|
|
374
|
+
onAddressChange: _t,
|
|
375
|
+
sectionsToExpand: V.sectionsToExpand,
|
|
376
|
+
onAddressExpand: V.expandAddress,
|
|
377
|
+
onCancel: dt,
|
|
378
|
+
onSave: pt,
|
|
379
|
+
isSaving: xt,
|
|
380
|
+
search: E === "edit" && !y ? vt : void 0,
|
|
381
|
+
paymentInstructions: St,
|
|
382
|
+
labels: Te?.inlineForm
|
|
383
|
+
}),
|
|
384
|
+
...$
|
|
62
385
|
};
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
386
|
+
if (G) return {
|
|
387
|
+
mode: "resolved",
|
|
388
|
+
summary: G,
|
|
389
|
+
onEdit: b && !at ? () => Q(() => st("edit")) : void 0,
|
|
390
|
+
...$
|
|
391
|
+
};
|
|
392
|
+
if (K) {
|
|
393
|
+
let e = () => Q(() => {
|
|
394
|
+
Ge(!0), st("create");
|
|
395
|
+
}), t = b && we ? {
|
|
396
|
+
isOpen: !1,
|
|
397
|
+
values: A,
|
|
398
|
+
errors: ze,
|
|
399
|
+
onOpen: e,
|
|
400
|
+
onChange: lt,
|
|
401
|
+
onCancel: ut,
|
|
402
|
+
canEditExisting: !0
|
|
403
|
+
} : void 0;
|
|
68
404
|
return {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
405
|
+
mode: "resolved",
|
|
406
|
+
summary: K,
|
|
407
|
+
onEdit: b ? e : void 0,
|
|
408
|
+
error: Se,
|
|
409
|
+
...$,
|
|
410
|
+
showPaymentInstructions: !0,
|
|
411
|
+
paymentInstructions: a(t, K.hasPaymentInstructions),
|
|
412
|
+
paymentInstructionsEditor: t
|
|
77
413
|
};
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
414
|
+
}
|
|
415
|
+
return {
|
|
416
|
+
mode: "selecting",
|
|
417
|
+
error: z.isError ? S.searchFailed : B.isError ? S.vendorDetailsFailed : Se,
|
|
418
|
+
search: vt,
|
|
419
|
+
...$
|
|
420
|
+
};
|
|
85
421
|
}
|
|
86
422
|
//#endregion
|
|
87
|
-
export {
|
|
423
|
+
export { _ as useVendorSectionProps };
|
|
@@ -1,83 +1,16 @@
|
|
|
1
|
-
import { BILL_CREATE_MESSAGE_LABELS_EN as e } from "./index23.js";
|
|
2
|
-
import { isPersistableLineItem as t, parseMoneyToMinorUnits as n, parseQuantity as r } from "./index29.js";
|
|
3
1
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index30.js
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
let n = new Date(u() + c * l);
|
|
17
|
-
return t < d() || t > n;
|
|
18
|
-
}
|
|
19
|
-
function p(e) {
|
|
20
|
-
let t = new Date(e);
|
|
21
|
-
if (Number.isNaN(t.getTime())) return !1;
|
|
22
|
-
let n = new Date(u());
|
|
23
|
-
return n.setUTCFullYear(n.getUTCFullYear() + s), t < d() || t > n;
|
|
24
|
-
}
|
|
25
|
-
function m(t, n = e) {
|
|
26
|
-
let r = {};
|
|
27
|
-
return t.poNumber.length > a && (r.poNumber = n.poNumberTooLong), Object.keys(r).length ? r : void 0;
|
|
28
|
-
}
|
|
29
|
-
function h(e) {
|
|
30
|
-
let t = e.trim();
|
|
31
|
-
return !t || n(t) !== null ? !0 : i.test(t) ? Number(t.replaceAll(",", "")) === 0 : !1;
|
|
32
|
-
}
|
|
33
|
-
function g(t, i = e) {
|
|
34
|
-
let a = {};
|
|
35
|
-
for (let e of t) {
|
|
36
|
-
let t = n(e.price), o = n(e.amount), s = {};
|
|
37
|
-
e.price.trim() && t === null && (s.price = i.unreadableMoney), e.amount.trim() && o === null && (s.amount = i.unreadableMoney), r(e.quantity) === null && (e.quantity.trim() || t !== null || o !== null) && (s.quantity = i.unusableQuantity), Object.keys(s).length && (a[e.id] = s);
|
|
38
|
-
}
|
|
39
|
-
return Object.keys(a).length ? a : void 0;
|
|
40
|
-
}
|
|
41
|
-
function _(i, a, o, s = e) {
|
|
42
|
-
let c = {};
|
|
43
|
-
a || (c.vendor = s.requiredField), i.invoiceNumber.trim() || (c.invoiceNumber = s.requiredField);
|
|
44
|
-
let l = i.invoiceDate.trim(), u = i.dueDate.trim();
|
|
45
|
-
l ? f(l) && (c.invoiceDate = s.implausibleInvoiceDate) : c.invoiceDate = s.requiredField, u ? p(u) ? c.dueDate = s.implausibleDueDate : l && u < l && (c.dueDate = s.dueBeforeInvoiceDate) : c.dueDate = s.requiredField;
|
|
46
|
-
let d = {};
|
|
47
|
-
return o.forEach((e, i) => {
|
|
48
|
-
if (i > 0 && !t(e)) return;
|
|
49
|
-
let a = {};
|
|
50
|
-
e.description.trim() || (a.description = s.requiredField), r(e.quantity) === null && (a.quantity = s.requiredField), n(e.price) === null && n(e.amount) === null && (a.price = s.requiredField, a.amount = s.requiredField), Object.keys(a).length && (d[e.id] = a);
|
|
51
|
-
}), {
|
|
52
|
-
formErrors: Object.keys(c).length ? c : void 0,
|
|
53
|
-
lineItemErrors: Object.keys(d).length ? d : void 0
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
function v(e) {
|
|
57
|
-
let t = e.trim();
|
|
58
|
-
if (!t) return !0;
|
|
59
|
-
let n = t.startsWith("-") ? t.slice(1) : t;
|
|
60
|
-
return i.test(n) ? Number(t.replaceAll(",", "")) <= 0 : !1;
|
|
61
|
-
}
|
|
62
|
-
function y(e, t) {
|
|
63
|
-
if (n(e) === null) return v(e) ? t.totalNotGreaterThanZero : t.unreadableTotal;
|
|
64
|
-
}
|
|
65
|
-
function b(t, n = e) {
|
|
66
|
-
let r = y(t, n);
|
|
67
|
-
return r ? { total: r } : void 0;
|
|
68
|
-
}
|
|
69
|
-
function x(t, r = e) {
|
|
70
|
-
if (t === void 0) return;
|
|
71
|
-
let i = n(t);
|
|
72
|
-
if (i !== null) return i > 0 ? void 0 : { total: r.totalNotGreaterThanZero };
|
|
73
|
-
}
|
|
74
|
-
function S(t, n, r, i = e) {
|
|
75
|
-
let a = {};
|
|
76
|
-
if (h(t) || (a.discount = i.unreadableDiscount), h(n) || (a.tax = i.unreadableTax), r !== void 0) {
|
|
77
|
-
let e = y(r, i);
|
|
78
|
-
e && (a.total = e);
|
|
79
|
-
}
|
|
80
|
-
return Object.keys(a).length ? a : void 0;
|
|
2
|
+
function e(e) {
|
|
3
|
+
return new Promise((t, n) => {
|
|
4
|
+
let r = new FileReader();
|
|
5
|
+
r.onerror = () => n(r.error ?? /* @__PURE__ */ Error("Failed to read file")), r.onload = () => {
|
|
6
|
+
let e = r.result;
|
|
7
|
+
if (typeof e != "string") {
|
|
8
|
+
n(/* @__PURE__ */ Error("Failed to read file as a data URL"));
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
t(e.slice(e.indexOf(",") + 1));
|
|
12
|
+
}, r.readAsDataURL(e);
|
|
13
|
+
});
|
|
81
14
|
}
|
|
82
15
|
//#endregion
|
|
83
|
-
export {
|
|
16
|
+
export { e as encodeFileToBase64 };
|