@tesouro/embedded-components-react 0.11.64 → 0.11.66
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 +14 -14
- package/dist/index.css +6 -27
- package/dist/index.d.ts +28 -40
- package/dist/lib/CounterpartsWidget.d.ts +26 -39
- package/dist/lib/CounterpartsWidgetPublic.d.ts +26 -39
- package/dist/lib/CustomersWidget.d.ts +26 -39
- package/dist/lib/OfferWidget.d.ts +1 -1
- package/dist/lib/ReceivablesWidget.d.ts +14 -4
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartDetailsContainer.js +8 -12
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartDetailsPanel.js +93 -110
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartsWidget.js +52 -52
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartDetailsActions.js +72 -107
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartDetailsSheetView.js +27 -27
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartsTable.js +112 -145
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartsWidget.js +13 -16
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/viewModels.js +3 -122
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/mocks/labels.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index2.js +44 -65
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index3.js +157 -134
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index4.js +18 -14
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index5.js +362 -55
- package/dist/libs/tesouro-embedded-components-react/offer-widget/feature/dist/lib/OfferWidget/OfferWidget.js +3 -3
- package/dist/libs/tesouro-embedded-components-react/offer-widget/feature/dist/lib/analytics/events.js +4 -4
- package/dist/libs/tesouro-embedded-components-react/offer-widget/feature/dist/lib/testIds.js +6 -6
- package/dist/libs/tesouro-embedded-components-react/offer-widget/ui/dist/index2.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/offer-widget/ui/dist/index3.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/offer-widget/ui/dist/index7.js +32 -44
- package/dist/libs/tesouro-embedded-components-react/offer-widget/ui/dist/index8.js +14 -23
- 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/helpers.js +7 -7
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/labels.js +16 -9
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useAddressForm.js +2 -66
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useDeleteController.js +48 -46
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index10.js +138 -149
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index11.js +19 -20
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index12.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index13.js +21 -27
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index2.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index3.js +0 -1
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index8.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index9.js +30 -63
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/isDisclosuresAcceptanceRequired.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index6.js +0 -211
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index7.js +0 -509
|
@@ -1,35 +1,26 @@
|
|
|
1
|
-
import { Badge as e
|
|
2
|
-
import {
|
|
3
|
-
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
1
|
+
import { Badge as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
4
3
|
// ../../libs/tesouro-embedded-components-react/offer-widget/ui/dist/index8.js
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
};
|
|
10
|
-
function o({ statusMessage: n, testId: o }) {
|
|
11
|
-
let { chipLabel: s, chipTone: c, heading: l, body: u } = n;
|
|
12
|
-
return /* @__PURE__ */ i("div", {
|
|
13
|
-
"data-testid": o,
|
|
4
|
+
function r({ statusMessage: r, testId: i }) {
|
|
5
|
+
let { chipLabel: a, chipTone: o, heading: s, body: c } = r;
|
|
6
|
+
return /* @__PURE__ */ n("div", {
|
|
7
|
+
"data-testid": i,
|
|
14
8
|
className: "ttw:flex ttw:flex-col ttw:items-start",
|
|
15
9
|
children: [
|
|
16
|
-
/* @__PURE__ */
|
|
17
|
-
|
|
18
|
-
className:
|
|
19
|
-
children:
|
|
20
|
-
"aria-hidden": "true",
|
|
21
|
-
className: "ttw:size-2 ttw:rounded-full ttw:bg-current"
|
|
22
|
-
}), s]
|
|
10
|
+
/* @__PURE__ */ t(e, {
|
|
11
|
+
tone: o,
|
|
12
|
+
className: "ttw:mb-2",
|
|
13
|
+
children: a
|
|
23
14
|
}),
|
|
24
|
-
|
|
15
|
+
s ? /* @__PURE__ */ t("p", {
|
|
25
16
|
className: "ttw:text-xl ttw:font-semibold ttw:text-primary",
|
|
26
|
-
children:
|
|
17
|
+
children: s
|
|
27
18
|
}) : null,
|
|
28
|
-
|
|
19
|
+
c.map((e) => /* @__PURE__ */ t("p", {
|
|
29
20
|
className: "ttw:mt-1 ttw:text-sm ttw:text-muted-foreground",
|
|
30
21
|
children: e
|
|
31
22
|
}, e))
|
|
32
23
|
]
|
|
33
24
|
});
|
|
34
25
|
}
|
|
35
|
-
export {
|
|
26
|
+
export { r as OfferWidgetStatus };
|
|
@@ -6,16 +6,16 @@ import { BankAccountFormSheet as r } from "../../ui/dist/index11.js";
|
|
|
6
6
|
import { ConfirmDeleteDialog as i } from "../../ui/dist/index13.js";
|
|
7
7
|
import "../../ui/dist/index.js";
|
|
8
8
|
import { COUNTERPART_MESSAGE_LABELS_EN as a } from "./lib/labels.js";
|
|
9
|
-
import {
|
|
10
|
-
import { useCounterpartQuery as
|
|
11
|
-
import { useCreateCounterpartBankAccountMutation as
|
|
12
|
-
import { useCounterpartAddressesForRowsQuery as
|
|
9
|
+
import { bankAccountToAchFormValues as o, buildAnalyticsMap as s, buildCounterpartFormTaxIdField as c, buildCounterpartRows as l, counterpartFormBankAccountToCreatePayload as u, counterpartFormBankAccountToUpdatePayload as d, counterpartToFormValues as f, emptyCounterpartFormValues as p, formatMoney as m, getAchInstructions as h, getCounterpartEmail as g, getCounterpartName as _, getPayableAchInstructions as v, hasCounterpartFormErrors as y, hasSelectedText as b, isAchCompatibleBankAccount as x, resolveCounterpartBankAccountWrite as S, validateAchFormValues as C, validateCounterpartForm as w } from "./lib/helpers.js";
|
|
10
|
+
import { useCounterpartQuery as T, useCounterpartsByIdsQuery as E, useCounterpartsQuery as D, useCreateCounterpartMutation as O } from "../../data-access/dist/index3.js";
|
|
11
|
+
import { useCreateCounterpartBankAccountMutation as k, useUpdateCounterpartBankAccountMutation as A } from "../../data-access/dist/index4.js";
|
|
12
|
+
import { useCounterpartAddressesForRowsQuery as j, useCounterpartAddressesQuery as M } from "../../data-access/dist/index5.js";
|
|
13
13
|
import "../../data-access/dist/index.js";
|
|
14
|
-
import
|
|
15
|
-
import { useCounterpartDetails as
|
|
16
|
-
import { usePayableAchInstructions as
|
|
17
|
-
import { useCounterpartForm as
|
|
18
|
-
import { useDeleteController as
|
|
14
|
+
import "./lib/useAddressForm.js";
|
|
15
|
+
import { useCounterpartDetails as N } from "./lib/useCounterpartDetails.js";
|
|
16
|
+
import { usePayableAchInstructions as P } from "./lib/usePayableAchInstructions.js";
|
|
17
|
+
import { useCounterpartForm as F } from "./lib/useCounterpartForm.js";
|
|
18
|
+
import { useDeleteController as I } from "./lib/useDeleteController.js";
|
|
19
19
|
import "./lib/useSubEntityForm.js";
|
|
20
|
-
import { useBankAccountForm as
|
|
21
|
-
export { r as BankAccountFormSheet, a as COUNTERPART_MESSAGE_LABELS_EN, i as ConfirmDeleteDialog, e as CounterpartFormFields, t as CounterpartFormSheet, o as
|
|
20
|
+
import { useBankAccountForm as L } from "./lib/subEntityForms.js";
|
|
21
|
+
export { r as BankAccountFormSheet, a as COUNTERPART_MESSAGE_LABELS_EN, i as ConfirmDeleteDialog, e as CounterpartFormFields, t as CounterpartFormSheet, o as bankAccountToAchFormValues, s as buildAnalyticsMap, c as buildCounterpartFormTaxIdField, l as buildCounterpartRows, u as counterpartFormBankAccountToCreatePayload, d as counterpartFormBankAccountToUpdatePayload, f as counterpartToFormValues, p as emptyCounterpartFormValues, m as formatMoney, h as getAchInstructions, g as getCounterpartEmail, _ as getCounterpartName, v as getPayableAchInstructions, y as hasCounterpartFormErrors, b as hasSelectedText, x as isAchCompatibleBankAccount, S as resolveCounterpartBankAccountWrite, L as useBankAccountForm, j as useCounterpartAddressesForRowsQuery, M as useCounterpartAddressesQuery, N as useCounterpartDetails, F as useCounterpartForm, T as useCounterpartQuery, E as useCounterpartsByIdsQuery, D as useCounterpartsQuery, k as useCreateCounterpartBankAccountMutation, O as useCreateCounterpartMutation, I as useDeleteController, n as useFocusFirstInvalidField, P as usePayableAchInstructions, A as useUpdateCounterpartBankAccountMutation, C as validateAchFormValues, w as validateCounterpartForm };
|
|
@@ -20,7 +20,10 @@ function o(e, t) {
|
|
|
20
20
|
return e / 10 ** a(t);
|
|
21
21
|
}
|
|
22
22
|
function s(t, n = "USD") {
|
|
23
|
-
return e(o(t, n), {
|
|
23
|
+
return e(o(t, n), {
|
|
24
|
+
currencyCode: n,
|
|
25
|
+
includeSpaceAfterCurrencySymbol: !1
|
|
26
|
+
});
|
|
24
27
|
}
|
|
25
28
|
var c = new Intl.DateTimeFormat(void 0, {
|
|
26
29
|
year: "numeric",
|
|
@@ -48,7 +51,7 @@ function p(e) {
|
|
|
48
51
|
for (let n of e ?? []) n.dimension_value && t.set(n.dimension_value, Math.round(n.metric_value));
|
|
49
52
|
return t;
|
|
50
53
|
}
|
|
51
|
-
var m = "
|
|
54
|
+
var m = "—";
|
|
52
55
|
function h({ counterparts: e, addresses: t, billedAmounts: n, dueOrOwedAmounts: r, isBilledAmountLoading: i = !1, isDueOrOwedAmountLoading: a = !1, isBilledAmountError: o = !1, isDueOrOwedAmountError: c = !1 }) {
|
|
53
56
|
return e.map((e) => {
|
|
54
57
|
let l = n?.get(e.id) ?? 0, d = r?.get(e.id) ?? 0, f = l - d, p = i || a, h = o || c, g = u(e);
|
|
@@ -382,11 +385,8 @@ function $(e) {
|
|
|
382
385
|
function ee(e) {
|
|
383
386
|
return K(e);
|
|
384
387
|
}
|
|
385
|
-
function te(
|
|
386
|
-
return G(e, t);
|
|
387
|
-
}
|
|
388
|
-
function ne() {
|
|
388
|
+
function te() {
|
|
389
389
|
let e = globalThis.getSelection?.();
|
|
390
390
|
return !!(e && e.toString().length > 0);
|
|
391
391
|
}
|
|
392
|
-
export { T as addressFormToCreatePayload, E as addressFormToUpdatePayload, w as addressResponseToFormValues, U as bankAccountToAchFormValues, p as buildAnalyticsMap, b as buildBankAccountItems, v as buildCounterpartDetailsView, N as buildCounterpartFormTaxIdField, h as buildCounterpartRows, L as counterpartFormBankAccountToCreatePayload, R as counterpartFormBankAccountToUpdatePayload, j as counterpartFormToCreatePayload, M as counterpartFormToUpdatePayload, O as counterpartToFormValues, H as emptyAchFormValues, D as emptyCounterpartFormValues, l as formatCounterpartDate, s as formatMoney, o as fromMinorUnits, x as getAchInstructions, d as getCounterpartEmail, u as getCounterpartName, S as getPayableAchInstructions, ee as hasAchFormErrors, F as hasAchFormValues, P as hasCounterpartFormAddressValues, I as hasCounterpartFormBankAccountValues, $ as hasCounterpartFormErrors,
|
|
392
|
+
export { T as addressFormToCreatePayload, E as addressFormToUpdatePayload, w as addressResponseToFormValues, U as bankAccountToAchFormValues, p as buildAnalyticsMap, b as buildBankAccountItems, v as buildCounterpartDetailsView, N as buildCounterpartFormTaxIdField, h as buildCounterpartRows, L as counterpartFormBankAccountToCreatePayload, R as counterpartFormBankAccountToUpdatePayload, j as counterpartFormToCreatePayload, M as counterpartFormToUpdatePayload, O as counterpartToFormValues, H as emptyAchFormValues, D as emptyCounterpartFormValues, l as formatCounterpartDate, s as formatMoney, o as fromMinorUnits, x as getAchInstructions, d as getCounterpartEmail, u as getCounterpartName, S as getPayableAchInstructions, ee as hasAchFormErrors, F as hasAchFormValues, P as hasCounterpartFormAddressValues, I as hasCounterpartFormBankAccountValues, $ as hasCounterpartFormErrors, te as hasSelectedText, B as isAchCompatibleBankAccount, V as resolveCounterpartBankAccountWrite, J as validateAchFormValues, Z as validateCounterpartForm, Q as withoutUnchangedContactErrors };
|
|
@@ -14,21 +14,28 @@ var e = {
|
|
|
14
14
|
accountHolderNameRequired: "Account holder name is required",
|
|
15
15
|
routingNumberInvalid: "Enter a valid 9-digit ABA routing number",
|
|
16
16
|
accountNumberInvalid: "Enter a valid account number",
|
|
17
|
-
genericError: "
|
|
18
|
-
amountsUnavailable: "
|
|
17
|
+
genericError: "Couldn't save changes. Try again.",
|
|
18
|
+
amountsUnavailable: "Couldn't load amounts.",
|
|
19
19
|
deleteTitle: "Delete {name}?",
|
|
20
|
-
deleteBankAccountTitle: "
|
|
20
|
+
deleteBankAccountTitle: "Remove payment method “{account}”?",
|
|
21
|
+
deleteBankAccountConfirm: "Remove",
|
|
21
22
|
deleteCounterpartMessage: "This record and its contacts, bank accounts, and tax ID will be permanently removed. You can't undo this action.",
|
|
22
23
|
deleteBankAccountMessage: "This removes these payment instructions from the vendor. The vendor will not be deleted. You can't undo this action.",
|
|
23
24
|
createSucceeded: "{name} has been added to the list.",
|
|
24
25
|
updateSucceeded: "{name} has been updated.",
|
|
26
|
+
customerAdded: "Customer added.",
|
|
27
|
+
vendorAdded: "Vendor added.",
|
|
28
|
+
customerUpdated: "Customer updated.",
|
|
29
|
+
vendorUpdated: "Vendor updated.",
|
|
25
30
|
addressAdded: "Address has been added.",
|
|
26
31
|
addressUpdated: "Address has been updated.",
|
|
27
|
-
bankAccountAdded: "
|
|
28
|
-
bankAccountUpdated: "
|
|
29
|
-
counterpartDeleted: "
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
bankAccountAdded: "Payment method added.",
|
|
33
|
+
bankAccountUpdated: "Payment method updated.",
|
|
34
|
+
counterpartDeleted: "Deleted.",
|
|
35
|
+
customerDeleted: "Customer deleted.",
|
|
36
|
+
vendorDeleted: "Vendor deleted.",
|
|
37
|
+
bankAccountDeleted: "Payment method removed.",
|
|
38
|
+
deleteCounterpartFailed: "Couldn't delete. Try again.",
|
|
39
|
+
deleteBankAccountFailed: "Couldn't remove payment method."
|
|
33
40
|
};
|
|
34
41
|
export { e as COUNTERPART_MESSAGE_LABELS_EN };
|
|
@@ -2,72 +2,8 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import { toast as e } from "../../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
6
|
-
import { extractApiErrorMessage as t } from "../../../../util/dist/lib/apiErrors.js";
|
|
7
5
|
import "../../../../util/dist/index.js";
|
|
8
6
|
import "../../../../ui/dist/index.js";
|
|
9
|
-
import
|
|
10
|
-
import { useCreateCounterpartAddressMutation as o, useUpdateCounterpartAddressMutation as s } from "../../../data-access/dist/index5.js";
|
|
7
|
+
import "./helpers.js";
|
|
11
8
|
import "../../../data-access/dist/index.js";
|
|
12
|
-
import
|
|
13
|
-
// ../../libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useAddressForm.js
|
|
14
|
-
function u({ selectedId: u, primaryAddress: d, messages: f }) {
|
|
15
|
-
let p = o(), m = s(), [h, g] = l(!1), [_, v] = l(() => ({
|
|
16
|
-
line1: "",
|
|
17
|
-
line2: "",
|
|
18
|
-
city: "",
|
|
19
|
-
state: "",
|
|
20
|
-
postalCode: ""
|
|
21
|
-
})), [y, b] = l({}), [x, S] = l(), C = c(() => {
|
|
22
|
-
d && (v(i(d)), b({}), S(void 0), g(!0));
|
|
23
|
-
}, [d]), w = c(() => {
|
|
24
|
-
v({
|
|
25
|
-
line1: "",
|
|
26
|
-
line2: "",
|
|
27
|
-
city: "",
|
|
28
|
-
state: "",
|
|
29
|
-
postalCode: ""
|
|
30
|
-
}), b({}), S(void 0), g(!0);
|
|
31
|
-
}, []), T = c(() => g(!1), []), E = c(async () => {
|
|
32
|
-
if (!u) return;
|
|
33
|
-
let i = a(_, f);
|
|
34
|
-
if (Object.values(i).some(Boolean)) b(i);
|
|
35
|
-
else {
|
|
36
|
-
b({});
|
|
37
|
-
try {
|
|
38
|
-
d ? (await m.mutateAsync({
|
|
39
|
-
path: {
|
|
40
|
-
counterpart_id: u,
|
|
41
|
-
address_id: d.id
|
|
42
|
-
},
|
|
43
|
-
body: r(_)
|
|
44
|
-
}), e.success(f.addressUpdated)) : (await p.mutateAsync({
|
|
45
|
-
path: { counterpart_id: u },
|
|
46
|
-
body: n(_)
|
|
47
|
-
}), e.success(f.addressAdded)), g(!1);
|
|
48
|
-
} catch (e) {
|
|
49
|
-
S(t(e) ?? f.genericError);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}, [
|
|
53
|
-
u,
|
|
54
|
-
d,
|
|
55
|
-
_,
|
|
56
|
-
f,
|
|
57
|
-
p,
|
|
58
|
-
m
|
|
59
|
-
]);
|
|
60
|
-
return {
|
|
61
|
-
open: h,
|
|
62
|
-
values: _,
|
|
63
|
-
setValues: v,
|
|
64
|
-
errors: y,
|
|
65
|
-
formError: x,
|
|
66
|
-
isPending: p.isPending || m.isPending,
|
|
67
|
-
openCreate: w,
|
|
68
|
-
openEdit: C,
|
|
69
|
-
close: T,
|
|
70
|
-
submit: E
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
export { u as useAddressForm };
|
|
9
|
+
import "react";
|
|
@@ -11,53 +11,55 @@ import { useDeleteCounterpartBankAccountMutation as r } from "../../../data-acce
|
|
|
11
11
|
import "../../../data-access/dist/index.js";
|
|
12
12
|
import { useCallback as i, useState as a } from "react";
|
|
13
13
|
// ../../libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useDeleteController.js
|
|
14
|
-
function o({ selectedId: o, setSelectedId: s, detailsView: c, messages: l }) {
|
|
15
|
-
let
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
confirm: i(async () => {
|
|
35
|
-
if (!f) return;
|
|
36
|
-
let { kind: n, id: r } = f;
|
|
37
|
-
try {
|
|
38
|
-
if (n === "counterpart") {
|
|
39
|
-
await u.mutateAsync({ path: { counterpart_id: r } }), e.success(l.counterpartDeleted), p(null), o === r && s(void 0);
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
if (!o) return;
|
|
43
|
-
n === "bankAccount" && (await d.mutateAsync({ path: {
|
|
44
|
-
counterpart_id: o,
|
|
45
|
-
bank_account_id: r
|
|
46
|
-
} }), e.success(l.bankAccountDeleted)), p(null);
|
|
47
|
-
} catch (r) {
|
|
48
|
-
e.error(t(r) ?? (n === "counterpart" ? l.deleteCounterpartFailed : l.deleteBankAccountFailed));
|
|
14
|
+
function o({ selectedId: o, setSelectedId: s, detailsView: c, messages: l, counterpartType: u }) {
|
|
15
|
+
let d = n(), f = r(), [p, m] = a(null), h = i(() => {
|
|
16
|
+
o && c && m({
|
|
17
|
+
kind: "counterpart",
|
|
18
|
+
id: o,
|
|
19
|
+
label: c.name
|
|
20
|
+
});
|
|
21
|
+
}, [o, c]), g = i(({ id: e, name: t }) => {
|
|
22
|
+
m({
|
|
23
|
+
kind: "counterpart",
|
|
24
|
+
id: e,
|
|
25
|
+
label: t
|
|
26
|
+
});
|
|
27
|
+
}, []), _ = i((e) => m(e), []), v = i(() => m(null), []), y = i(async () => {
|
|
28
|
+
if (!p) return;
|
|
29
|
+
let { kind: n, id: r } = p;
|
|
30
|
+
try {
|
|
31
|
+
if (n === "counterpart") {
|
|
32
|
+
await d.mutateAsync({ path: { counterpart_id: r } }), e.success(u === "customer" ? l.customerDeleted : u === "vendor" ? l.vendorDeleted : l.counterpartDeleted), m(null), o === r && s(void 0);
|
|
33
|
+
return;
|
|
49
34
|
}
|
|
50
|
-
|
|
51
|
-
f
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
l
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
35
|
+
if (!o) return;
|
|
36
|
+
n === "bankAccount" && (await f.mutateAsync({ path: {
|
|
37
|
+
counterpart_id: o,
|
|
38
|
+
bank_account_id: r
|
|
39
|
+
} }), e.success(l.bankAccountDeleted)), m(null);
|
|
40
|
+
} catch (r) {
|
|
41
|
+
e.error(t(r) ?? (n === "counterpart" ? l.deleteCounterpartFailed : l.deleteBankAccountFailed));
|
|
42
|
+
}
|
|
43
|
+
}, [
|
|
44
|
+
p,
|
|
45
|
+
o,
|
|
46
|
+
d,
|
|
47
|
+
f,
|
|
48
|
+
s,
|
|
49
|
+
l,
|
|
50
|
+
u
|
|
51
|
+
]), b = d.isPending || f.isPending, x = p ? p.kind === "counterpart" ? l.deleteTitle.replace("{name}", () => p.label) : l.deleteBankAccountTitle.replace("{account}", () => p.label) : "", S = p?.kind === "bankAccount" ? l.deleteBankAccountConfirm : void 0;
|
|
52
|
+
return {
|
|
53
|
+
target: p,
|
|
54
|
+
requestDeleteCounterpart: h,
|
|
55
|
+
requestDeleteCounterpartById: g,
|
|
56
|
+
requestDelete: _,
|
|
57
|
+
close: v,
|
|
58
|
+
confirm: y,
|
|
59
|
+
isDeleting: b,
|
|
60
|
+
dialogTitle: x,
|
|
61
|
+
dialogMessage: p?.kind === "counterpart" ? l.deleteCounterpartMessage : l.deleteBankAccountMessage,
|
|
62
|
+
confirmLabel: S
|
|
61
63
|
};
|
|
62
64
|
}
|
|
63
65
|
export { o as useDeleteController };
|
package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index.js
CHANGED
|
@@ -2,10 +2,10 @@ import { ACH_FIELD_GROUP_LABELS_EN as e, COUNTERPART_FORM_SHEET_LABELS_EN as t }
|
|
|
2
2
|
import "./index3.js";
|
|
3
3
|
import { AchFieldGroup as n } from "./index5.js";
|
|
4
4
|
import { EMPTY_ADDRESS_FORM_VALUES as r } from "./index6.js";
|
|
5
|
-
import
|
|
5
|
+
import "./index7.js";
|
|
6
6
|
import "./index8.js";
|
|
7
|
-
import { CounterpartFormFields as
|
|
8
|
-
import { BankAccountFormSheet as
|
|
7
|
+
import { CounterpartFormFields as i, CounterpartFormSheet as a, countErrors as o, useFocusFirstInvalidField as s } from "./index10.js";
|
|
8
|
+
import { BankAccountFormSheet as c } from "./index11.js";
|
|
9
9
|
import "./index12.js";
|
|
10
|
-
import { ConfirmDeleteDialog as
|
|
11
|
-
export { e as ACH_FIELD_GROUP_LABELS_EN, n as AchFieldGroup,
|
|
10
|
+
import { ConfirmDeleteDialog as l } from "./index13.js";
|
|
11
|
+
export { e as ACH_FIELD_GROUP_LABELS_EN, n as AchFieldGroup, c as BankAccountFormSheet, t as COUNTERPART_FORM_SHEET_LABELS_EN, l as ConfirmDeleteDialog, i as CounterpartFormFields, a as CounterpartFormSheet, r as EMPTY_ADDRESS_FORM_VALUES, o as countErrors, s as useFocusFirstInvalidField };
|