@tesouro/embedded-components-react 0.5.200 → 0.5.202
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.d.ts +20 -0
- package/dist/index.js +1 -1
- package/dist/lib/ReceivablesWidget.d.ts +20 -0
- package/dist/lib/ReceivablesWidget.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index.js +6 -6
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index2.js +24 -18
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index4.js +65 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index10.js +174 -234
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index11.js +32 -65
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index12.js +143 -102
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index13.js +48 -221
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index14.js +303 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index15.js +75 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index16.js +114 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index17.js +237 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index4.js +14 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index5.js +30 -215
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index6.js +211 -370
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index7.js +64 -62
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index8.js +409 -187
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index9.js +73 -40
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +10 -9
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index10.js +0 -9
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index11.js +4 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index12.js +10 -263
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +1 -72
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index14.js +241 -363
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index15.js +66 -100
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index16.js +406 -76
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index17.js +92 -330
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index18.js +93 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index19.js +344 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index2.js +10 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index4.js +157 -20
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index5.js +24 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index6.js +1 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index7.js +3 -18
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index8.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index9.js +18 -4
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +37 -37
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +54 -54
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +115 -94
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index10.js
CHANGED
|
@@ -2,254 +2,194 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { useCounterpartForm as ee } from "../../../shared/counterpart-management/feature/dist/lib/useCounterpartForm.js";
|
|
11
|
-
import "../../../shared/counterpart-management/feature/dist/index.js";
|
|
12
|
-
import { buildLineItemControls as a, commitLineItemField as te, convertPriceInput as ne, createLineItem as re, getCurrencySymbol as o, lineItemFromProduct as s, reconcileMeasureUnits as c, sanitizeLineItemPatch as l, stepLineItemQuantity as u, stripBlankLineItems as ie, summarizeLineItemErrors as ae, toSheetLineItem as d, validateLineItems as oe } from "./index5.js";
|
|
13
|
-
import { createEmptyReceivableFormValues as f, getPaymentTermOptions as se, hasReceivableFormErrors as ce, receivableFormValuesToCreatePayload as le, receivableFormValuesToLineItemChanges as ue, receivableFormValuesToUpdatePayload as de, receivableToFormValues as fe, validateReceivableForm as p } from "./index6.js";
|
|
14
|
-
import { useCreateReceivableMutation as m, useUpdateReceivableMutation as pe } from "../../data-access/dist/index6.js";
|
|
5
|
+
import { extractApiErrorMessage as e } from "../../../shared/util/dist/lib/apiErrors.js";
|
|
6
|
+
import { defaultPaymentValues as t, defaultSendValues as n, fromMajorUnits as r, hasPaymentErrors as i, hasSendErrors as a, splitEmailList as o, validatePaymentValues as s, validateSendValues as c } from "./index8.js";
|
|
7
|
+
import { useSendReceivableEmailMutation as l } from "../../data-access/dist/index5.js";
|
|
8
|
+
import { useAcceptReceivableMutation as ee, useCancelReceivableMutation as te, useCloneReceivableMutation as u, useDeclineReceivableMutation as d, useDeleteReceivableMutation as f, useIssueReceivableMutation as p } from "../../data-access/dist/index6.js";
|
|
9
|
+
import { useMarkReceivablePaidMutation as m, useMarkReceivablePartiallyPaidMutation as h, useMarkReceivableUncollectibleMutation as g } from "../../data-access/dist/index8.js";
|
|
15
10
|
import "../../data-access/dist/index.js";
|
|
16
|
-
import {
|
|
17
|
-
import { useMeasureUnitsQuery as he } from "../../../shared/product-catalog/data-access/dist/index9.js";
|
|
18
|
-
import { useMeasureUnits as ge } from "../../../shared/product-catalog/feature/dist/lib/useMeasureUnits.js";
|
|
19
|
-
import "../../../shared/product-catalog/feature/dist/index.js";
|
|
20
|
-
import { useCallback as h, useEffect as g, useMemo as _, useRef as v, useState as y } from "react";
|
|
11
|
+
import { useCallback as _, useState as v } from "react";
|
|
21
12
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index10.js
|
|
22
|
-
function
|
|
23
|
-
let
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
view: R,
|
|
33
|
-
setView: _e,
|
|
34
|
-
selectedId: P.customerId || void 0,
|
|
35
|
-
setSelectedId: Se,
|
|
36
|
-
messages: be,
|
|
37
|
-
counterpartType: "customer",
|
|
38
|
-
counterpart: void 0,
|
|
39
|
-
primaryAddress: xe
|
|
40
|
-
}), X = h(() => {
|
|
41
|
-
T.current = [], U(void 0), j("create"), N(void 0), F(f()), L({}), G(!1);
|
|
42
|
-
}, []), Ce = h((e = "invoice") => {
|
|
43
|
-
T.current = [], U(void 0), j("create"), N(void 0), F({
|
|
44
|
-
...f(),
|
|
45
|
-
type: e
|
|
46
|
-
}), L({}), G(!1), k(!0);
|
|
47
|
-
}, []), we = h((e) => {
|
|
48
|
-
e.type !== "credit_note" && (T.current = e.line_items, E.current = e.currency, U(void 0), j("edit"), N(e.id), F(fe(e, V)), L({}), G(!1), k(!0));
|
|
49
|
-
}, [V]);
|
|
50
|
-
g(() => {
|
|
51
|
-
V?.length && F((e) => {
|
|
52
|
-
let t = c(e.lineItems, V);
|
|
53
|
-
return t === e.lineItems ? e : {
|
|
54
|
-
...e,
|
|
55
|
-
lineItems: t
|
|
56
|
-
};
|
|
57
|
-
});
|
|
58
|
-
}, [V]);
|
|
59
|
-
let Te = h(() => {
|
|
60
|
-
k(!1), L({});
|
|
61
|
-
}, []), Ee = h((e) => {
|
|
62
|
-
let { currency: t } = e;
|
|
63
|
-
if (t === void 0) {
|
|
64
|
-
F((t) => ({
|
|
65
|
-
...t,
|
|
66
|
-
...e
|
|
67
|
-
}));
|
|
13
|
+
function y({ selectedReceivable: y, messages: x, onCreated: S, onDeleted: C }) {
|
|
14
|
+
let w = p(), T = te(), E = u(), D = ee(), O = d(), k = f(), A = l(), j = m(), M = h(), N = g(), [P, F] = v(), [I, L] = v(), [R, z] = v(), [B, V] = v(() => n(void 0, x)), [H, U] = v({}), [W, G] = v(), [K, q] = v(() => t()), [J, Y] = v({}), X = _((e, r, i) => {
|
|
15
|
+
let a = "documentLabel" in r ? r.documentLabel : r.title, o = {
|
|
16
|
+
id: r.id,
|
|
17
|
+
type: r.type,
|
|
18
|
+
title: a,
|
|
19
|
+
action: e
|
|
20
|
+
}, s = i === void 0 ? y : i ?? void 0;
|
|
21
|
+
if (e === "send") {
|
|
22
|
+
z(o), V(n(s, x)), U({});
|
|
68
23
|
return;
|
|
69
24
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
P.currency,
|
|
102
|
-
P.lineItems
|
|
103
|
-
]);
|
|
104
|
-
let De = h((e, t) => {
|
|
105
|
-
let { unit: n, ...r } = t, i = l(r);
|
|
106
|
-
i.name !== void 0 && (i.productId = ""), n !== void 0 && (i.measureUnitId = n, i.measureUnitName = ""), Q((t) => t.map((t) => t.id === e ? {
|
|
107
|
-
...t,
|
|
108
|
-
...i
|
|
109
|
-
} : t), { validate: W });
|
|
110
|
-
}, [Q, W]), Oe = h((e, t) => {
|
|
111
|
-
Q((n) => n.map((n) => n.id === e ? {
|
|
112
|
-
...n,
|
|
113
|
-
...s({
|
|
114
|
-
product: t,
|
|
115
|
-
currency: P.currency,
|
|
116
|
-
unitNamesById: H
|
|
117
|
-
})
|
|
118
|
-
} : n), { validate: !0 });
|
|
119
|
-
}, [
|
|
120
|
-
Q,
|
|
121
|
-
H,
|
|
122
|
-
P.currency
|
|
123
|
-
]), $ = h((e, t) => {
|
|
124
|
-
t && Q((n) => t.kind === "remove" ? n.filter((t) => t.id !== e) : n.map((n) => n.id === e ? {
|
|
125
|
-
...n,
|
|
126
|
-
...t.patch
|
|
127
|
-
} : n), { validate: !0 });
|
|
128
|
-
}, [Q]), ke = h((e, t) => {
|
|
129
|
-
let n = P.lineItems.find((t) => t.id === e);
|
|
130
|
-
n && $(e, te({
|
|
131
|
-
lineItem: n,
|
|
132
|
-
field: t,
|
|
133
|
-
rowCount: P.lineItems.length,
|
|
134
|
-
currency: P.currency
|
|
135
|
-
}));
|
|
25
|
+
if (e === "recordPayment") {
|
|
26
|
+
G({
|
|
27
|
+
...o,
|
|
28
|
+
currency: s?.currency
|
|
29
|
+
}), q(t()), Y({});
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
L(void 0), F(o);
|
|
33
|
+
}, [x, y]), Z = _(() => {
|
|
34
|
+
F(void 0), L(void 0);
|
|
35
|
+
}, []), Q = _(() => {
|
|
36
|
+
z(void 0), U({});
|
|
37
|
+
}, []), $ = _(() => {
|
|
38
|
+
G(void 0), Y({});
|
|
39
|
+
}, []), ne = _(async () => {
|
|
40
|
+
if (!P) return;
|
|
41
|
+
let t = { receivable_id: P.id };
|
|
42
|
+
try {
|
|
43
|
+
if (P.action === "issue") await w.mutateAsync({ path: t });
|
|
44
|
+
else if (P.action === "cancel") await T.mutateAsync({ path: t });
|
|
45
|
+
else if (P.action === "clone") {
|
|
46
|
+
let e = await E.mutateAsync({ path: t });
|
|
47
|
+
e?.id && S?.(e.id, e.type);
|
|
48
|
+
} else P.action === "accept" ? await D.mutateAsync({ path: t }) : P.action === "decline" ? await O.mutateAsync({ path: t }) : P.action === "delete" ? (await k.mutateAsync({ path: t }), C?.(P.id)) : P.action === "markPaid" ? await j.mutateAsync({
|
|
49
|
+
path: t,
|
|
50
|
+
body: { paid_at: (/* @__PURE__ */ new Date()).toISOString() }
|
|
51
|
+
}) : P.action === "markUncollectible" && await N.mutateAsync({ path: t });
|
|
52
|
+
F(void 0), L(void 0);
|
|
53
|
+
} catch (t) {
|
|
54
|
+
L(e(t) ?? x.genericError);
|
|
55
|
+
}
|
|
136
56
|
}, [
|
|
137
|
-
|
|
138
|
-
P
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
Q((t) => t.length <= 1 ? t : t.filter((t) => t.id !== e), { validate: !0 });
|
|
155
|
-
}, [Q]), Ne = h(async () => {
|
|
156
|
-
if (B.isLoading) {
|
|
157
|
-
L({ form: b.lineItemsLoading });
|
|
57
|
+
D,
|
|
58
|
+
P,
|
|
59
|
+
T,
|
|
60
|
+
E,
|
|
61
|
+
O,
|
|
62
|
+
k,
|
|
63
|
+
w,
|
|
64
|
+
j,
|
|
65
|
+
x.genericError,
|
|
66
|
+
S,
|
|
67
|
+
C,
|
|
68
|
+
N
|
|
69
|
+
]), re = _(async () => {
|
|
70
|
+
if (!R) return;
|
|
71
|
+
let t = c(B, x);
|
|
72
|
+
if (a(t)) {
|
|
73
|
+
U(t);
|
|
158
74
|
return;
|
|
159
75
|
}
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
76
|
+
try {
|
|
77
|
+
await A.mutateAsync({
|
|
78
|
+
path: { receivable_id: R.id },
|
|
79
|
+
body: {
|
|
80
|
+
body_text: B.body,
|
|
81
|
+
subject_text: B.subject,
|
|
82
|
+
recipients: {
|
|
83
|
+
to: o(B.to),
|
|
84
|
+
cc: o(B.cc),
|
|
85
|
+
bcc: o(B.bcc)
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}), Q();
|
|
89
|
+
} catch (t) {
|
|
90
|
+
U({ form: e(t) ?? x.genericError });
|
|
91
|
+
}
|
|
92
|
+
}, [
|
|
93
|
+
Q,
|
|
94
|
+
x,
|
|
95
|
+
A,
|
|
96
|
+
R,
|
|
97
|
+
B
|
|
98
|
+
]), ie = _(async () => {
|
|
99
|
+
if (!W) return;
|
|
100
|
+
let t = s(K, x, W.currency);
|
|
101
|
+
if (i(t)) {
|
|
102
|
+
Y(t);
|
|
172
103
|
return;
|
|
173
104
|
}
|
|
174
|
-
L({});
|
|
175
105
|
try {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
return;
|
|
193
|
-
}
|
|
194
|
-
let e = await C.mutateAsync({ body: le({
|
|
195
|
-
values: n,
|
|
196
|
-
billingAddressId: J ?? "",
|
|
197
|
-
unitNamesById: H
|
|
198
|
-
}) });
|
|
199
|
-
k(!1), X(), e?.id && S?.(e.id, e.type);
|
|
200
|
-
} catch (e) {
|
|
201
|
-
L({ form: t(e) ?? b.genericError });
|
|
106
|
+
let e = { receivable_id: W.id }, t = K.paidAt ? new Date(K.paidAt).toISOString() : void 0;
|
|
107
|
+
K.mode === "full" ? await j.mutateAsync({
|
|
108
|
+
path: e,
|
|
109
|
+
body: {
|
|
110
|
+
comment: K.comment || void 0,
|
|
111
|
+
paid_at: t
|
|
112
|
+
}
|
|
113
|
+
}) : await M.mutateAsync({
|
|
114
|
+
path: e,
|
|
115
|
+
body: {
|
|
116
|
+
amount_paid: r(K.amountPaid, W.currency) ?? 0,
|
|
117
|
+
comment: K.comment || void 0
|
|
118
|
+
}
|
|
119
|
+
}), $();
|
|
120
|
+
} catch (t) {
|
|
121
|
+
Y({ form: e(t) ?? x.genericError });
|
|
202
122
|
}
|
|
203
123
|
}, [
|
|
204
|
-
|
|
205
|
-
|
|
124
|
+
$,
|
|
125
|
+
j,
|
|
126
|
+
x,
|
|
206
127
|
M,
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
X,
|
|
211
|
-
V,
|
|
212
|
-
H,
|
|
213
|
-
B.isLoading,
|
|
214
|
-
w,
|
|
215
|
-
P
|
|
216
|
-
]), Pe = _(() => ({
|
|
217
|
-
...P,
|
|
218
|
-
lineItems: P.lineItems.map(d)
|
|
219
|
-
}), [P]), Fe = _(() => a(P.lineItems), [P.lineItems]);
|
|
128
|
+
W,
|
|
129
|
+
K
|
|
130
|
+
]);
|
|
220
131
|
return {
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
132
|
+
actionTarget: P,
|
|
133
|
+
actionDialog: P ? b(P.action, x) : void 0,
|
|
134
|
+
actionError: I,
|
|
135
|
+
actionInProgress: w.isPending || T.isPending || E.isPending || D.isPending || O.isPending || k.isPending || j.isPending || N.isPending,
|
|
136
|
+
openAction: X,
|
|
137
|
+
closeAction: Z,
|
|
138
|
+
confirmAction: ne,
|
|
139
|
+
sendOpen: !!R,
|
|
140
|
+
sendValues: B,
|
|
141
|
+
sendErrors: H,
|
|
142
|
+
sendInProgress: A.isPending,
|
|
143
|
+
setSendValues: V,
|
|
144
|
+
closeSend: Q,
|
|
145
|
+
submitSend: re,
|
|
146
|
+
paymentOpen: !!W,
|
|
147
|
+
paymentValues: K,
|
|
148
|
+
paymentErrors: J,
|
|
149
|
+
paymentInProgress: j.isPending || M.isPending,
|
|
150
|
+
setPaymentValues: q,
|
|
151
|
+
closePayment: $,
|
|
152
|
+
submitPayment: ie
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function b(e, t) {
|
|
156
|
+
return e === "issue" ? {
|
|
157
|
+
title: t.issueTitle,
|
|
158
|
+
description: t.issueDescription,
|
|
159
|
+
confirmLabel: t.issueConfirm
|
|
160
|
+
} : e === "accept" ? {
|
|
161
|
+
title: t.acceptTitle,
|
|
162
|
+
description: t.acceptDescription,
|
|
163
|
+
confirmLabel: t.acceptConfirm
|
|
164
|
+
} : e === "decline" ? {
|
|
165
|
+
title: t.declineTitle,
|
|
166
|
+
description: t.declineDescription,
|
|
167
|
+
confirmLabel: t.declineConfirm,
|
|
168
|
+
destructive: !0
|
|
169
|
+
} : e === "cancel" ? {
|
|
170
|
+
title: t.cancelTitle,
|
|
171
|
+
description: t.cancelDescription,
|
|
172
|
+
confirmLabel: t.cancelConfirm,
|
|
173
|
+
destructive: !0
|
|
174
|
+
} : e === "clone" ? {
|
|
175
|
+
title: t.cloneTitle,
|
|
176
|
+
description: t.cloneDescription,
|
|
177
|
+
confirmLabel: t.cloneConfirm
|
|
178
|
+
} : e === "delete" ? {
|
|
179
|
+
title: t.deleteTitle,
|
|
180
|
+
description: t.deleteDescription,
|
|
181
|
+
confirmLabel: t.deleteConfirm,
|
|
182
|
+
destructive: !0
|
|
183
|
+
} : e === "markPaid" ? {
|
|
184
|
+
title: t.markPaidTitle,
|
|
185
|
+
description: t.markPaidDescription,
|
|
186
|
+
confirmLabel: t.markPaidConfirm
|
|
187
|
+
} : {
|
|
188
|
+
title: t.markUncollectibleTitle,
|
|
189
|
+
description: t.markUncollectibleDescription,
|
|
190
|
+
confirmLabel: t.markUncollectibleConfirm,
|
|
191
|
+
destructive: !0
|
|
252
192
|
};
|
|
253
193
|
}
|
|
254
194
|
//#endregion
|
|
255
|
-
export {
|
|
195
|
+
export { y as useReceivableActions };
|
package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index11.js
CHANGED
|
@@ -2,74 +2,41 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { buildReceivableDetailsView as e } from "./index8.js";
|
|
6
|
+
import { useReceivableHistoryQuery as t, useReceivableMailsQuery as n, useReceivablePdfLinkQuery as r, useReceivableQuery as i } from "../../data-access/dist/index9.js";
|
|
7
7
|
import "../../data-access/dist/index.js";
|
|
8
|
-
import {
|
|
8
|
+
import { useMemo as a } from "react";
|
|
9
9
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index11.js
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}), [d, O]), M = !!b || S !== "all", N = i((e) => {
|
|
35
|
-
let t = typeof e == "function" ? e(f) : e;
|
|
36
|
-
p(t), _(void 0);
|
|
37
|
-
}, [f]), P = i((e) => {
|
|
38
|
-
h(e), _(void 0);
|
|
39
|
-
}, []), F = i((e) => {
|
|
40
|
-
C(e), _(void 0);
|
|
41
|
-
}, []), I = i(() => _(D.data?.next_pagination_token ?? void 0), [D.data?.next_pagination_token]), L = i(() => _(D.data?.prev_pagination_token ?? void 0), [D.data?.prev_pagination_token]), R = i(() => {
|
|
42
|
-
D.refetch();
|
|
43
|
-
}, [D]);
|
|
10
|
+
function o({ selectedReceivableId: o, enabled: s = !0, messages: c }) {
|
|
11
|
+
let l = i(o, { enabled: s }), u = t(o, {
|
|
12
|
+
enabled: s,
|
|
13
|
+
limit: 25,
|
|
14
|
+
sort: "timestamp",
|
|
15
|
+
order: "desc"
|
|
16
|
+
}), d = n(o, {
|
|
17
|
+
enabled: s,
|
|
18
|
+
limit: 10,
|
|
19
|
+
sort: "created_at",
|
|
20
|
+
order: "desc"
|
|
21
|
+
}), f = r(o, { enabled: s && !!l.data }), p = a(() => e({
|
|
22
|
+
receivable: l.data,
|
|
23
|
+
history: u.data?.data ?? [],
|
|
24
|
+
mails: d.data?.data ?? [],
|
|
25
|
+
pdfUrl: f.data?.file_url || f.data?.original_file_url || void 0,
|
|
26
|
+
messages: c
|
|
27
|
+
}), [
|
|
28
|
+
l.data,
|
|
29
|
+
u.data?.data,
|
|
30
|
+
d.data?.data,
|
|
31
|
+
c,
|
|
32
|
+
f.data
|
|
33
|
+
]);
|
|
44
34
|
return {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
onSortingChange: N,
|
|
50
|
-
pageSize: m,
|
|
51
|
-
onPageSizeChange: P,
|
|
52
|
-
hasNextPage: !!D.data?.next_pagination_token,
|
|
53
|
-
hasPrevPage: !!D.data?.prev_pagination_token,
|
|
54
|
-
onNextPage: I,
|
|
55
|
-
onPrevPage: L,
|
|
56
|
-
searchValue: v,
|
|
57
|
-
onSearchChange: y,
|
|
58
|
-
statusFilter: S,
|
|
59
|
-
statusOptions: t(),
|
|
60
|
-
onStatusFilterChange: F,
|
|
61
|
-
isFiltering: M,
|
|
62
|
-
onRetry: R,
|
|
63
|
-
getReceivableById: A
|
|
35
|
+
receivable: l.data,
|
|
36
|
+
detailsView: p,
|
|
37
|
+
isLoading: l.isLoading || u.isLoading || d.isLoading || f.isLoading,
|
|
38
|
+
isError: l.isError
|
|
64
39
|
};
|
|
65
40
|
}
|
|
66
|
-
var u = {
|
|
67
|
-
documentLabel: "document_id",
|
|
68
|
-
customerLabel: "counterpart_name",
|
|
69
|
-
status: "status",
|
|
70
|
-
issueDateLabel: "issue_date",
|
|
71
|
-
dueDateLabel: "due_date",
|
|
72
|
-
totalLabel: "total_amount"
|
|
73
|
-
};
|
|
74
41
|
//#endregion
|
|
75
|
-
export {
|
|
42
|
+
export { o as useReceivableDetails };
|