@tesouro/embedded-components-react 0.3.11 → 0.3.13

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 (81) hide show
  1. package/dist/index.d.ts +12 -0
  2. package/dist/index.js +1 -1
  3. package/dist/lib/BillPayWidget.js +1 -1
  4. package/dist/lib/CardsWidget.d.ts +12 -0
  5. package/dist/lib/CreateCardWidget.d.ts +12 -0
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +8 -8
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +13 -14
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +7 -46
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +54 -16
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +24 -52
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +61 -113
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +123 -13
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +11 -31
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +40 -50
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +51 -5
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +5 -72
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +71 -48
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +48 -79
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +91 -33
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +33 -137
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +138 -67
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +63 -200
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +194 -184
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +180 -50
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +64 -12
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +12 -46
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +46 -30
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +26 -158
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +159 -31
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +32 -98
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +102 -13
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +13 -241
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +244 -4
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +4 -29
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +28 -81
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +77 -130
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +145 -3
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +3 -4
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +2 -43
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +45 -1
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +1 -8
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +6 -9
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +9 -92
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +94 -3
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +3 -9
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +7 -20
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +14 -51
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +59 -3
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +3 -110
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +107 -8
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +8 -40
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +38 -15
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +18 -98
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +92 -173
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +180 -4
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +5 -8
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +6 -112
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +114 -1
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +0 -24
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +25 -0
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index16.js +56 -18
  62. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index46.js +4 -1
  63. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index47.js +75 -46
  64. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index52.js +3 -2
  65. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index53.js +120 -115
  66. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index5.js +1 -2
  67. package/dist/libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index.js +3 -2
  68. package/dist/libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index5.js +19 -12
  69. package/dist/libs/tesouro-embedded-components-react/create-card-widget/data-access/dist/index6.js +22 -0
  70. package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index4.js +4 -1
  71. package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index5.js +0 -1
  72. package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index6.js +22 -37
  73. package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index7.js +167 -110
  74. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +18 -18
  75. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +111 -104
  76. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +144 -128
  77. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/user/useAllOrganizationUsersQuery.js +20 -18
  78. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  79. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index7.js +1 -1
  80. package/dist/packages/shared-ui-shadcn/dist/index.js +1998 -1935
  81. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -2310,6 +2310,18 @@ interface CreateCardFeatureLabels {
2310
2310
  creating: string;
2311
2311
  success: string;
2312
2312
  error: string;
2313
+ /**
2314
+ * Card issued but granting company admins access to it failed. The card
2315
+ * already exists; this must not read as a create failure.
2316
+ */
2317
+ companyAdminAccessWarning: string;
2318
+ /**
2319
+ * The roster of users to grant access to a new card failed to load.
2320
+ * Shown with a retry action; Create stays disabled until it resolves so
2321
+ * a card is never issued without its required admin grants.
2322
+ */
2323
+ debitCardIssuersError: string;
2324
+ retry: string;
2313
2325
  };
2314
2326
  untitledFundingAccount: string;
2315
2327
  /**
package/dist/index.js CHANGED
@@ -16,7 +16,7 @@ import "./lib/AcceptDisclosuresWidget.js";
16
16
  import { BankAccountsWidget as C } from "./libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/index8.js";
17
17
  import "./lib/BankAccountsWidget.js";
18
18
  import { CounterpartsWidget as w } from "./libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/index8.js";
19
- import { BillPayWidget as T } from "./libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js";
19
+ import { BillPayWidget as T } from "./libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js";
20
20
  import "./lib/BillPayWidget.js";
21
21
  import { CardDetailsWidget as E } from "./libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index6.js";
22
22
  import { CardFormatValue as D } from "./libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index3.js";
@@ -1,3 +1,3 @@
1
- import { BillPayWidget as e } from "../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js";
1
+ import { BillPayWidget as e } from "../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js";
2
2
  import "../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js";
3
3
  export { e as BillPayWidget };
@@ -968,6 +968,18 @@ interface CreateCardFeatureLabels {
968
968
  creating: string;
969
969
  success: string;
970
970
  error: string;
971
+ /**
972
+ * Card issued but granting company admins access to it failed. The card
973
+ * already exists; this must not read as a create failure.
974
+ */
975
+ companyAdminAccessWarning: string;
976
+ /**
977
+ * The roster of users to grant access to a new card failed to load.
978
+ * Shown with a retry action; Create stays disabled until it resolves so
979
+ * a card is never issued without its required admin grants.
980
+ */
981
+ debitCardIssuersError: string;
982
+ retry: string;
971
983
  };
972
984
  untitledFundingAccount: string;
973
985
  /**
@@ -691,6 +691,18 @@ interface CreateCardFeatureLabels {
691
691
  creating: string;
692
692
  success: string;
693
693
  error: string;
694
+ /**
695
+ * Card issued but granting company admins access to it failed. The card
696
+ * already exists; this must not read as a create failure.
697
+ */
698
+ companyAdminAccessWarning: string;
699
+ /**
700
+ * The roster of users to grant access to a new card failed to load.
701
+ * Shown with a retry action; Create stays disabled until it resolves so
702
+ * a card is never issued without its required admin grants.
703
+ */
704
+ debitCardIssuersError: string;
705
+ retry: string;
694
706
  };
695
707
  untitledFundingAccount: string;
696
708
  /**
@@ -1,16 +1,15 @@
1
1
  import "./index10.js";
2
2
  import "./index11.js";
3
- import "./index21.js";
4
- import "./index27.js";
5
- import "./index35.js";
6
- import "./index37.js";
7
- import "./index39.js";
3
+ import "./index22.js";
4
+ import "./index28.js";
5
+ import "./index36.js";
6
+ import "./index38.js";
8
7
  import "./index40.js";
9
8
  import "./index41.js";
10
9
  import "./index42.js";
11
10
  import "./index43.js";
12
11
  import "./index44.js";
13
- import "./index48.js";
12
+ import "./index45.js";
14
13
  import "./index49.js";
15
14
  import "./index50.js";
16
15
  import "./index51.js";
@@ -19,10 +18,11 @@ import "./index53.js";
19
18
  import "./index54.js";
20
19
  import "./index55.js";
21
20
  import "./index56.js";
22
- import "./index58.js";
21
+ import "./index57.js";
23
22
  import "./index59.js";
24
23
  import "./index60.js";
25
24
  import "./index61.js";
26
25
  import "./index62.js";
27
- import { BillPayWidget as e } from "./index66.js";
26
+ import "./index63.js";
27
+ import { BillPayWidget as e } from "./index67.js";
28
28
  export { e as BillPayWidget };
@@ -1,17 +1,16 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { usePayableHistoryQuery as e } from "../../data-access/dist/index6.js";
6
- import "../../data-access/dist/index.js";
1
+ import { currentApprovalRound as e } from "./index13.js";
7
2
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.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
- };
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;
15
14
  }
16
15
  //#endregion
17
- export { n as usePayableApprovalRoundStart };
16
+ export { t as buildPendingApproverGroups };
@@ -2,55 +2,16 @@
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 { 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/index5.js";
5
+ import { usePayableHistoryQuery as e } from "../../data-access/dist/index6.js";
13
6
  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 "./index12.js";
17
- import { currentApprovalRound as c } from "./index13.js";
18
- import { usePayableApprovalRoundStart as l } from "./index14.js";
19
- import { useMemo as u } from "react";
20
7
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js
21
- function d({ payableId: d, approvalPolicyId: f, enabled: p = !0, copy: m }) {
22
- let h = p && !!f, { initResponse: g } = i(), _ = e(g?.scopes, [t.ApprovalPolicyReadOrg]), v = e(g?.scopes, [t.ApprovalRequestReadOrg]), y = e(g?.scopes, [t.RoleReadOrg]), b = e(g?.scopes, [t.UserReadOrg]), x = o({ enabled: h && _ }), S = n({ enabled: h && y }), C = r({ enabled: h && b }), w = a(d, { enabled: h && v }), { roundStartedAt: T } = l({
23
- payableId: d,
24
- enabled: h && v
25
- }), E = u(() => {
26
- let e = /* @__PURE__ */ new Map();
27
- for (let t of S.data?.data ?? []) e.set(t.id, {
28
- label: t.name,
29
- kind: "role"
30
- });
31
- for (let t of C.data?.data ?? []) e.set(t.id, {
32
- label: t.name,
33
- kind: "user"
34
- });
35
- return e;
36
- }, [S.data, C.data]), D = u(() => c(w.data?.data, T), [w.data, T]), O = u(() => new Set(D.flatMap((e) => e.approved_by ?? [])), [D]), k = u(() => new Set(D.filter((e) => (e.approved_by ?? []).length > 0).flatMap((e) => e.role_ids ?? [])), [D]), A = u(() => f ? x.data?.data.find((e) => e.id === f) : void 0, [x.data, f]);
8
+ var t = "submitted_for_approval";
9
+ function n({ payableId: n, enabled: r = !0 }) {
10
+ let i = e(n, { enabled: r });
37
11
  return {
38
- view: u(() => h && A ? s({
39
- policy: A,
40
- lookup: E,
41
- approvedUserIds: O,
42
- approvedRoleIds: k,
43
- copy: m
44
- }) : void 0, [
45
- h,
46
- A,
47
- E,
48
- O,
49
- k,
50
- m
51
- ]),
52
- isLoading: h && (x.isResolving || S.isResolving || C.isResolving || w.isLoading)
12
+ roundStartedAt: (i.data?.data ?? []).reduce((e, n) => n.event_type === t ? n.timestamp : e, void 0),
13
+ isLoading: i.isLoading
53
14
  };
54
15
  }
55
16
  //#endregion
56
- export { d as useApprovalPolicyCardView };
17
+ export { n as usePayableApprovalRoundStart };
@@ -3,27 +3,65 @@
3
3
  "use client";
4
4
  "use client";
5
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";
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";
8
9
  import "../../../shared/data-access/dist/index.js";
9
- import { useWidgetConfig as r } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
10
+ import { useWidgetConfig as i } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
10
11
  import "../../../shared/feature/dist/index.js";
11
- import { usePayableApprovalRequestsQuery as i } from "../../data-access/dist/index5.js";
12
+ import { usePayableApprovalRequestsQuery as a } from "../../data-access/dist/index5.js";
12
13
  import "../../data-access/dist/index.js";
13
- import { currentApprovalRound as a } from "./index13.js";
14
- import { usePayableApprovalRoundStart as o } from "./index14.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 "./index12.js";
17
+ import { currentApprovalRound as c } from "./index13.js";
18
+ import { buildPendingApproverGroups as l } from "./index14.js";
19
+ import { usePayableApprovalRoundStart as u } from "./index15.js";
20
+ import { useMemo as d } from "react";
15
21
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.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");
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]);
21
38
  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
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)
26
64
  };
27
65
  }
28
66
  //#endregion
29
- export { s as useCurrentApprovalRequestId };
67
+ export { f as useApprovalPolicyCardView };
@@ -1,57 +1,29 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
1
5
  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";
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";
3
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/index5.js";
12
+ import "../../data-access/dist/index.js";
13
+ import { currentApprovalRound as a } from "./index13.js";
14
+ import { usePayableApprovalRoundStart as o } from "./index15.js";
4
15
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js
5
- function n({ status: n, scopes: r, canDecideApprovalRequest: i, hasScheduledPayment: a, scheduledPaymentRecordId: o, isPolicyApprover: s, hasWaitingRequest: c, labels: l }) {
6
- let u = e(r, [t.PayablePayOrg]), d = e(r, [t.BankAccountReadOrg]), f = e(r, [t.PaymentRailAch]), p = e(r, [t.PayableWriteOrg]), m = e(r, [t.PaymentRecordWriteOrg]), h = e(r, [t.PayableApproveOrg]), g = [];
7
- n === "approve_in_progress" && i && (g.push({
8
- id: "approve",
9
- label: l.approve,
10
- variant: "default",
11
- surface: "row"
12
- }), g.push({
13
- id: "reject",
14
- label: l.reject,
15
- variant: "ghost",
16
- surface: "row"
17
- })), n === "approve_in_progress" && c && h && !s && (g.push({
18
- id: "forceApprove",
19
- label: l.forceApprove,
20
- variant: "ghost",
21
- surface: "menu"
22
- }), g.push({
23
- id: "forceReject",
24
- label: l.forceReject,
25
- variant: "ghost",
26
- surface: "menu"
27
- }));
28
- let _ = (n === "waiting_to_be_paid" || n === "partially_paid") && u && !a, v = n === "waiting_to_be_paid" && u && d && f && !a;
29
- return _ && g.push({
30
- id: "markAsPaid",
31
- label: l.markAsPaid,
32
- variant: "outline",
33
- surface: "row"
34
- }), v && g.push({
35
- id: "payBill",
36
- label: l.payBill,
37
- variant: "default",
38
- surface: "row"
39
- }), n === "new" && p && g.push({
40
- id: "cancel",
41
- label: l.cancel,
42
- variant: "ghost",
43
- surface: "menu"
44
- }), (n === "rejected" || n === "waiting_to_be_paid" && !a) && p && g.push({
45
- id: "reopen",
46
- label: l.reopen,
47
- variant: "ghost",
48
- surface: "menu"
49
- }), n === "waiting_to_be_paid" && a && o && m && g.push({
50
- id: "cancelScheduledPayment",
51
- label: l.cancelScheduledPayment,
52
- variant: "ghost",
53
- surface: "menu"
54
- }), g;
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");
21
+ 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
26
+ };
55
27
  }
56
28
  //#endregion
57
- export { n as getBillDetailActions };
29
+ export { s as useCurrentApprovalRequestId };
@@ -1,117 +1,65 @@
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 { useWidgetConfig as t } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
8
- import "../../../shared/feature/dist/index.js";
9
- import { useApprovePayableApprovalRequestMutation as n, useRejectPayableApprovalRequestMutation as r } from "../../data-access/dist/index5.js";
10
- import { useCancelPayableMutation as i, useCancelPaymentRecordMutation as a, useForceApprovePayableMutation as o, useForceRejectPayableMutation as s, useMarkPayableAsPaidMutation as c, useReopenPayableMutation as l } from "../../data-access/dist/index10.js";
11
- import "../../data-access/dist/index.js";
12
- import { getBillDetailActions as u } from "./index17.js";
13
- import { useState as d } from "react";
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";
3
+ 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";
14
5
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js
15
- function f({ payableId: f, status: p, currentApprovalRequestId: h, isPolicyApprover: g, hasWaitingRequest: _, hasScheduledPayment: v, scheduledPaymentRecordId: y, isScheduledPaymentUnknown: b, labels: x, onPayBillSelect: S }) {
16
- let { initResponse: C } = t(), w = c(), T = r(), E = n(), D = i(), O = a(), k = l(), A = o(), j = s(), M = w.isPending || T.isPending || E.isPending || D.isPending || O.isPending || k.isPending || A.isPending || j.isPending, [N, P] = d(), F = N && (N.id !== "cancelScheduledPayment" || N.scheduledPaymentRecordId === y) ? N : void 0, I = f && p ? u({
17
- status: p,
18
- scopes: C?.scopes,
19
- canDecideApprovalRequest: !!h,
20
- isPolicyApprover: g,
21
- hasWaitingRequest: _,
22
- hasScheduledPayment: v || b,
23
- scheduledPaymentRecordId: y,
24
- labels: x
25
- }) : [], L = { onError: () => e.error(x.actionError) }, R = {
26
- markAsPaid: {
27
- isPending: w.isPending,
28
- run: () => f && w.mutate({ path: { payable_id: f } }, L)
29
- },
30
- reject: {
31
- isPending: T.isPending,
32
- run: (e) => h && T.mutate({
33
- path: { approval_request_id: h },
34
- body: e ? { reject_reason: e } : void 0
35
- }, L)
36
- },
37
- approve: {
38
- isPending: E.isPending,
39
- run: () => h && E.mutate({ path: { approval_request_id: h } }, L)
40
- },
41
- cancel: {
42
- isPending: D.isPending,
43
- run: () => f && D.mutate({ path: { payable_id: f } }, L)
44
- },
45
- cancelScheduledPayment: {
46
- isPending: O.isPending,
47
- run: () => {
48
- let e = F?.scheduledPaymentRecordId;
49
- !f || !e || O.mutate({
50
- path: { payment_record_id: e },
51
- payableId: f
52
- }, L);
53
- }
54
- },
55
- reopen: {
56
- isPending: k.isPending,
57
- run: () => f && k.mutate({ path: { payable_id: f } }, L)
58
- },
59
- forceApprove: {
60
- isPending: A.isPending,
61
- run: () => f && A.mutate({ path: { payable_id: f } }, L)
62
- },
63
- forceReject: {
64
- isPending: j.isPending,
65
- run: () => f && j.mutate({ path: { payable_id: f } }, L)
66
- }
67
- }, z = I.map((e) => ({
68
- ...e,
69
- disabled: M,
70
- loading: R[e.id]?.isPending ?? !1,
71
- onSelect: () => {
72
- if (!(M || !f)) {
73
- if (e.id === "payBill") {
74
- S();
75
- return;
76
- }
77
- if (m(e.id)) {
78
- P({
79
- id: e.id,
80
- scheduledPaymentRecordId: y
81
- });
82
- return;
83
- }
84
- R[e.id]?.run();
85
- }
86
- }
6
+ function s({ status: s, scopes: c, canDecideApprovalRequest: l, hasScheduledPayment: u, scheduledPaymentRecordId: 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 = e(c, [t.PaymentRecordWriteOrg]), 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
87
32
  }));
88
- return {
89
- actions: {
90
- row: z.filter((e) => e.surface === "row"),
91
- menu: z.filter((e) => e.surface === "menu")
92
- },
93
- decisionDialog: {
94
- open: !!F,
95
- copy: F ? x.decisionDialog[F.id] : void 0,
96
- isPending: F ? R[F.id]?.isPending ?? !1 : !1,
97
- onCancel: () => {
98
- M || P(void 0);
99
- },
100
- onConfirm: (e) => {
101
- !F || M || (R[F.id]?.run(e), P(void 0));
102
- }
103
- }
104
- };
105
- }
106
- var p = [
107
- "reject",
108
- "cancel",
109
- "cancelScheduledPayment",
110
- "forceApprove",
111
- "forceReject"
112
- ];
113
- function m(e) {
114
- return p.includes(e);
33
+ let C = (s === "waiting_to_be_paid" || s === "partially_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;
115
63
  }
116
64
  //#endregion
117
- export { f as usePayableDetailActions };
65
+ export { s as getBillDetailActions };