@tesouro/embedded-components-react 0.5.263 → 0.5.265
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 +29 -29
- package/dist/index.d.ts +24 -33
- package/dist/lib/ReceivablesWidget.d.ts +24 -33
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +18 -27
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/helpers.js +49 -131
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/labels.js +1 -0
- 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/useReceivablesTable.js +73 -90
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesWidget.js +128 -170
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +18 -37
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index52.js +127 -292
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
|
@@ -11,222 +11,180 @@ import "../../../../ui/dist/index.js";
|
|
|
11
11
|
import { hasSelectedText as ie } from "../../../../../shared/product-catalog/feature/dist/lib/helpers.js";
|
|
12
12
|
import "../../../../../shared/product-catalog/feature/dist/index.js";
|
|
13
13
|
import { getCreateFollowUp as ae } from "./actionsModal.js";
|
|
14
|
-
import {
|
|
15
|
-
import { RECEIVABLE_MESSAGE_LABELS_EN as
|
|
16
|
-
import { getReceivablePermissions as
|
|
17
|
-
import { useReceivableActions as
|
|
18
|
-
import { useReceivableActionsModal as
|
|
19
|
-
import { useReceivableDetails as
|
|
20
|
-
import { useReceivableForm as
|
|
21
|
-
import { useReceivablesTable as
|
|
22
|
-
import { useCallback as
|
|
14
|
+
import { getDocumentTitle as oe } from "./helpers.js";
|
|
15
|
+
import { RECEIVABLE_MESSAGE_LABELS_EN as i } from "./labels.js";
|
|
16
|
+
import { getReceivablePermissions as se } from "./permissions.js";
|
|
17
|
+
import { useReceivableActions as ce } from "./useReceivableActions.js";
|
|
18
|
+
import { useReceivableActionsModal as le } from "./useReceivableActionsModal.js";
|
|
19
|
+
import { useReceivableDetails as ue } from "./useReceivableDetails.js";
|
|
20
|
+
import { useReceivableForm as de } from "./useReceivableForm.js";
|
|
21
|
+
import { useReceivablesTable as fe } from "./useReceivablesTable.js";
|
|
22
|
+
import { useCallback as a, useEffect as o, useMemo as s, useRef as pe, useState as c } from "react";
|
|
23
23
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesWidget.js
|
|
24
|
-
function
|
|
25
|
-
let
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
}, [
|
|
29
|
-
let { initResponse:
|
|
30
|
-
...
|
|
31
|
-
...
|
|
32
|
-
}), [
|
|
24
|
+
function l({ auditHistoryLabels: l, counterpartMessageLabels: me, embeddedBankName: he, filterLabels: ge, initialCounterpartId: d, initialView: f, messageLabels: p, onReceivableCreated: m, onReceivableOpened: h, screenLabels: _e }) {
|
|
25
|
+
let g = e();
|
|
26
|
+
o(() => {
|
|
27
|
+
g(ne.Mounted);
|
|
28
|
+
}, [g]);
|
|
29
|
+
let { initResponse: _, widgetToken: ve } = n(), v = te(), ye = r(), y = t(), b = ee(), x = !!_ && !b, S = s(() => se(_?.scopes), [_?.scopes]), be = !!_ && b, C = !!_ && S.canRead, w = !!_ && S.canWrite, T = x && S.canRead, E = x && S.canWrite, D = !!ye && !x && !v, O = !x && !D && !!(ve || v), k = s(() => ({
|
|
30
|
+
...i,
|
|
31
|
+
...p
|
|
32
|
+
}), [p]), A = _e?.statusBadge, j = s(() => ({
|
|
33
33
|
...re,
|
|
34
|
-
...
|
|
35
|
-
}), [M]), P = c(() =>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
})), [Te, L] = l(), [R, z] = l(!1), [B, V] = l(!1), Ee = o(() => V(!0), []), H = o(() => V(!1), []);
|
|
39
|
-
s(() => {
|
|
40
|
-
P.includes(F) || I(i({
|
|
41
|
-
defaultTab: f,
|
|
42
|
-
enabledTabs: P
|
|
43
|
-
}));
|
|
44
|
-
}, [
|
|
45
|
-
F,
|
|
46
|
-
f,
|
|
47
|
-
P
|
|
48
|
-
]);
|
|
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));
|
|
34
|
+
...A
|
|
35
|
+
}), [A]), [M, N] = c(), [P, F] = c(!1), [I, L] = c(!1), xe = a(() => L(!0), []), R = a(() => L(!1), []), Se = a((e, t) => {
|
|
36
|
+
N(e), F(!0), m?.(e, t);
|
|
37
|
+
}, [m]), z = le({ messages: k }), B = z.open, Ce = a((e, t, n) => {
|
|
53
38
|
let r = ae(n);
|
|
54
|
-
r.openDetails && (
|
|
39
|
+
r.openDetails && (N(e), F(!0)), r.actionsModal && B({
|
|
55
40
|
action: n.mode,
|
|
56
41
|
receivableId: e,
|
|
57
42
|
counterpartId: n.counterpartId,
|
|
58
43
|
inlineItems: n.inlineItems,
|
|
59
44
|
showEmailStep: r.actionsModal.showEmailStep
|
|
60
|
-
}),
|
|
61
|
-
}, [
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
45
|
+
}), m?.(e, t);
|
|
46
|
+
}, [m, B]), V = fe({
|
|
47
|
+
initialCounterpartId: f === "create" ? void 0 : d,
|
|
48
|
+
messages: k,
|
|
49
|
+
statusLabels: j,
|
|
50
|
+
filterLabels: ge,
|
|
51
|
+
enabled: T,
|
|
52
|
+
visible: C
|
|
53
|
+
}), we = a((e) => {
|
|
54
|
+
N(e), F(!0), h?.(e, "invoice");
|
|
55
|
+
}, [h]), H = ue({
|
|
56
|
+
selectedReceivableId: M,
|
|
57
|
+
enabled: P && T,
|
|
58
|
+
canWrite: w,
|
|
59
|
+
messages: k,
|
|
60
|
+
statusLabels: j,
|
|
61
|
+
auditHistoryLabels: l,
|
|
62
|
+
onOpenReceivable: we
|
|
63
|
+
}), U = de({
|
|
64
|
+
messages: k,
|
|
65
|
+
counterpartMessageLabels: me,
|
|
66
|
+
embeddedBankName: he,
|
|
67
|
+
onCreated: Ce
|
|
68
|
+
}), Te = a(() => {
|
|
69
|
+
E && U.openCreate("invoice");
|
|
70
|
+
}, [E, U.openCreate]), W = pe(!1);
|
|
71
|
+
o(() => {
|
|
72
|
+
W.current || f === "create" && E && (W.current = !0, U.openCreate("invoice", { customerId: d }));
|
|
88
73
|
}, [
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
s(() => {
|
|
94
|
-
J.current || h === "create" && O && (J.current = !0, q.openCreate("invoice", { customerId: m }));
|
|
95
|
-
}, [
|
|
96
|
-
O,
|
|
97
|
-
q.openCreate,
|
|
98
|
-
m,
|
|
99
|
-
h
|
|
74
|
+
E,
|
|
75
|
+
U.openCreate,
|
|
76
|
+
d,
|
|
77
|
+
f
|
|
100
78
|
]);
|
|
101
|
-
let
|
|
102
|
-
selectedReceivable:
|
|
103
|
-
selectedRecurrence:
|
|
104
|
-
messages:
|
|
105
|
-
onCreated:
|
|
79
|
+
let G = ce({
|
|
80
|
+
selectedReceivable: H.receivable,
|
|
81
|
+
selectedRecurrence: H.recurrence,
|
|
82
|
+
messages: k,
|
|
83
|
+
onCreated: Se,
|
|
106
84
|
onDeleted: (e) => {
|
|
107
|
-
e ===
|
|
85
|
+
e === M && (N(void 0), F(!1));
|
|
108
86
|
},
|
|
109
87
|
onCompleteBeforeIssue: (e) => {
|
|
110
|
-
|
|
88
|
+
U.openEdit(e, { highlightForIssue: !0 }), F(!1);
|
|
111
89
|
}
|
|
112
|
-
}),
|
|
113
|
-
|
|
114
|
-
|
|
90
|
+
}), K = x && !S.canWrite, q = U.open || U.counterpartView !== "none" || !!G.actionTarget || G.sendOpen || G.payment.isOpen || z.isOpen || I, J = U.close, Y = U.counterpartForm.close, { closeAction: X, closeSend: Z } = G, Q = G.payment.close, $ = z.close;
|
|
91
|
+
o(() => {
|
|
92
|
+
K && q && (J(), Y(), X(), Z(), Q(), $(), R());
|
|
115
93
|
}, [
|
|
116
|
-
|
|
94
|
+
X,
|
|
117
95
|
$,
|
|
96
|
+
Y,
|
|
97
|
+
J,
|
|
98
|
+
R,
|
|
118
99
|
Q,
|
|
119
|
-
je,
|
|
120
|
-
H,
|
|
121
|
-
Pe,
|
|
122
|
-
Ne,
|
|
123
100
|
Z,
|
|
124
|
-
|
|
101
|
+
q,
|
|
102
|
+
K
|
|
125
103
|
]);
|
|
126
|
-
let
|
|
127
|
-
ie() || (
|
|
128
|
-
}, [
|
|
129
|
-
|
|
130
|
-
}, []),
|
|
131
|
-
if (
|
|
132
|
-
let n = G.getReceivableById(t.id);
|
|
133
|
-
if (e === "edit") {
|
|
134
|
-
if (n) {
|
|
135
|
-
q.openEdit(n);
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
L(t.id), z(!0);
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
L(t.id), Y.openAction(e, t, n ?? null);
|
|
142
|
-
}, [
|
|
143
|
-
Y,
|
|
144
|
-
O,
|
|
145
|
-
q.openEdit,
|
|
146
|
-
G.getReceivableById
|
|
147
|
-
]), Re = o((e, t) => {
|
|
148
|
-
if (O) {
|
|
104
|
+
let Ee = a((e) => {
|
|
105
|
+
ie() || (N(e.id), F(!0), h?.(e.id, e.type));
|
|
106
|
+
}, [h]), De = a(() => {
|
|
107
|
+
F(!1), N(void 0);
|
|
108
|
+
}, []), Oe = a((e, t) => {
|
|
109
|
+
if (E) {
|
|
149
110
|
if (e === "edit") {
|
|
150
|
-
|
|
111
|
+
H.receivable && (U.openEdit(H.receivable), F(!1));
|
|
151
112
|
return;
|
|
152
113
|
}
|
|
153
|
-
|
|
114
|
+
G.openAction(e, {
|
|
154
115
|
id: t.id,
|
|
155
|
-
title:
|
|
116
|
+
title: H.receivable ? oe(H.receivable, k) : t.title,
|
|
156
117
|
type: t.type
|
|
157
|
-
},
|
|
118
|
+
}, H.receivable ?? null);
|
|
158
119
|
}
|
|
159
120
|
}, [
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
121
|
+
G,
|
|
122
|
+
E,
|
|
123
|
+
H.receivable,
|
|
124
|
+
U.openEdit,
|
|
125
|
+
k
|
|
165
126
|
]);
|
|
166
127
|
return {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
table: T ? G : {
|
|
174
|
-
...G,
|
|
128
|
+
canWrite: w,
|
|
129
|
+
canEditSettings: C && S.canEditSettings,
|
|
130
|
+
actionsSuspended: be,
|
|
131
|
+
isAccessRestricted: x && !S.canRead,
|
|
132
|
+
table: C ? V : {
|
|
133
|
+
...V,
|
|
175
134
|
rows: [],
|
|
176
135
|
statusCards: void 0,
|
|
177
136
|
isError: !1
|
|
178
137
|
},
|
|
179
|
-
isTableLoading:
|
|
180
|
-
isError:
|
|
181
|
-
onRetry:
|
|
182
|
-
details:
|
|
183
|
-
detailsOpen:
|
|
184
|
-
closeDetails:
|
|
138
|
+
isTableLoading: C ? V.isLoading || O && V.rows.length === 0 : O,
|
|
139
|
+
isError: D || C && V.isError,
|
|
140
|
+
onRetry: D ? y : V.onRetry,
|
|
141
|
+
details: H,
|
|
142
|
+
detailsOpen: P && C,
|
|
143
|
+
closeDetails: De,
|
|
185
144
|
form: {
|
|
186
|
-
...
|
|
187
|
-
open:
|
|
188
|
-
counterpartView:
|
|
145
|
+
...U,
|
|
146
|
+
open: w && U.open,
|
|
147
|
+
counterpartView: w ? U.counterpartView : "none",
|
|
189
148
|
counterpartForm: {
|
|
190
|
-
...
|
|
191
|
-
submit:
|
|
149
|
+
...U.counterpartForm,
|
|
150
|
+
submit: u(E, U.counterpartForm.submit)
|
|
192
151
|
},
|
|
193
|
-
submit:
|
|
194
|
-
submitDraft:
|
|
195
|
-
submitPrimary:
|
|
152
|
+
submit: u(E, U.submit),
|
|
153
|
+
submitDraft: u(E, U.submitDraft),
|
|
154
|
+
submitPrimary: u(E, U.submitPrimary)
|
|
196
155
|
},
|
|
197
|
-
openCreate:
|
|
198
|
-
measureUnitsOpen:
|
|
199
|
-
openMeasureUnits:
|
|
200
|
-
closeMeasureUnits:
|
|
156
|
+
openCreate: Te,
|
|
157
|
+
measureUnitsOpen: w && I,
|
|
158
|
+
openMeasureUnits: xe,
|
|
159
|
+
closeMeasureUnits: R,
|
|
201
160
|
actions: {
|
|
202
|
-
...
|
|
203
|
-
actionDialog:
|
|
204
|
-
sendOpen:
|
|
205
|
-
openAction:
|
|
206
|
-
confirmAction:
|
|
207
|
-
submitSend:
|
|
161
|
+
...G,
|
|
162
|
+
actionDialog: w ? G.actionDialog : void 0,
|
|
163
|
+
sendOpen: w && G.sendOpen,
|
|
164
|
+
openAction: u(E, G.openAction),
|
|
165
|
+
confirmAction: u(E, G.confirmAction),
|
|
166
|
+
submitSend: u(E, G.submitSend),
|
|
208
167
|
payment: {
|
|
209
|
-
...
|
|
210
|
-
isOpen:
|
|
211
|
-
save:
|
|
212
|
-
confirm:
|
|
168
|
+
...G.payment,
|
|
169
|
+
isOpen: w && G.payment.isOpen,
|
|
170
|
+
save: u(E, G.payment.save),
|
|
171
|
+
confirm: u(E, G.payment.confirm)
|
|
213
172
|
}
|
|
214
173
|
},
|
|
215
174
|
actionsModal: {
|
|
216
|
-
...
|
|
217
|
-
isOpen:
|
|
218
|
-
send:
|
|
219
|
-
saveItems:
|
|
175
|
+
...z,
|
|
176
|
+
isOpen: w && z.isOpen,
|
|
177
|
+
send: u(E, z.send),
|
|
178
|
+
saveItems: u(E, z.saveItems)
|
|
220
179
|
},
|
|
221
|
-
handleRowClick:
|
|
222
|
-
|
|
223
|
-
handleDetailsActionClick: Re
|
|
180
|
+
handleRowClick: Ee,
|
|
181
|
+
handleDetailsActionClick: Oe
|
|
224
182
|
};
|
|
225
183
|
}
|
|
226
|
-
function
|
|
184
|
+
function u(e, t) {
|
|
227
185
|
return (...n) => {
|
|
228
186
|
e && t(...n);
|
|
229
187
|
};
|
|
230
188
|
}
|
|
231
189
|
//#endregion
|
|
232
|
-
export {
|
|
190
|
+
export { l as useReceivablesWidget };
|
|
@@ -18,47 +18,28 @@ var r = {
|
|
|
18
18
|
deleted: "Deleted",
|
|
19
19
|
unknown: "Unknown"
|
|
20
20
|
}, i = { all: "All invoices" }, a = {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
statusFilterAll: "All statuses",
|
|
21
|
+
createInvoiceButton: "Create Invoice",
|
|
22
|
+
settingsButton: "Invoice settings",
|
|
23
|
+
bankAttributionPrefix: "Business Banking provided by",
|
|
25
24
|
statusCardsAll: i.all,
|
|
26
|
-
|
|
27
|
-
tabQuotes: "Quotes",
|
|
28
|
-
tabCreditNotes: "Credit notes",
|
|
29
|
-
columnDocument: "Document",
|
|
30
|
-
columnCustomer: "Customer",
|
|
25
|
+
columnDueDate: "Due date",
|
|
31
26
|
columnStatus: "Status",
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
sortByDocument: "Sort by document",
|
|
27
|
+
columnNumber: "Number",
|
|
28
|
+
columnCustomer: "Customer",
|
|
29
|
+
columnIssueDate: "Issue date",
|
|
30
|
+
columnAmount: "Amount",
|
|
31
|
+
openRow: (e) => `View invoice — ${e}`,
|
|
32
|
+
sortByDueDate: "Sort by due date",
|
|
39
33
|
sortByStatus: "Sort by status",
|
|
34
|
+
sortByNumber: "Sort by number",
|
|
40
35
|
sortByIssueDate: "Sort by issue date",
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
actionMarkUncollectible: "Mark uncollectible",
|
|
49
|
-
actionAccept: "Accept",
|
|
50
|
-
actionDecline: "Decline",
|
|
51
|
-
actionCancel: "Cancel",
|
|
52
|
-
actionClone: "Clone",
|
|
53
|
-
actionDelete: "Delete",
|
|
54
|
-
emptyTitle: "No receivables yet",
|
|
55
|
-
emptyDescription: "Create your first invoice or quote.",
|
|
56
|
-
emptyAction: "Create receivable",
|
|
57
|
-
filterEmptyTitle: "No receivables found",
|
|
58
|
-
filterEmptyDescription: "Try adjusting your search or filters.",
|
|
59
|
-
errorTitle: "Failed to load receivables",
|
|
60
|
-
errorDescription: "Something went wrong while fetching receivables. Please try again.",
|
|
61
|
-
errorRetry: "Try again",
|
|
36
|
+
sortByAmount: "Sort by amount",
|
|
37
|
+
emptyTitle: "No Invoices",
|
|
38
|
+
emptyDescription: "You don’t have any invoices yet.",
|
|
39
|
+
filterEmptyTitle: "No Invoices Found",
|
|
40
|
+
errorTitle: "Failed to load Invoices",
|
|
41
|
+
errorDescription: "There was an error loading invoices.",
|
|
42
|
+
errorRetry: "Reload",
|
|
62
43
|
accessRestrictedTitle: "Access Restricted",
|
|
63
44
|
accessRestrictedDescription: "You don’t have permissions to view this page. Contact your system administrator for details.",
|
|
64
45
|
statusBadge: r
|