@tesouro/embedded-components-react 0.7.0 → 0.7.1
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.css +3 -0
- package/dist/index.d.ts +1 -0
- package/dist/lib/ExpenseManagementWidget.d.ts +1 -0
- package/dist/lib/WidgetSuite.d.ts +1 -0
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/lib/useTrackReceiptMatching.js +126 -73
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/lib/ExpenseManagementWidget/ExpenseManagementWidget.js +185 -182
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/lib/TransactionDetails/TransactionDetailsFeature.js +187 -180
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/AccordionItemCard/AccordionItemCard.js +86 -84
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/TransactionDetails/TransactionDetails.js +110 -100
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/TransactionDetails/labels.js +1 -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/index.css
CHANGED
|
@@ -4910,6 +4910,9 @@
|
|
|
4910
4910
|
.ttw\:hover\:bg-purple-50:hover {
|
|
4911
4911
|
background-color: var(--ttw-color-purple-50);
|
|
4912
4912
|
}
|
|
4913
|
+
.ttw\:hover\:bg-purple-100:hover {
|
|
4914
|
+
background-color: var(--ttw-color-purple-100);
|
|
4915
|
+
}
|
|
4913
4916
|
.ttw\:hover\:bg-red-50:hover {
|
|
4914
4917
|
background-color: var(--ttw-color-red-50);
|
|
4915
4918
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,14 +7,14 @@ import { invalidateAllClients as t } from "../../../../shared/data-access/dist/l
|
|
|
7
7
|
import { useEmbedApi as n } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
|
|
8
8
|
import { organizationHeaders as r } from "../../../../shared/data-access/dist/lib/organizationHeaders.js";
|
|
9
9
|
import "../../../../shared/data-access/dist/index.js";
|
|
10
|
-
import { analyticsReceiptsInvalidationKey as i, analyticsTransactionsInvalidationKey as a, receiptsIdInvalidationKey as o, receiptsInvalidationKey as s,
|
|
11
|
-
import { useCallback as
|
|
10
|
+
import { analyticsReceiptsInvalidationKey as i, analyticsTransactionsInvalidationKey as a, receiptsIdInvalidationKey as o, receiptsInvalidationKey as s, transactionsIdExpenseHistoryInvalidationKey as c, transactionsIdInvalidationKey as l, transactionsInvalidationKey as u } from "./queryKeys.js";
|
|
11
|
+
import { useCallback as d, useEffect as f, useRef as p } from "react";
|
|
12
12
|
//#region ../../libs/tesouro-embedded-components-react/expense-management-widget/data-access/dist/lib/useTrackReceiptMatching.js
|
|
13
|
-
var
|
|
14
|
-
function
|
|
13
|
+
var m = 3e3, h = 30, g = 10;
|
|
14
|
+
function _(e) {
|
|
15
15
|
return e.transaction_id ? "matched" : e.ocr_status === "processing" ? null : e.ocr_status === "error" ? "unreadable" : "unmatched";
|
|
16
16
|
}
|
|
17
|
-
function
|
|
17
|
+
function v(e, t) {
|
|
18
18
|
return new Promise((n, r) => {
|
|
19
19
|
if (t.aborted) {
|
|
20
20
|
r(new DOMException("Aborted", "AbortError"));
|
|
@@ -28,83 +28,136 @@ function _(e, t) {
|
|
|
28
28
|
t.addEventListener("abort", i, { once: !0 });
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
|
-
function
|
|
32
|
-
let { client:
|
|
33
|
-
|
|
31
|
+
function y({ intervalMs: y = m, maxAttempts: b = h } = {}) {
|
|
32
|
+
let { client: x, organizationId: S } = n(), C = p(null);
|
|
33
|
+
f(() => {
|
|
34
34
|
let e = new AbortController();
|
|
35
|
-
return
|
|
35
|
+
return C.current = e, () => e.abort();
|
|
36
36
|
}, []);
|
|
37
|
-
let
|
|
37
|
+
let w = d(() => Promise.all([
|
|
38
38
|
t(s({
|
|
39
|
-
client:
|
|
40
|
-
organizationId:
|
|
39
|
+
client: x,
|
|
40
|
+
organizationId: S
|
|
41
41
|
})),
|
|
42
|
-
t(
|
|
43
|
-
client:
|
|
44
|
-
organizationId:
|
|
42
|
+
t(u({
|
|
43
|
+
client: x,
|
|
44
|
+
organizationId: S
|
|
45
45
|
})),
|
|
46
46
|
t(i({
|
|
47
|
-
client:
|
|
48
|
-
organizationId:
|
|
47
|
+
client: x,
|
|
48
|
+
organizationId: S
|
|
49
49
|
})),
|
|
50
50
|
t(a({
|
|
51
|
-
client:
|
|
52
|
-
organizationId:
|
|
51
|
+
client: x,
|
|
52
|
+
organizationId: S
|
|
53
53
|
}))
|
|
54
|
-
]), [
|
|
55
|
-
return {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
54
|
+
]), [x, S]);
|
|
55
|
+
return {
|
|
56
|
+
trackBatch: d(async (n) => {
|
|
57
|
+
let i = {
|
|
58
|
+
total: n.length,
|
|
59
|
+
matched: 0,
|
|
60
|
+
unmatched: 0,
|
|
61
|
+
unreadable: 0,
|
|
62
|
+
stillProcessing: 0
|
|
63
|
+
};
|
|
64
|
+
if (n.length === 0) return i;
|
|
65
|
+
let a = new Set(n), s = C.current?.signal ?? new AbortController().signal;
|
|
66
|
+
await w();
|
|
67
|
+
for (let n = 0; n < b && a.size > 0; n++) {
|
|
68
|
+
if (s.aborted) throw new DOMException("Aborted", "AbortError");
|
|
69
|
+
let { data: c } = await e({
|
|
70
|
+
client: x,
|
|
71
|
+
headers: r(S),
|
|
72
|
+
query: {
|
|
73
|
+
id__in: [...a],
|
|
74
|
+
limit: g
|
|
75
|
+
},
|
|
76
|
+
signal: s,
|
|
77
|
+
throwOnError: !0
|
|
78
|
+
}), u = [], d = [];
|
|
79
|
+
for (let e of c?.data ?? []) {
|
|
80
|
+
if (!a.has(e.id)) continue;
|
|
81
|
+
let t = _(e);
|
|
82
|
+
t && (a.delete(e.id), i[t] += 1, u.push(e.id), t === "matched" && e.transaction_id && d.push(e.transaction_id));
|
|
83
|
+
}
|
|
84
|
+
u.length > 0 && await Promise.all([
|
|
85
|
+
w(),
|
|
86
|
+
...u.map((e) => t(o({
|
|
87
|
+
client: x,
|
|
88
|
+
organizationId: S,
|
|
89
|
+
receiptId: e
|
|
90
|
+
}))),
|
|
91
|
+
...d.map((e) => t(l({
|
|
92
|
+
client: x,
|
|
93
|
+
organizationId: S,
|
|
94
|
+
transactionId: e
|
|
95
|
+
})))
|
|
96
|
+
]), a.size > 0 && n < b - 1 && await v(y, s);
|
|
82
97
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
98
|
+
return {
|
|
99
|
+
...i,
|
|
100
|
+
stillProcessing: a.size
|
|
101
|
+
};
|
|
102
|
+
}, [
|
|
103
|
+
x,
|
|
104
|
+
y,
|
|
105
|
+
b,
|
|
106
|
+
S,
|
|
107
|
+
w
|
|
108
|
+
]),
|
|
109
|
+
trackAttachedReceipt: d(async ({ receiptId: n, transactionId: i }) => {
|
|
110
|
+
let a = C.current?.signal ?? new AbortController().signal;
|
|
111
|
+
for (let s = 0; s < b; s++) {
|
|
112
|
+
if (a.aborted) throw new DOMException("Aborted", "AbortError");
|
|
113
|
+
let u, d = !1;
|
|
114
|
+
try {
|
|
115
|
+
let { data: t } = await e({
|
|
116
|
+
client: x,
|
|
117
|
+
headers: r(S),
|
|
118
|
+
query: {
|
|
119
|
+
id__in: [n],
|
|
120
|
+
limit: 1
|
|
121
|
+
},
|
|
122
|
+
signal: a,
|
|
123
|
+
throwOnError: !0
|
|
124
|
+
});
|
|
125
|
+
u = t?.data?.find((e) => e.id === n);
|
|
126
|
+
} catch (e) {
|
|
127
|
+
if (a.aborted) throw e;
|
|
128
|
+
d = !0;
|
|
129
|
+
}
|
|
130
|
+
if (!d && u?.ocr_status !== "processing") {
|
|
131
|
+
await Promise.all([
|
|
132
|
+
w(),
|
|
133
|
+
t(o({
|
|
134
|
+
client: x,
|
|
135
|
+
organizationId: S,
|
|
136
|
+
receiptId: n
|
|
137
|
+
})),
|
|
138
|
+
t(l({
|
|
139
|
+
client: x,
|
|
140
|
+
organizationId: S,
|
|
141
|
+
transactionId: i
|
|
142
|
+
})),
|
|
143
|
+
t(c({
|
|
144
|
+
client: x,
|
|
145
|
+
organizationId: S,
|
|
146
|
+
transactionId: i
|
|
147
|
+
}))
|
|
148
|
+
]);
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
s < b - 1 && await v(y, a);
|
|
152
|
+
}
|
|
153
|
+
}, [
|
|
154
|
+
x,
|
|
155
|
+
y,
|
|
156
|
+
b,
|
|
157
|
+
S,
|
|
158
|
+
w
|
|
159
|
+
])
|
|
160
|
+
};
|
|
108
161
|
}
|
|
109
162
|
//#endregion
|
|
110
|
-
export {
|
|
163
|
+
export { _ as classifyReceipt, y as useTrackReceiptMatching };
|