@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,234 +7,234 @@ import { extractApiErrorMessage as t } from "../../../../../shared/util/dist/lib
|
|
|
7
7
|
import "../../../../../shared/ui/dist/index.js";
|
|
8
8
|
import { getCounterpartEmail as n } from "../../../../../shared/counterpart-management/feature/dist/lib/helpers.js";
|
|
9
9
|
import "../../../../../shared/counterpart-management/feature/dist/index.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { useMarkReceivablePaidMutation as re, useMarkReceivableUncollectibleMutation as ie } from "../../../../data-access/dist/index12.js";
|
|
14
|
-
import { useCancelRecurrenceMutation as ae, usePauseRecurrenceMutation as oe, useResumeRecurrenceMutation as se } from "../../../../data-access/dist/index14.js";
|
|
10
|
+
import { useAcceptReceivableMutation as r, useCancelReceivableMutation as i, useCloneReceivableMutation as a, useDeclineReceivableMutation as o, useDeleteReceivableMutation as s, useIssueReceivableMutation as c } from "../../../../data-access/dist/index11.js";
|
|
11
|
+
import { useMarkReceivablePaidMutation as l, useMarkReceivableUncollectibleMutation as u } from "../../../../data-access/dist/index13.js";
|
|
12
|
+
import { useCancelRecurrenceMutation as ee, usePauseRecurrenceMutation as te, useResumeRecurrenceMutation as ne } from "../../../../data-access/dist/index15.js";
|
|
15
13
|
import "../../../../data-access/dist/index.js";
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
14
|
+
import { defaultSendValues as d, formatMoney as f, hasSendErrors as re, isReceivableReadyToIssue as p, splitEmailList as m, validateSendValues as ie } from "./helpers.js";
|
|
15
|
+
import { getIssueReminderBlocker as ae, hasSelectedReminder as oe } from "./reminders.js";
|
|
16
|
+
import { useReceivableIssuePreflight as se } from "./useReceivableIssuePreflight.js";
|
|
17
|
+
import { useReceivablePaymentRecord as ce } from "./useReceivablePaymentRecord.js";
|
|
18
|
+
import { useSendReceivableWithPaymentLink as le } from "./useSendReceivableWithPaymentLink.js";
|
|
19
|
+
import { useCallback as h, useEffect as ue, useState as g } from "react";
|
|
20
20
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActions.js
|
|
21
|
-
function
|
|
22
|
-
let
|
|
23
|
-
messages:
|
|
24
|
-
documentType:
|
|
25
|
-
}), G =
|
|
21
|
+
function _({ selectedReceivable: f, selectedRecurrence: _, messages: y, onCreated: b, onDeleted: x, onCompleteBeforeIssue: S, onIssuedForSend: C }) {
|
|
22
|
+
let w = c(), T = i(), E = a(), D = r(), O = o(), k = s(), A = l(), j = u(), M = te(), N = ne(), P = ee(), [F, I] = g(), [pe, L] = g(), [R, z] = g(""), [B, me] = g(), [V, H] = g(() => d(void 0, y)), [he, U] = g({}), { send: W, isPending: ge } = le({
|
|
23
|
+
messages: y,
|
|
24
|
+
documentType: B?.type
|
|
25
|
+
}), G = ce({ messages: y }), K = G.open, q = M.mutate, _e = E.mutate, ve = N.mutate, J = f?.type === "invoice" && f.status === "draft" ? f : void 0, [Y, ye] = g(), X = Y?.issueCheck ?? (J ? v(J) : void 0), Z = w.mutate, Q = se({
|
|
26
26
|
counterpartId: X?.counterpartId,
|
|
27
27
|
billingAddressId: X?.billingAddressId,
|
|
28
28
|
billingCountry: X?.billingCountry
|
|
29
29
|
});
|
|
30
|
-
|
|
30
|
+
ue(() => {
|
|
31
31
|
if (!Y || Q.isLoading) return;
|
|
32
32
|
ye(void 0);
|
|
33
|
-
let t = Y.issueCheck ? Q.isTaxIdMissing ?
|
|
33
|
+
let t = Y.issueCheck ? Q.isTaxIdMissing ? y.issueTaxIdRequired : Y.issueCheck.hasReminder ? ae(Q.counterpart, y) : void 0 : void 0;
|
|
34
34
|
if (t) {
|
|
35
35
|
e.error(t);
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
38
|
Z({ path: { receivable_id: Y.id } }, {
|
|
39
|
-
onSuccess: () => e.success(
|
|
40
|
-
onError: () => e.error(
|
|
39
|
+
onSuccess: () => e.success(y.issueSucceeded),
|
|
40
|
+
onError: () => e.error(y.issueFailed)
|
|
41
41
|
});
|
|
42
42
|
}, [
|
|
43
43
|
Z,
|
|
44
|
-
|
|
44
|
+
y,
|
|
45
45
|
Y,
|
|
46
46
|
Q.counterpart,
|
|
47
47
|
Q.isLoading,
|
|
48
48
|
Q.isTaxIdMissing
|
|
49
49
|
]);
|
|
50
|
-
let be =
|
|
51
|
-
let
|
|
52
|
-
id:
|
|
53
|
-
type:
|
|
54
|
-
title:
|
|
55
|
-
action:
|
|
56
|
-
},
|
|
57
|
-
if (
|
|
58
|
-
|
|
50
|
+
let be = h((r, i, a) => {
|
|
51
|
+
let o = "documentLabel" in i ? i.documentLabel : i.title, s = {
|
|
52
|
+
id: i.id,
|
|
53
|
+
type: i.type,
|
|
54
|
+
title: o,
|
|
55
|
+
action: r
|
|
56
|
+
}, c = a === void 0 ? f : a ?? void 0;
|
|
57
|
+
if (r === "send") {
|
|
58
|
+
me(s), H(d(c, y)), U({});
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
|
-
if (
|
|
62
|
-
if (
|
|
63
|
-
let t =
|
|
61
|
+
if (r === "issueAndSend") {
|
|
62
|
+
if (c?.type !== "invoice") return;
|
|
63
|
+
let t = c;
|
|
64
64
|
if (Q.isLoading) return;
|
|
65
65
|
if (!Q.counterpart || !n(Q.counterpart)) {
|
|
66
|
-
e.error(
|
|
66
|
+
e.error(y.issueAndSendNoEmail);
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
|
-
if (
|
|
70
|
-
|
|
69
|
+
if (S && !p(t, y)) {
|
|
70
|
+
S(t, "issueAndSend");
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
|
-
let r = Q.isTaxIdMissing ?
|
|
73
|
+
let r = Q.isTaxIdMissing ? y.issueTaxIdRequired : oe(t) ? ae(Q.counterpart, y) : void 0;
|
|
74
74
|
if (r) {
|
|
75
75
|
e.error(r);
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
78
|
Z({ path: { receivable_id: t.id } }, {
|
|
79
79
|
onSuccess: () => {
|
|
80
|
-
e.success(
|
|
80
|
+
e.success(y.issueSucceeded), C?.(t.id, t.counterpart_id);
|
|
81
81
|
},
|
|
82
|
-
onError: () => e.error(
|
|
82
|
+
onError: () => e.error(y.issueFailed)
|
|
83
83
|
});
|
|
84
84
|
return;
|
|
85
85
|
}
|
|
86
|
-
if (
|
|
87
|
-
_e({ path: { receivable_id:
|
|
86
|
+
if (r === "clone") {
|
|
87
|
+
_e({ path: { receivable_id: i.id } }, {
|
|
88
88
|
onSuccess: (t) => {
|
|
89
|
-
t?.id &&
|
|
89
|
+
t?.id && b?.(t.id, t.type), e.success(y.cloneSuccess);
|
|
90
90
|
},
|
|
91
|
-
onError: (n) => e.error(t(n) ??
|
|
91
|
+
onError: (n) => e.error(t(n) ?? y.cloneError)
|
|
92
92
|
});
|
|
93
93
|
return;
|
|
94
94
|
}
|
|
95
|
-
let
|
|
96
|
-
if (
|
|
97
|
-
if (!
|
|
98
|
-
let n =
|
|
95
|
+
let l = c?.type === "invoice" ? c.recurrence_id ?? void 0 : void 0;
|
|
96
|
+
if (r === "pauseRecurrence" || r === "resumeRecurrence") {
|
|
97
|
+
if (!l) return;
|
|
98
|
+
let n = r === "pauseRecurrence";
|
|
99
99
|
(n ? q : ve)({
|
|
100
|
-
path: { recurrence_id:
|
|
101
|
-
receivableId:
|
|
100
|
+
path: { recurrence_id: l },
|
|
101
|
+
receivableId: i.id
|
|
102
102
|
}, {
|
|
103
|
-
onSuccess: () => e.success(n ?
|
|
104
|
-
onError: (n) => e.error(t(n) ??
|
|
103
|
+
onSuccess: () => e.success(n ? y.recurrencePaused : y.recurrenceResumed),
|
|
104
|
+
onError: (n) => e.error(t(n) ?? y.genericError)
|
|
105
105
|
});
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
108
|
-
if (
|
|
109
|
-
if (!
|
|
110
|
-
|
|
111
|
-
...
|
|
112
|
-
recurrenceId:
|
|
113
|
-
description:
|
|
108
|
+
if (r === "cancelRecurrence") {
|
|
109
|
+
if (!l || c?.type !== "invoice") return;
|
|
110
|
+
L(void 0), I({
|
|
111
|
+
...s,
|
|
112
|
+
recurrenceId: l,
|
|
113
|
+
description: de(c, _, y)
|
|
114
114
|
});
|
|
115
115
|
return;
|
|
116
116
|
}
|
|
117
|
-
if (
|
|
118
|
-
|
|
117
|
+
if (r === "recordPayment") {
|
|
118
|
+
c?.type === "invoice" && K(c);
|
|
119
119
|
return;
|
|
120
120
|
}
|
|
121
|
-
let
|
|
122
|
-
if (
|
|
123
|
-
|
|
121
|
+
let u = r === "issue" && c?.type === "invoice" ? c : void 0;
|
|
122
|
+
if (u && S && !p(u, y)) {
|
|
123
|
+
S(u, "issue");
|
|
124
124
|
return;
|
|
125
125
|
}
|
|
126
|
-
if (
|
|
126
|
+
if (r === "issue") {
|
|
127
127
|
ye({
|
|
128
|
-
id:
|
|
129
|
-
issueCheck:
|
|
128
|
+
id: i.id,
|
|
129
|
+
issueCheck: u ? v(u) : void 0
|
|
130
130
|
});
|
|
131
131
|
return;
|
|
132
132
|
}
|
|
133
|
-
|
|
133
|
+
L(void 0), z(""), I(s);
|
|
134
134
|
}, [
|
|
135
135
|
_e,
|
|
136
136
|
Z,
|
|
137
|
-
v,
|
|
138
|
-
x,
|
|
139
137
|
y,
|
|
140
138
|
S,
|
|
139
|
+
b,
|
|
140
|
+
C,
|
|
141
141
|
K,
|
|
142
142
|
Q.counterpart,
|
|
143
143
|
Q.isLoading,
|
|
144
144
|
Q.isTaxIdMissing,
|
|
145
145
|
q,
|
|
146
146
|
ve,
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
]), xe =
|
|
150
|
-
|
|
151
|
-
}, []), $ =
|
|
152
|
-
|
|
153
|
-
}, []), Se =
|
|
154
|
-
if (!
|
|
155
|
-
let n = { receivable_id:
|
|
156
|
-
if (
|
|
157
|
-
if (!
|
|
147
|
+
f,
|
|
148
|
+
_
|
|
149
|
+
]), xe = h(() => {
|
|
150
|
+
I(void 0), L(void 0);
|
|
151
|
+
}, []), $ = h(() => {
|
|
152
|
+
me(void 0), U({});
|
|
153
|
+
}, []), Se = h(async () => {
|
|
154
|
+
if (!F) return;
|
|
155
|
+
let n = { receivable_id: F.id };
|
|
156
|
+
if (F.action === "cancelRecurrence") {
|
|
157
|
+
if (!F.recurrenceId) return;
|
|
158
158
|
try {
|
|
159
|
-
await
|
|
160
|
-
path: { recurrence_id:
|
|
161
|
-
receivableId:
|
|
162
|
-
}), e.success(
|
|
159
|
+
await P.mutateAsync({
|
|
160
|
+
path: { recurrence_id: F.recurrenceId },
|
|
161
|
+
receivableId: F.id
|
|
162
|
+
}), e.success(y.recurrenceCanceled), I(void 0);
|
|
163
163
|
} catch (n) {
|
|
164
|
-
e.error(t(n) ??
|
|
164
|
+
e.error(t(n) ?? y.genericError);
|
|
165
165
|
}
|
|
166
166
|
return;
|
|
167
167
|
}
|
|
168
168
|
try {
|
|
169
|
-
|
|
169
|
+
F.action === "cancel" ? await T.mutateAsync({ path: n }) : F.action === "accept" ? await D.mutateAsync({ path: n }) : F.action === "decline" ? await O.mutateAsync({ path: n }) : F.action === "delete" ? (await k.mutateAsync({ path: n }), x?.(F.id)) : F.action === "markPaid" ? await A.mutateAsync({
|
|
170
170
|
path: n,
|
|
171
171
|
body: { paid_at: (/* @__PURE__ */ new Date()).toISOString() }
|
|
172
|
-
}) :
|
|
172
|
+
}) : F.action === "markUncollectible" && await j.mutateAsync({
|
|
173
173
|
path: n,
|
|
174
|
-
body: { comment:
|
|
175
|
-
}),
|
|
174
|
+
body: { comment: R.trim() || void 0 }
|
|
175
|
+
}), I(void 0), L(void 0);
|
|
176
176
|
} catch (e) {
|
|
177
|
-
|
|
177
|
+
L(t(e) ?? y.genericError);
|
|
178
178
|
}
|
|
179
179
|
}, [
|
|
180
|
-
E,
|
|
181
|
-
L,
|
|
182
|
-
P,
|
|
183
|
-
w,
|
|
184
|
-
N,
|
|
185
180
|
D,
|
|
181
|
+
R,
|
|
182
|
+
F,
|
|
183
|
+
T,
|
|
184
|
+
P,
|
|
186
185
|
O,
|
|
187
186
|
k,
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
187
|
+
A,
|
|
188
|
+
y,
|
|
189
|
+
x,
|
|
190
|
+
j
|
|
191
|
+
]), Ce = h(async () => {
|
|
192
|
+
if (!B) return;
|
|
193
|
+
let e = ie(V, y);
|
|
194
|
+
if (re(e)) {
|
|
195
195
|
U(e);
|
|
196
196
|
return;
|
|
197
197
|
}
|
|
198
198
|
try {
|
|
199
199
|
await W({
|
|
200
|
-
path: { receivable_id:
|
|
200
|
+
path: { receivable_id: B.id },
|
|
201
201
|
body: {
|
|
202
202
|
body_text: V.body,
|
|
203
203
|
subject_text: V.subject,
|
|
204
204
|
recipients: {
|
|
205
|
-
to:
|
|
206
|
-
cc:
|
|
207
|
-
bcc:
|
|
205
|
+
to: m(V.to),
|
|
206
|
+
cc: m(V.cc),
|
|
207
|
+
bcc: m(V.bcc)
|
|
208
208
|
}
|
|
209
209
|
}
|
|
210
210
|
}), $();
|
|
211
211
|
} catch (e) {
|
|
212
|
-
U({ form: t(e) ??
|
|
212
|
+
U({ form: t(e) ?? y.genericError });
|
|
213
213
|
}
|
|
214
214
|
}, [
|
|
215
215
|
$,
|
|
216
|
-
|
|
216
|
+
y,
|
|
217
217
|
W,
|
|
218
|
-
|
|
218
|
+
B,
|
|
219
219
|
V
|
|
220
220
|
]);
|
|
221
221
|
return {
|
|
222
|
-
actionTarget:
|
|
223
|
-
actionDialog:
|
|
224
|
-
actionError:
|
|
225
|
-
actionComment:
|
|
226
|
-
setActionComment:
|
|
227
|
-
actionInProgress:
|
|
222
|
+
actionTarget: F,
|
|
223
|
+
actionDialog: F ? fe(F, y) : void 0,
|
|
224
|
+
actionError: pe,
|
|
225
|
+
actionComment: F?.action === "markUncollectible" ? R : void 0,
|
|
226
|
+
setActionComment: z,
|
|
227
|
+
actionInProgress: w.isPending || T.isPending || D.isPending || O.isPending || k.isPending || A.isPending || j.isPending || P.isPending,
|
|
228
228
|
pendingActions: [
|
|
229
|
-
...
|
|
230
|
-
...
|
|
231
|
-
...
|
|
232
|
-
...
|
|
229
|
+
...M.isPending ? ["pauseRecurrence"] : [],
|
|
230
|
+
...N.isPending ? ["resumeRecurrence"] : [],
|
|
231
|
+
...E.isPending ? ["clone"] : [],
|
|
232
|
+
...w.isPending || Y || J && Q.isLoading ? ["issue", "issueAndSend"] : []
|
|
233
233
|
],
|
|
234
234
|
openAction: be,
|
|
235
235
|
closeAction: xe,
|
|
236
236
|
confirmAction: Se,
|
|
237
|
-
sendOpen: !!
|
|
237
|
+
sendOpen: !!B,
|
|
238
238
|
sendValues: V,
|
|
239
239
|
sendErrors: he,
|
|
240
240
|
sendInProgress: ge,
|
|
@@ -244,8 +244,8 @@ function g({ selectedReceivable: i, selectedRecurrence: g, messages: v, onCreate
|
|
|
244
244
|
payment: G
|
|
245
245
|
};
|
|
246
246
|
}
|
|
247
|
-
function
|
|
248
|
-
let r = (t?.iterations ?? []).filter((e) => e.status === "pending").length,
|
|
247
|
+
function de(e, t, n) {
|
|
248
|
+
let r = (t?.iterations ?? []).filter((e) => e.status === "pending").length, i = f({
|
|
249
249
|
amount: e.total_amount_with_credit_notes * r,
|
|
250
250
|
currency: e.currency,
|
|
251
251
|
fallback: ""
|
|
@@ -253,19 +253,19 @@ function fe(e, t, n) {
|
|
|
253
253
|
return [
|
|
254
254
|
n.cancelRecurrenceQuestion,
|
|
255
255
|
n.cancelRecurrenceFutureIterations,
|
|
256
|
-
n.cancelRecurrenceTotal.replace("{count}", String(r)).replace("{invoices}", r === 1 ? n.cancelRecurrenceInvoice : n.cancelRecurrenceInvoices).replace("{amount}",
|
|
256
|
+
n.cancelRecurrenceTotal.replace("{count}", String(r)).replace("{invoices}", r === 1 ? n.cancelRecurrenceInvoice : n.cancelRecurrenceInvoices).replace("{amount}", i),
|
|
257
257
|
n.cancelRecurrenceIrreversible
|
|
258
258
|
].join("\n");
|
|
259
259
|
}
|
|
260
|
-
function
|
|
260
|
+
function v(e) {
|
|
261
261
|
return {
|
|
262
262
|
counterpartId: e.counterpart_id,
|
|
263
263
|
billingAddressId: e.counterpart_billing_address?.id ?? void 0,
|
|
264
264
|
billingCountry: e.counterpart_billing_address?.country,
|
|
265
|
-
hasReminder:
|
|
265
|
+
hasReminder: oe(e)
|
|
266
266
|
};
|
|
267
267
|
}
|
|
268
|
-
function
|
|
268
|
+
function fe({ action: e, description: t, title: n }, r) {
|
|
269
269
|
return e === "cancelRecurrence" ? {
|
|
270
270
|
title: r.cancelRecurrenceTitle,
|
|
271
271
|
description: t ?? "",
|
|
@@ -305,4 +305,4 @@ function pe({ action: e, description: t, title: n }, r) {
|
|
|
305
305
|
};
|
|
306
306
|
}
|
|
307
307
|
//#endregion
|
|
308
|
-
export {
|
|
308
|
+
export { _ as useReceivableActions };
|
|
@@ -7,20 +7,20 @@ import "../../../../../shared/ui/dist/index.js";
|
|
|
7
7
|
import { getCounterpartEmail as t, getCounterpartName as n } from "../../../../../shared/counterpart-management/feature/dist/lib/helpers.js";
|
|
8
8
|
import { useCounterpartQuery as r } from "../../../../../shared/counterpart-management/data-access/dist/index3.js";
|
|
9
9
|
import "../../../../../shared/counterpart-management/feature/dist/index.js";
|
|
10
|
-
import {
|
|
11
|
-
import { useMeasureUnits as a } from "../../../../../shared/product-catalog/feature/dist/lib/useMeasureUnits.js";
|
|
12
|
-
import "../../../../../shared/product-catalog/feature/dist/index.js";
|
|
13
|
-
import { getInlineItemPriceLabel as o, getIssueAttachments as s, getIssueSubject as c, getProductsStepTitle as l, inlineItemToProductRequest as u } from "./actionsModal.js";
|
|
14
|
-
import { useReceivableQuery as d } from "../../../../data-access/dist/index13.js";
|
|
10
|
+
import { useReceivableQuery as i } from "../../../../data-access/dist/index14.js";
|
|
15
11
|
import "../../../../data-access/dist/index.js";
|
|
12
|
+
import { useCreateProductMutation as a } from "../../../../../shared/product-catalog/data-access/dist/index6.js";
|
|
13
|
+
import { useMeasureUnits as o } from "../../../../../shared/product-catalog/feature/dist/lib/useMeasureUnits.js";
|
|
14
|
+
import "../../../../../shared/product-catalog/feature/dist/index.js";
|
|
15
|
+
import { getInlineItemPriceLabel as s, getIssueAttachments as c, getIssueSubject as l, getProductsStepTitle as u, inlineItemToProductRequest as d } from "./actionsModal.js";
|
|
16
16
|
import { useSendReceivableWithPaymentLink as f } from "./useSendReceivableWithPaymentLink.js";
|
|
17
17
|
import { useCallback as p, useMemo as m, useState as h } from "react";
|
|
18
18
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActionsModal.js
|
|
19
19
|
function g({ messages: g }) {
|
|
20
|
-
let [_, v] = h(), [y, b] = h("products"), [x, S] = h(), [C, w] = h(), [T, E] = h(""), [D, O] = h(() => /* @__PURE__ */ new Set()), [k, A] = h(!1), j = !!_ && y === "issue", M =
|
|
20
|
+
let [_, v] = h(), [y, b] = h("products"), [x, S] = h(), [C, w] = h(), [T, E] = h(""), [D, O] = h(() => /* @__PURE__ */ new Set()), [k, A] = h(!1), j = !!_ && y === "issue", M = i(_?.receivableId, { enabled: j }), N = r(j ? _?.counterpartId : void 0), { unitNamesById: P } = o({ enabled: !!_?.inlineItems.length }), { send: F, isPending: I } = f({
|
|
21
21
|
messages: g,
|
|
22
22
|
documentType: j ? _?.documentType : void 0
|
|
23
|
-
}), L =
|
|
23
|
+
}), L = a(), R = N.data?.id === _?.counterpartId ? N.data : void 0, z = R ? n(R) : "", B = R ? t(R) : "", V = M.data?.id === _?.receivableId ? M.data : void 0, H = C ?? l(V?.document_id, z, g), U = p((e) => {
|
|
24
24
|
v(e), b(e.showEmailStep ? "issue" : "products"), S(void 0), w(void 0), E(""), O(new Set(e.inlineItems.map((e) => e.key)));
|
|
25
25
|
}, []), W = p(() => v(void 0), []), G = p((e) => {
|
|
26
26
|
S(e), _?.inlineItems.length ? b("products") : W();
|
|
@@ -63,7 +63,7 @@ function g({ messages: g }) {
|
|
|
63
63
|
if (t.length) {
|
|
64
64
|
A(!0);
|
|
65
65
|
try {
|
|
66
|
-
await Promise.all(t.map((e) => L.mutateAsync({ body:
|
|
66
|
+
await Promise.all(t.map((e) => L.mutateAsync({ body: d(e) }))), e.success(g.actionsProductsSaved), W();
|
|
67
67
|
} catch {
|
|
68
68
|
e.error(g.actionsProductsSaveFailed);
|
|
69
69
|
} finally {
|
|
@@ -83,16 +83,16 @@ function g({ messages: g }) {
|
|
|
83
83
|
recipient: B ? `${z} <${B}>` : z,
|
|
84
84
|
subject: H,
|
|
85
85
|
message: T,
|
|
86
|
-
attachments:
|
|
86
|
+
attachments: c(V),
|
|
87
87
|
sendDisabled: I || !H.trim() || !T.trim(),
|
|
88
88
|
inProgress: I
|
|
89
89
|
} : {
|
|
90
90
|
step: "products",
|
|
91
|
-
title:
|
|
91
|
+
title: u(_.action, x, g),
|
|
92
92
|
items: J.map((e) => ({
|
|
93
93
|
key: e.key,
|
|
94
94
|
name: e.name,
|
|
95
|
-
priceLabel:
|
|
95
|
+
priceLabel: s(e, P),
|
|
96
96
|
selected: D.has(e.key)
|
|
97
97
|
})),
|
|
98
98
|
allSelected: J.length > 0 && D.size === J.length,
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import { useDeleteReceivableAttachmentMutation as n, useUploadReceivableAttachmentMutation as r } from "../../../../data-access/dist/index7.js";
|
|
5
|
+
import { useDeleteReceivableAttachmentMutation as e, useUploadReceivableAttachmentMutation as t } from "../../../../data-access/dist/index8.js";
|
|
7
6
|
import "../../../../data-access/dist/index.js";
|
|
7
|
+
import { toFileArray as n, validateAttachmentFile as r } from "./attachments.js";
|
|
8
8
|
import { useCallback as i, useEffect as a, useRef as o, useState as s } from "react";
|
|
9
9
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableAttachmentUploads.js
|
|
10
10
|
function c({ attachments: c, setAttachments: l, receivableId: u }) {
|
|
11
|
-
let { mutateAsync: d } =
|
|
11
|
+
let { mutateAsync: d } = t(), { mutate: f } = e(), [p, m] = s([]), [h, g] = s(!1), _ = o(0), v = o(/* @__PURE__ */ new Set()), y = o(/* @__PURE__ */ new Set()), b = o(/* @__PURE__ */ new Set()), x = o(0), S = o(!1), C = o({
|
|
12
12
|
deleteFile: f,
|
|
13
13
|
receivableId: u
|
|
14
14
|
});
|
|
@@ -63,18 +63,18 @@ function c({ attachments: c, setAttachments: l, receivableId: u }) {
|
|
|
63
63
|
u,
|
|
64
64
|
l,
|
|
65
65
|
d
|
|
66
|
-
]), T = i((
|
|
67
|
-
let
|
|
68
|
-
if (
|
|
66
|
+
]), T = i((e) => {
|
|
67
|
+
let t = n(e);
|
|
68
|
+
if (t.length === 0) return;
|
|
69
69
|
let i = p.filter((e) => e.status === "uploading").length, a = 10 - c.length - i, o = [], s = !1;
|
|
70
|
-
for (let e of
|
|
70
|
+
for (let e of t) {
|
|
71
71
|
_.current += 1;
|
|
72
|
-
let
|
|
73
|
-
if (
|
|
72
|
+
let t = `pending-attachment-${_.current}`, n = r(e);
|
|
73
|
+
if (n) {
|
|
74
74
|
o.push({
|
|
75
|
-
id:
|
|
75
|
+
id: t,
|
|
76
76
|
name: e.name,
|
|
77
|
-
status:
|
|
77
|
+
status: n
|
|
78
78
|
});
|
|
79
79
|
continue;
|
|
80
80
|
}
|
|
@@ -83,10 +83,10 @@ function c({ attachments: c, setAttachments: l, receivableId: u }) {
|
|
|
83
83
|
continue;
|
|
84
84
|
}
|
|
85
85
|
--a, o.push({
|
|
86
|
-
id:
|
|
86
|
+
id: t,
|
|
87
87
|
name: e.name,
|
|
88
88
|
status: "uploading"
|
|
89
|
-
}), w(
|
|
89
|
+
}), w(t, e);
|
|
90
90
|
}
|
|
91
91
|
o.length > 0 && m((e) => [...e, ...o]), g(s);
|
|
92
92
|
}, [
|
|
@@ -7,7 +7,7 @@ import { extractApiErrorMessage as t } from "../../../../../shared/util/dist/lib
|
|
|
7
7
|
import "../../../../../shared/ui/dist/index.js";
|
|
8
8
|
import { useWidgetConfig as n } from "../../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
9
9
|
import "../../../../../shared/feature/dist/index.js";
|
|
10
|
-
import { useCreateEntityBankAccountMutation as r, usePaymentAccountQuery as i, usePaymentAccountsQuery as a } from "../../../../data-access/dist/
|
|
10
|
+
import { useCreateEntityBankAccountMutation as r, usePaymentAccountQuery as i, usePaymentAccountsQuery as a } from "../../../../data-access/dist/index6.js";
|
|
11
11
|
import "../../../../data-access/dist/index.js";
|
|
12
12
|
import { EMPTY_BANK_ACCOUNT_FORM_VALUES as o, bankAccountFormToPayload as s, buildBankAccountSectionView as c, buildPaymentAccountOptions as l, getBankAccountPermissions as u, validateBankAccountForm as d } from "./bankAccounts.js";
|
|
13
13
|
import { useCallback as f, useEffect as p, useMemo as m, useRef as h, useState as g } from "react";
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import { buildCustomerCardView as e, filterCustomerPickerEntries as t, findCustomerExactMatch as n, findCustomerTabMatch as r, toCustomerPickerEntries as i } from "./customer.js";
|
|
6
|
+
import { useAllCustomersQuery as a } from "../../../../data-access/dist/index3.js";
|
|
7
|
+
import "../../../../data-access/dist/index.js";
|
|
8
|
+
import { useCallback as o, useId as s, useMemo as c, useRef as l, useState as u } from "react";
|
|
9
|
+
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableCustomerPicker.js
|
|
10
|
+
var d = 50;
|
|
11
|
+
function f({ customerId: f, customer: p, customerName: m, customerEmail: h, customerError: g, customerEmailError: _, canCreate: v, disabled: y = !1, messages: b, onCustomerSelect: x, onCustomerNameChange: S }) {
|
|
12
|
+
let C = s(), w = l(null), [T, E] = u(!1), [D, O] = u(), k = a({ enabled: !f && !y }), A = c(() => i(k.data?.data), [k.data]), j = c(() => t(A, m), [A, m]), M = c(() => j.slice(0, d), [j]), N = o((e) => `${C}-option-${e}`, [C]), P = o(() => {
|
|
13
|
+
E(!1), O(void 0), !v && m && S("");
|
|
14
|
+
}, [
|
|
15
|
+
v,
|
|
16
|
+
m,
|
|
17
|
+
S
|
|
18
|
+
]), F = o(() => E(!0), []), I = o((e) => {
|
|
19
|
+
E(!1), O(void 0), x(e);
|
|
20
|
+
}, [x]), L = o(() => {
|
|
21
|
+
if (T) {
|
|
22
|
+
P();
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
w.current?.focus(), E(!0);
|
|
26
|
+
}, [P, T]), R = o((e) => {
|
|
27
|
+
S(e), E(!0), O(void 0);
|
|
28
|
+
}, [S]), z = o((e) => {
|
|
29
|
+
let t = M.findIndex((e) => e.id === D);
|
|
30
|
+
if (e === "next" || e === "previous") {
|
|
31
|
+
if (E(!0), !M.length) return;
|
|
32
|
+
let n = e === "next" ? Math.min(t + 1, M.length - 1) : Math.max(t - 1, 0);
|
|
33
|
+
O(M[n].id), document.getElementById(N(M[n].id))?.scrollIntoView?.({ block: "nearest" });
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (e === "enter") {
|
|
37
|
+
let e = M[t], r = T && e ? e : n(j, m);
|
|
38
|
+
r ? I(r.id) : P();
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (e === "tab") {
|
|
42
|
+
let e = r(j, m);
|
|
43
|
+
e ? I(e.id) : P();
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
P();
|
|
47
|
+
}, [
|
|
48
|
+
P,
|
|
49
|
+
m,
|
|
50
|
+
D,
|
|
51
|
+
T,
|
|
52
|
+
j,
|
|
53
|
+
N,
|
|
54
|
+
I,
|
|
55
|
+
M
|
|
56
|
+
]), B = c(() => ({
|
|
57
|
+
inputValue: m,
|
|
58
|
+
options: M.map((e) => ({
|
|
59
|
+
value: e.id,
|
|
60
|
+
id: N(e.id),
|
|
61
|
+
name: e.name,
|
|
62
|
+
email: e.email
|
|
63
|
+
})),
|
|
64
|
+
open: T,
|
|
65
|
+
listId: C,
|
|
66
|
+
highlightedValue: D,
|
|
67
|
+
isLoading: k.isLoading,
|
|
68
|
+
placeholder: v ? b.customerPickerPlaceholder : b.customerPickerSearchOnlyPlaceholder,
|
|
69
|
+
emptyText: k.isError ? b.customerPickerLoadFailed : k.isPending ? b.customerPickerLoading : v ? b.customerPickerEmpty : b.customerPickerSearchOnlyEmpty,
|
|
70
|
+
moreText: j.length > M.length ? b.customerPickerMoreMatches : void 0,
|
|
71
|
+
description: v ? b.customerPickerDescription : b.customerPickerSearchOnlyDescription,
|
|
72
|
+
error: g
|
|
73
|
+
}), [
|
|
74
|
+
v,
|
|
75
|
+
g,
|
|
76
|
+
m,
|
|
77
|
+
D,
|
|
78
|
+
T,
|
|
79
|
+
C,
|
|
80
|
+
j,
|
|
81
|
+
b,
|
|
82
|
+
N,
|
|
83
|
+
k.isError,
|
|
84
|
+
k.isLoading,
|
|
85
|
+
k.isPending,
|
|
86
|
+
M
|
|
87
|
+
]);
|
|
88
|
+
return {
|
|
89
|
+
card: f ? {
|
|
90
|
+
...e(p),
|
|
91
|
+
error: g
|
|
92
|
+
} : void 0,
|
|
93
|
+
picker: B,
|
|
94
|
+
create: v ? {
|
|
95
|
+
email: h,
|
|
96
|
+
emailError: _
|
|
97
|
+
} : void 0,
|
|
98
|
+
inputRef: w,
|
|
99
|
+
open: F,
|
|
100
|
+
close: P,
|
|
101
|
+
toggle: L,
|
|
102
|
+
changeInput: R,
|
|
103
|
+
pressKey: z,
|
|
104
|
+
highlight: O,
|
|
105
|
+
select: I
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
//#endregion
|
|
109
|
+
export { f as useReceivableCustomerPicker };
|
|
@@ -9,13 +9,13 @@ import "../../../../../shared/data-access/dist/index.js";
|
|
|
9
9
|
import { useWidgetConfig as r } from "../../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
10
10
|
import { useOrganizationUserNames as i } from "../../../../../shared/feature/dist/lib/user/useOrganizationUserNames.js";
|
|
11
11
|
import "../../../../../shared/feature/dist/index.js";
|
|
12
|
-
import { RECEIVABLE_DETAILS_SECTION as a } from "../../../../ui/dist/
|
|
12
|
+
import { RECEIVABLE_DETAILS_SECTION as a } from "../../../../ui/dist/index28.js";
|
|
13
13
|
import "../../../../ui/dist/index.js";
|
|
14
|
-
import { useAllReceivableHistoryQuery as ee } from "../../../../data-access/dist/
|
|
15
|
-
import { usePaymentAccountsQuery as o } from "../../../../data-access/dist/
|
|
16
|
-
import { useReceivablePaymentRecordsQuery as s } from "../../../../data-access/dist/
|
|
17
|
-
import { useReceivablePdfLinkQuery as te, useReceivableQuery as ne, useReceivablesByIdQueries as re } from "../../../../data-access/dist/
|
|
18
|
-
import { useOverdueRemindersQuery as ie, usePaymentRemindersQuery as c, useRecurrenceQuery as l } from "../../../../data-access/dist/
|
|
14
|
+
import { useAllReceivableHistoryQuery as ee } from "../../../../data-access/dist/index4.js";
|
|
15
|
+
import { usePaymentAccountsQuery as o } from "../../../../data-access/dist/index6.js";
|
|
16
|
+
import { useReceivablePaymentRecordsQuery as s } from "../../../../data-access/dist/index12.js";
|
|
17
|
+
import { useReceivablePdfLinkQuery as te, useReceivableQuery as ne, useReceivablesByIdQueries as re } from "../../../../data-access/dist/index14.js";
|
|
18
|
+
import { useOverdueRemindersQuery as ie, usePaymentRemindersQuery as c, useRecurrenceQuery as l } from "../../../../data-access/dist/index15.js";
|
|
19
19
|
import "../../../../data-access/dist/index.js";
|
|
20
20
|
import { canRecordPayments as u } from "./paymentRecord.js";
|
|
21
21
|
import { buildReceivableAuditHistoryLabels as ae } from "./auditHistory/labels.js";
|