@tesouro/embedded-components-react 0.11.179 → 0.11.181

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 (108) hide show
  1. package/dist/index.css +22 -0
  2. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index.js +24 -23
  3. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index10.js +16 -18
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index11.js +3 -3
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index12.js +5 -7
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index13.js +2 -2
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index14.js +4 -3
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index15.js +13 -27
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index16.js +34 -19
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index17.js +23 -16
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index18.js +26 -12
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index19.js +12 -57
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index2.js +34 -85
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index20.js +48 -29
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index21.js +36 -20
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index22.js +20 -18
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index23.js +14 -37
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index24.js +31 -14
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index25.js +26 -2
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index26.js +2 -0
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index3.js +90 -20
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index4.js +30 -8
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index5.js +8 -74
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index6.js +60 -19
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index7.js +6 -5
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index8.js +12 -17
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index9.js +20 -12
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index.js +7 -7
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index10.js +17 -36
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index11.js +42 -54
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index12.js +89 -6
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index13.js +5 -21
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index14.js +15 -92
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index15.js +103 -10
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index16.js +10 -9
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index17.js +8 -7
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index18.js +7 -9
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index19.js +11 -29
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index20.js +24 -24
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index21.js +22 -14
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index22.js +14 -137
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index23.js +139 -13
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index24.js +12 -18
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index25.js +15 -32
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index26.js +39 -108
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index27.js +96 -80
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index28.js +94 -3
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index29.js +4 -57
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index30.js +56 -116
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index31.js +114 -197
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index32.js +194 -75
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index33.js +75 -67
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index34.js +69 -111
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index35.js +108 -459
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index36.js +450 -102
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index37.js +117 -9
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index38.js +8 -85
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index39.js +73 -67
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index4.js +1 -1
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index40.js +71 -246
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index41.js +251 -40
  62. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index42.js +38 -237
  63. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index43.js +244 -21
  64. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index44.js +21 -529
  65. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index45.js +530 -4
  66. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index46.js +4 -44
  67. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index47.js +41 -242
  68. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index48.js +245 -3
  69. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index49.js +3 -5
  70. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index50.js +4 -63
  71. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index51.js +64 -1
  72. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index52.js +1 -0
  73. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index9.js +6 -18
  74. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index3.js +7 -3
  75. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index.js +4 -4
  76. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index10.js +14 -17
  77. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index11.js +82 -13
  78. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index12.js +47 -83
  79. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index13.js +261 -47
  80. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index14.js +23 -251
  81. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index15.js +450 -25
  82. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index16.js +286 -442
  83. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index17.js +4 -300
  84. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index18.js +5 -4
  85. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index19.js +37 -4
  86. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index20.js +1 -38
  87. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index5.js +11 -11
  88. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index7.js +88 -7
  89. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index8.js +17 -89
  90. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index9.js +18 -18
  91. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index10.js +4 -4
  92. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index18.js +0 -1
  93. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index20.js +263 -262
  94. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/lib/invalidatePayableQueries/approvalDecisionQueries.js +22 -19
  95. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/lib/invalidatePayableQueries/invalidatePayableQueries.js +20 -20
  96. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/lib/queryKeys.js +32 -21
  97. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidget/BillsTab.js +2 -2
  98. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/mocks/labels.js +1 -1
  99. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/index.js +4 -4
  100. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +42 -42
  101. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +237 -215
  102. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +151 -135
  103. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  104. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/index.js +7 -5
  105. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/AttentionStrip/AttentionStrip.js +29 -0
  106. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/AttentionStrip/AttentionViewBar.js +33 -0
  107. package/package.json +1 -1
  108. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index21.js +0 -1
@@ -1,19 +1,7 @@
1
- import { ApprovalPoliciesSettingsDefaultLabels as e } from "../../../../shared/approval-policy/feature/dist/lib/labels.js";
2
- import "../../../../shared/approval-policy/feature/dist/index.js";
3
1
  // ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index9.js
4
- var t = {
5
- deletedBadge: "Deleted",
6
- deletedNote: "This rule was deleted after this bill was submitted.",
7
- deletedApprovalsNote: "The approvals below still apply to this bill.",
8
- noRuleTitle: "No approval rule",
9
- noRuleSentence: "No rule covered this bill when it was submitted.",
10
- ruleTitleRange: e.ruleTitleRange,
11
- ruleTitleUpTo: e.ruleTitleUpTo,
12
- ruleTitleFrom: e.ruleTitleFrom,
13
- ruleTitleAny: e.ruleTitleAny,
14
- ruleSentenceRange: e.ruleSentenceRange,
15
- ruleSentenceUpTo: e.ruleSentenceUpTo,
16
- ruleSentenceFrom: e.ruleSentenceFrom,
17
- ruleSentenceAny: e.ruleSentenceAny
18
- };
19
- export { t as APPROVAL_POLICY_RULE_COPY_EN };
2
+ function e(e, t) {
3
+ let n;
4
+ for (let t of e ?? []) (!n || Date.parse(t.created_at) > Date.parse(n.created_at)) && (n = t);
5
+ if (n && t) return Date.parse(n.created_at) >= Date.parse(t) - 5e3 ? n : void 0;
6
+ }
7
+ export { e as currentApprovalProcess };
@@ -42,9 +42,9 @@ function d({ view: d, labels: f }) {
42
42
  color: "muted",
43
43
  children: p.stepConnector
44
44
  }), /* @__PURE__ */ o("div", { className: "ttw:h-px ttw:flex-1 ttw:bg-border" })]
45
- }) : null, /* @__PURE__ */ o("div", {
45
+ }) : null, /* @__PURE__ */ s("div", {
46
46
  className: "ttw:flex ttw:flex-wrap ttw:items-center ttw:gap-1.5",
47
- children: e.chips.map((e, t) => /* @__PURE__ */ s(a, { children: [t > 0 ? /* @__PURE__ */ o(r, {
47
+ children: [e.chips.map((e, t) => /* @__PURE__ */ s(a, { children: [t > 0 ? /* @__PURE__ */ o(r, {
48
48
  variant: "body2",
49
49
  color: "muted",
50
50
  children: p.chipConnector
@@ -55,7 +55,11 @@ function d({ view: d, labels: f }) {
55
55
  "aria-label": p.approvedIndicator,
56
56
  className: "ttw:size-3.5 ttw:text-emerald-600"
57
57
  }) : null]
58
- })] }, e.id))
58
+ })] }, e.id)), e.caption ? /* @__PURE__ */ o(r, {
59
+ variant: "body2",
60
+ color: "muted",
61
+ children: e.caption
62
+ }) : null]
59
63
  })] }, e.id))
60
64
  ]
61
65
  })]
@@ -1,7 +1,7 @@
1
1
  import "./index5.js";
2
- import "./index8.js";
2
+ import "./index7.js";
3
+ import "./index15.js";
3
4
  import "./index16.js";
4
5
  import "./index17.js";
5
- import "./index18.js";
6
- export { BillsListWidget } from "./index20.js";
7
- import "./index21.js";
6
+ export { BillsListWidget } from "./index19.js";
7
+ import "./index20.js";
@@ -1,19 +1,16 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { BILL_QUEUE_ORDER as e, billQueueFilters as t } from "./index5.js";
6
- import { usePayablesCountQueries as n } from "../../data-access/dist/index3.js";
7
- import "../../data-access/dist/index.js";
8
- import { useMemo as r, useState as i } from "react";
1
+ import { BanIcon as e, Trash2Icon as t } from "lucide-react";
9
2
  // ../../libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index10.js
10
- function a({ enabled: a = !0, canPay: o } = {}) {
11
- let [s, c] = i(o);
12
- o !== void 0 && s !== o && c(o);
13
- let l = o ?? s, u = r(() => e.map((e) => t(e, l ?? !1)), [l]), d = n({
14
- filters: u,
15
- enabled: a && o !== void 0
16
- });
17
- return r(() => Object.fromEntries(e.map((e, t) => [e, d[t]?.count])), [d]);
3
+ function n(n, r) {
4
+ return {
5
+ title: n.title,
6
+ description: n.description,
7
+ confirmButton: n.confirmButton,
8
+ presentation: {
9
+ alignment: "center",
10
+ icon: r === "delete" ? t : e,
11
+ tone: r === "confirm" ? "default" : "destructive",
12
+ actionWidth: "equal"
13
+ }
14
+ };
18
15
  }
19
- export { a as useBillQueueCounts };
16
+ export { n as duplicateRemovalPrompt };
@@ -1,16 +1,85 @@
1
- import { BanIcon as e, Trash2Icon as t } from "lucide-react";
1
+ import { endOfDay as e, endOfMonth as t, endOfQuarter as n, endOfWeek as r, endOfYear as i, startOfDay as a, startOfMonth as o, startOfQuarter as s, startOfWeek as c, startOfYear as l, subDays as u, subMonths as d, subQuarters as f, subWeeks as p, subYears as m } from "date-fns";
2
2
  // ../../libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index11.js
3
- function n(n, r) {
4
- return {
5
- title: n.title,
6
- description: n.description,
7
- confirmButton: n.confirmButton,
8
- presentation: {
9
- alignment: "center",
10
- icon: r === "delete" ? t : e,
11
- tone: r === "confirm" ? "default" : "destructive",
12
- actionWidth: "equal"
3
+ var h = {
4
+ Today: "today",
5
+ ThisWeek: "this_week",
6
+ ThisMonth: "this_month",
7
+ ThisQuarter: "this_quarter",
8
+ ThisYear: "this_year",
9
+ Yesterday: "yesterday",
10
+ LastWeek: "last_week",
11
+ LastMonth: "last_month",
12
+ Last30Days: "last_30_days",
13
+ Last90Days: "last_90_days",
14
+ LastQuarter: "last_quarter",
15
+ LastYear: "last_year"
16
+ };
17
+ function g(g, _ = /* @__PURE__ */ new Date()) {
18
+ let v = a(_);
19
+ switch (g) {
20
+ case h.Today: return {
21
+ from: v,
22
+ to: e(v)
23
+ };
24
+ case h.ThisWeek: return {
25
+ from: c(v),
26
+ to: r(v)
27
+ };
28
+ case h.ThisMonth: return {
29
+ from: o(v),
30
+ to: t(v)
31
+ };
32
+ case h.ThisQuarter: return {
33
+ from: s(v),
34
+ to: n(v)
35
+ };
36
+ case h.ThisYear: return {
37
+ from: l(v),
38
+ to: i(v)
39
+ };
40
+ case h.Yesterday: {
41
+ let t = u(v, 1);
42
+ return {
43
+ from: t,
44
+ to: e(t)
45
+ };
13
46
  }
14
- };
47
+ case h.LastWeek: {
48
+ let e = c(p(v, 1));
49
+ return {
50
+ from: e,
51
+ to: r(e)
52
+ };
53
+ }
54
+ case h.LastMonth: {
55
+ let e = o(d(v, 1));
56
+ return {
57
+ from: e,
58
+ to: t(e)
59
+ };
60
+ }
61
+ case h.Last30Days: return {
62
+ from: u(v, 29),
63
+ to: e(v)
64
+ };
65
+ case h.Last90Days: return {
66
+ from: u(v, 89),
67
+ to: e(v)
68
+ };
69
+ case h.LastQuarter: {
70
+ let e = s(f(v, 1));
71
+ return {
72
+ from: e,
73
+ to: n(e)
74
+ };
75
+ }
76
+ case h.LastYear: {
77
+ let e = l(m(v, 1));
78
+ return {
79
+ from: e,
80
+ to: i(e)
81
+ };
82
+ }
83
+ }
15
84
  }
16
- export { n as duplicateRemovalPrompt };
85
+ export { h as BillsDatePreset, g as resolveDatePreset };
@@ -1,85 +1,49 @@
1
- import { endOfDay as e, endOfMonth as t, endOfQuarter as n, endOfWeek as r, endOfYear as i, startOfDay as a, startOfMonth as o, startOfQuarter as s, startOfWeek as c, startOfYear as l, subDays as u, subMonths as d, subQuarters as f, subWeeks as p, subYears as m } from "date-fns";
1
+ import { BillStatusFilter as e } from "./index4.js";
2
+ import { BillsDatePreset as t } from "./index11.js";
2
3
  // ../../libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index12.js
3
- var h = {
4
- Today: "today",
5
- ThisWeek: "this_week",
6
- ThisMonth: "this_month",
7
- ThisQuarter: "this_quarter",
8
- ThisYear: "this_year",
9
- Yesterday: "yesterday",
10
- LastWeek: "last_week",
11
- LastMonth: "last_month",
12
- Last30Days: "last_30_days",
13
- Last90Days: "last_90_days",
14
- LastQuarter: "last_quarter",
15
- LastYear: "last_year"
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}`
16
48
  };
17
- function g(g, _ = /* @__PURE__ */ new Date()) {
18
- let v = a(_);
19
- switch (g) {
20
- case h.Today: return {
21
- from: v,
22
- to: e(v)
23
- };
24
- case h.ThisWeek: return {
25
- from: c(v),
26
- to: r(v)
27
- };
28
- case h.ThisMonth: return {
29
- from: o(v),
30
- to: t(v)
31
- };
32
- case h.ThisQuarter: return {
33
- from: s(v),
34
- to: n(v)
35
- };
36
- case h.ThisYear: return {
37
- from: l(v),
38
- to: i(v)
39
- };
40
- case h.Yesterday: {
41
- let t = u(v, 1);
42
- return {
43
- from: t,
44
- to: e(t)
45
- };
46
- }
47
- case h.LastWeek: {
48
- let e = c(p(v, 1));
49
- return {
50
- from: e,
51
- to: r(e)
52
- };
53
- }
54
- case h.LastMonth: {
55
- let e = o(d(v, 1));
56
- return {
57
- from: e,
58
- to: t(e)
59
- };
60
- }
61
- case h.Last30Days: return {
62
- from: u(v, 29),
63
- to: e(v)
64
- };
65
- case h.Last90Days: return {
66
- from: u(v, 89),
67
- to: e(v)
68
- };
69
- case h.LastQuarter: {
70
- let e = s(f(v, 1));
71
- return {
72
- from: e,
73
- to: n(e)
74
- };
75
- }
76
- case h.LastYear: {
77
- let e = l(m(v, 1));
78
- return {
79
- from: e,
80
- to: i(e)
81
- };
82
- }
83
- }
84
- }
85
- export { h as BillsDatePreset, g as resolveDatePreset };
49
+ export { n as BILLS_FILTER_LABELS_EN };
@@ -1,49 +1,263 @@
1
- import { BillStatusFilter as e } from "./index4.js";
2
- import { BillsDatePreset as t } from "./index12.js";
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { formatMoneyExact as e } from "../../../../shared/util/dist/lib/formatMoneyExact.js";
6
+ import "../../../../shared/util/dist/index.js";
7
+ import "../../../util/dist/index.js";
8
+ import { getCounterpartName as t } from "../../../../shared/counterpart-management/feature/dist/lib/helpers.js";
9
+ import { useCounterpartsQuery as n } from "../../../../shared/counterpart-management/data-access/dist/index3.js";
10
+ import "../../../../shared/counterpart-management/feature/dist/index.js";
11
+ import { BILL_STATUS_FILTER_ORDER as r, billStatusFilterApiValues as i } from "./index4.js";
12
+ import { BillsFilterField as a } from "../../ui/dist/index9.js";
13
+ import "../../ui/dist/index.js";
14
+ import { BillsDatePreset as o, resolveDatePreset as s } from "./index11.js";
15
+ import { BILLS_FILTER_LABELS_EN as c } from "./index12.js";
16
+ import { useCallback as l, useEffect as u, useMemo as d, useState as f } from "react";
17
+ import { format as p, formatISO as m } from "date-fns";
3
18
  // ../../libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index13.js
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}`
19
+ var h = {
20
+ Date: "date",
21
+ Status: "status",
22
+ Amount: "amount",
23
+ Vendor: "vendor",
24
+ Attachment: "attachment"
25
+ }, g = 50, _ = 300, v = "MMM d, yyyy", y = 864e5, b = {
26
+ [a.IssueDate]: "issued_at",
27
+ [a.DueDate]: "due_date",
28
+ [a.AddedOn]: "created_at"
29
+ }, x = {
30
+ [o.Today]: "current",
31
+ [o.ThisWeek]: "current",
32
+ [o.ThisMonth]: "current",
33
+ [o.ThisQuarter]: "current",
34
+ [o.ThisYear]: "current",
35
+ [o.Yesterday]: "past",
36
+ [o.LastWeek]: "past",
37
+ [o.LastMonth]: "past",
38
+ [o.Last30Days]: "past",
39
+ [o.Last90Days]: "past",
40
+ [o.LastQuarter]: "past",
41
+ [o.LastYear]: "past"
48
42
  };
49
- export { n as BILLS_FILTER_LABELS_EN };
43
+ function S() {
44
+ return {
45
+ dateField: a.DueDate,
46
+ statuses: [],
47
+ amountMode: "any",
48
+ amountMin: "",
49
+ amountMax: "",
50
+ vendorIds: []
51
+ };
52
+ }
53
+ function C(e) {
54
+ let t = Number.parseFloat(e);
55
+ return Number.isFinite(t) ? Math.round(t * 100) : void 0;
56
+ }
57
+ function w({ offersStatusFilter: o = !1, offersVendorFilter: w = !0, isVendorFilterPaused: T = !1, onFiltersChange: E, labels: D } = {}) {
58
+ let O = d(() => ({
59
+ ...c,
60
+ ...D,
61
+ presets: {
62
+ ...c.presets,
63
+ ...D?.presets
64
+ },
65
+ statuses: {
66
+ ...c.statuses,
67
+ ...D?.statuses
68
+ },
69
+ dateFieldNames: {
70
+ ...c.dateFieldNames,
71
+ ...D?.dateFieldNames
72
+ }
73
+ }), [D]), [k, A] = f(S), [j, M] = f({}), [N, P] = f(""), [F, I] = f(""), L = l((e) => {
74
+ A((t) => ({
75
+ ...t,
76
+ ...e
77
+ })), E?.();
78
+ }, [E]);
79
+ u(() => {
80
+ w || A((e) => e.vendorIds.length === 0 ? e : (E?.(), {
81
+ ...e,
82
+ vendorIds: []
83
+ }));
84
+ }, [w, E]), u(() => {
85
+ o || A((e) => e.statuses.length === 0 ? e : (E?.(), {
86
+ ...e,
87
+ statuses: []
88
+ }));
89
+ }, [o, E]), u(() => {
90
+ let e = setTimeout(() => I(N.trim()), _);
91
+ return () => clearTimeout(e);
92
+ }, [N]);
93
+ let R = n({
94
+ enabled: w && !T,
95
+ is_vendor: !0,
96
+ sort: "counterpart_name",
97
+ order: "asc",
98
+ limit: g,
99
+ counterpart_name__icontains: F || void 0
100
+ }), z = d(() => (R.data?.data ?? []).map((e) => ({
101
+ value: e.id,
102
+ label: t(e)
103
+ })), [R.data?.data]), B = d(() => r.map((e) => ({
104
+ value: e,
105
+ label: O.statuses[e]
106
+ })), [O.statuses]), V = d(() => Object.entries(x).map(([e, t]) => ({
107
+ value: e,
108
+ label: O.presets[e],
109
+ group: t === "current" ? O.presetGroupCurrent : O.presetGroupPast
110
+ })), [
111
+ O.presetGroupCurrent,
112
+ O.presetGroupPast,
113
+ O.presets
114
+ ]), H = d(() => {
115
+ let e = {}, t = b[k.dateField], n = (e) => Date.UTC(e.getFullYear(), e.getMonth(), e.getDate());
116
+ 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 = i(k.statuses)), k.amountMode !== "any") {
117
+ let t = "total_amount__gte", n = "total_amount__lte", r = C(k.amountMin), i = C(k.amountMax);
118
+ k.amountMode === "exact" ? r !== void 0 && (e[t] = r, e[n] = r) : (r !== void 0 && (e[t] = r), i !== void 0 && (e[n] = i));
119
+ }
120
+ return k.vendorIds.length > 0 && (e.counterpart_id__in = [...k.vendorIds]), k.hasFile !== void 0 && (e.has_file = k.hasFile), e;
121
+ }, [k]), U = d(() => {
122
+ let t = [], n = (e) => p(e, v), r = (e) => {
123
+ let [t, ...n] = e;
124
+ return t ? n.length === 0 ? t : O.moreSelected(t, n.length) : "";
125
+ };
126
+ if (k.dateFrom || k.dateTo) {
127
+ 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)));
128
+ t.push({
129
+ key: h.Date,
130
+ label: O.dateChip(O.dateFieldNames[k.dateField], e)
131
+ });
132
+ }
133
+ if (k.statuses.length > 0 && t.push({
134
+ key: h.Status,
135
+ label: O.statusChip(r(k.statuses.map((e) => O.statuses[e] ?? e)))
136
+ }), k.vendorIds.length > 0 && t.push({
137
+ key: h.Vendor,
138
+ label: O.vendorChip(r(k.vendorIds.map((e) => j[e] ?? e)))
139
+ }), k.amountMode !== "any") {
140
+ let n = (t) => {
141
+ let n = Number.parseFloat(t);
142
+ return Number.isFinite(n) ? e(n, { currencyCode: "USD" }) : "";
143
+ }, 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) : "";
144
+ a && t.push({
145
+ key: h.Amount,
146
+ label: O.amountChip(a)
147
+ });
148
+ }
149
+ return k.hasFile !== void 0 && t.push({
150
+ key: h.Attachment,
151
+ label: k.hasFile ? O.attachmentChipHas : O.attachmentChipNone
152
+ }), t;
153
+ }, [
154
+ O,
155
+ k,
156
+ j
157
+ ]), W = l((e) => {
158
+ switch (e) {
159
+ case h.Date:
160
+ L({
161
+ datePreset: void 0,
162
+ dateFrom: void 0,
163
+ dateTo: void 0
164
+ });
165
+ break;
166
+ case h.Status:
167
+ L({ statuses: [] });
168
+ break;
169
+ case h.Vendor:
170
+ L({ vendorIds: [] });
171
+ break;
172
+ case h.Amount:
173
+ L({
174
+ amountMode: "any",
175
+ amountMin: "",
176
+ amountMax: ""
177
+ });
178
+ break;
179
+ case h.Attachment: L({ hasFile: void 0 });
180
+ }
181
+ }, [L]), G = l(() => {
182
+ A(S()), E?.();
183
+ }, [E]), K = l((e) => {
184
+ M((t) => ({
185
+ ...t,
186
+ [e.id]: e.name
187
+ })), A({
188
+ ...S(),
189
+ vendorIds: [e.id]
190
+ }), E?.();
191
+ }, [E]), q = l((e) => {
192
+ M((t) => {
193
+ let n = { ...t };
194
+ for (let t of z) e.includes(t.value) && (n[t.value] = t.label);
195
+ return n;
196
+ }), L({ vendorIds: e });
197
+ }, [L, z]);
198
+ return {
199
+ filterBarProps: {
200
+ fields: [...d(() => [
201
+ ...w ? [a.Vendor] : [],
202
+ a.IssueDate,
203
+ a.DueDate,
204
+ ...o ? [a.Status] : [],
205
+ a.TotalAmount,
206
+ a.AddedOn,
207
+ a.Attachment
208
+ ], [o, w])],
209
+ activeFilterCount: U.length,
210
+ chips: U,
211
+ onRemoveChip: W,
212
+ onClearAll: G,
213
+ dateField: k.dateField,
214
+ onDateFieldChange: (e) => {
215
+ let t = !!(k.dateFrom || k.dateTo);
216
+ A((t) => ({
217
+ ...t,
218
+ dateField: e
219
+ })), t && E?.();
220
+ },
221
+ datePresets: V,
222
+ selectedDatePreset: k.datePreset,
223
+ dateFrom: k.dateFrom,
224
+ dateTo: k.dateTo,
225
+ onDateRangeChange: ({ from: e, to: t }) => L({
226
+ datePreset: void 0,
227
+ dateFrom: e,
228
+ dateTo: t
229
+ }),
230
+ onDatePresetChange: (e) => {
231
+ let t = /* @__PURE__ */ new Date(), n = k.dateField === a.AddedOn ? new Date(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate()) : t, { from: r, to: i } = s(e, n);
232
+ L({
233
+ datePreset: e,
234
+ dateFrom: r,
235
+ dateTo: i
236
+ });
237
+ },
238
+ statusOptions: B,
239
+ selectedStatuses: k.statuses,
240
+ onStatusChange: (e) => L({ statuses: e }),
241
+ amountMode: k.amountMode,
242
+ onAmountModeChange: (e) => L({ amountMode: e }),
243
+ amountMin: k.amountMin,
244
+ amountMax: k.amountMax,
245
+ onAmountMinChange: (e) => L({ amountMin: e }),
246
+ onAmountMaxChange: (e) => L({ amountMax: e }),
247
+ vendorOptions: z,
248
+ selectedVendors: k.vendorIds,
249
+ onVendorChange: q,
250
+ vendorSearchValue: N,
251
+ onVendorSearchChange: P,
252
+ isVendorLoading: R.isLoading || T,
253
+ isVendorError: R.isError,
254
+ hasAttachment: k.hasFile,
255
+ onHasAttachmentChange: (e) => L({ hasFile: e })
256
+ },
257
+ query: H,
258
+ isFilterActive: U.length > 0,
259
+ clearAll: G,
260
+ filterByVendor: K
261
+ };
262
+ }
263
+ export { h as BillsFilterChipKey, w as useBillsFilters };