@tesouro/embedded-components-react 0.5.286 → 0.5.288
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 +6 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index25.js +9 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index27.js +39 -22
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index28.js +102 -77
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index29.js +267 -248
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index33.js +20 -19
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index37.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index24.js +119 -88
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/index.js +11 -11
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useCounterpartForm.js +62 -55
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index.js +4 -4
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index7.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index9.js +27 -22
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/util/dist/lib/usStates.js +4 -1
- package/package.json +1 -1
|
@@ -12,9 +12,9 @@ import { validateBillCompleteness as s, validateBillTotalIsPayable as c, validat
|
|
|
12
12
|
import { useReplacePayableLineItemsMutation as f } from "../../data-access/dist/index4.js";
|
|
13
13
|
import { useCreatePayableMutation as p } from "../../data-access/dist/index8.js";
|
|
14
14
|
import { useDeletePayableFileMutation as m } from "../../data-access/dist/index9.js";
|
|
15
|
-
import { useSubmitPayableForApprovalMutation as
|
|
16
|
-
import { useUpdatePayableMutation as
|
|
17
|
-
import { useValidatePayableMutation as
|
|
15
|
+
import { useSubmitPayableForApprovalMutation as h } from "../../data-access/dist/index14.js";
|
|
16
|
+
import { useUpdatePayableMutation as g } from "../../data-access/dist/index15.js";
|
|
17
|
+
import { useValidatePayableMutation as te } from "../../data-access/dist/index16.js";
|
|
18
18
|
import "../../data-access/dist/index.js";
|
|
19
19
|
import { useCallback as _, useRef as ne, useState as v } from "react";
|
|
20
20
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index33.js
|
|
@@ -32,10 +32,10 @@ var re = "pending-vendor";
|
|
|
32
32
|
function S(e) {
|
|
33
33
|
return !!t(e)?.includes("line_items_enabled");
|
|
34
34
|
}
|
|
35
|
-
function
|
|
35
|
+
function ie(e) {
|
|
36
36
|
return !!t(e)?.includes("A vendor could not be linked or created for this payable");
|
|
37
37
|
}
|
|
38
|
-
function
|
|
38
|
+
function C(e, t = n) {
|
|
39
39
|
let r = {}, i = {}, a = [];
|
|
40
40
|
for (let n of e) {
|
|
41
41
|
let e = n.loc[0] ?? t.unknownValidationField, o = y[e], s = b[e], c = x(n) ? t.requiredField : n.msg;
|
|
@@ -46,7 +46,7 @@ function w(e, t = n) {
|
|
|
46
46
|
totalsErrors: Object.keys(i).length ? i : void 0
|
|
47
47
|
};
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function ae(e, t) {
|
|
50
50
|
if (!e && !t) return;
|
|
51
51
|
let n = {}, r = /* @__PURE__ */ new Set([...Object.keys(e ?? {}), ...Object.keys(t ?? {})]);
|
|
52
52
|
for (let i of r) n[i] = {
|
|
@@ -55,11 +55,11 @@ function ie(e, t) {
|
|
|
55
55
|
};
|
|
56
56
|
return n;
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function w({ payableId: t, form: y, counterpartId: b, isVendorPending: x, onVendorIncomplete: w, clearCounterpart: T, prepareVendorForSave: E, onSaved: D, onPayableCreated: O, readSavedStatus: k, onDraftSaved: A, onFinalized: j, labels: M }) {
|
|
59
59
|
let N = {
|
|
60
60
|
...n,
|
|
61
61
|
...M
|
|
62
|
-
}, [P, F] = v(), I = t ?? P, [L, R] = v(),
|
|
62
|
+
}, [P, F] = v(), I = t ?? P, [L, R] = v(), oe = _(() => R(void 0), []), [z, B] = v(!1), se = _(() => B(!0), []), [V, H] = v(), U = ne(!1), [ce, le] = v(0), W = _(() => le((e) => e + 1), []), G = p(), K = m(), q = g(), J = f(), Y = te(), X = h(), Z = _(() => y.isTotalsDirty ? l(y.discount, y.tax, y.totalOverride, N) : void 0, [y, N]), Q = _(() => {
|
|
63
63
|
let t = u(y.values, N), n = d(y.lineItems, N), r = Z();
|
|
64
64
|
return y.setErrors(t), y.setLineItemErrors(n), y.setTotalsErrors(r), !t && !n && !r || (n && e.error(N.lineItemsNeedAttention), W(), !1);
|
|
65
65
|
}, [
|
|
@@ -127,7 +127,7 @@ function T({ payableId: t, form: y, counterpartId: b, isVendorPending: x, clearC
|
|
|
127
127
|
J,
|
|
128
128
|
L,
|
|
129
129
|
q
|
|
130
|
-
]),
|
|
130
|
+
]), ue = _(async () => {
|
|
131
131
|
I && (await K.mutateAsync({ path: { payable_id: I } }), B(!1));
|
|
132
132
|
}, [K, I]);
|
|
133
133
|
return {
|
|
@@ -135,7 +135,7 @@ function T({ payableId: t, form: y, counterpartId: b, isVendorPending: x, clearC
|
|
|
135
135
|
if (!U.current && Q()) {
|
|
136
136
|
U.current = !0, H("draft");
|
|
137
137
|
try {
|
|
138
|
-
let t = await E?.();
|
|
138
|
+
let t = await E?.({ allowIncompleteVendor: !0 });
|
|
139
139
|
if (t && !t.ok) return;
|
|
140
140
|
let n = await $(t?.counterpartBankAccountId, t?.counterpartId);
|
|
141
141
|
y.setErrors(void 0), D?.(n), A?.(n);
|
|
@@ -168,14 +168,14 @@ function T({ payableId: t, form: y, counterpartId: b, isVendorPending: x, clearC
|
|
|
168
168
|
...a,
|
|
169
169
|
...i,
|
|
170
170
|
...r
|
|
171
|
-
} : void 0, { formErrors: l, lineItemErrors: f } = s(y.values, b ?? (x ? re : void 0), y.lineItems, N), p =
|
|
171
|
+
} : void 0, { formErrors: l, lineItemErrors: f } = s(y.values, b ?? (x ? re : void 0), y.lineItems, N), p = ae(f, t);
|
|
172
172
|
y.setLineItemErrors(p), y.setTotalsErrors(o);
|
|
173
173
|
let m = {
|
|
174
174
|
...l,
|
|
175
175
|
...n
|
|
176
176
|
};
|
|
177
177
|
if (y.setErrors(Object.keys(m).length ? m : void 0), t && e.error(N.lineItemsNeedAttention), p || o || Object.keys(m).length) {
|
|
178
|
-
W();
|
|
178
|
+
m.vendor && w?.(), W();
|
|
179
179
|
return;
|
|
180
180
|
}
|
|
181
181
|
U.current = !0, H("finalize");
|
|
@@ -193,13 +193,13 @@ function T({ payableId: t, form: y, counterpartId: b, isVendorPending: x, clearC
|
|
|
193
193
|
try {
|
|
194
194
|
let n = await Y.mutateAsync({ path: { payable_id: t } });
|
|
195
195
|
if (n.validation_errors.length) {
|
|
196
|
-
let e =
|
|
196
|
+
let e = C(n.validation_errors, N);
|
|
197
197
|
y.setErrors(e.formErrors), y.setTotalsErrors(e.totalsErrors), W();
|
|
198
198
|
return;
|
|
199
199
|
}
|
|
200
200
|
await X.mutateAsync({ path: { payable_id: t } }), y.setErrors(void 0), j?.(t), e.success(N.billFinalized);
|
|
201
201
|
} catch (e) {
|
|
202
|
-
|
|
202
|
+
ie(e) ? y.setErrors({ vendor: N.vendorResolutionFailed }) : y.setSaveFailureMessage(N.finalizeFailed), W();
|
|
203
203
|
}
|
|
204
204
|
} finally {
|
|
205
205
|
H(void 0), U.current = !1;
|
|
@@ -211,6 +211,7 @@ function T({ payableId: t, form: y, counterpartId: b, isVendorPending: x, clearC
|
|
|
211
211
|
N,
|
|
212
212
|
j,
|
|
213
213
|
D,
|
|
214
|
+
w,
|
|
214
215
|
E,
|
|
215
216
|
$,
|
|
216
217
|
W,
|
|
@@ -223,14 +224,14 @@ function T({ payableId: t, form: y, counterpartId: b, isVendorPending: x, clearC
|
|
|
223
224
|
isFinalizing: V === "finalize",
|
|
224
225
|
stagedFile: L,
|
|
225
226
|
stageFile: R,
|
|
226
|
-
clearStagedFile:
|
|
227
|
-
scrollToErrorToken:
|
|
227
|
+
clearStagedFile: oe,
|
|
228
|
+
scrollToErrorToken: ce,
|
|
228
229
|
isFileDeletionPending: z,
|
|
229
|
-
requestFileDeletion:
|
|
230
|
-
detachFileNow:
|
|
230
|
+
requestFileDeletion: se,
|
|
231
|
+
detachFileNow: ue,
|
|
231
232
|
isDeletingFile: K.isPending,
|
|
232
233
|
hasFileDeletionFailed: K.isError
|
|
233
234
|
};
|
|
234
235
|
}
|
|
235
236
|
//#endregion
|
|
236
|
-
export {
|
|
237
|
+
export { C as mapValidationErrorsToForm, w as useBillCreateController };
|
|
@@ -219,6 +219,7 @@ function Ye({ open: Ye, onOpenChange: f, payableId: Xe, initialCounterpartId: Ze
|
|
|
219
219
|
labels: kt,
|
|
220
220
|
counterpartId: rt,
|
|
221
221
|
isVendorPending: F.mode === "creating" || F.isPendingVendor,
|
|
222
|
+
onVendorIncomplete: F.revealIncompleteVendor,
|
|
222
223
|
clearCounterpart: wt,
|
|
223
224
|
prepareVendorForSave: F.prepareVendorForSave,
|
|
224
225
|
onPayableCreated: pt,
|
package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index24.js
CHANGED
|
@@ -1,96 +1,127 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { mergeVendorSearchComboboxLabels as
|
|
3
|
-
import { useId as
|
|
4
|
-
import { jsx as
|
|
5
|
-
import { ChevronDown as
|
|
1
|
+
import { Badge as e, Command as t, CommandGroup as n, CommandInput as r, CommandItem as i, CommandList as a, CommandSeparator as o, FieldDescription as s, FieldRequirement as c, Label as l, Popover as u, PopoverContent as d, PopoverTrigger as f, Skeleton as p, cn as m } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
+
import { mergeVendorSearchComboboxLabels as h } from "./index23.js";
|
|
3
|
+
import { useId as g, useState as _ } from "react";
|
|
4
|
+
import { jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
5
|
+
import { ChevronDown as b, Plus as x } from "lucide-react";
|
|
6
6
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index24.js
|
|
7
|
-
var
|
|
8
|
-
function
|
|
9
|
-
let
|
|
10
|
-
return /* @__PURE__ */
|
|
7
|
+
var S = 5, C = "ttw:min-h-44";
|
|
8
|
+
function w({ query: w, onQueryChange: T, results: E, isLoading: D, onAddVendor: O, selectedLabel: k, badge: A, helperText: j, resultsHeading: M, addVendorDescription: N, testId: P, labels: F }) {
|
|
9
|
+
let I = h(F), L = g(), R = g(), [z, B] = _(!1);
|
|
10
|
+
return /* @__PURE__ */ y("div", {
|
|
11
11
|
className: "ttw:flex ttw:flex-col ttw:gap-1.5",
|
|
12
|
-
"data-testid":
|
|
13
|
-
children: [
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"aria-hidden": !0,
|
|
35
|
-
className: "ttw:size-4 ttw:shrink-0 ttw:opacity-50"
|
|
36
|
-
})]
|
|
37
|
-
})
|
|
38
|
-
}), /* @__PURE__ */ g(l, {
|
|
39
|
-
align: "start",
|
|
40
|
-
className: "ttw:w-[var(--radix-popover-trigger-width)] ttw:p-0",
|
|
41
|
-
children: /* @__PURE__ */ _(e, {
|
|
42
|
-
shouldFilter: !1,
|
|
43
|
-
children: [/* @__PURE__ */ g(n, {
|
|
44
|
-
value: S,
|
|
45
|
-
onValueChange: C,
|
|
46
|
-
placeholder: k.placeholder,
|
|
47
|
-
"aria-label": k.placeholder
|
|
48
|
-
}), /* @__PURE__ */ _(i, {
|
|
49
|
-
className: f("ttw:max-h-72", x),
|
|
12
|
+
"data-testid": P,
|
|
13
|
+
children: [
|
|
14
|
+
/* @__PURE__ */ v(l, {
|
|
15
|
+
htmlFor: L,
|
|
16
|
+
requirement: c.Required,
|
|
17
|
+
labels: I.fieldMarkers,
|
|
18
|
+
children: I.fieldLabel
|
|
19
|
+
}),
|
|
20
|
+
/* @__PURE__ */ y(u, {
|
|
21
|
+
modal: !0,
|
|
22
|
+
open: z,
|
|
23
|
+
onOpenChange: B,
|
|
24
|
+
children: [/* @__PURE__ */ v(f, {
|
|
25
|
+
asChild: !0,
|
|
26
|
+
children: /* @__PURE__ */ y("button", {
|
|
27
|
+
type: "button",
|
|
28
|
+
id: L,
|
|
29
|
+
role: "combobox",
|
|
30
|
+
"aria-expanded": z,
|
|
31
|
+
"aria-required": !0,
|
|
32
|
+
"aria-describedby": j ? R : void 0,
|
|
33
|
+
className: "ttw:flex ttw:h-10 ttw:w-full ttw:items-center ttw:justify-between ttw:gap-2 ttw:rounded-md ttw:border ttw:border-border ttw:bg-background ttw:px-3 ttw:text-left ttw:text-sm ttw:shadow-xs ttw:outline-none ttw:focus-visible:border-ring ttw:focus-visible:ring-[3px] ttw:focus-visible:ring-ring/50",
|
|
50
34
|
children: [
|
|
51
|
-
|
|
52
|
-
className: "ttw:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}), /* @__PURE__ */ g(d, {
|
|
63
|
-
height: 14,
|
|
64
|
-
width: "30%"
|
|
65
|
-
})]
|
|
66
|
-
}, t))]
|
|
67
|
-
}) : w.length === 0 ? /* @__PURE__ */ g("div", {
|
|
68
|
-
className: f("ttw:flex ttw:items-center ttw:justify-center ttw:py-6 ttw:text-center ttw:text-sm", x),
|
|
69
|
-
children: k.emptyResults
|
|
70
|
-
}) : /* @__PURE__ */ g(t, { children: w.map((e, t) => /* @__PURE__ */ _(r, {
|
|
71
|
-
value: `${e.name} ${e.email} ${t}`,
|
|
72
|
-
onSelect: () => e.onSelect(),
|
|
73
|
-
children: [/* @__PURE__ */ g("span", {
|
|
74
|
-
className: "ttw:text-foreground",
|
|
75
|
-
children: e.name
|
|
76
|
-
}), /* @__PURE__ */ g("span", {
|
|
77
|
-
className: "ttw:ml-auto ttw:text-muted-foreground",
|
|
78
|
-
children: e.email
|
|
79
|
-
})]
|
|
80
|
-
}, `${e.name}:${e.email}:${t}`)) }),
|
|
81
|
-
/* @__PURE__ */ g(a, {}),
|
|
82
|
-
/* @__PURE__ */ _(r, {
|
|
83
|
-
value: "__add_vendor__",
|
|
84
|
-
onSelect: E,
|
|
85
|
-
className: "ttw:sticky ttw:bottom-0 ttw:bg-popover ttw:text-primary",
|
|
86
|
-
children: [/* @__PURE__ */ g(y, { className: "ttw:size-4 ttw:text-primary" }), k.addVendorAction]
|
|
35
|
+
/* @__PURE__ */ v("span", {
|
|
36
|
+
className: m("ttw:min-w-0 ttw:flex-1 ttw:truncate", k ? "ttw:text-foreground" : "ttw:text-muted-foreground"),
|
|
37
|
+
children: k || I.triggerPlaceholder
|
|
38
|
+
}),
|
|
39
|
+
A ? /* @__PURE__ */ v(e, {
|
|
40
|
+
variant: "secondary",
|
|
41
|
+
children: A
|
|
42
|
+
}) : null,
|
|
43
|
+
/* @__PURE__ */ v(b, {
|
|
44
|
+
"aria-hidden": !0,
|
|
45
|
+
className: "ttw:size-4 ttw:shrink-0 ttw:opacity-50"
|
|
87
46
|
})
|
|
88
47
|
]
|
|
89
|
-
})
|
|
90
|
-
})
|
|
91
|
-
|
|
92
|
-
|
|
48
|
+
})
|
|
49
|
+
}), /* @__PURE__ */ v(d, {
|
|
50
|
+
align: "start",
|
|
51
|
+
className: "ttw:w-[var(--radix-popover-trigger-width)] ttw:p-0",
|
|
52
|
+
children: /* @__PURE__ */ y(t, {
|
|
53
|
+
shouldFilter: !1,
|
|
54
|
+
children: [/* @__PURE__ */ v(r, {
|
|
55
|
+
value: w,
|
|
56
|
+
onValueChange: T,
|
|
57
|
+
placeholder: I.placeholder,
|
|
58
|
+
"aria-label": I.placeholder
|
|
59
|
+
}), /* @__PURE__ */ y(a, {
|
|
60
|
+
className: m("ttw:max-h-72", C),
|
|
61
|
+
children: [
|
|
62
|
+
D ? /* @__PURE__ */ y("div", {
|
|
63
|
+
className: "ttw:flex ttw:flex-col ttw:gap-2 ttw:p-2",
|
|
64
|
+
"aria-busy": "true",
|
|
65
|
+
children: [/* @__PURE__ */ v("span", {
|
|
66
|
+
className: "ttw:sr-only",
|
|
67
|
+
children: I.loading
|
|
68
|
+
}), Array.from({ length: S }).map((e, t) => /* @__PURE__ */ y("div", {
|
|
69
|
+
className: "ttw:flex ttw:items-center ttw:justify-between ttw:gap-4 ttw:px-2 ttw:py-1.5",
|
|
70
|
+
children: [/* @__PURE__ */ v(p, {
|
|
71
|
+
height: 14,
|
|
72
|
+
width: "55%"
|
|
73
|
+
}), /* @__PURE__ */ v(p, {
|
|
74
|
+
height: 14,
|
|
75
|
+
width: "30%"
|
|
76
|
+
})]
|
|
77
|
+
}, t))]
|
|
78
|
+
}) : E.length === 0 ? /* @__PURE__ */ v("div", {
|
|
79
|
+
className: m("ttw:flex ttw:items-center ttw:justify-center ttw:py-6 ttw:text-center ttw:text-sm", C),
|
|
80
|
+
children: I.emptyResults
|
|
81
|
+
}) : /* @__PURE__ */ v(n, {
|
|
82
|
+
heading: M,
|
|
83
|
+
children: E.map((e, t) => /* @__PURE__ */ v(i, {
|
|
84
|
+
value: `${e.name} ${e.email} ${t}`,
|
|
85
|
+
onSelect: () => e.onSelect(),
|
|
86
|
+
children: /* @__PURE__ */ y("div", {
|
|
87
|
+
className: "ttw:flex ttw:min-w-0 ttw:flex-col",
|
|
88
|
+
children: [/* @__PURE__ */ v("span", {
|
|
89
|
+
className: "ttw:truncate ttw:text-foreground",
|
|
90
|
+
children: e.name
|
|
91
|
+
}), e.email ? /* @__PURE__ */ v("span", {
|
|
92
|
+
className: "ttw:truncate ttw:text-xs ttw:text-muted-foreground",
|
|
93
|
+
children: e.email
|
|
94
|
+
}) : null]
|
|
95
|
+
})
|
|
96
|
+
}, `${e.name}:${e.email}:${t}`))
|
|
97
|
+
}),
|
|
98
|
+
/* @__PURE__ */ v(o, {}),
|
|
99
|
+
/* @__PURE__ */ y(i, {
|
|
100
|
+
value: "__add_vendor__",
|
|
101
|
+
onSelect: O,
|
|
102
|
+
className: "ttw:sticky ttw:bottom-0 ttw:bg-popover ttw:text-primary",
|
|
103
|
+
children: [/* @__PURE__ */ v(x, { className: "ttw:size-4 ttw:text-primary" }), /* @__PURE__ */ y("div", {
|
|
104
|
+
className: "ttw:flex ttw:min-w-0 ttw:flex-col",
|
|
105
|
+
children: [/* @__PURE__ */ v("span", {
|
|
106
|
+
className: "ttw:truncate",
|
|
107
|
+
children: I.addVendorAction
|
|
108
|
+
}), N ? /* @__PURE__ */ v("span", {
|
|
109
|
+
className: "ttw:truncate ttw:text-xs ttw:text-muted-foreground",
|
|
110
|
+
children: N
|
|
111
|
+
}) : null]
|
|
112
|
+
})]
|
|
113
|
+
})
|
|
114
|
+
]
|
|
115
|
+
})]
|
|
116
|
+
})
|
|
117
|
+
})]
|
|
118
|
+
}),
|
|
119
|
+
j ? /* @__PURE__ */ v(s, {
|
|
120
|
+
id: R,
|
|
121
|
+
children: j
|
|
122
|
+
}) : null
|
|
123
|
+
]
|
|
93
124
|
});
|
|
94
125
|
}
|
|
95
126
|
//#endregion
|
|
96
|
-
export {
|
|
127
|
+
export { w as VendorSearchCombobox, w as default };
|
|
@@ -5,18 +5,18 @@ import { BankAccountFormSheet as r } from "../../ui/dist/index11.js";
|
|
|
5
5
|
import { ConfirmDeleteDialog as i } from "../../ui/dist/index14.js";
|
|
6
6
|
import "../../ui/dist/index.js";
|
|
7
7
|
import { COUNTERPART_MESSAGE_LABELS_EN as a } from "./lib/labels.js";
|
|
8
|
-
import { buildAnalyticsMap as o, buildCounterpartRows as s, counterpartFormBankAccountToCreatePayload as c, counterpartFormBankAccountToUpdatePayload as l,
|
|
9
|
-
import { useCounterpartQuery as
|
|
10
|
-
import { useCreateCounterpartBankAccountMutation as
|
|
11
|
-
import { useCounterpartAddressesForRowsQuery as
|
|
8
|
+
import { buildAnalyticsMap as o, buildCounterpartRows as s, counterpartFormBankAccountToCreatePayload as c, counterpartFormBankAccountToUpdatePayload as l, emptyCounterpartFormValues as u, formatCounterpartDate as d, formatMoney as f, getAchInstructions as p, getCounterpartEmail as m, getCounterpartName as h, getPayableAchInstructions as g, hasCounterpartFormErrors as _, hasSelectedText as v, isAchCompatibleBankAccount as y, resolveCounterpartBankAccountWrite as b, validateAchFormValues as x, validateCounterpartForm as S } from "./lib/helpers.js";
|
|
9
|
+
import { useCounterpartQuery as C, useCounterpartsByIdsQuery as w, useCounterpartsQuery as T, useCreateCounterpartMutation as E } from "../../data-access/dist/index3.js";
|
|
10
|
+
import { useCreateCounterpartBankAccountMutation as D, useUpdateCounterpartBankAccountMutation as O } from "../../data-access/dist/index5.js";
|
|
11
|
+
import { useCounterpartAddressesForRowsQuery as k, useCounterpartAddressesQuery as A } from "../../data-access/dist/index7.js";
|
|
12
12
|
import "../../data-access/dist/index.js";
|
|
13
|
-
import { useAddressForm as
|
|
14
|
-
import { useCounterpartDetails as
|
|
15
|
-
import { usePayableAchInstructions as
|
|
16
|
-
import { useCounterpartForm as
|
|
13
|
+
import { useAddressForm as j } from "./lib/useAddressForm.js";
|
|
14
|
+
import { useCounterpartDetails as M } from "./lib/useCounterpartDetails.js";
|
|
15
|
+
import { usePayableAchInstructions as N } from "./lib/usePayableAchInstructions.js";
|
|
16
|
+
import { useCounterpartForm as P } from "./lib/useCounterpartForm.js";
|
|
17
17
|
import "./lib/useCounterpartSelector.js";
|
|
18
18
|
import "./lib/CounterpartSelector.js";
|
|
19
|
-
import { useDeleteController as
|
|
19
|
+
import { useDeleteController as F } from "./lib/useDeleteController.js";
|
|
20
20
|
import "./lib/useSubEntityForm.js";
|
|
21
|
-
import { useBankAccountForm as
|
|
22
|
-
export { r as BankAccountFormSheet, a as COUNTERPART_MESSAGE_LABELS_EN, i as ConfirmDeleteDialog, e as CounterpartFormFields, t as CounterpartFormSheet, o as buildAnalyticsMap, s as buildCounterpartRows, c as counterpartFormBankAccountToCreatePayload, l as counterpartFormBankAccountToUpdatePayload, u as
|
|
21
|
+
import { useBankAccountForm as I } from "./lib/subEntityForms.js";
|
|
22
|
+
export { r as BankAccountFormSheet, a as COUNTERPART_MESSAGE_LABELS_EN, i as ConfirmDeleteDialog, e as CounterpartFormFields, t as CounterpartFormSheet, o as buildAnalyticsMap, s as buildCounterpartRows, c as counterpartFormBankAccountToCreatePayload, l as counterpartFormBankAccountToUpdatePayload, u as emptyCounterpartFormValues, d as formatCounterpartDate, f as formatMoney, p as getAchInstructions, m as getCounterpartEmail, h as getCounterpartName, g as getPayableAchInstructions, _ as hasCounterpartFormErrors, v as hasSelectedText, y as isAchCompatibleBankAccount, b as resolveCounterpartBankAccountWrite, j as useAddressForm, I as useBankAccountForm, k as useCounterpartAddressesForRowsQuery, A as useCounterpartAddressesQuery, M as useCounterpartDetails, P as useCounterpartForm, C as useCounterpartQuery, w as useCounterpartsByIdsQuery, T as useCounterpartsQuery, D as useCreateCounterpartBankAccountMutation, E as useCreateCounterpartMutation, F as useDeleteController, n as useFocusFirstInvalidField, N as usePayableAchInstructions, O as useUpdateCounterpartBankAccountMutation, x as validateAchFormValues, S as validateCounterpartForm };
|
|
@@ -3,31 +3,31 @@
|
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
5
|
import { extractApiErrorMessage as e } from "../../../../util/dist/lib/apiErrors.js";
|
|
6
|
-
import { addressFormToCreatePayload as t, addressFormToUpdatePayload as n, addressResponseToFormValues as r, counterpartFormBankAccountToCreatePayload as i, counterpartFormBankAccountToUpdatePayload as
|
|
7
|
-
import { useCreateCounterpartMutation as
|
|
8
|
-
import { useCreateCounterpartBankAccountMutation as
|
|
9
|
-
import { useCreateCounterpartAddressMutation as
|
|
6
|
+
import { addressFormToCreatePayload as t, addressFormToUpdatePayload as n, addressResponseToFormValues as r, counterpartFormBankAccountToCreatePayload as i, counterpartFormBankAccountToUpdatePayload as a, counterpartFormToCreatePayload as o, counterpartFormToUpdatePayload as s, counterpartToFormValues as c, emptyCounterpartFormValues as l, getAchInstructions as u, hasCounterpartFormAddressValues as d, hasCounterpartFormBankAccountValues as f, hasCounterpartFormErrors as p, resolveCounterpartBankAccountWrite as m, validateCounterpartForm as h } from "./helpers.js";
|
|
7
|
+
import { useCreateCounterpartMutation as g, useUpdateCounterpartMutation as ee } from "../../../data-access/dist/index3.js";
|
|
8
|
+
import { useCreateCounterpartBankAccountMutation as te, useUpdateCounterpartBankAccountMutation as _ } from "../../../data-access/dist/index5.js";
|
|
9
|
+
import { useCreateCounterpartAddressMutation as v, useUpdateCounterpartAddressMutation as y } from "../../../data-access/dist/index7.js";
|
|
10
10
|
import "../../../data-access/dist/index.js";
|
|
11
|
-
import { useCallback as
|
|
11
|
+
import { useCallback as b, useState as x } from "react";
|
|
12
12
|
//#region ../../libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useCounterpartForm.js
|
|
13
|
-
function
|
|
14
|
-
if (!t) return
|
|
13
|
+
function S(e, t) {
|
|
14
|
+
if (!t) return d(e);
|
|
15
15
|
let n = r(t);
|
|
16
16
|
return e.address.line1.trim() !== n.line1.trim() || e.address.line2.trim() !== n.line2.trim() || e.address.city.trim() !== n.city.trim() || e.address.state.trim() !== n.state.trim() || e.address.postalCode.trim() !== n.postalCode.trim();
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function C(e) {
|
|
19
19
|
return {
|
|
20
20
|
accountHolderName: e.account_holder_name ?? "",
|
|
21
21
|
routingNumber: e.routing_number ?? "",
|
|
22
22
|
accountNumber: e.account_number ?? ""
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
function
|
|
26
|
-
if (!t) return
|
|
27
|
-
let n =
|
|
25
|
+
function w(e, t) {
|
|
26
|
+
if (!t) return f(e);
|
|
27
|
+
let n = C(t);
|
|
28
28
|
return e.bankAccount.accountHolderName.trim() !== n.accountHolderName.trim() || e.bankAccount.routingNumber.trim() !== n.routingNumber.trim() || e.bankAccount.accountNumber.trim() !== n.accountNumber.trim();
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function T(e, t) {
|
|
31
31
|
let n = { ...e };
|
|
32
32
|
if ([
|
|
33
33
|
"legalName",
|
|
@@ -48,30 +48,30 @@ function te(e, t) {
|
|
|
48
48
|
r[e] && !t.bankAccount?.[e] && delete r[e];
|
|
49
49
|
}), n.bankAccount = Object.keys(r).length ? r : void 0;
|
|
50
50
|
}
|
|
51
|
-
return n;
|
|
51
|
+
return JSON.stringify(n) === JSON.stringify(e) ? e : n;
|
|
52
52
|
}
|
|
53
53
|
function E({ view: r, setView: E, selectedId: D, setSelectedId: O, messages: k, counterpartType: A, counterpart: j, primaryAddress: M, bankAccounts: N, isBankAccountsLoading: P, isBankAccountsError: F, includeBankAccount: I = !0 }) {
|
|
54
|
-
let L = A === "vendor" && I, R =
|
|
54
|
+
let L = A === "vendor" && I, R = g(), z = v(), B = te(), V = ee(), H = y(), U = _(), [W, G] = x(() => l()), [K, q] = x({}), [J, Y] = x({
|
|
55
55
|
address: !1,
|
|
56
56
|
bankAccount: !1
|
|
57
|
-
}), [X, Z] =
|
|
57
|
+
}), [X, Z] = x(), [Q, $] = x(), ne = R.isPending || z.isPending || B.isPending || U.isPending || V.isPending || H.isPending, re = b(() => {
|
|
58
58
|
O(void 0), $(void 0), Z(void 0), Y({
|
|
59
59
|
address: A === "vendor",
|
|
60
60
|
bankAccount: !1
|
|
61
|
-
}), G(
|
|
61
|
+
}), G(l("organization", A)), q({}), E("create");
|
|
62
62
|
}, [
|
|
63
63
|
A,
|
|
64
64
|
O,
|
|
65
65
|
E
|
|
66
|
-
]), ie =
|
|
66
|
+
]), ie = b(() => {
|
|
67
67
|
if (!j || L && (P || F)) return;
|
|
68
|
-
let e = L ?
|
|
68
|
+
let e = L ? u(N) : void 0, t = c(j, M);
|
|
69
69
|
$(void 0), Z(e?.id), Y({
|
|
70
|
-
address:
|
|
70
|
+
address: d(t),
|
|
71
71
|
bankAccount: !1
|
|
72
72
|
}), G({
|
|
73
73
|
...t,
|
|
74
|
-
...e ? { bankAccount:
|
|
74
|
+
...e ? { bankAccount: C(e) } : {}
|
|
75
75
|
}), q({}), E("edit");
|
|
76
76
|
}, [
|
|
77
77
|
N,
|
|
@@ -81,87 +81,93 @@ function E({ view: r, setView: E, selectedId: D, setSelectedId: O, messages: k,
|
|
|
81
81
|
M,
|
|
82
82
|
E,
|
|
83
83
|
L
|
|
84
|
-
]), ae =
|
|
84
|
+
]), ae = b(() => {
|
|
85
85
|
E("none");
|
|
86
|
-
}, [E]), oe =
|
|
86
|
+
}, [E]), oe = b(() => {
|
|
87
87
|
Y((e) => ({
|
|
88
88
|
...e,
|
|
89
89
|
address: !0
|
|
90
90
|
}));
|
|
91
|
-
}, [])
|
|
91
|
+
}, []), se = b((e) => {
|
|
92
|
+
G((t) => {
|
|
93
|
+
let n = typeof e == "function" ? e(t) : e;
|
|
94
|
+
return q((e) => p(e) ? T(e, h(n, r === "edit" ? "edit" : "create", k, A, r === "edit" && L && !!X)) : e), n;
|
|
95
|
+
});
|
|
96
|
+
}, [
|
|
97
|
+
X,
|
|
98
|
+
A,
|
|
99
|
+
k,
|
|
100
|
+
r,
|
|
101
|
+
L
|
|
102
|
+
]), ce = b(() => {
|
|
103
|
+
G((e) => (q(h(e, r === "edit" ? "edit" : "create", k, A)), e));
|
|
104
|
+
}, [
|
|
105
|
+
A,
|
|
106
|
+
k,
|
|
107
|
+
r
|
|
108
|
+
]);
|
|
92
109
|
return {
|
|
93
110
|
values: W,
|
|
94
111
|
errors: K,
|
|
95
|
-
setValues:
|
|
96
|
-
G((t) => {
|
|
97
|
-
let n = typeof e == "function" ? e(t) : e;
|
|
98
|
-
return q((e) => f(e) ? te(e, m(n, r === "edit" ? "edit" : "create", k, A, r === "edit" && L && !!X)) : e), n;
|
|
99
|
-
});
|
|
100
|
-
}, [
|
|
101
|
-
X,
|
|
102
|
-
A,
|
|
103
|
-
k,
|
|
104
|
-
r,
|
|
105
|
-
L
|
|
106
|
-
]),
|
|
112
|
+
setValues: se,
|
|
107
113
|
isSubmitting: ne,
|
|
108
114
|
sectionsToExpand: J,
|
|
109
115
|
expandAddress: oe,
|
|
110
116
|
openCreate: re,
|
|
111
117
|
openEdit: ie,
|
|
112
118
|
close: ae,
|
|
113
|
-
submit:
|
|
114
|
-
let
|
|
115
|
-
if (
|
|
116
|
-
address: e.address || !!
|
|
117
|
-
bankAccount: e.bankAccount || !!
|
|
119
|
+
submit: b(async () => {
|
|
120
|
+
let c = r === "edit" ? "edit" : "create", l = h(W, c, k, A, c === "edit" && L && !!X);
|
|
121
|
+
if (p(l)) return q(l), Y((e) => ({
|
|
122
|
+
address: e.address || !!l.address,
|
|
123
|
+
bankAccount: e.bankAccount || !!l.bankAccount
|
|
118
124
|
})), { ok: !1 };
|
|
119
125
|
q({}), Y({
|
|
120
126
|
address: !1,
|
|
121
127
|
bankAccount: !1
|
|
122
128
|
});
|
|
123
|
-
let
|
|
129
|
+
let g = Q;
|
|
124
130
|
try {
|
|
125
131
|
if (r === "edit" && D) {
|
|
126
132
|
$(void 0), await V.mutateAsync({
|
|
127
133
|
path: { counterpart_id: D },
|
|
128
|
-
body:
|
|
134
|
+
body: s(W, A)
|
|
129
135
|
});
|
|
130
|
-
let e = M ?
|
|
136
|
+
let e = M ? S(W, M) ? H.mutateAsync({
|
|
131
137
|
path: {
|
|
132
138
|
counterpart_id: D,
|
|
133
139
|
address_id: M.id
|
|
134
140
|
},
|
|
135
141
|
body: n(W.address)
|
|
136
|
-
}) : void 0 :
|
|
142
|
+
}) : void 0 : d(W) ? z.mutateAsync({
|
|
137
143
|
path: { counterpart_id: D },
|
|
138
144
|
body: t(W.address)
|
|
139
|
-
}) : void 0, r = L &&
|
|
145
|
+
}) : void 0, r = L && w(W, u(N)) ? m(N, X) : void 0, o = r?.kind === "update" ? U.mutateAsync({
|
|
140
146
|
path: {
|
|
141
147
|
counterpart_id: D,
|
|
142
148
|
bank_account_id: r.bankAccountId
|
|
143
149
|
},
|
|
144
|
-
body:
|
|
150
|
+
body: a(W.bankAccount, { includeAchDefaults: r.includeAchDefaults })
|
|
145
151
|
}) : r?.kind === "create" ? B.mutateAsync({
|
|
146
152
|
path: { counterpart_id: D },
|
|
147
153
|
body: i(W.bankAccount, { isDefaultForCurrency: r.isDefaultForCurrency })
|
|
148
|
-
}) : void 0, [
|
|
149
|
-
if (r?.kind === "create" &&
|
|
150
|
-
if (
|
|
154
|
+
}) : void 0, [c, l] = await Promise.allSettled([e, o]);
|
|
155
|
+
if (r?.kind === "create" && l.status === "fulfilled" && Z(l.value?.id), c.status === "rejected") throw c.reason;
|
|
156
|
+
if (l.status === "rejected") throw l.reason;
|
|
151
157
|
return E("none"), {
|
|
152
158
|
ok: !0,
|
|
153
159
|
counterpartId: D
|
|
154
160
|
};
|
|
155
161
|
}
|
|
156
|
-
return
|
|
157
|
-
path: { counterpart_id:
|
|
162
|
+
return g ||= (await R.mutateAsync({ body: o(W, A) }))?.id, g && L && f(W) && ($(g), await B.mutateAsync({
|
|
163
|
+
path: { counterpart_id: g },
|
|
158
164
|
body: i(W.bankAccount)
|
|
159
|
-
})), $(void 0), E("none"),
|
|
165
|
+
})), $(void 0), E("none"), g && O(g), {
|
|
160
166
|
ok: !0,
|
|
161
|
-
counterpartId:
|
|
167
|
+
counterpartId: g
|
|
162
168
|
};
|
|
163
169
|
} catch (t) {
|
|
164
|
-
return
|
|
170
|
+
return g && ($(g), O(g)), q({ form: e(t) ?? k.genericError }), { ok: !1 };
|
|
165
171
|
}
|
|
166
172
|
}, [
|
|
167
173
|
r,
|
|
@@ -182,7 +188,8 @@ function E({ view: r, setView: E, selectedId: D, setSelectedId: O, messages: k,
|
|
|
182
188
|
E,
|
|
183
189
|
O,
|
|
184
190
|
L
|
|
185
|
-
])
|
|
191
|
+
]),
|
|
192
|
+
revealErrors: ce
|
|
186
193
|
};
|
|
187
194
|
}
|
|
188
195
|
//#endregion
|
package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index.js
CHANGED
|
@@ -3,11 +3,11 @@ import "./index3.js";
|
|
|
3
3
|
import { AchFieldGroup as r } from "./index5.js";
|
|
4
4
|
import { AddressFieldGroup as i, EMPTY_ADDRESS_FORM_VALUES as a } from "./index6.js";
|
|
5
5
|
import "./index7.js";
|
|
6
|
-
import { CounterpartFormFields as o, CounterpartFormSheet as s,
|
|
6
|
+
import { CounterpartFormFields as o, CounterpartFormSheet as s, countErrors as c, useFocusFirstInvalidField as l } from "./index9.js";
|
|
7
7
|
import "./index10.js";
|
|
8
|
-
import { BankAccountFormSheet as
|
|
8
|
+
import { BankAccountFormSheet as u } from "./index11.js";
|
|
9
9
|
import "./index12.js";
|
|
10
10
|
import "./index13.js";
|
|
11
|
-
import { ConfirmDeleteDialog as
|
|
11
|
+
import { ConfirmDeleteDialog as d } from "./index14.js";
|
|
12
12
|
import "./index15.js";
|
|
13
|
-
export { e as ACH_FIELD_GROUP_LABELS_EN, t as ADDRESS_FORM_SHEET_LABELS_EN, r as AchFieldGroup, i as AddressFieldGroup,
|
|
13
|
+
export { e as ACH_FIELD_GROUP_LABELS_EN, t as ADDRESS_FORM_SHEET_LABELS_EN, r as AchFieldGroup, i as AddressFieldGroup, u as BankAccountFormSheet, n as COUNTERPART_FORM_SHEET_LABELS_EN, d as ConfirmDeleteDialog, o as CounterpartFormFields, s as CounterpartFormSheet, a as EMPTY_ADDRESS_FORM_VALUES, c as countErrors, l as useFocusFirstInvalidField };
|