@tesouro/embedded-components-react 0.3.9 → 0.3.12
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.
- package/dist/index.js +1 -1
- package/dist/lib/BillPayWidget.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +8 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +13 -14
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +7 -46
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +54 -16
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +24 -52
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +61 -113
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +123 -13
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +11 -31
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +40 -50
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +51 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +5 -72
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +71 -48
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +48 -79
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +91 -33
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +33 -137
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +138 -67
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +63 -200
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +194 -184
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +180 -50
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +64 -12
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +12 -46
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +46 -30
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +26 -158
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +159 -31
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +32 -98
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +102 -13
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +13 -241
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +244 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +4 -29
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +28 -81
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +77 -130
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +145 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +3 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +2 -43
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +45 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +1 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +6 -9
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +9 -92
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +94 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +3 -9
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +7 -20
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +14 -51
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +59 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +3 -110
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +107 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +8 -40
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +38 -15
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +18 -98
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +92 -173
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +180 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +5 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +6 -112
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +114 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +0 -24
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +25 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index16.js +56 -18
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index46.js +4 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index47.js +75 -46
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index52.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index53.js +120 -115
- package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index7.js +45 -44
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/zod.gen.js +846 -817
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/scopes.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index7.js +1 -1
- package/dist/packages/shared-ui-shadcn/dist/index.js +1998 -1935
- package/package.json +1 -1
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/
|
|
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/
|
|
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 };
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import "./index10.js";
|
|
2
2
|
import "./index11.js";
|
|
3
|
-
import "./
|
|
4
|
-
import "./
|
|
5
|
-
import "./
|
|
6
|
-
import "./
|
|
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 "./
|
|
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 "./
|
|
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
|
|
26
|
+
import "./index63.js";
|
|
27
|
+
import { BillPayWidget as e } from "./index67.js";
|
|
28
28
|
export { e as BillPayWidget };
|
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
9
|
-
|
|
10
|
-
let
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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 {
|
|
16
|
+
export { t as buildPendingApproverGroups };
|
|
@@ -2,55 +2,16 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
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
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
39
|
-
|
|
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 {
|
|
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 {
|
|
7
|
-
import {
|
|
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
|
|
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
|
|
12
|
+
import { usePayableApprovalRequestsQuery as a } from "../../data-access/dist/index5.js";
|
|
12
13
|
import "../../data-access/dist/index.js";
|
|
13
|
-
import {
|
|
14
|
-
import
|
|
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
|
|
17
|
-
let { initResponse:
|
|
18
|
-
payableId:
|
|
19
|
-
enabled:
|
|
20
|
-
}),
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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 {
|
|
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 {
|
|
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
|
|
6
|
-
let
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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 {
|
|
29
|
+
export { s as useCurrentApprovalRequestId };
|
|
@@ -1,117 +1,65 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
|
16
|
-
let
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
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
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
"
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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 {
|
|
65
|
+
export { s as getBillDetailActions };
|
|
@@ -2,23 +2,133 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import "../../../shared/
|
|
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";
|
|
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 {
|
|
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";
|
|
12
11
|
import "../../data-access/dist/index.js";
|
|
12
|
+
import { getBillDetailActions as u } from "./index18.js";
|
|
13
|
+
import { useState as d } from "react";
|
|
14
|
+
import { HandIcon as f } from "lucide-react";
|
|
13
15
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js
|
|
14
|
-
function
|
|
15
|
-
let { initResponse:
|
|
16
|
+
function p({ payableId: f, status: p, currentApprovalRequestId: h, isPolicyApprover: v, hasWaitingRequest: y, arePendingApproversUnknown: b, hasScheduledPayment: x, scheduledPaymentRecordId: S, isScheduledPaymentUnknown: C, labels: w, pendingApprovers: T, onPayBillSelect: E }) {
|
|
17
|
+
let { initResponse: D } = t(), O = c(), k = r(), A = n(), j = i(), M = a(), N = l(), P = o(), F = s(), I = O.isPending || k.isPending || A.isPending || j.isPending || M.isPending || N.isPending || P.isPending || F.isPending, [L, R] = d(), z = L && (L.id !== "cancelScheduledPayment" || L.scheduledPaymentRecordId === S) ? L : void 0, B = f && p ? u({
|
|
18
|
+
status: p,
|
|
19
|
+
scopes: D?.scopes,
|
|
20
|
+
canDecideApprovalRequest: !!h,
|
|
21
|
+
isPolicyApprover: v,
|
|
22
|
+
hasWaitingRequest: y,
|
|
23
|
+
arePendingApproversUnknown: b,
|
|
24
|
+
hasScheduledPayment: x || C,
|
|
25
|
+
scheduledPaymentRecordId: S,
|
|
26
|
+
labels: w
|
|
27
|
+
}) : [], V = (t) => ({
|
|
28
|
+
onError: () => e.error(w.actionError),
|
|
29
|
+
onSuccess: () => e.success(w.actionSuccess[t])
|
|
30
|
+
}), H = {
|
|
31
|
+
markAsPaid: {
|
|
32
|
+
isPending: O.isPending,
|
|
33
|
+
run: () => f && O.mutate({ path: { payable_id: f } }, V("markAsPaid"))
|
|
34
|
+
},
|
|
35
|
+
reject: {
|
|
36
|
+
isPending: k.isPending,
|
|
37
|
+
run: (e) => h && k.mutate({
|
|
38
|
+
path: { approval_request_id: h },
|
|
39
|
+
body: e ? { reject_reason: e } : void 0
|
|
40
|
+
}, V("reject"))
|
|
41
|
+
},
|
|
42
|
+
approve: {
|
|
43
|
+
isPending: A.isPending,
|
|
44
|
+
run: () => h && A.mutate({ path: { approval_request_id: h } }, V("approve"))
|
|
45
|
+
},
|
|
46
|
+
cancel: {
|
|
47
|
+
isPending: j.isPending,
|
|
48
|
+
run: () => f && j.mutate({ path: { payable_id: f } }, V("cancel"))
|
|
49
|
+
},
|
|
50
|
+
cancelScheduledPayment: {
|
|
51
|
+
isPending: M.isPending,
|
|
52
|
+
run: () => {
|
|
53
|
+
let e = z?.scheduledPaymentRecordId;
|
|
54
|
+
!f || !e || M.mutate({
|
|
55
|
+
path: { payment_record_id: e },
|
|
56
|
+
payableId: f
|
|
57
|
+
}, V("cancelScheduledPayment"));
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
reopen: {
|
|
61
|
+
isPending: N.isPending,
|
|
62
|
+
run: () => f && N.mutate({ path: { payable_id: f } }, V("reopen"))
|
|
63
|
+
},
|
|
64
|
+
forceApprove: {
|
|
65
|
+
isPending: P.isPending,
|
|
66
|
+
run: () => f && P.mutate({ path: { payable_id: f } }, V("forceApprove"))
|
|
67
|
+
},
|
|
68
|
+
forceReject: {
|
|
69
|
+
isPending: F.isPending,
|
|
70
|
+
run: () => f && F.mutate({ path: { payable_id: f } }, V("forceReject"))
|
|
71
|
+
}
|
|
72
|
+
}, U = B.map((e) => ({
|
|
73
|
+
...e,
|
|
74
|
+
disabled: I,
|
|
75
|
+
loading: H[e.id]?.isPending ?? !1,
|
|
76
|
+
onSelect: () => {
|
|
77
|
+
if (!(I || !f)) {
|
|
78
|
+
if (e.id === "payBill") {
|
|
79
|
+
E();
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (g(e.id)) {
|
|
83
|
+
R({
|
|
84
|
+
id: e.id,
|
|
85
|
+
scheduledPaymentRecordId: S
|
|
86
|
+
});
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
H[e.id]?.run();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}));
|
|
16
93
|
return {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
94
|
+
actions: {
|
|
95
|
+
row: U.filter((e) => e.surface === "row"),
|
|
96
|
+
menu: U.filter((e) => e.surface === "menu")
|
|
97
|
+
},
|
|
98
|
+
decisionDialog: {
|
|
99
|
+
open: !!z,
|
|
100
|
+
copy: z ? {
|
|
101
|
+
...w.decisionDialog[z.id],
|
|
102
|
+
presentation: _(z.id) ? m : void 0,
|
|
103
|
+
pendingApprovers: _(z.id) ? T ?? [] : void 0
|
|
104
|
+
} : void 0,
|
|
105
|
+
isPending: z ? H[z.id]?.isPending ?? !1 : !1,
|
|
106
|
+
onCancel: () => {
|
|
107
|
+
I || R(void 0);
|
|
108
|
+
},
|
|
109
|
+
onConfirm: (e) => {
|
|
110
|
+
!z || I || (H[z.id]?.run(e), R(void 0));
|
|
111
|
+
}
|
|
112
|
+
}
|
|
21
113
|
};
|
|
22
114
|
}
|
|
115
|
+
var m = {
|
|
116
|
+
alignment: "center",
|
|
117
|
+
icon: f,
|
|
118
|
+
tone: "destructive",
|
|
119
|
+
actionWidth: "equal"
|
|
120
|
+
}, h = [
|
|
121
|
+
"reject",
|
|
122
|
+
"cancel",
|
|
123
|
+
"cancelScheduledPayment",
|
|
124
|
+
"forceApprove",
|
|
125
|
+
"forceReject"
|
|
126
|
+
];
|
|
127
|
+
function g(e) {
|
|
128
|
+
return h.includes(e);
|
|
129
|
+
}
|
|
130
|
+
function _(e) {
|
|
131
|
+
return e === "forceApprove" || e === "forceReject";
|
|
132
|
+
}
|
|
23
133
|
//#endregion
|
|
24
|
-
export {
|
|
134
|
+
export { p as usePayableDetailActions };
|