@tesouro/embedded-components-react 0.5.247 → 0.5.249
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 +27 -26
- package/dist/index.d.ts +2 -1
- package/dist/lib/ReceivablesWidget.d.ts +2 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +58 -57
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/helpers.js +52 -38
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableForm.js +408 -396
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesWidget.js +140 -131
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
|
@@ -19,195 +19,204 @@ import { useReceivableActionsModal as fe } from "./useReceivableActionsModal.js"
|
|
|
19
19
|
import { useReceivableDetails as pe } from "./useReceivableDetails.js";
|
|
20
20
|
import { useReceivableForm as me } from "./useReceivableForm.js";
|
|
21
21
|
import { useReceivablesTable as he } from "./useReceivablesTable.js";
|
|
22
|
-
import { useCallback as o, useEffect as s, useMemo as c, useState as l } from "react";
|
|
22
|
+
import { useCallback as o, useEffect as s, useMemo as c, useRef as ge, useState as l } from "react";
|
|
23
23
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesWidget.js
|
|
24
|
-
function u({ auditHistoryLabels: u, counterpartMessageLabels:
|
|
25
|
-
let
|
|
24
|
+
function u({ auditHistoryLabels: u, counterpartMessageLabels: _e, defaultTab: f, embeddedBankName: ve, enabledTabs: p, filterLabels: ye, initialCounterpartId: m, initialView: h, messageLabels: g, onReceivableCreated: _, onReceivableOpened: v, screenLabels: be }) {
|
|
25
|
+
let y = e();
|
|
26
26
|
s(() => {
|
|
27
|
-
|
|
28
|
-
}, [
|
|
29
|
-
let { initResponse:
|
|
27
|
+
y(ne.Mounted);
|
|
28
|
+
}, [y]);
|
|
29
|
+
let { initResponse: b, widgetToken: xe } = n(), x = te(), Se = r(), Ce = t(), S = ee(), C = !!b && !S, w = c(() => ue(b?.scopes), [b?.scopes]), we = !!b && S, T = !!b && w.canRead, E = !!b && w.canWrite, D = C && w.canRead, O = C && w.canWrite, k = !!Se && !C && !x, A = !C && !k && !!(xe || x), j = c(() => ({
|
|
30
30
|
...le,
|
|
31
|
-
...
|
|
32
|
-
}), [
|
|
31
|
+
...g
|
|
32
|
+
}), [g]), M = be?.statusBadge, N = c(() => ({
|
|
33
33
|
...re,
|
|
34
|
-
...
|
|
35
|
-
}), [
|
|
34
|
+
...M
|
|
35
|
+
}), [M]), P = c(() => oe(p), [p]), [F, I] = l(() => i({
|
|
36
36
|
defaultTab: f,
|
|
37
|
-
enabledTabs:
|
|
38
|
-
})), [
|
|
37
|
+
enabledTabs: P
|
|
38
|
+
})), [Te, L] = l(), [R, z] = l(!1), [B, V] = l(!1), Ee = o(() => V(!0), []), H = o(() => V(!1), []);
|
|
39
39
|
s(() => {
|
|
40
|
-
|
|
40
|
+
P.includes(F) || I(i({
|
|
41
41
|
defaultTab: f,
|
|
42
|
-
enabledTabs:
|
|
42
|
+
enabledTabs: P
|
|
43
43
|
}));
|
|
44
44
|
}, [
|
|
45
|
-
|
|
45
|
+
F,
|
|
46
46
|
f,
|
|
47
|
-
|
|
47
|
+
P
|
|
48
48
|
]);
|
|
49
|
-
let
|
|
50
|
-
|
|
51
|
-
}, [
|
|
52
|
-
|
|
49
|
+
let De = o((e, t) => {
|
|
50
|
+
I(a(t)), L(e), z(!0), _?.(e, t);
|
|
51
|
+
}, [_]), U = fe({ messages: j }), W = U.open, Oe = o((e, t, n) => {
|
|
52
|
+
I(a(t));
|
|
53
53
|
let r = ae(n);
|
|
54
|
-
r.openDetails && (
|
|
54
|
+
r.openDetails && (L(e), z(!0)), r.actionsModal && W({
|
|
55
55
|
action: n.mode,
|
|
56
56
|
receivableId: e,
|
|
57
57
|
counterpartId: n.counterpartId,
|
|
58
58
|
inlineItems: n.inlineItems,
|
|
59
59
|
showEmailStep: r.actionsModal.showEmailStep
|
|
60
|
-
}),
|
|
61
|
-
}, [
|
|
62
|
-
activeTab:
|
|
63
|
-
initialCounterpartId:
|
|
64
|
-
messages:
|
|
65
|
-
statusLabels:
|
|
60
|
+
}), _?.(e, t);
|
|
61
|
+
}, [_, W]), G = he({
|
|
62
|
+
activeTab: F,
|
|
63
|
+
initialCounterpartId: h === "create" ? void 0 : m,
|
|
64
|
+
messages: j,
|
|
65
|
+
statusLabels: N,
|
|
66
66
|
filterLabels: ye,
|
|
67
|
-
enabled:
|
|
68
|
-
visible:
|
|
69
|
-
}),
|
|
70
|
-
|
|
71
|
-
}, [
|
|
72
|
-
selectedReceivableId:
|
|
73
|
-
enabled:
|
|
74
|
-
canWrite:
|
|
75
|
-
messages:
|
|
76
|
-
statusLabels:
|
|
67
|
+
enabled: D,
|
|
68
|
+
visible: T
|
|
69
|
+
}), ke = o((e) => {
|
|
70
|
+
L(e), z(!0), v?.(e, "invoice");
|
|
71
|
+
}, [v]), K = pe({
|
|
72
|
+
selectedReceivableId: Te,
|
|
73
|
+
enabled: R && D,
|
|
74
|
+
canWrite: E,
|
|
75
|
+
messages: j,
|
|
76
|
+
statusLabels: N,
|
|
77
77
|
auditHistoryLabels: u,
|
|
78
|
-
onOpenReceivable:
|
|
79
|
-
}),
|
|
80
|
-
messages:
|
|
81
|
-
counterpartMessageLabels:
|
|
82
|
-
embeddedBankName:
|
|
83
|
-
onCreated:
|
|
84
|
-
}),
|
|
85
|
-
if (!
|
|
86
|
-
let e = ce(
|
|
87
|
-
|
|
78
|
+
onOpenReceivable: ke
|
|
79
|
+
}), q = me({
|
|
80
|
+
messages: j,
|
|
81
|
+
counterpartMessageLabels: _e,
|
|
82
|
+
embeddedBankName: ve,
|
|
83
|
+
onCreated: Oe
|
|
84
|
+
}), Ae = o(() => {
|
|
85
|
+
if (!O) return;
|
|
86
|
+
let e = ce(F);
|
|
87
|
+
q.openCreate(e === "quote" ? "quote" : "invoice");
|
|
88
|
+
}, [
|
|
89
|
+
F,
|
|
90
|
+
O,
|
|
91
|
+
q.openCreate
|
|
92
|
+
]), J = ge(!1);
|
|
93
|
+
s(() => {
|
|
94
|
+
J.current || h === "create" && O && (J.current = !0, q.openCreate("invoice", { customerId: m }));
|
|
88
95
|
}, [
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
96
|
+
O,
|
|
97
|
+
q.openCreate,
|
|
98
|
+
m,
|
|
99
|
+
h
|
|
100
|
+
]);
|
|
101
|
+
let Y = de({
|
|
102
|
+
selectedReceivable: K.receivable,
|
|
103
|
+
selectedRecurrence: K.recurrence,
|
|
104
|
+
messages: j,
|
|
105
|
+
onCreated: De,
|
|
97
106
|
onDeleted: (e) => {
|
|
98
|
-
e ===
|
|
107
|
+
e === Te && (L(void 0), z(!1));
|
|
99
108
|
},
|
|
100
109
|
onCompleteBeforeIssue: (e) => {
|
|
101
|
-
|
|
110
|
+
q.openEdit(e, { highlightForIssue: !0 }), z(!1);
|
|
102
111
|
}
|
|
103
|
-
}),
|
|
112
|
+
}), X = C && !w.canWrite, Z = q.open || q.counterpartView !== "none" || !!Y.actionTarget || Y.sendOpen || Y.paymentOpen || U.isOpen || B, je = q.close, Q = q.counterpartForm.close, { closeAction: Me, closeSend: Ne, closePayment: Pe } = Y, $ = U.close;
|
|
104
113
|
s(() => {
|
|
105
|
-
|
|
114
|
+
X && Z && (je(), Q(), Me(), Ne(), Pe(), $(), H());
|
|
106
115
|
}, [
|
|
107
|
-
|
|
116
|
+
Me,
|
|
108
117
|
$,
|
|
109
|
-
Y,
|
|
110
|
-
J,
|
|
111
|
-
z,
|
|
112
118
|
Q,
|
|
119
|
+
je,
|
|
120
|
+
H,
|
|
121
|
+
Pe,
|
|
122
|
+
Ne,
|
|
113
123
|
Z,
|
|
114
|
-
|
|
115
|
-
K
|
|
124
|
+
X
|
|
116
125
|
]);
|
|
117
|
-
let
|
|
118
|
-
ie() || (
|
|
119
|
-
}, [
|
|
120
|
-
|
|
121
|
-
}, []),
|
|
122
|
-
if (!
|
|
123
|
-
let n =
|
|
126
|
+
let Fe = o((e) => {
|
|
127
|
+
ie() || (L(e.id), z(!0), v?.(e.id, e.type));
|
|
128
|
+
}, [v]), Ie = o(() => {
|
|
129
|
+
z(!1), L(void 0);
|
|
130
|
+
}, []), Le = o((e, t) => {
|
|
131
|
+
if (!O) return;
|
|
132
|
+
let n = G.getReceivableById(t.id);
|
|
124
133
|
if (e === "edit") {
|
|
125
134
|
if (n) {
|
|
126
|
-
|
|
135
|
+
q.openEdit(n);
|
|
127
136
|
return;
|
|
128
137
|
}
|
|
129
|
-
|
|
138
|
+
L(t.id), z(!0);
|
|
130
139
|
return;
|
|
131
140
|
}
|
|
132
|
-
|
|
141
|
+
L(t.id), Y.openAction(e, t, n ?? null);
|
|
133
142
|
}, [
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
]),
|
|
139
|
-
if (
|
|
143
|
+
Y,
|
|
144
|
+
O,
|
|
145
|
+
q.openEdit,
|
|
146
|
+
G.getReceivableById
|
|
147
|
+
]), Re = o((e, t) => {
|
|
148
|
+
if (O) {
|
|
140
149
|
if (e === "edit") {
|
|
141
|
-
|
|
150
|
+
K.receivable && (q.openEdit(K.receivable), z(!1));
|
|
142
151
|
return;
|
|
143
152
|
}
|
|
144
|
-
|
|
153
|
+
Y.openAction(e, {
|
|
145
154
|
id: t.id,
|
|
146
|
-
title:
|
|
155
|
+
title: K.receivable ? se(K.receivable, j) : t.title,
|
|
147
156
|
type: t.type
|
|
148
|
-
},
|
|
157
|
+
}, K.receivable ?? null);
|
|
149
158
|
}
|
|
150
159
|
}, [
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
160
|
+
Y,
|
|
161
|
+
O,
|
|
162
|
+
K.receivable,
|
|
163
|
+
q.openEdit,
|
|
164
|
+
j
|
|
156
165
|
]);
|
|
157
166
|
return {
|
|
158
|
-
activeTab:
|
|
159
|
-
enabledTabs:
|
|
160
|
-
setActiveTab:
|
|
161
|
-
canWrite:
|
|
162
|
-
actionsSuspended:
|
|
163
|
-
isAccessRestricted:
|
|
164
|
-
table:
|
|
165
|
-
...
|
|
167
|
+
activeTab: F,
|
|
168
|
+
enabledTabs: P,
|
|
169
|
+
setActiveTab: I,
|
|
170
|
+
canWrite: E,
|
|
171
|
+
actionsSuspended: we,
|
|
172
|
+
isAccessRestricted: C && !w.canRead,
|
|
173
|
+
table: T ? G : {
|
|
174
|
+
...G,
|
|
166
175
|
rows: [],
|
|
167
176
|
statusCards: void 0,
|
|
168
177
|
isError: !1
|
|
169
178
|
},
|
|
170
|
-
isTableLoading:
|
|
171
|
-
isError:
|
|
172
|
-
onRetry:
|
|
173
|
-
details:
|
|
174
|
-
detailsOpen:
|
|
175
|
-
closeDetails:
|
|
179
|
+
isTableLoading: T ? G.isLoading || A && G.rows.length === 0 : A,
|
|
180
|
+
isError: k || T && G.isError,
|
|
181
|
+
onRetry: k ? Ce : G.onRetry,
|
|
182
|
+
details: K,
|
|
183
|
+
detailsOpen: R && T,
|
|
184
|
+
closeDetails: Ie,
|
|
176
185
|
form: {
|
|
177
|
-
...
|
|
178
|
-
open:
|
|
179
|
-
counterpartView:
|
|
186
|
+
...q,
|
|
187
|
+
open: E && q.open,
|
|
188
|
+
counterpartView: E ? q.counterpartView : "none",
|
|
180
189
|
counterpartForm: {
|
|
181
|
-
...
|
|
182
|
-
submit: d(
|
|
190
|
+
...q.counterpartForm,
|
|
191
|
+
submit: d(O, q.counterpartForm.submit)
|
|
183
192
|
},
|
|
184
|
-
submit: d(
|
|
185
|
-
submitDraft: d(
|
|
186
|
-
submitPrimary: d(
|
|
193
|
+
submit: d(O, q.submit),
|
|
194
|
+
submitDraft: d(O, q.submitDraft),
|
|
195
|
+
submitPrimary: d(O, q.submitPrimary)
|
|
187
196
|
},
|
|
188
|
-
openCreate:
|
|
189
|
-
measureUnitsOpen:
|
|
190
|
-
openMeasureUnits:
|
|
191
|
-
closeMeasureUnits:
|
|
197
|
+
openCreate: Ae,
|
|
198
|
+
measureUnitsOpen: E && B,
|
|
199
|
+
openMeasureUnits: Ee,
|
|
200
|
+
closeMeasureUnits: H,
|
|
192
201
|
actions: {
|
|
193
|
-
...
|
|
194
|
-
actionDialog:
|
|
195
|
-
sendOpen:
|
|
196
|
-
paymentOpen:
|
|
197
|
-
openAction: d(
|
|
198
|
-
confirmAction: d(
|
|
199
|
-
submitSend: d(
|
|
200
|
-
submitPayment: d(
|
|
202
|
+
...Y,
|
|
203
|
+
actionDialog: E ? Y.actionDialog : void 0,
|
|
204
|
+
sendOpen: E && Y.sendOpen,
|
|
205
|
+
paymentOpen: E && Y.paymentOpen,
|
|
206
|
+
openAction: d(O, Y.openAction),
|
|
207
|
+
confirmAction: d(O, Y.confirmAction),
|
|
208
|
+
submitSend: d(O, Y.submitSend),
|
|
209
|
+
submitPayment: d(O, Y.submitPayment)
|
|
201
210
|
},
|
|
202
211
|
actionsModal: {
|
|
203
|
-
...
|
|
204
|
-
isOpen:
|
|
205
|
-
send: d(
|
|
206
|
-
saveItems: d(
|
|
212
|
+
...U,
|
|
213
|
+
isOpen: E && U.isOpen,
|
|
214
|
+
send: d(O, U.send),
|
|
215
|
+
saveItems: d(O, U.saveItems)
|
|
207
216
|
},
|
|
208
|
-
handleRowClick:
|
|
209
|
-
handleActionClick:
|
|
210
|
-
handleDetailsActionClick:
|
|
217
|
+
handleRowClick: Fe,
|
|
218
|
+
handleActionClick: Le,
|
|
219
|
+
handleDetailsActionClick: Re
|
|
211
220
|
};
|
|
212
221
|
}
|
|
213
222
|
function d(e, t) {
|
package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
|
|
2
|
-
var e = "@tesouro/embedded-components-react", t = "0.5.
|
|
2
|
+
var e = "@tesouro/embedded-components-react", t = "0.5.249", n = "1b9627e5ee009fc3ca088c4eec33a41cd9eec226", r = Object.freeze({
|
|
3
3
|
library_name: e,
|
|
4
4
|
library_version: t,
|
|
5
5
|
library_sha: n
|