@tesouro/embedded-components-react 0.11.120 → 0.11.123
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 +6 -3
- package/dist/index.css +32 -161
- package/dist/index.d.ts +40 -8
- package/dist/index.js +29 -28
- package/dist/lib/ExpenseManagementWidget.d.ts +11 -2
- package/dist/lib/ReceivablesWidget.d.ts +29 -6
- package/dist/lib/ReceivablesWidget.js +3 -1
- package/dist/lib/WidgetSuite.d.ts +38 -6
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/lib/ExpenseManagementWidget/ExpenseManagementWidget.js +343 -264
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/lib/ExpenseManagementWidget/labels.js +14 -0
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/lib/ExpenseManagementWidget/permissions.js +6 -3
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/lib/ExpenseManagementWidget/useExpenseTabBadgeCounts.js +34 -19
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/lib/ExpenseManagementWidget/useExpensesTransactions.js +100 -98
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/lib/TransactionDetails/TransactionDetailsActionsFeature.js +27 -24
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/lib/TransactionDetails/TransactionDetailsFeature.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/lib/expenseStatus.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/receipt-match/feature/dist/index2.js +43 -44
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/receipt-match/feature/dist/index4.js +79 -40
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/receipt-match/ui/dist/index2.js +10 -0
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/receipt-match/ui/dist/index3.js +47 -46
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/receipt-match/ui/dist/index4.js +78 -84
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/receipt-match/ui/dist/index5.js +165 -158
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/receipt-match/ui/dist/index6.js +38 -100
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/receipt-match/ui/dist/index7.js +77 -54
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/AccordionItemCard/AccordionItemCard.js +213 -229
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/ExpenseStatusBadge/ExpenseStatusBadge.js +6 -8
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/ExpensesScreen/ExpensesScreen.js +66 -73
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/ExpensesTransactionsFilterBar/ExpensesTransactionsFilterBar.js +13 -13
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/ExpensesTransactionsTable/ExpensesTransactionsTable.js +123 -80
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/ExpensesTransactionsTable/labels.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/FileViewer/FileViewer.js +83 -74
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/TransactionDetails/DeleteReceiptDialog/DeleteReceiptDialog.js +22 -30
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/TransactionDetails/TransactionDetails.js +176 -259
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/TransactionDetails/labels.js +4 -2
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/TransactionDetailsActions/BulkProgress.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/TransactionDetailsActions/TransactionDetailsActions.js +112 -121
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/TransactionDetailsActions/labels.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index.js +3 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivableAttachmentsSection.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivableCustomerSection.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +342 -295
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/paymentTerms.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/preview.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/recurrence.js +1 -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/tabs.js +26 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableDetails.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableForm.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/mocks/labels.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +30 -26
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index10.js +18 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index11.js +121 -11
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index12.js +100 -11
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +39 -27
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index14.js +2 -205
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index15.js +11 -52
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index16.js +11 -210
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index17.js +27 -159
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index18.js +203 -14
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index19.js +51 -22
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index20.js +210 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index21.js +154 -111
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index22.js +15 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index23.js +21 -195
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index24.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index25.js +116 -53
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index26.js +3 -22
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index27.js +197 -8
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index28.js +2 -78
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index29.js +53 -39
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index30.js +20 -17
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index31.js +8 -41
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index32.js +73 -25
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index33.js +36 -17
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index34.js +17 -9
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index35.js +39 -34
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index36.js +29 -14
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index37.js +18 -24
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index38.js +8 -85
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index39.js +33 -490
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index40.js +15 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index41.js +22 -42
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index42.js +82 -65
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index43.js +475 -426
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index44.js +2 -226
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index45.js +46 -21
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index46.js +69 -5
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index47.js +445 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index48.js +208 -246
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index49.js +22 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index50.js +5 -129
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index52.js +247 -222
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index53.js +1 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index54.js +125 -242
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index55.js +23 -56
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index56.js +229 -209
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index57.js +3 -47
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index58.js +248 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index59.js +60 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index6.js +2 -17
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index60.js +194 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index61.js +47 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index7.js +53 -117
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index8.js +9 -99
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index9.js +3 -40
- package/dist/libs/tesouro-embedded-components-react/shared/expense-requirements/feature/dist/lib/ExpenseRequirementsWidget.js +41 -32
- package/dist/libs/tesouro-embedded-components-react/shared/expense-requirements/ui/dist/index3.js +43 -53
- 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/ui/dist/index.js +3 -1
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/CopyAddress/CopyAddress.js +55 -0
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/UploadTray/UploadTray.js +84 -0
- package/dist/libs/tesouro-embedded-components-react/upload-receipt-widget/feature/dist/lib/UploadReceiptWidget.js +126 -73
- package/dist/libs/tesouro-embedded-components-react/upload-receipt-widget/ui/dist/index2.js +14 -1
- package/dist/libs/tesouro-embedded-components-react/upload-receipt-widget/ui/dist/index3.js +9 -8
- package/dist/libs/tesouro-embedded-components-react/upload-receipt-widget/ui/dist/index4.js +75 -128
- package/dist/packages/shared-ui-shadcn/dist/index.js +1399 -1302
- package/package.json +1 -1
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/ExpenseStatusBadge/badgeTones.js +0 -9
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index51.js +0 -27
|
@@ -10,17 +10,17 @@ import { isOrganizationOnItsWay as r } from "../../../../shared/data-access/dist
|
|
|
10
10
|
import { useEmbedApi as i } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
|
|
11
11
|
import "../../../../shared/data-access/dist/index.js";
|
|
12
12
|
import "../../../../shared/ui/dist/index.js";
|
|
13
|
-
import { useWidgetConfig as a, useWidgetLoading as
|
|
13
|
+
import { useWidgetConfig as a, useWidgetLoading as o } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
14
14
|
import "../../../../shared/feature/dist/index.js";
|
|
15
|
-
import { useGetTransactionsQuery as
|
|
16
|
-
import { usePatchReceiptMutation as
|
|
15
|
+
import { useGetTransactionsQuery as s } from "../../../data-access/dist/lib/useGetTransactionsQuery.js";
|
|
16
|
+
import { usePatchReceiptMutation as ee } from "../../../data-access/dist/lib/usePatchReceiptMutation.js";
|
|
17
17
|
import "../../../data-access/dist/index.js";
|
|
18
|
-
import { ReceiptMatchLabels as
|
|
18
|
+
import { ReceiptMatchLabels as c } from "../../ui/dist/index2.js";
|
|
19
19
|
import "../../ui/dist/index.js";
|
|
20
|
-
import { useGetReceiptsQuery as
|
|
21
|
-
import { useDeleteReceiptMutation as
|
|
20
|
+
import { useGetReceiptsQuery as te } from "../../data-access/dist/index2.js";
|
|
21
|
+
import { useDeleteReceiptMutation as ne } from "../../data-access/dist/index3.js";
|
|
22
22
|
import "../../data-access/dist/index.js";
|
|
23
|
-
import { useCallback as
|
|
23
|
+
import { useCallback as l, useEffect as re, useMemo as u, useState as d } from "react";
|
|
24
24
|
// ../../libs/tesouro-embedded-components-react/expense-management-widget/receipt-match/feature/dist/index2.js
|
|
25
25
|
function f(e, t) {
|
|
26
26
|
if (typeof e == "object" && e) {
|
|
@@ -53,20 +53,19 @@ function ie(e) {
|
|
|
53
53
|
return Number.isNaN(t.getTime()) ? "" : t.toLocaleTimeString("en-US", {
|
|
54
54
|
hour: "numeric",
|
|
55
55
|
minute: "2-digit",
|
|
56
|
-
second: "2-digit",
|
|
57
56
|
hour12: !0
|
|
58
57
|
});
|
|
59
58
|
}
|
|
60
|
-
function
|
|
59
|
+
function ae(e) {
|
|
61
60
|
let t = e.ocr_status === "processing";
|
|
62
61
|
return {
|
|
63
62
|
id: e.id,
|
|
64
|
-
primaryText: t ?
|
|
65
|
-
secondaryText: t ?
|
|
63
|
+
primaryText: t ? c.ReceiptScanningTitle : e.merchant_name?.trim() || c.ReceiptScanningTitle,
|
|
64
|
+
secondaryText: t ? c.ReceiptScanningSubtitle : h(e.issued_at),
|
|
66
65
|
thumbnailUrl: e.file_url ?? void 0
|
|
67
66
|
};
|
|
68
67
|
}
|
|
69
|
-
function
|
|
68
|
+
function oe(e) {
|
|
70
69
|
return {
|
|
71
70
|
id: e.id,
|
|
72
71
|
merchantName: e.merchant_name,
|
|
@@ -74,55 +73,54 @@ function ae(e) {
|
|
|
74
73
|
formattedAmount: p(e.amount, e.currency)
|
|
75
74
|
};
|
|
76
75
|
}
|
|
77
|
-
var
|
|
76
|
+
var g = .5, _ = 3, v = .25, y = 5e3, b = !1;
|
|
78
77
|
function x({ preSelectedIds: t, onClose: m, targetTransactionId: h, onSingleTransactionUpdate: x, enabled: S = !0 }) {
|
|
79
|
-
let { initResponse: C } = a(), w =
|
|
78
|
+
let { initResponse: C } = a(), w = o(), se = r(i().organizationStatus), T = C?.userId ?? void 0, ce = S && !!T && !w, [E, D] = d(1), [O, k] = d(0), [A, j] = d([]), [M, N] = d(() => t), [P, F] = d(""), [I, L] = d([]), le = u(() => I.map((e) => e.id), [I]), [R, z] = d(1), B = te({
|
|
80
79
|
has_transaction: !1,
|
|
81
80
|
created_by_entity_user_id: T,
|
|
82
81
|
enabled: ce
|
|
83
|
-
}), V =
|
|
82
|
+
}), V = s({
|
|
84
83
|
merchant_name__icontains: P || void 0,
|
|
85
84
|
has_receipt: !1,
|
|
86
85
|
enabled: E === 2
|
|
87
|
-
}), H =
|
|
88
|
-
|
|
86
|
+
}), H = ee(), U = ne(), W = B.data?.data ?? [], G = u(() => T ? W.filter((e) => e.created_by_entity_user_id == null || e.created_by_entity_user_id === T) : [], [W, T]);
|
|
87
|
+
re(() => {
|
|
89
88
|
if (!G.some((e) => e.ocr_status === "processing")) return;
|
|
90
89
|
let e = window.setInterval(() => {
|
|
91
90
|
B.isFetching || B.refetch();
|
|
92
|
-
},
|
|
91
|
+
}, y);
|
|
93
92
|
return () => window.clearInterval(e);
|
|
94
93
|
}, [
|
|
95
94
|
B.isFetching,
|
|
96
95
|
B.refetch,
|
|
97
96
|
G
|
|
98
97
|
]);
|
|
99
|
-
let K = u(() => G.map(
|
|
98
|
+
let K = u(() => G.map(ae), [G]), q = u(() => new Set(A.flatMap((e) => e.transactionIds)), [A]), ue = u(() => (V.data?.data ?? []).filter((e) => !q.has(e.id)).map(oe), [V.data, q]), J = V.data?.data ?? [], Y = M[O], X = u(() => G.find((e) => e.id === Y), [G, Y]), de = X?.file_url ?? void 0, fe = X?.file_name ?? void 0, Z = u(() => {
|
|
100
99
|
if (h) return "Attach";
|
|
101
100
|
if (!(M.length <= 1)) return `Review (${O + 1}/${M.length})`;
|
|
102
101
|
}, [
|
|
103
102
|
h,
|
|
104
103
|
M.length,
|
|
105
104
|
O
|
|
106
|
-
]), pe = u(() => A.filter((e) => e.receiptId === Y).flatMap((e) => e.transactionDetails), [A, Y]), me = O >= M.length - 1 ?
|
|
105
|
+
]), pe = u(() => A.filter((e) => e.receiptId === Y).flatMap((e) => e.transactionDetails), [A, Y]), me = O >= M.length - 1 ? c.Done : c.ReviewNextReceipt(O + 2, M.length), Q = l(() => {
|
|
107
106
|
F(""), L([]), z(1);
|
|
108
|
-
}, []), he =
|
|
107
|
+
}, []), he = l((e) => {
|
|
109
108
|
N(h ? (t) => t.includes(e) ? [] : [e] : (t) => t.includes(e) ? t.filter((t) => t !== e) : [...t, e]);
|
|
110
|
-
}, [h]), ge =
|
|
109
|
+
}, [h]), ge = l(() => {
|
|
111
110
|
N(K.map((e) => e.id));
|
|
112
|
-
}, [K]), _e =
|
|
111
|
+
}, [K]), _e = l(() => {
|
|
113
112
|
N([]);
|
|
114
|
-
}, []), ve =
|
|
113
|
+
}, []), ve = l((e) => {
|
|
115
114
|
let t = G.find((t) => t.id === e);
|
|
116
115
|
t?.file_url && window.open(t.file_url, "_blank", "noopener,noreferrer");
|
|
117
|
-
}, [G]), ye =
|
|
116
|
+
}, [G]), ye = l(async (e) => {
|
|
118
117
|
try {
|
|
119
|
-
await U.mutateAsync({ path: { receipt_id:
|
|
120
|
-
} catch
|
|
121
|
-
|
|
122
|
-
return;
|
|
118
|
+
await U.mutateAsync({ path: { receipt_id: e } });
|
|
119
|
+
} catch {
|
|
120
|
+
return !1;
|
|
123
121
|
}
|
|
124
|
-
N((
|
|
125
|
-
}, [U]), be =
|
|
122
|
+
return N((t) => t.filter((t) => t !== e)), !0;
|
|
123
|
+
}, [U]), be = l(async () => {
|
|
126
124
|
if (M.length !== 0) {
|
|
127
125
|
if (h) try {
|
|
128
126
|
await H.mutateAsync({
|
|
@@ -141,16 +139,16 @@ function x({ preSelectedIds: t, onClose: m, targetTransactionId: h, onSingleTran
|
|
|
141
139
|
x,
|
|
142
140
|
m,
|
|
143
141
|
Q
|
|
144
|
-
]), xe =
|
|
142
|
+
]), xe = l(() => {
|
|
145
143
|
B.refetch();
|
|
146
|
-
}, [B.refetch]), Se =
|
|
144
|
+
}, [B.refetch]), Se = l((e) => {
|
|
147
145
|
F(e);
|
|
148
|
-
}, []), Ce =
|
|
146
|
+
}, []), Ce = l((e) => {
|
|
149
147
|
L((t) => {
|
|
150
148
|
let n = t.find((t) => t.id === e), r = J.find((t) => t.id === e);
|
|
151
149
|
return n ? [] : r ? [r] : [];
|
|
152
150
|
});
|
|
153
|
-
}, [J]), we =
|
|
151
|
+
}, [J]), we = l(async () => {
|
|
154
152
|
if (I.length === 0 || !Y) return;
|
|
155
153
|
let t = I, r = (e) => ({
|
|
156
154
|
merchant: e.merchant_name,
|
|
@@ -181,19 +179,19 @@ function x({ preSelectedIds: t, onClose: m, targetTransactionId: h, onSingleTran
|
|
|
181
179
|
I,
|
|
182
180
|
Y,
|
|
183
181
|
H
|
|
184
|
-
]), Te =
|
|
182
|
+
]), Te = l(() => {
|
|
185
183
|
V.refetch();
|
|
186
|
-
}, [V.refetch]), Ee =
|
|
187
|
-
z((e) => Math.min(e +
|
|
188
|
-
}, []), De =
|
|
189
|
-
z((e) => Math.max(e -
|
|
190
|
-
}, []), $ =
|
|
184
|
+
}, [V.refetch]), Ee = l(() => {
|
|
185
|
+
z((e) => Math.min(e + v, _));
|
|
186
|
+
}, []), De = l(() => {
|
|
187
|
+
z((e) => Math.max(e - v, g));
|
|
188
|
+
}, []), $ = l(() => {
|
|
191
189
|
if (A.length > 0) {
|
|
192
190
|
let e = new Set(A.map((e) => e.receiptId));
|
|
193
191
|
N((t) => t.filter((t) => !e.has(t)));
|
|
194
192
|
}
|
|
195
193
|
Q(), k(0), j([]), D(1);
|
|
196
|
-
}, [Q, A]), Oe =
|
|
194
|
+
}, [Q, A]), Oe = l(() => {
|
|
197
195
|
let e = O + 1;
|
|
198
196
|
e < M.length ? (k(e), Q(), D(2)) : ($(), m());
|
|
199
197
|
}, [
|
|
@@ -212,6 +210,7 @@ function x({ preSelectedIds: t, onClose: m, targetTransactionId: h, onSingleTran
|
|
|
212
210
|
onReceiptToggle: he,
|
|
213
211
|
onViewAttachment: ve,
|
|
214
212
|
onDeleteReceipt: ye,
|
|
213
|
+
isDeletingReceipt: U.isPending,
|
|
215
214
|
onReview: be,
|
|
216
215
|
isReceiptsLoading: B.isLoading || w && !C || se && !B.data,
|
|
217
216
|
isReceiptsError: B.isError,
|
|
@@ -233,8 +232,8 @@ function x({ preSelectedIds: t, onClose: m, targetTransactionId: h, onSingleTran
|
|
|
233
232
|
zoom: R,
|
|
234
233
|
onZoomIn: Ee,
|
|
235
234
|
onZoomOut: De,
|
|
236
|
-
canZoomIn: R <
|
|
237
|
-
canZoomOut: R >
|
|
235
|
+
canZoomIn: R < _,
|
|
236
|
+
canZoomOut: R > g,
|
|
238
237
|
matchedTransactions: pe,
|
|
239
238
|
primaryLabel: me,
|
|
240
239
|
onPrimary: Oe,
|
|
@@ -2,63 +2,102 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
5
|
+
import { ConfirmDialog as e } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
6
|
+
import { EmbeddedToaster as t } from "../../../../shared/ui/dist/lib/EmbeddedToaster.js";
|
|
7
|
+
import { InlineErrorAlert as n } from "../../../../shared/ui/dist/lib/InlineErrorAlert/InlineErrorAlert.js";
|
|
6
8
|
import "../../../../shared/ui/dist/index.js";
|
|
7
|
-
import { useAnalyticsTrack as
|
|
8
|
-
import { WidgetProvider as
|
|
9
|
+
import { useAnalyticsTrack as r } from "../../../../shared/feature/dist/lib/analytics/hooks.js";
|
|
10
|
+
import { WidgetProvider as i } from "../../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
|
|
9
11
|
import "../../../../shared/feature/dist/index.js";
|
|
10
|
-
import {
|
|
12
|
+
import { ReceiptMatchLabels as a } from "../../ui/dist/index2.js";
|
|
13
|
+
import { ReceiptMatchSidebar as o } from "../../ui/dist/index7.js";
|
|
11
14
|
import "../../ui/dist/index.js";
|
|
12
|
-
import { useReceiptMatch as
|
|
13
|
-
import { ReceiptMatchAnalyticsEvent as
|
|
14
|
-
import { useCallback as
|
|
15
|
-
import { Fragment as
|
|
15
|
+
import { useReceiptMatch as s } from "./index2.js";
|
|
16
|
+
import { ReceiptMatchAnalyticsEvent as c, WIDGET_NAME as l } from "./index3.js";
|
|
17
|
+
import { useCallback as u, useEffect as d, useState as f } from "react";
|
|
18
|
+
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
16
19
|
// ../../libs/tesouro-embedded-components-react/expense-management-widget/receipt-match/feature/dist/index4.js
|
|
17
|
-
function
|
|
18
|
-
let
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}, [
|
|
22
|
-
let
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
20
|
+
function g({ isOpen: i = !1, preSelectedReceiptIds: l = [], onClose: g, targetTransactionId: _, onSingleTransactionUpdate: v, onFilesDropped: y }) {
|
|
21
|
+
let b = r();
|
|
22
|
+
d(() => {
|
|
23
|
+
b(c.Mounted);
|
|
24
|
+
}, [b]);
|
|
25
|
+
let [x, S] = f(null), [C, w] = f(!1);
|
|
26
|
+
d(() => {
|
|
27
|
+
i || (S(null), w(!1));
|
|
28
|
+
}, [i]);
|
|
29
|
+
let T = s({
|
|
30
|
+
preSelectedIds: l,
|
|
31
|
+
onClose: g,
|
|
32
|
+
targetTransactionId: _,
|
|
33
|
+
onSingleTransactionUpdate: v,
|
|
34
|
+
enabled: i
|
|
35
|
+
}), E = u(() => {
|
|
36
|
+
T.onCancel(), g();
|
|
37
|
+
}, [T.onCancel, g]), D = T.receipts.find((e) => e.id === x), O = async () => {
|
|
38
|
+
x && !T.isDeletingReceipt && (w(!1), await T.onDeleteReceipt(x) ? S(null) : w(!0));
|
|
39
|
+
};
|
|
40
|
+
return /* @__PURE__ */ h(p, { children: [
|
|
41
|
+
/* @__PURE__ */ m(t, {}),
|
|
42
|
+
/* @__PURE__ */ m(e, {
|
|
43
|
+
open: x !== null,
|
|
44
|
+
onOpenChange: (e) => {
|
|
45
|
+
!e && !T.isDeletingReceipt && (S(null), w(!1));
|
|
46
|
+
},
|
|
47
|
+
title: a.DeleteReceiptTitle,
|
|
48
|
+
destructive: !0,
|
|
49
|
+
loading: T.isDeletingReceipt,
|
|
50
|
+
labels: {
|
|
51
|
+
confirm: a.DeleteReceipt,
|
|
52
|
+
cancel: a.Cancel
|
|
53
|
+
},
|
|
54
|
+
details: D ? [{
|
|
55
|
+
label: a.Merchant,
|
|
56
|
+
value: D.primaryText
|
|
57
|
+
}, {
|
|
58
|
+
label: a.Date,
|
|
59
|
+
value: D.secondaryText
|
|
60
|
+
}] : void 0,
|
|
61
|
+
onConfirm: () => void O(),
|
|
62
|
+
children: C && /* @__PURE__ */ m(n, { children: a.DeleteReceiptFailed })
|
|
63
|
+
}),
|
|
64
|
+
/* @__PURE__ */ m(o, {
|
|
65
|
+
open: i,
|
|
66
|
+
onClose: E,
|
|
67
|
+
...T,
|
|
68
|
+
onFilesDropped: y,
|
|
69
|
+
onDeleteReceipt: (e) => {
|
|
70
|
+
w(!1), S(e);
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
] });
|
|
36
74
|
}
|
|
37
|
-
function
|
|
38
|
-
let [r, i] =
|
|
39
|
-
|
|
75
|
+
function _({ isOpen: e, onClose: t, ...n }) {
|
|
76
|
+
let [r, i] = f(!!e);
|
|
77
|
+
d(() => {
|
|
40
78
|
i(!!e);
|
|
41
79
|
}, [e]);
|
|
42
|
-
let a =
|
|
80
|
+
let a = u(() => {
|
|
43
81
|
i(!1), t?.();
|
|
44
82
|
}, [t]);
|
|
45
|
-
return /* @__PURE__ */
|
|
83
|
+
return /* @__PURE__ */ m(g, {
|
|
46
84
|
isOpen: r,
|
|
47
85
|
onClose: a,
|
|
48
86
|
...n
|
|
49
87
|
});
|
|
50
88
|
}
|
|
51
|
-
function
|
|
52
|
-
return /* @__PURE__ */
|
|
89
|
+
function v({ isOpen: e, preSelectedReceiptIds: t, onClose: n, targetTransactionId: r, onSingleTransactionUpdate: a, onFilesDropped: o, ...s }) {
|
|
90
|
+
return /* @__PURE__ */ m(i, {
|
|
53
91
|
...s,
|
|
54
|
-
widgetName:
|
|
55
|
-
children: /* @__PURE__ */
|
|
92
|
+
widgetName: l,
|
|
93
|
+
children: /* @__PURE__ */ m(_, {
|
|
56
94
|
isOpen: e,
|
|
57
95
|
preSelectedReceiptIds: t,
|
|
58
|
-
onClose:
|
|
59
|
-
targetTransactionId:
|
|
60
|
-
onSingleTransactionUpdate: a
|
|
96
|
+
onClose: n,
|
|
97
|
+
targetTransactionId: r,
|
|
98
|
+
onSingleTransactionUpdate: a,
|
|
99
|
+
onFilesDropped: o
|
|
61
100
|
})
|
|
62
101
|
});
|
|
63
102
|
}
|
|
64
|
-
export {
|
|
103
|
+
export { v as ReceiptMatchWidget };
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
// ../../libs/tesouro-embedded-components-react/expense-management-widget/receipt-match/ui/dist/index2.js
|
|
2
2
|
var e = {
|
|
3
3
|
ReceiptPdfPreviewTitle: "Receipt PDF preview",
|
|
4
|
+
FlowTitle: "Match receipts",
|
|
5
|
+
DropReceipts: "Drop to upload receipts",
|
|
6
|
+
DropReceiptRules: "PDF, PNG or JPG, 10 files at a time",
|
|
7
|
+
Step: (e) => `Step ${e} of 2`,
|
|
4
8
|
DialogTitle: "Match receipt to transaction",
|
|
5
9
|
DialogDescription: "Select a transaction to match with the selected receipt.",
|
|
6
10
|
InboxTitle: "Receipt inbox",
|
|
@@ -12,9 +16,15 @@ var e = {
|
|
|
12
16
|
Back: "Back",
|
|
13
17
|
Review: "Review",
|
|
14
18
|
ViewAttachment: "View attachment",
|
|
19
|
+
MoreActions: "More actions",
|
|
20
|
+
SelectReceipt: (e) => `Select receipt from ${e}`,
|
|
21
|
+
SelectTransaction: (e) => `Select transaction from ${e}`,
|
|
15
22
|
ThumbnailPdfAlt: "PDF receipt",
|
|
16
23
|
ThumbnailMissingAlt: "No preview available",
|
|
17
24
|
Delete: "Delete",
|
|
25
|
+
DeleteReceiptTitle: "Delete receipt?",
|
|
26
|
+
DeleteReceipt: "Delete receipt",
|
|
27
|
+
DeleteReceiptFailed: "Couldn’t delete receipt",
|
|
18
28
|
TransactionsTitle: "Transactions without receipt",
|
|
19
29
|
SearchPlaceholder: "Search",
|
|
20
30
|
ConfirmMatch: "Confirm match",
|
|
@@ -2,88 +2,89 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import { Button as e,
|
|
6
|
-
import { ReceiptMatchLabels as
|
|
7
|
-
import { jsx as
|
|
8
|
-
import { FileText as
|
|
5
|
+
import { Button as e, Checkbox as t, DropdownMenu as n, DropdownMenuContent as r, DropdownMenuItem as i, DropdownMenuTrigger as a, Tooltip as o, TooltipContent as s, TooltipProvider as c, TooltipTrigger as l } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
6
|
+
import { ReceiptMatchLabels as u } from "./index2.js";
|
|
7
|
+
import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
8
|
+
import { FileText as p, ImageOff as m, MoreVertical as h, Search as g, Trash2 as _ } from "lucide-react";
|
|
9
9
|
// ../../libs/tesouro-embedded-components-react/expense-management-widget/receipt-match/ui/dist/index3.js
|
|
10
|
-
function
|
|
10
|
+
function v(e) {
|
|
11
11
|
if (!e) return "missing";
|
|
12
12
|
let t = e.split(/[?#]/)[0].toLowerCase();
|
|
13
13
|
return /\.pdf$/.test(t) ? "pdf" : "image";
|
|
14
14
|
}
|
|
15
|
-
function
|
|
16
|
-
let n =
|
|
17
|
-
return /* @__PURE__ */
|
|
15
|
+
function y({ url: e, alt: t }) {
|
|
16
|
+
let n = v(e);
|
|
17
|
+
return /* @__PURE__ */ d("div", {
|
|
18
18
|
className: "ttw:w-10 ttw:h-10 ttw:rounded ttw:overflow-hidden ttw:flex-shrink-0 ttw:bg-muted ttw:flex ttw:items-center ttw:justify-center",
|
|
19
|
-
children: n === "image" && e ? /* @__PURE__ */
|
|
19
|
+
children: n === "image" && e ? /* @__PURE__ */ d("img", {
|
|
20
20
|
src: e,
|
|
21
21
|
alt: t,
|
|
22
22
|
className: "ttw:w-full ttw:h-full ttw:object-cover"
|
|
23
|
-
}) : n === "pdf" ? /* @__PURE__ */
|
|
23
|
+
}) : n === "pdf" ? /* @__PURE__ */ d(p, {
|
|
24
24
|
size: 18,
|
|
25
25
|
className: "ttw:text-muted-foreground",
|
|
26
|
-
"aria-label":
|
|
27
|
-
}) : /* @__PURE__ */
|
|
26
|
+
"aria-label": u.ThumbnailPdfAlt
|
|
27
|
+
}) : /* @__PURE__ */ d(m, {
|
|
28
28
|
size: 18,
|
|
29
29
|
className: "ttw:text-muted-foreground",
|
|
30
|
-
"aria-label":
|
|
30
|
+
"aria-label": u.ThumbnailMissingAlt
|
|
31
31
|
})
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
-
function
|
|
35
|
-
return /* @__PURE__ */
|
|
34
|
+
function b({ item: p, selected: m, onToggle: v, onViewAttachment: b, onDelete: x }) {
|
|
35
|
+
return /* @__PURE__ */ f("div", {
|
|
36
36
|
className: "ttw:flex ttw:items-center ttw:gap-3 ttw:px-3 ttw:py-2 ttw:rounded-lg ttw:border ttw:border-border ttw:bg-card ttw:hover:bg-muted/30 ttw:transition-colors",
|
|
37
|
-
children: [/* @__PURE__ */
|
|
37
|
+
children: [/* @__PURE__ */ f("label", {
|
|
38
38
|
className: "ttw:flex ttw:items-center ttw:gap-3 ttw:flex-1 ttw:min-w-0 ttw:cursor-pointer",
|
|
39
39
|
children: [
|
|
40
|
-
/* @__PURE__ */
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
"aria-label": `Select receipt from ${c.primaryText}`,
|
|
45
|
-
className: "ttw:h-4 ttw:w-4 ttw:rounded ttw:border ttw:border-input ttw:accent-primary ttw:cursor-pointer"
|
|
40
|
+
/* @__PURE__ */ d(t, {
|
|
41
|
+
checked: m,
|
|
42
|
+
onCheckedChange: v,
|
|
43
|
+
"aria-label": u.SelectReceipt(p.primaryText)
|
|
46
44
|
}),
|
|
47
|
-
/* @__PURE__ */
|
|
48
|
-
url:
|
|
49
|
-
alt:
|
|
45
|
+
/* @__PURE__ */ d(y, {
|
|
46
|
+
url: p.thumbnailUrl,
|
|
47
|
+
alt: p.primaryText
|
|
50
48
|
}),
|
|
51
|
-
/* @__PURE__ */
|
|
49
|
+
/* @__PURE__ */ f("div", {
|
|
52
50
|
className: "ttw:flex ttw:flex-col ttw:flex-1 ttw:min-w-0",
|
|
53
|
-
children: [/* @__PURE__ */
|
|
51
|
+
children: [/* @__PURE__ */ d("span", {
|
|
54
52
|
className: "ttw:text-sm ttw:font-medium ttw:truncate",
|
|
55
|
-
children:
|
|
56
|
-
}), /* @__PURE__ */
|
|
53
|
+
children: p.primaryText
|
|
54
|
+
}), /* @__PURE__ */ d("span", {
|
|
57
55
|
className: "ttw:text-xs ttw:text-muted-foreground",
|
|
58
|
-
children:
|
|
56
|
+
children: p.secondaryText
|
|
59
57
|
})]
|
|
60
58
|
})
|
|
61
59
|
]
|
|
62
|
-
}), /* @__PURE__ */
|
|
60
|
+
}), /* @__PURE__ */ f(n, { children: [/* @__PURE__ */ d(c, { children: /* @__PURE__ */ f(o, { children: [/* @__PURE__ */ d(l, {
|
|
63
61
|
asChild: !0,
|
|
64
|
-
children: /* @__PURE__ */
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
62
|
+
children: /* @__PURE__ */ d(a, {
|
|
63
|
+
asChild: !0,
|
|
64
|
+
children: /* @__PURE__ */ d(e, {
|
|
65
|
+
variant: "ghost",
|
|
66
|
+
size: "icon-sm",
|
|
67
|
+
"aria-label": u.MoreActions,
|
|
68
|
+
children: /* @__PURE__ */ d(h, { size: 16 })
|
|
69
|
+
})
|
|
69
70
|
})
|
|
70
|
-
}), /* @__PURE__ */ s(
|
|
71
|
+
}), /* @__PURE__ */ d(s, { children: u.MoreActions })] }) }), /* @__PURE__ */ f(r, {
|
|
71
72
|
align: "end",
|
|
72
|
-
children: [/* @__PURE__ */
|
|
73
|
-
onClick:
|
|
74
|
-
children: [/* @__PURE__ */
|
|
73
|
+
children: [/* @__PURE__ */ f(i, {
|
|
74
|
+
onClick: b,
|
|
75
|
+
children: [/* @__PURE__ */ d(g, {
|
|
75
76
|
size: 14,
|
|
76
77
|
className: "ttw:mr-2"
|
|
77
|
-
}),
|
|
78
|
-
}), /* @__PURE__ */
|
|
78
|
+
}), u.ViewAttachment]
|
|
79
|
+
}), /* @__PURE__ */ f(i, {
|
|
79
80
|
variant: "destructive",
|
|
80
|
-
onClick:
|
|
81
|
-
children: [/* @__PURE__ */
|
|
81
|
+
onClick: x,
|
|
82
|
+
children: [/* @__PURE__ */ d(_, {
|
|
82
83
|
size: 14,
|
|
83
84
|
className: "ttw:mr-2"
|
|
84
|
-
}),
|
|
85
|
+
}), u.Delete]
|
|
85
86
|
})]
|
|
86
87
|
})] })]
|
|
87
88
|
});
|
|
88
89
|
}
|
|
89
|
-
export {
|
|
90
|
+
export { b as ReceiptInboxItem };
|