@tesouro/embedded-components-react 0.11.225 → 0.11.228

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 (58) 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/bill-detail/ui/dist/index31.js +1 -1
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index34.js +1 -1
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index48.js +1 -1
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index49.js +1 -1
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/data-access/dist/index.js +3 -1
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/data-access/dist/index8.js +55 -0
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/data-access/dist/index9.js +36 -0
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index.js +5 -5
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index10.js +19 -185
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index11.js +10 -30
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index12.js +186 -12
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index13.js +35 -83
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index14.js +15 -51
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index15.js +76 -294
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index16.js +51 -34
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index17.js +277 -456
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index18.js +29 -326
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index19.js +524 -5
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index20.js +359 -4
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index21.js +4 -37
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index22.js +5 -1
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index23.js +38 -0
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index24.js +1 -0
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index7.js +8 -0
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index8.js +3 -1
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index15.js +2 -0
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index16.js +3 -1
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index17.js +221 -200
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index2.js +1 -1
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index3.js +1 -1
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +1 -1
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidget/BillPayWidget.js +2 -2
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidget/BillsTab.js +1 -1
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidget/index.js +1 -1
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/pay-bill/ui/dist/index5.js +1 -1
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/pay-bill/ui/dist/index6.js +1 -1
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +14 -12
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index10.js +10 -11
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index11.js +1 -53
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index12.js +13 -2
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index13.js +52 -2
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index14.js +2 -74
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index15.js +3 -2
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index16.js +73 -9
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index17.js +2 -77
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index18.js +10 -0
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index19.js +77 -2
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index21.js +2 -31
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index22.js +6 -2
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index23.js +31 -0
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index24.js +2 -0
  54. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +1 -0
  55. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/data-export/useDataExportQueries.js +9 -0
  56. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  57. package/package.json +1 -1
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index20.js +0 -6
package/dist/index.js CHANGED
@@ -18,7 +18,7 @@ import { RefreshingRootWidgetProvider as w } from "./libs/tesouro-embedded-compo
18
18
  import { useDisclosuresAcceptanceSurface as T, useOwnWidgetConfig as E, useRefetchWidget as D, useWidgetConfig as O, useWidgetError as k, useWidgetInitStaleForToken as A, useWidgetLoading as j } from "./libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/hooks.js";
19
19
  import { BankAccountsWidget as M } from "./libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/lib/BankAccountsWidget/BankAccountsWidget.js";
20
20
  import { BillQueue as N } from "./libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index5.js";
21
- import { BillSummaryCard as P } from "./libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index10.js";
21
+ import { BillSummaryCard as P } from "./libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index12.js";
22
22
  import { BillPayWidget as F } from "./libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidget/BillPayWidget.js";
23
23
  import { CardDetailsWidget as I } from "./libs/tesouro-embedded-components-react/card-details-widget/feature/dist/lib/CardDetailsWidget.js";
24
24
  import { CreditCardsWidget as L } from "./libs/tesouro-embedded-components-react/cards-widget/feature/dist/lib/CreditCardsWidget.js";
@@ -1,5 +1,5 @@
1
1
  import { BillQueue as e } from "../libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index5.js";
2
- import { BillSummaryCard as t } from "../libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index10.js";
2
+ import { BillSummaryCard as t } from "../libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index12.js";
3
3
  import { BillPayWidget as n } from "../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidget/BillPayWidget.js";
4
4
  import "../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js";
5
5
  export { n as BillPayWidget, t as BillSummaryCard, e as BillsView };
@@ -1,7 +1,7 @@
1
1
  import { Button as e, Dialog as t, DialogContent as n, DialogDescription as r, DialogHeader as i, DialogTitle as a, DropdownMenu as o, DropdownMenuContent as s, DropdownMenuGroup as c, DropdownMenuItem as l, DropdownMenuLabel as ee, DropdownMenuSeparator as u, DropdownMenuTrigger as d, RequiredFieldsLegend as f } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
2
2
  import { InlineErrorAlert as te } from "../../../../shared/ui/dist/lib/InlineErrorAlert/InlineErrorAlert.js";
3
3
  import "../../../../shared/ui/dist/index.js";
4
- import { groupBySectionHeading as p } from "../../../ui/dist/index10.js";
4
+ import { groupBySectionHeading as p } from "../../../ui/dist/index12.js";
5
5
  import "../../../ui/dist/index.js";
6
6
  import { BillDetailBody as m } from "./index15.js";
7
7
  import "./index16.js";
@@ -2,7 +2,7 @@ import { AuditHistoryList as e, Badge as t, Button as n, CollapsibleSection as r
2
2
  import { DueDateText as d } from "../../../../shared/ui/dist/lib/DueDateText/DueDateText.js";
3
3
  import "../../../../shared/ui/dist/index.js";
4
4
  import { BillActionButtons as f, NO_BILL_ACTIONS as p } from "../../../ui/dist/index2.js";
5
- import { BillOverflowMenu as m } from "../../../ui/dist/index11.js";
5
+ import { BillOverflowMenu as m } from "../../../ui/dist/index13.js";
6
6
  import "../../../ui/dist/index.js";
7
7
  import { BillStatusBadge as h } from "../../../../shared/document-status/ui/dist/index4.js";
8
8
  import "../../../../shared/document-status/ui/dist/index.js";
@@ -1,4 +1,4 @@
1
- import { BILL_UPLOAD_DROPZONE_LABELS_EN as e } from "../../../ui/dist/index16.js";
1
+ import { BILL_UPLOAD_DROPZONE_LABELS_EN as e } from "../../../ui/dist/index18.js";
2
2
  import "../../../ui/dist/index.js";
3
3
  // ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index48.js
4
4
  var t = {
@@ -1,5 +1,5 @@
1
1
  import { Button as e, Skeleton as t } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
2
- import { BillUploadDropzone as n } from "../../../ui/dist/index17.js";
2
+ import { BillUploadDropzone as n } from "../../../ui/dist/index19.js";
3
3
  import "../../../ui/dist/index.js";
4
4
  import { SOURCE_DOCUMENT_PANEL_LABELS_EN as r } from "./index48.js";
5
5
  import { jsx as i, jsxs as a } from "react/jsx-runtime";
@@ -4,4 +4,6 @@ import { usePayablesQuery as n } from "./index4.js";
4
4
  import { usePayablesTotalCountQuery as r } from "./index5.js";
5
5
  import { usePayablesAnalyticsQueries as i } from "./index6.js";
6
6
  import "./index7.js";
7
- export { e as useFirstPayablesPagesQuery, i as usePayablesAnalyticsQueries, t as usePayablesCountQueries, n as usePayablesQuery, r as usePayablesTotalCountQuery };
7
+ import { usePayablesFailedPaymentRecordsQuery as a } from "./index8.js";
8
+ import { usePayablesWithFailedPaymentQuery as o } from "./index9.js";
9
+ export { e as useFirstPayablesPagesQuery, i as usePayablesAnalyticsQueries, t as usePayablesCountQueries, a as usePayablesFailedPaymentRecordsQuery, n as usePayablesQuery, r as usePayablesTotalCountQuery, o as usePayablesWithFailedPaymentQuery };
@@ -0,0 +1,55 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { getPaymentRecords as e } from "../../../../shared/data-access/dist/lib/rest/sdk.gen.js";
6
+ import { getPaymentRecordsOptions as t } from "../../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
7
+ import { withAuthEpochInfinite as n } from "../../../../shared/data-access/dist/lib/withAuthEpoch.js";
8
+ import { useEmbedApi as r } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
9
+ import { organizationHeaders as i } from "../../../../shared/data-access/dist/lib/organizationHeaders.js";
10
+ import { getAllPagesNextPaginationTokenParam as a, isAllPagesResolving as o, useAutoFetchNextPage as s } from "../../../../shared/data-access/dist/lib/allPages.js";
11
+ import "../../../../shared/data-access/dist/index.js";
12
+ import { useMemo as c } from "react";
13
+ import { useInfiniteQuery as l } from "@tanstack/react-query";
14
+ // ../../libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/data-access/dist/index8.js
15
+ var u = 100;
16
+ function d({ payableIds: d, enabled: f }) {
17
+ let { client: p, organizationId: m, widgetToken: h, authEpoch: g, organizationStatus: _ } = r(), v = i(m), y = !!(m && h) && d.length > 0 && f !== !1, b = {
18
+ object_type: "payable",
19
+ payment_intent_status: "payment_failed",
20
+ object_id__in: [...d].sort(),
21
+ limit: u
22
+ }, x = t({
23
+ client: p,
24
+ headers: v,
25
+ query: b
26
+ }), S = l({
27
+ ...n(x.queryKey, {
28
+ authEpoch: g,
29
+ organizationStatus: _
30
+ }, { suffix: ["all"] }),
31
+ enabled: y,
32
+ initialPageParam: void 0,
33
+ queryFn: async ({ signal: t, pageParam: n }) => {
34
+ let { data: r } = await e({
35
+ client: p,
36
+ headers: v,
37
+ query: {
38
+ ...b,
39
+ ...n ? { pagination_token: n } : {}
40
+ },
41
+ signal: t,
42
+ throwOnError: !0
43
+ });
44
+ return r;
45
+ },
46
+ getNextPageParam: a
47
+ });
48
+ return s(S, y), {
49
+ records: c(() => y ? S.data?.pages.flatMap((e) => e.data) ?? [] : [], [y, S.data]),
50
+ isResolving: y && o(S),
51
+ isError: y && S.isError,
52
+ refetch: S.refetch
53
+ };
54
+ }
55
+ export { d as usePayablesFailedPaymentRecordsQuery };
@@ -0,0 +1,36 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { getPayablesOptions as e } from "../../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
6
+ import { withAuthEpoch as t } from "../../../../shared/data-access/dist/lib/withAuthEpoch.js";
7
+ import { useEmbedApi as n } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
8
+ import { organizationHeaders as r } from "../../../../shared/data-access/dist/lib/organizationHeaders.js";
9
+ import "../../../../shared/data-access/dist/index.js";
10
+ import { useMemo as i } from "react";
11
+ import { useQuery as a } from "@tanstack/react-query";
12
+ // ../../libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/data-access/dist/index9.js
13
+ var o = 100;
14
+ function s({ payableIds: s, enabled: c }) {
15
+ let { client: l, organizationId: u, widgetToken: d, authEpoch: f, organizationStatus: p } = n(), m = !!(u && d) && s.length > 0 && c !== !1, h = e({
16
+ client: l,
17
+ headers: r(u),
18
+ query: {
19
+ id__in: [...s].sort(),
20
+ has_failed_payment: !0,
21
+ limit: o
22
+ }
23
+ }), g = a({
24
+ ...t(h, {
25
+ authEpoch: f,
26
+ organizationStatus: p
27
+ }, { carryWithinOrg: !0 }),
28
+ enabled: m
29
+ });
30
+ return {
31
+ failedIds: i(() => new Set((g.data?.data ?? []).map((e) => e.id)), [g.data]),
32
+ isError: m && g.isError,
33
+ refetch: g.refetch
34
+ };
35
+ }
36
+ export { s as usePayablesWithFailedPaymentQuery };
@@ -1,9 +1,9 @@
1
1
  import { BillQueue as e } from "./index5.js";
2
2
  import "./index7.js";
3
- import { BillSummaryCard as t } from "./index10.js";
4
- import "./index17.js";
5
- import "./index18.js";
3
+ import { BillSummaryCard as t } from "./index12.js";
6
4
  import "./index19.js";
7
- import { BillsListWidget as n } from "./index21.js";
8
- import "./index22.js";
5
+ import "./index20.js";
6
+ import "./index21.js";
7
+ import { BillsListWidget as n } from "./index23.js";
8
+ import "./index24.js";
9
9
  export { e as BillQueue, t as BillSummaryCard, n as BillsListWidget };
@@ -1,190 +1,24 @@
1
- import { amountOutputToMajorUnits as e } from "../../../../shared/util/dist/lib/amountOutputToMajorUnits.js";
2
- import { formatMoneyExact as t } from "../../../../shared/util/dist/lib/formatMoneyExact.js";
3
- import "../../../../shared/util/dist/index.js";
4
- import "../../../util/dist/index.js";
5
- import { BillStatusFilter as n, billStatusFilterApiValues as r } from "./index4.js";
6
1
  // ../../libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index10.js
7
- var i = {
8
- TotalUnpaid: "total_unpaid",
9
- Overdue: "overdue",
10
- Scheduled: "scheduled",
11
- NotSubmitted: "not_submitted"
12
- }, a = {
13
- Scheduled: "scheduled",
14
- ReadyToPay: "ready_to_pay",
15
- ReadyToSubmit: "ready_to_submit",
16
- PendingApproval: "pending_approval",
17
- Rejected: "rejected",
18
- Draft: "draft"
19
- }, o = Object.values(a), s = [
20
- "draft",
21
- "new",
22
- "approve_in_progress",
23
- "waiting_to_be_paid",
24
- "partially_paid",
25
- "rejected"
26
- ];
27
- function c(e) {
28
- return Object.values(i).includes(e);
29
- }
30
- var l = [
31
- n.Draft,
32
- n.ReadyToSubmit,
33
- n.PendingApproval,
34
- n.ReadyToPay,
35
- n.Rejected
36
- ], u = [
37
- n.Draft,
38
- n.ReadyToSubmit,
39
- n.Rejected
40
- ];
41
- function d(e, t) {
42
- let n = [...s];
43
- switch (e) {
44
- case i.TotalUnpaid: return {
45
- statuses: l,
46
- query: { status__in: n }
47
- };
48
- case i.Overdue: return { query: {
49
- status__in: n,
50
- due_date__lt: t
51
- } };
52
- case i.Scheduled: return { query: {
53
- status__in: n,
54
- has_scheduled_payment: !0
55
- } };
56
- case i.NotSubmitted: return {
57
- statuses: u,
58
- query: {
59
- status__in: r(u),
60
- has_scheduled_payment: !1
61
- }
62
- };
63
- }
64
- }
65
- var f = {
66
- draft: a.Draft,
67
- new: a.ReadyToSubmit,
68
- approve_in_progress: a.PendingApproval,
69
- waiting_to_be_paid: a.ReadyToPay,
70
- partially_paid: a.ReadyToPay,
71
- rejected: a.Rejected
72
- }, p = [
73
- a.Draft,
74
- a.ReadyToSubmit,
75
- a.Rejected
76
- ], m = {
77
- metric: "id",
78
- aggregation_function: "count"
79
- }, h = {
80
- metric: "amount_due",
81
- aggregation_function: "summary"
2
+ var e = ["waiting_to_be_paid", "partially_paid"], t = {
3
+ has_failed_payment: !0,
4
+ status__in: [...e]
82
5
  };
83
- function g(e = {}) {
84
- let t = {
85
- ...e,
86
- currency: "USD",
87
- status__in: [...s],
88
- has_scheduled_payment: !1,
89
- dimension: "status"
90
- }, n = {
91
- ...e,
92
- currency: "USD",
93
- status__in: [...s],
94
- has_scheduled_payment: !0
95
- };
96
- return [
97
- {
98
- ...t,
99
- ...m
100
- },
101
- {
102
- ...t,
103
- ...h
104
- },
105
- {
106
- ...n,
107
- ...m
108
- },
109
- {
110
- ...n,
111
- ...h
112
- }
113
- ];
6
+ function n(e) {
7
+ return e.history.reduce((e, t) => t.timestamp > e ? t.timestamp : e, "");
114
8
  }
115
- function _(e) {
116
- return g({ due_date__lt: e });
117
- }
118
- var v = () => Object.fromEntries(o.map((e) => [e, 0]));
119
- function y(e) {
120
- if (e.length < 4 || e.some((e) => e.isError)) return null;
121
- let [t, n, r, i] = e, a = (e = []) => {
122
- let t = v();
123
- for (let n of e) {
124
- let e = f[n.dimension_value ?? ""];
125
- e && (t[e] += n.metric_value);
126
- }
127
- return t;
128
- }, o = a(t.points), s = a(n.points);
129
- return o.scheduled = r.points?.[0]?.metric_value ?? 0, s.scheduled = i.points?.[0]?.metric_value ?? 0, {
130
- counts: o,
131
- amounts: s
132
- };
9
+ function r(e) {
10
+ let t = /* @__PURE__ */ new Map();
11
+ for (let r of e) {
12
+ let e = r.object.id, i = t.get(e);
13
+ (!i || n(r) > n(i)) && t.set(e, r);
14
+ }
15
+ return new Map([...t].map(([e, t]) => [e, {
16
+ reason: t.error_message?.trim() || void 0,
17
+ amount: t.amount,
18
+ currency: t.currency
19
+ }]));
133
20
  }
134
- var b = (e, t = o) => t.reduce((t, n) => t + e[n], 0), x = (n) => t(e({
135
- value: n,
136
- currencyCode: "USD"
137
- }), {
138
- currencyCode: "USD",
139
- includeSpaceAfterCurrencySymbol: !1,
140
- minimumFractionDigits: 2,
141
- maximumFractionDigits: 2
142
- });
143
- function S({ totals: e, overdue: t, labels: n, selectedCard: r = null }) {
144
- let s = (e, t, i, a, o) => {
145
- let s = e === r;
146
- if (!i) return {
147
- id: e,
148
- label: t,
149
- amountLabel: n.unavailable,
150
- selected: s
151
- };
152
- let c = b(i.counts, a), l = n.billCount(c);
153
- return {
154
- id: e,
155
- label: t,
156
- amountLabel: x(b(i.amounts, a)),
157
- captionLabel: l,
158
- description: c > 0 ? o(c, l) : void 0,
159
- selected: s
160
- };
161
- }, c = (e, t) => (r, i) => n.statusBreakdown({
162
- billCount: i,
163
- statuses: o.filter((n) => t.includes(n) && (e?.counts[n] ?? 0) > 0).map((t) => n.statusCount[t](e?.counts[t] ?? 0))
164
- });
165
- return {
166
- kind: "ready",
167
- cards: [
168
- s(i.TotalUnpaid, n.totalUnpaid, e, o, (r, i) => {
169
- let a = e?.counts ?? v(), o = [
170
- [b(a, p), n.stageCount.notSubmitted],
171
- [a.pending_approval, n.stageCount.inApproval],
172
- [a.ready_to_pay, n.stageCount.readyToPay],
173
- [a.scheduled, n.stageCount.scheduled]
174
- ];
175
- return n.totalUnpaidDescription({
176
- billCount: i,
177
- stages: o.filter(([e]) => e > 0).map(([e, t]) => t(e)),
178
- overdueCount: t ? b(t.counts) : void 0
179
- });
180
- }),
181
- {
182
- ...s(i.Overdue, n.overdue, t, o, c(t, o)),
183
- labelTone: "destructive"
184
- },
185
- s(i.Scheduled, n.scheduled, e, [a.Scheduled], (e, t) => n.scheduledDescription(t)),
186
- s(i.NotSubmitted, n.notSubmitted, e, p, c(e, p))
187
- ]
188
- };
21
+ function i(t) {
22
+ return e.includes(t.status) && !t.scheduled_payment_date;
189
23
  }
190
- export { i as BillSummaryCard, a as BillSummaryStatus, s as UNPAID_PAYABLE_STATUSES, d as billSummaryCardFilter, g as billSummaryQueries, S as buildBillSummaryCardsView, c as isBillSummaryCard, _ as overdueBillSummaryQueries, y as readBillTotals };
24
+ export { t as FAILED_PAYMENTS_FILTERS, i as isStillFailed, r as latestFailedPayments };
@@ -2,36 +2,16 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { useLocalCalendarDay as e } from "../../../../shared/feature/dist/lib/calendar/useLocalCalendarDay.js";
6
- import "../../../../shared/feature/dist/index.js";
7
- import { billSummaryQueries as t, buildBillSummaryCardsView as n, overdueBillSummaryQueries as r, readBillTotals as i } from "./index10.js";
8
- import { usePayablesAnalyticsQueries as a } from "../../data-access/dist/index6.js";
5
+ import { FAILED_PAYMENTS_FILTERS as e } from "./index10.js";
6
+ import { usePayablesCountQueries as t } from "../../data-access/dist/index3.js";
9
7
  import "../../data-access/dist/index.js";
10
- import { useMemo as o } from "react";
11
8
  // ../../libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index11.js
12
- var s = t();
13
- function c({ enabled: t, labels: c, selectedCard: l }) {
14
- let u = e(), d = o(() => u ? r(u) : [], [u]), f = a({
15
- queries: s,
16
- enabled: t
17
- }), p = a({
18
- queries: d,
19
- enabled: t
20
- }), m = !u || [...f, ...p].some((e) => e.isPending);
21
- return o(() => {
22
- if (t) return m ? { kind: "loading" } : n({
23
- totals: i(f),
24
- overdue: i(p),
25
- labels: c,
26
- selectedCard: l
27
- });
28
- }, [
29
- t,
30
- m,
31
- c,
32
- p,
33
- f,
34
- l
35
- ]);
9
+ var n = [e];
10
+ function r({ enabled: e = !0 } = {}) {
11
+ let [r] = t({
12
+ filters: n,
13
+ enabled: e
14
+ });
15
+ return { count: r?.count };
36
16
  }
37
- export { c as useBillSummaryCards };
17
+ export { r as useFailedPaymentsCount };
@@ -1,16 +1,190 @@
1
- import { BanIcon as e, Trash2Icon as t } from "lucide-react";
1
+ import { amountOutputToMajorUnits as e } from "../../../../shared/util/dist/lib/amountOutputToMajorUnits.js";
2
+ import { formatMoneyExact as t } from "../../../../shared/util/dist/lib/formatMoneyExact.js";
3
+ import "../../../../shared/util/dist/index.js";
4
+ import "../../../util/dist/index.js";
5
+ import { BillStatusFilter as n, billStatusFilterApiValues as r } from "./index4.js";
2
6
  // ../../libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index12.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"
7
+ var i = {
8
+ TotalUnpaid: "total_unpaid",
9
+ Overdue: "overdue",
10
+ Scheduled: "scheduled",
11
+ NotSubmitted: "not_submitted"
12
+ }, a = {
13
+ Scheduled: "scheduled",
14
+ ReadyToPay: "ready_to_pay",
15
+ ReadyToSubmit: "ready_to_submit",
16
+ PendingApproval: "pending_approval",
17
+ Rejected: "rejected",
18
+ Draft: "draft"
19
+ }, o = Object.values(a), s = [
20
+ "draft",
21
+ "new",
22
+ "approve_in_progress",
23
+ "waiting_to_be_paid",
24
+ "partially_paid",
25
+ "rejected"
26
+ ];
27
+ function c(e) {
28
+ return Object.values(i).includes(e);
29
+ }
30
+ var l = [
31
+ n.Draft,
32
+ n.ReadyToSubmit,
33
+ n.PendingApproval,
34
+ n.ReadyToPay,
35
+ n.Rejected
36
+ ], u = [
37
+ n.Draft,
38
+ n.ReadyToSubmit,
39
+ n.Rejected
40
+ ];
41
+ function d(e, t) {
42
+ let n = [...s];
43
+ switch (e) {
44
+ case i.TotalUnpaid: return {
45
+ statuses: l,
46
+ query: { status__in: n }
47
+ };
48
+ case i.Overdue: return { query: {
49
+ status__in: n,
50
+ due_date__lt: t
51
+ } };
52
+ case i.Scheduled: return { query: {
53
+ status__in: n,
54
+ has_scheduled_payment: !0
55
+ } };
56
+ case i.NotSubmitted: return {
57
+ statuses: u,
58
+ query: {
59
+ status__in: r(u),
60
+ has_scheduled_payment: !1
61
+ }
62
+ };
63
+ }
64
+ }
65
+ var f = {
66
+ draft: a.Draft,
67
+ new: a.ReadyToSubmit,
68
+ approve_in_progress: a.PendingApproval,
69
+ waiting_to_be_paid: a.ReadyToPay,
70
+ partially_paid: a.ReadyToPay,
71
+ rejected: a.Rejected
72
+ }, p = [
73
+ a.Draft,
74
+ a.ReadyToSubmit,
75
+ a.Rejected
76
+ ], m = {
77
+ metric: "id",
78
+ aggregation_function: "count"
79
+ }, h = {
80
+ metric: "amount_due",
81
+ aggregation_function: "summary"
82
+ };
83
+ function g(e = {}) {
84
+ let t = {
85
+ ...e,
86
+ currency: "USD",
87
+ status__in: [...s],
88
+ has_scheduled_payment: !1,
89
+ dimension: "status"
90
+ }, n = {
91
+ ...e,
92
+ currency: "USD",
93
+ status__in: [...s],
94
+ has_scheduled_payment: !0
95
+ };
96
+ return [
97
+ {
98
+ ...t,
99
+ ...m
100
+ },
101
+ {
102
+ ...t,
103
+ ...h
104
+ },
105
+ {
106
+ ...n,
107
+ ...m
108
+ },
109
+ {
110
+ ...n,
111
+ ...h
112
+ }
113
+ ];
114
+ }
115
+ function _(e) {
116
+ return g({ due_date__lt: e });
117
+ }
118
+ var v = () => Object.fromEntries(o.map((e) => [e, 0]));
119
+ function y(e) {
120
+ if (e.length < 4 || e.some((e) => e.isError)) return null;
121
+ let [t, n, r, i] = e, a = (e = []) => {
122
+ let t = v();
123
+ for (let n of e) {
124
+ let e = f[n.dimension_value ?? ""];
125
+ e && (t[e] += n.metric_value);
13
126
  }
127
+ return t;
128
+ }, o = a(t.points), s = a(n.points);
129
+ return o.scheduled = r.points?.[0]?.metric_value ?? 0, s.scheduled = i.points?.[0]?.metric_value ?? 0, {
130
+ counts: o,
131
+ amounts: s
132
+ };
133
+ }
134
+ var b = (e, t = o) => t.reduce((t, n) => t + e[n], 0), x = (n) => t(e({
135
+ value: n,
136
+ currencyCode: "USD"
137
+ }), {
138
+ currencyCode: "USD",
139
+ includeSpaceAfterCurrencySymbol: !1,
140
+ minimumFractionDigits: 2,
141
+ maximumFractionDigits: 2
142
+ });
143
+ function S({ totals: e, overdue: t, labels: n, selectedCard: r = null }) {
144
+ let s = (e, t, i, a, o) => {
145
+ let s = e === r;
146
+ if (!i) return {
147
+ id: e,
148
+ label: t,
149
+ amountLabel: n.unavailable,
150
+ selected: s
151
+ };
152
+ let c = b(i.counts, a), l = n.billCount(c);
153
+ return {
154
+ id: e,
155
+ label: t,
156
+ amountLabel: x(b(i.amounts, a)),
157
+ captionLabel: l,
158
+ description: c > 0 ? o(c, l) : void 0,
159
+ selected: s
160
+ };
161
+ }, c = (e, t) => (r, i) => n.statusBreakdown({
162
+ billCount: i,
163
+ statuses: o.filter((n) => t.includes(n) && (e?.counts[n] ?? 0) > 0).map((t) => n.statusCount[t](e?.counts[t] ?? 0))
164
+ });
165
+ return {
166
+ kind: "ready",
167
+ cards: [
168
+ s(i.TotalUnpaid, n.totalUnpaid, e, o, (r, i) => {
169
+ let a = e?.counts ?? v(), o = [
170
+ [b(a, p), n.stageCount.notSubmitted],
171
+ [a.pending_approval, n.stageCount.inApproval],
172
+ [a.ready_to_pay, n.stageCount.readyToPay],
173
+ [a.scheduled, n.stageCount.scheduled]
174
+ ];
175
+ return n.totalUnpaidDescription({
176
+ billCount: i,
177
+ stages: o.filter(([e]) => e > 0).map(([e, t]) => t(e)),
178
+ overdueCount: t ? b(t.counts) : void 0
179
+ });
180
+ }),
181
+ {
182
+ ...s(i.Overdue, n.overdue, t, o, c(t, o)),
183
+ labelTone: "destructive"
184
+ },
185
+ s(i.Scheduled, n.scheduled, e, [a.Scheduled], (e, t) => n.scheduledDescription(t)),
186
+ s(i.NotSubmitted, n.notSubmitted, e, p, c(e, p))
187
+ ]
14
188
  };
15
189
  }
16
- export { n as duplicateRemovalPrompt };
190
+ export { i as BillSummaryCard, a as BillSummaryStatus, s as UNPAID_PAYABLE_STATUSES, d as billSummaryCardFilter, g as billSummaryQueries, S as buildBillSummaryCardsView, c as isBillSummaryCard, _ as overdueBillSummaryQueries, y as readBillTotals };