@tesouro/embedded-components-react 0.5.168 → 0.5.170

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 (129) hide show
  1. package/dist/index.css +39 -17
  2. package/dist/index.js +1 -1
  3. package/dist/lib/BillPayWidget.js +1 -1
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index.js +11 -11
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index17.js +95 -80
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index7.js +37 -11
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +13 -15
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +56 -67
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js +4 -43
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +6 -115
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js +202 -63
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +2 -4
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +1 -1
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +84 -4
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +3 -84
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +5 -4
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +4 -5
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +32 -3
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +36 -30
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +167 -35
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +40 -164
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +1 -49
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +50 -1
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +11 -45
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +8 -13
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +14 -8
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +59 -7
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +8 -64
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +24 -8
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +150 -18
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +9 -152
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +25 -9
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +19 -21
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +32 -14
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +14 -39
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +8 -16
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +4 -8
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +98 -4
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +68 -83
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +3 -83
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +143 -3
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +44 -143
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +114 -45
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +189 -111
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js +13 -0
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +72 -186
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +31 -76
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +89 -32
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +406 -83
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +12 -411
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +84 -12
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +67 -72
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +222 -73
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +37 -223
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +245 -37
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +5 -23
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +23 -252
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +626 -21
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +4 -586
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +45 -4
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +256 -41
  62. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +3 -263
  63. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +4 -3
  64. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +44 -2
  65. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +1 -46
  66. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +8 -1
  67. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +22 -57
  68. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +11 -6
  69. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js +130 -11
  70. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +3 -132
  71. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +6 -3
  72. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js +129 -3
  73. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +8 -124
  74. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js +7 -8
  75. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index77.js +82 -8
  76. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index78.js +19 -48
  77. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index79.js +20 -21
  78. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +14 -6
  79. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index80.js +28 -19
  80. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index81.js +82 -27
  81. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index82.js +47 -83
  82. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index83.js +260 -47
  83. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index84.js +24 -251
  84. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index85.js +382 -25
  85. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index86.js +294 -144
  86. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index87.js +4 -223
  87. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index88.js +7 -4
  88. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index89.js +112 -5
  89. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +37 -5
  90. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index90.js +1 -114
  91. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index91.js +26 -0
  92. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +18 -21
  93. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index100.js +126 -10
  94. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index101.js +1 -105
  95. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index102.js +33 -2
  96. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index103.js +7 -28
  97. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index104.js +126 -73
  98. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index105.js +1 -1
  99. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index106.js +11 -30
  100. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index107.js +106 -8
  101. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index108.js +2 -181
  102. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index109.js +10 -2
  103. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index110.js +50 -12
  104. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index111.js +2 -108
  105. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index38.js +6 -0
  106. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index46.js +8 -4
  107. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index73.js +8 -1
  108. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index74.js +154 -23
  109. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index83.js +1 -0
  110. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index84.js +343 -250
  111. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index90.js +5 -123
  112. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index91.js +28 -26
  113. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index92.js +2 -94
  114. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index93.js +7 -2
  115. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index94.js +32 -5
  116. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index95.js +2 -30
  117. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index96.js +12 -2
  118. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index97.js +104 -5
  119. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index98.js +2 -34
  120. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index99.js +31 -2
  121. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  122. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index8.js +1 -1
  123. package/dist/packages/shared-ui-shadcn/dist/index.js +2458 -2284
  124. package/package.json +2 -1
  125. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index92.js +0 -27
  126. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index112.js +0 -2
  127. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index113.js +0 -10
  128. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index114.js +0 -52
  129. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index115.js +0 -2
@@ -1 +1,8 @@
1
- import "./index68.js";
1
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js
2
+ var e = (e) => [
3
+ "bill-pay",
4
+ "upload-queue",
5
+ e ?? ""
6
+ ];
7
+ //#endregion
8
+ export { e as billPayUploadQueueKey };
@@ -1,62 +1,27 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { countSuspectedPayableDuplicateGroups as e } from "../../data-access/dist/index7.js";
6
+ import { usePayablesQuery as t } from "../../data-access/dist/index17.js";
7
+ import "../../data-access/dist/index.js";
1
8
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js
2
- var e = /* @__PURE__ */ new Set([
3
- "new",
4
- "approve_in_progress",
5
- "waiting_to_be_paid",
6
- "partially_paid"
7
- ]);
8
- function t(t) {
9
- return !!(t && e.has(t));
9
+ function n(e) {
10
+ return e.isError && e.data === void 0;
10
11
  }
11
- function n(e, t) {
12
- let n = /* @__PURE__ */ new Date(`${e.slice(0, 10)}T00:00:00Z`), r = Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate());
13
- return n.getTime() < r;
14
- }
15
- function r({ apiStatus: t, dueDate: r, scheduledPaymentDate: i, hasScheduledPayment: a = !!i, now: o = /* @__PURE__ */ new Date() }) {
16
- if (e.has(t) && a) return {
17
- status: "scheduled",
18
- tone: "committed",
19
- isOverdue: !1
12
+ function r({ enabled: r = !0 } = {}) {
13
+ let i = t({
14
+ duplicate_match_status: "suspected",
15
+ limit: 100,
16
+ enabled: r
17
+ });
18
+ return {
19
+ count: i.data?.data?.length ?? 0,
20
+ groupCount: e(i.data?.data ?? []),
21
+ isCapped: !!i.data?.next_pagination_token,
22
+ isError: n(i),
23
+ isLoading: i.isLoading
20
24
  };
21
- let s = !!(e.has(t) && r && n(r, o));
22
- switch (t) {
23
- case "draft": return {
24
- status: "draft",
25
- tone: "neutral",
26
- isOverdue: s
27
- };
28
- case "new": return {
29
- status: "ready_to_submit",
30
- tone: "accent",
31
- isOverdue: s
32
- };
33
- case "approve_in_progress": return {
34
- status: "pending_approval",
35
- tone: "info",
36
- isOverdue: s
37
- };
38
- case "waiting_to_be_paid":
39
- case "partially_paid": return {
40
- status: "ready_to_pay",
41
- tone: "success",
42
- isOverdue: s
43
- };
44
- case "paid": return {
45
- status: "paid",
46
- tone: "settled",
47
- isOverdue: s
48
- };
49
- case "canceled": return {
50
- status: "canceled",
51
- tone: "neutral",
52
- isOverdue: s
53
- };
54
- case "rejected": return {
55
- status: "rejected",
56
- tone: "danger",
57
- isOverdue: s
58
- };
59
- }
60
25
  }
61
26
  //#endregion
62
- export { r as derivePayableStatus, t as hasUnpaidBalance };
27
+ export { r as useDuplicateBillsCount };
@@ -1,8 +1,13 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js
2
- var e = (e) => [
3
- "bill-pay",
4
- "upload-queue",
5
- e ?? ""
6
- ];
2
+ var e = {
3
+ uploadingSummary: (e) => `Uploading and scanning ${e} ${e === 1 ? "file" : "files"}`,
4
+ completeSummary: (e) => `${e} ${e === 1 ? "upload" : "uploads"} complete`,
5
+ readyCaption: (e) => `${e} new ${e === 1 ? "bill" : "bills"} ready`,
6
+ duplicateCaption: (e) => `${e} possible ${e === 1 ? "duplicate" : "duplicates"}`,
7
+ failedCaption: (e) => `${e} failed to upload`,
8
+ tooManyFilesError: (e) => `You can only upload up to ${e} files at a time`,
9
+ remainingCapacityError: (e) => e === 0 ? "Wait for the current uploads to finish before adding more files" : `You can upload ${e} more ${e === 1 ? "file" : "files"} right now`,
10
+ billDeletedError: "This bill was already deleted"
11
+ };
7
12
  //#endregion
8
- export { e as billPayUploadQueueKey };
13
+ export { e as BILL_UPLOAD_QUEUE_LABELS_EN };
@@ -1,13 +1,132 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
+ import { getPayablesIdOptions as t } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
7
+ import { withAuthEpoch as n } from "../../../shared/data-access/dist/lib/withAuthEpoch.js";
8
+ import { useEmbedApi as r } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
9
+ import { organizationHeaders as i } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
10
+ import { isApiNotFoundError as a } from "../../../shared/data-access/dist/lib/isApiNotFoundError.js";
11
+ import "../../../shared/data-access/dist/index.js";
12
+ import "../../../shared/ui/dist/index.js";
13
+ import { useUploadPayableFromFileMutation as o } from "../../data-access/dist/index13.js";
14
+ import { usePayableOcrQueries as s } from "../../data-access/dist/index15.js";
15
+ import "../../data-access/dist/index.js";
16
+ import { billPayUploadQueueKey as c } from "./index69.js";
17
+ import { BILL_UPLOAD_QUEUE_LABELS_EN as l } from "./index70.js";
18
+ import { useCallback as u, useEffect as d, useMemo as f, useState as p } from "react";
19
+ import { useQuery as m, useQueryClient as h } from "@tanstack/react-query";
1
20
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js
2
- var e = {
3
- uploadingSummary: (e) => `Uploading and scanning ${e} ${e === 1 ? "file" : "files"}`,
4
- completeSummary: (e) => `${e} ${e === 1 ? "upload" : "uploads"} complete`,
5
- readyCaption: (e) => `${e} new ${e === 1 ? "bill" : "bills"} ready`,
6
- duplicateCaption: (e) => `${e} possible ${e === 1 ? "duplicate" : "duplicates"}`,
7
- failedCaption: (e) => `${e} failed to upload`,
8
- tooManyFilesError: (e) => `You can only upload up to ${e} files at a time`,
9
- remainingCapacityError: (e) => e === 0 ? "Wait for the current uploads to finish before adding more files" : `You can upload ${e} more ${e === 1 ? "file" : "files"} right now`,
10
- billDeletedError: "This bill was already deleted"
11
- };
21
+ function g({ onOpenBill: g, labels: _ } = {}) {
22
+ let v = {
23
+ ...l,
24
+ ..._
25
+ }, y = _?.tooManyFilesError ?? l.tooManyFilesError, b = _?.remainingCapacityError ?? l.remainingCapacityError, { client: x, organizationId: S, authEpoch: C, organizationPending: w } = r(), T = h(), E = f(() => c(S), [S]), D = o(), [O, k] = p(!1), { data: A = [] } = m({
26
+ queryKey: E,
27
+ queryFn: () => T.getQueryData(E) ?? [],
28
+ staleTime: Infinity,
29
+ gcTime: Infinity,
30
+ initialData: []
31
+ }), j = u((e, t) => {
32
+ T.setQueryData(E, (n) => (n ?? []).map((n) => n.localId === e ? {
33
+ ...n,
34
+ ...t
35
+ } : n));
36
+ }, [T, E]), M = u((e) => {
37
+ T.setQueryData(E, (t) => (t ?? []).filter((t) => t.localId !== e));
38
+ }, [T, E]), N = u((t) => {
39
+ let n = (T.getQueryData(E) ?? []).filter((e) => e.status === "uploading").length;
40
+ if (t.length + n > 10) {
41
+ e.error(n > 0 ? b(10 - n) : y(10));
42
+ return;
43
+ }
44
+ k(!1);
45
+ for (let e of t) {
46
+ let t = crypto.randomUUID();
47
+ T.setQueryData(E, (n) => [...n ?? [], {
48
+ localId: t,
49
+ fileName: e.name,
50
+ status: "uploading"
51
+ }]), D.mutateAsync({ file: e }).then((e) => j(t, { payableId: e?.id })).catch(() => j(t, { status: "failed" }));
52
+ }
53
+ }, [
54
+ j,
55
+ T,
56
+ E,
57
+ b,
58
+ y,
59
+ D
60
+ ]), P = s({ payableIds: A.filter((e) => e.status === "uploading" && e.payableId).map((e) => e.payableId) });
61
+ d(() => {
62
+ let e = /* @__PURE__ */ new Set();
63
+ for (let t of P) if (t.suspectedDuplicateOf.length !== 0) {
64
+ e.add(t.payableId);
65
+ for (let n of t.suspectedDuplicateOf) e.add(n);
66
+ }
67
+ for (let { payableId: t, ocrStatus: n, isError: r } of P) {
68
+ let i = A.find((e) => e.payableId === t && e.status === "uploading");
69
+ i && (n === "success" ? j(i.localId, { status: e.has(t) ? "duplicate" : "ready" }) : (r || n === "error" || n === "canceled") && j(i.localId, { status: "failed" }));
70
+ }
71
+ for (let t of A) t.status === "ready" && t.payableId && e.has(t.payableId) && j(t.localId, { status: "duplicate" });
72
+ }, [
73
+ A,
74
+ P,
75
+ j
76
+ ]);
77
+ let F = A.filter((e) => e.status === "uploading"), I = A.filter((e) => e.status === "ready"), L = A.filter((e) => e.status === "duplicate"), R = A.filter((e) => e.status === "failed"), z = (r) => ({
78
+ id: r.localId,
79
+ fileName: r.fileName,
80
+ status: r.status,
81
+ onOpen: (r.status === "ready" || r.status === "duplicate") && r.payableId && g ? () => {
82
+ let o = r.payableId;
83
+ T.fetchQuery({
84
+ ...n(t({
85
+ client: x,
86
+ headers: i(S),
87
+ path: { payable_id: o }
88
+ }), {
89
+ authEpoch: C,
90
+ organizationPending: w
91
+ }),
92
+ retry: !1
93
+ }).catch((e) => {
94
+ if (a(e)) return "deleted";
95
+ }).then((t) => {
96
+ t === "deleted" ? e.error(v.billDeletedError) : g(o), M(r.localId);
97
+ });
98
+ } : void 0
99
+ }), B = F.length ? [{
100
+ id: "in-progress",
101
+ items: A.map(z)
102
+ }] : [
103
+ ...I.length ? [{
104
+ id: "ready",
105
+ caption: v.readyCaption(I.length),
106
+ items: I.map(z)
107
+ }] : [],
108
+ ...L.length ? [{
109
+ id: "duplicate",
110
+ caption: v.duplicateCaption(L.length),
111
+ items: L.map(z)
112
+ }] : [],
113
+ ...R.length ? [{
114
+ id: "failed",
115
+ caption: v.failedCaption(R.length),
116
+ items: R.map(z)
117
+ }] : []
118
+ ], V = I.length + L.length, H = F.length ? v.uploadingSummary(A.length) : V ? v.completeSummary(V) : v.failedCaption(R.length), U = u(() => {
119
+ T.setQueryData(E, []);
120
+ }, [T, E]);
121
+ return {
122
+ enqueue: N,
123
+ sections: B,
124
+ summaryLabel: H,
125
+ collapsed: O,
126
+ onToggleCollapsed: u(() => k((e) => !e), []),
127
+ onClose: U,
128
+ isVisible: A.length > 0
129
+ };
130
+ }
12
131
  //#endregion
13
- export { e as BILL_UPLOAD_QUEUE_LABELS_EN };
132
+ export { g as useBillUploadQueue };
@@ -1,132 +1,3 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
- import { getPayablesIdOptions as t } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
7
- import { withAuthEpoch as n } from "../../../shared/data-access/dist/lib/withAuthEpoch.js";
8
- import { useEmbedApi as r } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
9
- import { organizationHeaders as i } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
10
- import { isApiNotFoundError as a } from "../../../shared/data-access/dist/lib/isApiNotFoundError.js";
11
- import "../../../shared/data-access/dist/index.js";
12
- import "../../../shared/ui/dist/index.js";
13
- import { useUploadPayableFromFileMutation as o } from "../../data-access/dist/index13.js";
14
- import { usePayableOcrQueries as s } from "../../data-access/dist/index15.js";
15
- import "../../data-access/dist/index.js";
16
- import { billPayUploadQueueKey as c } from "./index70.js";
17
- import { BILL_UPLOAD_QUEUE_LABELS_EN as l } from "./index71.js";
18
- import { useCallback as u, useEffect as d, useMemo as f, useState as p } from "react";
19
- import { useQuery as m, useQueryClient as h } from "@tanstack/react-query";
20
- //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js
21
- function g({ onOpenBill: g, labels: _ } = {}) {
22
- let v = {
23
- ...l,
24
- ..._
25
- }, y = _?.tooManyFilesError ?? l.tooManyFilesError, b = _?.remainingCapacityError ?? l.remainingCapacityError, { client: x, organizationId: S, authEpoch: C, organizationPending: w } = r(), T = h(), E = f(() => c(S), [S]), D = o(), [O, k] = p(!1), { data: A = [] } = m({
26
- queryKey: E,
27
- queryFn: () => T.getQueryData(E) ?? [],
28
- staleTime: Infinity,
29
- gcTime: Infinity,
30
- initialData: []
31
- }), j = u((e, t) => {
32
- T.setQueryData(E, (n) => (n ?? []).map((n) => n.localId === e ? {
33
- ...n,
34
- ...t
35
- } : n));
36
- }, [T, E]), M = u((e) => {
37
- T.setQueryData(E, (t) => (t ?? []).filter((t) => t.localId !== e));
38
- }, [T, E]), N = u((t) => {
39
- let n = (T.getQueryData(E) ?? []).filter((e) => e.status === "uploading").length;
40
- if (t.length + n > 10) {
41
- e.error(n > 0 ? b(10 - n) : y(10));
42
- return;
43
- }
44
- k(!1);
45
- for (let e of t) {
46
- let t = crypto.randomUUID();
47
- T.setQueryData(E, (n) => [...n ?? [], {
48
- localId: t,
49
- fileName: e.name,
50
- status: "uploading"
51
- }]), D.mutateAsync({ file: e }).then((e) => j(t, { payableId: e?.id })).catch(() => j(t, { status: "failed" }));
52
- }
53
- }, [
54
- j,
55
- T,
56
- E,
57
- b,
58
- y,
59
- D
60
- ]), P = s({ payableIds: A.filter((e) => e.status === "uploading" && e.payableId).map((e) => e.payableId) });
61
- d(() => {
62
- let e = /* @__PURE__ */ new Set();
63
- for (let t of P) if (t.suspectedDuplicateOf.length !== 0) {
64
- e.add(t.payableId);
65
- for (let n of t.suspectedDuplicateOf) e.add(n);
66
- }
67
- for (let { payableId: t, ocrStatus: n, isError: r } of P) {
68
- let i = A.find((e) => e.payableId === t && e.status === "uploading");
69
- i && (n === "success" ? j(i.localId, { status: e.has(t) ? "duplicate" : "ready" }) : (r || n === "error" || n === "canceled") && j(i.localId, { status: "failed" }));
70
- }
71
- for (let t of A) t.status === "ready" && t.payableId && e.has(t.payableId) && j(t.localId, { status: "duplicate" });
72
- }, [
73
- A,
74
- P,
75
- j
76
- ]);
77
- let F = A.filter((e) => e.status === "uploading"), I = A.filter((e) => e.status === "ready"), L = A.filter((e) => e.status === "duplicate"), R = A.filter((e) => e.status === "failed"), z = (r) => ({
78
- id: r.localId,
79
- fileName: r.fileName,
80
- status: r.status,
81
- onOpen: (r.status === "ready" || r.status === "duplicate") && r.payableId && g ? () => {
82
- let o = r.payableId;
83
- T.fetchQuery({
84
- ...n(t({
85
- client: x,
86
- headers: i(S),
87
- path: { payable_id: o }
88
- }), {
89
- authEpoch: C,
90
- organizationPending: w
91
- }),
92
- retry: !1
93
- }).catch((e) => {
94
- if (a(e)) return "deleted";
95
- }).then((t) => {
96
- t === "deleted" ? e.error(v.billDeletedError) : g(o), M(r.localId);
97
- });
98
- } : void 0
99
- }), B = F.length ? [{
100
- id: "in-progress",
101
- items: A.map(z)
102
- }] : [
103
- ...I.length ? [{
104
- id: "ready",
105
- caption: v.readyCaption(I.length),
106
- items: I.map(z)
107
- }] : [],
108
- ...L.length ? [{
109
- id: "duplicate",
110
- caption: v.duplicateCaption(L.length),
111
- items: L.map(z)
112
- }] : [],
113
- ...R.length ? [{
114
- id: "failed",
115
- caption: v.failedCaption(R.length),
116
- items: R.map(z)
117
- }] : []
118
- ], V = I.length + L.length, H = F.length ? v.uploadingSummary(A.length) : V ? v.completeSummary(V) : v.failedCaption(R.length), U = u(() => {
119
- T.setQueryData(E, []);
120
- }, [T, E]);
121
- return {
122
- enqueue: N,
123
- sections: B,
124
- summaryLabel: H,
125
- collapsed: O,
126
- onToggleCollapsed: u(() => k((e) => !e), []),
127
- onClose: U,
128
- isVisible: A.length > 0
129
- };
130
- }
131
- //#endregion
132
- export { g as useBillUploadQueue };
1
+ import "./index69.js";
2
+ import "./index70.js";
3
+ import "./index71.js";
@@ -1,3 +1,6 @@
1
- import "./index70.js";
2
- import "./index71.js";
3
- import "./index72.js";
1
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js
2
+ function e(e) {
3
+ return e === void 0 ? "0" : e > 99 ? "99+" : String(e);
4
+ }
5
+ //#endregion
6
+ export { e as formatBillQueueBadge };
@@ -1,6 +1,132 @@
1
+ import { BillColumn as e } from "../../ui/dist/index83.js";
2
+ import "../../ui/dist/index.js";
1
3
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js
2
- function e(e) {
3
- return e === void 0 ? "0" : e > 99 ? "99+" : String(e);
4
+ var t = {
5
+ Drafts: "drafts",
6
+ Pending: "pending",
7
+ Scheduled: "scheduled",
8
+ Paid: "paid",
9
+ All: "all"
10
+ }, n = {
11
+ [t.Drafts]: ["draft", "new"],
12
+ [t.Pending]: [
13
+ "approve_in_progress",
14
+ "waiting_to_be_paid",
15
+ "partially_paid"
16
+ ],
17
+ [t.Scheduled]: [
18
+ "new",
19
+ "approve_in_progress",
20
+ "waiting_to_be_paid",
21
+ "partially_paid"
22
+ ],
23
+ [t.Paid]: ["paid"],
24
+ [t.All]: void 0
25
+ }, r = {
26
+ [t.Drafts]: void 0,
27
+ [t.Pending]: !1,
28
+ [t.Scheduled]: !0,
29
+ [t.Paid]: void 0,
30
+ [t.All]: void 0
31
+ };
32
+ function i(e) {
33
+ return e === t.Pending || e === t.Drafts;
34
+ }
35
+ var a = t.Drafts, o = [
36
+ t.Drafts,
37
+ t.Pending,
38
+ t.Scheduled,
39
+ t.Paid,
40
+ t.All
41
+ ], s = {
42
+ [t.Drafts]: [
43
+ e.Vendor,
44
+ e.InvoiceNumber,
45
+ e.Attachment,
46
+ e.IssueDate,
47
+ e.DueDate,
48
+ e.Status,
49
+ e.AmountDue,
50
+ e.TotalAmount,
51
+ e.AddedOn
52
+ ],
53
+ [t.Pending]: [
54
+ e.Vendor,
55
+ e.InvoiceNumber,
56
+ e.Attachment,
57
+ e.IssueDate,
58
+ e.DueDate,
59
+ e.Status,
60
+ e.AmountDue,
61
+ e.TotalAmount,
62
+ e.AddedOn
63
+ ],
64
+ [t.Scheduled]: [
65
+ e.Vendor,
66
+ e.InvoiceNumber,
67
+ e.Attachment,
68
+ e.IssueDate,
69
+ e.DueDate,
70
+ e.ScheduledDate,
71
+ e.Status,
72
+ e.AmountScheduled,
73
+ e.TotalAmount,
74
+ e.AddedOn
75
+ ],
76
+ [t.Paid]: [
77
+ e.Vendor,
78
+ e.InvoiceNumber,
79
+ e.Attachment,
80
+ e.IssueDate,
81
+ e.DueDate,
82
+ e.PaidDate,
83
+ e.Status,
84
+ e.AmountPaid,
85
+ e.TotalAmount,
86
+ e.AddedOn
87
+ ],
88
+ [t.All]: [
89
+ e.Vendor,
90
+ e.InvoiceNumber,
91
+ e.Attachment,
92
+ e.IssueDate,
93
+ e.DueDate,
94
+ e.ScheduledDate,
95
+ e.Status,
96
+ e.AmountDue,
97
+ e.AmountPaid,
98
+ e.TotalAmount,
99
+ e.AddedOn
100
+ ]
101
+ };
102
+ function c(e) {
103
+ return s[e];
104
+ }
105
+ function l(e) {
106
+ let t = n[e];
107
+ return t ? [...t] : void 0;
108
+ }
109
+ function u(e) {
110
+ return r[e];
111
+ }
112
+ var d = {
113
+ vendorLabel: "counterpart_name",
114
+ issueDateLabel: "issued_at",
115
+ dueDateLabel: "due_date",
116
+ scheduledDateLabel: "scheduled_payment_date",
117
+ addedOnLabel: "created_at"
118
+ }, f = {
119
+ [e.Vendor]: "vendorLabel",
120
+ [e.IssueDate]: "issueDateLabel",
121
+ [e.DueDate]: "dueDateLabel",
122
+ [e.ScheduledDate]: "scheduledDateLabel",
123
+ [e.AddedOn]: "addedOnLabel"
124
+ };
125
+ function p(e) {
126
+ return f[e];
127
+ }
128
+ function m(e) {
129
+ if (e) return d[e];
4
130
  }
5
131
  //#endregion
6
- export { e as formatBillQueueBadge };
132
+ export { s as BILL_QUEUE_COLUMNS, r as BILL_QUEUE_HAS_SCHEDULED_PAYMENT, o as BILL_QUEUE_ORDER, n as BILL_QUEUE_STATUSES, d as BILL_SORT_FIELDS, t as BillQueue, a as DEFAULT_BILL_QUEUE, c as billQueueColumns, u as billQueueHasScheduledPayment, i as billQueueOffersAddPanel, l as billQueueStatuses, p as billSortColumnId, m as billSortField };
@@ -1,127 +1,11 @@
1
- import { BillColumn as e } from "../../ui/dist/index83.js";
2
- import "../../ui/dist/index.js";
3
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js
4
- var t = {
5
- Drafts: "drafts",
6
- Pending: "pending",
7
- Scheduled: "scheduled",
8
- Paid: "paid",
9
- All: "all"
10
- }, n = {
11
- [t.Drafts]: ["draft", "new"],
12
- [t.Pending]: [
13
- "approve_in_progress",
14
- "waiting_to_be_paid",
15
- "partially_paid"
16
- ],
17
- [t.Scheduled]: [
18
- "new",
19
- "approve_in_progress",
20
- "waiting_to_be_paid",
21
- "partially_paid"
22
- ],
23
- [t.Paid]: ["paid"],
24
- [t.All]: void 0
25
- }, r = {
26
- [t.Drafts]: void 0,
27
- [t.Pending]: !1,
28
- [t.Scheduled]: !0,
29
- [t.Paid]: void 0,
30
- [t.All]: void 0
31
- };
32
- function i(e) {
33
- return e === t.Pending || e === t.Drafts;
34
- }
35
- var a = t.Drafts, o = [
36
- t.Drafts,
37
- t.Pending,
38
- t.Scheduled,
39
- t.Paid,
40
- t.All
41
- ], s = {
42
- [t.Drafts]: [
43
- e.Vendor,
44
- e.Attachment,
45
- e.IssueDate,
46
- e.DueDate,
47
- e.Status,
48
- e.AmountDue,
49
- e.TotalAmount,
50
- e.AddedOn
51
- ],
52
- [t.Pending]: [
53
- e.Vendor,
54
- e.Attachment,
55
- e.IssueDate,
56
- e.DueDate,
57
- e.Status,
58
- e.AmountDue,
59
- e.TotalAmount,
60
- e.AddedOn
61
- ],
62
- [t.Scheduled]: [
63
- e.Vendor,
64
- e.Attachment,
65
- e.IssueDate,
66
- e.DueDate,
67
- e.ScheduledDate,
68
- e.Status,
69
- e.AmountScheduled,
70
- e.TotalAmount,
71
- e.AddedOn
72
- ],
73
- [t.Paid]: [
74
- e.Vendor,
75
- e.Attachment,
76
- e.IssueDate,
77
- e.DueDate,
78
- e.PaidDate,
79
- e.Status,
80
- e.AmountPaid,
81
- e.TotalAmount,
82
- e.AddedOn
83
- ],
84
- [t.All]: [
85
- e.Vendor,
86
- e.Attachment,
87
- e.IssueDate,
88
- e.DueDate,
89
- e.ScheduledDate,
90
- e.Status,
91
- e.AmountDue,
92
- e.AmountPaid,
93
- e.TotalAmount,
94
- e.AddedOn
95
- ]
96
- };
97
- function c(e) {
98
- return s[e];
99
- }
100
- function l(e) {
101
- let t = n[e];
102
- return t ? [...t] : void 0;
103
- }
104
- function u(e) {
105
- return r[e];
106
- }
107
- var d = {
108
- vendorLabel: "counterpart_name",
109
- issueDateLabel: "issued_at",
110
- dueDateLabel: "due_date",
111
- scheduledDateLabel: "scheduled_payment_date",
112
- addedOnLabel: "created_at"
113
- }, f = {
114
- [e.Vendor]: "vendorLabel",
115
- [e.IssueDate]: "issueDateLabel",
116
- [e.DueDate]: "dueDateLabel",
117
- [e.ScheduledDate]: "scheduledDateLabel",
118
- [e.AddedOn]: "addedOnLabel"
119
- };
120
- function p(e) {
121
- return f[e];
122
- }
123
- function m(e) {
124
- if (e) return d[e];
2
+ async function e(e) {
3
+ if (!e.trim()) return !1;
4
+ try {
5
+ return await navigator.clipboard.writeText(e), !0;
6
+ } catch {
7
+ return !1;
8
+ }
125
9
  }
126
10
  //#endregion
127
- export { s as BILL_QUEUE_COLUMNS, r as BILL_QUEUE_HAS_SCHEDULED_PAYMENT, o as BILL_QUEUE_ORDER, n as BILL_QUEUE_STATUSES, d as BILL_SORT_FIELDS, t as BillQueue, a as DEFAULT_BILL_QUEUE, c as billQueueColumns, u as billQueueHasScheduledPayment, i as billQueueOffersAddPanel, l as billQueueStatuses, p as billSortColumnId, m as billSortField };
11
+ export { e as copyTextToClipboard };