@tesouro/embedded-components-react 0.4.4 → 0.4.6

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 (69) hide show
  1. package/README.md +37 -37
  2. package/dist/index.d.ts +14 -8
  3. package/dist/lib/CreditCardsWidget.d.ts +4 -2
  4. package/dist/lib/DebitCardsWidget.d.ts +4 -2
  5. package/dist/lib/WidgetSuite.d.ts +14 -8
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index.js +8 -8
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index10.js +50 -29
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index11.js +39 -30
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index12.js +26 -311
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index13.js +326 -12
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index14.js +1 -1
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index15.js +1 -1
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index4.js +13 -27
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index5.js +28 -245
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index6.js +256 -92
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index7.js +86 -73
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index8.js +77 -14
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index9.js +18 -63
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +4 -4
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +1 -1
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +1 -1
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +1 -1
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +1 -1
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index3.js +1 -1
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +1 -1
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +1 -1
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +2 -2
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +1 -1
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +1 -1
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +72 -56
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +77 -48
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +47 -91
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +91 -33
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +33 -167
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +168 -75
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +75 -21
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +23 -210
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +199 -203
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +198 -89
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +105 -13
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +12 -47
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +47 -31
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +27 -198
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +198 -30
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +30 -234
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +240 -18
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +19 -341
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +344 -4
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +4 -33
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +32 -83
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +25 -25
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +1 -1
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +1 -1
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +1 -1
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js +1 -1
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index77.js +2 -2
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +1 -1
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index25.js +2 -0
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index26.js +28 -3
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index56.js +2 -0
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index57.js +152 -131
  62. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index97.js +1 -1
  63. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index98.js +32 -27
  64. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardsList.js +84 -87
  65. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/labels.js +0 -1
  66. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  67. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index4.js +2 -2
  68. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index9.js +12 -10
  69. package/package.json +1 -1
@@ -4,90 +4,103 @@
4
4
  "use client";
5
5
  import { useEmbedApi as e } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
6
6
  import { organizationHeaders as t } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
7
- import { postApprovalRequestsIdApprove as n, postApprovalRequestsIdReject as r } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
8
- import { getApprovalRequestsOptions as i } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
9
- import { withAuthEpoch as a } from "../../../shared/data-access/dist/lib/withAuthEpoch.js";
7
+ import { deletePayablesId as n, postPayablesIdCancel as r, postPayablesIdDuplicatesIdConfirm as i, postPayablesIdDuplicatesIdDismiss as a } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
10
8
  import "../../../shared/data-access/dist/index.js";
11
- import { NEWEST_REQUEST_FIRST as o, PAYABLE_OBJECT_TYPE as s } from "./index4.js";
12
- import { beginApprovalRequestWatch as c, invalidateApprovalDecisionQueries as l, reconcileApprovalDecisionQueries as u } from "./index5.js";
13
- import { useMutation as d, useQuery as f } from "@tanstack/react-query";
9
+ import { invalidatePayableQueries as o } from "./index6.js";
10
+ import { useMutation as s } from "@tanstack/react-query";
14
11
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index7.js
15
- function p(n, { enabled: r } = {}) {
16
- let { client: c, organizationId: l, widgetToken: u, authEpoch: d } = e(), p = !!(l && u && n) && r !== !1, m = i({
17
- client: c,
18
- headers: t(l),
19
- query: {
20
- object_id: n ?? "",
21
- object_type: s,
22
- order: o
23
- }
24
- });
25
- return f({
26
- ...a(m, d),
27
- enabled: p
28
- });
12
+ var c = [
13
+ "suspected",
14
+ "dismissed",
15
+ "confirmed"
16
+ ];
17
+ function l(e) {
18
+ if (typeof e != "object" || !e) return !1;
19
+ let t = e;
20
+ return typeof t.id == "string" && typeof t.matched_payable_id == "string" && c.includes(t.status);
29
21
  }
30
- async function m({ client: e, organizationId: t, payableId: n, requestStatus: r }) {
31
- let i = n && r !== "waiting" && n ? await c({
32
- client: e,
33
- organizationId: t,
34
- payableId: n
35
- }) : void 0;
36
- await l({
37
- client: e,
38
- organizationId: t,
39
- payableId: n
40
- }), !(!n || !i) && u({
41
- client: e,
42
- organizationId: t,
43
- payableId: n,
44
- watch: i
45
- }).catch(() => {});
22
+ function u(e) {
23
+ return Array.isArray(e?.duplicates) ? e.duplicates.filter(l) : [];
46
24
  }
47
- function h() {
48
- let { client: r, organizationId: i } = e();
49
- return d({
50
- mutationFn: async ({ path: e }) => {
51
- let { data: a } = await n({
52
- client: r,
53
- headers: t(i),
54
- path: e,
55
- throwOnError: !0
56
- });
57
- return a;
58
- },
59
- onSuccess: async (e) => {
60
- await m({
61
- client: r,
62
- organizationId: i,
63
- payableId: e?.object_id,
64
- requestStatus: e?.status
65
- });
66
- }
67
- });
25
+ function d(e) {
26
+ return u(e).filter((e) => e.status === "suspected");
27
+ }
28
+ function f(e) {
29
+ return d(e).length > 0;
30
+ }
31
+ var p = {
32
+ Keep: "keep",
33
+ Remove: "remove"
34
+ }, m = class extends Error {
35
+ applied;
36
+ constructor(e, t) {
37
+ super("A duplicate verdict batch failed partway through.", { cause: t }), this.name = "DuplicateVerdictBatchError", this.applied = e;
38
+ }
39
+ };
40
+ function h(e) {
41
+ return e.payableIds.length > 0 || e.deletedPayableIds.length > 0;
68
42
  }
69
43
  function g() {
70
- let { client: n, organizationId: i } = e();
71
- return d({
72
- mutationFn: async ({ path: e, body: a }) => {
73
- let { data: o } = await r({
74
- client: n,
75
- headers: t(i),
76
- path: e,
77
- body: a?.reject_reason ? a : void 0,
78
- throwOnError: !0
44
+ let { client: c, organizationId: l } = e();
45
+ return s({
46
+ mutationFn: async ({ verdict: e, targets: o }) => {
47
+ let s = t(l), u = [], d = [], f = () => o.filter((e) => e.matchedPayableId !== void 0 && d.includes(e.payableId) && !d.includes(e.matchedPayableId)).map((e) => e.matchedPayableId), h = () => ({
48
+ payableIds: [.../* @__PURE__ */ new Set([...u, ...f()])],
49
+ deletedPayableIds: [...new Set(d)]
79
50
  });
80
- return o;
51
+ try {
52
+ let t = /* @__PURE__ */ new Set();
53
+ if (e === p.Remove) {
54
+ for (let e of o) if (!t.has(e.payableId)) {
55
+ if (t.add(e.payableId), e.removeBy === "delete") {
56
+ await n({
57
+ client: c,
58
+ headers: s,
59
+ path: { payable_id: e.payableId },
60
+ throwOnError: !0
61
+ }), d.push(e.payableId);
62
+ continue;
63
+ }
64
+ e.removeBy === "cancel" && (await r({
65
+ client: c,
66
+ headers: s,
67
+ path: { payable_id: e.payableId },
68
+ throwOnError: !0
69
+ }), u.push(e.payableId));
70
+ }
71
+ }
72
+ let l = /* @__PURE__ */ new Set(), f = e === p.Remove ? i : a;
73
+ for (let e of o) l.has(e.duplicateId) || d.includes(e.payableId) || e.matchedPayableId && d.includes(e.matchedPayableId) || (l.add(e.duplicateId), await f({
74
+ client: c,
75
+ headers: s,
76
+ path: {
77
+ payable_id: e.payableId,
78
+ duplicate_id: e.duplicateId
79
+ },
80
+ throwOnError: !0
81
+ }), u.push(e.payableId), e.matchedPayableId && u.push(e.matchedPayableId));
82
+ } catch (e) {
83
+ throw new m(h(), e);
84
+ }
85
+ return h();
81
86
  },
82
87
  onSuccess: async (e) => {
83
- await m({
84
- client: n,
85
- organizationId: i,
86
- payableId: e?.object_id,
87
- requestStatus: e?.status
88
+ await o({
89
+ client: c,
90
+ organizationId: l,
91
+ payableIds: e.payableIds,
92
+ deletedPayableIds: e.deletedPayableIds
93
+ });
94
+ },
95
+ onError: async (e) => {
96
+ !(e instanceof m) || !h(e.applied) || await o({
97
+ client: c,
98
+ organizationId: l,
99
+ payableIds: e.applied.payableIds,
100
+ deletedPayableIds: e.applied.deletedPayableIds
88
101
  });
89
102
  }
90
103
  });
91
104
  }
92
105
  //#endregion
93
- export { h as useApprovePayableApprovalRequestMutation, p as usePayableApprovalRequestsQuery, g as useRejectPayableApprovalRequestMutation };
106
+ export { p as DuplicateVerdict, m as DuplicateVerdictBatchError, f as hasSuspectedPayableDuplicate, u as readPayableDuplicates, d as suspectedPayableDuplicates, g as useApplyDuplicateVerdictsMutation };
@@ -4,27 +4,90 @@
4
4
  "use client";
5
5
  import { useEmbedApi as e } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
6
6
  import { organizationHeaders as t } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
7
- import { getPayablesIdHistoryOptions as n } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
8
- import { withAuthEpoch as r } from "../../../shared/data-access/dist/lib/withAuthEpoch.js";
7
+ import { postApprovalRequestsIdApprove as n, postApprovalRequestsIdReject as r } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
8
+ import { getApprovalRequestsOptions as i } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
9
+ import { withAuthEpoch as a } from "../../../shared/data-access/dist/lib/withAuthEpoch.js";
9
10
  import "../../../shared/data-access/dist/index.js";
10
- import { useQuery as i } from "@tanstack/react-query";
11
+ import { NEWEST_REQUEST_FIRST as o, PAYABLE_OBJECT_TYPE as s } from "./index5.js";
12
+ import { beginApprovalRequestWatch as c, invalidateApprovalDecisionQueries as l, reconcileApprovalDecisionQueries as u } from "./index6.js";
13
+ import { useMutation as d, useQuery as f } from "@tanstack/react-query";
11
14
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index8.js
12
- var a = 100;
13
- function o(o, { enabled: s } = {}) {
14
- let { client: c, organizationId: l, widgetToken: u, authEpoch: d } = e(), f = !!(l && u && o) && s !== !1, p = n({
15
+ function p(n, { enabled: r } = {}) {
16
+ let { client: c, organizationId: l, widgetToken: u, authEpoch: d } = e(), p = !!(l && u && n) && r !== !1, m = i({
15
17
  client: c,
16
18
  headers: t(l),
17
- path: { payable_id: o ?? "" },
18
19
  query: {
19
- sort: "timestamp",
20
- order: "asc",
21
- limit: a
20
+ object_id: n ?? "",
21
+ object_type: s,
22
+ order: o
22
23
  }
23
24
  });
24
- return i({
25
- ...r(p, d),
26
- enabled: f
25
+ return f({
26
+ ...a(m, d),
27
+ enabled: p
28
+ });
29
+ }
30
+ async function m({ client: e, organizationId: t, payableId: n, requestStatus: r }) {
31
+ let i = n && r !== "waiting" && n ? await c({
32
+ client: e,
33
+ organizationId: t,
34
+ payableId: n
35
+ }) : void 0;
36
+ await l({
37
+ client: e,
38
+ organizationId: t,
39
+ payableId: n
40
+ }), !(!n || !i) && u({
41
+ client: e,
42
+ organizationId: t,
43
+ payableId: n,
44
+ watch: i
45
+ }).catch(() => {});
46
+ }
47
+ function h() {
48
+ let { client: r, organizationId: i } = e();
49
+ return d({
50
+ mutationFn: async ({ path: e }) => {
51
+ let { data: a } = await n({
52
+ client: r,
53
+ headers: t(i),
54
+ path: e,
55
+ throwOnError: !0
56
+ });
57
+ return a;
58
+ },
59
+ onSuccess: async (e) => {
60
+ await m({
61
+ client: r,
62
+ organizationId: i,
63
+ payableId: e?.object_id,
64
+ requestStatus: e?.status
65
+ });
66
+ }
67
+ });
68
+ }
69
+ function g() {
70
+ let { client: n, organizationId: i } = e();
71
+ return d({
72
+ mutationFn: async ({ path: e, body: a }) => {
73
+ let { data: o } = await r({
74
+ client: n,
75
+ headers: t(i),
76
+ path: e,
77
+ body: a?.reject_reason ? a : void 0,
78
+ throwOnError: !0
79
+ });
80
+ return o;
81
+ },
82
+ onSuccess: async (e) => {
83
+ await m({
84
+ client: n,
85
+ organizationId: i,
86
+ payableId: e?.object_id,
87
+ requestStatus: e?.status
88
+ });
89
+ }
27
90
  });
28
91
  }
29
92
  //#endregion
30
- export { o as usePayableHistoryQuery };
93
+ export { h as useApprovePayableApprovalRequestMutation, p as usePayableApprovalRequestsQuery, g as useRejectPayableApprovalRequestMutation };
@@ -4,72 +4,27 @@
4
4
  "use client";
5
5
  import { useEmbedApi as e } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
6
6
  import { organizationHeaders as t } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
7
- import { getPayablesIdLineItems as n, putPayablesIdLineItems as r } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
8
- import { getPayablesIdLineItemsOptions as i } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
9
- import { withAuthEpoch as a } from "../../../shared/data-access/dist/lib/withAuthEpoch.js";
10
- import { getAllPagesNextPaginationTokenParam as o, isAllPagesResolving as s, useAutoFetchNextPage as c } from "../../../shared/data-access/dist/lib/allPages.js";
7
+ import { getPayablesIdHistoryOptions as n } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
8
+ import { withAuthEpoch as r } from "../../../shared/data-access/dist/lib/withAuthEpoch.js";
11
9
  import "../../../shared/data-access/dist/index.js";
12
- import { invalidatePayableQueries as l } from "./index5.js";
13
- import { useMemo as u } from "react";
14
- import { useInfiniteQuery as d, useMutation as f } from "@tanstack/react-query";
10
+ import { useQuery as i } from "@tanstack/react-query";
15
11
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index9.js
16
- var p = 100;
17
- function m(r, { enabled: l } = {}) {
18
- let { client: f, organizationId: m, widgetToken: h, authEpoch: g } = e(), _ = t(m), v = !!(m && h && r) && l !== !1, y = i({
19
- client: f,
20
- headers: _,
21
- path: { payable_id: r ?? "" },
22
- query: { limit: p }
23
- }), b = d({
24
- queryKey: [...a(y, g).queryKey, "all"],
25
- enabled: v,
26
- initialPageParam: void 0,
27
- queryFn: async ({ signal: e, pageParam: t }) => {
28
- let { data: i } = await n({
29
- client: f,
30
- headers: _,
31
- path: { payable_id: r ?? "" },
32
- query: {
33
- limit: p,
34
- ...t ? { pagination_token: t } : {}
35
- },
36
- signal: e,
37
- throwOnError: !0
38
- });
39
- return i;
40
- },
41
- getNextPageParam: o
42
- });
43
- c(b, v);
44
- let x = u(() => b.data?.pages.flatMap((e) => e.data ?? []) ?? [], [b.data]);
45
- return {
46
- ...b,
47
- lineItems: x,
48
- isResolving: s(b)
49
- };
50
- }
51
- function h() {
52
- let { client: n, organizationId: i } = e();
53
- return f({
54
- mutationFn: async ({ path: e, body: a }) => {
55
- let { data: o } = await r({
56
- client: n,
57
- headers: t(i),
58
- path: e,
59
- body: a,
60
- throwOnError: !0
61
- });
62
- return o;
63
- },
64
- onSuccess: async (e, t) => {
65
- await l({
66
- client: n,
67
- organizationId: i,
68
- payableId: t.path.payable_id,
69
- includeLineItems: !0
70
- });
12
+ var a = 100;
13
+ function o(o, { enabled: s } = {}) {
14
+ let { client: c, organizationId: l, widgetToken: u, authEpoch: d } = e(), f = !!(l && u && o) && s !== !1, p = n({
15
+ client: c,
16
+ headers: t(l),
17
+ path: { payable_id: o ?? "" },
18
+ query: {
19
+ sort: "timestamp",
20
+ order: "asc",
21
+ limit: a
71
22
  }
72
23
  });
24
+ return i({
25
+ ...r(p, d),
26
+ enabled: f
27
+ });
73
28
  }
74
29
  //#endregion
75
- export { m as useAllPayableLineItemsQuery, h as useReplacePayableLineItemsMutation };
30
+ export { o as usePayableHistoryQuery };
@@ -9,10 +9,10 @@ import "./index10.js";
9
9
  import "./index11.js";
10
10
  import "./index23.js";
11
11
  import "./index24.js";
12
- import "./index41.js";
13
- import "./index50.js";
14
- import "./index52.js";
15
- import "./index54.js";
12
+ import "./index37.js";
13
+ import "./index42.js";
14
+ import "./index51.js";
15
+ import "./index53.js";
16
16
  import "./index55.js";
17
17
  import "./index56.js";
18
18
  import "./index57.js";
@@ -5,7 +5,7 @@
5
5
  import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
6
  import "../../../shared/ui/dist/index.js";
7
7
  import { DUPLICATE_BILLS_LABELS_EN as t } from "./index2.js";
8
- import { DuplicateVerdict as n, suspectedPayableDuplicates as r, useApplyDuplicateVerdictsMutation as i } from "../../data-access/dist/index6.js";
8
+ import { DuplicateVerdict as n, suspectedPayableDuplicates as r, useApplyDuplicateVerdictsMutation as i } from "../../data-access/dist/index7.js";
9
9
  import "../../data-access/dist/index.js";
10
10
  import { payableRemoval as a } from "./index6.js";
11
11
  import { useCallback as o, useMemo as s, useState as c } from "react";
@@ -7,7 +7,7 @@ import "../../../shared/ui/dist/index.js";
7
7
  import { formatCalendarDate as t } from "../../../shared/util/dist/lib/formatCalendarDate.js";
8
8
  import { formatMoneyExact as n } from "../../../shared/util/dist/lib/formatMoneyExact.js";
9
9
  import { extractApiErrorMessage as r } from "../../../shared/util/dist/lib/apiErrors.js";
10
- import { useMarkPayableAsPaidMutation as i } from "../../data-access/dist/index12.js";
10
+ import { useMarkPayableAsPaidMutation as i } from "../../data-access/dist/index13.js";
11
11
  import "../../data-access/dist/index.js";
12
12
  import { dateToCalendarKey as a, getDefaultPaymentDate as o, isTodayInEastern as s } from "./index13.js";
13
13
  import { mergeMarkAsPaidFlowLabels as c } from "./index12.js";
@@ -11,7 +11,7 @@ import { formatCalendarDate as r } from "../../../shared/util/dist/lib/formatCal
11
11
  import { formatMoneyExact as i } from "../../../shared/util/dist/lib/formatMoneyExact.js";
12
12
  import { extractApiErrorMessage as a } from "../../../shared/util/dist/lib/apiErrors.js";
13
13
  import "../../../shared/feature/dist/index.js";
14
- import { useSchedulePaymentMutation as o } from "../../data-access/dist/index11.js";
14
+ import { useSchedulePaymentMutation as o } from "../../data-access/dist/index12.js";
15
15
  import "../../data-access/dist/index.js";
16
16
  import { dateToCalendarKey as s, getDefaultPaymentDate as c, isPastEasternDate as l, isTodayInEastern as u } from "./index13.js";
17
17
  import { maskAccountNumber as d } from "./index19.js";
@@ -2,7 +2,7 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { usePayableHistoryQuery as e } from "../../data-access/dist/index8.js";
5
+ import { usePayableHistoryQuery as e } from "../../data-access/dist/index9.js";
6
6
  import "../../data-access/dist/index.js";
7
7
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js
8
8
  var t = "submitted_for_approval";
@@ -1,4 +1,4 @@
1
- import { suspectedPayableDuplicates as e } from "../../data-access/dist/index6.js";
1
+ import { suspectedPayableDuplicates as e } from "../../data-access/dist/index7.js";
2
2
  import "../../data-access/dist/index.js";
3
3
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index3.js
4
4
  function t(t) {
@@ -9,7 +9,7 @@ import { useAllOrganizationUsersQuery as r } from "../../../shared/data-access/d
9
9
  import "../../../shared/data-access/dist/index.js";
10
10
  import { useWidgetConfig as i } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
11
11
  import "../../../shared/feature/dist/index.js";
12
- import { usePayableApprovalRequestsQuery as a } from "../../data-access/dist/index7.js";
12
+ import { usePayableApprovalRequestsQuery as a } from "../../data-access/dist/index8.js";
13
13
  import "../../data-access/dist/index.js";
14
14
  import { useGetApprovalPoliciesQuery as o } from "../../../shared/approval-policy/data-access/dist/lib/approvalPoliciesApi.js";
15
15
  import "../../../shared/approval-policy/data-access/dist/index.js";
@@ -8,7 +8,7 @@ import { Scope as n } from "../../../shared/data-access/dist/lib/scopes.js";
8
8
  import "../../../shared/data-access/dist/index.js";
9
9
  import { useWidgetConfig as r } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
10
10
  import "../../../shared/feature/dist/index.js";
11
- import { usePayableApprovalRequestsQuery as i } from "../../data-access/dist/index7.js";
11
+ import { usePayableApprovalRequestsQuery as i } from "../../data-access/dist/index8.js";
12
12
  import "../../data-access/dist/index.js";
13
13
  import { currentApprovalRound as a } from "./index26.js";
14
14
  import { usePayableApprovalRoundStart as o } from "./index29.js";
@@ -6,8 +6,8 @@ import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.
6
6
  import "../../../shared/ui/dist/index.js";
7
7
  import { useWidgetConfig as t } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
8
8
  import "../../../shared/feature/dist/index.js";
9
- import { useApprovePayableApprovalRequestMutation as n, useRejectPayableApprovalRequestMutation as r } from "../../data-access/dist/index7.js";
10
- import { useCancelPayableMutation as i, useCancelScheduledPaymentMutation as a, useForceApprovePayableMutation as o, useForceRejectPayableMutation as s, useReopenPayableMutation as c } from "../../data-access/dist/index12.js";
9
+ import { useApprovePayableApprovalRequestMutation as n, useRejectPayableApprovalRequestMutation as r } from "../../data-access/dist/index8.js";
10
+ import { useCancelPayableMutation as i, useCancelScheduledPaymentMutation as a, useForceApprovePayableMutation as o, useForceRejectPayableMutation as s, useReopenPayableMutation as c } from "../../data-access/dist/index13.js";
11
11
  import "../../data-access/dist/index.js";
12
12
  import { getBillDetailActions as l } from "./index16.js";
13
13
  import { useState as u } from "react";
@@ -9,7 +9,7 @@ import { formatCalendarDate as n } from "../../../shared/util/dist/lib/formatCal
9
9
  import { useWidgetConfig as r } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
10
10
  import "../../../shared/feature/dist/index.js";
11
11
  import { isLiveScheduledPaymentRecord as i } from "../../data-access/dist/index3.js";
12
- import { usePayablePaymentRecordsQuery as a } from "../../data-access/dist/index10.js";
12
+ import { usePayablePaymentRecordsQuery as a } from "../../data-access/dist/index11.js";
13
13
  import "../../data-access/dist/index.js";
14
14
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js
15
15
  function o({ payableId: o, scheduledPaymentDate: s, enabled: c = !0 }) {
@@ -9,7 +9,7 @@ import "../../../shared/data-access/dist/index.js";
9
9
  import "../../../shared/ui/dist/index.js";
10
10
  import { useWidgetConfig as r } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
11
11
  import "../../../shared/feature/dist/index.js";
12
- import { useDeletePayableMutation as i } from "../../data-access/dist/index12.js";
12
+ import { useDeletePayableMutation as i } from "../../data-access/dist/index13.js";
13
13
  import "../../data-access/dist/index.js";
14
14
  import { useState as a } from "react";
15
15
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js
@@ -1,76 +1,92 @@
1
1
  import { formatCalendarDate as e } from "../../../shared/util/dist/lib/formatCalendarDate.js";
2
2
  import { derivePayableStatus as t } from "./index4.js";
3
- import { resolveVendor as n } from "./index5.js";
4
- import { resolveAmountDueMinorUnits as r } from "./index17.js";
3
+ import { resolveVendor as n, resolveVendorName as r } from "./index5.js";
5
4
  import { formatBillMoney as i } from "./index36.js";
6
5
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js
7
- function a({ payable: a, lineItems: o, glCodeOptions: s, glCodeRosterAvailable: c = !0, history: l, approvalPolicy: u, labels: d, hasScheduledPayment: f }) {
8
- let p = a.currency, m = t({
6
+ function a({ payable: a, lineItems: s, ledgerAccounts: c, labels: l, hasScheduledPayment: u, now: d }) {
7
+ let f = a.currency, p = (e) => i(e, f), m = t({
9
8
  apiStatus: a.status,
10
9
  dueDate: a.due_date,
11
10
  scheduledPaymentDate: a.scheduled_payment_date,
12
- hasScheduledPayment: f
13
- }), h = n(a), g = h?.bank_account?.account_number, _ = e(a.issued_at) || d.notProvided, v = e(a.due_date) || d.notProvided, y = new Map(s.map((e) => [e.value, e.label])), b = [
11
+ hasScheduledPayment: u,
12
+ now: d
13
+ }), h = n(a), g = r(a), _ = e(a.issued_at) || l.notProvided, v = e(a.due_date) || l.notProvided, y = [{
14
+ label: l.vendorRow,
15
+ value: g || l.notProvided,
16
+ secondaryValue: h?.email ?? void 0
17
+ }], b = h?.bank_account?.account_number;
18
+ b && y.push({
19
+ label: l.bankAccountRow,
20
+ value: l.bankAccountValue(b.slice(-4))
21
+ });
22
+ let x = [
14
23
  {
15
- label: d.subtotalRow,
16
- minorUnits: a.subtotal
24
+ label: l.invoiceNumberRow,
25
+ value: a.document_id || l.notProvided
17
26
  },
18
27
  {
19
- label: d.discountRow,
20
- minorUnits: a.discount
28
+ label: l.issueDateRow,
29
+ value: _
21
30
  },
22
31
  {
23
- label: d.taxRow,
24
- minorUnits: a.tax_amount
32
+ label: l.dueDateRow,
33
+ value: v
34
+ },
35
+ {
36
+ label: l.poNumberRow,
37
+ value: l.notProvided
38
+ }
39
+ ], S = new Map(c.map((e) => [e.id, [e.nominal_code, e.name].filter(Boolean).join(" — ")])), C = s.map((e) => {
40
+ let t = p(e.unit_price);
41
+ return {
42
+ id: e.id,
43
+ description: e.name ?? e.description ?? "",
44
+ glCodeLabel: (e.ledger_account_id ? S.get(e.ledger_account_id) : void 0) || l.glCodeMissing,
45
+ quantityLabel: e.quantity != null && t ? l.quantityValue(String(e.quantity), t) : "",
46
+ amountLabel: p(e.subtotal) ?? ""
47
+ };
48
+ }), w = [
49
+ {
50
+ label: l.subtotalRow,
51
+ value: a.subtotal
52
+ },
53
+ {
54
+ label: l.discountsRow,
55
+ value: a.discount
56
+ },
57
+ {
58
+ label: l.taxRow,
59
+ value: a.tax_amount
25
60
  }
26
- ].map((e) => ({
27
- label: e.label,
28
- value: i(e.minorUnits, p)
29
- })).filter((e) => !!e.value), x = i(a.total_amount, p);
30
- return x && b.push({
31
- label: d.totalRow,
32
- value: x,
61
+ ].map(({ label: e, value: t }) => ({
62
+ label: e,
63
+ value: p(t)
64
+ })).filter((e) => !!e.value), T = p(a.total_amount);
65
+ T && w.push({
66
+ label: l.totalRow,
67
+ value: T,
33
68
  emphasis: !0
34
- }), {
35
- amountDue: i(r(a), p) ?? "",
69
+ });
70
+ let E = o(a);
71
+ return {
72
+ title: g,
73
+ subtitle: l.subtitle,
74
+ status: m.status,
75
+ statusTone: m.tone,
76
+ amountDueLabel: p(a.amount_due) ?? p(a.total_amount) ?? "",
77
+ amountPaidLabel: E ? p(a.amount_paid) : void 0,
78
+ paidOnLabel: E ? l.paidOnLabel(E) : void 0,
36
79
  invoiceDateLabel: _,
37
80
  dueDateLabel: v,
38
81
  dueDateTone: m.isOverdue ? "danger" : "default",
39
- status: m.status,
40
- statusTone: m.tone,
41
- payTo: {
42
- name: h?.name || d.notProvided,
43
- email: h?.email ?? void 0,
44
- paymentInstructionsLabel: g ? d.paymentInstructionsValue(g.slice(-4)) : void 0
45
- },
46
- invoiceFields: [
47
- {
48
- label: d.invoiceDateRow,
49
- value: _
50
- },
51
- {
52
- label: d.dueDateRow,
53
- value: v
54
- },
55
- {
56
- label: d.invoiceNumberRow,
57
- value: a.document_id || d.notProvided
58
- }
59
- ],
60
- lineItems: o.map((e) => {
61
- let t = i(e.unit_price, p);
62
- return {
63
- id: e.id,
64
- description: e.name ?? e.description ?? "",
65
- glCodeLabel: e.ledger_account_id ? y.get(e.ledger_account_id) ?? (c ? d.glCodeMissing : d.glCodeUnavailable) : d.glCodeMissing,
66
- qtyPriceLabel: e.quantity != null && t ? d.qtyPriceValue(String(e.quantity), t) : "",
67
- amount: i(e.subtotal, p) ?? ""
68
- };
69
- }),
70
- amountRows: b,
71
- approvalPolicy: u,
72
- history: l
82
+ payToItems: y,
83
+ invoiceItems: x,
84
+ lineItems: C,
85
+ totals: w
73
86
  };
74
87
  }
88
+ function o(t) {
89
+ return t.status === "paid" && t.paid_at ? e(t.paid_at.slice(0, 10)) : void 0;
90
+ }
75
91
  //#endregion
76
- export { a as buildBillDetailView };
92
+ export { o as getPaidAtLabel, a as mapPayableToBillDetails };