@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
|
@@ -7,97 +7,111 @@ import { getStateOptions as t } from "../../../../../shared/util/dist/lib/usStat
|
|
|
7
7
|
import "../../../../../shared/ui/dist/index.js";
|
|
8
8
|
import { COUNTERPART_MESSAGE_LABELS_EN as n } from "../../../../../shared/counterpart-management/feature/dist/lib/labels.js";
|
|
9
9
|
import { getCounterpartEmail as r } from "../../../../../shared/counterpart-management/feature/dist/lib/helpers.js";
|
|
10
|
-
import { useCounterpartQuery as i } from "../../../../../shared/counterpart-management/data-access/dist/index3.js";
|
|
11
|
-
import { useCounterpartAddressesQuery as
|
|
12
|
-
import { useCounterpartForm as
|
|
10
|
+
import { useCounterpartQuery as i, useCreateCounterpartMutation as a } from "../../../../../shared/counterpart-management/data-access/dist/index3.js";
|
|
11
|
+
import { useCounterpartAddressesQuery as o } from "../../../../../shared/counterpart-management/data-access/dist/index7.js";
|
|
12
|
+
import { useCounterpartForm as ee } from "../../../../../shared/counterpart-management/feature/dist/lib/useCounterpartForm.js";
|
|
13
13
|
import "../../../../../shared/counterpart-management/feature/dist/index.js";
|
|
14
|
-
import "../../../../ui/dist/
|
|
14
|
+
import "../../../../ui/dist/index20.js";
|
|
15
15
|
import "../../../../ui/dist/index.js";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import { useMeasureUnits as ge } from "../../../../../shared/product-catalog/feature/dist/lib/useMeasureUnits.js";
|
|
20
|
-
import "../../../../../shared/product-catalog/feature/dist/index.js";
|
|
21
|
-
import { getInlineItems as _e } from "./actionsModal.js";
|
|
22
|
-
import { buildCreateRecurrencePayload as ve, buildUpdateRecurrencePayload as ye, clearRecurrenceRecipients as l, countIssuedIterations as be, isRecurring as u, recurrenceToFormFields as xe, validateRecurrence as Se, willRecurrenceIssue as Ce } from "./recurrence.js";
|
|
23
|
-
import { convertDiscountInput as we, decorateDiscountInput as Te, discountInputToMinorUnits as Ee, sanitizeDiscountInput as De } from "./discount.js";
|
|
24
|
-
import { buildFormTotalsView as Oe, calculateFormTotals as ke, validateDiscount as Ae, validateInvoiceTotals as je } from "./totals.js";
|
|
25
|
-
import { createEmptyReceivableFormValues as Me, hasReceivableFormErrors as Ne, receivableFormValuesToCreatePayload as Pe, receivableFormValuesToLineItemChanges as Fe, receivableFormValuesToUpdatePayload as Ie, receivableToFormValues as Le, resolveCounterpartAddresses as Re, submittedLineItemRows as ze, validateReceivableForm as Be } from "./helpers.js";
|
|
26
|
-
import { getIssueReminderBlocker as Ve, shouldShowRemindersInitially as He } from "./reminders.js";
|
|
27
|
-
import { useCreateReceivableMutation as Ue, useIssueReceivableMutation as We, useUpdateReceivableMutation as Ge } from "../../../../data-access/dist/index10.js";
|
|
28
|
-
import { useCreateRecurrenceMutation as Ke, useRecurrenceQuery as qe, useUpdateRecurrenceMutation as Je } from "../../../../data-access/dist/index14.js";
|
|
16
|
+
import { INLINE_CUSTOMER_TYPE as s, buildInlineCustomerPayload as te, seedCustomerFormValues as ne } from "./customer.js";
|
|
17
|
+
import { useCreateReceivableMutation as c, useIssueReceivableMutation as l, useUpdateReceivableMutation as re } from "../../../../data-access/dist/index11.js";
|
|
18
|
+
import { useCreateRecurrenceMutation as ie, useRecurrenceQuery as ae, useUpdateRecurrenceMutation as oe } from "../../../../data-access/dist/index15.js";
|
|
29
19
|
import "../../../../data-access/dist/index.js";
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
20
|
+
import { buildLineItemControls as se, commitLineItemField as ce, commitTaxRateInput as le, convertPriceInput as ue, createLineItem as de, getCurrencySymbol as fe, lineItemFromProduct as pe, reconcileLineItemIds as me, reconcileMeasureUnits as he, sanitizeLineItemPatch as ge, sanitizeTaxRateInput as _e, stepLineItemQuantity as ve, stripBlankLineItems as ye, summarizeLineItemErrors as be, toSheetLineItem as xe, validateLineItems as Se } from "./lineItems.js";
|
|
21
|
+
import { buildReceivableAttachmentsView as Ce } from "./attachments.js";
|
|
22
|
+
import { useMeasureUnitsQuery as we } from "../../../../../shared/product-catalog/data-access/dist/index9.js";
|
|
23
|
+
import { useMeasureUnits as Te } from "../../../../../shared/product-catalog/feature/dist/lib/useMeasureUnits.js";
|
|
24
|
+
import "../../../../../shared/product-catalog/feature/dist/index.js";
|
|
25
|
+
import { getInlineItems as Ee } from "./actionsModal.js";
|
|
26
|
+
import { buildCreateRecurrencePayload as De, buildUpdateRecurrencePayload as Oe, clearRecurrenceRecipients as u, countIssuedIterations as ke, isRecurring as d, recurrenceToFormFields as Ae, validateRecurrence as je, willRecurrenceIssue as Me } from "./recurrence.js";
|
|
27
|
+
import { convertDiscountInput as Ne, decorateDiscountInput as Pe, discountInputToMinorUnits as Fe, sanitizeDiscountInput as Ie } from "./discount.js";
|
|
28
|
+
import { buildFormTotalsView as Le, calculateFormTotals as Re, validateDiscount as ze, validateInvoiceTotals as Be } from "./totals.js";
|
|
29
|
+
import { createEmptyReceivableFormValues as Ve, hasReceivableFormErrors as He, receivableFormValuesToCreatePayload as Ue, receivableFormValuesToLineItemChanges as We, receivableFormValuesToUpdatePayload as Ge, receivableToFormValues as Ke, resolveCounterpartAddresses as qe, submittedLineItemRows as Je, validateReceivableForm as Ye } from "./helpers.js";
|
|
30
|
+
import { getIssueReminderBlocker as Xe, shouldShowRemindersInitially as Ze } from "./reminders.js";
|
|
31
|
+
import { useReceivableIssuePreflight as Qe } from "./useReceivableIssuePreflight.js";
|
|
32
|
+
import { UNSUBMITTED_PAYLOAD_VARIANTS as $e, apiValidationErrorsToFormErrors as et, getApiErrorMessage as tt, parseApiValidationErrors as nt } from "./apiValidationErrors.js";
|
|
33
|
+
import { useReceivableAttachmentUploads as rt } from "./useReceivableAttachmentUploads.js";
|
|
34
|
+
import { useReceivablePaymentTerms as it } from "./useReceivablePaymentTerms.js";
|
|
35
|
+
import { useReceivableRecurrence as at } from "./useReceivableRecurrence.js";
|
|
36
|
+
import { useReceivableBankAccount as ot } from "./useReceivableBankAccount.js";
|
|
37
|
+
import { useReceivableReminders as st } from "./useReceivableReminders.js";
|
|
38
|
+
import { useReceivablePreview as ct } from "./useReceivablePreview.js";
|
|
39
|
+
import { hasUnsavedChanges as lt } from "./unsavedChanges.js";
|
|
40
|
+
import { useCallback as f, useEffect as p, useMemo as m, useRef as h, useState as g } from "react";
|
|
40
41
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableForm.js
|
|
41
|
-
function
|
|
42
|
-
return t === e.customerId ? e :
|
|
42
|
+
function ut(e, t) {
|
|
43
|
+
return t === e.customerId ? e : u({
|
|
43
44
|
...e,
|
|
44
45
|
customerId: t,
|
|
45
46
|
billingAddressId: "",
|
|
46
47
|
shippingAddressId: "",
|
|
47
|
-
...t ? {
|
|
48
|
+
...t ? {
|
|
49
|
+
customerName: "",
|
|
50
|
+
customerEmail: ""
|
|
51
|
+
} : {}
|
|
48
52
|
});
|
|
49
53
|
}
|
|
50
|
-
function
|
|
51
|
-
|
|
54
|
+
function dt(e, t) {
|
|
55
|
+
return {
|
|
56
|
+
...e,
|
|
57
|
+
customerId: t,
|
|
58
|
+
customerName: "",
|
|
59
|
+
customerEmail: ""
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function ft({ messages: u, counterpartMessageLabels: ft, embeddedBankName: pt, canCreateCustomer: _ = !0, onCreated: mt, onUpdated: ht }) {
|
|
63
|
+
let gt = c(), _t = re(), vt = ie(), yt = oe(), bt = l(), xt = a(), v = h("draft"), St = h(!1), [Ct, wt] = g(), y = h(!1), b = h(!1), Tt = h(null), x = h(void 0), S = h([]), Et = h(""), [C, w] = g(!1), [T, Dt] = g("create"), [Ot, kt] = g(), [At, jt] = g(), [E, D] = g(() => Ve()), O = h(E), [Mt, k] = g(!1), [Nt, A] = g({}), [Pt, Ft] = g("none"), It = Te(), j = we(), M = j.data?.data, { unitNamesById: N } = It, [Lt, Rt] = g(), [P, zt] = g(!1), Bt = h(!1), F = h(!1), I = h(!1), L = h({
|
|
52
64
|
lines: !1,
|
|
53
65
|
discount: !1
|
|
54
|
-
}), [
|
|
66
|
+
}), [Vt, R] = g(!1), Ht = m(() => t(), []), Ut = m(() => ({
|
|
55
67
|
...n,
|
|
56
|
-
...
|
|
57
|
-
}), [
|
|
58
|
-
values:
|
|
59
|
-
counterpart:
|
|
60
|
-
addresses:
|
|
61
|
-
}),
|
|
62
|
-
counterpartId:
|
|
63
|
-
billingAddressId:
|
|
64
|
-
billingCountry:
|
|
65
|
-
|
|
66
|
-
|
|
68
|
+
...ft
|
|
69
|
+
}), [ft]), Wt = o(E.customerId), Gt = i(E.customerId || void 0), Kt = Wt.data?.data?.[0], { billingAddressId: qt, billingAddress: Jt, shippingAddressId: Yt } = qe({
|
|
70
|
+
values: E,
|
|
71
|
+
counterpart: Gt.data,
|
|
72
|
+
addresses: Wt.data?.data
|
|
73
|
+
}), z = !!E.customerId && (Wt.isLoading || Gt.isLoading), B = Qe({
|
|
74
|
+
counterpartId: E.customerId,
|
|
75
|
+
billingAddressId: qt,
|
|
76
|
+
billingCountry: Jt?.country,
|
|
77
|
+
inlineCustomerType: _ && !E.customerId && E.customerName.trim() ? s : void 0
|
|
78
|
+
}), Xt = B.isLoading || z, Zt = f((e) => {
|
|
79
|
+
D((t) => ({
|
|
67
80
|
...t,
|
|
68
81
|
attachments: e(t.attachments)
|
|
69
82
|
}));
|
|
70
|
-
}, []),
|
|
71
|
-
attachments:
|
|
72
|
-
setAttachments:
|
|
73
|
-
receivableId:
|
|
74
|
-
}), { reset:
|
|
75
|
-
attachments:
|
|
76
|
-
pendingUploads:
|
|
77
|
-
isCountLimitReached:
|
|
78
|
-
isRecurring:
|
|
79
|
-
messages:
|
|
80
|
-
}) : void 0,
|
|
81
|
-
|
|
82
|
-
}, []),
|
|
83
|
-
view:
|
|
84
|
-
setView:
|
|
85
|
-
selectedId:
|
|
86
|
-
setSelectedId:
|
|
87
|
-
messages:
|
|
83
|
+
}, []), V = rt({
|
|
84
|
+
attachments: E.attachments,
|
|
85
|
+
setAttachments: Zt,
|
|
86
|
+
receivableId: Ot
|
|
87
|
+
}), { reset: H, discardUploads: Qt, commitRemovals: $t } = V, en = E.type === "invoice" ? Ce({
|
|
88
|
+
attachments: E.attachments,
|
|
89
|
+
pendingUploads: V.pendingUploads,
|
|
90
|
+
isCountLimitReached: V.isCountLimitReached,
|
|
91
|
+
isRecurring: d(E),
|
|
92
|
+
messages: u
|
|
93
|
+
}) : void 0, tn = f((e) => {
|
|
94
|
+
e && D((t) => ut(t, e));
|
|
95
|
+
}, []), nn = ee({
|
|
96
|
+
view: Pt,
|
|
97
|
+
setView: Ft,
|
|
98
|
+
selectedId: E.customerId || void 0,
|
|
99
|
+
setSelectedId: tn,
|
|
100
|
+
messages: Ut,
|
|
88
101
|
counterpartType: "customer",
|
|
89
102
|
counterpart: void 0,
|
|
90
|
-
primaryAddress:
|
|
91
|
-
}), { openCreate:
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
email:
|
|
103
|
+
primaryAddress: Kt
|
|
104
|
+
}), { openCreate: rn, setValues: an } = nn, on = f(() => {
|
|
105
|
+
rn(), an((e) => ne(e, {
|
|
106
|
+
name: E.customerName,
|
|
107
|
+
email: E.customerEmail
|
|
95
108
|
}));
|
|
96
109
|
}, [
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
110
|
+
rn,
|
|
111
|
+
an,
|
|
112
|
+
E.customerName,
|
|
113
|
+
E.customerEmail
|
|
114
|
+
]), sn = f((e) => D((t) => {
|
|
101
115
|
let n = e({
|
|
102
116
|
paymentTermsId: t.paymentTermsId,
|
|
103
117
|
paymentTermsCustomDate: t.paymentTermsCustomDate
|
|
@@ -107,293 +121,308 @@ function ct({ messages: l, counterpartMessageLabels: ct, embeddedBankName: lt, o
|
|
|
107
121
|
...n,
|
|
108
122
|
...n.paymentTermsId === "receipt_due" ? { paymentReminderId: "" } : {}
|
|
109
123
|
};
|
|
110
|
-
}), []),
|
|
111
|
-
paymentTermsId:
|
|
112
|
-
paymentTermsCustomDate:
|
|
113
|
-
issueDate:
|
|
114
|
-
isRecurring:
|
|
115
|
-
messages:
|
|
116
|
-
onChange:
|
|
117
|
-
}),
|
|
118
|
-
t && (
|
|
119
|
-
...
|
|
124
|
+
}), []), cn = it({
|
|
125
|
+
paymentTermsId: E.paymentTermsId,
|
|
126
|
+
paymentTermsCustomDate: E.paymentTermsCustomDate,
|
|
127
|
+
issueDate: E.issueDate,
|
|
128
|
+
isRecurring: E.type === "invoice" && d(E),
|
|
129
|
+
messages: u,
|
|
130
|
+
onChange: sn
|
|
131
|
+
}), ln = cn.reset, un = f((e, { automatic: t = !1 } = {}) => {
|
|
132
|
+
t && (O.current = {
|
|
133
|
+
...O.current,
|
|
120
134
|
...e
|
|
121
|
-
}),
|
|
135
|
+
}), D((t) => ({
|
|
122
136
|
...t,
|
|
123
137
|
...e
|
|
124
138
|
}));
|
|
125
|
-
}, []),
|
|
126
|
-
open:
|
|
127
|
-
bankAccountId:
|
|
128
|
-
bankAccountType:
|
|
129
|
-
embeddedBankName:
|
|
130
|
-
messages:
|
|
131
|
-
onSelect:
|
|
132
|
-
}),
|
|
133
|
-
|
|
134
|
-
if (!
|
|
135
|
-
|
|
136
|
-
let e =
|
|
137
|
-
|
|
138
|
-
...
|
|
139
|
+
}, []), U = ot({
|
|
140
|
+
open: C,
|
|
141
|
+
bankAccountId: E.bankAccountId,
|
|
142
|
+
bankAccountType: E.bankAccountType,
|
|
143
|
+
embeddedBankName: pt,
|
|
144
|
+
messages: u,
|
|
145
|
+
onSelect: un
|
|
146
|
+
}), dn = U.reset, fn = ae(At), W = At ? fn.data : void 0, G = ke(W), pn = G > 0, K = !!At && fn.isLoading, mn = h(void 0);
|
|
147
|
+
p(() => {
|
|
148
|
+
if (!W || mn.current === W.id) return;
|
|
149
|
+
mn.current = W.id;
|
|
150
|
+
let e = Ae(W);
|
|
151
|
+
O.current = {
|
|
152
|
+
...O.current,
|
|
139
153
|
...e
|
|
140
|
-
},
|
|
154
|
+
}, D((t) => ({
|
|
141
155
|
...t,
|
|
142
156
|
...e
|
|
143
157
|
}));
|
|
144
|
-
}, [
|
|
145
|
-
let
|
|
158
|
+
}, [W]);
|
|
159
|
+
let hn = f((e) => D(e), []), gn = f((e) => A((t) => {
|
|
146
160
|
if (!e.some((e) => e in t)) return t;
|
|
147
161
|
let n = { ...t };
|
|
148
162
|
return e.forEach((e) => delete n[e]), n;
|
|
149
|
-
}), []),
|
|
150
|
-
if (!
|
|
151
|
-
|
|
163
|
+
}), []), _n = h([]), vn = f((e) => {
|
|
164
|
+
if (!P) {
|
|
165
|
+
gn(e);
|
|
152
166
|
return;
|
|
153
167
|
}
|
|
154
|
-
|
|
155
|
-
}, [
|
|
156
|
-
|
|
157
|
-
let e =
|
|
168
|
+
_n.current.push(...e);
|
|
169
|
+
}, [gn, P]);
|
|
170
|
+
p(() => {
|
|
171
|
+
let e = _n.current;
|
|
158
172
|
if (!e.length) return;
|
|
159
|
-
|
|
160
|
-
let t =
|
|
161
|
-
fields:
|
|
162
|
-
issuedCount:
|
|
163
|
-
messages:
|
|
173
|
+
_n.current = [];
|
|
174
|
+
let t = je({
|
|
175
|
+
fields: E,
|
|
176
|
+
issuedCount: G,
|
|
177
|
+
messages: u
|
|
164
178
|
});
|
|
165
|
-
|
|
179
|
+
A((n) => {
|
|
166
180
|
let r = { ...n };
|
|
167
181
|
return e.forEach((e) => {
|
|
168
182
|
t[e] ? r[e] = t[e] : delete r[e];
|
|
169
183
|
}), r;
|
|
170
184
|
});
|
|
171
185
|
}, [
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
186
|
+
G,
|
|
187
|
+
u,
|
|
188
|
+
E
|
|
175
189
|
]);
|
|
176
|
-
let
|
|
177
|
-
values:
|
|
178
|
-
errors:
|
|
179
|
-
lockSchedule:
|
|
180
|
-
messages:
|
|
181
|
-
onChange:
|
|
182
|
-
onClearErrors:
|
|
183
|
-
onRevalidateErrors:
|
|
184
|
-
}), q =
|
|
190
|
+
let yn = at({
|
|
191
|
+
values: E,
|
|
192
|
+
errors: Nt,
|
|
193
|
+
lockSchedule: pn,
|
|
194
|
+
messages: u,
|
|
195
|
+
onChange: hn,
|
|
196
|
+
onClearErrors: gn,
|
|
197
|
+
onRevalidateErrors: vn
|
|
198
|
+
}), q = yn.reset, bn = f((e) => D((t) => ({
|
|
185
199
|
...t,
|
|
186
200
|
...e
|
|
187
|
-
})), []), J =
|
|
188
|
-
open:
|
|
189
|
-
isInvoice:
|
|
201
|
+
})), []), J = xt.isPending || gt.isPending || _t.isPending || vt.isPending || yt.isPending || bt.isPending, xn = st({
|
|
202
|
+
open: C,
|
|
203
|
+
isInvoice: E.type === "invoice",
|
|
190
204
|
disabled: J,
|
|
191
|
-
paymentTermsId:
|
|
192
|
-
paymentTermsCustomDate:
|
|
193
|
-
paymentReminderId:
|
|
194
|
-
overdueReminderId:
|
|
195
|
-
messages:
|
|
196
|
-
onSelect:
|
|
197
|
-
}),
|
|
198
|
-
|
|
205
|
+
paymentTermsId: E.paymentTermsId,
|
|
206
|
+
paymentTermsCustomDate: E.paymentTermsCustomDate,
|
|
207
|
+
paymentReminderId: E.paymentReminderId,
|
|
208
|
+
overdueReminderId: E.overdueReminderId,
|
|
209
|
+
messages: u,
|
|
210
|
+
onSelect: bn
|
|
211
|
+
}), Sn = xn.reset, Cn = f(() => {
|
|
212
|
+
S.current = [], Rt(void 0), Dt("create"), kt(void 0), jt(void 0), mn.current = void 0, x.current = void 0, v.current = "draft", y.current = !1, b.current = !1, D(Ve()), k(!1), A({}), zt(!1), R(!1), L.current = {
|
|
199
213
|
lines: !1,
|
|
200
214
|
discount: !1
|
|
201
|
-
},
|
|
202
|
-
}, [
|
|
203
|
-
|
|
215
|
+
}, H(), q();
|
|
216
|
+
}, [H, q]), wn = f((e = "invoice", { customerId: t = "" } = {}) => {
|
|
217
|
+
ln(), dn(), q();
|
|
204
218
|
let n = {
|
|
205
|
-
...
|
|
219
|
+
...Ve(),
|
|
206
220
|
type: e,
|
|
207
221
|
customerId: t
|
|
208
222
|
};
|
|
209
|
-
|
|
223
|
+
Sn(Ze(n)), S.current = [], x.current = void 0, v.current = "draft", y.current = !1, b.current = !1, mn.current = void 0, Rt(void 0), Dt("create"), kt(void 0), jt(void 0), O.current = n, D(n), k(!1), A({}), H(), zt(!1), R(!1), L.current = {
|
|
210
224
|
lines: !1,
|
|
211
225
|
discount: !1
|
|
212
|
-
},
|
|
226
|
+
}, w(!0);
|
|
213
227
|
}, [
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
228
|
+
H,
|
|
229
|
+
ln,
|
|
230
|
+
dn,
|
|
217
231
|
q,
|
|
218
|
-
|
|
219
|
-
]),
|
|
232
|
+
Sn
|
|
233
|
+
]), Tn = f((e, { highlightForIssue: t = !1 } = {}) => {
|
|
220
234
|
if (e.type === "credit_note") return;
|
|
221
|
-
|
|
222
|
-
let n =
|
|
223
|
-
|
|
235
|
+
ln(), dn(), q();
|
|
236
|
+
let n = Ke(e, M);
|
|
237
|
+
Sn(Ze(n)), S.current = e.line_items, Et.current = e.currency, x.current = void 0, v.current = t ? "issue" : "draft", y.current = !1, b.current = t, mn.current = void 0, Rt(void 0), Dt("edit"), kt(e.id), jt(e.type === "invoice" ? e.recurrence_id ?? void 0 : void 0), O.current = n, D(n), k(!1), A({}), zt(!1), R(!1), L.current = {
|
|
224
238
|
lines: !1,
|
|
225
239
|
discount: !1
|
|
226
|
-
},
|
|
240
|
+
}, H(), w(!0);
|
|
227
241
|
}, [
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
242
|
+
H,
|
|
243
|
+
ln,
|
|
244
|
+
dn,
|
|
231
245
|
q,
|
|
232
|
-
|
|
233
|
-
|
|
246
|
+
Sn,
|
|
247
|
+
M
|
|
234
248
|
]);
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
...
|
|
238
|
-
lineItems:
|
|
239
|
-
},
|
|
240
|
-
let t =
|
|
249
|
+
p(() => {
|
|
250
|
+
M?.length && (O.current = {
|
|
251
|
+
...O.current,
|
|
252
|
+
lineItems: he(O.current.lineItems, M)
|
|
253
|
+
}, D((e) => {
|
|
254
|
+
let t = he(e.lineItems, M);
|
|
241
255
|
return t === e.lineItems ? e : {
|
|
242
256
|
...e,
|
|
243
257
|
lineItems: t
|
|
244
258
|
};
|
|
245
259
|
}));
|
|
246
|
-
}, [
|
|
247
|
-
let Y =
|
|
248
|
-
Y || (
|
|
249
|
-
}, [
|
|
250
|
-
if (
|
|
251
|
-
|
|
260
|
+
}, [M]);
|
|
261
|
+
let Y = V.isUploading, En = f(() => {
|
|
262
|
+
Y || (Qt(), k(!1), w(!1), A({}));
|
|
263
|
+
}, [Qt, Y]), Dn = f(() => {
|
|
264
|
+
if (Mt) {
|
|
265
|
+
k(!1);
|
|
252
266
|
return;
|
|
253
267
|
}
|
|
254
268
|
if (Y) {
|
|
255
|
-
e.error(
|
|
269
|
+
e.error(u.attachmentsUploading);
|
|
256
270
|
return;
|
|
257
271
|
}
|
|
258
|
-
if (
|
|
259
|
-
|
|
272
|
+
if (lt(O.current, E)) {
|
|
273
|
+
k(!0);
|
|
260
274
|
return;
|
|
261
275
|
}
|
|
262
|
-
|
|
276
|
+
En();
|
|
263
277
|
}, [
|
|
264
|
-
|
|
278
|
+
En,
|
|
265
279
|
Y,
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
]),
|
|
280
|
+
u.attachmentsUploading,
|
|
281
|
+
Mt,
|
|
282
|
+
E
|
|
283
|
+
]), On = f((e) => {
|
|
270
284
|
let t = { ...e };
|
|
271
|
-
t.taxRate !== void 0 && (t.taxRate =
|
|
285
|
+
t.taxRate !== void 0 && (t.taxRate = _e(t.taxRate), I.current = !0), t.type !== void 0 && t.type !== "invoice" && Qt(), t.type !== void 0 && (v.current = "draft"), t.discount !== void 0 && P && (F.current = !0), t.discountType !== void 0 && (F.current = !0), t.currency !== void 0 && (Bt.current = !0), D((e) => {
|
|
272
286
|
let n = {
|
|
273
|
-
...t.customerId === void 0 ? e :
|
|
287
|
+
...t.customerId === void 0 ? e : ut(e, t.customerId),
|
|
274
288
|
...t
|
|
275
289
|
};
|
|
276
|
-
return t.discount !== void 0 && (n.discount =
|
|
290
|
+
return t.discount !== void 0 && (n.discount = Ie(t.discount, n.discountType, n.currency)), n.currency !== e.currency && (n.lineItems = e.lineItems.map((t) => ({
|
|
277
291
|
...t,
|
|
278
|
-
price:
|
|
279
|
-
}))), (n.currency !== e.currency || n.discountType !== e.discountType) && (n.discount =
|
|
292
|
+
price: ue(t.price, e.currency, n.currency)
|
|
293
|
+
}))), (n.currency !== e.currency || n.discountType !== e.discountType) && (n.discount = Ne({
|
|
280
294
|
value: n.discount,
|
|
281
295
|
type: n.discountType,
|
|
282
296
|
currency: n.currency
|
|
283
297
|
})), n;
|
|
284
298
|
});
|
|
285
|
-
}, [
|
|
286
|
-
|
|
299
|
+
}, [Qt, P]), kn = f(() => R(!0), []), An = f(() => {
|
|
300
|
+
R(!1), F.current = !0, D((e) => ({
|
|
287
301
|
...e,
|
|
288
|
-
discount:
|
|
302
|
+
discount: Ne({
|
|
289
303
|
value: e.discount,
|
|
290
304
|
type: e.discountType,
|
|
291
305
|
currency: e.currency
|
|
292
306
|
})
|
|
293
307
|
}));
|
|
294
|
-
}, []),
|
|
295
|
-
|
|
296
|
-
|
|
308
|
+
}, []), jn = f(() => {
|
|
309
|
+
let e = Ye({
|
|
310
|
+
values: E,
|
|
311
|
+
messages: u,
|
|
312
|
+
canCreateCustomer: _
|
|
313
|
+
}).customerEmail;
|
|
314
|
+
A((t) => {
|
|
315
|
+
if (t.customerEmail === e) return t;
|
|
316
|
+
let n = { ...t };
|
|
317
|
+
return e ? n.customerEmail = e : delete n.customerEmail, n;
|
|
318
|
+
});
|
|
319
|
+
}, [
|
|
320
|
+
_,
|
|
321
|
+
u,
|
|
322
|
+
E
|
|
323
|
+
]), Mn = f(() => {
|
|
324
|
+
I.current = !0, D((e) => {
|
|
325
|
+
let t = le(e.taxRate);
|
|
297
326
|
return t === e.taxRate ? e : {
|
|
298
327
|
...e,
|
|
299
328
|
taxRate: t
|
|
300
329
|
};
|
|
301
330
|
});
|
|
302
|
-
}, []),
|
|
303
|
-
t && (
|
|
331
|
+
}, []), X = f((e, { validate: t }) => {
|
|
332
|
+
t && (Bt.current = !0), D((t) => ({
|
|
304
333
|
...t,
|
|
305
334
|
lineItems: e(t.lineItems)
|
|
306
335
|
}));
|
|
307
336
|
}, []);
|
|
308
|
-
|
|
309
|
-
let e =
|
|
310
|
-
if (!e && !t && !
|
|
311
|
-
|
|
312
|
-
let n =
|
|
313
|
-
currency:
|
|
314
|
-
messages:
|
|
337
|
+
p(() => {
|
|
338
|
+
let e = Bt.current, t = F.current;
|
|
339
|
+
if (!e && !t && !I.current) return;
|
|
340
|
+
Bt.current = !1, F.current = !1, I.current = !1, e && (L.current.lines = !0), t && (L.current.discount = !0);
|
|
341
|
+
let n = y.current || G > 0, r = e ? Se(E.lineItems, {
|
|
342
|
+
currency: E.currency,
|
|
343
|
+
messages: u,
|
|
315
344
|
requireComplete: n
|
|
316
345
|
}) : void 0;
|
|
317
|
-
|
|
346
|
+
A((t) => {
|
|
318
347
|
let i = { ...t };
|
|
319
|
-
return
|
|
348
|
+
return L.current.lines && (i.lineItems = e ? r : t.lineItems, i.lineItemsSummary = be(i.lineItems, Be(E, u), n && E.lineItems.length === 0 ? u.lineItemsRequired : void 0)), L.current.discount && (i.discount = ze(E, u)), i;
|
|
320
349
|
});
|
|
321
350
|
}, [
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
351
|
+
G,
|
|
352
|
+
u,
|
|
353
|
+
E
|
|
325
354
|
]);
|
|
326
|
-
let
|
|
327
|
-
let { unit: n, ...r } = t, i =
|
|
328
|
-
i.name !== void 0 && (i.productId = ""), n !== void 0 && (i.measureUnitId = n, i.measureUnitName = ""), i.taxable !== void 0 && (
|
|
355
|
+
let Nn = f((e, t) => {
|
|
356
|
+
let { unit: n, ...r } = t, i = ge(r);
|
|
357
|
+
i.name !== void 0 && (i.productId = ""), n !== void 0 && (i.measureUnitId = n, i.measureUnitName = ""), i.taxable !== void 0 && (I.current = !0), X((t) => t.map((t) => t.id === e ? {
|
|
329
358
|
...t,
|
|
330
359
|
...i
|
|
331
|
-
} : t), { validate:
|
|
332
|
-
}, [
|
|
333
|
-
|
|
360
|
+
} : t), { validate: P });
|
|
361
|
+
}, [X, P]), Pn = f((e, t) => {
|
|
362
|
+
X((n) => n.map((n) => n.id === e ? {
|
|
334
363
|
...n,
|
|
335
|
-
...
|
|
364
|
+
...pe({
|
|
336
365
|
product: t,
|
|
337
|
-
currency:
|
|
338
|
-
unitNamesById:
|
|
366
|
+
currency: E.currency,
|
|
367
|
+
unitNamesById: N
|
|
339
368
|
})
|
|
340
369
|
} : n), { validate: !0 });
|
|
341
370
|
}, [
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
]),
|
|
346
|
-
t &&
|
|
371
|
+
X,
|
|
372
|
+
N,
|
|
373
|
+
E.currency
|
|
374
|
+
]), Fn = f((e, t) => {
|
|
375
|
+
t && X((n) => t.kind === "remove" ? n.filter((t) => t.id !== e) : n.map((n) => n.id === e ? {
|
|
347
376
|
...n,
|
|
348
377
|
...t.patch
|
|
349
378
|
} : n), { validate: !0 });
|
|
350
|
-
}, [
|
|
351
|
-
let n =
|
|
352
|
-
n &&
|
|
379
|
+
}, [X]), In = f((e, t) => {
|
|
380
|
+
let n = E.lineItems.find((t) => t.id === e);
|
|
381
|
+
n && Fn(e, ce({
|
|
353
382
|
lineItem: n,
|
|
354
383
|
field: t,
|
|
355
|
-
rowCount:
|
|
356
|
-
currency:
|
|
384
|
+
rowCount: E.lineItems.length,
|
|
385
|
+
currency: E.currency
|
|
357
386
|
}));
|
|
358
387
|
}, [
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
]),
|
|
363
|
-
let n =
|
|
364
|
-
n &&
|
|
388
|
+
Fn,
|
|
389
|
+
E.currency,
|
|
390
|
+
E.lineItems
|
|
391
|
+
]), Ln = f((e, t) => {
|
|
392
|
+
let n = E.lineItems.find((t) => t.id === e);
|
|
393
|
+
n && Fn(e, ve({
|
|
365
394
|
lineItem: n,
|
|
366
395
|
step: t,
|
|
367
|
-
rowCount:
|
|
396
|
+
rowCount: E.lineItems.length
|
|
368
397
|
}));
|
|
369
|
-
}, [
|
|
370
|
-
let e =
|
|
371
|
-
|
|
398
|
+
}, [Fn, E.lineItems]), Rn = f(() => {
|
|
399
|
+
let e = de(E.currency);
|
|
400
|
+
Rt(e.id), D((t) => ({
|
|
372
401
|
...t,
|
|
373
402
|
lineItems: [...t.lineItems, e]
|
|
374
403
|
}));
|
|
375
|
-
}, [
|
|
376
|
-
|
|
377
|
-
}, [
|
|
378
|
-
...
|
|
404
|
+
}, [E.currency]), zn = f((e) => {
|
|
405
|
+
X((t) => t.length <= 1 ? t : t.filter((t) => t.id !== e), { validate: !0 });
|
|
406
|
+
}, [X]), Bn = f((e, t) => e.type === "invoice" && (t === "issue" || Me(e) && G === 0), [G]), Vn = f((e, t) => ({
|
|
407
|
+
...Ye({
|
|
379
408
|
values: e,
|
|
380
|
-
|
|
381
|
-
messages: l,
|
|
409
|
+
messages: u,
|
|
382
410
|
willIssue: t,
|
|
383
|
-
hasStartedRecurrence:
|
|
411
|
+
hasStartedRecurrence: G > 0,
|
|
412
|
+
canCreateCustomer: _
|
|
384
413
|
}),
|
|
385
|
-
...e.type === "invoice" &&
|
|
414
|
+
...e.type === "invoice" && d(e) ? je({
|
|
386
415
|
fields: e,
|
|
387
|
-
issuedCount:
|
|
388
|
-
messages:
|
|
416
|
+
issuedCount: G,
|
|
417
|
+
messages: u
|
|
389
418
|
}) : {}
|
|
390
419
|
}), [
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
]),
|
|
420
|
+
_,
|
|
421
|
+
G,
|
|
422
|
+
u
|
|
423
|
+
]), Hn = f(() => {
|
|
395
424
|
requestAnimationFrame(() => {
|
|
396
|
-
let e =
|
|
425
|
+
let e = Tt.current, t = e?.querySelector("[aria-invalid=\"true\"], [data-invalid=\"true\"]");
|
|
397
426
|
if (!e || !t) return;
|
|
398
427
|
let n = t.getBoundingClientRect().top - e.getBoundingClientRect().top + e.scrollTop;
|
|
399
428
|
e.scrollTo({
|
|
@@ -401,37 +430,31 @@ function ct({ messages: l, counterpartMessageLabels: ct, embeddedBankName: lt, o
|
|
|
401
430
|
behavior: "smooth"
|
|
402
431
|
});
|
|
403
432
|
});
|
|
404
|
-
}, []),
|
|
405
|
-
|
|
433
|
+
}, []), Un = f((e, t) => {
|
|
434
|
+
A(e), zt(!0), y.current = t, L.current = {
|
|
406
435
|
lines: !0,
|
|
407
436
|
discount: !0
|
|
408
|
-
},
|
|
409
|
-
}, [
|
|
410
|
-
|
|
411
|
-
if (!
|
|
412
|
-
|
|
413
|
-
let e =
|
|
414
|
-
|
|
437
|
+
}, Hn();
|
|
438
|
+
}, [Hn]), Wn = !At || E.frequency !== "once" || fn.isError;
|
|
439
|
+
p(() => {
|
|
440
|
+
if (!C || !b.current || z || K || !Wn) return;
|
|
441
|
+
b.current = !1;
|
|
442
|
+
let e = Bn(E, "issue");
|
|
443
|
+
Un(Vn(E, e), e);
|
|
415
444
|
}, [
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
445
|
+
z,
|
|
446
|
+
C,
|
|
447
|
+
Wn,
|
|
448
|
+
K,
|
|
449
|
+
Un,
|
|
450
|
+
Vn,
|
|
451
|
+
E,
|
|
452
|
+
Bn
|
|
424
453
|
]);
|
|
425
|
-
let
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
f(() => {
|
|
430
|
-
let e = In.current;
|
|
431
|
-
if (In.current = {
|
|
432
|
-
values: w,
|
|
433
|
-
billingAddressId: L
|
|
434
|
-
}, !M) return;
|
|
454
|
+
let Gn = h({ values: E });
|
|
455
|
+
p(() => {
|
|
456
|
+
let e = Gn.current;
|
|
457
|
+
if (Gn.current = { values: E }, !P) return;
|
|
435
458
|
let t = [
|
|
436
459
|
"customerId",
|
|
437
460
|
"customerEmail",
|
|
@@ -441,292 +464,313 @@ function ct({ messages: l, counterpartMessageLabels: ct, embeddedBankName: lt, o
|
|
|
441
464
|
"openingNote",
|
|
442
465
|
"closingNote",
|
|
443
466
|
"taxRate"
|
|
444
|
-
].filter((t) => e.values[t] !==
|
|
467
|
+
].filter((t) => e.values[t] !== E[t] || t === "customerId" && e.values.customerName !== E.customerName || t === "paymentTermsId" && e.values.paymentTermsCustomDate !== E.paymentTermsCustomDate);
|
|
445
468
|
if (!t.length) return;
|
|
446
|
-
let n =
|
|
447
|
-
values:
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
469
|
+
let n = Ye({
|
|
470
|
+
values: E,
|
|
471
|
+
messages: u,
|
|
472
|
+
willIssue: y.current,
|
|
473
|
+
canCreateCustomer: _
|
|
451
474
|
});
|
|
452
|
-
|
|
475
|
+
A((e) => {
|
|
453
476
|
let r = { ...e };
|
|
454
477
|
return t.forEach((e) => {
|
|
455
478
|
n[e] ? r[e] = n[e] : delete r[e];
|
|
456
479
|
}), r;
|
|
457
480
|
});
|
|
458
481
|
}, [
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
482
|
+
_,
|
|
483
|
+
u,
|
|
484
|
+
P,
|
|
485
|
+
E
|
|
463
486
|
]);
|
|
464
|
-
let
|
|
465
|
-
if (
|
|
487
|
+
let Kn = f(async (t) => {
|
|
488
|
+
if (v.current = t, K) return;
|
|
466
489
|
if (Y) {
|
|
467
|
-
e.error(
|
|
490
|
+
e.error(u.attachmentsUploading);
|
|
468
491
|
return;
|
|
469
492
|
}
|
|
470
|
-
if (
|
|
471
|
-
e.error(
|
|
493
|
+
if (j.isLoading || z) {
|
|
494
|
+
e.error(u.lineItemsLoading);
|
|
472
495
|
return;
|
|
473
496
|
}
|
|
474
|
-
let n =
|
|
475
|
-
...
|
|
497
|
+
let n = ye(E.lineItems), i = n.length === E.lineItems.length ? E : {
|
|
498
|
+
...E,
|
|
476
499
|
lineItems: n
|
|
477
500
|
};
|
|
478
|
-
i !==
|
|
479
|
-
let a = i.type === "invoice" &&
|
|
480
|
-
if (o && (
|
|
481
|
-
e.error(
|
|
501
|
+
i !== E && D(i);
|
|
502
|
+
let a = i.type === "invoice" && d(i), o = Bn(i, t);
|
|
503
|
+
if (o && (Xt || U.isLoading)) {
|
|
504
|
+
e.error(u.issueChecksLoading);
|
|
482
505
|
return;
|
|
483
506
|
}
|
|
484
|
-
if (o && !
|
|
485
|
-
e.error(
|
|
507
|
+
if (o && !U.canAddAccount && !i.bankAccountId && !U.hasAccounts) {
|
|
508
|
+
e.error(u.issueBankAccountUnavailable);
|
|
486
509
|
return;
|
|
487
510
|
}
|
|
488
|
-
let ee =
|
|
489
|
-
if (
|
|
490
|
-
|
|
511
|
+
let ee = Vn(i, o);
|
|
512
|
+
if (He(ee)) {
|
|
513
|
+
Un(ee, o);
|
|
491
514
|
return;
|
|
492
515
|
}
|
|
493
|
-
if (
|
|
494
|
-
e.error(
|
|
516
|
+
if (A({}), o && B.isTaxIdMissing) {
|
|
517
|
+
e.error(u.issueTaxIdRequired);
|
|
495
518
|
return;
|
|
496
519
|
}
|
|
520
|
+
let s = _ && !i.customerId && !!i.customerName.trim(), ne = i.customerEmail.trim();
|
|
497
521
|
if (o && (i.paymentReminderId || i.overdueReminderId)) {
|
|
498
|
-
let t =
|
|
522
|
+
let t = s ? ne ? void 0 : u.issueRemindersNoEmail : Xe(B.counterpart, u);
|
|
499
523
|
if (t) {
|
|
500
524
|
e.error(t);
|
|
501
525
|
return;
|
|
502
526
|
}
|
|
503
527
|
}
|
|
504
|
-
|
|
528
|
+
if (s) {
|
|
529
|
+
let t;
|
|
530
|
+
try {
|
|
531
|
+
t = (await xt.mutateAsync({ body: te({
|
|
532
|
+
name: i.customerName,
|
|
533
|
+
email: i.customerEmail
|
|
534
|
+
}) }))?.id;
|
|
535
|
+
} catch (t) {
|
|
536
|
+
e.error(tt(t, { messages: u }));
|
|
537
|
+
return;
|
|
538
|
+
}
|
|
539
|
+
if (!t) return;
|
|
540
|
+
i = dt(i, t);
|
|
541
|
+
let n = t;
|
|
542
|
+
D((e) => dt(e, n));
|
|
543
|
+
}
|
|
544
|
+
let c = T === "edit" ? Ot : x.current, l, re, ie = {};
|
|
505
545
|
try {
|
|
506
|
-
if (
|
|
507
|
-
let e =
|
|
546
|
+
if (c) {
|
|
547
|
+
let e = We({
|
|
508
548
|
values: i,
|
|
509
|
-
originalLineItems:
|
|
510
|
-
originalCurrency:
|
|
511
|
-
unitNamesById:
|
|
512
|
-
units:
|
|
549
|
+
originalLineItems: S.current,
|
|
550
|
+
originalCurrency: Et.current,
|
|
551
|
+
unitNamesById: N,
|
|
552
|
+
units: M
|
|
513
553
|
});
|
|
514
|
-
|
|
554
|
+
ie = Je({
|
|
515
555
|
values: i,
|
|
516
|
-
originalLineItems:
|
|
556
|
+
originalLineItems: S.current,
|
|
517
557
|
changes: e
|
|
518
558
|
});
|
|
519
|
-
let t = await
|
|
520
|
-
path: { receivable_id:
|
|
521
|
-
body:
|
|
559
|
+
let t = await _t.mutateAsync({
|
|
560
|
+
path: { receivable_id: c },
|
|
561
|
+
body: Ge({
|
|
522
562
|
values: i,
|
|
523
|
-
billingAddressId:
|
|
524
|
-
shippingAddressId:
|
|
563
|
+
billingAddressId: qt,
|
|
564
|
+
shippingAddressId: Yt,
|
|
525
565
|
lineItemChanges: e
|
|
526
566
|
})
|
|
527
567
|
});
|
|
528
|
-
|
|
568
|
+
$t(), l = c, re = t?.type ?? i.type, a && t && (S.current = t.line_items, Et.current = t.currency, i = {
|
|
529
569
|
...i,
|
|
530
|
-
lineItems:
|
|
531
|
-
},
|
|
570
|
+
lineItems: me(i.lineItems, t.line_items)
|
|
571
|
+
}, D(i));
|
|
532
572
|
} else {
|
|
533
|
-
|
|
534
|
-
let e = await
|
|
573
|
+
ie = Je({ values: i });
|
|
574
|
+
let e = await gt.mutateAsync({ body: Ue({
|
|
535
575
|
values: i,
|
|
536
|
-
billingAddressId:
|
|
537
|
-
shippingAddressId:
|
|
538
|
-
unitNamesById:
|
|
576
|
+
billingAddressId: qt,
|
|
577
|
+
shippingAddressId: Yt,
|
|
578
|
+
unitNamesById: N
|
|
539
579
|
}) });
|
|
540
580
|
if (!e?.id) {
|
|
541
|
-
|
|
581
|
+
w(!1), Cn();
|
|
542
582
|
return;
|
|
543
583
|
}
|
|
544
|
-
|
|
584
|
+
l = e.id, re = e.type, a && (x.current = e.id, S.current = e.line_items, Et.current = e.currency, i = {
|
|
545
585
|
...i,
|
|
546
|
-
lineItems:
|
|
547
|
-
},
|
|
586
|
+
lineItems: me(i.lineItems, e.line_items)
|
|
587
|
+
}, D(i));
|
|
548
588
|
}
|
|
549
589
|
} catch (t) {
|
|
550
|
-
let n =
|
|
590
|
+
let n = $e[i.type], r = tt(t, {
|
|
551
591
|
irrelevantVariants: n,
|
|
552
|
-
messages:
|
|
592
|
+
messages: u
|
|
553
593
|
});
|
|
554
|
-
e.error((
|
|
555
|
-
let { errors: a, listError: ee } =
|
|
556
|
-
|
|
594
|
+
e.error((c ? u.updateFailed : u.createFailed).replace("{errorMessage}", r));
|
|
595
|
+
let { errors: a, listError: ee } = et(nt(t, n), ie), s = be(a.lineItems, void 0, ee);
|
|
596
|
+
Un({
|
|
557
597
|
...a,
|
|
558
|
-
...
|
|
598
|
+
...s ? { lineItemsSummary: s } : {}
|
|
559
599
|
}, o);
|
|
560
600
|
return;
|
|
561
601
|
}
|
|
562
|
-
let
|
|
602
|
+
let ae = a ? "recurrence" : "draft";
|
|
563
603
|
if (a) try {
|
|
564
|
-
|
|
565
|
-
path: { recurrence_id:
|
|
566
|
-
body:
|
|
567
|
-
}) : await
|
|
604
|
+
W ? await yt.mutateAsync({
|
|
605
|
+
path: { recurrence_id: W.id },
|
|
606
|
+
body: Oe(i, { lockSchedule: pn })
|
|
607
|
+
}) : await vt.mutateAsync({ body: De(i, l) });
|
|
568
608
|
} catch (t) {
|
|
569
|
-
e.error(
|
|
609
|
+
e.error(tt(t, { messages: u }));
|
|
570
610
|
return;
|
|
571
611
|
}
|
|
572
612
|
else if (o) try {
|
|
573
|
-
await
|
|
613
|
+
await bt.mutateAsync({ path: { receivable_id: l } }), ae = "issue";
|
|
574
614
|
} catch {
|
|
575
|
-
e.error(
|
|
615
|
+
e.error(u.issueFailedAfterSave);
|
|
576
616
|
}
|
|
577
|
-
let
|
|
578
|
-
|
|
579
|
-
mode:
|
|
617
|
+
let oe = T === "create" ? mt : ht;
|
|
618
|
+
w(!1), Cn(), oe?.(l, re, {
|
|
619
|
+
mode: ae,
|
|
580
620
|
counterpartId: i.customerId,
|
|
581
|
-
inlineItems:
|
|
582
|
-
hasCustomerEmail: !!(
|
|
621
|
+
inlineItems: Ee(i.lineItems, i.currency),
|
|
622
|
+
hasCustomerEmail: s ? !!ne : !!(B.counterpart && r(B.counterpart).trim())
|
|
583
623
|
});
|
|
584
624
|
}, [
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
L,
|
|
625
|
+
U.canAddAccount,
|
|
626
|
+
U.hasAccounts,
|
|
627
|
+
U.isLoading,
|
|
589
628
|
qt,
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
U,
|
|
594
|
-
R,
|
|
595
|
-
Y,
|
|
596
|
-
Wt,
|
|
629
|
+
_,
|
|
630
|
+
$t,
|
|
631
|
+
xt,
|
|
597
632
|
gt,
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
A,
|
|
610
|
-
j,
|
|
611
|
-
k.isLoading,
|
|
612
|
-
pt,
|
|
633
|
+
vt,
|
|
634
|
+
Ot,
|
|
635
|
+
W,
|
|
636
|
+
z,
|
|
637
|
+
Y,
|
|
638
|
+
Xt,
|
|
639
|
+
bt,
|
|
640
|
+
pn,
|
|
641
|
+
u,
|
|
642
|
+
T,
|
|
643
|
+
mt,
|
|
613
644
|
ht,
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
645
|
+
B.counterpart,
|
|
646
|
+
B.isTaxIdMissing,
|
|
647
|
+
K,
|
|
648
|
+
Cn,
|
|
649
|
+
Yt,
|
|
650
|
+
Un,
|
|
651
|
+
M,
|
|
652
|
+
N,
|
|
653
|
+
j.isLoading,
|
|
654
|
+
_t,
|
|
655
|
+
yt,
|
|
656
|
+
Vn,
|
|
657
|
+
E,
|
|
658
|
+
Bn
|
|
659
|
+
]), Z = f(async (e = v.current) => {
|
|
660
|
+
if (!St.current) {
|
|
661
|
+
St.current = !0, wt(e);
|
|
620
662
|
try {
|
|
621
|
-
await
|
|
663
|
+
await Kn(e);
|
|
622
664
|
} finally {
|
|
623
|
-
|
|
665
|
+
St.current = !1, wt(void 0);
|
|
624
666
|
}
|
|
625
667
|
}
|
|
626
|
-
}, [
|
|
627
|
-
...
|
|
628
|
-
discount:
|
|
629
|
-
lineItems:
|
|
630
|
-
}), [
|
|
631
|
-
|
|
632
|
-
}, []),
|
|
633
|
-
|
|
634
|
-
}, [$]),
|
|
635
|
-
if (!
|
|
636
|
-
await
|
|
668
|
+
}, [Kn]), qn = m(() => ({
|
|
669
|
+
...E,
|
|
670
|
+
discount: Vt ? E.discount : Pe(Fe(E.discount, E.discountType, E.currency), E.discountType, E.currency),
|
|
671
|
+
lineItems: E.lineItems.map(xe)
|
|
672
|
+
}), [Vt, E]), Jn = m(() => se(E.lineItems), [E.lineItems]), Yn = m(() => Re(E), [E]), Xn = E.type === "invoice", Q = Xn && d(E), Zn = J || j.isLoading || z || V.isUploading || K, Qn = T === "edit" ? u.updateDraftButton : u.saveDraftButton, $n = Q ? W ? u.recurrenceUpdateButton : u.recurrenceActivateButton : Xn ? u.issueButton : Qn, $ = Xn && !Q ? "issue" : "draft", er = f(() => Z("draft"), [Z]), tr = f(() => Z($), [$, Z]), nr = f(() => Z(), [Z]), rr = f(() => {
|
|
673
|
+
v.current = "draft";
|
|
674
|
+
}, []), ir = f(() => {
|
|
675
|
+
v.current = $;
|
|
676
|
+
}, [$]), ar = Zn || Q, or = f(async () => {
|
|
677
|
+
if (!ar) try {
|
|
678
|
+
await Z("draft");
|
|
637
679
|
} finally {
|
|
638
|
-
|
|
680
|
+
k(!1);
|
|
639
681
|
}
|
|
640
|
-
}, [
|
|
641
|
-
open:
|
|
642
|
-
onSaveDraft: () => void
|
|
643
|
-
onDiscard:
|
|
644
|
-
onCancel:
|
|
682
|
+
}, [ar, Z]), sr = f(() => k(!1), []), cr = m(() => ({
|
|
683
|
+
open: Mt,
|
|
684
|
+
onSaveDraft: () => void or(),
|
|
685
|
+
onDiscard: En,
|
|
686
|
+
onCancel: sr,
|
|
645
687
|
isSaving: J,
|
|
646
|
-
isSaveDraftDisabled:
|
|
688
|
+
isSaveDraftDisabled: ar
|
|
647
689
|
}), [
|
|
648
|
-
|
|
649
|
-
|
|
690
|
+
sr,
|
|
691
|
+
En,
|
|
650
692
|
J,
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
]),
|
|
655
|
-
values:
|
|
656
|
-
totals:
|
|
657
|
-
billingAddress:
|
|
658
|
-
bankAccount:
|
|
659
|
-
unitNamesById:
|
|
660
|
-
messages:
|
|
661
|
-
enabled:
|
|
693
|
+
ar,
|
|
694
|
+
or,
|
|
695
|
+
Mt
|
|
696
|
+
]), lr = m(() => Le(Yn, E.currency), [Yn, E.currency]), ur = ct({
|
|
697
|
+
values: E,
|
|
698
|
+
totals: Yn,
|
|
699
|
+
billingAddress: Jt,
|
|
700
|
+
bankAccount: U.selectedAccount,
|
|
701
|
+
unitNamesById: N,
|
|
702
|
+
messages: u,
|
|
703
|
+
enabled: C
|
|
662
704
|
});
|
|
663
705
|
return {
|
|
664
|
-
open:
|
|
665
|
-
setOpen:
|
|
666
|
-
mode:
|
|
667
|
-
values:
|
|
668
|
-
sheetValues:
|
|
669
|
-
errors:
|
|
670
|
-
setValues:
|
|
671
|
-
updateValues:
|
|
672
|
-
commitTaxRate:
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
706
|
+
open: C,
|
|
707
|
+
setOpen: w,
|
|
708
|
+
mode: T,
|
|
709
|
+
values: E,
|
|
710
|
+
sheetValues: qn,
|
|
711
|
+
errors: Nt,
|
|
712
|
+
setValues: D,
|
|
713
|
+
updateValues: On,
|
|
714
|
+
commitTaxRate: Mn,
|
|
715
|
+
commitCustomerEmail: jn,
|
|
716
|
+
focusDiscount: kn,
|
|
717
|
+
commitDiscount: An,
|
|
718
|
+
updateLineItem: Nn,
|
|
719
|
+
selectProduct: Pn,
|
|
720
|
+
commitLineItem: In,
|
|
721
|
+
stepLineItem: Ln,
|
|
722
|
+
addLineItem: Rn,
|
|
723
|
+
removeLineItem: zn,
|
|
724
|
+
attachmentsView: en,
|
|
725
|
+
attachmentsUploading: V.isUploading,
|
|
726
|
+
draftButtonLabel: Xn && !Q ? Qn : void 0,
|
|
727
|
+
draftDisabled: Zn,
|
|
728
|
+
draftLoading: J && Ct === "draft",
|
|
729
|
+
primaryButtonLabel: $n,
|
|
730
|
+
primaryLoading: J && Ct === $,
|
|
731
|
+
primaryDisabled: Zn || U.isLoading && Bn(E, $) || Xn && (Xt || !Q && B.isCounterpartLoading),
|
|
732
|
+
scrollContainerRef: Tt,
|
|
733
|
+
selectAttachmentFiles: V.selectFiles,
|
|
734
|
+
setAttachmentIncludeInEmail: V.setIncludeInEmail,
|
|
735
|
+
removeAttachment: V.remove,
|
|
736
|
+
autoFocusLineItemId: Lt,
|
|
737
|
+
lineItemUnitOptions: It.unitOptions,
|
|
738
|
+
lineItemsLoading: j.isLoading,
|
|
739
|
+
lineItemControls: Jn,
|
|
740
|
+
totals: Yn,
|
|
741
|
+
preview: ur,
|
|
742
|
+
totalsView: lr,
|
|
743
|
+
currencySymbol: fe(E.currency),
|
|
701
744
|
isSubmitting: J,
|
|
702
|
-
paymentTerms:
|
|
703
|
-
showBillingSection:
|
|
704
|
-
purchaseOrder:
|
|
705
|
-
value:
|
|
706
|
-
error:
|
|
745
|
+
paymentTerms: cn,
|
|
746
|
+
showBillingSection: E.type === "invoice" || T === "edit",
|
|
747
|
+
purchaseOrder: T === "create" ? {
|
|
748
|
+
value: E.purchaseOrder,
|
|
749
|
+
error: Nt.purchaseOrder
|
|
707
750
|
} : void 0,
|
|
708
|
-
recurrence:
|
|
709
|
-
showRecurrenceSection:
|
|
710
|
-
recurrenceLoading:
|
|
711
|
-
showDueDateField:
|
|
712
|
-
openCreate:
|
|
713
|
-
openEdit:
|
|
714
|
-
close:
|
|
715
|
-
requestClose:
|
|
716
|
-
unsavedPrompt:
|
|
717
|
-
submit:
|
|
718
|
-
submitDraft:
|
|
719
|
-
submitPrimary:
|
|
720
|
-
selectDraftMode:
|
|
721
|
-
selectPrimaryMode:
|
|
722
|
-
units:
|
|
723
|
-
counterpartView:
|
|
724
|
-
counterpartForm:
|
|
725
|
-
stateOptions:
|
|
726
|
-
openCounterpartCreate:
|
|
727
|
-
|
|
728
|
-
|
|
751
|
+
recurrence: yn,
|
|
752
|
+
showRecurrenceSection: E.type === "invoice",
|
|
753
|
+
recurrenceLoading: K,
|
|
754
|
+
showDueDateField: E.type === "quote",
|
|
755
|
+
openCreate: wn,
|
|
756
|
+
openEdit: Tn,
|
|
757
|
+
close: En,
|
|
758
|
+
requestClose: Dn,
|
|
759
|
+
unsavedPrompt: cr,
|
|
760
|
+
submit: nr,
|
|
761
|
+
submitDraft: er,
|
|
762
|
+
submitPrimary: tr,
|
|
763
|
+
selectDraftMode: rr,
|
|
764
|
+
selectPrimaryMode: ir,
|
|
765
|
+
units: It,
|
|
766
|
+
counterpartView: Pt,
|
|
767
|
+
counterpartForm: nn,
|
|
768
|
+
stateOptions: Ht,
|
|
769
|
+
openCounterpartCreate: on,
|
|
770
|
+
customer: Gt.data?.id === E.customerId ? Gt.data : void 0,
|
|
771
|
+
bankAccount: U,
|
|
772
|
+
reminders: xn
|
|
729
773
|
};
|
|
730
774
|
}
|
|
731
775
|
//#endregion
|
|
732
|
-
export {
|
|
776
|
+
export { ft as useReceivableForm };
|