@tesouro/embedded-components-react 0.3.49 → 0.3.51

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 (144) hide show
  1. package/dist/index.css +8 -2
  2. package/dist/index.js +2 -2
  3. package/dist/lib/BillPayWidget.js +1 -1
  4. package/dist/lib/LinkedAccountsWidget.js +1 -1
  5. package/dist/libs/shared/util-validation/dist/{index22.js → index23.js} +1 -1
  6. package/dist/libs/shared/util-validation/dist/index7.js +6 -0
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index.js +11 -10
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index10.js +39 -30
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index11.js +26 -311
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index12.js +325 -12
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index13.js +13 -26
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index14.js +20 -40
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index15.js +75 -24
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index16.js +36 -0
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index5.js +80 -68
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index6.js +86 -73
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index7.js +77 -14
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index8.js +18 -63
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index9.js +50 -29
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +22 -18
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +82 -30
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js +7 -42
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +15 -159
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js +23 -33
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +66 -1
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +2 -50
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +3 -4
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +5 -14
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +3 -14
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +31 -63
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index2.js +23 -18
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +37 -24
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +161 -61
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +29 -130
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +1 -25
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +47 -4
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +4 -41
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +12 -55
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +13 -4
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +63 -72
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +26 -49
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index3.js +23 -23
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +62 -93
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +133 -34
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +20 -163
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +4 -77
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +39 -21
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +5 -210
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +70 -211
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +47 -103
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +92 -12
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +34 -47
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index4.js +59 -62
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +163 -29
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +67 -181
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +20 -32
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +203 -94
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +214 -15
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +98 -312
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +16 -4
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +49 -31
  62. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +29 -80
  63. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +183 -156
  64. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js +9 -2
  65. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +38 -3
  66. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +102 -2
  67. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +18 -44
  68. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +343 -1
  69. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +4 -8
  70. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +30 -8
  71. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +79 -88
  72. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +179 -3
  73. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +3 -9
  74. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +2 -20
  75. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +4 -2
  76. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +38 -51
  77. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +0 -2
  78. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +6 -126
  79. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +9 -9
  80. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +92 -44
  81. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +3 -23
  82. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +123 -26
  83. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +7 -82
  84. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +8 -48
  85. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +45 -250
  86. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +69 -5
  87. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +21 -113
  88. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js +27 -208
  89. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +86 -4
  90. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +47 -5
  91. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js +244 -106
  92. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +115 -1
  93. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js +201 -16
  94. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index77.js +4 -0
  95. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index78.js +8 -0
  96. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index79.js +115 -0
  97. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +44 -5
  98. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index80.js +1 -0
  99. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index81.js +25 -0
  100. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +94 -3
  101. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +19 -19
  102. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index18.js +1 -0
  103. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index50.js +28 -28
  104. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index59.js +1 -3
  105. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index60.js +6 -16
  106. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index73.js +119 -16
  107. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index74.js +24 -111
  108. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index75.js +89 -2
  109. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index76.js +2 -7
  110. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index77.js +5 -28
  111. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index78.js +30 -2
  112. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index79.js +2 -7
  113. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index80.js +5 -32
  114. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index81.js +34 -2
  115. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index82.js +2 -12
  116. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index83.js +10 -104
  117. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index84.js +105 -1
  118. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index85.js +2 -17
  119. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index86.js +15 -123
  120. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index87.js +125 -2
  121. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index88.js +2 -18
  122. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index89.js +14 -6
  123. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index90.js +7 -167
  124. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index91.js +170 -2
  125. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index92.js +2 -14
  126. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index93.js +11 -105
  127. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index94.js +108 -2
  128. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index95.js +2 -10
  129. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index96.js +8 -45
  130. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index97.js +47 -2
  131. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index98.js +2 -0
  132. package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index8.js +95 -94
  133. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index.js +1 -1
  134. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index10.js +45 -0
  135. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index7.js +18 -55
  136. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index8.js +46 -265
  137. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index9.js +273 -34
  138. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/useApproverOptions.js +1 -1
  139. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +23 -23
  140. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +87 -71
  141. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  142. package/dist/libs/tesouro-embedded-components-react/team-widget/feature/dist/index11.js +1 -1
  143. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index8.js +1 -1
  144. package/package.json +1 -1
@@ -1,50 +1,2 @@
1
- import { ApprovalPoliciesSettingsDefaultLabels as e } from "../../../shared/approval-policy/feature/dist/lib/labels.js";
2
- import { parseApprovalPolicyScript as t } from "../../../shared/approval-policy/util/dist/lib/policyScript.js";
3
- import { parseApprovalPolicyTrigger as n } from "../../../shared/approval-policy/util/dist/lib/policyTrigger.js";
4
- import { buildPolicySentence as r, buildPolicyTitle as i } from "../../../shared/approval-policy/feature/dist/lib/policyViewModel.js";
5
- import "../../../shared/approval-policy/feature/dist/index.js";
6
- //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js
7
- var a = {
8
- ruleTitleRange: e.ruleTitleRange,
9
- ruleTitleUpTo: e.ruleTitleUpTo,
10
- ruleTitleFrom: e.ruleTitleFrom,
11
- ruleTitleAny: e.ruleTitleAny,
12
- ruleSentenceRange: e.ruleSentenceRange,
13
- ruleSentenceUpTo: e.ruleSentenceUpTo,
14
- ruleSentenceFrom: e.ruleSentenceFrom,
15
- ruleSentenceAny: e.ruleSentenceAny
16
- };
17
- function o({ policy: a, lookup: o, approvedUserIds: s, approvedRoleIds: c, copy: l }) {
18
- let u = t(a.script);
19
- if (!u.groups.length || !u.isSupported) return;
20
- let d = [];
21
- for (let [e, t] of u.groups.entries()) {
22
- let n = [];
23
- for (let e of [...t.roleIds, ...t.userIds]) {
24
- let t = o.get(e);
25
- t && n.push({
26
- id: e,
27
- label: t.label,
28
- approved: t.kind === "user" ? s.has(e) : !!c?.has(e)
29
- });
30
- }
31
- n.length && d.push({
32
- id: `group-${e + 1}`,
33
- chips: n
34
- });
35
- }
36
- if (!d.length) return;
37
- let { condition: f, hasKnownAmountBounds: p } = n(a.trigger);
38
- if (!p) return;
39
- let m = {
40
- ...e,
41
- ...l
42
- };
43
- return {
44
- title: i(f, m),
45
- sentence: r(f, m),
46
- steps: d
47
- };
48
- }
49
- //#endregion
50
- export { a as APPROVAL_POLICY_RULE_COPY_EN, o as buildApprovalPolicyCardView };
1
+ import "./index12.js";
2
+ import "./index14.js";
@@ -1,7 +1,6 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js
2
- function e(e, t) {
3
- let n = e ?? [];
4
- return t ? n.filter((e) => !e.created_at || e.created_at >= t) : n.slice(0, 1);
2
+ function e(e) {
3
+ return e?.amount_due ?? e?.total_amount ?? void 0;
5
4
  }
6
5
  //#endregion
7
- export { e as currentApprovalRound };
6
+ export { e as resolveAmountDueMinorUnits };
@@ -1,16 +1,7 @@
1
- import { currentApprovalRound as e } from "./index16.js";
2
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js
3
- function t({ requestsNewestFirst: t, roundStartedAt: n, lookup: r }) {
4
- let i = e(t, n), a = [];
5
- for (let e of i) {
6
- if (e.status !== "waiting") continue;
7
- let t = [...e.role_ids ?? [], ...e.user_ids ?? []].map((e) => r.get(e)?.label).filter((e) => !!e);
8
- t.length && a.push({
9
- id: e.id,
10
- names: t
11
- });
12
- }
13
- return a;
14
- }
2
+ var e = {
3
+ scheduleDialog: "pay-bill-schedule-dialog",
4
+ reviewDialog: "pay-bill-review-dialog"
5
+ };
15
6
  //#endregion
16
- export { t as buildPendingApproverGroups };
7
+ export { e as payBillFlowTestIds };
@@ -1,17 +1,6 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { usePayableHistoryQuery as e } from "../../data-access/dist/index7.js";
6
- import "../../data-access/dist/index.js";
7
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js
8
- var t = "submitted_for_approval";
9
- function n({ payableId: n, enabled: r = !0 }) {
10
- let i = e(n, { enabled: r });
11
- return {
12
- roundStartedAt: (i.data?.data ?? []).reduce((e, n) => n.event_type === t ? n.timestamp : e, void 0),
13
- isLoading: i.isLoading
14
- };
2
+ function e(e) {
3
+ return e ? `••••${e.slice(-4)}` : void 0;
15
4
  }
16
5
  //#endregion
17
- export { n as usePayableApprovalRoundStart };
6
+ export { e as maskAccountNumber };
@@ -1,67 +1,35 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { hasAnyScope as e } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
6
- import { Scope as t } from "../../../shared/data-access/dist/lib/scopes.js";
7
- import { useAllOrganizationRolesQuery as n } from "../../../shared/data-access/dist/lib/role/useAllOrganizationRolesQuery.js";
8
- import { useAllOrganizationUsersQuery as r } from "../../../shared/data-access/dist/lib/user/useAllOrganizationUsersQuery.js";
9
- import "../../../shared/data-access/dist/index.js";
10
- import { useWidgetConfig as i } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
11
- import "../../../shared/feature/dist/index.js";
12
- import { usePayableApprovalRequestsQuery as a } from "../../data-access/dist/index6.js";
13
- import "../../data-access/dist/index.js";
14
- import { useGetApprovalPoliciesQuery as o } from "../../../shared/approval-policy/data-access/dist/lib/approvalPoliciesApi.js";
15
- import "../../../shared/approval-policy/data-access/dist/index.js";
16
- import { buildApprovalPolicyCardView as s } from "./index15.js";
17
- import { currentApprovalRound as c } from "./index16.js";
18
- import { buildPendingApproverGroups as l } from "./index17.js";
19
- import { usePayableApprovalRoundStart as u } from "./index18.js";
20
- import { useMemo as d } from "react";
1
+ import { coerceAmountValueToMinorUnits as e } from "../../../shared/util/dist/lib/coerceAmountValueToMinorUnits.js";
2
+ import { formatMoneyExact as t } from "../../../shared/util/dist/lib/formatMoneyExact.js";
21
3
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js
22
- function f({ payableId: f, approvalPolicyId: p, enabled: m = !0, copy: h }) {
23
- let g = m && !!p, { initResponse: _ } = i(), v = e(_?.scopes, [t.ApprovalPolicyReadOrg]), y = e(_?.scopes, [t.ApprovalRequestReadOrg]), b = e(_?.scopes, [t.RoleReadOrg]), x = e(_?.scopes, [t.UserReadOrg]), S = o({ enabled: g && v }), C = n({ enabled: g && b }), w = r({ enabled: g && x }), T = a(f, { enabled: g && y }), { roundStartedAt: E } = u({
24
- payableId: f,
25
- enabled: g && y
26
- }), D = d(() => {
27
- let e = /* @__PURE__ */ new Map();
28
- for (let t of C.data?.data ?? []) e.set(t.id, {
29
- label: t.name,
30
- kind: "role"
31
- });
32
- for (let t of w.data?.data ?? []) e.set(t.id, {
33
- label: t.name,
34
- kind: "user"
35
- });
36
- return e;
37
- }, [C.data, w.data]), O = d(() => c(T.data?.data, E), [T.data, E]), k = d(() => new Set(O.flatMap((e) => e.approved_by ?? [])), [O]), A = d(() => new Set(O.filter((e) => (e.approved_by ?? []).length > 0).flatMap((e) => e.role_ids ?? [])), [O]), j = d(() => p ? S.data?.data.find((e) => e.id === p) : void 0, [S.data, p]);
38
- return {
39
- view: d(() => g && j ? s({
40
- policy: j,
41
- lookup: D,
42
- approvedUserIds: k,
43
- approvedRoleIds: A,
44
- copy: h
45
- }) : void 0, [
46
- g,
47
- j,
48
- D,
49
- k,
50
- A,
51
- h
52
- ]),
53
- pendingApprovers: d(() => g ? l({
54
- requestsNewestFirst: T.data?.data,
55
- roundStartedAt: E,
56
- lookup: D
57
- }) : [], [
58
- g,
59
- T.data,
60
- E,
61
- D
62
- ]),
63
- isLoading: g && (S.isResolving || C.isResolving || w.isResolving || T.isLoading)
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
29
+ } : {
30
+ state: "warning",
31
+ message: i.futureInsufficientFunds
64
32
  };
65
33
  }
66
34
  //#endregion
67
- export { f as useApprovalPolicyCardView };
35
+ export { n as SOURCE_ACCOUNT_LABELS_EN, a as deriveSourceAccountFunds, i as mapSourceAccountOptions };
@@ -1,21 +1,26 @@
1
- import { MARK_AS_PAID_DIALOG_LABELS_EN as e } from "../../ui/dist/index85.js";
2
- import "../../ui/dist/index.js";
3
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index2.js
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
2
+ var e = {
3
+ selectRow: ({ vendorLabel: e, invoiceNumberLabel: t, addedOnLabel: n }) => `Select bill — ${e}, invoice ${t}, added ${n}`,
4
+ openRow: ({ vendorLabel: e, invoiceNumberLabel: t, addedOnLabel: n }) => `View bill — ${e}, invoice ${t}, added ${n}`,
5
+ reviewGroup: ({ vendorLabel: e, count: t }) => `${e} ${t} possible duplicate bills`,
6
+ selectGroup: ({ vendorLabel: e }) => `Select every bill from ${e}`,
7
+ deleteBillButton: "Remove this bill",
8
+ deleteConfirmTitle: "Remove duplicate bill?",
9
+ deleteConfirmDescription: "You can't undo this action.",
10
+ deleteConfirmButton: "Remove duplicate bill",
11
+ deleteConfirmBackButton: "Cancel",
12
+ cancelBillButton: "Cancel this bill",
13
+ confirmBillButton: "Confirm duplicate",
14
+ cancelConfirmTitle: "Cancel duplicate bill?",
15
+ cancelConfirmDescription: "You can't undo this action.",
16
+ cancelConfirmButton: "Cancel this bill",
17
+ cancelConfirmBackButton: "Back",
18
+ deletedToast: "Duplicate removed",
19
+ cancelledToast: "Duplicate cancelled",
20
+ confirmedToast: "Duplicate confirmed",
21
+ dismissedToast: "Marked as “not a duplicate”.",
22
+ removedToast: "Duplicate removed",
23
+ verdictFailedToast: "Couldn't update this duplicate. Try again."
9
24
  };
10
- function n(e) {
11
- return {
12
- ...t,
13
- ...e,
14
- dialog: {
15
- ...t.dialog,
16
- ...e?.dialog
17
- }
18
- };
19
- }
20
25
  //#endregion
21
- export { t as MARK_AS_PAID_FLOW_LABELS_EN, n as mergeMarkAsPaidFlowLabels };
26
+ export { e as DUPLICATE_BILLS_LABELS_EN };
@@ -1,29 +1,42 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { hasAnyScope as e } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
6
- import { useCurrentUserQuery as t } from "../../../shared/data-access/dist/lib/useCurrentUserQuery.js";
7
- import { Scope as n } from "../../../shared/data-access/dist/lib/scopes.js";
8
- import "../../../shared/data-access/dist/index.js";
9
- import { useWidgetConfig as r } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
10
- import "../../../shared/feature/dist/index.js";
11
- import { usePayableApprovalRequestsQuery as i } from "../../data-access/dist/index6.js";
12
- import "../../data-access/dist/index.js";
13
- import { currentApprovalRound as a } from "./index16.js";
14
- import { usePayableApprovalRoundStart as o } from "./index18.js";
1
+ import { REVIEW_TRANSACTION_DIALOG_LABELS_EN as e } from "../../ui/dist/index83.js";
2
+ import { SCHEDULE_PAYMENT_DIALOG_LABELS_EN as t } from "../../ui/dist/index89.js";
3
+ import "../../ui/dist/index.js";
4
+ import { SOURCE_ACCOUNT_LABELS_EN as n } from "./index19.js";
15
5
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js
16
- function s({ payableId: s, status: c }) {
17
- let { initResponse: l } = r(), u = e(l?.scopes, [n.ApprovalRequestReadOrg]), d = c === "approve_in_progress" && u, f = i(s, { enabled: d }), p = t({ enabled: d }), { roundStartedAt: m } = o({
18
- payableId: s,
19
- enabled: d
20
- }), h = p.data?.id, g = d ? a(f.data?.data, m) : [], _ = (e) => e.caller_is_policy_approver ?? !!(h && e.user_ids.includes(h)), v = g.some(_), y = g.filter((e) => e.status === "waiting");
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
+ ...n,
24
+ scheduleDialog: t,
25
+ reviewDialog: e
26
+ };
27
+ function i(e) {
21
28
  return {
22
- id: y.filter(_).find((e) => !(h && (e.approved_by ?? []).includes(h)))?.id,
23
- isPolicyApprover: v,
24
- hasWaitingRequest: y.length > 0,
25
- isLoading: f.isLoading || p.isLoading
29
+ ...r,
30
+ ...e,
31
+ scheduleDialog: {
32
+ ...r.scheduleDialog,
33
+ ...e?.scheduleDialog
34
+ },
35
+ reviewDialog: {
36
+ ...r.reviewDialog,
37
+ ...e?.reviewDialog
38
+ }
26
39
  };
27
40
  }
28
41
  //#endregion
29
- export { s as useCurrentApprovalRequestId };
42
+ export { r as PAY_BILL_FLOW_LABELS_EN, i as mergePayBillFlowLabels };
@@ -1,65 +1,165 @@
1
- import { hasAnyScope as e } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
2
- import { Scope as t } from "../../../shared/data-access/dist/lib/scopes.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 { useAllBankAccountsQuery as t } from "../../../shared/data-access/dist/lib/bank-account/useAllBankAccountsQuery.js";
3
7
  import "../../../shared/data-access/dist/index.js";
4
- import { BanIcon as n, CalendarXIcon as r, RotateCcwIcon as i, ThumbsDownIcon as a, ThumbsUpIcon as o } from "lucide-react";
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 { useSchedulePaymentMutation as o } from "../../data-access/dist/index11.js";
15
+ import "../../data-access/dist/index.js";
16
+ import { dateToCalendarKey as s, getDefaultPaymentDate as c, isPastEasternDate as l, isTodayInEastern as u } from "./index13.js";
17
+ import { maskAccountNumber as d } from "./index18.js";
18
+ import { deriveSourceAccountFunds as f, mapSourceAccountOptions as p } from "./index19.js";
19
+ import { mergePayBillFlowLabels as m } from "./index20.js";
20
+ import { useMemo as h, useState as g } from "react";
5
21
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js
6
- function s({ status: s, scopes: c, canDecideApprovalRequest: l, hasScheduledPayment: u, scheduledPaymentIntentId: d, isPolicyApprover: f, hasWaitingRequest: p, arePendingApproversUnknown: m, labels: h }) {
7
- let g = e(c, [t.PayablePayOrg]), _ = e(c, [t.BankAccountReadOrg]), v = e(c, [t.PaymentRailAch]), y = e(c, [t.PayableWriteOrg]), b = g, x = e(c, [t.PayableApproveOrg]), S = [];
8
- s === "approve_in_progress" && l && (S.push({
9
- id: "approve",
10
- label: h.approve,
11
- variant: "default",
12
- surface: "row"
13
- }), S.push({
14
- id: "reject",
15
- label: h.reject,
16
- variant: "ghost",
17
- surface: "row"
18
- })), s === "approve_in_progress" && p && x && !f && !m && (S.push({
19
- id: "forceApprove",
20
- label: h.forceApprove,
21
- variant: "ghost",
22
- surface: "menu",
23
- icon: o,
24
- sectionHeading: h.policyOverridesHeading
25
- }), S.push({
26
- id: "forceReject",
27
- label: h.forceReject,
28
- variant: "ghost",
29
- surface: "menu",
30
- icon: a,
31
- sectionHeading: h.policyOverridesHeading
32
- }));
33
- let C = s === "waiting_to_be_paid" && g && !u, w = s === "waiting_to_be_paid" && g && _ && v && !u;
34
- return C && S.push({
35
- id: "markAsPaid",
36
- label: h.markAsPaid,
37
- variant: "outline",
38
- surface: "row"
39
- }), w && S.push({
40
- id: "payBill",
41
- label: h.payBill,
42
- variant: "default",
43
- surface: "row"
44
- }), s === "new" && y && S.push({
45
- id: "cancel",
46
- label: h.cancel,
47
- variant: "ghost",
48
- surface: "menu",
49
- icon: n
50
- }), (s === "rejected" || s === "waiting_to_be_paid" && !u) && y && S.push({
51
- id: "reopen",
52
- label: h.reopen,
53
- variant: "ghost",
54
- surface: "menu",
55
- icon: i
56
- }), s === "waiting_to_be_paid" && u && d && b && S.push({
57
- id: "cancelScheduledPayment",
58
- label: h.cancelScheduledPayment,
59
- variant: "ghost",
60
- surface: "menu",
61
- icon: r
62
- }), S;
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 (l(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 = f({
39
+ selectedAccount: t,
40
+ amountDueMinorUnits: n,
41
+ isToday: u(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: l, amountDueMinorUnits: y, currencyCode: b = "USD", dueDate: x, vendorName: S, vendorEmail: C, vendorBankAccount: w, poweredByBankName: T, labels: E }) {
54
+ let D = h(() => m(E), [E]), O = S ?? D.missingVendorName, [k, A] = g(!1), [j, M] = g(!1), [N, P] = g(() => c()), [F, I] = g(), L = t({ enabled: k || j }), R = o(), z = n(), B = h(() => p(L.data?.data ?? [], D), [L.data?.data, D]), V = B.find((e) => e.id === F), H = N ? u(N) : !1, U = { before: c() }, W = f({
55
+ selectedAccount: V,
56
+ amountDueMinorUnits: y,
57
+ isToday: H,
58
+ labels: D
59
+ }), G = i(y / 100, { currencyCode: b }), K = N ? r(s(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
+ };
73
+ 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: d(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: l,
153
+ paymentDate: s(t.date),
154
+ sourceBankAccountId: t.account.id
155
+ }), X(), e.success(D.scheduledToast);
156
+ } catch (t) {
157
+ z(t, { payable_id: l }), e.error(a(t) ?? D.submitError);
158
+ }
159
+ },
160
+ labels: D.reviewDialog
161
+ }
162
+ };
63
163
  }
64
164
  //#endregion
65
- export { s as getBillDetailActions };
165
+ export { y as usePayBillFlow };