@tesouro/embedded-components-react 0.3.48 → 0.3.50

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 (134) hide show
  1. package/dist/index.css +8 -2
  2. package/dist/index.js +1 -1
  3. package/dist/lib/BillPayWidget.js +1 -1
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index.js +11 -10
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index10.js +39 -30
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index11.js +26 -311
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index12.js +325 -12
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index13.js +13 -26
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index14.js +20 -40
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index15.js +75 -24
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index16.js +36 -0
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index5.js +80 -68
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index6.js +86 -73
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index7.js +77 -14
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index8.js +18 -63
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index9.js +50 -29
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +22 -18
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +82 -30
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js +7 -42
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +15 -159
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js +23 -33
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +66 -1
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +2 -50
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +3 -4
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +5 -14
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +3 -14
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +31 -63
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index2.js +23 -18
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +37 -24
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +161 -61
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +29 -130
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +1 -25
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +47 -4
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +4 -41
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +12 -55
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +13 -4
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +63 -72
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +26 -49
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index3.js +23 -23
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +62 -93
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +133 -34
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +20 -163
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +4 -77
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +39 -21
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +5 -210
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +70 -211
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +47 -103
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +92 -12
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +34 -47
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index4.js +59 -62
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +163 -29
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +67 -181
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +20 -32
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +203 -94
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +214 -15
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +98 -312
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +16 -4
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +49 -31
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +29 -80
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +183 -156
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js +9 -2
  62. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +38 -3
  63. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +102 -2
  64. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +18 -44
  65. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +343 -1
  66. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +4 -8
  67. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +30 -8
  68. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +79 -88
  69. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +179 -3
  70. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +3 -9
  71. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +2 -20
  72. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +4 -2
  73. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +38 -51
  74. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +0 -2
  75. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +6 -126
  76. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +9 -9
  77. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +92 -44
  78. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +3 -23
  79. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +123 -26
  80. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +7 -82
  81. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +8 -48
  82. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +45 -250
  83. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +69 -5
  84. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +21 -113
  85. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js +27 -208
  86. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +86 -4
  87. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +47 -5
  88. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js +244 -106
  89. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +115 -1
  90. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js +201 -16
  91. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index77.js +4 -0
  92. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index78.js +8 -0
  93. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index79.js +115 -0
  94. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +44 -5
  95. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index80.js +1 -0
  96. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index81.js +25 -0
  97. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +94 -3
  98. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +19 -19
  99. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index18.js +1 -0
  100. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index50.js +28 -28
  101. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index59.js +1 -3
  102. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index60.js +6 -16
  103. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index73.js +119 -16
  104. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index74.js +24 -111
  105. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index75.js +89 -2
  106. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index76.js +2 -7
  107. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index77.js +5 -28
  108. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index78.js +30 -2
  109. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index79.js +2 -7
  110. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index80.js +5 -32
  111. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index81.js +34 -2
  112. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index82.js +2 -12
  113. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index83.js +10 -104
  114. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index84.js +105 -1
  115. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index85.js +2 -17
  116. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index86.js +15 -123
  117. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index87.js +125 -2
  118. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index88.js +2 -18
  119. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index89.js +14 -6
  120. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index90.js +7 -167
  121. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index91.js +170 -2
  122. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index92.js +2 -14
  123. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index93.js +11 -105
  124. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index94.js +108 -2
  125. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index95.js +2 -10
  126. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index96.js +8 -45
  127. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index97.js +47 -2
  128. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index98.js +2 -0
  129. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index8.js +144 -130
  130. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +23 -23
  131. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +87 -71
  132. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  133. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index8.js +1 -1
  134. package/package.json +1 -1
@@ -4,51 +4,72 @@
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 { getPaymentRecords as n } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
8
- import { getPaymentRecordsOptions as r } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
9
- import { withAuthEpoch as i } from "../../../shared/data-access/dist/lib/withAuthEpoch.js";
10
- import { getAllPagesNextPaginationTokenParam as a, isAllPagesResolving as o, useAutoFetchNextPage as s } from "../../../shared/data-access/dist/lib/allPages.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";
11
11
  import "../../../shared/data-access/dist/index.js";
12
- import { useMemo as c } from "react";
13
- import { useInfiniteQuery as l } from "@tanstack/react-query";
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";
14
15
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index9.js
15
- var u = 100;
16
- function d(d, { enabled: f } = {}) {
17
- let { client: p, organizationId: m, widgetToken: h, authEpoch: g } = e(), _ = t(m), v = !!(m && h && d) && f !== !1, y = {
18
- limit: u,
19
- object_id__in: d ? [d] : [],
20
- order: "desc",
21
- sort: "paid_at"
22
- }, b = r({
23
- client: p,
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,
24
20
  headers: _,
25
- query: y
26
- }), x = l({
27
- queryKey: [...i(b, g).queryKey, "all"],
21
+ path: { payable_id: r ?? "" },
22
+ query: { limit: p }
23
+ }), b = d({
24
+ queryKey: [...a(y, g).queryKey, "all"],
28
25
  enabled: v,
29
26
  initialPageParam: void 0,
30
27
  queryFn: async ({ signal: e, pageParam: t }) => {
31
- let { data: r } = await n({
32
- client: p,
28
+ let { data: i } = await n({
29
+ client: f,
33
30
  headers: _,
31
+ path: { payable_id: r ?? "" },
34
32
  query: {
35
- ...y,
33
+ limit: p,
36
34
  ...t ? { pagination_token: t } : {}
37
35
  },
38
36
  signal: e,
39
37
  throwOnError: !0
40
38
  });
41
- return r;
39
+ return i;
42
40
  },
43
- getNextPageParam: a
41
+ getNextPageParam: o
44
42
  });
45
- s(x, v);
46
- let S = c(() => x.data?.pages.flatMap((e) => e.data ?? []) ?? [], [x.data]);
43
+ c(b, v);
44
+ let x = u(() => b.data?.pages.flatMap((e) => e.data ?? []) ?? [], [b.data]);
47
45
  return {
48
- ...x,
49
- paymentRecords: S,
50
- isResolving: v && o(x)
46
+ ...b,
47
+ lineItems: x,
48
+ isResolving: s(b)
51
49
  };
52
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
+ });
71
+ }
72
+ });
73
+ }
53
74
  //#endregion
54
- export { d as usePayablePaymentRecordsQuery };
75
+ export { m as useAllPayableLineItemsQuery, h as useReplacePayableLineItemsMutation };
@@ -1,27 +1,31 @@
1
- import "./index13.js";
2
- import "./index14.js";
3
- import "./index26.js";
4
- import "./index32.js";
5
- import "./index41.js";
6
- import "./index43.js";
7
- import "./index45.js";
8
- import "./index46.js";
9
- import "./index47.js";
10
- import "./index48.js";
1
+ import "./index2.js";
2
+ import "./index3.js";
3
+ import "./index4.js";
4
+ import "./index6.js";
5
+ import "./index7.js";
6
+ import "./index8.js";
7
+ import "./index9.js";
8
+ import "./index10.js";
9
+ import "./index11.js";
10
+ import "./index22.js";
11
+ import "./index23.js";
12
+ import "./index40.js";
11
13
  import "./index49.js";
12
- import "./index50.js";
14
+ import "./index51.js";
15
+ import "./index53.js";
13
16
  import "./index54.js";
14
17
  import "./index55.js";
15
18
  import "./index56.js";
16
19
  import "./index57.js";
17
20
  import "./index58.js";
18
- import "./index59.js";
19
- import "./index60.js";
20
- import "./index61.js";
21
21
  import "./index62.js";
22
+ import "./index63.js";
22
23
  import "./index64.js";
23
- import "./index70.js";
24
- import "./index71.js";
25
- import "./index72.js";
26
- import { BillPayWidget as e } from "./index76.js";
24
+ import "./index65.js";
25
+ import "./index66.js";
26
+ import "./index69.js";
27
+ import "./index75.js";
28
+ import "./index76.js";
29
+ import "./index77.js";
30
+ import { BillPayWidget as e } from "./index81.js";
27
31
  export { e as BillPayWidget };
@@ -1,35 +1,87 @@
1
- import { coerceAmountValueToMinorUnits as e } from "../../../shared/util/dist/lib/coerceAmountValueToMinorUnits.js";
2
- import { formatMoneyExact as t } from "../../../shared/util/dist/lib/formatMoneyExact.js";
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
+ import "../../../shared/ui/dist/index.js";
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";
9
+ import "../../data-access/dist/index.js";
10
+ import { payableRemoval as a } from "./index6.js";
11
+ import { useCallback as o, useMemo as s, useState as c } from "react";
3
12
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js
4
- var n = {
5
- unnamedSourceAccount: "Bank account",
6
- availableBalancePrefix: (e) => `Available balance: ${e}`,
7
- futureInsufficientFunds: "Not enough funds right now. Add funds before the payment date.",
8
- todayInsufficientFunds: "Not enough funds to pay today. Choose a different account or a later date."
9
- };
10
- function r(e) {
11
- return e.slice(-4);
12
- }
13
- function i(i, a = n) {
14
- return i.filter((e) => e.status === "ACTIVE").map((n) => {
15
- let i = e(n.balance.value), o = n.balance.currencyCode;
16
- return {
17
- id: n.id,
18
- primaryLabel: `${n.nickname || a.unnamedSourceAccount} - ${r(n.accountNumber)}`,
19
- secondaryLabel: a.availableBalancePrefix(t(i / 100, { currencyCode: o })),
20
- balanceMinorUnits: i
21
- };
22
- });
23
- }
24
- function a({ selectedAccount: e, amountDueMinorUnits: t, isToday: r, labels: i = n }) {
25
- let a = e?.balanceMinorUnits;
26
- return a === void 0 ? { state: "warning" } : a >= t ? { state: "sufficient" } : r ? {
27
- state: "error",
28
- message: i.todayInsufficientFunds
13
+ function l({ payable: l, canManage: u = !0, onRemoved: d, labels: f }) {
14
+ let p = s(() => ({
15
+ ...t,
16
+ ...f
17
+ }), [f]), m = r(l), [h] = m, g = l?.id, _ = i(), [v, y] = c(!1), b = a(l?.status), x = o(async (t, n, r) => {
18
+ if (!(!m.length || !g)) try {
19
+ await _.mutateAsync({
20
+ verdict: t,
21
+ targets: m.map((e) => ({
22
+ payableId: g,
23
+ duplicateId: e.id,
24
+ matchedPayableId: e.matched_payable_id,
25
+ removeBy: b
26
+ }))
27
+ }), e.success(n), r?.();
28
+ } catch {
29
+ e.error(p.verdictFailedToast);
30
+ }
31
+ }, [
32
+ _,
33
+ p,
34
+ m,
35
+ g,
36
+ b
37
+ ]), S = b === "delete" ? {
38
+ button: p.deleteBillButton,
39
+ title: p.deleteConfirmTitle,
40
+ description: p.deleteConfirmDescription,
41
+ confirmButton: p.deleteConfirmButton,
42
+ backButton: p.deleteConfirmBackButton,
43
+ toast: p.deletedToast
44
+ } : b === "confirm" ? {
45
+ button: p.confirmBillButton,
46
+ title: p.cancelConfirmTitle,
47
+ description: p.cancelConfirmDescription,
48
+ confirmButton: p.confirmBillButton,
49
+ backButton: p.cancelConfirmBackButton,
50
+ toast: p.confirmedToast
29
51
  } : {
30
- state: "warning",
31
- message: i.futureInsufficientFunds
52
+ button: p.cancelBillButton,
53
+ title: p.cancelConfirmTitle,
54
+ description: p.cancelConfirmDescription,
55
+ confirmButton: p.cancelConfirmButton,
56
+ backButton: p.cancelConfirmBackButton,
57
+ toast: p.cancelledToast
58
+ }, C = o(async () => {
59
+ await x(n.Remove, S.toast, d), y(!1);
60
+ }, [
61
+ x,
62
+ d,
63
+ S.toast
64
+ ]), w = u && !!(h && g), T = w && !!b;
65
+ return {
66
+ isPossibleDuplicate: !!h,
67
+ onNotADuplicate: w ? () => void x(n.Keep, p.dismissedToast) : void 0,
68
+ onRemoveBill: T ? b === "delete" ? () => y(!0) : () => void C() : void 0,
69
+ removeBillLabel: T ? S.button : void 0,
70
+ removeConfirmation: {
71
+ open: v,
72
+ copy: {
73
+ title: S.title,
74
+ description: S.description,
75
+ confirmButton: S.confirmButton,
76
+ presentation: { tone: "destructive" }
77
+ },
78
+ onConfirm: () => void C(),
79
+ onCancel: () => y(!1),
80
+ isPending: _.isPending,
81
+ cancelButtonLabel: S.backButton
82
+ },
83
+ isBusy: _.isPending
32
84
  };
33
85
  }
34
86
  //#endregion
35
- export { n as SOURCE_ACCOUNT_LABELS_EN, a as deriveSourceAccountFunds, i as mapSourceAccountOptions };
87
+ export { l as usePayableDuplicateReview };
@@ -1,42 +1,7 @@
1
- import { SOURCE_ACCOUNT_LABELS_EN as e } from "./index10.js";
2
- import { REVIEW_TRANSACTION_DIALOG_LABELS_EN as t } from "../../ui/dist/index82.js";
3
- import { SCHEDULE_PAYMENT_DIALOG_LABELS_EN as n } from "../../ui/dist/index88.js";
4
- import "../../ui/dist/index.js";
5
- //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js
6
- var r = {
7
- amountDue: "Amount due",
8
- paymentAmount: "Payment amount",
9
- dueDateSuffix: (e) => `by ${e}`,
10
- paymentDate: "Payment date",
11
- sourceAccount: "Pay from",
12
- accountHolder: "Account holder name",
13
- routingNumber: "Routing number",
14
- accountNumber: "Account number",
15
- achMethod: "Pay by ACH bank transfer",
16
- scheduledToast: "Payment scheduled",
17
- submitError: "Couldn't schedule this payment. Try again.",
18
- selectAccountError: "Select a source account.",
19
- selectDateError: "Select a payment date.",
20
- staleDateError: "That date has passed. Choose a new payment date.",
21
- missingPaymentInstructionsError: "This vendor does not have ACH payment instructions on file.",
22
- missingVendorName: "Not provided",
23
- ...e,
24
- scheduleDialog: n,
25
- reviewDialog: t
26
- };
27
- function i(e) {
28
- return {
29
- ...r,
30
- ...e,
31
- scheduleDialog: {
32
- ...r.scheduleDialog,
33
- ...e?.scheduleDialog
34
- },
35
- reviewDialog: {
36
- ...r.reviewDialog,
37
- ...e?.reviewDialog
38
- }
39
- };
40
- }
41
- //#endregion
42
- export { r as PAY_BILL_FLOW_LABELS_EN, i as mergePayBillFlowLabels };
1
+ import "./index2.js";
2
+ import "./index3.js";
3
+ import "./index6.js";
4
+ import "./index7.js";
5
+ import "./index8.js";
6
+ import "./index9.js";
7
+ import "./index10.js";
@@ -1,165 +1,21 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
- import { useAllBankAccountsQuery as t } from "../../../shared/data-access/dist/lib/bank-account/useAllBankAccountsQuery.js";
7
- import "../../../shared/data-access/dist/index.js";
8
- import "../../../shared/ui/dist/index.js";
9
- import { useAnalyticsCaptureException as n } from "../../../shared/feature/dist/lib/analytics/hooks.js";
10
- import { formatCalendarDate as r } from "../../../shared/util/dist/lib/formatCalendarDate.js";
11
- import { formatMoneyExact as i } from "../../../shared/util/dist/lib/formatMoneyExact.js";
12
- import { extractApiErrorMessage as a } from "../../../shared/util/dist/lib/apiErrors.js";
13
- import "../../../shared/feature/dist/index.js";
14
- import { dateToCalendarKey as o, getDefaultPaymentDate as s, isPastEasternDate as c, isTodayInEastern as l } from "./index3.js";
15
- import { maskAccountNumber as u } from "./index9.js";
16
- import { deriveSourceAccountFunds as d, mapSourceAccountOptions as f } from "./index10.js";
17
- import { mergePayBillFlowLabels as p } from "./index11.js";
18
- import { useSchedulePaymentMutation as m } from "../../data-access/dist/index10.js";
19
- import "../../data-access/dist/index.js";
20
- import { useMemo as h, useState as g } from "react";
1
+ import { MARK_AS_PAID_DIALOG_LABELS_EN as e } from "../../ui/dist/index86.js";
2
+ import "../../ui/dist/index.js";
21
3
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js
22
- function _(e) {
23
- return !!(e?.account_holder_name && e.routing_number && e.account_number);
24
- }
25
- function v({ selectedDate: e, selectedAccount: t, amountDueMinorUnits: n, labels: r }) {
26
- if (!e) return {
27
- ok: !1,
28
- error: r.selectDateError
29
- };
30
- if (c(e)) return {
31
- ok: !1,
32
- error: r.staleDateError
33
- };
34
- if (!t) return {
35
- ok: !1,
36
- error: r.selectAccountError
37
- };
38
- let i = d({
39
- selectedAccount: t,
40
- amountDueMinorUnits: n,
41
- isToday: l(e),
42
- labels: r
43
- });
44
- return i.state === "error" ? {
45
- ok: !1,
46
- error: i.message ?? r.todayInsufficientFunds
47
- } : {
48
- ok: !0,
49
- date: e,
50
- account: t
51
- };
52
- }
53
- function y({ payableId: c, amountDueMinorUnits: y, currencyCode: b = "USD", dueDate: x, vendorName: S, vendorEmail: C, vendorBankAccount: w, poweredByBankName: T, labels: E }) {
54
- let D = h(() => p(E), [E]), O = S ?? D.missingVendorName, [k, A] = g(!1), [j, M] = g(!1), [N, P] = g(() => s()), [F, I] = g(), L = t({ enabled: k || j }), R = m(), z = n(), B = h(() => f(L.data?.data ?? [], D), [L.data?.data, D]), V = B.find((e) => e.id === F), H = N ? l(N) : !1, U = { before: s() }, W = d({
55
- selectedAccount: V,
56
- amountDueMinorUnits: y,
57
- isToday: H,
58
- labels: D
59
- }), G = i(y / 100, { currencyCode: b }), K = N ? r(o(N)) : void 0, q = x ? D.dueDateSuffix(r(x)) : void 0, J = () => v({
60
- selectedDate: N,
61
- selectedAccount: V,
62
- amountDueMinorUnits: y,
63
- labels: D
64
- }), Y = () => {
65
- if (!_(w)) {
66
- e.error(D.missingPaymentInstructionsError);
67
- return;
68
- }
69
- A(!0);
70
- }, X = () => {
71
- M(!1), A(!1);
72
- };
4
+ var t = {
5
+ dueDateSuffix: (e) => `by ${e}`,
6
+ paidToast: "Bill marked as paid",
7
+ submitError: "Couldn't mark this bill as paid. Try again.",
8
+ dialog: e
9
+ };
10
+ function n(e) {
73
11
  return {
74
- open: Y,
75
- dialogProps: {
76
- open: k,
77
- onOpenChange: A,
78
- amountDueLabel: D.amountDue,
79
- amountDue: G,
80
- dueDateSuffix: q,
81
- paymentAmountLabel: D.paymentAmount,
82
- paymentAmount: G,
83
- selectedDate: N,
84
- selectedDateLabel: K,
85
- calendarDisabled: U,
86
- isToday: H,
87
- selectedAccountId: F,
88
- accounts: B,
89
- poweredByBankName: T,
90
- funds: W,
91
- isAccountsLoading: L.isLoading,
92
- isAccountsError: L.isError,
93
- isSubmitting: R.isPending,
94
- onDateChange: P,
95
- onAccountChange: I,
96
- onReview: () => {
97
- let t = J();
98
- if (!t.ok) {
99
- e.error(t.error);
100
- return;
101
- }
102
- A(!1), M(!0);
103
- },
104
- onCancel: X,
105
- labels: D.scheduleDialog
106
- },
107
- reviewProps: {
108
- open: j,
109
- onOpenChange: M,
110
- amountLabel: D.paymentAmount,
111
- amount: G,
112
- rows: [{
113
- label: D.sourceAccount,
114
- value: V?.primaryLabel ?? ""
115
- }, {
116
- label: D.paymentDate,
117
- value: K ?? ""
118
- }],
119
- payTo: {
120
- name: O,
121
- email: C,
122
- methodLabel: D.achMethod,
123
- fields: _(w) ? [
124
- {
125
- label: D.routingNumber,
126
- value: w.routing_number
127
- },
128
- {
129
- label: D.accountNumber,
130
- value: w.account_number,
131
- maskedValue: u(w.account_number)
132
- },
133
- {
134
- label: D.accountHolder,
135
- value: w.account_holder_name
136
- }
137
- ] : []
138
- },
139
- isSubmitting: R.isPending,
140
- onBack: () => {
141
- M(!1), A(!0);
142
- },
143
- onCancel: X,
144
- onSubmit: async () => {
145
- let t = J();
146
- if (!t.ok) {
147
- M(!1), e.error(t.error), A(!0);
148
- return;
149
- }
150
- try {
151
- await R.mutateAsync({
152
- payableId: c,
153
- paymentDate: o(t.date),
154
- sourceBankAccountId: t.account.id
155
- }), X(), e.success(D.scheduledToast);
156
- } catch (t) {
157
- z(t, { payable_id: c }), e.error(a(t) ?? D.submitError);
158
- }
159
- },
160
- labels: D.reviewDialog
12
+ ...t,
13
+ ...e,
14
+ dialog: {
15
+ ...t.dialog,
16
+ ...e?.dialog
161
17
  }
162
18
  };
163
19
  }
164
20
  //#endregion
165
- export { y as usePayBillFlow };
21
+ export { t as MARK_AS_PAID_FLOW_LABELS_EN, n as mergeMarkAsPaidFlowLabels };
@@ -1,36 +1,26 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { resolveAmountDueMinorUnits as e } from "./index6.js";
6
- import { resolveVendor as t } from "./index7.js";
7
- import { payBillFlowTestIds as n } from "./index8.js";
8
- import { ReviewTransactionDialog as r } from "../../ui/dist/index83.js";
9
- import { SchedulePaymentDialog as i } from "../../ui/dist/index90.js";
10
- import "../../ui/dist/index.js";
11
- import { usePayBillFlow as a } from "./index12.js";
12
- import { useImperativeHandle as o } from "react";
13
- import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
14
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js
15
- function u({ ref: u, payable: d, poweredByBankName: f, labels: p }) {
16
- let m = t(d), h = a({
17
- payableId: d.id,
18
- amountDueMinorUnits: e(d) ?? 0,
19
- currencyCode: d.currency ?? void 0,
20
- dueDate: d.due_date,
21
- vendorName: m?.name ?? void 0,
22
- vendorEmail: m?.email ?? void 0,
23
- vendorBankAccount: m?.bank_account ?? void 0,
24
- poweredByBankName: f,
25
- labels: p
26
- });
27
- return o(u, () => ({ open: h.open }), [h.open]), /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c(i, {
28
- ...h.dialogProps,
29
- testId: n.scheduleDialog
30
- }), /* @__PURE__ */ c(r, {
31
- ...h.reviewProps,
32
- testId: n.reviewDialog
33
- })] });
2
+ var e = new Intl.DateTimeFormat("en-CA", {
3
+ timeZone: "America/New_York",
4
+ year: "numeric",
5
+ month: "2-digit",
6
+ day: "2-digit"
7
+ });
8
+ function t(t = /* @__PURE__ */ new Date()) {
9
+ let n = e.formatToParts(t), r = Object.fromEntries(n.map((e) => [e.type, e.value]));
10
+ return `${r.year}-${r.month}-${r.day}`;
11
+ }
12
+ function n(e) {
13
+ return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}-${String(e.getDate()).padStart(2, "0")}`;
14
+ }
15
+ function r(e, r = /* @__PURE__ */ new Date()) {
16
+ return n(e) === t(r);
17
+ }
18
+ function i(e = /* @__PURE__ */ new Date()) {
19
+ let [n, r, i] = t(e).split("-").map(Number);
20
+ return new Date(n, r - 1, i);
21
+ }
22
+ function a(e, r = /* @__PURE__ */ new Date()) {
23
+ return n(e) < t(r);
34
24
  }
35
25
  //#endregion
36
- export { u as PayBillFlow, u as default };
26
+ export { n as dateToCalendarKey, i as getDefaultPaymentDate, t as getEasternDateKey, a as isPastEasternDate, r as isTodayInEastern };
@@ -1 +1,66 @@
1
- import "./index13.js";
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
+ import "../../../shared/ui/dist/index.js";
7
+ import { formatCalendarDate as t } from "../../../shared/util/dist/lib/formatCalendarDate.js";
8
+ import { formatMoneyExact as n } from "../../../shared/util/dist/lib/formatMoneyExact.js";
9
+ import { extractApiErrorMessage as r } from "../../../shared/util/dist/lib/apiErrors.js";
10
+ import { useMarkPayableAsPaidMutation as i } from "../../data-access/dist/index12.js";
11
+ import "../../data-access/dist/index.js";
12
+ import { dateToCalendarKey as a, getDefaultPaymentDate as o, isTodayInEastern as s } from "./index13.js";
13
+ import { mergeMarkAsPaidFlowLabels as c } from "./index12.js";
14
+ import { useEffect as l, useState as u } from "react";
15
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js
16
+ function d({ payableId: d, amountDueMinorUnits: f, amountToPayMinorUnits: p, currencyCode: m, dueDate: h, hasScheduledPayment: g, testId: _, labels: v }) {
17
+ let y = c(v), b = i(), [x, S] = u(!1), [C, w] = u(void 0), [T, E] = u(""), D = x && !g, O = n(f / 100, { currencyCode: m }), k = n((p ?? f) / 100, { currencyCode: m }), A = C ? t(a(C)) : void 0, j = h ? y.dueDateSuffix(t(h)) : void 0, M = () => {
18
+ S(!1), w(void 0), E("");
19
+ };
20
+ return l(() => {
21
+ g && (S(!1), w(void 0), E(""));
22
+ }, [g]), {
23
+ open: () => {
24
+ w(o()), E(""), S(!0);
25
+ },
26
+ isPending: b.isPending,
27
+ dialogProps: {
28
+ open: D,
29
+ amountDue: O,
30
+ dueDateSuffix: j,
31
+ paymentAmount: k,
32
+ selectedDate: C,
33
+ selectedDateLabel: A,
34
+ isToday: C ? s(C) : !1,
35
+ comment: T,
36
+ isSubmitting: b.isPending,
37
+ onDateChange: w,
38
+ onCommentChange: E,
39
+ onConfirm: () => {
40
+ !d || !C || b.isPending || g || b.mutate({
41
+ path: { payable_id: d },
42
+ body: {
43
+ paid_at: `${a(C)}T12:00:00.000Z`,
44
+ is_external: !0,
45
+ ...T.trim() ? { comment: T.trim() } : {}
46
+ }
47
+ }, {
48
+ onSuccess: () => {
49
+ e.success(y.paidToast), M();
50
+ },
51
+ onError: (t) => {
52
+ e.error(r(t) ?? y.submitError);
53
+ }
54
+ });
55
+ },
56
+ onCancel: () => {
57
+ b.isPending || M();
58
+ },
59
+ testId: _ ? `${_}-mark-as-paid-dialog` : void 0,
60
+ confirmTestId: _ ? `${_}-mark-as-paid-confirm` : void 0,
61
+ labels: y.dialog
62
+ }
63
+ };
64
+ }
65
+ //#endregion
66
+ export { d as useMarkAsPaidFlow };