@tesouro/embedded-components-react 0.5.293 → 0.5.294
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/README.md +1 -1
- package/dist/index.d.ts +26 -1
- package/dist/lib/CounterpartsWidget.d.ts +2 -0
- package/dist/lib/CounterpartsWidgetPublic.d.ts +2 -0
- package/dist/lib/CustomersWidget.d.ts +2 -0
- package/dist/lib/ReceivablesWidget.d.ts +26 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index.js +4 -4
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index11.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index14.js +5 -88
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index15.js +70 -173
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index16.js +210 -17
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index17.js +29 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +6 -7
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/details.js +142 -141
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/helpers.js +84 -54
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/labels.js +21 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/paymentTerms.js +27 -27
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/recurrence.js +2 -1
- 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 +13 -10
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActions.js +84 -80
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActionsModal.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableDetails.js +32 -30
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableForm.js +417 -414
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableIssuePreflight.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableReminders.js +1 -1
- 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 +83 -66
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesWidget.js +133 -129
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useSendReceivableWithPaymentLink.js +26 -22
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useUtcDayStart.js +16 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +0 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index15.js +20 -22
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index23.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index40.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index44.js +91 -85
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index45.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index51.js +119 -88
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index53.js +19 -16
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index57.js +130 -96
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/helpers.js +24 -8
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/labels.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useCounterpartForm.js +101 -98
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index9.js +34 -20
- 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/product-catalog/ui/dist/index6.js +4 -3
- package/dist/packages/shared-ui-shadcn/dist/index.js +15 -10
- package/package.json +1 -1
|
@@ -9,60 +9,60 @@ import { getCounterpartEmail as n } from "../../../../../shared/counterpart-mana
|
|
|
9
9
|
import "../../../../../shared/counterpart-management/feature/dist/index.js";
|
|
10
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
11
|
import { useMarkReceivablePaidMutation as l, useMarkReceivableUncollectibleMutation as u } from "../../../../data-access/dist/index13.js";
|
|
12
|
-
import { useCancelRecurrenceMutation as ee, usePauseRecurrenceMutation as
|
|
12
|
+
import { useCancelRecurrenceMutation as ee, usePauseRecurrenceMutation as d, useResumeRecurrenceMutation as te } from "../../../../data-access/dist/index16.js";
|
|
13
13
|
import "../../../../data-access/dist/index.js";
|
|
14
|
-
import { formatMoney as
|
|
15
|
-
import { getIssueReminderBlocker as
|
|
16
|
-
import { useReceivableIssuePreflight as
|
|
17
|
-
import { useReceivablePaymentRecord as
|
|
18
|
-
import { useCallback as
|
|
14
|
+
import { formatMoney as f, isReceivableReadyToIssue as p } from "./helpers.js";
|
|
15
|
+
import { getIssueReminderBlocker as m, hasSelectedReminder as h } from "./reminders.js";
|
|
16
|
+
import { useReceivableIssuePreflight as ne } from "./useReceivableIssuePreflight.js";
|
|
17
|
+
import { useReceivablePaymentRecord as re } from "./useReceivablePaymentRecord.js";
|
|
18
|
+
import { useCallback as g, useEffect as ie, useState as _ } from "react";
|
|
19
19
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActions.js
|
|
20
|
-
function v({ selectedReceivable:
|
|
21
|
-
let
|
|
20
|
+
function v({ selectedReceivable: f, selectedRecurrence: v, messages: x, onCreated: S, onDeleted: C, onCompleteBeforeIssue: w, onIssuedForSend: T, onResend: E }) {
|
|
21
|
+
let D = c(), O = i(), k = a(), A = r(), j = o(), M = s(), N = l(), P = u(), F = d(), I = te(), L = ee(), [R, z] = _(), [B, V] = _(""), H = re({ messages: x }), U = H.open, W = F.mutate, G = k.mutate, K = I.mutate, q = f?.type === "invoice" && f.status === "draft" ? f : void 0, J = f?.type === "invoice" && f.status !== "draft" ? f : void 0, [Y, X] = _(), Z = Y?.issueCheck ?? (q ? b(q) : void 0), Q = D.mutate, $ = ne({
|
|
22
22
|
counterpartId: Z?.counterpartId ?? J?.counterpart_id,
|
|
23
23
|
billingAddressId: Z?.billingAddressId,
|
|
24
24
|
billingCountry: Z?.billingCountry,
|
|
25
25
|
checkRequiredFields: !!Z
|
|
26
26
|
});
|
|
27
|
-
|
|
27
|
+
ie(() => {
|
|
28
28
|
if (!Y || $.isLoading) return;
|
|
29
29
|
X(void 0);
|
|
30
|
-
let t = Y.issueCheck ? $.isTaxIdMissing ?
|
|
30
|
+
let t = Y.issueCheck ? $.isTaxIdMissing ? x.issueTaxIdRequired : Y.issueCheck.hasReminder ? m($.counterpart, x) : void 0 : void 0;
|
|
31
31
|
if (t) {
|
|
32
32
|
e.error(t);
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
35
|
Q({ path: { receivable_id: Y.id } }, {
|
|
36
|
-
onSuccess: () => e.success(
|
|
37
|
-
onError: () => e
|
|
36
|
+
onSuccess: () => e.success(x.issueSucceeded),
|
|
37
|
+
onError: (e) => y(e, x)
|
|
38
38
|
});
|
|
39
39
|
}, [
|
|
40
40
|
Q,
|
|
41
|
-
|
|
41
|
+
x,
|
|
42
42
|
Y,
|
|
43
43
|
$.counterpart,
|
|
44
44
|
$.isLoading,
|
|
45
45
|
$.isTaxIdMissing
|
|
46
46
|
]);
|
|
47
|
-
let
|
|
47
|
+
let se = g((r, i, a) => {
|
|
48
48
|
let o = "documentLabel" in i ? i.documentLabel : i.title, s = {
|
|
49
49
|
id: i.id,
|
|
50
50
|
type: i.type,
|
|
51
51
|
title: o,
|
|
52
52
|
action: r
|
|
53
|
-
}, c = a === void 0 ?
|
|
53
|
+
}, c = a === void 0 ? f : a ?? void 0;
|
|
54
54
|
if (r === "send") {
|
|
55
55
|
if (c?.type !== "invoice" || $.isCounterpartLoading) return;
|
|
56
56
|
if ($.isCounterpartError) {
|
|
57
|
-
e.error(
|
|
57
|
+
e.error(x.genericError);
|
|
58
58
|
return;
|
|
59
59
|
}
|
|
60
60
|
let t = $.counterpart?.id === c.counterpart_id ? $.counterpart : void 0;
|
|
61
61
|
if (!t || !n(t)) {
|
|
62
|
-
e.error(
|
|
62
|
+
e.error(x.sendNoEmail);
|
|
63
63
|
return;
|
|
64
64
|
}
|
|
65
|
-
|
|
65
|
+
E?.(c.id, c.counterpart_id);
|
|
66
66
|
return;
|
|
67
67
|
}
|
|
68
68
|
if (r === "issueAndSend") {
|
|
@@ -70,36 +70,36 @@ function v({ selectedReceivable: d, selectedRecurrence: v, messages: b, onCreate
|
|
|
70
70
|
let t = c;
|
|
71
71
|
if ($.isLoading) return;
|
|
72
72
|
if ($.isCounterpartError) {
|
|
73
|
-
e.error(
|
|
73
|
+
e.error(x.genericError);
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
76
|
if (!$.counterpart || !n($.counterpart)) {
|
|
77
|
-
e.error(
|
|
77
|
+
e.error(x.sendNoEmail);
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
|
-
if (
|
|
81
|
-
|
|
80
|
+
if (w && !p(t, x)) {
|
|
81
|
+
w(t, "issueAndSend");
|
|
82
82
|
return;
|
|
83
83
|
}
|
|
84
|
-
let r = $.isTaxIdMissing ?
|
|
84
|
+
let r = $.isTaxIdMissing ? x.issueTaxIdRequired : h(t) ? m($.counterpart, x) : void 0;
|
|
85
85
|
if (r) {
|
|
86
86
|
e.error(r);
|
|
87
87
|
return;
|
|
88
88
|
}
|
|
89
89
|
Q({ path: { receivable_id: t.id } }, {
|
|
90
90
|
onSuccess: () => {
|
|
91
|
-
e.success(
|
|
91
|
+
e.success(x.issueSucceeded), T?.(t.id, t.counterpart_id);
|
|
92
92
|
},
|
|
93
|
-
onError: () => e
|
|
93
|
+
onError: (e) => y(e, x)
|
|
94
94
|
});
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
97
97
|
if (r === "clone") {
|
|
98
98
|
G({ path: { receivable_id: i.id } }, {
|
|
99
99
|
onSuccess: (t) => {
|
|
100
|
-
t?.id &&
|
|
100
|
+
t?.id && S?.(t.id, t.type), e.success(x.cloneSuccess);
|
|
101
101
|
},
|
|
102
|
-
onError: (n) => e.error(t(n) ??
|
|
102
|
+
onError: (n) => e.error(t(n) ?? x.cloneError)
|
|
103
103
|
});
|
|
104
104
|
return;
|
|
105
105
|
}
|
|
@@ -111,17 +111,17 @@ function v({ selectedReceivable: d, selectedRecurrence: v, messages: b, onCreate
|
|
|
111
111
|
path: { recurrence_id: l },
|
|
112
112
|
receivableId: i.id
|
|
113
113
|
}, {
|
|
114
|
-
onSuccess: () => e.success(n ?
|
|
115
|
-
onError: (n) => e.error(t(n) ??
|
|
114
|
+
onSuccess: () => e.success(n ? x.recurrencePaused : x.recurrenceResumed),
|
|
115
|
+
onError: (n) => e.error(t(n) ?? x.genericError)
|
|
116
116
|
});
|
|
117
117
|
return;
|
|
118
118
|
}
|
|
119
119
|
if (r === "cancelRecurrence") {
|
|
120
120
|
if (!l || c?.type !== "invoice") return;
|
|
121
|
-
z(
|
|
121
|
+
z({
|
|
122
122
|
...s,
|
|
123
123
|
recurrenceId: l,
|
|
124
|
-
description: ae(c, v,
|
|
124
|
+
description: ae(c, v, x)
|
|
125
125
|
});
|
|
126
126
|
return;
|
|
127
127
|
}
|
|
@@ -130,26 +130,26 @@ function v({ selectedReceivable: d, selectedRecurrence: v, messages: b, onCreate
|
|
|
130
130
|
return;
|
|
131
131
|
}
|
|
132
132
|
let u = r === "issue" && c?.type === "invoice" ? c : void 0;
|
|
133
|
-
if (u &&
|
|
134
|
-
|
|
133
|
+
if (u && w && !p(u, x)) {
|
|
134
|
+
w(u, "issue");
|
|
135
135
|
return;
|
|
136
136
|
}
|
|
137
137
|
if (r === "issue") {
|
|
138
138
|
X({
|
|
139
139
|
id: i.id,
|
|
140
|
-
issueCheck: u ?
|
|
140
|
+
issueCheck: u ? b(u) : void 0
|
|
141
141
|
});
|
|
142
142
|
return;
|
|
143
143
|
}
|
|
144
|
-
|
|
144
|
+
V(""), z(s);
|
|
145
145
|
}, [
|
|
146
146
|
G,
|
|
147
147
|
Q,
|
|
148
|
-
b,
|
|
149
|
-
C,
|
|
150
148
|
x,
|
|
151
149
|
w,
|
|
150
|
+
S,
|
|
152
151
|
T,
|
|
152
|
+
E,
|
|
153
153
|
U,
|
|
154
154
|
$.counterpart,
|
|
155
155
|
$.isCounterpartError,
|
|
@@ -158,71 +158,73 @@ function v({ selectedReceivable: d, selectedRecurrence: v, messages: b, onCreate
|
|
|
158
158
|
$.isTaxIdMissing,
|
|
159
159
|
W,
|
|
160
160
|
K,
|
|
161
|
-
|
|
161
|
+
f,
|
|
162
162
|
v
|
|
163
|
-
]),
|
|
164
|
-
|
|
165
|
-
}, []),
|
|
166
|
-
if (!
|
|
167
|
-
let n = { receivable_id:
|
|
168
|
-
if (
|
|
169
|
-
if (!
|
|
163
|
+
]), ce = g(() => {
|
|
164
|
+
z(void 0);
|
|
165
|
+
}, []), le = g(async () => {
|
|
166
|
+
if (!R) return;
|
|
167
|
+
let n = { receivable_id: R.id };
|
|
168
|
+
if (R.action === "cancelRecurrence") {
|
|
169
|
+
if (!R.recurrenceId) return;
|
|
170
170
|
try {
|
|
171
|
-
await
|
|
172
|
-
path: { recurrence_id:
|
|
173
|
-
receivableId:
|
|
174
|
-
}), e.success(
|
|
171
|
+
await L.mutateAsync({
|
|
172
|
+
path: { recurrence_id: R.recurrenceId },
|
|
173
|
+
receivableId: R.id
|
|
174
|
+
}), e.success(x.recurrenceCanceled), z(void 0);
|
|
175
175
|
} catch (n) {
|
|
176
|
-
e.error(t(n) ??
|
|
176
|
+
e.error(t(n) ?? x.genericError);
|
|
177
177
|
}
|
|
178
178
|
return;
|
|
179
179
|
}
|
|
180
180
|
try {
|
|
181
|
-
|
|
181
|
+
R.action === "cancel" ? (await O.mutateAsync({ path: n }), e.success(x.cancelSucceeded)) : R.action === "accept" ? await A.mutateAsync({ path: n }) : R.action === "decline" ? await j.mutateAsync({ path: n }) : R.action === "delete" ? (await M.mutateAsync({ path: n }), e.success(x.deleteSucceeded), C?.(R.id)) : R.action === "markPaid" ? await N.mutateAsync({
|
|
182
182
|
path: n,
|
|
183
183
|
body: { paid_at: (/* @__PURE__ */ new Date()).toISOString() }
|
|
184
|
-
}) :
|
|
184
|
+
}) : R.action === "markUncollectible" && (await P.mutateAsync({
|
|
185
185
|
path: n,
|
|
186
186
|
body: { comment: B.trim() || void 0 }
|
|
187
|
-
}),
|
|
188
|
-
} catch (
|
|
189
|
-
|
|
187
|
+
}), e.success(x.markUncollectibleSucceeded)), z(void 0);
|
|
188
|
+
} catch (n) {
|
|
189
|
+
e.error(t(n) ?? x.unrecognizedError);
|
|
190
190
|
}
|
|
191
191
|
}, [
|
|
192
|
-
|
|
192
|
+
A,
|
|
193
193
|
B,
|
|
194
|
+
R,
|
|
195
|
+
O,
|
|
194
196
|
L,
|
|
195
|
-
D,
|
|
196
|
-
I,
|
|
197
|
-
A,
|
|
198
197
|
j,
|
|
199
198
|
M,
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
199
|
+
N,
|
|
200
|
+
x,
|
|
201
|
+
C,
|
|
202
|
+
P
|
|
203
203
|
]);
|
|
204
204
|
return {
|
|
205
|
-
actionTarget:
|
|
206
|
-
actionDialog:
|
|
207
|
-
|
|
208
|
-
actionComment: L?.action === "markUncollectible" ? B : void 0,
|
|
205
|
+
actionTarget: R,
|
|
206
|
+
actionDialog: R ? oe(R, x) : void 0,
|
|
207
|
+
actionComment: R?.action === "markUncollectible" ? B : void 0,
|
|
209
208
|
setActionComment: V,
|
|
210
|
-
actionInProgress:
|
|
209
|
+
actionInProgress: D.isPending || O.isPending || A.isPending || j.isPending || M.isPending || N.isPending || P.isPending || L.isPending,
|
|
211
210
|
pendingActions: [
|
|
212
|
-
...
|
|
213
|
-
...
|
|
214
|
-
...
|
|
215
|
-
...
|
|
211
|
+
...F.isPending ? ["pauseRecurrence"] : [],
|
|
212
|
+
...I.isPending ? ["resumeRecurrence"] : [],
|
|
213
|
+
...k.isPending ? ["clone"] : [],
|
|
214
|
+
...D.isPending || Y || q && $.isLoading ? ["issue", "issueAndSend"] : [],
|
|
216
215
|
...J && $.isCounterpartLoading ? ["send"] : []
|
|
217
216
|
],
|
|
218
|
-
openAction:
|
|
219
|
-
closeAction:
|
|
220
|
-
confirmAction:
|
|
217
|
+
openAction: se,
|
|
218
|
+
closeAction: ce,
|
|
219
|
+
confirmAction: le,
|
|
221
220
|
payment: H
|
|
222
221
|
};
|
|
223
222
|
}
|
|
223
|
+
function y(n, r) {
|
|
224
|
+
e.error(t(n) ?? r.unrecognizedError), e.error(r.issueFailed);
|
|
225
|
+
}
|
|
224
226
|
function ae(e, t, n) {
|
|
225
|
-
let r = (t?.iterations ?? []).filter((e) => e.status === "pending").length, i =
|
|
227
|
+
let r = (t?.iterations ?? []).filter((e) => e.status === "pending").length, i = f({
|
|
226
228
|
amount: e.total_amount_with_credit_notes * r,
|
|
227
229
|
currency: e.currency,
|
|
228
230
|
fallback: ""
|
|
@@ -232,22 +234,23 @@ function ae(e, t, n) {
|
|
|
232
234
|
n.cancelRecurrenceFutureIterations,
|
|
233
235
|
n.cancelRecurrenceTotal.replace("{count}", String(r)).replace("{invoices}", r === 1 ? n.cancelRecurrenceInvoice : n.cancelRecurrenceInvoices).replace("{amount}", i),
|
|
234
236
|
n.cancelRecurrenceIrreversible
|
|
235
|
-
]
|
|
237
|
+
];
|
|
236
238
|
}
|
|
237
|
-
function
|
|
239
|
+
function b(e) {
|
|
238
240
|
return {
|
|
239
241
|
counterpartId: e.counterpart_id,
|
|
240
242
|
billingAddressId: e.counterpart_billing_address?.id ?? void 0,
|
|
241
243
|
billingCountry: e.counterpart_billing_address?.country,
|
|
242
|
-
hasReminder:
|
|
244
|
+
hasReminder: h(e)
|
|
243
245
|
};
|
|
244
246
|
}
|
|
245
247
|
function oe({ action: e, description: t, title: n }, r) {
|
|
246
248
|
return e === "cancelRecurrence" ? {
|
|
247
249
|
title: r.cancelRecurrenceTitle,
|
|
248
|
-
description: t ??
|
|
250
|
+
description: t ?? [],
|
|
249
251
|
confirmLabel: r.cancelRecurrenceConfirm,
|
|
250
252
|
cancelLabel: r.cancelRecurrenceClose,
|
|
253
|
+
cancelVariant: "outline",
|
|
251
254
|
destructive: !0
|
|
252
255
|
} : e === "accept" ? {
|
|
253
256
|
title: r.acceptTitle,
|
|
@@ -266,9 +269,10 @@ function oe({ action: e, description: t, title: n }, r) {
|
|
|
266
269
|
cancelVariant: "outline",
|
|
267
270
|
destructive: !0
|
|
268
271
|
} : e === "delete" ? {
|
|
269
|
-
title: r.deleteTitle,
|
|
272
|
+
title: n && n !== r.untitledDocument ? r.deleteNumberedTitle.replace("{number}", n) : r.deleteTitle,
|
|
270
273
|
description: r.deleteDescription,
|
|
271
274
|
confirmLabel: r.deleteConfirm,
|
|
275
|
+
cancelVariant: "outline",
|
|
272
276
|
destructive: !0
|
|
273
277
|
} : e === "markPaid" ? {
|
|
274
278
|
title: r.markPaidTitle,
|
|
@@ -7,7 +7,7 @@ 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 { useReceivableQuery as i } from "../../../../data-access/dist/
|
|
10
|
+
import { useReceivableQuery as i } from "../../../../data-access/dist/index15.js";
|
|
11
11
|
import "../../../../data-access/dist/index.js";
|
|
12
12
|
import { useCreateProductMutation as a } from "../../../../../shared/product-catalog/data-access/dist/index6.js";
|
|
13
13
|
import { useMeasureUnits as o } from "../../../../../shared/product-catalog/feature/dist/lib/useMeasureUnits.js";
|
|
@@ -14,8 +14,8 @@ import "../../../../ui/dist/index.js";
|
|
|
14
14
|
import { useAllReceivableHistoryQuery as ee } from "../../../../data-access/dist/index4.js";
|
|
15
15
|
import { usePaymentAccountsQuery as o } from "../../../../data-access/dist/index6.js";
|
|
16
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/
|
|
18
|
-
import { useOverdueRemindersQuery as ie, usePaymentRemindersQuery as c, useRecurrenceQuery as l } from "../../../../data-access/dist/
|
|
17
|
+
import { useReceivablePdfLinkQuery as te, useReceivableQuery as ne, useReceivablesByIdQueries as re } from "../../../../data-access/dist/index15.js";
|
|
18
|
+
import { useOverdueRemindersQuery as ie, usePaymentRemindersQuery as c, useRecurrenceQuery as l } from "../../../../data-access/dist/index16.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";
|
|
@@ -25,13 +25,13 @@ import { useMemo as d, useState as f } from "react";
|
|
|
25
25
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableDetails.js
|
|
26
26
|
var p = [a.attachments];
|
|
27
27
|
function m({ selectedReceivableId: m, enabled: h = !0, canWrite: g = !0, messages: _, statusLabels: v, auditHistoryLabels: y, onOpenReceivable: b, onOpenCustomer: x }) {
|
|
28
|
-
let { initResponse: S } = r(), C = d(() => oe(S?.scopes), [S?.scopes]), w = u(S?.scopes), T = ne(m, { enabled: h }), E = T.data, D = E?.type === "invoice" ? E : void 0, le = te(m, { enabled: h && !!D }), ue = c({ enabled: h && !!D?.payment_reminder_id }),
|
|
28
|
+
let { initResponse: S } = r(), C = d(() => oe(S?.scopes), [S?.scopes]), w = u(S?.scopes), T = ne(m, { enabled: h }), E = T.data, D = E?.type === "invoice" ? E : void 0, le = te(m, { enabled: h && !!D }), ue = c({ enabled: h && !!D?.payment_reminder_id }), de = ie({ enabled: h && !!D?.overdue_reminder_id }), O = o({
|
|
29
29
|
enabled: h && !!D,
|
|
30
30
|
canReadEmbedded: C.canReadEmbedded,
|
|
31
31
|
canReadExternal: C.canReadExternal
|
|
32
|
-
}),
|
|
33
|
-
|
|
34
|
-
let
|
|
32
|
+
}), k = l(h ? D?.recurrence_id : void 0), A = k.data, j = s(D?.id, { enabled: h }), M = ee(D?.id, { enabled: h && !!D }), N = d(() => D?.status === "recurring" ? (A?.iterations ?? []).flatMap((e) => e.issued_invoice_id ? [e.issued_invoice_id] : []) : [], [D?.status, A?.iterations]), P = re(N, { enabled: h }), F = d(() => new Map(P.filter((e) => !!e).map((e) => [e.id, e])), [P]), [I, L] = f(p), [R, z] = f(m);
|
|
33
|
+
R !== m && (z(m), L(p));
|
|
34
|
+
let B = I.includes(a.auditHistory), V = d(() => M.data?.data ?? [], [M.data]), H = V.some((e) => e.event_type === "mail_sent"), U = V.some((e) => e.recorded_by === "user" && !!e.entity_user_id), W = t(S?.scopes, [n.UserReadOrg]), { userNames: G, isError: K } = i({ enabled: h && B && W && U }), q = d(() => ({
|
|
35
35
|
...ae(_, v),
|
|
36
36
|
...y
|
|
37
37
|
}), [
|
|
@@ -39,7 +39,7 @@ function m({ selectedReceivableId: m, enabled: h = !0, canWrite: g = !0, message
|
|
|
39
39
|
v,
|
|
40
40
|
y
|
|
41
41
|
]), J = d(() => {
|
|
42
|
-
let t = D ? e(
|
|
42
|
+
let t = D ? e(V, G, q, {
|
|
43
43
|
documentType: "invoice",
|
|
44
44
|
currency: D.currency,
|
|
45
45
|
documentNumber: D.document_id,
|
|
@@ -47,37 +47,38 @@ function m({ selectedReceivableId: m, enabled: h = !0, canWrite: g = !0, message
|
|
|
47
47
|
}) : [];
|
|
48
48
|
return {
|
|
49
49
|
rows: t,
|
|
50
|
-
countLabel:
|
|
51
|
-
isLoading:
|
|
52
|
-
isError:
|
|
50
|
+
countLabel: M.data && !M.isLoading && !M.isError ? String(t.length) : void 0,
|
|
51
|
+
isLoading: M.isLoading,
|
|
52
|
+
isError: M.isError,
|
|
53
53
|
showNamesError: W && K && U
|
|
54
54
|
};
|
|
55
55
|
}, [
|
|
56
56
|
D,
|
|
57
|
-
|
|
57
|
+
V,
|
|
58
58
|
G,
|
|
59
59
|
q,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
M.data,
|
|
61
|
+
M.isLoading,
|
|
62
|
+
M.isError,
|
|
63
63
|
W,
|
|
64
64
|
K,
|
|
65
65
|
U
|
|
66
|
-
]), Y = ue.data?.data.find((e) => e.id === D?.payment_reminder_id), X =
|
|
66
|
+
]), Y = ue.data?.data.find((e) => e.id === D?.payment_reminder_id), X = de.data?.data.find((e) => e.id === D?.overdue_reminder_id), Z = O.paymentAccounts.find((e) => e.id === D?.bank_account_id), Q = le.data?.file_url || void 0, fe = d(() => ce({
|
|
67
67
|
receivable: E,
|
|
68
68
|
pdfUrl: Q,
|
|
69
69
|
paymentReminder: Y,
|
|
70
70
|
overdueReminder: X,
|
|
71
71
|
depositAccount: Z,
|
|
72
|
-
isAccountListIncomplete:
|
|
73
|
-
recurrence:
|
|
74
|
-
paymentRecords:
|
|
75
|
-
isLoadingPaymentRecords:
|
|
76
|
-
iterationInvoices:
|
|
72
|
+
isAccountListIncomplete: O.isIncomplete,
|
|
73
|
+
recurrence: A,
|
|
74
|
+
paymentRecords: j.data?.data,
|
|
75
|
+
isLoadingPaymentRecords: j.isLoading,
|
|
76
|
+
iterationInvoices: F,
|
|
77
77
|
auditHistory: J,
|
|
78
78
|
statusLabels: v,
|
|
79
79
|
messages: _,
|
|
80
80
|
canRecordPayment: w,
|
|
81
|
+
hasBeenSent: H,
|
|
81
82
|
canWrite: g,
|
|
82
83
|
onOpenReceivable: b,
|
|
83
84
|
onOpenCustomer: x
|
|
@@ -87,31 +88,32 @@ function m({ selectedReceivableId: m, enabled: h = !0, canWrite: g = !0, message
|
|
|
87
88
|
Y,
|
|
88
89
|
X,
|
|
89
90
|
Z,
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
O.isIncomplete,
|
|
92
|
+
A,
|
|
93
|
+
j.data,
|
|
94
|
+
j.isLoading,
|
|
95
|
+
F,
|
|
95
96
|
J,
|
|
96
97
|
v,
|
|
97
98
|
_,
|
|
98
99
|
w,
|
|
100
|
+
H,
|
|
99
101
|
g,
|
|
100
102
|
b,
|
|
101
103
|
x
|
|
102
|
-
]), $ = T.isLoading ||
|
|
104
|
+
]), $ = T.isLoading || k.isLoading;
|
|
103
105
|
return {
|
|
104
106
|
receivable: E,
|
|
105
|
-
recurrence:
|
|
106
|
-
detailsView:
|
|
107
|
+
recurrence: A,
|
|
108
|
+
detailsView: fe,
|
|
107
109
|
messageView: d(() => $ ? void 0 : se(E, m ?? "", _), [
|
|
108
110
|
$,
|
|
109
111
|
E,
|
|
110
112
|
m,
|
|
111
113
|
_
|
|
112
114
|
]),
|
|
113
|
-
openSections:
|
|
114
|
-
setOpenSections:
|
|
115
|
+
openSections: I,
|
|
116
|
+
setOpenSections: L,
|
|
115
117
|
isLoading: $
|
|
116
118
|
};
|
|
117
119
|
}
|