@tesouro/embedded-components-react 0.4.21 → 0.4.22

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 (179) hide show
  1. package/dist/index.js +1 -1
  2. package/dist/lib/BillPayWidget.js +1 -1
  3. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +12 -12
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +64 -37
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js +38 -110
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +104 -73
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js +87 -7
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +7 -21
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +17 -22
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +23 -63
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +66 -2
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +2 -77
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +74 -3
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +4 -5
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +5 -4
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +3 -32
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +30 -39
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +37 -166
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +164 -39
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +48 -1
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +1 -50
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +47 -4
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +1 -1
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +7 -7
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +8 -24
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +18 -125
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +135 -16
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +24 -4
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +4 -41
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +39 -87
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +79 -84
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index4.js +5 -25
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +95 -48
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +47 -119
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +119 -33
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +33 -177
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +186 -75
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +75 -21
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +22 -232
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +223 -210
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +202 -103
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +121 -13
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js +25 -24
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +12 -47
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +47 -31
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +27 -198
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +198 -30
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +30 -234
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +240 -19
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +19 -385
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +416 -4
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +4 -35
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +35 -189
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +21 -57
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +214 -3
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +3 -4
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +2 -44
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +46 -1
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +1 -8
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +6 -10
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +10 -110
  62. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +112 -3
  63. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +3 -127
  64. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +124 -8
  65. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +58 -5
  66. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +8 -7
  67. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js +8 -46
  68. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +43 -18
  69. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +20 -28
  70. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js +27 -82
  71. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +83 -47
  72. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js +47 -250
  73. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index77.js +239 -101
  74. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index78.js +107 -202
  75. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index79.js +209 -3
  76. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +5 -4
  77. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index80.js +4 -8
  78. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index81.js +6 -113
  79. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index82.js +115 -1
  80. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index83.js +0 -24
  81. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index84.js +25 -0
  82. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +5 -70
  83. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +44 -40
  84. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index100.js +170 -2
  85. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index101.js +2 -10
  86. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index102.js +12 -50
  87. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index103.js +108 -2
  88. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index104.js +2 -0
  89. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index105.js +10 -0
  90. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index106.js +52 -0
  91. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index107.js +2 -0
  92. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index16.js +21 -12
  93. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index17.js +10 -9
  94. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index18.js +11 -16
  95. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index19.js +18 -2
  96. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index20.js +2 -4
  97. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index21.js +2 -28
  98. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index22.js +30 -2
  99. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index23.js +2 -32
  100. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index24.js +32 -1
  101. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index25.js +1 -29
  102. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index26.js +26 -19
  103. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index27.js +20 -152
  104. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index28.js +154 -2
  105. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index29.js +1 -64
  106. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index30.js +61 -253
  107. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index31.js +258 -1
  108. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index32.js +2 -9
  109. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index33.js +7 -47
  110. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index34.js +49 -2
  111. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index35.js +2 -18
  112. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index36.js +15 -47
  113. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index37.js +50 -2
  114. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index38.js +2 -23
  115. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index39.js +21 -338
  116. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index40.js +340 -2
  117. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index41.js +2 -11
  118. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index42.js +9 -94
  119. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index43.js +96 -2
  120. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index44.js +1 -12
  121. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index45.js +11 -57
  122. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index46.js +58 -1
  123. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index47.js +1 -54
  124. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index48.js +52 -10
  125. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index49.js +10 -179
  126. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index50.js +181 -1
  127. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index51.js +2 -4
  128. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index52.js +2 -39
  129. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index53.js +41 -2
  130. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index54.js +2 -7
  131. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index55.js +5 -90
  132. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index56.js +92 -2
  133. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index57.js +2 -4
  134. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index58.js +2 -14
  135. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index59.js +16 -2
  136. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index60.js +1 -88
  137. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index61.js +86 -298
  138. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index62.js +299 -9
  139. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index63.js +13 -1
  140. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index64.js +1 -8
  141. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index65.js +6 -37
  142. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index66.js +39 -2
  143. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index67.js +2 -39
  144. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index68.js +2 -10
  145. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index69.js +30 -195
  146. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index70.js +0 -1
  147. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index71.js +36 -14
  148. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index72.js +10 -345
  149. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index73.js +199 -8
  150. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index74.js +3 -9
  151. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index75.js +15 -91
  152. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index76.js +347 -0
  153. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index77.js +10 -2
  154. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index78.js +7 -123
  155. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index79.js +91 -26
  156. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index81.js +1 -1
  157. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index82.js +123 -5
  158. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index83.js +26 -28
  159. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index84.js +94 -2
  160. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index85.js +2 -7
  161. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index86.js +5 -32
  162. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index87.js +30 -2
  163. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index88.js +2 -12
  164. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index89.js +5 -104
  165. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index90.js +34 -2
  166. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index91.js +2 -17
  167. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index92.js +10 -123
  168. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index93.js +105 -1
  169. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index94.js +2 -18
  170. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index95.js +13 -6
  171. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index96.js +74 -119
  172. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index97.js +1 -1
  173. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index98.js +15 -11
  174. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index99.js +8 -106
  175. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  176. package/dist/libs/tesouro-embedded-components-react/shared/util/dist/lib/formatRejectionDate.js +11 -0
  177. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index8.js +1 -1
  178. package/package.json +1 -1
  179. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index80.js +0 -94
@@ -1,62 +1,26 @@
1
+ import { suspectedPayableDuplicates as e } from "../../data-access/dist/index7.js";
2
+ import "../../data-access/dist/index.js";
1
3
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js
2
- var e = /* @__PURE__ */ new Set([
3
- "new",
4
- "approve_in_progress",
5
- "waiting_to_be_paid",
6
- "partially_paid"
7
- ]);
8
4
  function t(t) {
9
- return !!(t && e.has(t));
10
- }
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
5
+ let n = new Map(t.map((e) => [e.id, e])), r = /* @__PURE__ */ new Map(), i = (e) => {
6
+ let t = r.get(e);
7
+ if (t === void 0 || t === e) return e;
8
+ let n = i(t);
9
+ return r.set(e, n), n;
10
+ }, a = (e, t) => {
11
+ let n = i(e), a = i(t);
12
+ n !== a && r.set(n, a);
20
13
  };
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
- }
14
+ t.forEach((t) => {
15
+ r.set(t.id, r.get(t.id) ?? t.id), e(t).forEach((e) => {
16
+ n.has(e.matched_payable_id) && a(t.id, e.matched_payable_id);
17
+ });
18
+ });
19
+ let o = /* @__PURE__ */ new Map();
20
+ return t.forEach((e) => {
21
+ let t = i(e.id);
22
+ o.set(t, [...o.get(t) ?? [], e]);
23
+ }), [...o.values()].map((e) => ({ members: [...e].sort((e, t) => (e.created_at ?? "").localeCompare(t.created_at ?? "")) }));
60
24
  }
61
25
  //#endregion
62
- export { r as derivePayableStatus, t as hasUnpaidBalance };
26
+ export { t as groupSuspectedDuplicates };
@@ -1,3 +1,214 @@
1
- import "./index38.js";
2
- import "./index58.js";
3
- import "./index59.js";
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { hasAnyScope as e } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
6
+ import { Scope as t } from "../../../shared/data-access/dist/lib/scopes.js";
7
+ import { useAllLedgerAccountsQuery as ee } from "../../../shared/data-access/dist/lib/reference-data/useLedgerAccountsQuery.js";
8
+ import { useAllOrganizationUsersQuery as te } from "../../../shared/data-access/dist/lib/user/useAllOrganizationUsersQuery.js";
9
+ import "../../../shared/data-access/dist/index.js";
10
+ import { useWidgetConfig as ne } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
11
+ import "../../../shared/feature/dist/index.js";
12
+ import { usePayableApprovalRequestsQuery as n } from "../../data-access/dist/index8.js";
13
+ import { usePayableHistoryQuery as r } from "../../data-access/dist/index9.js";
14
+ import { useAllPayableLineItemsQuery as i } from "../../data-access/dist/index10.js";
15
+ import { usePayableQuery as a } from "../../data-access/dist/index16.js";
16
+ import "../../data-access/dist/index.js";
17
+ import { BillDecisionDialog as o } from "../../ui/dist/index56.js";
18
+ import { BillDetailsSheet as s } from "../../ui/dist/index62.js";
19
+ import { BillDuplicateNotice as c } from "../../ui/dist/index66.js";
20
+ import { MarkAsPaidDialog as l } from "../../ui/dist/index96.js";
21
+ import "../../ui/dist/index.js";
22
+ import { usePayableDuplicateReview as u } from "./index13.js";
23
+ import "./index14.js";
24
+ import { canOverrideApprovalPolicy as d } from "./index19.js";
25
+ import { resolveAmountDueMinorUnits as f } from "./index20.js";
26
+ import { PayBillFlow as p } from "./index26.js";
27
+ import "./index27.js";
28
+ import { mapPayableToBillDetails as re } from "./index39.js";
29
+ import { mergeMarkAsPaidFlowLabels as ie } from "./index15.js";
30
+ import { useMarkAsPaidFlow as ae } from "./index17.js";
31
+ import "./index18.js";
32
+ import { mergeDecisionDialogCopy as oe, mergePaymentHistoryMethodLabels as se } from "./index42.js";
33
+ import { buildPaymentHistory as m } from "./index3.js";
34
+ import { currentApprovalRound as ce } from "./index4.js";
35
+ import { usePayableApprovalRoundStart as le } from "./index31.js";
36
+ import { useApprovalPolicyCardView as ue } from "./index32.js";
37
+ import { resolveBillRejectionNotice as h } from "./index33.js";
38
+ import { useCurrentApprovalRequestId as g } from "./index34.js";
39
+ import { usePayableDetailActions as _ } from "./index35.js";
40
+ import { useScheduledPayment as de } from "./index36.js";
41
+ import { BILL_DETAILS_LABELS_EN as v } from "./index59.js";
42
+ import { useMemo as y, useRef as fe } from "react";
43
+ import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
44
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js
45
+ function C({ open: C, onOpenChange: w, payableId: T, onClose: E, onExpand: D, testId: O, labels: k, poweredByBankName: A }) {
46
+ let j = y(() => ({
47
+ ...v,
48
+ ...k,
49
+ sheet: {
50
+ ...v.sheet,
51
+ ...k?.sheet,
52
+ statusBadge: {
53
+ ...v.sheet.statusBadge,
54
+ ...k?.sheet?.statusBadge
55
+ },
56
+ approvalPolicy: {
57
+ ...v.sheet.approvalPolicy,
58
+ ...k?.sheet?.approvalPolicy
59
+ },
60
+ dueDate: {
61
+ ...v.sheet.dueDate,
62
+ ...k?.sheet?.dueDate
63
+ }
64
+ },
65
+ decisionDialog: oe(v.decisionDialog, k?.decisionDialog),
66
+ approvalPolicyCopy: {
67
+ ...v.approvalPolicyCopy,
68
+ ...k?.approvalPolicyCopy
69
+ },
70
+ markAsPaid: ie(k?.markAsPaid),
71
+ actionSuccess: {
72
+ ...v.actionSuccess,
73
+ ...k?.actionSuccess
74
+ },
75
+ paymentHistoryMethodLabels: se(k?.paymentHistoryMethodLabels)
76
+ }), [k]), M = a(T), N = i(T), P = ee(), { initResponse: F } = ne(), I = M.data, L = fe(null), R = g({
77
+ payableId: T,
78
+ status: I?.status
79
+ }), z = I?.status === "rejected", B = e(F?.scopes, [t.ApprovalRequestReadOrg]), V = z && B, H = le({
80
+ payableId: T,
81
+ enabled: V
82
+ }), U = n(T, { enabled: V }), pe = e(F?.scopes, [t.UserReadOrg]), W = te({ enabled: z && pe }), G = y(() => ce(U.data?.data, H.roundStartedAt), [U.data, H.roundStartedAt]), K = y(() => h({
83
+ payableStatus: I?.status,
84
+ approvalRequests: G,
85
+ users: W.data?.data ?? [],
86
+ payableUpdatedAt: I?.updated_at,
87
+ labels: j
88
+ }), [
89
+ I?.status,
90
+ I?.updated_at,
91
+ G,
92
+ W.data,
93
+ j
94
+ ]), q = ue({
95
+ payableId: T,
96
+ approvalPolicyId: I?.approval_policy_id,
97
+ copy: j.approvalPolicyCopy
98
+ }), me = d({
99
+ status: I?.status,
100
+ scopes: F?.scopes,
101
+ hasWaitingRequest: R.hasWaitingRequest,
102
+ arePendingApproversUnknown: q.isLoading
103
+ }), J = de({
104
+ payableId: T,
105
+ scheduledPaymentDate: I?.scheduled_payment_date
106
+ }), Y = ae({
107
+ payableId: T,
108
+ amountDueMinorUnits: f(I) ?? 0,
109
+ amountToPayMinorUnits: I?.amount_to_pay ?? void 0,
110
+ currencyCode: I?.currency ?? void 0,
111
+ dueDate: I?.due_date,
112
+ hasScheduledPayment: J.hasScheduledPayment,
113
+ testId: O,
114
+ labels: j.markAsPaid
115
+ }), { actions: he, decisionDialog: ge } = _({
116
+ payableId: I ? T : void 0,
117
+ status: I?.status,
118
+ currentApprovalRequestId: R.id,
119
+ hasWaitingRequest: R.hasWaitingRequest,
120
+ hasScheduledPayment: J.hasScheduledPayment,
121
+ scheduledPaymentIntentId: J.scheduledPaymentIntentId,
122
+ isScheduledPaymentUnknown: J.isResolving,
123
+ pendingApprovers: q.pendingApprovers,
124
+ arePendingApproversUnknown: q.isLoading,
125
+ labels: {
126
+ payBill: j.sheet.payButton,
127
+ markAsPaid: j.sheet.markAsPaidButton,
128
+ reject: j.sheet.rejectButton,
129
+ approve: j.sheet.approveButton,
130
+ cancel: j.sheet.cancelButton,
131
+ cancelScheduledPayment: j.sheet.cancelScheduledPaymentButton,
132
+ reopen: j.sheet.reopenButton,
133
+ forceApprove: j.sheet.forceApproveButton,
134
+ forceReject: j.sheet.forceRejectButton,
135
+ policyOverridesHeading: j.sheet.policyOverridesGroup,
136
+ decisionDialog: j.decisionDialog,
137
+ actionError: j.actionError,
138
+ actionSuccess: j.actionSuccess
139
+ },
140
+ isMarkAsPaidPending: Y.isPending,
141
+ onMarkAsPaidSelect: Y.open,
142
+ onPayBillSelect: () => L.current?.open()
143
+ }), X = J.hasScheduledPayment && J.scheduledDateLabel ? /* @__PURE__ */ x("p", {
144
+ className: "ttw:text-sm ttw:text-muted-foreground",
145
+ children: j.scheduledSummary(J.scheduledDateLabel)
146
+ }) : void 0, Z = u({
147
+ payable: I,
148
+ canManage: e(F?.scopes, [t.PayableWriteOrg])
149
+ }), Q = Z.isPossibleDuplicate ? /* @__PURE__ */ x(c, {
150
+ onNotADuplicate: Z.onNotADuplicate,
151
+ isActionDisabled: Z.isBusy
152
+ }) : void 0, _e = Q || X ? /* @__PURE__ */ S(b, { children: [Q, X] }) : void 0, $ = r(T), ve = y(() => m({
153
+ records: J.paymentRecords,
154
+ events: $.data?.data ?? [],
155
+ currencyCode: I?.currency,
156
+ labels: j
157
+ }), [
158
+ J.paymentRecords,
159
+ $.data,
160
+ I?.currency,
161
+ j
162
+ ]), ye = y(() => I ? re({
163
+ payable: I,
164
+ lineItems: N.lineItems,
165
+ ledgerAccounts: P.data?.data ?? [],
166
+ labels: j,
167
+ hasScheduledPayment: J.hasScheduledPayment,
168
+ rejection: K
169
+ }) : void 0, [
170
+ I,
171
+ N.lineItems,
172
+ P.data,
173
+ j,
174
+ J.hasScheduledPayment,
175
+ K
176
+ ]), be = M.isLoading || N.isResolving || P.isResolving, xe = M.isError || N.isError || P.isError;
177
+ return /* @__PURE__ */ S(b, { children: [
178
+ /* @__PURE__ */ x(s, {
179
+ open: C,
180
+ onOpenChange: w,
181
+ details: ye,
182
+ actions: he,
183
+ approvalPolicy: q.view,
184
+ showApprovalOverrideNotice: me,
185
+ paymentHistory: ve,
186
+ paymentHistoryError: J.isError || $.isError,
187
+ paymentHistoryLoading: J.isResolving || $.isLoading,
188
+ isLoading: be,
189
+ isError: xe,
190
+ notice: _e,
191
+ onClose: E,
192
+ onExpand: D,
193
+ testId: O,
194
+ labels: j.sheet
195
+ }),
196
+ /* @__PURE__ */ x(o, {
197
+ ...ge,
198
+ labels: { cancelButton: j.decisionDialog.cancelButton },
199
+ testId: O ? `${O}-decision-dialog` : void 0,
200
+ confirmTestId: O ? `${O}-decision-confirm` : void 0,
201
+ reasonTestId: O ? `${O}-decision-reason` : void 0,
202
+ reasonFieldId: O ? `${O}-decision-reason-field` : void 0
203
+ }),
204
+ /* @__PURE__ */ x(l, { ...Y.dialogProps }),
205
+ I ? /* @__PURE__ */ x(p, {
206
+ ref: L,
207
+ payable: I,
208
+ onMissingAchInstructions: D,
209
+ poweredByBankName: A
210
+ }) : null
211
+ ] });
212
+ }
213
+ //#endregion
214
+ export { C as BillDetailsContainer, C as default };
@@ -1,4 +1,3 @@
1
- //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js
2
- var e = { Mounted: "bill_pay_widget.mounted" }, t = "bill_pay_widget";
3
- //#endregion
4
- export { e as BillPayWidgetAnalyticsEvent, t as WIDGET_NAME };
1
+ import "./index39.js";
2
+ import "./index59.js";
3
+ import "./index60.js";
@@ -1,46 +1,4 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { useAnalyticsTrack as e } from "../../../shared/feature/dist/lib/analytics/hooks.js";
6
- import "../../../shared/feature/dist/index.js";
7
- import { BillPayWidgetAnalyticsEvent as t, WIDGET_NAME as n } from "./index61.js";
8
- import { Payables as r } from "../../../monite-sdk/dist/index444.js";
9
- import "../../../monite-sdk/dist/index.js";
10
- import { MoniteRegionProvider as i } from "../../../shared/monite-wrapper/feature/dist/lib/MoniteRegionProvider.js";
11
- import "../../../shared/monite-wrapper/feature/dist/index.js";
12
- import { useEffect as a } from "react";
13
- import { jsx as o } from "react/jsx-runtime";
14
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js
15
- var s = (e) => e;
16
- function c(n) {
17
- let i = e();
18
- return a(() => {
19
- i(t.Mounted);
20
- }, [i]), /* @__PURE__ */ o(r, { ...n });
21
- }
22
- function l({ baseUrl: e, widgetToken: t, organizationId: r, configClient: a, gatewayRouting: l, linkComponent: u, implementation: d, uiFramework: f, errorFallback: p, onError: m, finopsThemeColors: h, analytics: g, disclosuresAcceptance: _, providerLabels: v, pageTitleComponent: y = s, ...b }) {
23
- return /* @__PURE__ */ o(i, {
24
- widgetName: n,
25
- baseUrl: e,
26
- widgetToken: t,
27
- organizationId: r,
28
- configClient: a,
29
- gatewayRouting: l,
30
- linkComponent: u,
31
- implementation: d,
32
- uiFramework: f,
33
- errorFallback: p,
34
- onError: m,
35
- finopsThemeColors: h,
36
- analytics: g,
37
- disclosuresAcceptance: _,
38
- providerLabels: v,
39
- children: /* @__PURE__ */ o(c, {
40
- ...b,
41
- pageTitleComponent: y
42
- })
43
- });
44
- }
2
+ var e = { Mounted: "bill_pay_widget.mounted" }, t = "bill_pay_widget";
45
3
  //#endregion
46
- export { l as BillPayWidgetMonite, l as default };
4
+ export { e as BillPayWidgetAnalyticsEvent, t as WIDGET_NAME };
@@ -1 +1,46 @@
1
- import "./index62.js";
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { useAnalyticsTrack as e } from "../../../shared/feature/dist/lib/analytics/hooks.js";
6
+ import "../../../shared/feature/dist/index.js";
7
+ import { BillPayWidgetAnalyticsEvent as t, WIDGET_NAME as n } from "./index62.js";
8
+ import { Payables as r } from "../../../monite-sdk/dist/index444.js";
9
+ import "../../../monite-sdk/dist/index.js";
10
+ import { MoniteRegionProvider as i } from "../../../shared/monite-wrapper/feature/dist/lib/MoniteRegionProvider.js";
11
+ import "../../../shared/monite-wrapper/feature/dist/index.js";
12
+ import { useEffect as a } from "react";
13
+ import { jsx as o } from "react/jsx-runtime";
14
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js
15
+ var s = (e) => e;
16
+ function c(n) {
17
+ let i = e();
18
+ return a(() => {
19
+ i(t.Mounted);
20
+ }, [i]), /* @__PURE__ */ o(r, { ...n });
21
+ }
22
+ function l({ baseUrl: e, widgetToken: t, organizationId: r, configClient: a, gatewayRouting: l, linkComponent: u, implementation: d, uiFramework: f, errorFallback: p, onError: m, finopsThemeColors: h, analytics: g, disclosuresAcceptance: _, providerLabels: v, pageTitleComponent: y = s, ...b }) {
23
+ return /* @__PURE__ */ o(i, {
24
+ widgetName: n,
25
+ baseUrl: e,
26
+ widgetToken: t,
27
+ organizationId: r,
28
+ configClient: a,
29
+ gatewayRouting: l,
30
+ linkComponent: u,
31
+ implementation: d,
32
+ uiFramework: f,
33
+ errorFallback: p,
34
+ onError: m,
35
+ finopsThemeColors: h,
36
+ analytics: g,
37
+ disclosuresAcceptance: _,
38
+ providerLabels: v,
39
+ children: /* @__PURE__ */ o(c, {
40
+ ...b,
41
+ pageTitleComponent: y
42
+ })
43
+ });
44
+ }
45
+ //#endregion
46
+ export { l as BillPayWidgetMonite, l as default };
@@ -1,8 +1 @@
1
- //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js
2
- var e = (e) => [
3
- "bill-pay",
4
- "upload-queue",
5
- e ?? ""
6
- ];
7
- //#endregion
8
- export { e as billPayUploadQueueKey };
1
+ import "./index63.js";
@@ -1,12 +1,8 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.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
- };
2
+ var e = (e) => [
3
+ "bill-pay",
4
+ "upload-queue",
5
+ e ?? ""
6
+ ];
11
7
  //#endregion
12
- export { e as BILL_UPLOAD_QUEUE_LABELS_EN };
8
+ export { e as billPayUploadQueueKey };
@@ -1,112 +1,12 @@
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 { useEmbedApi as t } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
7
- import "../../../shared/ui/dist/index.js";
8
- import { useUploadPayableFromFileMutation as n } from "../../data-access/dist/index13.js";
9
- import { usePayableOcrQueries as r } from "../../data-access/dist/index15.js";
10
- import "../../data-access/dist/index.js";
11
- import { billPayUploadQueueKey as i } from "./index64.js";
12
- import { BILL_UPLOAD_QUEUE_LABELS_EN as a } from "./index65.js";
13
- import { useCallback as o, useEffect as s, useMemo as c, useState as l } from "react";
14
- import { useQuery as u, useQueryClient as d } from "@tanstack/react-query";
15
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js
16
- function f({ onOpenBill: f, labels: p } = {}) {
17
- let m = {
18
- ...a,
19
- ...p
20
- }, h = p?.tooManyFilesError ?? a.tooManyFilesError, g = p?.remainingCapacityError ?? a.remainingCapacityError, { organizationId: _ } = t(), v = d(), y = c(() => i(_), [_]), b = n(), [x, S] = l(!1), { data: C = [] } = u({
21
- queryKey: y,
22
- queryFn: () => v.getQueryData(y) ?? [],
23
- staleTime: Infinity,
24
- gcTime: Infinity,
25
- initialData: []
26
- }), w = o((e, t) => {
27
- v.setQueryData(y, (n) => (n ?? []).map((n) => n.localId === e ? {
28
- ...n,
29
- ...t
30
- } : n));
31
- }, [v, y]), T = o((e) => {
32
- v.setQueryData(y, (t) => (t ?? []).filter((t) => t.localId !== e));
33
- }, [v, y]), E = o((t) => {
34
- let n = (v.getQueryData(y) ?? []).filter((e) => e.status === "uploading").length;
35
- if (t.length + n > 10) {
36
- e.error(n > 0 ? g(10 - n) : h(10));
37
- return;
38
- }
39
- S(!1);
40
- for (let e of t) {
41
- let t = crypto.randomUUID();
42
- v.setQueryData(y, (n) => [...n ?? [], {
43
- localId: t,
44
- fileName: e.name,
45
- status: "uploading"
46
- }]), b.mutateAsync({ file: e }).then((e) => w(t, { payableId: e?.id })).catch(() => w(t, { status: "failed" }));
47
- }
48
- }, [
49
- w,
50
- v,
51
- y,
52
- g,
53
- h,
54
- b
55
- ]), D = r({ payableIds: C.filter((e) => e.status === "uploading" && e.payableId).map((e) => e.payableId) });
56
- s(() => {
57
- let e = /* @__PURE__ */ new Set();
58
- for (let t of D) if (t.suspectedDuplicateOf.length !== 0) {
59
- e.add(t.payableId);
60
- for (let n of t.suspectedDuplicateOf) e.add(n);
61
- }
62
- for (let { payableId: t, ocrStatus: n, isError: r } of D) {
63
- let i = C.find((e) => e.payableId === t && e.status === "uploading");
64
- i && (n === "success" ? w(i.localId, { status: e.has(t) ? "duplicate" : "ready" }) : (r || n === "error" || n === "canceled") && w(i.localId, { status: "failed" }));
65
- }
66
- for (let t of C) t.status === "ready" && t.payableId && e.has(t.payableId) && w(t.localId, { status: "duplicate" });
67
- }, [
68
- C,
69
- D,
70
- w
71
- ]);
72
- let O = C.filter((e) => e.status === "uploading"), k = C.filter((e) => e.status === "ready"), A = C.filter((e) => e.status === "duplicate"), j = C.filter((e) => e.status === "failed"), M = (e) => ({
73
- id: e.localId,
74
- fileName: e.fileName,
75
- status: e.status,
76
- onOpen: (e.status === "ready" || e.status === "duplicate") && e.payableId && f ? () => {
77
- f(e.payableId), T(e.localId);
78
- } : void 0
79
- }), N = O.length ? [{
80
- id: "in-progress",
81
- items: C.map(M)
82
- }] : [
83
- ...k.length ? [{
84
- id: "ready",
85
- caption: m.readyCaption(k.length),
86
- items: k.map(M)
87
- }] : [],
88
- ...A.length ? [{
89
- id: "duplicate",
90
- caption: m.duplicateCaption(A.length),
91
- items: A.map(M)
92
- }] : [],
93
- ...j.length ? [{
94
- id: "failed",
95
- caption: m.failedCaption(j.length),
96
- items: j.map(M)
97
- }] : []
98
- ], P = k.length + A.length, F = O.length ? m.uploadingSummary(C.length) : P ? m.completeSummary(P) : m.failedCaption(j.length), I = o(() => {
99
- v.setQueryData(y, []);
100
- }, [v, y]);
101
- return {
102
- enqueue: E,
103
- sections: N,
104
- summaryLabel: F,
105
- collapsed: x,
106
- onToggleCollapsed: o(() => S((e) => !e), []),
107
- onClose: I,
108
- isVisible: C.length > 0
109
- };
110
- }
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
+ };
111
11
  //#endregion
112
- export { f as useBillUploadQueue };
12
+ export { e as BILL_UPLOAD_QUEUE_LABELS_EN };
@@ -1,3 +1,112 @@
1
- import "./index64.js";
2
- import "./index65.js";
3
- import "./index66.js";
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 { useEmbedApi as t } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
7
+ import "../../../shared/ui/dist/index.js";
8
+ import { useUploadPayableFromFileMutation as n } from "../../data-access/dist/index13.js";
9
+ import { usePayableOcrQueries as r } from "../../data-access/dist/index15.js";
10
+ import "../../data-access/dist/index.js";
11
+ import { billPayUploadQueueKey as i } from "./index65.js";
12
+ import { BILL_UPLOAD_QUEUE_LABELS_EN as a } from "./index66.js";
13
+ import { useCallback as o, useEffect as s, useMemo as c, useState as l } from "react";
14
+ import { useQuery as u, useQueryClient as d } from "@tanstack/react-query";
15
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js
16
+ function f({ onOpenBill: f, labels: p } = {}) {
17
+ let m = {
18
+ ...a,
19
+ ...p
20
+ }, h = p?.tooManyFilesError ?? a.tooManyFilesError, g = p?.remainingCapacityError ?? a.remainingCapacityError, { organizationId: _ } = t(), v = d(), y = c(() => i(_), [_]), b = n(), [x, S] = l(!1), { data: C = [] } = u({
21
+ queryKey: y,
22
+ queryFn: () => v.getQueryData(y) ?? [],
23
+ staleTime: Infinity,
24
+ gcTime: Infinity,
25
+ initialData: []
26
+ }), w = o((e, t) => {
27
+ v.setQueryData(y, (n) => (n ?? []).map((n) => n.localId === e ? {
28
+ ...n,
29
+ ...t
30
+ } : n));
31
+ }, [v, y]), T = o((e) => {
32
+ v.setQueryData(y, (t) => (t ?? []).filter((t) => t.localId !== e));
33
+ }, [v, y]), E = o((t) => {
34
+ let n = (v.getQueryData(y) ?? []).filter((e) => e.status === "uploading").length;
35
+ if (t.length + n > 10) {
36
+ e.error(n > 0 ? g(10 - n) : h(10));
37
+ return;
38
+ }
39
+ S(!1);
40
+ for (let e of t) {
41
+ let t = crypto.randomUUID();
42
+ v.setQueryData(y, (n) => [...n ?? [], {
43
+ localId: t,
44
+ fileName: e.name,
45
+ status: "uploading"
46
+ }]), b.mutateAsync({ file: e }).then((e) => w(t, { payableId: e?.id })).catch(() => w(t, { status: "failed" }));
47
+ }
48
+ }, [
49
+ w,
50
+ v,
51
+ y,
52
+ g,
53
+ h,
54
+ b
55
+ ]), D = r({ payableIds: C.filter((e) => e.status === "uploading" && e.payableId).map((e) => e.payableId) });
56
+ s(() => {
57
+ let e = /* @__PURE__ */ new Set();
58
+ for (let t of D) if (t.suspectedDuplicateOf.length !== 0) {
59
+ e.add(t.payableId);
60
+ for (let n of t.suspectedDuplicateOf) e.add(n);
61
+ }
62
+ for (let { payableId: t, ocrStatus: n, isError: r } of D) {
63
+ let i = C.find((e) => e.payableId === t && e.status === "uploading");
64
+ i && (n === "success" ? w(i.localId, { status: e.has(t) ? "duplicate" : "ready" }) : (r || n === "error" || n === "canceled") && w(i.localId, { status: "failed" }));
65
+ }
66
+ for (let t of C) t.status === "ready" && t.payableId && e.has(t.payableId) && w(t.localId, { status: "duplicate" });
67
+ }, [
68
+ C,
69
+ D,
70
+ w
71
+ ]);
72
+ let O = C.filter((e) => e.status === "uploading"), k = C.filter((e) => e.status === "ready"), A = C.filter((e) => e.status === "duplicate"), j = C.filter((e) => e.status === "failed"), M = (e) => ({
73
+ id: e.localId,
74
+ fileName: e.fileName,
75
+ status: e.status,
76
+ onOpen: (e.status === "ready" || e.status === "duplicate") && e.payableId && f ? () => {
77
+ f(e.payableId), T(e.localId);
78
+ } : void 0
79
+ }), N = O.length ? [{
80
+ id: "in-progress",
81
+ items: C.map(M)
82
+ }] : [
83
+ ...k.length ? [{
84
+ id: "ready",
85
+ caption: m.readyCaption(k.length),
86
+ items: k.map(M)
87
+ }] : [],
88
+ ...A.length ? [{
89
+ id: "duplicate",
90
+ caption: m.duplicateCaption(A.length),
91
+ items: A.map(M)
92
+ }] : [],
93
+ ...j.length ? [{
94
+ id: "failed",
95
+ caption: m.failedCaption(j.length),
96
+ items: j.map(M)
97
+ }] : []
98
+ ], P = k.length + A.length, F = O.length ? m.uploadingSummary(C.length) : P ? m.completeSummary(P) : m.failedCaption(j.length), I = o(() => {
99
+ v.setQueryData(y, []);
100
+ }, [v, y]);
101
+ return {
102
+ enqueue: E,
103
+ sections: N,
104
+ summaryLabel: F,
105
+ collapsed: x,
106
+ onToggleCollapsed: o(() => S((e) => !e), []),
107
+ onClose: I,
108
+ isVisible: C.length > 0
109
+ };
110
+ }
111
+ //#endregion
112
+ export { f as useBillUploadQueue };