@tesouro/embedded-components-react 0.11.141 → 0.11.168

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