@tesouro/embedded-components-react 0.5.2 → 0.5.4

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 (113) hide show
  1. package/README.md +15 -2
  2. package/dist/index.d.ts +120 -100
  3. package/dist/index.js +7 -4
  4. package/dist/lib/BankAccountOnboardingWidget.d.ts +214 -246
  5. package/dist/lib/BillPayWidget.js +1 -1
  6. package/dist/lib/MarketingWidget.d.ts +684 -0
  7. package/dist/lib/MarketingWidget.js +4 -0
  8. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/data-access/dist/index.js +9 -8
  9. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index16.js +0 -2
  10. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index18.js +183 -205
  11. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index.js +1 -4
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +13 -13
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +70 -5
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js +37 -64
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +110 -38
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js +73 -104
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +7 -87
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +21 -7
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +22 -17
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +63 -23
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +2 -66
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +81 -2
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +3 -78
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +5 -4
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +4 -5
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +32 -3
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +39 -30
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +166 -37
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +39 -164
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +1 -48
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +50 -1
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +11 -45
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +8 -13
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +14 -8
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +59 -7
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +8 -64
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +24 -8
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +139 -18
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +16 -139
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +4 -24
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +41 -4
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +14 -39
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +8 -16
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +91 -8
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +86 -80
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +3 -97
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +49 -3
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +135 -47
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +33 -135
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +186 -33
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +75 -186
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +21 -75
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js +25 -14
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +232 -22
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +210 -223
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +103 -202
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +13 -121
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +47 -12
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +31 -47
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +198 -27
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +31 -198
  62. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +234 -31
  63. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +19 -240
  64. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +24 -25
  65. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +427 -19
  66. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +4 -433
  67. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +38 -4
  68. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +220 -35
  69. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +3 -224
  70. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +4 -3
  71. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +44 -2
  72. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +1 -46
  73. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +8 -1
  74. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +10 -6
  75. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +57 -21
  76. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +110 -10
  77. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js +3 -112
  78. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +127 -3
  79. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +8 -124
  80. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js +7 -8
  81. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +46 -8
  82. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js +18 -43
  83. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index77.js +28 -20
  84. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index78.js +82 -27
  85. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index79.js +47 -83
  86. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +5 -58
  87. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index80.js +250 -47
  88. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index81.js +101 -239
  89. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index82.js +202 -107
  90. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index83.js +3 -209
  91. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index84.js +8 -4
  92. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index85.js +113 -6
  93. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index86.js +1 -115
  94. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index87.js +24 -0
  95. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +4 -5
  96. package/dist/libs/tesouro-embedded-components-react/marketing-widget/feature/dist/index.js +3 -0
  97. package/dist/libs/tesouro-embedded-components-react/marketing-widget/feature/dist/index2.js +8 -0
  98. package/dist/libs/tesouro-embedded-components-react/{bank-account-onboarding-widget/ui/dist/index26.js → marketing-widget/feature/dist/index3.js} +1 -1
  99. package/dist/libs/tesouro-embedded-components-react/marketing-widget/feature/dist/index4.js +81 -0
  100. package/dist/libs/tesouro-embedded-components-react/marketing-widget/ui/dist/index.js +4 -0
  101. package/dist/libs/tesouro-embedded-components-react/{bank-account-onboarding-widget/ui/dist/index24.js → marketing-widget/ui/dist/index2.js} +1 -1
  102. package/dist/libs/tesouro-embedded-components-react/{bank-account-onboarding-widget/ui/dist/index25.js → marketing-widget/ui/dist/index3.js} +1 -1
  103. package/dist/libs/tesouro-embedded-components-react/{bank-account-onboarding-widget/ui/dist/index27.js → marketing-widget/ui/dist/index4.js} +36 -37
  104. package/dist/libs/tesouro-embedded-components-react/marketing-widget/ui/dist/index5.js +75 -0
  105. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +24 -22
  106. package/dist/libs/tesouro-embedded-components-react/{bank-account-onboarding-widget/data-access/dist/index9.js → shared/data-access/dist/lib/onboardingSuppressionReason.js} +1 -1
  107. package/dist/libs/tesouro-embedded-components-react/{bank-account-onboarding-widget/data-access/dist/index10.js → shared/data-access/dist/lib/useOrganizationOnboardingSuppression.js} +5 -6
  108. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/isDisclosuresAcceptanceRequired.js +1 -0
  109. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  110. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index8.js +1 -1
  111. package/package.json +1 -1
  112. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index28.js +0 -75
  113. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index88.js +0 -25
@@ -2,16 +2,68 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { usePayableHistoryQuery as e } from "../../data-access/dist/index9.js";
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/index8.js";
6
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 "./index28.js";
17
+ import { currentApprovalRound as c } from "./index4.js";
18
+ import { usePayableApprovalRoundStart as l } from "./index31.js";
19
+ import { buildPendingApproverGroups as u } from "./index29.js";
20
+ import { buildPendingApproverGroupsFromCardView as d } from "./index30.js";
21
+ import { useMemo as f } from "react";
7
22
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js
8
- var t = "submitted_for_approval";
9
- function n({ payableId: n, enabled: r = !0 }) {
10
- let i = e(n, { enabled: r });
23
+ function p({ payableId: p, approvalPolicyId: m, enabled: h = !0, copy: g }) {
24
+ let _ = h && !!m, { initResponse: v } = i(), y = e(v?.scopes, [t.ApprovalPolicyReadOrg]), b = e(v?.scopes, [t.ApprovalRequestReadOrg]), x = e(v?.scopes, [t.RoleReadOrg]), S = e(v?.scopes, [t.UserReadOrg]), C = o({ enabled: _ && y }), w = n({ enabled: _ && x }), T = r({ enabled: _ && S }), E = a(p, { enabled: _ && b }), { roundStartedAt: D } = l({
25
+ payableId: p,
26
+ enabled: _ && b
27
+ }), O = f(() => {
28
+ let e = /* @__PURE__ */ new Map();
29
+ for (let t of w.data?.data ?? []) e.set(t.id, {
30
+ label: t.name,
31
+ kind: "role"
32
+ });
33
+ for (let t of T.data?.data ?? []) e.set(t.id, {
34
+ label: t.name,
35
+ kind: "user"
36
+ });
37
+ return e;
38
+ }, [w.data, T.data]), k = f(() => c(E.data?.data, D), [E.data, D]), A = f(() => new Set(k.flatMap((e) => e.approved_by ?? [])), [k]), j = f(() => new Set(k.filter((e) => (e.approved_by ?? []).length > 0).flatMap((e) => e.role_ids ?? [])), [k]), M = f(() => m ? C.data?.data.find((e) => e.id === m) : void 0, [C.data, m]), N = f(() => _ && M ? s({
39
+ policy: M,
40
+ lookup: O,
41
+ approvedUserIds: A,
42
+ approvedRoleIds: j,
43
+ copy: g
44
+ }) : void 0, [
45
+ _,
46
+ M,
47
+ O,
48
+ A,
49
+ j,
50
+ g
51
+ ]);
11
52
  return {
12
- roundStartedAt: (i.data?.data ?? []).reduce((e, n) => n.event_type === t ? n.timestamp : e, void 0),
13
- isLoading: i.isLoading
53
+ view: N,
54
+ pendingApprovers: f(() => _ ? N ? d(N) : u({
55
+ requestsNewestFirst: E.data?.data,
56
+ roundStartedAt: D,
57
+ lookup: O
58
+ }) : [], [
59
+ _,
60
+ N,
61
+ E.data,
62
+ D,
63
+ O
64
+ ]),
65
+ isLoading: !!m && (!h || C.isResolving || w.isResolving || T.isResolving || E.isLoading || E.isError || !b)
14
66
  };
15
67
  }
16
68
  //#endregion
17
- export { n as usePayableApprovalRoundStart };
69
+ export { p as useApprovalPolicyCardView };
@@ -1,69 +1,13 @@
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/index8.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 "./index29.js";
17
- import { currentApprovalRound as c } from "./index4.js";
18
- import { usePayableApprovalRoundStart as l } from "./index32.js";
19
- import { buildPendingApproverGroups as u } from "./index30.js";
20
- import { buildPendingApproverGroupsFromCardView as d } from "./index31.js";
21
- import { useMemo as f } from "react";
1
+ import { formatRejectionDate as e } from "../../../shared/util/dist/lib/formatRejectionDate.js";
22
2
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js
23
- function p({ payableId: p, approvalPolicyId: m, enabled: h = !0, copy: g }) {
24
- let _ = h && !!m, { initResponse: v } = i(), y = e(v?.scopes, [t.ApprovalPolicyReadOrg]), b = e(v?.scopes, [t.ApprovalRequestReadOrg]), x = e(v?.scopes, [t.RoleReadOrg]), S = e(v?.scopes, [t.UserReadOrg]), C = o({ enabled: _ && y }), w = n({ enabled: _ && x }), T = r({ enabled: _ && S }), E = a(p, { enabled: _ && b }), { roundStartedAt: D } = l({
25
- payableId: p,
26
- enabled: _ && b
27
- }), O = f(() => {
28
- let e = /* @__PURE__ */ new Map();
29
- for (let t of w.data?.data ?? []) e.set(t.id, {
30
- label: t.name,
31
- kind: "role"
32
- });
33
- for (let t of T.data?.data ?? []) e.set(t.id, {
34
- label: t.name,
35
- kind: "user"
36
- });
37
- return e;
38
- }, [w.data, T.data]), k = f(() => c(E.data?.data, D), [E.data, D]), A = f(() => new Set(k.flatMap((e) => e.approved_by ?? [])), [k]), j = f(() => new Set(k.filter((e) => (e.approved_by ?? []).length > 0).flatMap((e) => e.role_ids ?? [])), [k]), M = f(() => m ? C.data?.data.find((e) => e.id === m) : void 0, [C.data, m]), N = f(() => _ && M ? s({
39
- policy: M,
40
- lookup: O,
41
- approvedUserIds: A,
42
- approvedRoleIds: j,
43
- copy: g
44
- }) : void 0, [
45
- _,
46
- M,
47
- O,
48
- A,
49
- j,
50
- g
51
- ]);
3
+ function t({ payableStatus: t, approvalRequests: n, users: r, payableUpdatedAt: i, labels: a, now: o }) {
4
+ let s = n.find((e) => e.status === "rejected");
5
+ if (!s) return t !== "rejected" || !i ? void 0 : { actorLabel: a.rejectedOn(e(i, o)) };
6
+ let c = new Map(r.map((e) => [e.id, e.name])), l = s.rejected_by ? c.get(s.rejected_by) : void 0, u = e(s.updated_at, o);
52
7
  return {
53
- view: N,
54
- pendingApprovers: f(() => _ ? N ? d(N) : u({
55
- requestsNewestFirst: E.data?.data,
56
- roundStartedAt: D,
57
- lookup: O
58
- }) : [], [
59
- _,
60
- N,
61
- E.data,
62
- D,
63
- O
64
- ]),
65
- isLoading: !!m && (!h || C.isResolving || w.isResolving || T.isResolving || E.isLoading || E.isError || !b)
8
+ actorLabel: l ? a.rejectedByOn(l, u) : a.rejectedOn(u),
9
+ message: s.reject_reason ? a.rejectionMessage(s.reject_reason) : void 0
66
10
  };
67
11
  }
68
12
  //#endregion
69
- export { p as useApprovalPolicyCardView };
13
+ export { t as resolveBillRejectionNotice };
@@ -1,13 +1,29 @@
1
- import { formatRejectionDate as e } from "../../../shared/util/dist/lib/formatRejectionDate.js";
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/index8.js";
12
+ import "../../data-access/dist/index.js";
13
+ import { currentApprovalRound as a } from "./index4.js";
14
+ import { usePayableApprovalRoundStart as o } from "./index31.js";
2
15
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js
3
- function t({ payableStatus: t, approvalRequests: n, users: r, payableUpdatedAt: i, labels: a, now: o }) {
4
- let s = n.find((e) => e.status === "rejected");
5
- if (!s) return t !== "rejected" || !i ? void 0 : { actorLabel: a.rejectedOn(e(i, o)) };
6
- let c = new Map(r.map((e) => [e.id, e.name])), l = s.rejected_by ? c.get(s.rejected_by) : void 0, u = e(s.updated_at, o);
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");
7
21
  return {
8
- actorLabel: l ? a.rejectedByOn(l, u) : a.rejectedOn(u),
9
- message: s.reject_reason ? a.rejectionMessage(s.reject_reason) : void 0
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
10
26
  };
11
27
  }
12
28
  //#endregion
13
- export { t as resolveBillRejectionNotice };
29
+ export { s as useCurrentApprovalRequestId };
@@ -2,28 +2,149 @@
2
2
  "use client";
3
3
  "use client";
4
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";
5
+ import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
+ import "../../../shared/ui/dist/index.js";
7
+ import { useWidgetConfig as t } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
10
8
  import "../../../shared/feature/dist/index.js";
11
- import { usePayableApprovalRequestsQuery as i } from "../../data-access/dist/index8.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";
12
11
  import "../../data-access/dist/index.js";
13
- import { currentApprovalRound as a } from "./index4.js";
14
- import { usePayableApprovalRoundStart as o } from "./index32.js";
12
+ import { getBillDetailActions as l } from "./index19.js";
13
+ import { useState as u } from "react";
14
+ import { BanIcon as d, HandIcon as f } from "lucide-react";
15
15
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.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");
16
+ function p({ payableId: d, status: f, currentApprovalRequestId: p, arePendingApproversUnknown: m, hasScheduledPayment: h, scheduledPaymentIntentId: _, isScheduledPaymentUnknown: b, isPayabilityUnknown: x, labels: S, isMarkAsPaidPending: C, hasApprovalPolicy: w = !0, hasWaitingRequest: T, pendingApprovers: E, onPayBillSelect: D, onMarkAsPaidSelect: O, onActionSucceeded: k }) {
17
+ let { initResponse: A } = t(), j = r(), M = n(), N = i(), P = a(), F = c(), I = o(), L = s(), R = C || j.isPending || M.isPending || N.isPending || P.isPending || F.isPending || I.isPending || L.isPending, [z, B] = u(), V = z && (z.id !== "cancelScheduledPayment" || z.scheduledPaymentIntentId === _) ? z : void 0, H = d && f ? l({
18
+ status: f,
19
+ scopes: A?.scopes,
20
+ canDecideApprovalRequest: !!p,
21
+ arePendingApproversUnknown: m,
22
+ hasApprovalPolicy: w,
23
+ hasWaitingRequest: T,
24
+ hasScheduledPayment: h || b,
25
+ scheduledPaymentIntentId: _,
26
+ isPayabilityUnknown: x,
27
+ labels: S
28
+ }) : [], U = (t) => ({
29
+ onError: () => e.error(S.actionError),
30
+ onSuccess: () => {
31
+ let n = y(t) && !w ? `${t}NoApprovalPolicy` : t;
32
+ e.success(S.actionSuccess[n]), k?.();
33
+ }
34
+ }), W = {
35
+ reject: {
36
+ isPending: j.isPending,
37
+ run: (e) => p && j.mutate({
38
+ path: { approval_request_id: p },
39
+ body: e ? { reject_reason: e } : void 0
40
+ }, U("reject"))
41
+ },
42
+ approve: {
43
+ isPending: M.isPending,
44
+ run: () => p && M.mutate({ path: { approval_request_id: p } }, U("approve"))
45
+ },
46
+ cancel: {
47
+ isPending: N.isPending,
48
+ run: () => d && N.mutate({ path: { payable_id: d } }, U("cancel"))
49
+ },
50
+ cancelScheduledPayment: {
51
+ isPending: P.isPending,
52
+ run: () => {
53
+ let e = V?.scheduledPaymentIntentId;
54
+ !d || !e || P.mutate({
55
+ path: { payment_intent_id: e },
56
+ payableId: d
57
+ }, U("cancelScheduledPayment"));
58
+ }
59
+ },
60
+ reopen: {
61
+ isPending: F.isPending,
62
+ run: () => d && F.mutate({ path: { payable_id: d } }, U("reopen"))
63
+ },
64
+ forceApprove: {
65
+ isPending: I.isPending,
66
+ run: () => d && I.mutate({ path: { payable_id: d } }, U("forceApprove"))
67
+ },
68
+ forceReject: {
69
+ isPending: L.isPending,
70
+ run: () => d && L.mutate({ path: { payable_id: d } }, U("forceReject"))
71
+ }
72
+ }, G = H.map((e) => ({
73
+ ...e,
74
+ disabled: R,
75
+ loading: e.id === "markAsPaid" ? C : W[e.id]?.isPending ?? !1,
76
+ onSelect: () => {
77
+ if (!(R || !d)) {
78
+ if (e.id === "payBill") {
79
+ D();
80
+ return;
81
+ }
82
+ if (e.id === "markAsPaid") {
83
+ O();
84
+ return;
85
+ }
86
+ if (v(e.id)) {
87
+ B({
88
+ id: e.id,
89
+ scheduledPaymentIntentId: _
90
+ });
91
+ return;
92
+ }
93
+ W[e.id]?.run();
94
+ }
95
+ }
96
+ }));
21
97
  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
98
+ isActionPending: R,
99
+ actions: {
100
+ row: G.filter((e) => e.surface === "row"),
101
+ menu: G.filter((e) => e.surface === "menu")
102
+ },
103
+ decisionDialog: {
104
+ open: !!V,
105
+ copy: V ? {
106
+ ...S.decisionDialog[V.id],
107
+ ...y(V.id) && !w ? S.decisionDialog[V.id].noApprovalPolicy : void 0,
108
+ presentation: g(V.id),
109
+ pendingApprovers: y(V.id) ? E ?? [] : void 0
110
+ } : void 0,
111
+ isPending: V ? W[V.id]?.isPending ?? !1 : !1,
112
+ onCancel: () => {
113
+ R || B(void 0);
114
+ },
115
+ onConfirm: (e) => {
116
+ !V || R || (W[V.id]?.run(e), B(void 0));
117
+ }
118
+ }
26
119
  };
27
120
  }
121
+ var m = {
122
+ alignment: "center",
123
+ icon: f,
124
+ tone: "destructive",
125
+ actionWidth: "equal"
126
+ }, h = {
127
+ alignment: "center",
128
+ icon: d,
129
+ tone: "destructive",
130
+ actionWidth: "equal"
131
+ };
132
+ function g(e) {
133
+ if (y(e)) return m;
134
+ if (e === "reject") return h;
135
+ }
136
+ var _ = [
137
+ "reject",
138
+ "cancel",
139
+ "cancelScheduledPayment",
140
+ "forceApprove",
141
+ "forceReject"
142
+ ];
143
+ function v(e) {
144
+ return _.includes(e);
145
+ }
146
+ function y(e) {
147
+ return e === "forceApprove" || e === "forceReject";
148
+ }
28
149
  //#endregion
29
- export { s as useCurrentApprovalRequestId };
150
+ export { p as usePayableDetailActions };
@@ -2,149 +2,26 @@
2
2
  "use client";
3
3
  "use client";
4
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 { useWidgetConfig as t } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
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 "../../../shared/data-access/dist/index.js";
8
+ import { formatCalendarDate as n } from "../../../shared/util/dist/lib/formatCalendarDate.js";
9
+ import { useWidgetConfig as r } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
8
10
  import "../../../shared/feature/dist/index.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
+ import { isLiveScheduledPaymentRecord as i } from "../../data-access/dist/index3.js";
12
+ import { usePayablePaymentRecordsQuery as a } from "../../data-access/dist/index11.js";
11
13
  import "../../data-access/dist/index.js";
12
- import { getBillDetailActions as l } from "./index20.js";
13
- import { useState as u } from "react";
14
- import { BanIcon as d, HandIcon as f } from "lucide-react";
15
14
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js
16
- function p({ payableId: d, status: f, currentApprovalRequestId: p, arePendingApproversUnknown: m, hasScheduledPayment: h, scheduledPaymentIntentId: _, isScheduledPaymentUnknown: b, isPayabilityUnknown: x, labels: S, isMarkAsPaidPending: C, hasApprovalPolicy: w = !0, hasWaitingRequest: T, pendingApprovers: E, onPayBillSelect: D, onMarkAsPaidSelect: O, onActionSucceeded: k }) {
17
- let { initResponse: A } = t(), j = r(), M = n(), N = i(), P = a(), F = c(), I = o(), L = s(), R = C || j.isPending || M.isPending || N.isPending || P.isPending || F.isPending || I.isPending || L.isPending, [z, B] = u(), V = z && (z.id !== "cancelScheduledPayment" || z.scheduledPaymentIntentId === _) ? z : void 0, H = d && f ? l({
18
- status: f,
19
- scopes: A?.scopes,
20
- canDecideApprovalRequest: !!p,
21
- arePendingApproversUnknown: m,
22
- hasApprovalPolicy: w,
23
- hasWaitingRequest: T,
24
- hasScheduledPayment: h || b,
25
- scheduledPaymentIntentId: _,
26
- isPayabilityUnknown: x,
27
- labels: S
28
- }) : [], U = (t) => ({
29
- onError: () => e.error(S.actionError),
30
- onSuccess: () => {
31
- let n = y(t) && !w ? `${t}NoApprovalPolicy` : t;
32
- e.success(S.actionSuccess[n]), k?.();
33
- }
34
- }), W = {
35
- reject: {
36
- isPending: j.isPending,
37
- run: (e) => p && j.mutate({
38
- path: { approval_request_id: p },
39
- body: e ? { reject_reason: e } : void 0
40
- }, U("reject"))
41
- },
42
- approve: {
43
- isPending: M.isPending,
44
- run: () => p && M.mutate({ path: { approval_request_id: p } }, U("approve"))
45
- },
46
- cancel: {
47
- isPending: N.isPending,
48
- run: () => d && N.mutate({ path: { payable_id: d } }, U("cancel"))
49
- },
50
- cancelScheduledPayment: {
51
- isPending: P.isPending,
52
- run: () => {
53
- let e = V?.scheduledPaymentIntentId;
54
- !d || !e || P.mutate({
55
- path: { payment_intent_id: e },
56
- payableId: d
57
- }, U("cancelScheduledPayment"));
58
- }
59
- },
60
- reopen: {
61
- isPending: F.isPending,
62
- run: () => d && F.mutate({ path: { payable_id: d } }, U("reopen"))
63
- },
64
- forceApprove: {
65
- isPending: I.isPending,
66
- run: () => d && I.mutate({ path: { payable_id: d } }, U("forceApprove"))
67
- },
68
- forceReject: {
69
- isPending: L.isPending,
70
- run: () => d && L.mutate({ path: { payable_id: d } }, U("forceReject"))
71
- }
72
- }, G = H.map((e) => ({
73
- ...e,
74
- disabled: R,
75
- loading: e.id === "markAsPaid" ? C : W[e.id]?.isPending ?? !1,
76
- onSelect: () => {
77
- if (!(R || !d)) {
78
- if (e.id === "payBill") {
79
- D();
80
- return;
81
- }
82
- if (e.id === "markAsPaid") {
83
- O();
84
- return;
85
- }
86
- if (v(e.id)) {
87
- B({
88
- id: e.id,
89
- scheduledPaymentIntentId: _
90
- });
91
- return;
92
- }
93
- W[e.id]?.run();
94
- }
95
- }
96
- }));
15
+ function o({ payableId: o, scheduledPaymentDate: s, enabled: c = !0 }) {
16
+ let { initResponse: l } = r(), u = e(l?.scopes, [t.PaymentRecordReadOrg]), d = a(c ? o : void 0, { enabled: c && u }), f = d.paymentRecords.find(i), p = !!f || !!s, m = f?.planned_payment_date ?? (p ? s : void 0);
97
17
  return {
98
- isActionPending: R,
99
- actions: {
100
- row: G.filter((e) => e.surface === "row"),
101
- menu: G.filter((e) => e.surface === "menu")
102
- },
103
- decisionDialog: {
104
- open: !!V,
105
- copy: V ? {
106
- ...S.decisionDialog[V.id],
107
- ...y(V.id) && !w ? S.decisionDialog[V.id].noApprovalPolicy : void 0,
108
- presentation: g(V.id),
109
- pendingApprovers: y(V.id) ? E ?? [] : void 0
110
- } : void 0,
111
- isPending: V ? W[V.id]?.isPending ?? !1 : !1,
112
- onCancel: () => {
113
- R || B(void 0);
114
- },
115
- onConfirm: (e) => {
116
- !V || R || (W[V.id]?.run(e), B(void 0));
117
- }
118
- }
18
+ hasScheduledPayment: p,
19
+ paymentRecords: d.paymentRecords,
20
+ isError: d.isError,
21
+ isResolving: d.isResolving,
22
+ scheduledDateLabel: m ? n(m) : void 0,
23
+ scheduledPaymentIntentId: f?.payment_intent_id ?? void 0
119
24
  };
120
25
  }
121
- var m = {
122
- alignment: "center",
123
- icon: f,
124
- tone: "destructive",
125
- actionWidth: "equal"
126
- }, h = {
127
- alignment: "center",
128
- icon: d,
129
- tone: "destructive",
130
- actionWidth: "equal"
131
- };
132
- function g(e) {
133
- if (y(e)) return m;
134
- if (e === "reject") return h;
135
- }
136
- var _ = [
137
- "reject",
138
- "cancel",
139
- "cancelScheduledPayment",
140
- "forceApprove",
141
- "forceReject"
142
- ];
143
- function v(e) {
144
- return _.includes(e);
145
- }
146
- function y(e) {
147
- return e === "forceApprove" || e === "forceReject";
148
- }
149
26
  //#endregion
150
- export { p as usePayableDetailActions };
27
+ export { o as useScheduledPayment };
@@ -1,27 +1,7 @@
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 "../../../shared/data-access/dist/index.js";
8
- import { formatCalendarDate as n } from "../../../shared/util/dist/lib/formatCalendarDate.js";
9
- import { useWidgetConfig as r } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
10
- import "../../../shared/feature/dist/index.js";
11
- import { isLiveScheduledPaymentRecord as i } from "../../data-access/dist/index3.js";
12
- import { usePayablePaymentRecordsQuery as a } from "../../data-access/dist/index11.js";
13
- import "../../data-access/dist/index.js";
14
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js
15
- function o({ payableId: o, scheduledPaymentDate: s, enabled: c = !0 }) {
16
- let { initResponse: l } = r(), u = e(l?.scopes, [t.PaymentRecordReadOrg]), d = a(c ? o : void 0, { enabled: c && u }), f = d.paymentRecords.find(i), p = !!f || !!s, m = f?.planned_payment_date ?? (p ? s : void 0);
17
- return {
18
- hasScheduledPayment: p,
19
- paymentRecords: d.paymentRecords,
20
- isError: d.isError,
21
- isResolving: d.isResolving,
22
- scheduledDateLabel: m ? n(m) : void 0,
23
- scheduledPaymentIntentId: f?.payment_intent_id ?? void 0
24
- };
2
+ var e = /* @__PURE__ */ new Set(["draft", "new"]);
3
+ function t(t) {
4
+ return !!(t && e.has(t));
25
5
  }
26
6
  //#endregion
27
- export { o as useScheduledPayment };
7
+ export { t as isEditablePayableStatus };
@@ -1,7 +1,44 @@
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 { hasAnyScope as t } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
7
+ import { Scope as n } from "../../../shared/data-access/dist/lib/scopes.js";
8
+ import "../../../shared/data-access/dist/index.js";
9
+ import "../../../shared/ui/dist/index.js";
10
+ import { useWidgetConfig as r } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
11
+ import "../../../shared/feature/dist/index.js";
12
+ import { useDeletePayableMutation as i } from "../../data-access/dist/index13.js";
13
+ import "../../data-access/dist/index.js";
14
+ import { useState as a } from "react";
1
15
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js
2
- var e = /* @__PURE__ */ new Set(["draft", "new"]);
3
- function t(t) {
4
- return !!(t && e.has(t));
16
+ function o({ payableId: o, status: s, enabled: c = !0, labels: l, onDeleted: u }) {
17
+ let { initResponse: d } = r(), f = i(), [p, m] = a(!1), h = t(d?.scopes, [n.PayableWriteOrg]), g = !!(c && o && s === "draft" && h), _ = g ? [{
18
+ id: "deleteDraft",
19
+ label: l.menuItem,
20
+ destructive: !0,
21
+ onSelect: () => m(!0)
22
+ }] : [], v = p && g;
23
+ return {
24
+ menuItems: _,
25
+ dialog: {
26
+ open: v,
27
+ copy: v ? l.dialog : void 0,
28
+ isPending: f.isPending,
29
+ onCancel: () => {
30
+ f.isPending || m(!1);
31
+ },
32
+ onConfirm: () => {
33
+ !g || !o || f.isPending || f.mutate({ path: { payable_id: o } }, {
34
+ onError: () => e.error(l.error),
35
+ onSuccess: () => {
36
+ m(!1), u();
37
+ }
38
+ });
39
+ }
40
+ }
41
+ };
5
42
  }
6
43
  //#endregion
7
- export { t as isEditablePayableStatus };
44
+ export { o as useDraftDelete };