@tesouro/embedded-components-react 0.4.19 → 0.4.21
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.css +11 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +23 -14
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +49 -50
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +0 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +73 -67
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +265 -259
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +71 -65
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +5 -9
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +3 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +11 -11
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +4 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index12.js +1 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index13.js +1 -6
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index16.js +3 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index17.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index29.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index30.js +142 -137
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index41.js +0 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index42.js +2 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index47.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index49.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index60.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index61.js +52 -47
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
package/dist/index.css
CHANGED
|
@@ -49,7 +49,9 @@
|
|
|
49
49
|
--ttw-color-emerald-500: oklch(69.6% 0.17 162.48);
|
|
50
50
|
--ttw-color-emerald-600: oklch(59.6% 0.145 163.225);
|
|
51
51
|
--ttw-color-emerald-700: oklch(50.8% 0.118 165.612);
|
|
52
|
+
--ttw-color-cyan-50: oklch(98.4% 0.019 200.873);
|
|
52
53
|
--ttw-color-cyan-100: oklch(95.6% 0.045 203.388);
|
|
54
|
+
--ttw-color-cyan-200: oklch(91.7% 0.08 205.041);
|
|
53
55
|
--ttw-color-cyan-700: oklch(52% 0.105 223.128);
|
|
54
56
|
--ttw-color-sky-200: oklch(90.1% 0.058 230.902);
|
|
55
57
|
--ttw-color-sky-400: oklch(74.6% 0.16 232.661);
|
|
@@ -2207,6 +2209,9 @@
|
|
|
2207
2209
|
.ttw\:border-cyan-100 {
|
|
2208
2210
|
border-color: var(--ttw-color-cyan-100);
|
|
2209
2211
|
}
|
|
2212
|
+
.ttw\:border-cyan-200 {
|
|
2213
|
+
border-color: var(--ttw-color-cyan-200);
|
|
2214
|
+
}
|
|
2210
2215
|
.ttw\:border-destructive {
|
|
2211
2216
|
border-color: var(--ttw-destructive);
|
|
2212
2217
|
}
|
|
@@ -2453,6 +2458,9 @@
|
|
|
2453
2458
|
.ttw\:bg-card {
|
|
2454
2459
|
background-color: var(--ttw-card);
|
|
2455
2460
|
}
|
|
2461
|
+
.ttw\:bg-cyan-50 {
|
|
2462
|
+
background-color: var(--ttw-color-cyan-50);
|
|
2463
|
+
}
|
|
2456
2464
|
.ttw\:bg-cyan-100 {
|
|
2457
2465
|
background-color: var(--ttw-color-cyan-100);
|
|
2458
2466
|
}
|
|
@@ -4369,6 +4377,9 @@
|
|
|
4369
4377
|
.ttw\:hover\:bg-card:hover {
|
|
4370
4378
|
background-color: var(--ttw-card);
|
|
4371
4379
|
}
|
|
4380
|
+
.ttw\:hover\:bg-cyan-50:hover {
|
|
4381
|
+
background-color: var(--ttw-color-cyan-50);
|
|
4382
|
+
}
|
|
4372
4383
|
.ttw\:hover\:bg-destructive\/10:hover {
|
|
4373
4384
|
background-color: var(--ttw-destructive);
|
|
4374
4385
|
}
|
|
@@ -6,26 +6,35 @@ import { BanIcon as n, CalendarXIcon as r, RotateCcwIcon as i, ThumbsDownIcon as
|
|
|
6
6
|
function s(n) {
|
|
7
7
|
return e(n, [t.CounterpartReadOrg]);
|
|
8
8
|
}
|
|
9
|
-
function c({ status:
|
|
10
|
-
let
|
|
11
|
-
|
|
9
|
+
function c({ status: n, scopes: r, hasWaitingRequest: i, arePendingApproversUnknown: a }) {
|
|
10
|
+
let o = e(r, [t.PayableApproveOrg]);
|
|
11
|
+
return !!(n === "approve_in_progress" && i && o && !a);
|
|
12
|
+
}
|
|
13
|
+
function l({ status: l, scopes: u, canDecideApprovalRequest: d, hasScheduledPayment: f, scheduledPaymentIntentId: p, hasWaitingRequest: m, arePendingApproversUnknown: h, labels: g }) {
|
|
14
|
+
let _ = e(u, [t.PayablePayOrg]), v = e(u, [t.BankAccountReadOrg]), y = s(u), b = e(u, [t.PaymentRailAch]), x = e(u, [t.PayableWriteOrg]), S = _, C = [];
|
|
15
|
+
l === "approve_in_progress" && d && (C.push({
|
|
12
16
|
id: "approve",
|
|
13
17
|
label: g.approve,
|
|
14
18
|
variant: "default",
|
|
15
19
|
surface: "row"
|
|
16
|
-
}),
|
|
20
|
+
}), C.push({
|
|
17
21
|
id: "reject",
|
|
18
22
|
label: g.reject,
|
|
19
23
|
variant: "ghost",
|
|
20
24
|
surface: "row"
|
|
21
|
-
})), c
|
|
25
|
+
})), c({
|
|
26
|
+
status: l,
|
|
27
|
+
scopes: u,
|
|
28
|
+
hasWaitingRequest: m,
|
|
29
|
+
arePendingApproversUnknown: h
|
|
30
|
+
}) && (C.push({
|
|
22
31
|
id: "forceApprove",
|
|
23
32
|
label: g.forceApprove,
|
|
24
33
|
variant: "ghost",
|
|
25
34
|
surface: "menu",
|
|
26
35
|
icon: o,
|
|
27
36
|
sectionHeading: g.policyOverridesHeading
|
|
28
|
-
}),
|
|
37
|
+
}), C.push({
|
|
29
38
|
id: "forceReject",
|
|
30
39
|
label: g.forceReject,
|
|
31
40
|
variant: "ghost",
|
|
@@ -33,36 +42,36 @@ function c({ status: c, scopes: l, canDecideApprovalRequest: u, hasScheduledPaym
|
|
|
33
42
|
icon: a,
|
|
34
43
|
sectionHeading: g.policyOverridesHeading
|
|
35
44
|
}));
|
|
36
|
-
let
|
|
37
|
-
return
|
|
45
|
+
let w = l === "waiting_to_be_paid" && _ && !f, T = l === "waiting_to_be_paid" && _ && v && y && b && !f;
|
|
46
|
+
return w && C.push({
|
|
38
47
|
id: "markAsPaid",
|
|
39
48
|
label: g.markAsPaid,
|
|
40
49
|
variant: "outline",
|
|
41
50
|
surface: "row"
|
|
42
|
-
}),
|
|
51
|
+
}), T && C.push({
|
|
43
52
|
id: "payBill",
|
|
44
53
|
label: g.payBill,
|
|
45
54
|
variant: "default",
|
|
46
55
|
surface: "row"
|
|
47
|
-
}),
|
|
56
|
+
}), l === "new" && x && C.push({
|
|
48
57
|
id: "cancel",
|
|
49
58
|
label: g.cancel,
|
|
50
59
|
variant: "ghost",
|
|
51
60
|
surface: "menu",
|
|
52
61
|
icon: n
|
|
53
|
-
}), (
|
|
62
|
+
}), (l === "rejected" || l === "waiting_to_be_paid" && !f) && x && C.push({
|
|
54
63
|
id: "reopen",
|
|
55
64
|
label: g.reopen,
|
|
56
65
|
variant: "ghost",
|
|
57
66
|
surface: "menu",
|
|
58
67
|
icon: i
|
|
59
|
-
}),
|
|
68
|
+
}), l === "waiting_to_be_paid" && f && p && S && C.push({
|
|
60
69
|
id: "cancelScheduledPayment",
|
|
61
70
|
label: g.cancelScheduledPayment,
|
|
62
71
|
variant: "ghost",
|
|
63
72
|
surface: "menu",
|
|
64
73
|
icon: r
|
|
65
|
-
}),
|
|
74
|
+
}), C;
|
|
66
75
|
}
|
|
67
76
|
//#endregion
|
|
68
|
-
export { s as canReadCounterpartBankAccounts,
|
|
77
|
+
export { c as canOverrideApprovalPolicy, s as canReadCounterpartBankAccounts, l as getBillDetailActions };
|
|
@@ -13,104 +13,103 @@ import { getBillDetailActions as l } from "./index18.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/index34.js
|
|
16
|
-
function f({ payableId: d, status: f, currentApprovalRequestId: m,
|
|
17
|
-
let { initResponse:
|
|
16
|
+
function f({ payableId: d, status: f, currentApprovalRequestId: m, hasWaitingRequest: _, arePendingApproversUnknown: v, hasScheduledPayment: y, scheduledPaymentIntentId: b, isScheduledPaymentUnknown: x, labels: S, isMarkAsPaidPending: C, pendingApprovers: w, onPayBillSelect: T, onMarkAsPaidSelect: E, onActionSucceeded: D }) {
|
|
17
|
+
let { initResponse: O } = t(), k = r(), A = n(), j = i(), M = a(), N = c(), P = o(), F = s(), I = C || k.isPending || A.isPending || j.isPending || M.isPending || N.isPending || P.isPending || F.isPending, [L, R] = u(), z = L && (L.id !== "cancelScheduledPayment" || L.scheduledPaymentIntentId === b) ? L : void 0, B = d && f ? l({
|
|
18
18
|
status: f,
|
|
19
|
-
scopes:
|
|
19
|
+
scopes: O?.scopes,
|
|
20
20
|
canDecideApprovalRequest: !!m,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
onError: () => e.error(C.actionError),
|
|
21
|
+
hasWaitingRequest: _,
|
|
22
|
+
arePendingApproversUnknown: v,
|
|
23
|
+
hasScheduledPayment: y || x,
|
|
24
|
+
scheduledPaymentIntentId: b,
|
|
25
|
+
labels: S
|
|
26
|
+
}) : [], V = (t) => ({
|
|
27
|
+
onError: () => e.error(S.actionError),
|
|
29
28
|
onSuccess: () => {
|
|
30
|
-
e.success(
|
|
29
|
+
e.success(S.actionSuccess[t]), D?.();
|
|
31
30
|
}
|
|
32
|
-
}),
|
|
31
|
+
}), H = {
|
|
33
32
|
reject: {
|
|
34
|
-
isPending:
|
|
35
|
-
run: (e) => m &&
|
|
33
|
+
isPending: k.isPending,
|
|
34
|
+
run: (e) => m && k.mutate({
|
|
36
35
|
path: { approval_request_id: m },
|
|
37
36
|
body: e ? { reject_reason: e } : void 0
|
|
38
|
-
},
|
|
37
|
+
}, V("reject"))
|
|
39
38
|
},
|
|
40
39
|
approve: {
|
|
41
|
-
isPending:
|
|
42
|
-
run: () => m &&
|
|
40
|
+
isPending: A.isPending,
|
|
41
|
+
run: () => m && A.mutate({ path: { approval_request_id: m } }, V("approve"))
|
|
43
42
|
},
|
|
44
43
|
cancel: {
|
|
45
|
-
isPending:
|
|
46
|
-
run: () => d &&
|
|
44
|
+
isPending: j.isPending,
|
|
45
|
+
run: () => d && j.mutate({ path: { payable_id: d } }, V("cancel"))
|
|
47
46
|
},
|
|
48
47
|
cancelScheduledPayment: {
|
|
49
|
-
isPending:
|
|
48
|
+
isPending: M.isPending,
|
|
50
49
|
run: () => {
|
|
51
|
-
let e =
|
|
52
|
-
!d || !e ||
|
|
50
|
+
let e = z?.scheduledPaymentIntentId;
|
|
51
|
+
!d || !e || M.mutate({
|
|
53
52
|
path: { payment_intent_id: e },
|
|
54
53
|
payableId: d
|
|
55
|
-
},
|
|
54
|
+
}, V("cancelScheduledPayment"));
|
|
56
55
|
}
|
|
57
56
|
},
|
|
58
57
|
reopen: {
|
|
59
|
-
isPending:
|
|
60
|
-
run: () => d &&
|
|
58
|
+
isPending: N.isPending,
|
|
59
|
+
run: () => d && N.mutate({ path: { payable_id: d } }, V("reopen"))
|
|
61
60
|
},
|
|
62
61
|
forceApprove: {
|
|
63
|
-
isPending:
|
|
64
|
-
run: () => d &&
|
|
62
|
+
isPending: P.isPending,
|
|
63
|
+
run: () => d && P.mutate({ path: { payable_id: d } }, V("forceApprove"))
|
|
65
64
|
},
|
|
66
65
|
forceReject: {
|
|
67
|
-
isPending:
|
|
68
|
-
run: () => d &&
|
|
66
|
+
isPending: F.isPending,
|
|
67
|
+
run: () => d && F.mutate({ path: { payable_id: d } }, V("forceReject"))
|
|
69
68
|
}
|
|
70
|
-
},
|
|
69
|
+
}, U = B.map((e) => ({
|
|
71
70
|
...e,
|
|
72
|
-
disabled:
|
|
73
|
-
loading: e.id === "markAsPaid" ?
|
|
71
|
+
disabled: I,
|
|
72
|
+
loading: e.id === "markAsPaid" ? C : H[e.id]?.isPending ?? !1,
|
|
74
73
|
onSelect: () => {
|
|
75
|
-
if (!(
|
|
74
|
+
if (!(I || !d)) {
|
|
76
75
|
if (e.id === "payBill") {
|
|
77
|
-
|
|
76
|
+
T();
|
|
78
77
|
return;
|
|
79
78
|
}
|
|
80
79
|
if (e.id === "markAsPaid") {
|
|
81
|
-
|
|
80
|
+
E();
|
|
82
81
|
return;
|
|
83
82
|
}
|
|
84
83
|
if (h(e.id)) {
|
|
85
|
-
|
|
84
|
+
R({
|
|
86
85
|
id: e.id,
|
|
87
|
-
scheduledPaymentIntentId:
|
|
86
|
+
scheduledPaymentIntentId: b
|
|
88
87
|
});
|
|
89
88
|
return;
|
|
90
89
|
}
|
|
91
|
-
|
|
90
|
+
H[e.id]?.run();
|
|
92
91
|
}
|
|
93
92
|
}
|
|
94
93
|
}));
|
|
95
94
|
return {
|
|
96
|
-
isActionPending:
|
|
95
|
+
isActionPending: I,
|
|
97
96
|
actions: {
|
|
98
|
-
row:
|
|
99
|
-
menu:
|
|
97
|
+
row: U.filter((e) => e.surface === "row"),
|
|
98
|
+
menu: U.filter((e) => e.surface === "menu")
|
|
100
99
|
},
|
|
101
100
|
decisionDialog: {
|
|
102
|
-
open: !!
|
|
103
|
-
copy:
|
|
104
|
-
...
|
|
105
|
-
presentation: g(
|
|
106
|
-
pendingApprovers: g(
|
|
101
|
+
open: !!z,
|
|
102
|
+
copy: z ? {
|
|
103
|
+
...S.decisionDialog[z.id],
|
|
104
|
+
presentation: g(z.id) ? p : void 0,
|
|
105
|
+
pendingApprovers: g(z.id) ? w ?? [] : void 0
|
|
107
106
|
} : void 0,
|
|
108
|
-
isPending:
|
|
107
|
+
isPending: z ? H[z.id]?.isPending ?? !1 : !1,
|
|
109
108
|
onCancel: () => {
|
|
110
|
-
|
|
109
|
+
I || R(void 0);
|
|
111
110
|
},
|
|
112
111
|
onConfirm: (e) => {
|
|
113
|
-
!
|
|
112
|
+
!z || I || (H[z.id]?.run(e), R(void 0));
|
|
114
113
|
}
|
|
115
114
|
}
|
|
116
115
|
};
|
|
@@ -2,37 +2,42 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
5
|
+
import { hasAnyScope as e } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
|
|
6
|
+
import { Scope as t } from "../../../shared/data-access/dist/lib/scopes.js";
|
|
7
|
+
import "../../../shared/data-access/dist/index.js";
|
|
8
|
+
import { useWidgetConfig as n } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
9
|
+
import "../../../shared/feature/dist/index.js";
|
|
10
|
+
import { useCounterpartsQuery as r } from "../../../shared/counterpart-management/data-access/dist/index3.js";
|
|
11
|
+
import { useCreateCounterpartBankAccountMutation as ee, useUpdateCounterpartBankAccountMutation as te } from "../../../shared/counterpart-management/data-access/dist/index5.js";
|
|
12
|
+
import { usePayableSuggestionsQuery as i } from "../../data-access/dist/index17.js";
|
|
8
13
|
import "../../data-access/dist/index.js";
|
|
9
|
-
import { maskAccountNumber as
|
|
10
|
-
import { counterpartFormBankAccountToCreatePayload as
|
|
11
|
-
import { useCounterpartDetails as
|
|
14
|
+
import { maskAccountNumber as a } from "./index21.js";
|
|
15
|
+
import { counterpartFormBankAccountToCreatePayload as ne, counterpartFormBankAccountToUpdatePayload as re, getAchInstructions as ie, getCounterpartEmail as o, getCounterpartName as s, getPayableAchInstructions as c, hasAchFormValues as l, resolveCounterpartBankAccountWrite as ae, validateAchFormValues as oe } from "../../../shared/counterpart-management/feature/dist/lib/helpers.js";
|
|
16
|
+
import { useCounterpartDetails as se } from "../../../shared/counterpart-management/feature/dist/lib/useCounterpartDetails.js";
|
|
12
17
|
import "../../../shared/counterpart-management/feature/dist/index.js";
|
|
13
|
-
import { VENDOR_SECTION_PROPS_LABELS_EN as
|
|
14
|
-
import { buildVendorPrefill as
|
|
15
|
-
import { VendorInlineForm as
|
|
16
|
-
import { useCallback as
|
|
17
|
-
import { jsx as
|
|
18
|
+
import { VENDOR_SECTION_PROPS_LABELS_EN as ce } from "./index43.js";
|
|
19
|
+
import { buildVendorPrefill as le } from "./index45.js";
|
|
20
|
+
import { VendorInlineForm as ue } from "./index46.js";
|
|
21
|
+
import { useCallback as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
|
|
22
|
+
import { jsx as de } from "react/jsx-runtime";
|
|
18
23
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js
|
|
19
|
-
var
|
|
24
|
+
var fe = 10, h = 300, g = {
|
|
20
25
|
accountHolderName: "",
|
|
21
26
|
routingNumber: "",
|
|
22
27
|
accountNumber: ""
|
|
23
28
|
};
|
|
24
|
-
function _({ payableId: _, counterpartId: v, payableCounterpartId: y, payableCounterpartBankAccountId: b,
|
|
29
|
+
function _({ payableId: _, counterpartId: v, payableCounterpartId: y, payableCounterpartBankAccountId: b, isVendorKnown: x = !0, onCounterpartChange: S, requiredError: pe, extractedVendor: C, labels: me }) {
|
|
25
30
|
let w = {
|
|
26
|
-
...
|
|
27
|
-
...
|
|
28
|
-
},
|
|
31
|
+
...ce,
|
|
32
|
+
...me
|
|
33
|
+
}, { initResponse: T } = n(), he = e(T?.scopes, [t.CounterpartReadOrg]), [E, D] = m(""), [ge, _e] = m(""), [O, k] = m(), [ve, A] = m(!1), [j, M] = m(g), N = p(j);
|
|
29
34
|
N.current = j;
|
|
30
|
-
let [
|
|
35
|
+
let [P, F] = m(!1), I = l(j) || P, [ye, L] = m(), [R, z] = m(), B = p(v), [V, be] = m(!1), H = u(() => {
|
|
31
36
|
A(!1), M(g), L(void 0), z(void 0);
|
|
32
|
-
}, []), U =
|
|
33
|
-
|
|
34
|
-
}, [
|
|
35
|
-
|
|
37
|
+
}, []), U = u((e) => {
|
|
38
|
+
be(!0), S(e);
|
|
39
|
+
}, [S]), W = i(_, { enabled: !!_ && !v && !y }).data?.suggested_counterpart?.id;
|
|
40
|
+
d(() => {
|
|
36
41
|
!V && !v && !y && W && U(W);
|
|
37
42
|
}, [
|
|
38
43
|
v,
|
|
@@ -40,40 +45,40 @@ function _({ payableId: _, counterpartId: v, payableCounterpartId: y, payableCou
|
|
|
40
45
|
V,
|
|
41
46
|
W,
|
|
42
47
|
U
|
|
43
|
-
]),
|
|
48
|
+
]), d(() => {
|
|
44
49
|
B.current !== v && (B.current = v, H());
|
|
45
|
-
}, [v, H]),
|
|
50
|
+
}, [v, H]), d(() => {
|
|
46
51
|
let e = setTimeout(() => {
|
|
47
|
-
|
|
48
|
-
},
|
|
52
|
+
_e(E.trim());
|
|
53
|
+
}, h);
|
|
49
54
|
return () => clearTimeout(e);
|
|
50
|
-
}, [
|
|
51
|
-
let G =
|
|
55
|
+
}, [E]);
|
|
56
|
+
let G = r({
|
|
52
57
|
sort: "counterpart_name",
|
|
53
58
|
order: "asc",
|
|
54
|
-
limit:
|
|
55
|
-
counterpart_name__icontains:
|
|
59
|
+
limit: fe,
|
|
60
|
+
counterpart_name__icontains: ge || void 0,
|
|
56
61
|
is_vendor: !0,
|
|
57
|
-
enabled:
|
|
58
|
-
}), K =
|
|
62
|
+
enabled: !O && !v && x && he
|
|
63
|
+
}), K = se({ selectedId: v }), q = ee(), J = te(), Y = f(() => {
|
|
59
64
|
let e = K.counterpart;
|
|
60
65
|
if (!e) return;
|
|
61
66
|
if (K.isBankAccountsLoading) return {
|
|
62
|
-
name:
|
|
63
|
-
email:
|
|
67
|
+
name: s(e),
|
|
68
|
+
email: o(e),
|
|
64
69
|
methodLabel: w.paymentMethodLoading,
|
|
65
70
|
fields: []
|
|
66
71
|
};
|
|
67
72
|
if (K.isBankAccountsError) return {
|
|
68
|
-
name:
|
|
69
|
-
email:
|
|
73
|
+
name: s(e),
|
|
74
|
+
email: o(e),
|
|
70
75
|
methodLabel: w.paymentMethodUnavailable,
|
|
71
76
|
fields: []
|
|
72
77
|
};
|
|
73
|
-
let t =
|
|
78
|
+
let t = c(K.bankAccounts);
|
|
74
79
|
return {
|
|
75
|
-
name:
|
|
76
|
-
email:
|
|
80
|
+
name: s(e),
|
|
81
|
+
email: o(e),
|
|
77
82
|
methodLabel: t ? w.achMethod : w.noMethod,
|
|
78
83
|
fields: t ? [
|
|
79
84
|
{
|
|
@@ -87,7 +92,7 @@ function _({ payableId: _, counterpartId: v, payableCounterpartId: y, payableCou
|
|
|
87
92
|
{
|
|
88
93
|
label: w.accountNumber,
|
|
89
94
|
value: t.account_number ?? "",
|
|
90
|
-
maskedValue: t.account_number ?
|
|
95
|
+
maskedValue: t.account_number ? a(t.account_number) : ""
|
|
91
96
|
}
|
|
92
97
|
] : []
|
|
93
98
|
};
|
|
@@ -97,10 +102,10 @@ function _({ payableId: _, counterpartId: v, payableCounterpartId: y, payableCou
|
|
|
97
102
|
K.isBankAccountsError,
|
|
98
103
|
K.isBankAccountsLoading,
|
|
99
104
|
w
|
|
100
|
-
]), X =
|
|
105
|
+
]), X = f(() => ie(K.bankAccounts), [K.bankAccounts]), Z = f(() => c(K.bankAccounts)?.id, [K.bankAccounts]), Q = u(async () => {
|
|
101
106
|
let e = N.current;
|
|
102
107
|
if (!v) return { ok: !0 };
|
|
103
|
-
if (!
|
|
108
|
+
if (!l(e)) return b && v === y ? {
|
|
104
109
|
ok: !0,
|
|
105
110
|
counterpartBankAccountId: b
|
|
106
111
|
} : K.isBankAccountsLoading || K.isBankAccountsFetching || K.isBankAccountsError ? { ok: !1 } : {
|
|
@@ -108,23 +113,23 @@ function _({ payableId: _, counterpartId: v, payableCounterpartId: y, payableCou
|
|
|
108
113
|
counterpartBankAccountId: Z
|
|
109
114
|
};
|
|
110
115
|
if (K.isBankAccountsLoading || K.isBankAccountsFetching || K.isBankAccountsError) return { ok: !1 };
|
|
111
|
-
let t =
|
|
116
|
+
let t = oe(e);
|
|
112
117
|
if (Object.keys(t).length > 0) return L(t), A(!0), { ok: !1 };
|
|
113
118
|
L(void 0);
|
|
114
|
-
let n =
|
|
119
|
+
let n = ae(K.bankAccounts, R ?? X?.id);
|
|
115
120
|
if (n.kind === "update") return await J.mutateAsync({
|
|
116
121
|
path: {
|
|
117
122
|
counterpart_id: v,
|
|
118
123
|
bank_account_id: n.bankAccountId
|
|
119
124
|
},
|
|
120
|
-
body:
|
|
125
|
+
body: re(e, { includeAchDefaults: n.includeAchDefaults })
|
|
121
126
|
}), z(n.bankAccountId), {
|
|
122
127
|
ok: !0,
|
|
123
128
|
counterpartBankAccountId: n.bankAccountId
|
|
124
129
|
};
|
|
125
130
|
let r = await q.mutateAsync({
|
|
126
131
|
path: { counterpart_id: v },
|
|
127
|
-
body:
|
|
132
|
+
body: ne(e, { isDefaultForCurrency: n.isDefaultForCurrency })
|
|
128
133
|
});
|
|
129
134
|
return z(r?.id), {
|
|
130
135
|
ok: !0,
|
|
@@ -143,32 +148,32 @@ function _({ payableId: _, counterpartId: v, payableCounterpartId: y, payableCou
|
|
|
143
148
|
b,
|
|
144
149
|
y,
|
|
145
150
|
J
|
|
146
|
-
]),
|
|
147
|
-
name:
|
|
148
|
-
email:
|
|
151
|
+
]), xe = f(() => (G.data?.data ?? []).map((e) => ({
|
|
152
|
+
name: s(e),
|
|
153
|
+
email: o(e),
|
|
149
154
|
onSelect: () => U(e.id)
|
|
150
|
-
})), [G.data, U]),
|
|
151
|
-
k(void 0),
|
|
152
|
-
}, []),
|
|
153
|
-
k(void 0),
|
|
155
|
+
})), [G.data, U]), Se = f(() => le(C), [C]), $ = u(() => {
|
|
156
|
+
k(void 0), F(!1);
|
|
157
|
+
}, []), Ce = u((e) => {
|
|
158
|
+
k(void 0), F(!1), U(e);
|
|
154
159
|
}, [U]);
|
|
155
160
|
if (O) return {
|
|
156
161
|
mode: "creating",
|
|
157
|
-
newVendorForm: /* @__PURE__ */
|
|
162
|
+
newVendorForm: /* @__PURE__ */ de(ue, {
|
|
158
163
|
mode: O,
|
|
159
164
|
counterpart: O === "edit" ? K.counterpart : void 0,
|
|
160
165
|
primaryAddress: O === "edit" ? K.primaryAddress : void 0,
|
|
161
166
|
bankAccounts: O === "edit" ? K.bankAccounts : void 0,
|
|
162
167
|
isBankAccountsLoading: O === "edit" ? K.isBankAccountsLoading : void 0,
|
|
163
168
|
isBankAccountsError: O === "edit" ? K.isBankAccountsError : void 0,
|
|
164
|
-
initialName: O === "create" ?
|
|
165
|
-
initialValues: O === "create" ?
|
|
166
|
-
onSaved:
|
|
169
|
+
initialName: O === "create" ? E : void 0,
|
|
170
|
+
initialValues: O === "create" ? Se : void 0,
|
|
171
|
+
onSaved: Ce,
|
|
167
172
|
onCancel: $,
|
|
168
|
-
onDirtyChange:
|
|
173
|
+
onDirtyChange: F
|
|
169
174
|
}),
|
|
170
175
|
onClear: $,
|
|
171
|
-
hasUnsavedVendorChanges:
|
|
176
|
+
hasUnsavedVendorChanges: I
|
|
172
177
|
};
|
|
173
178
|
if (Y) {
|
|
174
179
|
let e = K.isBankAccountsLoading || K.isBankAccountsFetching || K.isBankAccountsError;
|
|
@@ -178,9 +183,9 @@ function _({ payableId: _, counterpartId: v, payableCounterpartId: y, payableCou
|
|
|
178
183
|
onEdit: e ? void 0 : () => k("edit"),
|
|
179
184
|
onClear: () => U(void 0),
|
|
180
185
|
paymentInstructions: e ? void 0 : {
|
|
181
|
-
isOpen:
|
|
186
|
+
isOpen: ve,
|
|
182
187
|
values: j,
|
|
183
|
-
errors:
|
|
188
|
+
errors: ye,
|
|
184
189
|
onOpen: () => {
|
|
185
190
|
A(!0), X && (M({
|
|
186
191
|
accountHolderName: X.account_holder_name ?? "",
|
|
@@ -196,21 +201,22 @@ function _({ payableId: _, counterpartId: v, payableCounterpartId: y, payableCou
|
|
|
196
201
|
}
|
|
197
202
|
},
|
|
198
203
|
savePaymentInstructions: Q,
|
|
199
|
-
hasUnsavedVendorChanges:
|
|
204
|
+
hasUnsavedVendorChanges: I
|
|
200
205
|
};
|
|
201
206
|
}
|
|
207
|
+
let we = !x || !T || !!v && K.isLoading;
|
|
202
208
|
return {
|
|
203
209
|
mode: "selecting",
|
|
204
|
-
error: G.isError ? w.searchFailed : K.isError ? w.vendorDetailsFailed :
|
|
210
|
+
error: G.isError ? w.searchFailed : K.isError ? w.vendorDetailsFailed : pe,
|
|
205
211
|
search: {
|
|
206
|
-
query:
|
|
207
|
-
onQueryChange:
|
|
208
|
-
isLoading: G.
|
|
212
|
+
query: E,
|
|
213
|
+
onQueryChange: D,
|
|
214
|
+
isLoading: we || G.isFetching,
|
|
209
215
|
onAddVendor: () => k("create"),
|
|
210
|
-
results:
|
|
216
|
+
results: xe
|
|
211
217
|
},
|
|
212
218
|
savePaymentInstructions: Q,
|
|
213
|
-
hasUnsavedVendorChanges:
|
|
219
|
+
hasUnsavedVendorChanges: I
|
|
214
220
|
};
|
|
215
221
|
}
|
|
216
222
|
//#endregion
|