@tesouro/embedded-components-react 0.5.206 → 0.5.210
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 +40 -0
- package/dist/index.js +1 -1
- package/dist/lib/ReceivablesWidget.d.ts +40 -0
- package/dist/lib/ReceivablesWidget.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index10.js +84 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index2.js +31 -25
- 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 +22 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index11.js +151 -187
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index12.js +202 -31
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index13.js +32 -145
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index14.js +145 -37
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index15.js +42 -58
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index16.js +58 -96
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index17.js +96 -47
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index18.js +103 -318
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index19.js +47 -70
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index20.js +350 -100
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index21.js +68 -263
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index22.js +115 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index23.js +285 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index9.js +10 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +4 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index23.js +11 -10
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index25.js +234 -78
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index26.js +80 -331
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index27.js +344 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index3.js +14 -1
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index.js +7 -8
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index2.js +11 -10
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index3.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index4.js +12 -24
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index5.js +36 -14
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index6.js +16 -21
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/data-access/dist/index7.js +6 -7
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index10.js +23 -22
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index7.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index8.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/index.js +11 -11
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +40 -39
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/queryKeys.js +8 -4
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +220 -198
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +124 -84
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/useMyEntityQuery.js +25 -0
- 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/settings-widget/invoice-settings/data-access/dist/index8.js +0 -34
package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index13.js
CHANGED
|
@@ -2,154 +2,41 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { buildReceivableDetailsView as e } from "./index9.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/index13.js
|
|
10
|
-
function
|
|
11
|
-
let
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
let n = x.current, r = () => S.current || x.current !== n;
|
|
35
|
-
try {
|
|
36
|
-
let n = await d({
|
|
37
|
-
file: t,
|
|
38
|
-
receivableId: u
|
|
39
|
-
});
|
|
40
|
-
if (r() || v.current.delete(e)) {
|
|
41
|
-
f({
|
|
42
|
-
path: { file_id: n.id },
|
|
43
|
-
receivableId: u
|
|
44
|
-
});
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
y.current.add(n.id), m((t) => t.filter((t) => t.id !== e)), l((e) => [...e, {
|
|
48
|
-
id: n.id,
|
|
49
|
-
includeInEmail: !0,
|
|
50
|
-
name: n.name,
|
|
51
|
-
size: n.size
|
|
52
|
-
}]);
|
|
53
|
-
} catch {
|
|
54
|
-
let t = v.current.delete(e);
|
|
55
|
-
if (r() || t) return;
|
|
56
|
-
m((t) => t.map((t) => t.id === e ? {
|
|
57
|
-
...t,
|
|
58
|
-
status: "upload_failed"
|
|
59
|
-
} : t));
|
|
60
|
-
}
|
|
61
|
-
}, [
|
|
62
|
-
f,
|
|
63
|
-
u,
|
|
64
|
-
l,
|
|
65
|
-
d
|
|
66
|
-
]), T = i((n) => {
|
|
67
|
-
let r = e(n);
|
|
68
|
-
if (r.length === 0) return;
|
|
69
|
-
let i = p.filter((e) => e.status === "uploading").length, a = 10 - c.length - i, o = [], s = !1;
|
|
70
|
-
for (let e of r) {
|
|
71
|
-
_.current += 1;
|
|
72
|
-
let n = `pending-attachment-${_.current}`, r = t(e);
|
|
73
|
-
if (r) {
|
|
74
|
-
o.push({
|
|
75
|
-
id: n,
|
|
76
|
-
name: e.name,
|
|
77
|
-
status: r
|
|
78
|
-
});
|
|
79
|
-
continue;
|
|
80
|
-
}
|
|
81
|
-
if (a <= 0) {
|
|
82
|
-
s = !0;
|
|
83
|
-
continue;
|
|
84
|
-
}
|
|
85
|
-
--a, o.push({
|
|
86
|
-
id: n,
|
|
87
|
-
name: e.name,
|
|
88
|
-
status: "uploading"
|
|
89
|
-
}), w(n, e);
|
|
90
|
-
}
|
|
91
|
-
o.length > 0 && m((e) => [...e, ...o]), g(s);
|
|
92
|
-
}, [
|
|
93
|
-
c.length,
|
|
94
|
-
p,
|
|
95
|
-
w
|
|
96
|
-
]), E = i((e, t) => {
|
|
97
|
-
l((n) => n.map((n) => n.id === e ? {
|
|
98
|
-
...n,
|
|
99
|
-
includeInEmail: t
|
|
100
|
-
} : n));
|
|
101
|
-
}, [l]), D = i((e) => {
|
|
102
|
-
g(!1);
|
|
103
|
-
let t = p.find((t) => t.id === e);
|
|
104
|
-
if (t) {
|
|
105
|
-
t.status === "uploading" && v.current.add(e), m((t) => t.filter((t) => t.id !== e));
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
if (l((t) => t.filter((t) => t.id !== e)), !y.current.delete(e)) {
|
|
109
|
-
b.current.add(e);
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
f({
|
|
113
|
-
path: { file_id: e },
|
|
114
|
-
receivableId: u
|
|
115
|
-
});
|
|
116
|
-
}, [
|
|
117
|
-
f,
|
|
118
|
-
p,
|
|
119
|
-
u,
|
|
120
|
-
l
|
|
121
|
-
]), O = i(() => {
|
|
122
|
-
x.current += 1, v.current.clear(), y.current.clear(), b.current.clear(), m([]), g(!1);
|
|
123
|
-
}, []), k = i(() => {
|
|
124
|
-
let e = new Set(y.current);
|
|
125
|
-
for (let t of e) f({
|
|
126
|
-
path: { file_id: t },
|
|
127
|
-
receivableId: u
|
|
128
|
-
});
|
|
129
|
-
l((t) => t.filter(({ id: t }) => !e.has(t))), O();
|
|
130
|
-
}, [
|
|
131
|
-
f,
|
|
132
|
-
u,
|
|
133
|
-
O,
|
|
134
|
-
l
|
|
135
|
-
]), A = i(() => {
|
|
136
|
-
for (let e of b.current) f({
|
|
137
|
-
path: { file_id: e },
|
|
138
|
-
receivableId: u
|
|
139
|
-
});
|
|
140
|
-
b.current.clear();
|
|
141
|
-
}, [f, u]);
|
|
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
|
+
]);
|
|
142
34
|
return {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
setIncludeInEmail: E,
|
|
148
|
-
remove: D,
|
|
149
|
-
reset: O,
|
|
150
|
-
discardUploads: k,
|
|
151
|
-
commitRemovals: A
|
|
35
|
+
receivable: l.data,
|
|
36
|
+
detailsView: p,
|
|
37
|
+
isLoading: l.isLoading || u.isLoading || d.isLoading || f.isLoading,
|
|
38
|
+
isError: l.isError
|
|
152
39
|
};
|
|
153
40
|
}
|
|
154
41
|
//#endregion
|
|
155
|
-
export {
|
|
42
|
+
export { o as useReceivableDetails };
|
package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index14.js
CHANGED
|
@@ -2,46 +2,154 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { toFileArray as e, validateAttachmentFile as t } from "./index7.js";
|
|
6
|
+
import { useDeleteReceivableAttachmentMutation as n, useUploadReceivableAttachmentMutation as r } from "../../data-access/dist/index4.js";
|
|
7
7
|
import "../../data-access/dist/index.js";
|
|
8
|
-
import { useCallback as
|
|
8
|
+
import { useCallback as i, useEffect as a, useRef as o, useState as s } from "react";
|
|
9
9
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index14.js
|
|
10
|
-
function
|
|
11
|
-
let
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
10
|
+
function c({ attachments: c, setAttachments: l, receivableId: u }) {
|
|
11
|
+
let { mutateAsync: d } = r(), { mutate: f } = n(), [p, m] = s([]), [h, g] = s(!1), _ = o(0), v = o(/* @__PURE__ */ new Set()), y = o(/* @__PURE__ */ new Set()), b = o(/* @__PURE__ */ new Set()), x = o(0), S = o(!1), C = o({
|
|
12
|
+
deleteFile: f,
|
|
13
|
+
receivableId: u
|
|
14
|
+
});
|
|
15
|
+
a(() => {
|
|
16
|
+
C.current = {
|
|
17
|
+
deleteFile: f,
|
|
18
|
+
receivableId: u
|
|
19
|
+
};
|
|
20
|
+
}, [f, u]), a(() => {
|
|
21
|
+
S.current = !1;
|
|
22
|
+
let e = y.current;
|
|
23
|
+
return () => {
|
|
24
|
+
S.current = !0;
|
|
25
|
+
let { deleteFile: t, receivableId: n } = C.current;
|
|
26
|
+
for (let r of e) t({
|
|
27
|
+
path: { file_id: r },
|
|
28
|
+
receivableId: n
|
|
29
|
+
});
|
|
30
|
+
e.clear();
|
|
31
|
+
};
|
|
32
|
+
}, []);
|
|
33
|
+
let w = i(async (e, t) => {
|
|
34
|
+
let n = x.current, r = () => S.current || x.current !== n;
|
|
35
|
+
try {
|
|
36
|
+
let n = await d({
|
|
37
|
+
file: t,
|
|
38
|
+
receivableId: u
|
|
39
|
+
});
|
|
40
|
+
if (r() || v.current.delete(e)) {
|
|
41
|
+
f({
|
|
42
|
+
path: { file_id: n.id },
|
|
43
|
+
receivableId: u
|
|
44
|
+
});
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
y.current.add(n.id), m((t) => t.filter((t) => t.id !== e)), l((e) => [...e, {
|
|
48
|
+
id: n.id,
|
|
49
|
+
includeInEmail: !0,
|
|
50
|
+
name: n.name,
|
|
51
|
+
size: n.size
|
|
52
|
+
}]);
|
|
53
|
+
} catch {
|
|
54
|
+
let t = v.current.delete(e);
|
|
55
|
+
if (r() || t) return;
|
|
56
|
+
m((t) => t.map((t) => t.id === e ? {
|
|
39
57
|
...t,
|
|
40
|
-
|
|
41
|
-
}))
|
|
42
|
-
}
|
|
43
|
-
|
|
58
|
+
status: "upload_failed"
|
|
59
|
+
} : t));
|
|
60
|
+
}
|
|
61
|
+
}, [
|
|
62
|
+
f,
|
|
63
|
+
u,
|
|
64
|
+
l,
|
|
65
|
+
d
|
|
66
|
+
]), T = i((n) => {
|
|
67
|
+
let r = e(n);
|
|
68
|
+
if (r.length === 0) return;
|
|
69
|
+
let i = p.filter((e) => e.status === "uploading").length, a = 10 - c.length - i, o = [], s = !1;
|
|
70
|
+
for (let e of r) {
|
|
71
|
+
_.current += 1;
|
|
72
|
+
let n = `pending-attachment-${_.current}`, r = t(e);
|
|
73
|
+
if (r) {
|
|
74
|
+
o.push({
|
|
75
|
+
id: n,
|
|
76
|
+
name: e.name,
|
|
77
|
+
status: r
|
|
78
|
+
});
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
if (a <= 0) {
|
|
82
|
+
s = !0;
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
--a, o.push({
|
|
86
|
+
id: n,
|
|
87
|
+
name: e.name,
|
|
88
|
+
status: "uploading"
|
|
89
|
+
}), w(n, e);
|
|
90
|
+
}
|
|
91
|
+
o.length > 0 && m((e) => [...e, ...o]), g(s);
|
|
92
|
+
}, [
|
|
93
|
+
c.length,
|
|
94
|
+
p,
|
|
95
|
+
w
|
|
96
|
+
]), E = i((e, t) => {
|
|
97
|
+
l((n) => n.map((n) => n.id === e ? {
|
|
98
|
+
...n,
|
|
99
|
+
includeInEmail: t
|
|
100
|
+
} : n));
|
|
101
|
+
}, [l]), D = i((e) => {
|
|
102
|
+
g(!1);
|
|
103
|
+
let t = p.find((t) => t.id === e);
|
|
104
|
+
if (t) {
|
|
105
|
+
t.status === "uploading" && v.current.add(e), m((t) => t.filter((t) => t.id !== e));
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (l((t) => t.filter((t) => t.id !== e)), !y.current.delete(e)) {
|
|
109
|
+
b.current.add(e);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
f({
|
|
113
|
+
path: { file_id: e },
|
|
114
|
+
receivableId: u
|
|
115
|
+
});
|
|
116
|
+
}, [
|
|
117
|
+
f,
|
|
118
|
+
p,
|
|
119
|
+
u,
|
|
120
|
+
l
|
|
121
|
+
]), O = i(() => {
|
|
122
|
+
x.current += 1, v.current.clear(), y.current.clear(), b.current.clear(), m([]), g(!1);
|
|
123
|
+
}, []), k = i(() => {
|
|
124
|
+
let e = new Set(y.current);
|
|
125
|
+
for (let t of e) f({
|
|
126
|
+
path: { file_id: t },
|
|
127
|
+
receivableId: u
|
|
128
|
+
});
|
|
129
|
+
l((t) => t.filter(({ id: t }) => !e.has(t))), O();
|
|
130
|
+
}, [
|
|
131
|
+
f,
|
|
132
|
+
u,
|
|
133
|
+
O,
|
|
134
|
+
l
|
|
135
|
+
]), A = i(() => {
|
|
136
|
+
for (let e of b.current) f({
|
|
137
|
+
path: { file_id: e },
|
|
138
|
+
receivableId: u
|
|
139
|
+
});
|
|
140
|
+
b.current.clear();
|
|
141
|
+
}, [f, u]);
|
|
142
|
+
return {
|
|
143
|
+
pendingUploads: p,
|
|
144
|
+
isUploading: p.some((e) => e.status === "uploading"),
|
|
145
|
+
isCountLimitReached: h,
|
|
146
|
+
selectFiles: T,
|
|
147
|
+
setIncludeInEmail: E,
|
|
148
|
+
remove: D,
|
|
149
|
+
reset: O,
|
|
150
|
+
discardUploads: k,
|
|
151
|
+
commitRemovals: A
|
|
44
152
|
};
|
|
45
153
|
}
|
|
46
154
|
//#endregion
|
|
47
|
-
export {
|
|
155
|
+
export { c as useReceivableAttachmentUploads };
|
package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index15.js
CHANGED
|
@@ -1,63 +1,47 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import { usePaymentTermsQuery as e } from "../../../shared/data-access/dist/lib/reference-data/usePaymentTermsQuery.js";
|
|
6
|
+
import { buildCustomDateCalendar as t, buildPaymentTermsView as n, closeCustomDatePickerFields as r, selectPaymentTermsFields as i, toCustomDateValue as a } from "./index8.js";
|
|
7
|
+
import "../../data-access/dist/index.js";
|
|
8
|
+
import { useCallback as o, useMemo as s, useState as c } from "react";
|
|
4
9
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index15.js
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
accountNumber: "",
|
|
8
|
-
accountHolderName: "",
|
|
9
|
-
displayName: ""
|
|
10
|
-
};
|
|
11
|
-
function r(n) {
|
|
12
|
-
let r = new Set(n ?? []);
|
|
10
|
+
function l({ paymentTermsId: l, paymentTermsCustomDate: u, messages: d, onChange: f }) {
|
|
11
|
+
let p = e(), [m, h] = c(!1);
|
|
13
12
|
return {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
errors: o,
|
|
46
|
-
canCancel: e.length > 0,
|
|
47
|
-
isSaving: s
|
|
48
|
-
} : { kind: "restricted" };
|
|
49
|
-
}
|
|
50
|
-
function c(e, t) {
|
|
51
|
-
let n = {}, r = e.accountHolderName.trim(), i = e.accountNumber.trim(), a = e.routingNumber.trim();
|
|
52
|
-
return r ? r.length > 255 && (n.accountHolderName = t.bankAccountHolderNameTooLong) : n.accountHolderName = t.bankAccountHolderNameRequired, i ? /^\d+$/.test(i) ? i.length < 4 ? n.accountNumber = t.bankAccountNumberTooShort : i.length > 17 && (n.accountNumber = t.bankAccountNumberTooLong) : n.accountNumber = t.bankAccountNumberDigitsOnly : n.accountNumber = t.bankAccountNumberRequired, a ? /^\d{9}$/.test(a) || (n.routingNumber = t.bankAccountRoutingNumberInvalid) : n.routingNumber = t.bankAccountRoutingNumberRequired, e.displayName.length > 200 && (n.displayName = t.bankAccountNicknameTooLong), n;
|
|
53
|
-
}
|
|
54
|
-
function l(e) {
|
|
55
|
-
return {
|
|
56
|
-
display_name: e.displayName || void 0,
|
|
57
|
-
account_holder_name: e.accountHolderName.trim() || void 0,
|
|
58
|
-
account_number: e.accountNumber.trim() || void 0,
|
|
59
|
-
routing_number: e.routingNumber.trim() || void 0
|
|
13
|
+
view: s(() => n({
|
|
14
|
+
terms: p.data?.data,
|
|
15
|
+
isLoading: p.isLoading,
|
|
16
|
+
fields: {
|
|
17
|
+
paymentTermsId: l,
|
|
18
|
+
paymentTermsCustomDate: u
|
|
19
|
+
},
|
|
20
|
+
customDatePickerOpen: m,
|
|
21
|
+
messages: d
|
|
22
|
+
}), [
|
|
23
|
+
m,
|
|
24
|
+
d,
|
|
25
|
+
u,
|
|
26
|
+
l,
|
|
27
|
+
p.data?.data,
|
|
28
|
+
p.isLoading
|
|
29
|
+
]),
|
|
30
|
+
calendar: s(() => t(u), [u]),
|
|
31
|
+
select: o((e) => {
|
|
32
|
+
f((t) => i(t, e)), h(!1);
|
|
33
|
+
}, [f]),
|
|
34
|
+
changeCustomDatePickerOpen: o((e) => {
|
|
35
|
+
h(e), e || f(r);
|
|
36
|
+
}, [f]),
|
|
37
|
+
selectCustomDate: o((e) => {
|
|
38
|
+
f((t) => r({
|
|
39
|
+
...t,
|
|
40
|
+
paymentTermsCustomDate: a(e)
|
|
41
|
+
})), h(!1);
|
|
42
|
+
}, [f]),
|
|
43
|
+
reset: o(() => h(!1), [])
|
|
60
44
|
};
|
|
61
45
|
}
|
|
62
46
|
//#endregion
|
|
63
|
-
export {
|
|
47
|
+
export { l as useReceivablePaymentTerms };
|
package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index16.js
CHANGED
|
@@ -1,101 +1,63 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
"use client";
|
|
5
|
-
import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
6
|
-
import { extractApiErrorMessage as t } from "../../../shared/util/dist/lib/apiErrors.js";
|
|
7
|
-
import "../../../shared/ui/dist/index.js";
|
|
8
|
-
import { useWidgetConfig as n } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
9
|
-
import "../../../shared/feature/dist/index.js";
|
|
10
|
-
import { useCreateEntityBankAccountMutation as r, usePaymentAccountsQuery as i } from "../../data-access/dist/index3.js";
|
|
11
|
-
import "../../data-access/dist/index.js";
|
|
12
|
-
import { EMPTY_BANK_ACCOUNT_FORM_VALUES as a, bankAccountFormToPayload as o, buildBankAccountSectionView as s, buildPaymentAccountOptions as c, getBankAccountPermissions as l, validateBankAccountForm as u } from "./index15.js";
|
|
13
|
-
import { useCallback as d, useEffect as f, useMemo as p, useRef as m, useState as h } from "react";
|
|
1
|
+
import { hasAnyScope as e } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
|
|
2
|
+
import { Scope as t } from "../../../shared/data-access/dist/lib/scopes.js";
|
|
3
|
+
import "../../../shared/data-access/dist/index.js";
|
|
14
4
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index16.js
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
f(() => {
|
|
24
|
-
if (!g || T || N.current || C.length !== 1) return;
|
|
25
|
-
let [e] = C;
|
|
26
|
-
N.current = !0, b({
|
|
27
|
-
bankAccountId: e.id,
|
|
28
|
-
bankAccountType: e.type
|
|
29
|
-
});
|
|
30
|
-
}, [
|
|
31
|
-
T,
|
|
32
|
-
b,
|
|
33
|
-
g,
|
|
34
|
-
C
|
|
35
|
-
]);
|
|
36
|
-
let F = d((e) => {
|
|
37
|
-
let t = C.find((t) => t.id === e);
|
|
38
|
-
t && b({
|
|
39
|
-
bankAccountId: t.id,
|
|
40
|
-
bankAccountType: t.type
|
|
41
|
-
});
|
|
42
|
-
}, [b, C]), I = d(() => O(!0), []), L = d(() => {
|
|
43
|
-
O(!1), A(a), M({});
|
|
44
|
-
}, []), R = d((e) => A((t) => ({
|
|
45
|
-
...t,
|
|
46
|
-
...e
|
|
47
|
-
})), []), z = d(async () => {
|
|
48
|
-
let n = u(k, y);
|
|
49
|
-
if (M(n), !(Object.keys(n).length > 0)) try {
|
|
50
|
-
let t = await E.mutateAsync({ body: o(k) });
|
|
51
|
-
O(!1), A(a), b({
|
|
52
|
-
bankAccountId: t.id,
|
|
53
|
-
bankAccountType: "BANK_DETAILS"
|
|
54
|
-
}), e.success(y.bankAccountCreated.replace("{name}", t.display_name ?? ""));
|
|
55
|
-
} catch (n) {
|
|
56
|
-
e.error(t(n) ?? y.bankAccountCreateFailed);
|
|
57
|
-
}
|
|
58
|
-
}, [
|
|
59
|
-
E,
|
|
60
|
-
k,
|
|
61
|
-
y,
|
|
62
|
-
b
|
|
63
|
-
]), B = p(() => c({
|
|
64
|
-
accounts: C,
|
|
65
|
-
embeddedBankName: v,
|
|
66
|
-
messages: y
|
|
67
|
-
}), [
|
|
68
|
-
v,
|
|
69
|
-
y,
|
|
70
|
-
C
|
|
71
|
-
]);
|
|
5
|
+
var n = {
|
|
6
|
+
routingNumber: "",
|
|
7
|
+
accountNumber: "",
|
|
8
|
+
accountHolderName: "",
|
|
9
|
+
displayName: ""
|
|
10
|
+
};
|
|
11
|
+
function r(n) {
|
|
12
|
+
let r = new Set(n ?? []);
|
|
72
13
|
return {
|
|
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
|
-
|
|
14
|
+
canReadEmbedded: e(r, [t.BankAccountReadOrg]),
|
|
15
|
+
canReadExternal: e(r, [t.ExternalBankAccountReadOrg]),
|
|
16
|
+
canAddAccount: e(r, [t.BankAccountWriteOrg])
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function i(e, t) {
|
|
20
|
+
return [e.displayName || t.bankAccountFallbackName, e.accountNumberLast4].filter(Boolean).join(" - ");
|
|
21
|
+
}
|
|
22
|
+
function a(e, t, n) {
|
|
23
|
+
switch (e) {
|
|
24
|
+
case "INTERNAL": return t ? n.bankAccountPoweredBy.replace("{embeddedBankName}", t) : void 0;
|
|
25
|
+
case "EXTERNAL": return n.bankAccountLinked;
|
|
26
|
+
default: return;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function o({ accounts: e, embeddedBankName: t, messages: n }) {
|
|
30
|
+
return e.map((e) => ({
|
|
31
|
+
value: e.id,
|
|
32
|
+
label: i(e, n),
|
|
33
|
+
sourceLabel: a(e.type, t, n)
|
|
34
|
+
})).sort((e, t) => e.label.localeCompare(t.label));
|
|
35
|
+
}
|
|
36
|
+
function s({ options: e, isLoading: t, selectedId: n, isAddingAccount: r, canAddAccount: i, formValues: a, formErrors: o, isSaving: s }) {
|
|
37
|
+
return t ? { kind: "loading" } : e.length > 0 && !r ? {
|
|
38
|
+
kind: "picker",
|
|
39
|
+
options: e,
|
|
40
|
+
selected: e.find((e) => e.value === n),
|
|
41
|
+
canAddAccount: i
|
|
42
|
+
} : i ? {
|
|
43
|
+
kind: "form",
|
|
44
|
+
values: a,
|
|
45
|
+
errors: o,
|
|
46
|
+
canCancel: e.length > 0,
|
|
47
|
+
isSaving: s
|
|
48
|
+
} : { kind: "restricted" };
|
|
49
|
+
}
|
|
50
|
+
function c(e, t) {
|
|
51
|
+
let n = {}, r = e.accountHolderName.trim(), i = e.accountNumber.trim(), a = e.routingNumber.trim();
|
|
52
|
+
return r ? r.length > 255 && (n.accountHolderName = t.bankAccountHolderNameTooLong) : n.accountHolderName = t.bankAccountHolderNameRequired, i ? /^\d+$/.test(i) ? i.length < 4 ? n.accountNumber = t.bankAccountNumberTooShort : i.length > 17 && (n.accountNumber = t.bankAccountNumberTooLong) : n.accountNumber = t.bankAccountNumberDigitsOnly : n.accountNumber = t.bankAccountNumberRequired, a ? /^\d{9}$/.test(a) || (n.routingNumber = t.bankAccountRoutingNumberInvalid) : n.routingNumber = t.bankAccountRoutingNumberRequired, e.displayName.length > 200 && (n.displayName = t.bankAccountNicknameTooLong), n;
|
|
53
|
+
}
|
|
54
|
+
function l(e) {
|
|
55
|
+
return {
|
|
56
|
+
display_name: e.displayName || void 0,
|
|
57
|
+
account_holder_name: e.accountHolderName.trim() || void 0,
|
|
58
|
+
account_number: e.accountNumber.trim() || void 0,
|
|
59
|
+
routing_number: e.routingNumber.trim() || void 0
|
|
98
60
|
};
|
|
99
61
|
}
|
|
100
62
|
//#endregion
|
|
101
|
-
export {
|
|
63
|
+
export { n as EMPTY_BANK_ACCOUNT_FORM_VALUES, l as bankAccountFormToPayload, s as buildBankAccountSectionView, o as buildPaymentAccountOptions, r as getBankAccountPermissions, i as getPaymentAccountLineLabel, a as getPaymentAccountSourceLabel, c as validateBankAccountForm };
|