@tesouro/embedded-components-react 0.5.31 → 0.5.32
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/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index10.js +9 -8
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index8.js +45 -45
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/ReceiptMatchWidget/lib/ReceiptInboxStep.js +8 -1
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/ReceiptMatchWidget/lib/TransactionsMatchStep.js +7 -1
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/ReceiptMatchWidget/lib/labels.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
|
@@ -46,7 +46,7 @@ function m({ isOpen: e, onClose: t, ...n }) {
|
|
|
46
46
|
...n
|
|
47
47
|
}) : null;
|
|
48
48
|
}
|
|
49
|
-
function h({ baseUrl: e, widgetToken: t, organizationId: r, configClient: i, gatewayRouting: a, linkComponent: s, implementation: c, uiFramework: l, errorFallback: u, onError: f,
|
|
49
|
+
function h({ baseUrl: e, widgetToken: t, organizationId: r, configClient: i, gatewayRouting: a, linkComponent: s, implementation: c, uiFramework: l, errorFallback: u, onError: f, analytics: p, disclosuresAcceptance: h, providerLabels: g, isOpen: _, preSelectedReceiptIds: v, onClose: y, targetTransactionId: b, onSingleTransactionUpdate: x }) {
|
|
50
50
|
return /* @__PURE__ */ d(n, {
|
|
51
51
|
widgetName: o,
|
|
52
52
|
baseUrl: e,
|
|
@@ -59,14 +59,15 @@ function h({ baseUrl: e, widgetToken: t, organizationId: r, configClient: i, gat
|
|
|
59
59
|
uiFramework: l,
|
|
60
60
|
errorFallback: u,
|
|
61
61
|
onError: f,
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
analytics: p,
|
|
63
|
+
disclosuresAcceptance: h,
|
|
64
|
+
providerLabels: g,
|
|
64
65
|
children: /* @__PURE__ */ d(m, {
|
|
65
|
-
isOpen:
|
|
66
|
-
preSelectedReceiptIds:
|
|
67
|
-
onClose:
|
|
68
|
-
targetTransactionId:
|
|
69
|
-
onSingleTransactionUpdate:
|
|
66
|
+
isOpen: _,
|
|
67
|
+
preSelectedReceiptIds: v,
|
|
68
|
+
onClose: y,
|
|
69
|
+
targetTransactionId: b,
|
|
70
|
+
onSingleTransactionUpdate: x
|
|
70
71
|
})
|
|
71
72
|
});
|
|
72
73
|
}
|
package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index8.js
CHANGED
|
@@ -10,12 +10,12 @@ import { ReceiptMatchLabels as r } from "../../ui/dist/lib/ReceiptMatchWidget/li
|
|
|
10
10
|
import "../../ui/dist/index.js";
|
|
11
11
|
import { useGetReceiptsQuery as i } from "../../data-access/dist/index2.js";
|
|
12
12
|
import { useGetTransactionsQuery as a } from "../../data-access/dist/index3.js";
|
|
13
|
-
import { usePatchReceiptMutation as
|
|
14
|
-
import { useDeleteReceiptMutation as
|
|
13
|
+
import { usePatchReceiptMutation as o } from "../../data-access/dist/index5.js";
|
|
14
|
+
import { useDeleteReceiptMutation as ee } from "../../data-access/dist/index6.js";
|
|
15
15
|
import "../../data-access/dist/index.js";
|
|
16
|
-
import { useCallback as
|
|
16
|
+
import { useCallback as s, useEffect as c, useMemo as l, useState as u } from "react";
|
|
17
17
|
//#region ../../libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index8.js
|
|
18
|
-
function
|
|
18
|
+
function d(e, t) {
|
|
19
19
|
if (typeof e == "object" && e) {
|
|
20
20
|
let t = e.error;
|
|
21
21
|
if (typeof t == "object" && t) {
|
|
@@ -25,7 +25,7 @@ function l(e, t) {
|
|
|
25
25
|
}
|
|
26
26
|
return e instanceof Error && e.message ? e.message : t;
|
|
27
27
|
}
|
|
28
|
-
function
|
|
28
|
+
function f(e, t) {
|
|
29
29
|
let n = e / 100;
|
|
30
30
|
try {
|
|
31
31
|
return new Intl.NumberFormat("en-US", {
|
|
@@ -36,7 +36,7 @@ function u(e, t) {
|
|
|
36
36
|
return `${t} ${n.toFixed(2)}`;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function p(e) {
|
|
40
40
|
if (!e) return "";
|
|
41
41
|
let t = new Date(e);
|
|
42
42
|
return Number.isNaN(t.getTime()) ? "" : t.toLocaleDateString("en-US", {
|
|
@@ -45,7 +45,7 @@ function d(e) {
|
|
|
45
45
|
year: "numeric"
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
|
-
function
|
|
48
|
+
function te(e) {
|
|
49
49
|
if (!e) return "";
|
|
50
50
|
let t = new Date(e);
|
|
51
51
|
return Number.isNaN(t.getTime()) ? "" : t.toLocaleDateString("en-US", {
|
|
@@ -54,7 +54,7 @@ function re(e) {
|
|
|
54
54
|
year: "numeric"
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function m(e) {
|
|
58
58
|
if (!e) return "";
|
|
59
59
|
let t = new Date(e);
|
|
60
60
|
return Number.isNaN(t.getTime()) ? "" : t.toLocaleTimeString("en-US", {
|
|
@@ -64,26 +64,26 @@ function f(e) {
|
|
|
64
64
|
hour12: !0
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
|
-
function
|
|
67
|
+
function ne(e) {
|
|
68
68
|
let t = e.ocr_status === "processing";
|
|
69
69
|
return {
|
|
70
70
|
id: e.id,
|
|
71
71
|
primaryText: t ? r.ReceiptScanningTitle : e.merchant_name?.trim() || r.ReceiptScanningTitle,
|
|
72
|
-
secondaryText: t ? r.ReceiptScanningSubtitle :
|
|
72
|
+
secondaryText: t ? r.ReceiptScanningSubtitle : p(e.issued_at),
|
|
73
73
|
thumbnailUrl: e.file_url ?? void 0
|
|
74
74
|
};
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function re(e) {
|
|
77
77
|
return {
|
|
78
78
|
id: e.id,
|
|
79
79
|
merchantName: e.merchant_name,
|
|
80
|
-
date:
|
|
81
|
-
formattedAmount:
|
|
80
|
+
date: p(e.started_at),
|
|
81
|
+
formattedAmount: f(e.amount, e.currency)
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
|
-
var
|
|
85
|
-
function y({ preSelectedIds:
|
|
86
|
-
let { initResponse: S } = t(), C = n(), w = S?.userId ?? void 0, T = !!w && !C, [E, D] =
|
|
84
|
+
var h = .5, g = 3, _ = .25, ie = 5e3, v = !1;
|
|
85
|
+
function y({ preSelectedIds: p, onClose: y, targetTransactionId: b, onSingleTransactionUpdate: x }) {
|
|
86
|
+
let { initResponse: S } = t(), C = n(), w = S?.userId ?? void 0, T = !!w && !C, [E, D] = u(1), [O, k] = u(0), [A, j] = u([]), [M, N] = u(() => p), [P, F] = u(""), [I, L] = u([]), R = l(() => I.map((e) => e.id), [I]), [z, B] = u(1), V = i({
|
|
87
87
|
has_transaction: !1,
|
|
88
88
|
created_by_entity_user_id: w,
|
|
89
89
|
enabled: T
|
|
@@ -91,49 +91,49 @@ function y({ preSelectedIds: d, onClose: y, targetTransactionId: b, onSingleTran
|
|
|
91
91
|
merchant_name__icontains: P || void 0,
|
|
92
92
|
has_receipt: !1,
|
|
93
93
|
enabled: E === 2
|
|
94
|
-
}), U =
|
|
95
|
-
|
|
94
|
+
}), U = o(), W = ee(), G = V.data?.data ?? [], K = l(() => w ? G.filter((e) => e.created_by_entity_user_id == null || e.created_by_entity_user_id === w) : [], [G, w]);
|
|
95
|
+
c(() => {
|
|
96
96
|
if (!K.some((e) => e.ocr_status === "processing")) return;
|
|
97
97
|
let e = window.setInterval(() => {
|
|
98
98
|
V.isFetching || V.refetch();
|
|
99
|
-
},
|
|
99
|
+
}, ie);
|
|
100
100
|
return () => window.clearInterval(e);
|
|
101
101
|
}, [
|
|
102
102
|
V.isFetching,
|
|
103
103
|
V.refetch,
|
|
104
104
|
K
|
|
105
105
|
]);
|
|
106
|
-
let q =
|
|
106
|
+
let q = l(() => K.map(ne), [K]), J = l(() => new Set(A.flatMap((e) => e.transactionIds)), [A]), ae = l(() => (H.data?.data ?? []).filter((e) => !J.has(e.id)).map(re), [H.data, J]), Y = H.data?.data ?? [], X = M[O], Z = l(() => K.find((e) => e.id === X), [K, X]), oe = Z?.file_url ?? void 0, se = Z?.file_name ?? void 0, ce = l(() => {
|
|
107
107
|
if (b) return "Attach";
|
|
108
108
|
if (!(M.length <= 1)) return `Review (${O + 1}/${M.length})`;
|
|
109
109
|
}, [
|
|
110
110
|
b,
|
|
111
111
|
M.length,
|
|
112
112
|
O
|
|
113
|
-
]), le =
|
|
113
|
+
]), le = l(() => A.filter((e) => e.receiptId === X).flatMap((e) => e.transactionDetails), [A, X]), ue = O >= M.length - 1 ? r.Done : r.ReviewNextReceipt(O + 2, M.length), Q = s(() => {
|
|
114
114
|
F(""), L([]), B(1);
|
|
115
|
-
}, []), de =
|
|
115
|
+
}, []), de = s((e) => {
|
|
116
116
|
if (b) {
|
|
117
117
|
N((t) => t.includes(e) ? [] : [e]);
|
|
118
118
|
return;
|
|
119
119
|
}
|
|
120
120
|
N((t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
|
|
121
|
-
}, [b]), fe =
|
|
121
|
+
}, [b]), fe = s(() => {
|
|
122
122
|
N(q.map((e) => e.id));
|
|
123
|
-
}, [q]), pe =
|
|
123
|
+
}, [q]), pe = s(() => {
|
|
124
124
|
N([]);
|
|
125
|
-
}, []), me =
|
|
125
|
+
}, []), me = s((e) => {
|
|
126
126
|
let t = K.find((t) => t.id === e);
|
|
127
127
|
t?.file_url && window.open(t.file_url, "_blank", "noopener,noreferrer");
|
|
128
|
-
}, [K]), $ =
|
|
128
|
+
}, [K]), $ = s(async (t) => {
|
|
129
129
|
try {
|
|
130
130
|
await W.mutateAsync({ path: { receipt_id: t } });
|
|
131
131
|
} catch (t) {
|
|
132
|
-
e.error(
|
|
132
|
+
e.error(d(t, "Failed to delete receipt"));
|
|
133
133
|
return;
|
|
134
134
|
}
|
|
135
135
|
N((e) => e.filter((e) => e !== t));
|
|
136
|
-
}, [W]), he =
|
|
136
|
+
}, [W]), he = s(async () => {
|
|
137
137
|
if (M.length !== 0) {
|
|
138
138
|
if (b) {
|
|
139
139
|
try {
|
|
@@ -142,7 +142,7 @@ function y({ preSelectedIds: d, onClose: y, targetTransactionId: b, onSingleTran
|
|
|
142
142
|
body: { transaction_id: b }
|
|
143
143
|
}), x?.(), y();
|
|
144
144
|
} catch (t) {
|
|
145
|
-
e.error(
|
|
145
|
+
e.error(d(t, "Failed to attach receipt"));
|
|
146
146
|
}
|
|
147
147
|
return;
|
|
148
148
|
}
|
|
@@ -155,21 +155,21 @@ function y({ preSelectedIds: d, onClose: y, targetTransactionId: b, onSingleTran
|
|
|
155
155
|
x,
|
|
156
156
|
y,
|
|
157
157
|
Q
|
|
158
|
-
]), ge =
|
|
158
|
+
]), ge = s((e) => {
|
|
159
159
|
F(e);
|
|
160
|
-
}, []), _e =
|
|
160
|
+
}, []), _e = s((e) => {
|
|
161
161
|
L((t) => {
|
|
162
162
|
let n = t.find((t) => t.id === e), r = Y.find((t) => t.id === e);
|
|
163
163
|
return n ? [] : r ? [r] : [];
|
|
164
164
|
});
|
|
165
|
-
}, [Y]), ve =
|
|
165
|
+
}, [Y]), ve = s(async () => {
|
|
166
166
|
if (I.length === 0 || !X) return;
|
|
167
167
|
let t = I, n = (e) => ({
|
|
168
168
|
merchant: e.merchant_name,
|
|
169
169
|
location: e.merchant_location,
|
|
170
|
-
date:
|
|
171
|
-
time:
|
|
172
|
-
formattedAmount:
|
|
170
|
+
date: te(e.started_at),
|
|
171
|
+
time: m(e.started_at),
|
|
172
|
+
formattedAmount: f(e.amount, e.currency)
|
|
173
173
|
}), r = [], i = [];
|
|
174
174
|
for (let a of t) try {
|
|
175
175
|
await U.mutateAsync({
|
|
@@ -181,7 +181,7 @@ function y({ preSelectedIds: d, onClose: y, targetTransactionId: b, onSingleTran
|
|
|
181
181
|
receiptId: X,
|
|
182
182
|
transactionIds: r,
|
|
183
183
|
transactionDetails: i
|
|
184
|
-
}]), L((e) => e.filter((e) => !r.includes(e.id))), e.error(
|
|
184
|
+
}]), L((e) => e.filter((e) => !r.includes(e.id))), e.error(d(t, "Failed to match receipt"));
|
|
185
185
|
return;
|
|
186
186
|
}
|
|
187
187
|
j((e) => [...e, {
|
|
@@ -193,11 +193,11 @@ function y({ preSelectedIds: d, onClose: y, targetTransactionId: b, onSingleTran
|
|
|
193
193
|
I,
|
|
194
194
|
X,
|
|
195
195
|
U
|
|
196
|
-
]), ye =
|
|
197
|
-
B((e) => Math.min(e +
|
|
198
|
-
}, []), be =
|
|
199
|
-
B((e) => Math.max(e -
|
|
200
|
-
}, []), xe =
|
|
196
|
+
]), ye = s(() => {
|
|
197
|
+
B((e) => Math.min(e + _, g));
|
|
198
|
+
}, []), be = s(() => {
|
|
199
|
+
B((e) => Math.max(e - _, h));
|
|
200
|
+
}, []), xe = s(() => {
|
|
201
201
|
let e = O + 1;
|
|
202
202
|
if (e < M.length) {
|
|
203
203
|
k(e), Q(), D(2);
|
|
@@ -209,7 +209,7 @@ function y({ preSelectedIds: d, onClose: y, targetTransactionId: b, onSingleTran
|
|
|
209
209
|
M.length,
|
|
210
210
|
Q,
|
|
211
211
|
y
|
|
212
|
-
]), Se =
|
|
212
|
+
]), Se = s(() => {
|
|
213
213
|
if (A.length > 0) {
|
|
214
214
|
let e = new Set(A.map((e) => e.receiptId));
|
|
215
215
|
N((t) => t.filter((t) => !e.has(t)));
|
|
@@ -226,7 +226,7 @@ function y({ preSelectedIds: d, onClose: y, targetTransactionId: b, onSingleTran
|
|
|
226
226
|
onViewAttachment: me,
|
|
227
227
|
onDeleteReceipt: $,
|
|
228
228
|
onReview: he,
|
|
229
|
-
isReceiptsLoading: V.isLoading,
|
|
229
|
+
isReceiptsLoading: V.isLoading || C && !S,
|
|
230
230
|
showSelectAllButton: !b,
|
|
231
231
|
receiptPreviewUrl: oe,
|
|
232
232
|
receiptFileName: se,
|
|
@@ -242,8 +242,8 @@ function y({ preSelectedIds: d, onClose: y, targetTransactionId: b, onSingleTran
|
|
|
242
242
|
zoom: z,
|
|
243
243
|
onZoomIn: ye,
|
|
244
244
|
onZoomOut: be,
|
|
245
|
-
canZoomIn: z <
|
|
246
|
-
canZoomOut: z >
|
|
245
|
+
canZoomIn: z < g,
|
|
246
|
+
canZoomOut: z > h,
|
|
247
247
|
matchedTransactions: le,
|
|
248
248
|
primaryLabel: ue,
|
|
249
249
|
onPrimary: xe,
|
|
@@ -43,7 +43,14 @@ function u({ receipts: t, selectedReceiptIds: u, onSelectAll: f, onReset: p, onR
|
|
|
43
43
|
}),
|
|
44
44
|
/* @__PURE__ */ i("div", {
|
|
45
45
|
className: "ttw:flex-1 ttw:overflow-y-auto ttw:flex ttw:flex-col ttw:gap-2 ttw:px-6 ttw:py-3",
|
|
46
|
-
children: b ?
|
|
46
|
+
children: b ? /* @__PURE__ */ a("div", {
|
|
47
|
+
role: "status",
|
|
48
|
+
className: "ttw:flex ttw:flex-col ttw:gap-2",
|
|
49
|
+
children: [/* @__PURE__ */ i("span", {
|
|
50
|
+
className: "ttw:sr-only",
|
|
51
|
+
children: n.LoadingReceipts
|
|
52
|
+
}), Array.from({ length: l }).map((e, t) => /* @__PURE__ */ i(d, {}, t))]
|
|
53
|
+
}) : t.length === 0 ? /* @__PURE__ */ a("div", {
|
|
47
54
|
className: "ttw:flex ttw:flex-col ttw:items-center ttw:justify-center ttw:gap-3 ttw:flex-1 ttw:py-12",
|
|
48
55
|
children: [/* @__PURE__ */ i("div", {
|
|
49
56
|
className: "ttw:w-14 ttw:h-14 ttw:rounded-full ttw:bg-muted ttw:flex ttw:items-center ttw:justify-center",
|
|
@@ -97,7 +97,13 @@ function m({ receiptPreviewUrl: n, receiptFileName: m, transactions: g, selected
|
|
|
97
97
|
/* @__PURE__ */ a("div", {
|
|
98
98
|
className: "ttw:flex-1 ttw:overflow-y-auto",
|
|
99
99
|
children: [
|
|
100
|
-
N &&
|
|
100
|
+
N && /* @__PURE__ */ a("div", {
|
|
101
|
+
role: "status",
|
|
102
|
+
children: [/* @__PURE__ */ i("span", {
|
|
103
|
+
className: "ttw:sr-only",
|
|
104
|
+
children: r.LoadingTransactions
|
|
105
|
+
}), Array.from({ length: p }).map((e, t) => /* @__PURE__ */ i(h, {}, t))]
|
|
106
|
+
}),
|
|
101
107
|
!N && g.length === 0 && /* @__PURE__ */ a("div", {
|
|
102
108
|
className: "ttw:flex ttw:flex-col ttw:items-center ttw:justify-center ttw:gap-3 ttw:h-full ttw:py-12",
|
|
103
109
|
children: [/* @__PURE__ */ i("div", {
|
|
@@ -36,6 +36,8 @@ var e = {
|
|
|
36
36
|
NoTransactionsSubtitle: "Go directly to transactions to modify receipt data if necessary.",
|
|
37
37
|
MatchConfirmedTitle: "Match confirmed",
|
|
38
38
|
MatchConfirmedSubtitle: "Your receipt has been matched to",
|
|
39
|
+
LoadingReceipts: "Loading receipts",
|
|
40
|
+
LoadingTransactions: "Loading transactions",
|
|
39
41
|
Close: "Close",
|
|
40
42
|
ZoomIn: "Zoom in",
|
|
41
43
|
ZoomOut: "Zoom out",
|
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.32", n = "b173c22974bd1325f16c2944cccf6ab072572670", r = Object.freeze({
|
|
3
3
|
library_name: e,
|
|
4
4
|
library_version: t,
|
|
5
5
|
library_sha: n
|