@tesouro/embedded-components-react 0.3.53 → 0.3.57
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/README.md +0 -20
- package/dist/index.d.ts +2 -22
- package/dist/index.js +44 -48
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +65 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +4 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +5 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +3 -32
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +30 -37
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +37 -158
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +165 -28
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +48 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +1 -50
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +47 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +4 -13
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +13 -14
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +7 -57
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +54 -16
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +24 -60
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +6 -6
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +98 -98
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +51 -53
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +131 -140
- package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index.js +4 -4
- package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index22.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index98.js +47 -29
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/data-access/dist/index5.js +6 -6
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/index.js +6 -5
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/helpers.js +2 -3
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/usePayableAchInstructions.js +18 -0
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
- package/dist/lib/CreateCardWidget.d.ts +0 -823
- package/dist/lib/CreateCardWidget.js +0 -5
|
@@ -2,66 +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/index7.js";
|
|
5
|
+
import { usePayableHistoryQuery as e } from "../../data-access/dist/index8.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 "./index24.js";
|
|
17
|
-
import { currentApprovalRound as c } from "./index25.js";
|
|
18
|
-
import { buildPendingApproverGroups as l } from "./index26.js";
|
|
19
|
-
import { usePayableApprovalRoundStart as u } from "./index27.js";
|
|
20
|
-
import { useMemo as d } from "react";
|
|
21
7
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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]);
|
|
8
|
+
var t = "submitted_for_approval";
|
|
9
|
+
function n({ payableId: n, enabled: r = !0 }) {
|
|
10
|
+
let i = e(n, { enabled: r });
|
|
38
11
|
return {
|
|
39
|
-
|
|
40
|
-
|
|
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)
|
|
12
|
+
roundStartedAt: (i.data?.data ?? []).reduce((e, n) => n.event_type === t ? n.timestamp : e, void 0),
|
|
13
|
+
isLoading: i.isLoading
|
|
64
14
|
};
|
|
65
15
|
}
|
|
66
16
|
//#endregion
|
|
67
|
-
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/index7.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 "./index25.js";
|
|
17
|
+
import { currentApprovalRound as c } from "./index26.js";
|
|
18
|
+
import { buildPendingApproverGroups as l } from "./index27.js";
|
|
19
|
+
import { usePayableApprovalRoundStart as u } from "./index28.js";
|
|
20
|
+
import { useMemo as d } from "react";
|
|
15
21
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.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,65 +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";
|
|
4
|
-
import {
|
|
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/index7.js";
|
|
12
|
+
import "../../data-access/dist/index.js";
|
|
13
|
+
import { currentApprovalRound as a } from "./index26.js";
|
|
14
|
+
import { usePayableApprovalRoundStart as o } from "./index28.js";
|
|
5
15
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js
|
|
6
|
-
function s({
|
|
7
|
-
let
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
surface: "row"
|
|
18
|
-
})), s === "approve_in_progress" && p && x && !f && !m && (S.push({
|
|
19
|
-
id: "forceApprove",
|
|
20
|
-
label: h.forceApprove,
|
|
21
|
-
variant: "ghost",
|
|
22
|
-
surface: "menu",
|
|
23
|
-
icon: o,
|
|
24
|
-
sectionHeading: h.policyOverridesHeading
|
|
25
|
-
}), S.push({
|
|
26
|
-
id: "forceReject",
|
|
27
|
-
label: h.forceReject,
|
|
28
|
-
variant: "ghost",
|
|
29
|
-
surface: "menu",
|
|
30
|
-
icon: a,
|
|
31
|
-
sectionHeading: h.policyOverridesHeading
|
|
32
|
-
}));
|
|
33
|
-
let C = s === "waiting_to_be_paid" && g && !u, w = s === "waiting_to_be_paid" && g && _ && v && !u;
|
|
34
|
-
return C && S.push({
|
|
35
|
-
id: "markAsPaid",
|
|
36
|
-
label: h.markAsPaid,
|
|
37
|
-
variant: "outline",
|
|
38
|
-
surface: "row"
|
|
39
|
-
}), w && S.push({
|
|
40
|
-
id: "payBill",
|
|
41
|
-
label: h.payBill,
|
|
42
|
-
variant: "default",
|
|
43
|
-
surface: "row"
|
|
44
|
-
}), s === "new" && y && S.push({
|
|
45
|
-
id: "cancel",
|
|
46
|
-
label: h.cancel,
|
|
47
|
-
variant: "ghost",
|
|
48
|
-
surface: "menu",
|
|
49
|
-
icon: n
|
|
50
|
-
}), (s === "rejected" || s === "waiting_to_be_paid" && !u) && y && S.push({
|
|
51
|
-
id: "reopen",
|
|
52
|
-
label: h.reopen,
|
|
53
|
-
variant: "ghost",
|
|
54
|
-
surface: "menu",
|
|
55
|
-
icon: i
|
|
56
|
-
}), s === "waiting_to_be_paid" && u && d && b && S.push({
|
|
57
|
-
id: "cancelScheduledPayment",
|
|
58
|
-
label: h.cancelScheduledPayment,
|
|
59
|
-
variant: "ghost",
|
|
60
|
-
surface: "menu",
|
|
61
|
-
icon: r
|
|
62
|
-
}), S;
|
|
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
|
+
};
|
|
63
27
|
}
|
|
64
28
|
//#endregion
|
|
65
|
-
export { s as
|
|
29
|
+
export { s as useCurrentApprovalRequestId };
|
|
@@ -9,7 +9,7 @@ import "../../../shared/feature/dist/index.js";
|
|
|
9
9
|
import { useApprovePayableApprovalRequestMutation as n, useRejectPayableApprovalRequestMutation as r } from "../../data-access/dist/index7.js";
|
|
10
10
|
import { useCancelPayableMutation as i, useCancelScheduledPaymentMutation as a, useForceApprovePayableMutation as o, useForceRejectPayableMutation as s, useReopenPayableMutation as c } from "../../data-access/dist/index12.js";
|
|
11
11
|
import "../../data-access/dist/index.js";
|
|
12
|
-
import { getBillDetailActions as l } from "./
|
|
12
|
+
import { getBillDetailActions as l } from "./index16.js";
|
|
13
13
|
import { useState as u } from "react";
|
|
14
14
|
import { HandIcon as d } from "lucide-react";
|
|
15
15
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { formatCalendarDate as e } from "../../../shared/util/dist/lib/formatCalendarDate.js";
|
|
2
2
|
import { derivePayableStatus as t } from "./index4.js";
|
|
3
3
|
import { resolveVendor as n } from "./index5.js";
|
|
4
|
-
import { resolveAmountDueMinorUnits as r } from "./
|
|
4
|
+
import { resolveAmountDueMinorUnits as r } from "./index17.js";
|
|
5
5
|
import { formatBillMoney as i } from "./index35.js";
|
|
6
6
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js
|
|
7
7
|
function a({ payable: a, lineItems: o, glCodeOptions: s, glCodeRosterAvailable: c = !0, history: l, approvalPolicy: u, labels: d, hasScheduledPayment: f }) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { UNSAVED_BILL_DIALOG_LABELS_EN as e } from "../../ui/dist/index96.js";
|
|
2
2
|
import "../../ui/dist/index.js";
|
|
3
|
-
import { PAY_BILL_FLOW_LABELS_EN as t, mergePayBillFlowLabels as n } from "./
|
|
3
|
+
import { PAY_BILL_FLOW_LABELS_EN as t, mergePayBillFlowLabels as n } from "./index21.js";
|
|
4
4
|
import { MARK_AS_PAID_FLOW_LABELS_EN as r, mergeMarkAsPaidFlowLabels as i } from "./index12.js";
|
|
5
5
|
import "./index15.js";
|
|
6
|
-
import { APPROVAL_POLICY_RULE_COPY_EN as a } from "./
|
|
6
|
+
import { APPROVAL_POLICY_RULE_COPY_EN as a } from "./index25.js";
|
|
7
7
|
import { BILL_DETAIL_ACTIONS_LABELS_EN as o, SCHEDULED_SUMMARY_LABEL_EN as s, mergeBillDetailActionsLabels as c } from "./index38.js";
|
|
8
8
|
import { SOURCE_DOCUMENT_PREVIEW_LABELS_EN as l } from "./index39.js";
|
|
9
9
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js
|
|
@@ -6,28 +6,28 @@ import { Button as e } from "../../../../../packages/shared-ui-shadcn/dist/index
|
|
|
6
6
|
import { getStateOptions as t } from "../../../shared/util/dist/lib/usStates.js";
|
|
7
7
|
import { AchFieldGroup as n } from "../../../shared/counterpart-management/ui/dist/index5.js";
|
|
8
8
|
import { CounterpartFormFields as r, useFocusFirstInvalidField as i } from "../../../shared/counterpart-management/ui/dist/index9.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { useCounterpartForm as s } from "../../../shared/counterpart-management/feature/dist/lib/useCounterpartForm.js";
|
|
9
|
+
import { COUNTERPART_MESSAGE_LABELS_EN as a } from "../../../shared/counterpart-management/feature/dist/lib/labels.js";
|
|
10
|
+
import { useCounterpartForm as o } from "../../../shared/counterpart-management/feature/dist/lib/useCounterpartForm.js";
|
|
12
11
|
import "../../../shared/counterpart-management/feature/dist/index.js";
|
|
12
|
+
import { VENDOR_INLINE_FORM_LABELS_EN as s } from "./index40.js";
|
|
13
13
|
import { useCallback as c, useEffect as l, useMemo as u, useRef as d, useState as f } from "react";
|
|
14
14
|
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
15
15
|
import { Landmark as g, Plus as _, X as v } from "lucide-react";
|
|
16
16
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js
|
|
17
17
|
function y({ mode: y, counterpart: b, primaryAddress: x, bankAccounts: S, isBankAccountsLoading: C, isBankAccountsError: w, initialName: T, initialValues: E, onSaved: D, onCancel: O, onDirtyChange: k, labels: A }) {
|
|
18
18
|
let j = {
|
|
19
|
-
...
|
|
19
|
+
...s,
|
|
20
20
|
...A
|
|
21
21
|
}, [M, N] = f("none"), [P, F] = f(b?.id), [I, L] = f(!1), [R, z] = f(!1);
|
|
22
22
|
l(() => {
|
|
23
23
|
k?.(R);
|
|
24
24
|
}, [R, k]);
|
|
25
|
-
let B = u(() => t(), []), V = d(M), H = d(!1), U =
|
|
25
|
+
let B = u(() => t(), []), V = d(M), H = d(!1), U = o({
|
|
26
26
|
view: M,
|
|
27
27
|
setView: N,
|
|
28
28
|
selectedId: P,
|
|
29
29
|
setSelectedId: F,
|
|
30
|
-
messages:
|
|
30
|
+
messages: a,
|
|
31
31
|
counterpartType: "vendor",
|
|
32
32
|
counterpart: b,
|
|
33
33
|
primaryAddress: x,
|
|
@@ -4,88 +4,88 @@
|
|
|
4
4
|
"use client";
|
|
5
5
|
import { usePayableSuggestionsQuery as e } from "../../data-access/dist/index16.js";
|
|
6
6
|
import "../../data-access/dist/index.js";
|
|
7
|
-
import { maskAccountNumber as t } from "./
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { useCreateCounterpartBankAccountMutation as ie, useUpdateCounterpartBankAccountMutation as ae } from "../../../shared/counterpart-management/data-access/dist/index5.js";
|
|
13
|
-
import { useCounterpartDetails as oe } from "../../../shared/counterpart-management/feature/dist/lib/useCounterpartDetails.js";
|
|
7
|
+
import { maskAccountNumber as t } from "./index19.js";
|
|
8
|
+
import { counterpartFormBankAccountToCreatePayload as n, counterpartFormBankAccountToUpdatePayload as ee, getAchInstructions as r, getCounterpartEmail as i, getCounterpartName as a, getPayableAchInstructions as o, hasAchFormValues as s, resolveCounterpartBankAccountWrite as c, validateAchFormValues as te } from "../../../shared/counterpart-management/feature/dist/lib/helpers.js";
|
|
9
|
+
import { useCounterpartsQuery as ne } from "../../../shared/counterpart-management/data-access/dist/index3.js";
|
|
10
|
+
import { useCreateCounterpartBankAccountMutation as re, useUpdateCounterpartBankAccountMutation as ie } from "../../../shared/counterpart-management/data-access/dist/index5.js";
|
|
11
|
+
import { useCounterpartDetails as ae } from "../../../shared/counterpart-management/feature/dist/lib/useCounterpartDetails.js";
|
|
14
12
|
import "../../../shared/counterpart-management/feature/dist/index.js";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
13
|
+
import { VENDOR_SECTION_PROPS_LABELS_EN as oe } from "./index40.js";
|
|
14
|
+
import { buildVendorPrefill as se } from "./index42.js";
|
|
15
|
+
import { VendorInlineForm as ce } from "./index43.js";
|
|
16
|
+
import { useCallback as l, useEffect as u, useMemo as d, useRef as f, useState as p } from "react";
|
|
17
|
+
import { jsx as le } from "react/jsx-runtime";
|
|
18
18
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js
|
|
19
|
-
var
|
|
19
|
+
var m = 10, ue = 300, h = {
|
|
20
20
|
accountHolderName: "",
|
|
21
21
|
routingNumber: "",
|
|
22
22
|
accountNumber: ""
|
|
23
23
|
};
|
|
24
|
-
function
|
|
25
|
-
let
|
|
26
|
-
...
|
|
27
|
-
...
|
|
28
|
-
}, [
|
|
29
|
-
|
|
30
|
-
let [
|
|
31
|
-
|
|
32
|
-
}, []), U =
|
|
33
|
-
me(!0),
|
|
34
|
-
}, [
|
|
35
|
-
|
|
36
|
-
!V && !
|
|
24
|
+
function g({ payableId: g, counterpartId: _, payableCounterpartId: v, payableCounterpartBankAccountId: y, onCounterpartChange: b, requiredError: de, extractedVendor: x, labels: fe }) {
|
|
25
|
+
let S = {
|
|
26
|
+
...oe,
|
|
27
|
+
...fe
|
|
28
|
+
}, [C, w] = p(""), [T, E] = p(""), [D, O] = p(), [pe, k] = p(!1), [A, j] = p(h), M = f(A);
|
|
29
|
+
M.current = A;
|
|
30
|
+
let [N, P] = p(!1), F = s(A) || N, [I, L] = p(), [R, z] = p(), B = f(_), [V, me] = p(!1), H = l(() => {
|
|
31
|
+
k(!1), j(h), L(void 0), z(void 0);
|
|
32
|
+
}, []), U = l((e) => {
|
|
33
|
+
me(!0), b(e);
|
|
34
|
+
}, [b]), W = e(g, { enabled: !!g && !_ && !v }).data?.suggested_counterpart?.id;
|
|
35
|
+
u(() => {
|
|
36
|
+
!V && !_ && !v && W && U(W);
|
|
37
37
|
}, [
|
|
38
|
+
_,
|
|
38
39
|
v,
|
|
39
|
-
y,
|
|
40
40
|
V,
|
|
41
41
|
W,
|
|
42
42
|
U
|
|
43
|
-
]),
|
|
44
|
-
B.current !==
|
|
45
|
-
}, [
|
|
43
|
+
]), u(() => {
|
|
44
|
+
B.current !== _ && (B.current = _, H());
|
|
45
|
+
}, [_, H]), u(() => {
|
|
46
46
|
let e = setTimeout(() => {
|
|
47
|
-
|
|
48
|
-
},
|
|
47
|
+
E(C.trim());
|
|
48
|
+
}, ue);
|
|
49
49
|
return () => clearTimeout(e);
|
|
50
|
-
}, [
|
|
51
|
-
let G =
|
|
50
|
+
}, [C]);
|
|
51
|
+
let G = ne({
|
|
52
52
|
sort: "counterpart_name",
|
|
53
53
|
order: "asc",
|
|
54
|
-
limit:
|
|
55
|
-
counterpart_name__icontains:
|
|
54
|
+
limit: m,
|
|
55
|
+
counterpart_name__icontains: T || void 0,
|
|
56
56
|
is_vendor: !0,
|
|
57
|
-
enabled: !!
|
|
58
|
-
}), K =
|
|
57
|
+
enabled: !!T
|
|
58
|
+
}), K = ae({ selectedId: _ }), q = re(), J = ie(), Y = d(() => {
|
|
59
59
|
let e = K.counterpart;
|
|
60
60
|
if (!e) return;
|
|
61
61
|
if (K.isBankAccountsLoading) return {
|
|
62
|
-
name:
|
|
63
|
-
email:
|
|
64
|
-
methodLabel:
|
|
62
|
+
name: a(e),
|
|
63
|
+
email: i(e),
|
|
64
|
+
methodLabel: S.paymentMethodLoading,
|
|
65
65
|
fields: []
|
|
66
66
|
};
|
|
67
67
|
if (K.isBankAccountsError) return {
|
|
68
|
-
name:
|
|
69
|
-
email:
|
|
70
|
-
methodLabel:
|
|
68
|
+
name: a(e),
|
|
69
|
+
email: i(e),
|
|
70
|
+
methodLabel: S.paymentMethodUnavailable,
|
|
71
71
|
fields: []
|
|
72
72
|
};
|
|
73
|
-
let n =
|
|
73
|
+
let n = o(K.bankAccounts);
|
|
74
74
|
return {
|
|
75
|
-
name:
|
|
76
|
-
email:
|
|
77
|
-
methodLabel: n ?
|
|
75
|
+
name: a(e),
|
|
76
|
+
email: i(e),
|
|
77
|
+
methodLabel: n ? S.achMethod : S.noMethod,
|
|
78
78
|
fields: n ? [
|
|
79
79
|
{
|
|
80
|
-
label:
|
|
80
|
+
label: S.accountHolder,
|
|
81
81
|
value: n.account_holder_name ?? ""
|
|
82
82
|
},
|
|
83
83
|
{
|
|
84
|
-
label:
|
|
84
|
+
label: S.routingNumber,
|
|
85
85
|
value: n.routing_number ?? ""
|
|
86
86
|
},
|
|
87
87
|
{
|
|
88
|
-
label:
|
|
88
|
+
label: S.accountNumber,
|
|
89
89
|
value: n.account_number ?? "",
|
|
90
90
|
maskedValue: n.account_number ? t(n.account_number) : ""
|
|
91
91
|
}
|
|
@@ -96,43 +96,43 @@ function _({ payableId: _, counterpartId: v, payableCounterpartId: y, payableCou
|
|
|
96
96
|
K.counterpart,
|
|
97
97
|
K.isBankAccountsError,
|
|
98
98
|
K.isBankAccountsLoading,
|
|
99
|
-
|
|
100
|
-
]), X =
|
|
101
|
-
let e =
|
|
102
|
-
if (!
|
|
103
|
-
if (!
|
|
99
|
+
S
|
|
100
|
+
]), X = d(() => r(K.bankAccounts), [K.bankAccounts]), Z = d(() => o(K.bankAccounts)?.id, [K.bankAccounts]), Q = l(async () => {
|
|
101
|
+
let e = M.current;
|
|
102
|
+
if (!_) return { ok: !0 };
|
|
103
|
+
if (!s(e)) return y && _ === v ? {
|
|
104
104
|
ok: !0,
|
|
105
|
-
counterpartBankAccountId:
|
|
105
|
+
counterpartBankAccountId: y
|
|
106
106
|
} : K.isBankAccountsLoading || K.isBankAccountsFetching || K.isBankAccountsError ? { ok: !1 } : {
|
|
107
107
|
ok: !0,
|
|
108
108
|
counterpartBankAccountId: Z
|
|
109
109
|
};
|
|
110
110
|
if (K.isBankAccountsLoading || K.isBankAccountsFetching || K.isBankAccountsError) return { ok: !1 };
|
|
111
|
-
let t =
|
|
112
|
-
if (Object.keys(t).length > 0) return L(t),
|
|
111
|
+
let t = te(e);
|
|
112
|
+
if (Object.keys(t).length > 0) return L(t), k(!0), { ok: !1 };
|
|
113
113
|
L(void 0);
|
|
114
|
-
let
|
|
115
|
-
if (
|
|
114
|
+
let r = c(K.bankAccounts, R ?? X?.id);
|
|
115
|
+
if (r.kind === "update") return await J.mutateAsync({
|
|
116
116
|
path: {
|
|
117
|
-
counterpart_id:
|
|
118
|
-
bank_account_id:
|
|
117
|
+
counterpart_id: _,
|
|
118
|
+
bank_account_id: r.bankAccountId
|
|
119
119
|
},
|
|
120
|
-
body:
|
|
121
|
-
}), z(
|
|
120
|
+
body: ee(e, { includeAchDefaults: r.includeAchDefaults })
|
|
121
|
+
}), z(r.bankAccountId), {
|
|
122
122
|
ok: !0,
|
|
123
|
-
counterpartBankAccountId:
|
|
123
|
+
counterpartBankAccountId: r.bankAccountId
|
|
124
124
|
};
|
|
125
|
-
let
|
|
126
|
-
path: { counterpart_id:
|
|
127
|
-
body:
|
|
125
|
+
let i = await q.mutateAsync({
|
|
126
|
+
path: { counterpart_id: _ },
|
|
127
|
+
body: n(e, { isDefaultForCurrency: r.isDefaultForCurrency })
|
|
128
128
|
});
|
|
129
|
-
return z(
|
|
129
|
+
return z(i?.id), {
|
|
130
130
|
ok: !0,
|
|
131
|
-
counterpartBankAccountId:
|
|
131
|
+
counterpartBankAccountId: i?.id
|
|
132
132
|
};
|
|
133
133
|
}, [
|
|
134
134
|
X,
|
|
135
|
-
|
|
135
|
+
_,
|
|
136
136
|
q,
|
|
137
137
|
K.bankAccounts,
|
|
138
138
|
K.isBankAccountsError,
|
|
@@ -140,29 +140,29 @@ function _({ payableId: _, counterpartId: v, payableCounterpartId: y, payableCou
|
|
|
140
140
|
K.isBankAccountsLoading,
|
|
141
141
|
R,
|
|
142
142
|
Z,
|
|
143
|
-
b,
|
|
144
143
|
y,
|
|
144
|
+
v,
|
|
145
145
|
J
|
|
146
|
-
]), he =
|
|
147
|
-
name:
|
|
148
|
-
email:
|
|
146
|
+
]), he = d(() => (G.data?.data ?? []).map((e) => ({
|
|
147
|
+
name: a(e),
|
|
148
|
+
email: i(e),
|
|
149
149
|
onSelect: () => U(e.id)
|
|
150
|
-
})), [G.data, U]), ge =
|
|
151
|
-
|
|
152
|
-
}, []), _e =
|
|
153
|
-
|
|
150
|
+
})), [G.data, U]), ge = d(() => se(x), [x]), $ = l(() => {
|
|
151
|
+
O(void 0), P(!1);
|
|
152
|
+
}, []), _e = l((e) => {
|
|
153
|
+
O(void 0), P(!1), U(e);
|
|
154
154
|
}, [U]);
|
|
155
|
-
if (
|
|
155
|
+
if (D) return {
|
|
156
156
|
mode: "creating",
|
|
157
|
-
newVendorForm: /* @__PURE__ */ ce
|
|
158
|
-
mode:
|
|
159
|
-
counterpart:
|
|
160
|
-
primaryAddress:
|
|
161
|
-
bankAccounts:
|
|
162
|
-
isBankAccountsLoading:
|
|
163
|
-
isBankAccountsError:
|
|
164
|
-
initialName:
|
|
165
|
-
initialValues:
|
|
157
|
+
newVendorForm: /* @__PURE__ */ le(ce, {
|
|
158
|
+
mode: D,
|
|
159
|
+
counterpart: D === "edit" ? K.counterpart : void 0,
|
|
160
|
+
primaryAddress: D === "edit" ? K.primaryAddress : void 0,
|
|
161
|
+
bankAccounts: D === "edit" ? K.bankAccounts : void 0,
|
|
162
|
+
isBankAccountsLoading: D === "edit" ? K.isBankAccountsLoading : void 0,
|
|
163
|
+
isBankAccountsError: D === "edit" ? K.isBankAccountsError : void 0,
|
|
164
|
+
initialName: D === "create" ? C : void 0,
|
|
165
|
+
initialValues: D === "create" ? ge : void 0,
|
|
166
166
|
onSaved: _e,
|
|
167
167
|
onCancel: $,
|
|
168
168
|
onDirtyChange: P
|
|
@@ -175,21 +175,21 @@ function _({ payableId: _, counterpartId: v, payableCounterpartId: y, payableCou
|
|
|
175
175
|
return {
|
|
176
176
|
mode: "resolved",
|
|
177
177
|
summary: Y,
|
|
178
|
-
onEdit: e ? void 0 : () =>
|
|
178
|
+
onEdit: e ? void 0 : () => O("edit"),
|
|
179
179
|
onClear: () => U(void 0),
|
|
180
180
|
paymentInstructions: e ? void 0 : {
|
|
181
|
-
isOpen:
|
|
182
|
-
values:
|
|
181
|
+
isOpen: pe,
|
|
182
|
+
values: A,
|
|
183
183
|
errors: I,
|
|
184
184
|
onOpen: () => {
|
|
185
|
-
|
|
185
|
+
k(!0), X && (j({
|
|
186
186
|
accountHolderName: X.account_holder_name ?? "",
|
|
187
187
|
routingNumber: X.routing_number ?? "",
|
|
188
188
|
accountNumber: X.account_number ?? ""
|
|
189
189
|
}), z(X.id));
|
|
190
190
|
},
|
|
191
191
|
onChange: (e) => {
|
|
192
|
-
|
|
192
|
+
j((t) => ({
|
|
193
193
|
...t,
|
|
194
194
|
...e
|
|
195
195
|
})), L(void 0);
|
|
@@ -201,12 +201,12 @@ function _({ payableId: _, counterpartId: v, payableCounterpartId: y, payableCou
|
|
|
201
201
|
}
|
|
202
202
|
return {
|
|
203
203
|
mode: "selecting",
|
|
204
|
-
error: G.isError ?
|
|
204
|
+
error: G.isError ? S.searchFailed : K.isError ? S.vendorDetailsFailed : de,
|
|
205
205
|
search: {
|
|
206
|
-
query:
|
|
207
|
-
onQueryChange:
|
|
206
|
+
query: C,
|
|
207
|
+
onQueryChange: w,
|
|
208
208
|
isLoading: G.isLoading,
|
|
209
|
-
onAddVendor: () =>
|
|
209
|
+
onAddVendor: () => O("create"),
|
|
210
210
|
results: he
|
|
211
211
|
},
|
|
212
212
|
savePaymentInstructions: Q,
|
|
@@ -214,4 +214,4 @@ function _({ payableId: _, counterpartId: v, payableCounterpartId: y, payableCou
|
|
|
214
214
|
};
|
|
215
215
|
}
|
|
216
216
|
//#endregion
|
|
217
|
-
export {
|
|
217
|
+
export { g as useVendorSectionProps };
|