@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
|
@@ -6,7 +6,7 @@ import { useMyEntityQuery as e } from "../../../../../shared/data-access/dist/li
|
|
|
6
6
|
import "../../../../../shared/data-access/dist/index.js";
|
|
7
7
|
import { useCounterpartQuery as t } from "../../../../../shared/counterpart-management/data-access/dist/index3.js";
|
|
8
8
|
import "../../../../../shared/counterpart-management/feature/dist/index.js";
|
|
9
|
-
import { useReceivableRequiredFieldsQuery as n } from "../../../../data-access/dist/
|
|
9
|
+
import { useReceivableRequiredFieldsQuery as n } from "../../../../data-access/dist/index15.js";
|
|
10
10
|
import "../../../../data-access/dist/index.js";
|
|
11
11
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableIssuePreflight.js
|
|
12
12
|
function r({ counterpartId: r, billingAddressId: i, billingCountry: a, inlineCustomerType: o, checkRequiredFields: s = !0 }) {
|
|
@@ -8,7 +8,7 @@ import { usePaymentTermsQuery as n } from "../../../../../shared/data-access/dis
|
|
|
8
8
|
import "../../../../../shared/ui/dist/index.js";
|
|
9
9
|
import { useWidgetConfig as r } from "../../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
10
10
|
import "../../../../../shared/feature/dist/index.js";
|
|
11
|
-
import { useCreateOverdueReminderMutation as i, useCreatePaymentReminderMutation as a, useOverdueRemindersQuery as o, usePaymentRemindersQuery as s } from "../../../../data-access/dist/
|
|
11
|
+
import { useCreateOverdueReminderMutation as i, useCreatePaymentReminderMutation as a, useOverdueRemindersQuery as o, usePaymentRemindersQuery as s } from "../../../../data-access/dist/index16.js";
|
|
12
12
|
import "../../../../data-access/dist/index.js";
|
|
13
13
|
import { areOverdueTermsValid as c, buildOverdueReminderPayload as l, buildPaymentReminderPayload as u, buildRemindersView as d, canCreateReminders as f, getImpliedDueDate as p, isBeforeDueDaysValid as m, sanitizeReminderDays as h } from "./reminders.js";
|
|
14
14
|
import { useCallback as g, useMemo as _, useState as v } from "react";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import { useReceivablesAnalyticsQuery as e } from "../../../../data-access/dist/
|
|
5
|
+
import { useReceivablesAnalyticsQuery as e } from "../../../../data-access/dist/index17.js";
|
|
6
6
|
import "../../../../data-access/dist/index.js";
|
|
7
7
|
import { buildReceivableStatusCardsView as t } from "./statusCards.js";
|
|
8
8
|
import { useMemo as n } from "react";
|
|
@@ -2,87 +2,104 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import { useReceivablesQuery as e } from "../../../../data-access/dist/
|
|
5
|
+
import { useReceivablesQuery as e } from "../../../../data-access/dist/index15.js";
|
|
6
|
+
import { useRecurrencesByIdQueries as t } from "../../../../data-access/dist/index16.js";
|
|
6
7
|
import "../../../../data-access/dist/index.js";
|
|
7
|
-
import { buildReceivableRows as
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
8
|
+
import { buildReceivableRows as n } from "./helpers.js";
|
|
9
|
+
import { buildSeriesStatusChipView as r } from "./details.js";
|
|
10
|
+
import { useInvoicesFilter as i } from "./useInvoicesFilter.js";
|
|
11
|
+
import { useReceivableCustomerNames as a } from "./useReceivableCustomerNames.js";
|
|
12
|
+
import { useReceivableStatusCards as o } from "./useReceivableStatusCards.js";
|
|
13
|
+
import { useUtcDayStart as s } from "./useUtcDayStart.js";
|
|
14
|
+
import { useCallback as c, useEffect as l, useMemo as u, useState as d } from "react";
|
|
12
15
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesTable.js
|
|
13
|
-
var
|
|
16
|
+
var f = [], p = [{
|
|
14
17
|
id: "dueDateLabel",
|
|
15
18
|
desc: !0
|
|
16
19
|
}];
|
|
17
|
-
function
|
|
18
|
-
let [
|
|
19
|
-
initialCounterpartId:
|
|
20
|
-
search:
|
|
21
|
-
onSearchChange:
|
|
22
|
-
onFiltersChange:
|
|
23
|
-
statusLabels:
|
|
24
|
-
labels:
|
|
20
|
+
function m({ initialCounterpartId: m, messages: g, statusLabels: _, filterLabels: v, pageSizeOptions: y, enabled: b = !0, visible: x = b }) {
|
|
21
|
+
let [S, C] = d(p), [w, T] = d(y?.[0] ?? 10), [E, D] = d(), [O, k] = d(""), [A, j] = d(""), M = c(() => D(void 0), []), N = i({
|
|
22
|
+
initialCounterpartId: m,
|
|
23
|
+
search: O,
|
|
24
|
+
onSearchChange: k,
|
|
25
|
+
onFiltersChange: M,
|
|
26
|
+
statusLabels: _,
|
|
27
|
+
labels: v
|
|
25
28
|
});
|
|
26
|
-
|
|
29
|
+
l(() => {
|
|
27
30
|
let e = setTimeout(() => {
|
|
28
|
-
O
|
|
31
|
+
j(O), M();
|
|
29
32
|
}, 300);
|
|
30
33
|
return () => clearTimeout(e);
|
|
31
|
-
}, [
|
|
32
|
-
let
|
|
33
|
-
enabled:
|
|
34
|
+
}, [M, O]);
|
|
35
|
+
let P = S[0]?.id, F = P ? h[P] : void 0, I = S[0] ? S[0].desc ? "desc" : "asc" : void 0, L = e({
|
|
36
|
+
enabled: b,
|
|
34
37
|
type: "invoice",
|
|
35
|
-
limit:
|
|
36
|
-
pagination_token:
|
|
37
|
-
search_text:
|
|
38
|
-
...
|
|
39
|
-
...
|
|
40
|
-
sort:
|
|
41
|
-
order:
|
|
38
|
+
limit: w,
|
|
39
|
+
pagination_token: E,
|
|
40
|
+
search_text: A || void 0,
|
|
41
|
+
...N.query,
|
|
42
|
+
...F ? {
|
|
43
|
+
sort: F,
|
|
44
|
+
order: I
|
|
42
45
|
} : {}
|
|
43
|
-
}),
|
|
44
|
-
enabled:
|
|
45
|
-
visible:
|
|
46
|
-
statusFilter:
|
|
47
|
-
messages:
|
|
48
|
-
statusLabels:
|
|
49
|
-
}),
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
}), R = o({
|
|
47
|
+
enabled: b,
|
|
48
|
+
visible: x,
|
|
49
|
+
statusFilter: N.cardStatus,
|
|
50
|
+
messages: g,
|
|
51
|
+
statusLabels: _
|
|
52
|
+
}), z = L.data?.data ?? f, B = u(() => new Map(z.map((e) => [e.id, e])), [z]), V = c((e) => B.get(e), [B]), H = a(z), U = u(() => [...new Set(z.flatMap((e) => e.type === "invoice" && e.status === "recurring" && e.recurrence_id ? [e.recurrence_id] : []))], [z]), W = t(U, { enabled: b }), G = u(() => new Map(U.map((e, t) => {
|
|
53
|
+
let n = W[t], i = n?.data?.status;
|
|
54
|
+
return [e, {
|
|
55
|
+
status: i ? r(i, g) : void 0,
|
|
56
|
+
isLoading: n?.isLoading ?? !1
|
|
57
|
+
}];
|
|
58
|
+
})), [
|
|
59
|
+
g,
|
|
60
|
+
U,
|
|
61
|
+
W
|
|
62
|
+
]), K = s(), q = u(() => n({
|
|
63
|
+
receivables: z,
|
|
64
|
+
messages: g,
|
|
65
|
+
customerNames: H,
|
|
66
|
+
seriesStatuses: G,
|
|
67
|
+
now: new Date(K)
|
|
53
68
|
}), [
|
|
69
|
+
H,
|
|
70
|
+
g,
|
|
54
71
|
z,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
]),
|
|
58
|
-
let t = typeof e == "function" ? e(
|
|
59
|
-
|
|
60
|
-
}, [
|
|
61
|
-
|
|
62
|
-
}, []),
|
|
63
|
-
|
|
64
|
-
}, [
|
|
72
|
+
G,
|
|
73
|
+
K
|
|
74
|
+
]), J = c((e) => {
|
|
75
|
+
let t = typeof e == "function" ? e(S) : e;
|
|
76
|
+
C(t[0] && Object.hasOwn(h, t[0].id) ? t : p), M();
|
|
77
|
+
}, [M, S]), Y = c((e) => {
|
|
78
|
+
T(e), M();
|
|
79
|
+
}, [M]), X = c(() => D(L.data?.next_pagination_token ?? void 0), [L.data?.next_pagination_token]), Z = c(() => D(L.data?.prev_pagination_token ?? void 0), [L.data?.prev_pagination_token]), Q = c(() => {
|
|
80
|
+
L.refetch();
|
|
81
|
+
}, [L]);
|
|
65
82
|
return {
|
|
66
|
-
rows:
|
|
67
|
-
isLoading:
|
|
68
|
-
isError:
|
|
69
|
-
sorting:
|
|
70
|
-
onSortingChange:
|
|
71
|
-
pageSize:
|
|
72
|
-
onPageSizeChange:
|
|
73
|
-
hasNextPage: !!
|
|
74
|
-
hasPrevPage: !!
|
|
75
|
-
onNextPage:
|
|
76
|
-
onPrevPage:
|
|
77
|
-
statusCards:
|
|
78
|
-
onStatusCardSelect:
|
|
79
|
-
filterBar:
|
|
80
|
-
isFiltering:
|
|
81
|
-
onRetry:
|
|
82
|
-
getReceivableById:
|
|
83
|
+
rows: q,
|
|
84
|
+
isLoading: L.isLoading,
|
|
85
|
+
isError: L.isError,
|
|
86
|
+
sorting: S,
|
|
87
|
+
onSortingChange: J,
|
|
88
|
+
pageSize: w,
|
|
89
|
+
onPageSizeChange: Y,
|
|
90
|
+
hasNextPage: !!L.data?.next_pagination_token,
|
|
91
|
+
hasPrevPage: !!L.data?.prev_pagination_token,
|
|
92
|
+
onNextPage: X,
|
|
93
|
+
onPrevPage: Z,
|
|
94
|
+
statusCards: R,
|
|
95
|
+
onStatusCardSelect: N.selectStatusCard,
|
|
96
|
+
filterBar: N.filterBar,
|
|
97
|
+
isFiltering: N.isFiltering,
|
|
98
|
+
onRetry: Q,
|
|
99
|
+
getReceivableById: V
|
|
83
100
|
};
|
|
84
101
|
}
|
|
85
|
-
var
|
|
102
|
+
var h = {
|
|
86
103
|
documentLabel: "document_id",
|
|
87
104
|
status: "status",
|
|
88
105
|
issueDateLabel: "issue_date",
|
|
@@ -90,4 +107,4 @@ var f = {
|
|
|
90
107
|
totalLabel: "total_amount"
|
|
91
108
|
};
|
|
92
109
|
//#endregion
|
|
93
|
-
export {
|
|
110
|
+
export { m as useReceivablesTable };
|
|
@@ -24,53 +24,53 @@ import { useReceivableForm as pe } from "./useReceivableForm.js";
|
|
|
24
24
|
import { useReceivablesTable as me } from "./useReceivablesTable.js";
|
|
25
25
|
import { useCallback as a, useEffect as o, useMemo as s, useRef as c, useState as l } from "react";
|
|
26
26
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesWidget.js
|
|
27
|
-
function
|
|
28
|
-
let
|
|
27
|
+
function u({ auditHistoryLabels: u, counterpartMessageLabels: he, embeddedBankName: ge, filterLabels: _e, initialCounterpartId: f, initialView: p, messageLabels: m, onReceivableCreated: h, onReceivableOpened: g, pageSizeOptions: ve, screenLabels: ye }) {
|
|
28
|
+
let _ = n();
|
|
29
29
|
o(() => {
|
|
30
|
-
|
|
31
|
-
}, [
|
|
32
|
-
let { initResponse:
|
|
30
|
+
_(re.Mounted);
|
|
31
|
+
}, [_]);
|
|
32
|
+
let { initResponse: v, widgetToken: be } = i(), y = ne(), xe = ee(), Se = r(), b = te(), x = !!v && !b, S = s(() => le(v?.scopes), [v?.scopes]), Ce = !!v && b, C = !!v && S.canRead, w = !!v && S.canWrite, T = x && S.canRead, E = x && S.canWrite, D = !!xe && !x && !y, O = !x && !D && !!(be || y), k = s(() => ({
|
|
33
33
|
...ce,
|
|
34
|
-
...
|
|
35
|
-
}), [
|
|
34
|
+
...m
|
|
35
|
+
}), [m]), A = ye?.statusBadge, j = s(() => ({
|
|
36
36
|
...ie,
|
|
37
|
-
...
|
|
38
|
-
}), [
|
|
39
|
-
|
|
40
|
-
let [
|
|
41
|
-
|
|
42
|
-
}, [
|
|
37
|
+
...A
|
|
38
|
+
}), [A]), [M, N] = l(), [P, F] = l(!1), [I, we] = l(M);
|
|
39
|
+
M && M !== I && we(M);
|
|
40
|
+
let [L, R] = l(!1), [Te, z] = l(), B = e(v?.scopes, [t.CounterpartReadOrg]), Ee = a(() => z(void 0), []), [V, H] = l(!1), De = a(() => H(!0), []), U = a(() => H(!1), []), Oe = a((e) => {
|
|
41
|
+
N(e), F(!0);
|
|
42
|
+
}, []), W = de({ messages: k }), G = W.open, ke = a((e, t, n) => {
|
|
43
43
|
let r = oe(n);
|
|
44
|
-
r.openDetails && (
|
|
44
|
+
r.openDetails && (N(e), F(!0)), r.actionsModal && G({
|
|
45
45
|
action: n.mode,
|
|
46
46
|
receivableId: e,
|
|
47
47
|
documentType: t,
|
|
48
48
|
counterpartId: n.counterpartId,
|
|
49
49
|
inlineItems: n.inlineItems,
|
|
50
50
|
showEmailStep: r.actionsModal.showEmailStep
|
|
51
|
-
}),
|
|
52
|
-
}, [
|
|
53
|
-
initialCounterpartId:
|
|
54
|
-
messages:
|
|
55
|
-
statusLabels:
|
|
56
|
-
filterLabels:
|
|
57
|
-
pageSizeOptions:
|
|
58
|
-
enabled:
|
|
59
|
-
visible:
|
|
60
|
-
}),
|
|
61
|
-
|
|
62
|
-
}, [
|
|
63
|
-
selectedReceivableId:
|
|
64
|
-
enabled:
|
|
65
|
-
canWrite:
|
|
66
|
-
messages:
|
|
67
|
-
statusLabels:
|
|
68
|
-
auditHistoryLabels:
|
|
69
|
-
onOpenReceivable:
|
|
70
|
-
onOpenCustomer:
|
|
71
|
-
}),
|
|
72
|
-
let r = n.mode === "issue", i = r &&
|
|
73
|
-
(i || n.inlineItems.length !== 0) &&
|
|
51
|
+
}), h?.(e, t);
|
|
52
|
+
}, [h, G]), K = me({
|
|
53
|
+
initialCounterpartId: p === "create" ? void 0 : f,
|
|
54
|
+
messages: k,
|
|
55
|
+
statusLabels: j,
|
|
56
|
+
filterLabels: _e,
|
|
57
|
+
pageSizeOptions: ve,
|
|
58
|
+
enabled: T,
|
|
59
|
+
visible: C
|
|
60
|
+
}), Ae = a((e) => {
|
|
61
|
+
N(e), F(!0), g?.(e, "invoice");
|
|
62
|
+
}, [g]), q = fe({
|
|
63
|
+
selectedReceivableId: M,
|
|
64
|
+
enabled: P && T,
|
|
65
|
+
canWrite: w,
|
|
66
|
+
messages: k,
|
|
67
|
+
statusLabels: j,
|
|
68
|
+
auditHistoryLabels: u,
|
|
69
|
+
onOpenReceivable: Ae,
|
|
70
|
+
onOpenCustomer: B ? z : void 0
|
|
71
|
+
}), J = c("edit"), je = a((e, t, n) => {
|
|
72
|
+
let r = n.mode === "issue", i = r && J.current !== "issue" && n.hasCustomerEmail;
|
|
73
|
+
(i || n.inlineItems.length !== 0) && G({
|
|
74
74
|
action: r || n.mode === "recurrence" ? n.mode : "update",
|
|
75
75
|
receivableId: e,
|
|
76
76
|
documentType: t,
|
|
@@ -78,36 +78,36 @@ function he({ auditHistoryLabels: he, counterpartMessageLabels: ge, embeddedBank
|
|
|
78
78
|
inlineItems: n.inlineItems,
|
|
79
79
|
showEmailStep: i
|
|
80
80
|
});
|
|
81
|
-
}, [
|
|
82
|
-
messages:
|
|
83
|
-
counterpartMessageLabels:
|
|
84
|
-
embeddedBankName:
|
|
85
|
-
canCreateCustomer:
|
|
86
|
-
onCreated:
|
|
87
|
-
onUpdated:
|
|
88
|
-
}),
|
|
89
|
-
|
|
90
|
-
}, [
|
|
81
|
+
}, [G]), Y = pe({
|
|
82
|
+
messages: k,
|
|
83
|
+
counterpartMessageLabels: he,
|
|
84
|
+
embeddedBankName: ge,
|
|
85
|
+
canCreateCustomer: S.canCreateCustomer,
|
|
86
|
+
onCreated: ke,
|
|
87
|
+
onUpdated: je
|
|
88
|
+
}), Me = a(() => {
|
|
89
|
+
E && Y.openCreate("invoice");
|
|
90
|
+
}, [E, Y.openCreate]), X = c(!1);
|
|
91
91
|
o(() => {
|
|
92
|
-
|
|
92
|
+
X.current || p === "create" && E && (X.current = !0, Y.openCreate("invoice", { customerId: f }));
|
|
93
93
|
}, [
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
94
|
+
E,
|
|
95
|
+
Y.openCreate,
|
|
96
|
+
f,
|
|
97
|
+
p
|
|
98
98
|
]);
|
|
99
|
-
let
|
|
100
|
-
selectedReceivable:
|
|
101
|
-
selectedRecurrence:
|
|
102
|
-
messages:
|
|
103
|
-
onCreated:
|
|
99
|
+
let Z = ue({
|
|
100
|
+
selectedReceivable: q.receivable,
|
|
101
|
+
selectedRecurrence: q.recurrence,
|
|
102
|
+
messages: k,
|
|
103
|
+
onCreated: Oe,
|
|
104
104
|
onDeleted: (e) => {
|
|
105
|
-
e ===
|
|
105
|
+
e === M && (N(void 0), F(!1));
|
|
106
106
|
},
|
|
107
107
|
onCompleteBeforeIssue: (e, t) => {
|
|
108
|
-
|
|
108
|
+
J.current = t, Y.openEdit(e, { highlightForIssue: !0 }), P && R(!0), F(!1);
|
|
109
109
|
},
|
|
110
|
-
onIssuedForSend: (e, t) =>
|
|
110
|
+
onIssuedForSend: (e, t) => G({
|
|
111
111
|
action: "issue",
|
|
112
112
|
receivableId: e,
|
|
113
113
|
documentType: "invoice",
|
|
@@ -115,7 +115,7 @@ function he({ auditHistoryLabels: he, counterpartMessageLabels: ge, embeddedBank
|
|
|
115
115
|
inlineItems: [],
|
|
116
116
|
showEmailStep: !0
|
|
117
117
|
}),
|
|
118
|
-
onResend: (e, t) =>
|
|
118
|
+
onResend: (e, t) => G({
|
|
119
119
|
action: "issue",
|
|
120
120
|
receivableId: e,
|
|
121
121
|
documentType: "invoice",
|
|
@@ -126,111 +126,115 @@ function he({ auditHistoryLabels: he, counterpartMessageLabels: ge, embeddedBank
|
|
|
126
126
|
})
|
|
127
127
|
});
|
|
128
128
|
o(() => {
|
|
129
|
-
|
|
130
|
-
}, [
|
|
131
|
-
|
|
132
|
-
}, [
|
|
133
|
-
|
|
129
|
+
Y.open || (J.current = "edit");
|
|
130
|
+
}, [Y.open]), o(() => {
|
|
131
|
+
Y.open || W.isOpen || !L || (R(!1), F(!0));
|
|
132
|
+
}, [
|
|
133
|
+
W.isOpen,
|
|
134
|
+
Y.open,
|
|
135
|
+
L
|
|
136
|
+
]);
|
|
137
|
+
let Q = x && !S.canWrite, $ = Y.open || Y.counterpartView !== "none" || !!Z.actionTarget || Z.payment.isOpen || W.isOpen || V, Ne = Y.close, Pe = Y.counterpartForm.close, { closeAction: Fe } = Z, Ie = Z.payment.close, Le = W.close;
|
|
134
138
|
o(() => {
|
|
135
|
-
|
|
139
|
+
Q && $ && (Ne(), Pe(), Fe(), Ie(), Le(), U());
|
|
136
140
|
}, [
|
|
137
|
-
Ie,
|
|
138
|
-
$,
|
|
139
141
|
Fe,
|
|
140
|
-
Pe,
|
|
141
|
-
H,
|
|
142
142
|
Le,
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
Pe,
|
|
144
|
+
Ne,
|
|
145
|
+
U,
|
|
146
|
+
Ie,
|
|
147
|
+
$,
|
|
148
|
+
Q
|
|
145
149
|
]);
|
|
146
150
|
let Re = a((e) => {
|
|
147
|
-
ae() || (
|
|
148
|
-
}, [
|
|
149
|
-
|
|
151
|
+
ae() || (N(e.id), F(!0), g?.(e.id, e.type));
|
|
152
|
+
}, [g]), ze = a(() => {
|
|
153
|
+
F(!1), N(void 0), z(void 0);
|
|
150
154
|
}, []), Be = a((e, t) => {
|
|
151
|
-
if (
|
|
155
|
+
if (E) {
|
|
152
156
|
if (e === "edit") {
|
|
153
|
-
|
|
157
|
+
q.receivable && (J.current = "edit", Y.openEdit(q.receivable), R(!0), F(!1));
|
|
154
158
|
return;
|
|
155
159
|
}
|
|
156
|
-
|
|
160
|
+
Z.openAction(e, {
|
|
157
161
|
id: t.id,
|
|
158
|
-
title:
|
|
162
|
+
title: q.receivable ? se(q.receivable, k) : t.title,
|
|
159
163
|
type: t.type
|
|
160
|
-
},
|
|
164
|
+
}, q.receivable ?? null);
|
|
161
165
|
}
|
|
162
166
|
}, [
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
167
|
+
Z,
|
|
168
|
+
E,
|
|
169
|
+
q.receivable,
|
|
170
|
+
Y.openEdit,
|
|
171
|
+
k
|
|
168
172
|
]);
|
|
169
173
|
return {
|
|
170
|
-
canWrite:
|
|
171
|
-
canEditSettings:
|
|
172
|
-
actionsSuspended:
|
|
173
|
-
isAccessRestricted:
|
|
174
|
-
table:
|
|
175
|
-
...
|
|
174
|
+
canWrite: w,
|
|
175
|
+
canEditSettings: C && S.canEditSettings,
|
|
176
|
+
actionsSuspended: Ce,
|
|
177
|
+
isAccessRestricted: x && !S.canRead,
|
|
178
|
+
table: C ? K : {
|
|
179
|
+
...K,
|
|
176
180
|
rows: [],
|
|
177
181
|
statusCards: void 0,
|
|
178
182
|
isError: !1
|
|
179
183
|
},
|
|
180
|
-
isTableLoading:
|
|
181
|
-
isError:
|
|
182
|
-
onRetry:
|
|
183
|
-
details:
|
|
184
|
-
detailsOpen:
|
|
184
|
+
isTableLoading: C ? K.isLoading || O && K.rows.length === 0 : O,
|
|
185
|
+
isError: D || C && K.isError,
|
|
186
|
+
onRetry: D ? Se : K.onRetry,
|
|
187
|
+
details: q,
|
|
188
|
+
detailsOpen: P && C,
|
|
185
189
|
closeDetails: ze,
|
|
186
|
-
detailsPanelKey:
|
|
187
|
-
customerDetailsId:
|
|
188
|
-
closeCustomerDetails:
|
|
189
|
-
openCustomerDetails:
|
|
190
|
-
canCreateCustomer:
|
|
191
|
-
messages:
|
|
190
|
+
detailsPanelKey: I,
|
|
191
|
+
customerDetailsId: Te,
|
|
192
|
+
closeCustomerDetails: Ee,
|
|
193
|
+
openCustomerDetails: B ? z : void 0,
|
|
194
|
+
canCreateCustomer: S.canCreateCustomer,
|
|
195
|
+
messages: k,
|
|
192
196
|
form: {
|
|
193
|
-
...
|
|
194
|
-
open:
|
|
195
|
-
counterpartView:
|
|
197
|
+
...Y,
|
|
198
|
+
open: w && Y.open,
|
|
199
|
+
counterpartView: w ? Y.counterpartView : "none",
|
|
196
200
|
counterpartForm: {
|
|
197
|
-
...
|
|
198
|
-
submit:
|
|
201
|
+
...Y.counterpartForm,
|
|
202
|
+
submit: d(E, Y.counterpartForm.submit)
|
|
199
203
|
},
|
|
200
|
-
submit:
|
|
201
|
-
submitDraft:
|
|
202
|
-
submitPrimary:
|
|
204
|
+
submit: d(E, Y.submit),
|
|
205
|
+
submitDraft: d(E, Y.submitDraft),
|
|
206
|
+
submitPrimary: d(E, Y.submitPrimary)
|
|
203
207
|
},
|
|
204
|
-
openCreate:
|
|
205
|
-
measureUnitsOpen:
|
|
206
|
-
openMeasureUnits:
|
|
207
|
-
closeMeasureUnits:
|
|
208
|
+
openCreate: Me,
|
|
209
|
+
measureUnitsOpen: w && V,
|
|
210
|
+
openMeasureUnits: De,
|
|
211
|
+
closeMeasureUnits: U,
|
|
208
212
|
actions: {
|
|
209
|
-
...
|
|
210
|
-
actionDialog:
|
|
211
|
-
openAction:
|
|
212
|
-
confirmAction:
|
|
213
|
+
...Z,
|
|
214
|
+
actionDialog: w ? Z.actionDialog : void 0,
|
|
215
|
+
openAction: d(E, Z.openAction),
|
|
216
|
+
confirmAction: d(E, Z.confirmAction),
|
|
213
217
|
payment: {
|
|
214
|
-
...
|
|
215
|
-
isOpen:
|
|
216
|
-
save:
|
|
217
|
-
confirm:
|
|
218
|
+
...Z.payment,
|
|
219
|
+
isOpen: w && Z.payment.isOpen,
|
|
220
|
+
save: d(E, Z.payment.save),
|
|
221
|
+
confirm: d(E, Z.payment.confirm)
|
|
218
222
|
}
|
|
219
223
|
},
|
|
220
224
|
actionsModal: {
|
|
221
|
-
...
|
|
222
|
-
isOpen:
|
|
223
|
-
send:
|
|
224
|
-
saveItems:
|
|
225
|
+
...W,
|
|
226
|
+
isOpen: w && W.isOpen,
|
|
227
|
+
send: d(E, W.send),
|
|
228
|
+
saveItems: d(E, W.saveItems)
|
|
225
229
|
},
|
|
226
230
|
handleRowClick: Re,
|
|
227
231
|
handleDetailsActionClick: Be
|
|
228
232
|
};
|
|
229
233
|
}
|
|
230
|
-
function
|
|
234
|
+
function d(e, t) {
|
|
231
235
|
return (...n) => {
|
|
232
236
|
e && t(...n);
|
|
233
237
|
};
|
|
234
238
|
}
|
|
235
239
|
//#endregion
|
|
236
|
-
export {
|
|
240
|
+
export { u as useReceivablesWidget };
|
|
@@ -15,40 +15,44 @@ import { useCreatePaymentLinkMutation as o } from "../../../../data-access/dist/
|
|
|
15
15
|
import { useSendReceivableEmailMutation as s } from "../../../../data-access/dist/index10.js";
|
|
16
16
|
import "../../../../data-access/dist/index.js";
|
|
17
17
|
import { getReceivePaymentMethods as c } from "./preview.js";
|
|
18
|
-
import { useCallback as l } from "react";
|
|
18
|
+
import { useCallback as l, useEffect as u, useRef as d } from "react";
|
|
19
19
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useSendReceivableWithPaymentLink.js
|
|
20
|
-
function
|
|
21
|
-
let { initResponse:
|
|
22
|
-
entityId:
|
|
23
|
-
enabled:
|
|
24
|
-
}),
|
|
20
|
+
function f({ messages: f, documentType: p }) {
|
|
21
|
+
let { initResponse: m } = i(), h = p === "invoice", g = t(m?.scopes, [r.PaymentLinkWrite]), _ = h && g, v = n({ enabled: _ }), y = v.data?.id, b = a({
|
|
22
|
+
entityId: y,
|
|
23
|
+
enabled: _
|
|
24
|
+
}), x = o(), S = s(), C = v.error || b.error ? void 0 : b.data?.data, w = d(void 0);
|
|
25
|
+
u(() => {
|
|
26
|
+
p || (w.current = void 0);
|
|
27
|
+
}, [p]);
|
|
28
|
+
let T = x.mutateAsync, E = S.mutateAsync, D = f.actionsSendWithoutPaymentLink, O = f.actionsSendWithoutPaymentLinkScope;
|
|
25
29
|
return {
|
|
26
30
|
send: l(async (t) => {
|
|
27
|
-
if (!
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return n.length === 0 ? e.error(C) : await x({ body: {
|
|
31
|
+
if (!_) return h && e.error(O), E(t);
|
|
32
|
+
let n = t.path.receivable_id, r = c(C);
|
|
33
|
+
return !y || r.length === 0 ? e.error(D) : w.current !== n && (await T({ body: {
|
|
31
34
|
recipient: {
|
|
32
|
-
id:
|
|
35
|
+
id: y,
|
|
33
36
|
type: "entity"
|
|
34
37
|
},
|
|
35
|
-
payment_methods:
|
|
38
|
+
payment_methods: r.map((e) => e.type),
|
|
36
39
|
object: {
|
|
37
|
-
id:
|
|
40
|
+
id: n,
|
|
38
41
|
type: "receivable"
|
|
39
42
|
}
|
|
40
|
-
} }),
|
|
43
|
+
} }), w.current = n), E(t);
|
|
41
44
|
}, [
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
h,
|
|
45
|
-
b,
|
|
45
|
+
_,
|
|
46
|
+
T,
|
|
46
47
|
y,
|
|
47
|
-
|
|
48
|
-
C
|
|
48
|
+
h,
|
|
49
|
+
C,
|
|
50
|
+
O,
|
|
51
|
+
E,
|
|
52
|
+
D
|
|
49
53
|
]),
|
|
50
|
-
isPending:
|
|
54
|
+
isPending: _ && (v.isFetching || b.isFetching) || x.isPending || S.isPending
|
|
51
55
|
};
|
|
52
56
|
}
|
|
53
57
|
//#endregion
|
|
54
|
-
export {
|
|
58
|
+
export { f as useSendReceivableWithPaymentLink };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import { useEffect as e, useState as t } from "react";
|
|
6
|
+
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useUtcDayStart.js
|
|
7
|
+
var n = 864e5, r = (e) => e - e % n;
|
|
8
|
+
function i() {
|
|
9
|
+
let [i, a] = t(() => r(Date.now()));
|
|
10
|
+
return e(() => {
|
|
11
|
+
let e = setTimeout(() => a(r(Date.now())), Math.max(i + n - Date.now(), 0));
|
|
12
|
+
return () => clearTimeout(e);
|
|
13
|
+
}, [i]), i;
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { i as useUtcDayStart };
|