@tesouro/embedded-components-react 0.5.141 → 0.5.144

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 (168) 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 +11 -11
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +1 -1
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +1 -1
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +2 -2
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +2 -2
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +9 -24
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +21 -37
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +21 -14
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +41 -8
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +16 -4
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +8 -98
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +4 -83
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +98 -3
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +78 -135
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +4 -45
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +139 -109
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +44 -186
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +108 -72
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +188 -29
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +71 -83
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +27 -406
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +88 -12
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +403 -77
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +13 -80
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +77 -221
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +78 -41
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +212 -234
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +44 -21
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +234 -557
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +23 -4
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +581 -40
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +4 -251
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +45 -3
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +261 -2
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +3 -46
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +4 -1
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +44 -6
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +1 -13
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +6 -127
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js +13 -3
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +126 -3
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +3 -127
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js +3 -8
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +124 -7
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js +8 -46
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index77.js +8 -21
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index78.js +51 -20
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index79.js +20 -28
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index80.js +19 -83
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index81.js +28 -47
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index82.js +76 -252
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index83.js +48 -33
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index84.js +249 -142
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index85.js +27 -206
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index86.js +160 -4
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index87.js +217 -5
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index88.js +3 -112
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index89.js +7 -1
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index90.js +104 -18
  62. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index91.js +1 -0
  63. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index92.js +27 -0
  64. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +48 -48
  65. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index100.js +12 -2
  66. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index101.js +102 -27
  67. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index102.js +2 -128
  68. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index103.js +31 -2
  69. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index104.js +125 -30
  70. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index105.js +2 -10
  71. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index106.js +29 -177
  72. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index107.js +10 -2
  73. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index108.js +178 -11
  74. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index109.js +2 -108
  75. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index110.js +14 -2
  76. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index111.js +106 -8
  77. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index112.js +2 -52
  78. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index113.js +10 -2
  79. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index114.js +52 -0
  80. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index115.js +2 -0
  81. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index16.js +26 -16
  82. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index17.js +14 -19
  83. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index18.js +16 -11
  84. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index19.js +19 -14
  85. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index20.js +14 -2
  86. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index21.js +16 -2
  87. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index22.js +2 -30
  88. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index23.js +4 -2
  89. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index24.js +26 -28
  90. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index25.js +1 -0
  91. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index26.js +28 -31
  92. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index27.js +1 -19
  93. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index28.js +27 -117
  94. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index29.js +19 -2
  95. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index30.js +123 -2
  96. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index31.js +2 -16
  97. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index32.js +4 -2
  98. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index33.js +14 -2
  99. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index34.js +2 -22
  100. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index35.js +4 -2
  101. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index36.js +20 -99
  102. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index37.js +2 -79
  103. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index38.js +97 -273
  104. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index39.js +79 -2
  105. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index40.js +273 -18
  106. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index41.js +2 -56
  107. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index42.js +21 -2
  108. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index43.js +52 -14
  109. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index44.js +2 -50
  110. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index45.js +18 -2
  111. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index46.js +47 -32
  112. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index47.js +2 -374
  113. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index48.js +35 -2
  114. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index49.js +369 -18
  115. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index50.js +2 -96
  116. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index51.js +23 -2
  117. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index52.js +93 -29
  118. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index53.js +1 -51
  119. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index54.js +31 -1
  120. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index55.js +49 -53
  121. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index56.js +2 -13
  122. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index57.js +53 -194
  123. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index58.js +13 -2
  124. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index59.js +195 -2
  125. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index60.js +2 -41
  126. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index61.js +4 -2
  127. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index62.js +37 -15
  128. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index63.js +2 -88
  129. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index64.js +19 -2
  130. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index65.js +78 -308
  131. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index66.js +2 -9
  132. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index67.js +311 -27
  133. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index68.js +9 -2
  134. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index69.js +33 -2
  135. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index70.js +1 -0
  136. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index71.js +2 -8
  137. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index72.js +1 -39
  138. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index73.js +8 -2
  139. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index74.js +37 -2
  140. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index75.js +2 -36
  141. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index76.js +4 -2
  142. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index77.js +34 -37
  143. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index78.js +2 -12
  144. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index79.js +37 -199
  145. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index80.js +12 -3
  146. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index81.js +199 -15
  147. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index82.js +2 -402
  148. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index83.js +13 -6
  149. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index84.js +413 -6
  150. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index85.js +8 -91
  151. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index86.js +9 -0
  152. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index87.js +93 -2
  153. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index89.js +2 -28
  154. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index90.js +118 -87
  155. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index91.js +28 -2
  156. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index92.js +92 -5
  157. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index93.js +2 -30
  158. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index94.js +7 -2
  159. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index95.js +28 -5
  160. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index96.js +2 -34
  161. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index97.js +7 -2
  162. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index98.js +32 -10
  163. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index99.js +1 -105
  164. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  165. package/dist/libs/tesouro-embedded-components-react/shared/util/dist/lib/relativeCalendarDay.js +12 -0
  166. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index8.js +1 -1
  167. package/package.json +1 -1
  168. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index88.js +0 -125
@@ -1,35 +1,50 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { useCounterpartsByIdsQuery as e } from "../../../shared/counterpart-management/data-access/dist/index3.js";
6
- import { resolveVendorName as t } from "./index8.js";
7
- import { getCounterpartName as n } from "../../../shared/counterpart-management/feature/dist/lib/helpers.js";
8
- import "../../../shared/counterpart-management/feature/dist/index.js";
9
- import { useMemo as r } from "react";
1
+ import { BillStatusFilter as e } from "./index81.js";
2
+ import { BillsDatePreset as t } from "./index82.js";
10
3
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index83.js
11
- var i = {
12
- Resolving: "resolving",
13
- Unavailable: "unavailable",
14
- Settled: "settled"
15
- }, a = /* @__PURE__ */ new Map();
16
- function o({ payables: i, enabled: o, canReadVendors: c = !0, isPaused: l = !1 } = {}) {
17
- let u = r(() => (i ?? []).filter((e) => !t(e)).map((e) => e.counterpart_id).filter((e) => !!e), [i]), d = e({
18
- counterpartIds: u,
19
- enabled: o !== !1 && c && !l
20
- }), f = !c && !l;
21
- return {
22
- vendorNames: r(() => f ? a : new Map((d.data?.data ?? []).map((e) => [e.id, n(e)]).filter((e) => !!e[1])), [d.data?.data, f]),
23
- lookup: s({
24
- hasUnresolvedIds: u.length > 0,
25
- isScopeWithdrawn: f,
26
- isFetching: d.isFetching,
27
- isError: d.isError
28
- })
29
- };
30
- }
31
- function s({ hasUnresolvedIds: e, isScopeWithdrawn: t, isFetching: n, isError: r }) {
32
- return e ? t ? i.Unavailable : n ? i.Resolving : r ? i.Unavailable : i.Settled : i.Settled;
33
- }
4
+ var n = {
5
+ presets: {
6
+ [t.Today]: "Today",
7
+ [t.ThisWeek]: "This week",
8
+ [t.ThisMonth]: "This month",
9
+ [t.ThisQuarter]: "This quarter",
10
+ [t.ThisYear]: "This year",
11
+ [t.Yesterday]: "Yesterday",
12
+ [t.LastWeek]: "Last week",
13
+ [t.LastMonth]: "Last month",
14
+ [t.Last30Days]: "Last 30 days",
15
+ [t.Last90Days]: "Last 90 days",
16
+ [t.LastQuarter]: "Last quarter",
17
+ [t.LastYear]: "Last year"
18
+ },
19
+ presetGroupCurrent: "Current",
20
+ presetGroupPast: "Past",
21
+ statuses: {
22
+ [e.Draft]: "Draft",
23
+ [e.ReadyToSubmit]: "Ready to submit",
24
+ [e.PendingApproval]: "Pending review",
25
+ [e.ReadyToPay]: "Ready to pay",
26
+ [e.Paid]: "Paid",
27
+ [e.Canceled]: "Cancelled",
28
+ [e.Rejected]: "Rejected"
29
+ },
30
+ dateFieldNames: {
31
+ issueDate: "Issue date",
32
+ dueDate: "Due date",
33
+ addedOn: "Added on"
34
+ },
35
+ dateChip: (e, t) => `${e}: ${t}`,
36
+ statusChip: (e) => `Status: ${e}`,
37
+ vendorChip: (e) => `Vendor: ${e}`,
38
+ amountChip: (e) => `Total amount: ${e}`,
39
+ attachmentChipHas: "Has attachment",
40
+ attachmentChipNone: "No attachment",
41
+ moreSelected: (e, t) => `${e} + ${t} more`,
42
+ amountAtLeast: (e) => `${e} or more`,
43
+ amountAtMost: (e) => `${e} or less`,
44
+ amountBetween: (e, t) => `${e} - ${t}`,
45
+ dateRange: (e, t) => `${e} - ${t}`,
46
+ dateFrom: (e) => `From ${e}`,
47
+ dateTo: (e) => `Until ${e}`
48
+ };
34
49
  //#endregion
35
- export { i as BillVendorLookup, o as useBillVendorNames };
50
+ export { n as BILLS_FILTER_LABELS_EN };
@@ -2,154 +2,261 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { useEmbedApi as e } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
6
- import { formatCalendarDate as t } from "../../../shared/util/dist/lib/formatCalendarDate.js";
7
- import { formatMoneyExact as n } from "../../../shared/util/dist/lib/formatMoneyExact.js";
8
- import { hasSuspectedPayableDuplicate as r } from "../../data-access/dist/index7.js";
9
- import { usePayablesQuery as i, usePayablesTotalCountQuery as a } from "../../data-access/dist/index17.js";
5
+ import { formatMoneyExact as e } from "../../../shared/util/dist/lib/formatMoneyExact.js";
6
+ import { useCounterpartsQuery as t } from "../../../shared/counterpart-management/data-access/dist/index3.js";
10
7
  import "../../data-access/dist/index.js";
11
- import { derivePayableStatus as o } from "./index7.js";
12
- import { resolveVendorName as ee } from "./index8.js";
13
- import { isEditablePayableStatus as te } from "./index19.js";
14
- import { BillQueue as s, DEFAULT_BILL_QUEUE as c, billQueueColumns as l, billQueueHasScheduledPayment as u, billQueueOffersAddPanel as d, billQueueStatuses as f, billSortColumnId as ne, billSortField as re } from "./index73.js";
15
- import { useBillsFilters as ie } from "./index82.js";
16
- import { BillVendorLookup as p, useBillVendorNames as ae } from "./index83.js";
17
- import { useCallback as m, useEffect as h, useMemo as g, useState as _ } from "react";
8
+ import { BillsFilterField as n } from "../../ui/dist/index80.js";
9
+ import "../../ui/dist/index.js";
10
+ import { getCounterpartName as r } from "../../../shared/counterpart-management/feature/dist/lib/helpers.js";
11
+ import "../../../shared/counterpart-management/feature/dist/index.js";
12
+ import { BILL_STATUS_FILTER_ORDER as i, billStatusFilterApiValues as a } from "./index81.js";
13
+ import { BillsDatePreset as o, resolveDatePreset as s } from "./index82.js";
14
+ import { BILLS_FILTER_LABELS_EN as c } from "./index83.js";
15
+ import { useCallback as l, useEffect as u, useMemo as d, useState as f } from "react";
16
+ import { format as p, formatISO as m } from "date-fns";
18
17
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index84.js
19
- var oe = 10, v = [{
20
- id: "addedOnLabel",
21
- desc: !0
22
- }];
23
- function y({ enabled: p = !0, canReadVendors: y = !0, isVendorFilterPaused: b = !1, filterLabels: x, onOpenBill: S, duplicateRowNote: C, attachmentLabel: w }) {
24
- let [T, E] = _(c), [D, O] = _(v), [k, A] = _(oe), [j, M] = _(), [N, P] = _(""), [F, ce] = _(""), I = m(() => M(void 0), []);
25
- h(() => {
26
- if (N === F) return;
27
- let e = setTimeout(() => {
28
- ce(N), I();
29
- }, 300);
18
+ var h = {
19
+ Date: "date",
20
+ Status: "status",
21
+ Amount: "amount",
22
+ Vendor: "vendor",
23
+ Attachment: "attachment"
24
+ }, g = 50, _ = 300, v = "MMM d, yyyy", y = 864e5, b = {
25
+ [n.IssueDate]: "issued_at",
26
+ [n.DueDate]: "due_date",
27
+ [n.AddedOn]: "created_at"
28
+ }, x = {
29
+ [o.Today]: "current",
30
+ [o.ThisWeek]: "current",
31
+ [o.ThisMonth]: "current",
32
+ [o.ThisQuarter]: "current",
33
+ [o.ThisYear]: "current",
34
+ [o.Yesterday]: "past",
35
+ [o.LastWeek]: "past",
36
+ [o.LastMonth]: "past",
37
+ [o.Last30Days]: "past",
38
+ [o.Last90Days]: "past",
39
+ [o.LastQuarter]: "past",
40
+ [o.LastYear]: "past"
41
+ };
42
+ function S() {
43
+ return {
44
+ dateField: n.DueDate,
45
+ statuses: [],
46
+ amountMode: "any",
47
+ amountMin: "",
48
+ amountMax: "",
49
+ vendorIds: []
50
+ };
51
+ }
52
+ function C(e) {
53
+ let t = Number.parseFloat(e);
54
+ return Number.isFinite(t) ? Math.round(t * 100) : void 0;
55
+ }
56
+ function w({ offersStatusFilter: o = !1, offersVendorFilter: w = !0, isVendorFilterPaused: T = !1, onFiltersChange: E, labels: D } = {}) {
57
+ let O = d(() => ({
58
+ ...c,
59
+ ...D,
60
+ presets: {
61
+ ...c.presets,
62
+ ...D?.presets
63
+ },
64
+ statuses: {
65
+ ...c.statuses,
66
+ ...D?.statuses
67
+ },
68
+ dateFieldNames: {
69
+ ...c.dateFieldNames,
70
+ ...D?.dateFieldNames
71
+ }
72
+ }), [D]), [k, A] = f(S), [j, M] = f({}), [N, P] = f(""), [F, I] = f(""), L = l((e) => {
73
+ A((t) => ({
74
+ ...t,
75
+ ...e
76
+ })), E?.();
77
+ }, [E]);
78
+ u(() => {
79
+ w || A((e) => e.vendorIds.length === 0 ? e : (E?.(), {
80
+ ...e,
81
+ vendorIds: []
82
+ }));
83
+ }, [w, E]), u(() => {
84
+ o || A((e) => e.statuses.length === 0 ? e : (E?.(), {
85
+ ...e,
86
+ statuses: []
87
+ }));
88
+ }, [o, E]), u(() => {
89
+ let e = setTimeout(() => I(N.trim()), _);
30
90
  return () => clearTimeout(e);
91
+ }, [N]);
92
+ let R = t({
93
+ enabled: w && !T,
94
+ is_vendor: !0,
95
+ sort: "counterpart_name",
96
+ order: "asc",
97
+ limit: g,
98
+ counterpart_name__icontains: F || void 0
99
+ }), z = d(() => (R.data?.data ?? []).map((e) => ({
100
+ value: e.id,
101
+ label: r(e)
102
+ })), [R.data?.data]), B = d(() => i.map((e) => ({
103
+ value: e,
104
+ label: O.statuses[e]
105
+ })), [O.statuses]), V = d(() => Object.entries(x).map(([e, t]) => ({
106
+ value: e,
107
+ label: O.presets[e],
108
+ group: t === "current" ? O.presetGroupCurrent : O.presetGroupPast
109
+ })), [
110
+ O.presetGroupCurrent,
111
+ O.presetGroupPast,
112
+ O.presets
113
+ ]), H = d(() => {
114
+ let e = {}, t = b[k.dateField], n = (e) => Date.UTC(e.getFullYear(), e.getMonth(), e.getDate());
115
+ if (k.dateFrom && (e[`${t}__gte`] = t === "created_at" ? new Date(n(k.dateFrom)).toISOString() : m(k.dateFrom, { representation: "date" })), k.dateTo && (t === "created_at" ? e.created_at__lt = new Date(n(k.dateTo) + y).toISOString() : e[`${t}__lte`] = m(k.dateTo, { representation: "date" })), k.statuses.length > 0 && (e.status__in = a(k.statuses)), k.amountMode !== "any") {
116
+ let t = "total_amount__gte", n = "total_amount__lte", r = C(k.amountMin), i = C(k.amountMax);
117
+ k.amountMode === "exact" ? r !== void 0 && (e[t] = r, e[n] = r) : (r !== void 0 && (e[t] = r), i !== void 0 && (e[n] = i));
118
+ }
119
+ return k.vendorIds.length > 0 && (e.counterpart_id__in = [...k.vendorIds]), k.hasFile !== void 0 && (e.has_file = k.hasFile), e;
120
+ }, [k]), U = d(() => {
121
+ let t = [], n = (e) => p(e, v), r = (e) => {
122
+ let [t, ...n] = e;
123
+ return t ? n.length === 0 ? t : O.moreSelected(t, n.length) : "";
124
+ };
125
+ if (k.dateFrom || k.dateTo) {
126
+ let e = (k.datePreset ? O.presets[k.datePreset] : void 0) ?? (k.dateFrom && k.dateTo ? O.dateRange(n(k.dateFrom), n(k.dateTo)) : k.dateFrom ? O.dateFrom(n(k.dateFrom)) : O.dateTo(n(k.dateTo)));
127
+ t.push({
128
+ key: h.Date,
129
+ label: O.dateChip(O.dateFieldNames[k.dateField], e)
130
+ });
131
+ }
132
+ if (k.statuses.length > 0 && t.push({
133
+ key: h.Status,
134
+ label: O.statusChip(r(k.statuses.map((e) => O.statuses[e] ?? e)))
135
+ }), k.vendorIds.length > 0 && t.push({
136
+ key: h.Vendor,
137
+ label: O.vendorChip(r(k.vendorIds.map((e) => j[e] ?? e)))
138
+ }), k.amountMode !== "any") {
139
+ let n = (t) => {
140
+ let n = Number.parseFloat(t);
141
+ return Number.isFinite(n) ? e(n, { currencyCode: "USD" }) : "";
142
+ }, r = n(k.amountMin), i = n(k.amountMax), a = k.amountMode === "exact" ? r : r && i ? O.amountBetween(r, i) : r ? O.amountAtLeast(r) : i ? O.amountAtMost(i) : "";
143
+ a && t.push({
144
+ key: h.Amount,
145
+ label: O.amountChip(a)
146
+ });
147
+ }
148
+ return k.hasFile !== void 0 && t.push({
149
+ key: h.Attachment,
150
+ label: k.hasFile ? O.attachmentChipHas : O.attachmentChipNone
151
+ }), t;
31
152
  }, [
32
- N,
33
- F,
34
- I
35
- ]);
36
- let L = ie({
37
- offersStatusFilter: T === s.All,
38
- offersVendorFilter: y,
39
- isVendorFilterPaused: b,
40
- labels: x,
41
- onFiltersChange: I
42
- }), { filterByVendor: R } = L, z = D[0], B = re(z?.id), V = B ? z?.desc ? "desc" : "asc" : void 0, H = g(() => ({
43
- ...L.query,
44
- limit: k,
45
- pagination_token: j,
46
- status__in: f(T) ?? L.query.status__in,
47
- has_scheduled_payment: u(T),
48
- counterpart_name__icontains: F || void 0,
49
- sort: B,
50
- order: V
51
- }), [
52
- L.query,
153
+ O,
53
154
  k,
54
- j,
55
- T,
56
- F,
57
- B,
58
- V
59
- ]), { organizationId: U } = e(), W = JSON.stringify([U, H]), G = i({
60
- ...H,
61
- enabled: p,
62
- pollWhileOcrProcessing: !0
63
- }), [le, ue] = _(W);
64
- h(() => {
65
- G.isFetching || ue(W);
66
- }, [G.isFetching, W]);
67
- let K = G.data?.data.length, q = K === 0, J = a({ enabled: p && q }), Y = !q || (J.data?.count ?? 1) > 0, { vendorNames: X, lookup: Z } = ae({
68
- payables: G.data?.data,
69
- enabled: p,
70
- canReadVendors: y,
71
- isPaused: b
72
- }), Q = g(() => (G.data?.data ?? []).filter((e) => e.ocr_status !== "processing").map((e) => {
73
- let i = o({
74
- apiStatus: e.status,
75
- dueDate: e.due_date,
76
- scheduledPaymentDate: e.scheduled_payment_date
77
- }), a = e.amount_due ?? e.total_amount, c = e.status === "partially_paid" || e.status === "paid", l = (t) => t == null ? "" : n(t / 100, { currencyCode: e.currency ?? "USD" }), u = ee(e) || (e.counterpart_id ? X.get(e.counterpart_id) ?? "" : "");
78
- return {
79
- rowKey: e.id,
80
- vendorLabel: u,
81
- vendorLookup: u || !e.counterpart_id ? void 0 : se(Z),
82
- issueDateLabel: t(e.issued_at),
83
- dueDateLabel: t(e.due_date),
84
- dueDateTone: i.isOverdue ? "danger" : "default",
85
- scheduledDateLabel: t(e.scheduled_payment_date),
86
- scheduledDateIsGap: T === s.Scheduled,
87
- paidDateLabel: t(e.paid_at?.slice(0, 10)),
88
- amountDueLabel: l(a),
89
- amountPaidLabel: c ? l(e.amount_paid) : "",
90
- amountPaidIsGap: T === s.Paid,
91
- amountScheduledLabel: l(e.amount_to_pay ?? a),
92
- totalAmountLabel: l(e.total_amount),
93
- attachment: e.file_id ? { label: w } : void 0,
94
- status: i.status,
95
- statusTone: i.tone,
96
- addedOnLabel: t(e.created_at?.slice(0, 10)),
97
- ...r(e) ? {
98
- rowTone: "warning",
99
- rowNote: C
100
- } : {},
101
- onOpen: () => S(e.id, te(e.status))
102
- };
103
- }), [
104
- G.data?.data,
105
- C,
106
- w,
107
- S,
108
- T,
109
- X,
110
- Z
111
- ]), $ = m((e) => {
112
- let t = e;
113
- E(t), O((e) => {
114
- let n = e[0]?.id;
115
- return n ? l(t).some((e) => ne(e) === n) ? e : v : e;
116
- }), I();
117
- }, [I]), de = m((e) => {
118
- $(s.All), P(""), R(e);
119
- }, [R, $]), fe = m((e) => {
120
- O((t) => typeof e == "function" ? e(t) : e), I();
121
- }, [I]), pe = m((e) => {
122
- A(e), I();
123
- }, [I]), me = m(() => M(G.data?.next_pagination_token ?? void 0), [G.data?.next_pagination_token]), he = m(() => M(G.data?.prev_pagination_token ?? void 0), [G.data?.prev_pagination_token]), ge = m(() => {
124
- G.refetch();
125
- }, [G.refetch]);
155
+ j
156
+ ]), W = l((e) => {
157
+ switch (e) {
158
+ case h.Date:
159
+ L({
160
+ datePreset: void 0,
161
+ dateFrom: void 0,
162
+ dateTo: void 0
163
+ });
164
+ break;
165
+ case h.Status:
166
+ L({ statuses: [] });
167
+ break;
168
+ case h.Vendor:
169
+ L({ vendorIds: [] });
170
+ break;
171
+ case h.Amount:
172
+ L({
173
+ amountMode: "any",
174
+ amountMin: "",
175
+ amountMax: ""
176
+ });
177
+ break;
178
+ case h.Attachment: L({ hasFile: void 0 });
179
+ }
180
+ }, [L]), G = l(() => {
181
+ A(S()), E?.();
182
+ }, [E]), K = l((e) => {
183
+ M((t) => ({
184
+ ...t,
185
+ [e.id]: e.name
186
+ })), A({
187
+ ...S(),
188
+ vendorIds: [e.id]
189
+ }), E?.();
190
+ }, [E]), q = l((e) => {
191
+ M((t) => {
192
+ let n = { ...t };
193
+ for (let t of z) e.includes(t.value) && (n[t.value] = t.label);
194
+ return n;
195
+ }), L({ vendorIds: e });
196
+ }, [L, z]);
126
197
  return {
127
- rows: Q,
128
- isLoading: G.isLoading || W !== le || q && J.isLoading || (K ?? 0) > 0 && Q.length === 0,
129
- isError: G.isError,
130
- onRetry: ge,
131
- selectedFilterTabId: T,
132
- onFilterTabChange: $,
133
- showVendorBills: de,
134
- searchValue: N,
135
- onSearchChange: P,
136
- hasAnyBills: Y,
137
- isSearchActive: F.length > 0 || L.isFilterActive,
138
- filterBarProps: L.filterBarProps,
139
- visibleColumns: l(T),
140
- showAddPanelWhenEmpty: d(T),
141
- sorting: D,
142
- onSortingChange: fe,
143
- pageSize: k,
144
- onPageSizeChange: pe,
145
- hasNextPage: !!G.data?.next_pagination_token,
146
- hasPrevPage: !!G.data?.prev_pagination_token,
147
- onNextPage: me,
148
- onPrevPage: he
198
+ filterBarProps: {
199
+ fields: [...d(() => [
200
+ ...w ? [n.Vendor] : [],
201
+ n.IssueDate,
202
+ n.DueDate,
203
+ ...o ? [n.Status] : [],
204
+ n.TotalAmount,
205
+ n.AddedOn,
206
+ n.Attachment
207
+ ], [o, w])],
208
+ activeFilterCount: U.length,
209
+ chips: U,
210
+ onRemoveChip: W,
211
+ onClearAll: G,
212
+ dateField: k.dateField,
213
+ onDateFieldChange: (e) => {
214
+ let t = !!(k.dateFrom || k.dateTo);
215
+ A((t) => ({
216
+ ...t,
217
+ dateField: e
218
+ })), t && E?.();
219
+ },
220
+ datePresets: V,
221
+ selectedDatePreset: k.datePreset,
222
+ dateFrom: k.dateFrom,
223
+ dateTo: k.dateTo,
224
+ onDateRangeChange: ({ from: e, to: t }) => L({
225
+ datePreset: void 0,
226
+ dateFrom: e,
227
+ dateTo: t
228
+ }),
229
+ onDatePresetChange: (e) => {
230
+ let t = /* @__PURE__ */ new Date(), r = k.dateField === n.AddedOn ? new Date(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate()) : t, { from: i, to: a } = s(e, r);
231
+ L({
232
+ datePreset: e,
233
+ dateFrom: i,
234
+ dateTo: a
235
+ });
236
+ },
237
+ statusOptions: B,
238
+ selectedStatuses: k.statuses,
239
+ onStatusChange: (e) => L({ statuses: e }),
240
+ amountMode: k.amountMode,
241
+ onAmountModeChange: (e) => L({ amountMode: e }),
242
+ amountMin: k.amountMin,
243
+ amountMax: k.amountMax,
244
+ onAmountMinChange: (e) => L({ amountMin: e }),
245
+ onAmountMaxChange: (e) => L({ amountMax: e }),
246
+ vendorOptions: z,
247
+ selectedVendors: k.vendorIds,
248
+ onVendorChange: q,
249
+ vendorSearchValue: N,
250
+ onVendorSearchChange: P,
251
+ isVendorLoading: R.isLoading || T,
252
+ isVendorError: R.isError,
253
+ hasAttachment: k.hasFile,
254
+ onHasAttachmentChange: (e) => L({ hasFile: e })
255
+ },
256
+ query: H,
257
+ isFilterActive: U.length > 0,
258
+ filterByVendor: K
149
259
  };
150
260
  }
151
- function se(e) {
152
- return e === p.Settled ? void 0 : e;
153
- }
154
261
  //#endregion
155
- export { y as useBillsTable };
262
+ export { h as BillsFilterChipKey, w as useBillsFilters };