@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.
Files changed (119) hide show
  1. package/README.md +6 -3
  2. package/dist/index.css +32 -161
  3. package/dist/index.d.ts +40 -8
  4. package/dist/index.js +29 -28
  5. package/dist/lib/ExpenseManagementWidget.d.ts +11 -2
  6. package/dist/lib/ReceivablesWidget.d.ts +29 -6
  7. package/dist/lib/ReceivablesWidget.js +3 -1
  8. package/dist/lib/WidgetSuite.d.ts +38 -6
  9. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/lib/ExpenseManagementWidget/ExpenseManagementWidget.js +343 -264
  10. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/lib/ExpenseManagementWidget/labels.js +14 -0
  11. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/lib/ExpenseManagementWidget/permissions.js +6 -3
  12. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/lib/ExpenseManagementWidget/useExpenseTabBadgeCounts.js +34 -19
  13. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/lib/ExpenseManagementWidget/useExpensesTransactions.js +100 -98
  14. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/lib/TransactionDetails/TransactionDetailsActionsFeature.js +27 -24
  15. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/lib/TransactionDetails/TransactionDetailsFeature.js +1 -0
  16. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/lib/expenseStatus.js +2 -2
  17. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/receipt-match/feature/dist/index2.js +43 -44
  18. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/receipt-match/feature/dist/index4.js +79 -40
  19. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/receipt-match/ui/dist/index2.js +10 -0
  20. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/receipt-match/ui/dist/index3.js +47 -46
  21. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/receipt-match/ui/dist/index4.js +78 -84
  22. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/receipt-match/ui/dist/index5.js +165 -158
  23. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/receipt-match/ui/dist/index6.js +38 -100
  24. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/receipt-match/ui/dist/index7.js +77 -54
  25. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/AccordionItemCard/AccordionItemCard.js +213 -229
  26. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/ExpenseStatusBadge/ExpenseStatusBadge.js +6 -8
  27. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/ExpensesScreen/ExpensesScreen.js +66 -73
  28. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/ExpensesTransactionsFilterBar/ExpensesTransactionsFilterBar.js +13 -13
  29. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/ExpensesTransactionsTable/ExpensesTransactionsTable.js +123 -80
  30. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/ExpensesTransactionsTable/labels.js +1 -0
  31. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/FileViewer/FileViewer.js +83 -74
  32. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/TransactionDetails/DeleteReceiptDialog/DeleteReceiptDialog.js +22 -30
  33. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/TransactionDetails/TransactionDetails.js +176 -259
  34. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/TransactionDetails/labels.js +4 -2
  35. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/TransactionDetailsActions/BulkProgress.js +1 -0
  36. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/TransactionDetailsActions/TransactionDetailsActions.js +112 -121
  37. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/TransactionDetailsActions/labels.js +1 -0
  38. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index.js +3 -1
  39. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivableAttachmentsSection.js +1 -1
  40. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivableCustomerSection.js +1 -1
  41. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +342 -295
  42. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/paymentTerms.js +1 -1
  43. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/preview.js +1 -1
  44. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/recurrence.js +1 -1
  45. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/reminders.js +1 -1
  46. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/tabs.js +26 -0
  47. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableDetails.js +1 -1
  48. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableForm.js +1 -1
  49. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/mocks/labels.js +1 -1
  50. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +30 -26
  51. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index10.js +18 -2
  52. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index11.js +121 -11
  53. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index12.js +100 -11
  54. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +39 -27
  55. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index14.js +2 -205
  56. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index15.js +11 -52
  57. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index16.js +11 -210
  58. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index17.js +27 -159
  59. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index18.js +203 -14
  60. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index19.js +51 -22
  61. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index20.js +210 -2
  62. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index21.js +154 -111
  63. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index22.js +15 -3
  64. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index23.js +21 -195
  65. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index24.js +3 -2
  66. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index25.js +116 -53
  67. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index26.js +3 -22
  68. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index27.js +197 -8
  69. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index28.js +2 -78
  70. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index29.js +53 -39
  71. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index30.js +20 -17
  72. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index31.js +8 -41
  73. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index32.js +73 -25
  74. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index33.js +36 -17
  75. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index34.js +17 -9
  76. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index35.js +39 -34
  77. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index36.js +29 -14
  78. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index37.js +18 -24
  79. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index38.js +8 -85
  80. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index39.js +33 -490
  81. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index40.js +15 -2
  82. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index41.js +22 -42
  83. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index42.js +82 -65
  84. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index43.js +475 -426
  85. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index44.js +2 -226
  86. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index45.js +46 -21
  87. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index46.js +69 -5
  88. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index47.js +445 -0
  89. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index48.js +208 -246
  90. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index49.js +22 -2
  91. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index50.js +5 -129
  92. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index52.js +247 -222
  93. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index53.js +1 -2
  94. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index54.js +125 -242
  95. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index55.js +23 -56
  96. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index56.js +229 -209
  97. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index57.js +3 -47
  98. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index58.js +248 -0
  99. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index59.js +60 -0
  100. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index6.js +2 -17
  101. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index60.js +194 -0
  102. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index61.js +47 -0
  103. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index7.js +53 -117
  104. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index8.js +9 -99
  105. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index9.js +3 -40
  106. package/dist/libs/tesouro-embedded-components-react/shared/expense-requirements/feature/dist/lib/ExpenseRequirementsWidget.js +41 -32
  107. package/dist/libs/tesouro-embedded-components-react/shared/expense-requirements/ui/dist/index3.js +43 -53
  108. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  109. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/index.js +3 -1
  110. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/CopyAddress/CopyAddress.js +55 -0
  111. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/UploadTray/UploadTray.js +84 -0
  112. package/dist/libs/tesouro-embedded-components-react/upload-receipt-widget/feature/dist/lib/UploadReceiptWidget.js +126 -73
  113. package/dist/libs/tesouro-embedded-components-react/upload-receipt-widget/ui/dist/index2.js +14 -1
  114. package/dist/libs/tesouro-embedded-components-react/upload-receipt-widget/ui/dist/index3.js +9 -8
  115. package/dist/libs/tesouro-embedded-components-react/upload-receipt-widget/ui/dist/index4.js +75 -128
  116. package/dist/packages/shared-ui-shadcn/dist/index.js +1399 -1302
  117. package/package.json +1 -1
  118. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/ExpenseStatusBadge/badgeTones.js +0 -9
  119. 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 ee } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
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 te } from "../../../data-access/dist/lib/useGetTransactionsQuery.js";
16
- import { usePatchReceiptMutation as ne } from "../../../data-access/dist/lib/usePatchReceiptMutation.js";
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 o } from "../../ui/dist/index2.js";
18
+ import { ReceiptMatchLabels as c } from "../../ui/dist/index2.js";
19
19
  import "../../ui/dist/index.js";
20
- import { useGetReceiptsQuery as s } from "../../data-access/dist/index2.js";
21
- import { useDeleteReceiptMutation as re } from "../../data-access/dist/index3.js";
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 c, useEffect as l, useMemo as u, useState as d } from "react";
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 g(e) {
59
+ function ae(e) {
61
60
  let t = e.ocr_status === "processing";
62
61
  return {
63
62
  id: e.id,
64
- primaryText: t ? o.ReceiptScanningTitle : e.merchant_name?.trim() || o.ReceiptScanningTitle,
65
- secondaryText: t ? o.ReceiptScanningSubtitle : h(e.issued_at),
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 ae(e) {
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 _ = .5, v = 3, y = .25, oe = 5e3, b = !1;
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 = ee(), 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 = s({
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 = te({
82
+ }), V = s({
84
83
  merchant_name__icontains: P || void 0,
85
84
  has_receipt: !1,
86
85
  enabled: E === 2
87
- }), H = ne(), U = re(), 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]);
88
- l(() => {
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
- }, oe);
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(g), [G]), q = u(() => new Set(A.flatMap((e) => e.transactionIds)), [A]), ue = u(() => (V.data?.data ?? []).filter((e) => !q.has(e.id)).map(ae), [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(() => {
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 ? o.Done : o.ReviewNextReceipt(O + 2, M.length), Q = c(() => {
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 = c((e) => {
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 = c(() => {
109
+ }, [h]), ge = l(() => {
111
110
  N(K.map((e) => e.id));
112
- }, [K]), _e = c(() => {
111
+ }, [K]), _e = l(() => {
113
112
  N([]);
114
- }, []), ve = c((e) => {
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 = c(async (t) => {
116
+ }, [G]), ye = l(async (e) => {
118
117
  try {
119
- await U.mutateAsync({ path: { receipt_id: t } });
120
- } catch (t) {
121
- e.error(f(t, "Failed to delete receipt"));
122
- return;
118
+ await U.mutateAsync({ path: { receipt_id: e } });
119
+ } catch {
120
+ return !1;
123
121
  }
124
- N((e) => e.filter((e) => e !== t));
125
- }, [U]), be = c(async () => {
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 = c(() => {
142
+ ]), xe = l(() => {
145
143
  B.refetch();
146
- }, [B.refetch]), Se = c((e) => {
144
+ }, [B.refetch]), Se = l((e) => {
147
145
  F(e);
148
- }, []), Ce = c((e) => {
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 = c(async () => {
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 = c(() => {
182
+ ]), Te = l(() => {
185
183
  V.refetch();
186
- }, [V.refetch]), Ee = c(() => {
187
- z((e) => Math.min(e + y, v));
188
- }, []), De = c(() => {
189
- z((e) => Math.max(e - y, _));
190
- }, []), $ = c(() => {
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 = c(() => {
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 < v,
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 { EmbeddedToaster as e } from "../../../../shared/ui/dist/lib/EmbeddedToaster.js";
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 t } from "../../../../shared/feature/dist/lib/analytics/hooks.js";
8
- import { WidgetProvider as n } from "../../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
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 { ReceiptMatchSidebar as r } from "../../ui/dist/index7.js";
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 i } from "./index2.js";
13
- import { ReceiptMatchAnalyticsEvent as a, WIDGET_NAME as o } from "./index3.js";
14
- import { useCallback as s, useEffect as c, useState as l } from "react";
15
- import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
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 p({ isOpen: n = !1, preSelectedReceiptIds: o = [], onClose: l, targetTransactionId: p, onSingleTransactionUpdate: m }) {
18
- let h = t();
19
- c(() => {
20
- h(a.Mounted);
21
- }, [h]);
22
- let g = i({
23
- preSelectedIds: o,
24
- onClose: l,
25
- targetTransactionId: p,
26
- onSingleTransactionUpdate: m,
27
- enabled: n
28
- }), _ = s(() => {
29
- g.onCancel(), l();
30
- }, [g.onCancel, l]);
31
- return /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(e, {}), /* @__PURE__ */ d(r, {
32
- open: n,
33
- onClose: _,
34
- ...g
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 m({ isOpen: e, onClose: t, ...n }) {
38
- let [r, i] = l(!!e);
39
- c(() => {
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 = s(() => {
80
+ let a = u(() => {
43
81
  i(!1), t?.();
44
82
  }, [t]);
45
- return /* @__PURE__ */ d(p, {
83
+ return /* @__PURE__ */ m(g, {
46
84
  isOpen: r,
47
85
  onClose: a,
48
86
  ...n
49
87
  });
50
88
  }
51
- function h({ isOpen: e, preSelectedReceiptIds: t, onClose: r, targetTransactionId: i, onSingleTransactionUpdate: a, ...s }) {
52
- return /* @__PURE__ */ d(n, {
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: o,
55
- children: /* @__PURE__ */ d(m, {
92
+ widgetName: l,
93
+ children: /* @__PURE__ */ m(_, {
56
94
  isOpen: e,
57
95
  preSelectedReceiptIds: t,
58
- onClose: r,
59
- targetTransactionId: i,
60
- onSingleTransactionUpdate: a
96
+ onClose: n,
97
+ targetTransactionId: r,
98
+ onSingleTransactionUpdate: a,
99
+ onFilesDropped: o
61
100
  })
62
101
  });
63
102
  }
64
- export { h as ReceiptMatchWidget };
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, DropdownMenu as t, DropdownMenuContent as n, DropdownMenuItem as r, DropdownMenuTrigger as i } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
6
- import { ReceiptMatchLabels as a } from "./index2.js";
7
- import { jsx as o, jsxs as s } from "react/jsx-runtime";
8
- import { FileText as c, ImageOff as l, MoreVertical as u, Search as d, Trash2 as f } from "lucide-react";
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 p(e) {
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 m({ url: e, alt: t }) {
16
- let n = p(e);
17
- return /* @__PURE__ */ o("div", {
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__ */ o("img", {
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__ */ o(c, {
23
+ }) : n === "pdf" ? /* @__PURE__ */ d(p, {
24
24
  size: 18,
25
25
  className: "ttw:text-muted-foreground",
26
- "aria-label": a.ThumbnailPdfAlt
27
- }) : /* @__PURE__ */ o(l, {
26
+ "aria-label": u.ThumbnailPdfAlt
27
+ }) : /* @__PURE__ */ d(m, {
28
28
  size: 18,
29
29
  className: "ttw:text-muted-foreground",
30
- "aria-label": a.ThumbnailMissingAlt
30
+ "aria-label": u.ThumbnailMissingAlt
31
31
  })
32
32
  });
33
33
  }
34
- function h({ item: c, selected: l, onToggle: p, onViewAttachment: h, onDelete: g }) {
35
- return /* @__PURE__ */ s("div", {
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__ */ s("label", {
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__ */ o("input", {
41
- type: "checkbox",
42
- checked: l,
43
- onChange: p,
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__ */ o(m, {
48
- url: c.thumbnailUrl,
49
- alt: c.primaryText
45
+ /* @__PURE__ */ d(y, {
46
+ url: p.thumbnailUrl,
47
+ alt: p.primaryText
50
48
  }),
51
- /* @__PURE__ */ s("div", {
49
+ /* @__PURE__ */ f("div", {
52
50
  className: "ttw:flex ttw:flex-col ttw:flex-1 ttw:min-w-0",
53
- children: [/* @__PURE__ */ o("span", {
51
+ children: [/* @__PURE__ */ d("span", {
54
52
  className: "ttw:text-sm ttw:font-medium ttw:truncate",
55
- children: c.primaryText
56
- }), /* @__PURE__ */ o("span", {
53
+ children: p.primaryText
54
+ }), /* @__PURE__ */ d("span", {
57
55
  className: "ttw:text-xs ttw:text-muted-foreground",
58
- children: c.secondaryText
56
+ children: p.secondaryText
59
57
  })]
60
58
  })
61
59
  ]
62
- }), /* @__PURE__ */ s(t, { children: [/* @__PURE__ */ o(i, {
60
+ }), /* @__PURE__ */ f(n, { children: [/* @__PURE__ */ d(c, { children: /* @__PURE__ */ f(o, { children: [/* @__PURE__ */ d(l, {
63
61
  asChild: !0,
64
- children: /* @__PURE__ */ o(e, {
65
- variant: "ghost",
66
- size: "sm",
67
- className: "ttw:p-1 ttw:h-auto",
68
- children: /* @__PURE__ */ o(u, { size: 16 })
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(n, {
71
+ }), /* @__PURE__ */ d(s, { children: u.MoreActions })] }) }), /* @__PURE__ */ f(r, {
71
72
  align: "end",
72
- children: [/* @__PURE__ */ s(r, {
73
- onClick: h,
74
- children: [/* @__PURE__ */ o(d, {
73
+ children: [/* @__PURE__ */ f(i, {
74
+ onClick: b,
75
+ children: [/* @__PURE__ */ d(g, {
75
76
  size: 14,
76
77
  className: "ttw:mr-2"
77
- }), a.ViewAttachment]
78
- }), /* @__PURE__ */ s(r, {
78
+ }), u.ViewAttachment]
79
+ }), /* @__PURE__ */ f(i, {
79
80
  variant: "destructive",
80
- onClick: g,
81
- children: [/* @__PURE__ */ o(f, {
81
+ onClick: x,
82
+ children: [/* @__PURE__ */ d(_, {
82
83
  size: 14,
83
84
  className: "ttw:mr-2"
84
- }), a.Delete]
85
+ }), u.Delete]
85
86
  })]
86
87
  })] })]
87
88
  });
88
89
  }
89
- export { h as ReceiptInboxItem };
90
+ export { b as ReceiptInboxItem };