@tesouro/embedded-components-react 0.5.146 → 0.5.147
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 +22 -1
- package/dist/index.d.ts +72 -22
- package/dist/index.js +38 -36
- package/dist/lib/CounterpartsWidget.d.ts +21 -18
- package/dist/lib/CounterpartsWidget.js +1 -2
- package/dist/lib/CounterpartsWidgetPublic.d.ts +976 -0
- package/dist/lib/CounterpartsWidgetPublic.js +10 -0
- package/dist/lib/CustomersWidget.d.ts +955 -0
- package/dist/lib/CustomersWidget.js +3 -0
- package/dist/lib/ReceivablesWidget.d.ts +2 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index90.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/index4.js +98 -89
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/index7.js +114 -108
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/index8.js +40 -42
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index2.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index3.js +90 -76
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index4.js +300 -226
- package/dist/libs/tesouro-embedded-components-react/customers-widget/feature/dist/index.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/customers-widget/feature/dist/index2.js +4 -0
- package/dist/libs/tesouro-embedded-components-react/customers-widget/feature/dist/index3.js +45 -0
- package/dist/libs/tesouro-embedded-components-react/customers-widget/feature/dist/index4.js +42 -0
- package/dist/libs/tesouro-embedded-components-react/customers-widget/feature/dist/index5.js +27 -0
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/index.js +11 -12
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/helpers.js +103 -100
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/labels.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index.js +9 -9
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index13.js +4 -74
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import { useAnalyticsTrack as e } from "../../../shared/feature/dist/lib/analytics/hooks.js";
|
|
6
|
+
import "../../../shared/feature/dist/index.js";
|
|
7
|
+
import { Counterparts as t } from "../../../monite-sdk/dist/index260.js";
|
|
8
|
+
import "../../../monite-sdk/dist/index.js";
|
|
9
|
+
import { MoniteRegionProvider as n } from "../../../shared/monite-wrapper/feature/dist/lib/MoniteRegionProvider.js";
|
|
10
|
+
import "../../../shared/monite-wrapper/feature/dist/index.js";
|
|
11
|
+
import { CustomersWidgetAnalyticsEvent as r, WIDGET_NAME as i } from "./index2.js";
|
|
12
|
+
import { useEffect as a } from "react";
|
|
13
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
14
|
+
//#region ../../libs/tesouro-embedded-components-react/customers-widget/feature/dist/index3.js
|
|
15
|
+
var s = (e) => e;
|
|
16
|
+
function c({ onViewAllDocuments: n, onCreateDocument: i, pageTitleComponent: c = s }) {
|
|
17
|
+
let l = e();
|
|
18
|
+
return a(() => {
|
|
19
|
+
l(r.Mounted);
|
|
20
|
+
}, [l]), /* @__PURE__ */ o(t, {
|
|
21
|
+
type: "customer",
|
|
22
|
+
pageTitleComponent: c,
|
|
23
|
+
onCreateInvoiceForCustomer: i && ((e) => i({
|
|
24
|
+
id: e,
|
|
25
|
+
name: ""
|
|
26
|
+
})),
|
|
27
|
+
onViewCustomerInvoices: n && ((e) => n({
|
|
28
|
+
id: e,
|
|
29
|
+
name: ""
|
|
30
|
+
}))
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function l({ onViewAllDocuments: e, onCreateDocument: t, pageTitleComponent: r, ...a }) {
|
|
34
|
+
return /* @__PURE__ */ o(n, {
|
|
35
|
+
...a,
|
|
36
|
+
widgetName: i,
|
|
37
|
+
children: /* @__PURE__ */ o(c, {
|
|
38
|
+
onViewAllDocuments: e,
|
|
39
|
+
onCreateDocument: t,
|
|
40
|
+
pageTitleComponent: r
|
|
41
|
+
})
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
//#endregion
|
|
45
|
+
export { l as CustomersWidgetMonite, l as default };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import { useAnalyticsTrack as e } from "../../../shared/feature/dist/lib/analytics/hooks.js";
|
|
6
|
+
import { WidgetProvider as t } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
|
|
7
|
+
import "../../../shared/feature/dist/index.js";
|
|
8
|
+
import { CounterpartsWidget as n } from "../../../counterparts-widget/feature/dist/index8.js";
|
|
9
|
+
import "../../../counterparts-widget/feature/dist/index.js";
|
|
10
|
+
import { CustomersWidgetAnalyticsEvent as r, WIDGET_NAME as i } from "./index2.js";
|
|
11
|
+
import { useEffect as a } from "react";
|
|
12
|
+
import { Fragment as o, jsx as s } from "react/jsx-runtime";
|
|
13
|
+
//#region ../../libs/tesouro-embedded-components-react/customers-widget/feature/dist/index4.js
|
|
14
|
+
function c(t) {
|
|
15
|
+
let i = e();
|
|
16
|
+
return a(() => {
|
|
17
|
+
i(r.Mounted);
|
|
18
|
+
}, [i]), /* @__PURE__ */ s(o, { children: /* @__PURE__ */ s(n, {
|
|
19
|
+
counterpartType: "customer",
|
|
20
|
+
passThrough: !0,
|
|
21
|
+
...t
|
|
22
|
+
}) });
|
|
23
|
+
}
|
|
24
|
+
function l({ pageSizeOptions: e, onViewAllDocuments: n, onCreateDocument: r, screenLabels: a, formLabels: o, detailsLabels: l, addressLabels: u, deleteLabels: d, messageLabels: f, ...p }) {
|
|
25
|
+
return /* @__PURE__ */ s(t, {
|
|
26
|
+
...p,
|
|
27
|
+
widgetName: i,
|
|
28
|
+
children: /* @__PURE__ */ s(c, {
|
|
29
|
+
pageSizeOptions: e,
|
|
30
|
+
onViewAllDocuments: n,
|
|
31
|
+
onCreateDocument: r,
|
|
32
|
+
screenLabels: a,
|
|
33
|
+
formLabels: o,
|
|
34
|
+
detailsLabels: l,
|
|
35
|
+
addressLabels: u,
|
|
36
|
+
deleteLabels: d,
|
|
37
|
+
messageLabels: f
|
|
38
|
+
})
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { l as CustomersWidgetNative, l as default };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import { Implementation as e } from "../../../shared/feature/dist/lib/WidgetProvider/types.js";
|
|
6
|
+
import { useWidgetConfig as t } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
7
|
+
import "../../../shared/feature/dist/index.js";
|
|
8
|
+
import { CustomersWidgetMonite as n } from "./index3.js";
|
|
9
|
+
import { CustomersWidgetNative as r } from "./index4.js";
|
|
10
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
11
|
+
//#region ../../libs/tesouro-embedded-components-react/customers-widget/feature/dist/index5.js
|
|
12
|
+
function a({ implementation: a, onViewAllDocuments: o, onCreateDocument: s, ...c }) {
|
|
13
|
+
let l = t().implementation;
|
|
14
|
+
return (a ?? l) === e.Monite ? /* @__PURE__ */ i(n, {
|
|
15
|
+
...c,
|
|
16
|
+
implementation: a,
|
|
17
|
+
onViewAllDocuments: o,
|
|
18
|
+
onCreateDocument: s
|
|
19
|
+
}) : /* @__PURE__ */ i(r, {
|
|
20
|
+
...c,
|
|
21
|
+
implementation: a,
|
|
22
|
+
onViewAllDocuments: o,
|
|
23
|
+
onCreateDocument: s
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { a as CustomersWidget, a as default };
|
|
@@ -6,18 +6,17 @@ import "../../data-access/dist/index.js";
|
|
|
6
6
|
import "../../ui/dist/index5.js";
|
|
7
7
|
import { CounterpartFormFields as o, CounterpartFormSheet as s, useFocusFirstInvalidField as c } from "../../ui/dist/index9.js";
|
|
8
8
|
import { BankAccountFormSheet as l } from "../../ui/dist/index11.js";
|
|
9
|
-
import {
|
|
10
|
-
import { ConfirmDeleteDialog as d } from "../../ui/dist/index14.js";
|
|
9
|
+
import { ConfirmDeleteDialog as u } from "../../ui/dist/index14.js";
|
|
11
10
|
import "../../ui/dist/index.js";
|
|
12
|
-
import { COUNTERPART_MESSAGE_LABELS_EN as
|
|
13
|
-
import { buildAnalyticsMap as
|
|
14
|
-
import { useAddressForm as
|
|
15
|
-
import { useCounterpartDetails as
|
|
16
|
-
import { usePayableAchInstructions as
|
|
17
|
-
import { useCounterpartForm as
|
|
11
|
+
import { COUNTERPART_MESSAGE_LABELS_EN as d } from "./lib/labels.js";
|
|
12
|
+
import { buildAnalyticsMap as f, buildCounterpartRows as p, counterpartFormBankAccountToCreatePayload as m, counterpartFormBankAccountToUpdatePayload as h, formatCounterpartDate as g, formatMoney as _, getAchInstructions as v, getCounterpartEmail as y, getCounterpartName as b, getPayableAchInstructions as x, hasSelectedText as S, isAchCompatibleBankAccount as C, resolveCounterpartBankAccountWrite as w, validateAchFormValues as T } from "./lib/helpers.js";
|
|
13
|
+
import { useAddressForm as E } from "./lib/useAddressForm.js";
|
|
14
|
+
import { useCounterpartDetails as D } from "./lib/useCounterpartDetails.js";
|
|
15
|
+
import { usePayableAchInstructions as O } from "./lib/usePayableAchInstructions.js";
|
|
16
|
+
import { useCounterpartForm as k } from "./lib/useCounterpartForm.js";
|
|
18
17
|
import "./lib/useCounterpartSelector.js";
|
|
19
|
-
import { CounterpartSelector as
|
|
20
|
-
import { useDeleteController as
|
|
18
|
+
import { CounterpartSelector as A } from "./lib/CounterpartSelector.js";
|
|
19
|
+
import { useDeleteController as j } from "./lib/useDeleteController.js";
|
|
21
20
|
import "./lib/useSubEntityForm.js";
|
|
22
|
-
import { useBankAccountForm as
|
|
23
|
-
export {
|
|
21
|
+
import { useBankAccountForm as M } from "./lib/subEntityForms.js";
|
|
22
|
+
export { l as BankAccountFormSheet, d as COUNTERPART_MESSAGE_LABELS_EN, u as ConfirmDeleteDialog, o as CounterpartFormFields, s as CounterpartFormSheet, A as CounterpartSelector, f as buildAnalyticsMap, p as buildCounterpartRows, m as counterpartFormBankAccountToCreatePayload, h as counterpartFormBankAccountToUpdatePayload, g as formatCounterpartDate, _ as formatMoney, v as getAchInstructions, y as getCounterpartEmail, b as getCounterpartName, x as getPayableAchInstructions, S as hasSelectedText, C as isAchCompatibleBankAccount, w as resolveCounterpartBankAccountWrite, E as useAddressForm, M as useBankAccountForm, i as useCounterpartAddressesForRowsQuery, a as useCounterpartAddressesQuery, D as useCounterpartDetails, k as useCounterpartForm, e as useCounterpartsByIdsQuery, t as useCounterpartsQuery, n as useCreateCounterpartBankAccountMutation, j as useDeleteController, c as useFocusFirstInvalidField, O as usePayableAchInstructions, r as useUpdateCounterpartBankAccountMutation, T as validateAchFormValues };
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { formatMoneyExact as e } from "../../../../util/dist/lib/formatMoneyExact.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { getInitials as t } from "../../../../util/dist/lib/getInitials.js";
|
|
3
|
+
import { isValidAchAccountNumber as n } from "../../../../util/dist/lib/isValidAchAccountNumber.js";
|
|
4
|
+
import { EMPTY_ADDRESS_FORM_VALUES as r } from "../../../ui/dist/index6.js";
|
|
4
5
|
import "../../../ui/dist/index.js";
|
|
5
|
-
import { COUNTERPART_MESSAGE_LABELS_EN as
|
|
6
|
+
import { COUNTERPART_MESSAGE_LABELS_EN as i } from "./labels.js";
|
|
6
7
|
//#region ../../libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/helpers.js
|
|
7
|
-
var
|
|
8
|
+
var a = [
|
|
8
9
|
"USD",
|
|
9
10
|
"EUR",
|
|
10
11
|
"GBP",
|
|
@@ -18,13 +19,13 @@ var i = [
|
|
|
18
19
|
"MXN",
|
|
19
20
|
"SGD"
|
|
20
21
|
];
|
|
21
|
-
function
|
|
22
|
-
return Array.from(/* @__PURE__ */ new Set([...
|
|
22
|
+
function o(e) {
|
|
23
|
+
return Array.from(/* @__PURE__ */ new Set([...a, ...e ? [e] : []])).sort().map((e) => ({
|
|
23
24
|
value: e,
|
|
24
25
|
label: e
|
|
25
26
|
}));
|
|
26
27
|
}
|
|
27
|
-
function
|
|
28
|
+
function s(e) {
|
|
28
29
|
try {
|
|
29
30
|
return new Intl.NumberFormat("en-US", {
|
|
30
31
|
style: "currency",
|
|
@@ -34,56 +35,58 @@ function o(e) {
|
|
|
34
35
|
return 2;
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
|
-
function
|
|
38
|
-
return e / 10 **
|
|
38
|
+
function c(e, t) {
|
|
39
|
+
return e / 10 ** s(t);
|
|
39
40
|
}
|
|
40
|
-
function
|
|
41
|
-
return e(
|
|
41
|
+
function l(t, n = "USD") {
|
|
42
|
+
return e(c(t, n), { currencyCode: n });
|
|
42
43
|
}
|
|
43
|
-
var
|
|
44
|
+
var u = new Intl.DateTimeFormat(void 0, {
|
|
44
45
|
year: "numeric",
|
|
45
46
|
month: "short",
|
|
46
47
|
day: "numeric"
|
|
47
48
|
});
|
|
48
|
-
function
|
|
49
|
+
function d(e) {
|
|
49
50
|
if (!e) return "";
|
|
50
51
|
let t = new Date(e);
|
|
51
|
-
return Number.isNaN(t.getTime()) ? "" :
|
|
52
|
+
return Number.isNaN(t.getTime()) ? "" : u.format(t);
|
|
52
53
|
}
|
|
53
|
-
function
|
|
54
|
+
function f(e) {
|
|
54
55
|
if ("organization" in e) return e.organization.legal_name;
|
|
55
56
|
let { first_name: t, last_name: n } = e.individual;
|
|
56
57
|
return [t, n].filter(Boolean).join(" ").trim();
|
|
57
58
|
}
|
|
58
|
-
function
|
|
59
|
+
function p(e) {
|
|
59
60
|
return "organization" in e ? e.organization.email ?? "" : e.individual.email ?? "";
|
|
60
61
|
}
|
|
61
|
-
function
|
|
62
|
+
function m(e) {
|
|
62
63
|
return "organization" in e ? e.organization.phone ?? "" : e.individual.phone ?? "";
|
|
63
64
|
}
|
|
64
|
-
function
|
|
65
|
+
function h(e) {
|
|
65
66
|
let t = /* @__PURE__ */ new Map();
|
|
66
67
|
for (let n of e ?? []) n.dimension_value && t.set(n.dimension_value, Math.round(n.metric_value));
|
|
67
68
|
return t;
|
|
68
69
|
}
|
|
69
|
-
|
|
70
|
+
var g = "-";
|
|
71
|
+
function _({ counterparts: e, addresses: n, billedAmounts: r, dueOrOwedAmounts: i, isBilledAmountLoading: a = !1, isDueOrOwedAmountLoading: o = !1, isBilledAmountError: s = !1, isDueOrOwedAmountError: c = !1 }) {
|
|
70
72
|
return e.map((e) => {
|
|
71
|
-
let
|
|
73
|
+
let u = r?.get(e.id) ?? 0, d = i?.get(e.id) ?? 0, p = u - d, m = a || o, h = s || c, _ = f(e);
|
|
72
74
|
return {
|
|
73
75
|
id: e.id,
|
|
74
|
-
name:
|
|
76
|
+
name: _,
|
|
77
|
+
initials: t(_),
|
|
75
78
|
entityType: e.type,
|
|
76
|
-
locationLabel:
|
|
77
|
-
billedAmountLabel:
|
|
78
|
-
receivedOrPaidAmountLabel:
|
|
79
|
-
dueOrOwedAmountLabel:
|
|
80
|
-
isBilledAmountLoading:
|
|
81
|
-
isReceivedOrPaidAmountLoading:
|
|
82
|
-
isDueOrOwedAmountLoading:
|
|
79
|
+
locationLabel: y(n?.get(e.id)),
|
|
80
|
+
billedAmountLabel: s ? g : r && !a ? l(u) : "",
|
|
81
|
+
receivedOrPaidAmountLabel: h ? g : r && i && !m ? l(p) : "",
|
|
82
|
+
dueOrOwedAmountLabel: c ? g : i && !o ? l(d) : "",
|
|
83
|
+
isBilledAmountLoading: a && !s,
|
|
84
|
+
isReceivedOrPaidAmountLoading: m && !h,
|
|
85
|
+
isDueOrOwedAmountLoading: o && !c
|
|
83
86
|
};
|
|
84
87
|
});
|
|
85
88
|
}
|
|
86
|
-
function
|
|
89
|
+
function v(e) {
|
|
87
90
|
if (!e) return [];
|
|
88
91
|
let t = [
|
|
89
92
|
e.city,
|
|
@@ -97,27 +100,27 @@ function g(e) {
|
|
|
97
100
|
e.country
|
|
98
101
|
].filter((e) => !!(e && e.trim()));
|
|
99
102
|
}
|
|
100
|
-
function
|
|
101
|
-
return e ? [e.
|
|
103
|
+
function y(e) {
|
|
104
|
+
return e ? [e.country, e.city].filter(Boolean).join(" • ") : "";
|
|
102
105
|
}
|
|
103
|
-
function
|
|
106
|
+
function b({ counterpart: e, primaryAddress: t }) {
|
|
104
107
|
return {
|
|
105
|
-
name:
|
|
108
|
+
name: f(e),
|
|
106
109
|
entityType: e.type,
|
|
107
|
-
email:
|
|
108
|
-
phone:
|
|
110
|
+
email: p(e),
|
|
111
|
+
phone: m(e),
|
|
109
112
|
taxId: e.tax_id ?? "",
|
|
110
|
-
addressLines:
|
|
111
|
-
createdAtLabel:
|
|
112
|
-
updatedAtLabel:
|
|
113
|
+
addressLines: v(t),
|
|
114
|
+
createdAtLabel: d(e.created_at),
|
|
115
|
+
updatedAtLabel: d(e.updated_at)
|
|
113
116
|
};
|
|
114
117
|
}
|
|
115
|
-
function
|
|
118
|
+
function x(e) {
|
|
116
119
|
if (e) return `•••• ${e.slice(-4)}`;
|
|
117
120
|
}
|
|
118
|
-
function
|
|
121
|
+
function S(e) {
|
|
119
122
|
return (e ?? []).map((e) => {
|
|
120
|
-
let t =
|
|
123
|
+
let t = x(e.iban || e.account_number || void 0), n = [e.currency, t].filter(Boolean).join(" · ");
|
|
121
124
|
return {
|
|
122
125
|
id: e.id,
|
|
123
126
|
primary: e.name || e.account_holder_name || e.currency,
|
|
@@ -126,17 +129,17 @@ function b(e) {
|
|
|
126
129
|
};
|
|
127
130
|
});
|
|
128
131
|
}
|
|
129
|
-
function
|
|
132
|
+
function C(e) {
|
|
130
133
|
let t = (e ?? []).filter((e) => e.currency === "USD" && (!!e.routing_number || !!e.account_number));
|
|
131
134
|
return t.find((e) => e.is_default_for_currency) ?? t[0];
|
|
132
135
|
}
|
|
133
|
-
function
|
|
134
|
-
let r = n && (e ?? []).find((e) => e.id === n &&
|
|
136
|
+
function w(e, t = "USD", n) {
|
|
137
|
+
let r = n && (e ?? []).find((e) => e.id === n && V(e));
|
|
135
138
|
if (r) return r;
|
|
136
139
|
let i = (e ?? []).filter((e) => e.currency === t && !!e.account_holder_name && !!e.routing_number && !!e.account_number);
|
|
137
140
|
return i.find((e) => e.is_default_for_currency) ?? i[0];
|
|
138
141
|
}
|
|
139
|
-
function
|
|
142
|
+
function T(e, t = {}) {
|
|
140
143
|
let n = e.line2.trim();
|
|
141
144
|
return {
|
|
142
145
|
line1: e.line1.trim(),
|
|
@@ -147,7 +150,7 @@ function C(e, t = {}) {
|
|
|
147
150
|
country: "US"
|
|
148
151
|
};
|
|
149
152
|
}
|
|
150
|
-
function
|
|
153
|
+
function E(e) {
|
|
151
154
|
return {
|
|
152
155
|
line1: e.line1 ?? "",
|
|
153
156
|
line2: e.line2 ?? "",
|
|
@@ -156,10 +159,10 @@ function w(e) {
|
|
|
156
159
|
postalCode: e.postal_code ?? ""
|
|
157
160
|
};
|
|
158
161
|
}
|
|
159
|
-
function
|
|
160
|
-
return
|
|
162
|
+
function D(e) {
|
|
163
|
+
return T(e);
|
|
161
164
|
}
|
|
162
|
-
function
|
|
165
|
+
function O(e) {
|
|
163
166
|
return {
|
|
164
167
|
line1: e.line1.trim(),
|
|
165
168
|
line2: e.line2.trim(),
|
|
@@ -169,7 +172,7 @@ function E(e) {
|
|
|
169
172
|
country: "US"
|
|
170
173
|
};
|
|
171
174
|
}
|
|
172
|
-
function
|
|
175
|
+
function k(e = "organization", t) {
|
|
173
176
|
return {
|
|
174
177
|
entityType: e,
|
|
175
178
|
legalName: "",
|
|
@@ -180,7 +183,7 @@ function D(e = "organization", t) {
|
|
|
180
183
|
phone: "",
|
|
181
184
|
taxId: "",
|
|
182
185
|
remindersEnabled: t === "customer",
|
|
183
|
-
address: { ...
|
|
186
|
+
address: { ...r },
|
|
184
187
|
bankAccount: {
|
|
185
188
|
accountHolderName: "",
|
|
186
189
|
routingNumber: "",
|
|
@@ -188,11 +191,11 @@ function D(e = "organization", t) {
|
|
|
188
191
|
}
|
|
189
192
|
};
|
|
190
193
|
}
|
|
191
|
-
function
|
|
192
|
-
let n =
|
|
193
|
-
return n.email =
|
|
194
|
+
function A(e, t) {
|
|
195
|
+
let n = k(e.type);
|
|
196
|
+
return n.email = p(e), n.phone = m(e), n.taxId = e.tax_id ?? "", n.remindersEnabled = !!e.reminders_enabled, t && (n.address = E(t)), "organization" in e ? n.legalName = e.organization.legal_name : (n.firstName = e.individual.first_name, n.lastName = e.individual.last_name), n;
|
|
194
197
|
}
|
|
195
|
-
function
|
|
198
|
+
function j(e) {
|
|
196
199
|
return [
|
|
197
200
|
e.line1,
|
|
198
201
|
e.line2,
|
|
@@ -201,11 +204,11 @@ function k(e) {
|
|
|
201
204
|
e.postalCode
|
|
202
205
|
].some((e) => e.trim().length > 0);
|
|
203
206
|
}
|
|
204
|
-
function
|
|
205
|
-
return
|
|
207
|
+
function M(e) {
|
|
208
|
+
return j(e) ? T(e) : void 0;
|
|
206
209
|
}
|
|
207
|
-
function
|
|
208
|
-
let n = t === "customer", r = t === "vendor", i =
|
|
210
|
+
function N(e, t) {
|
|
211
|
+
let n = t === "customer", r = t === "vendor", i = M(e.address), a = e.taxId.trim() || void 0, o = e.email.trim(), s = e.phone.trim() || void 0, c = {
|
|
209
212
|
is_customer: n,
|
|
210
213
|
is_vendor: r,
|
|
211
214
|
language: "en",
|
|
@@ -234,7 +237,7 @@ function j(e, t) {
|
|
|
234
237
|
}
|
|
235
238
|
};
|
|
236
239
|
}
|
|
237
|
-
function
|
|
240
|
+
function P(e, t) {
|
|
238
241
|
let n = e.taxId.trim(), r = e.email.trim(), i = e.phone.trim(), a = {
|
|
239
242
|
language: "en",
|
|
240
243
|
reminders_enabled: t === "customer" ? e.remindersEnabled : void 0,
|
|
@@ -258,20 +261,20 @@ function M(e, t) {
|
|
|
258
261
|
}
|
|
259
262
|
};
|
|
260
263
|
}
|
|
261
|
-
function
|
|
262
|
-
return
|
|
264
|
+
function F(e) {
|
|
265
|
+
return j(e.address);
|
|
263
266
|
}
|
|
264
|
-
function
|
|
267
|
+
function I(e) {
|
|
265
268
|
return [
|
|
266
269
|
e.accountHolderName,
|
|
267
270
|
e.routingNumber,
|
|
268
271
|
e.accountNumber
|
|
269
272
|
].some((e) => e.trim().length > 0);
|
|
270
273
|
}
|
|
271
|
-
function
|
|
272
|
-
return
|
|
274
|
+
function L(e) {
|
|
275
|
+
return I(e.bankAccount);
|
|
273
276
|
}
|
|
274
|
-
function
|
|
277
|
+
function R(e, t = {}) {
|
|
275
278
|
return {
|
|
276
279
|
account_holder_name: e.accountHolderName.trim() || void 0,
|
|
277
280
|
account_number: e.accountNumber.trim() || void 0,
|
|
@@ -281,7 +284,7 @@ function I(e, t = {}) {
|
|
|
281
284
|
is_default_for_currency: t.isDefaultForCurrency ?? !0
|
|
282
285
|
};
|
|
283
286
|
}
|
|
284
|
-
function
|
|
287
|
+
function z(e, t = {}) {
|
|
285
288
|
return {
|
|
286
289
|
account_holder_name: e.accountHolderName.trim() || void 0,
|
|
287
290
|
account_number: e.accountNumber.trim() || void 0,
|
|
@@ -292,7 +295,7 @@ function L(e, t = {}) {
|
|
|
292
295
|
} : {}
|
|
293
296
|
};
|
|
294
297
|
}
|
|
295
|
-
function
|
|
298
|
+
function B(e) {
|
|
296
299
|
return [
|
|
297
300
|
e.account_number,
|
|
298
301
|
e.iban,
|
|
@@ -301,19 +304,19 @@ function R(e) {
|
|
|
301
304
|
e.bic
|
|
302
305
|
].every((e) => !e);
|
|
303
306
|
}
|
|
304
|
-
function
|
|
305
|
-
return !!(
|
|
307
|
+
function V(e) {
|
|
308
|
+
return !!(B(e) || e.currency === "USD" && (e.routing_number || e.account_number));
|
|
306
309
|
}
|
|
307
|
-
function
|
|
310
|
+
function H(e, t) {
|
|
308
311
|
if (t) {
|
|
309
312
|
let n = e?.find((e) => e.id === t);
|
|
310
313
|
return {
|
|
311
314
|
kind: "update",
|
|
312
315
|
bankAccountId: t,
|
|
313
|
-
includeAchDefaults: n ?
|
|
316
|
+
includeAchDefaults: n ? B(n) : !1
|
|
314
317
|
};
|
|
315
318
|
}
|
|
316
|
-
let n = e?.find(
|
|
319
|
+
let n = e?.find(B);
|
|
317
320
|
return n ? {
|
|
318
321
|
kind: "update",
|
|
319
322
|
bankAccountId: n.id,
|
|
@@ -323,7 +326,7 @@ function B(e, t) {
|
|
|
323
326
|
isDefaultForCurrency: !(e ?? []).some((e) => e.currency === "USD" && e.is_default_for_currency)
|
|
324
327
|
};
|
|
325
328
|
}
|
|
326
|
-
function
|
|
329
|
+
function U() {
|
|
327
330
|
return {
|
|
328
331
|
name: "",
|
|
329
332
|
accountHolderName: "",
|
|
@@ -336,7 +339,7 @@ function V() {
|
|
|
336
339
|
isDefault: !1
|
|
337
340
|
};
|
|
338
341
|
}
|
|
339
|
-
function
|
|
342
|
+
function W(e) {
|
|
340
343
|
return {
|
|
341
344
|
name: e.name ?? "",
|
|
342
345
|
accountHolderName: e.account_holder_name ?? "",
|
|
@@ -349,7 +352,7 @@ function H(e) {
|
|
|
349
352
|
isDefault: e.is_default_for_currency ?? !1
|
|
350
353
|
};
|
|
351
354
|
}
|
|
352
|
-
function
|
|
355
|
+
function G(e) {
|
|
353
356
|
return {
|
|
354
357
|
name: e.name.trim() || void 0,
|
|
355
358
|
account_holder_name: e.accountHolderName.trim() || void 0,
|
|
@@ -363,7 +366,7 @@ function U(e) {
|
|
|
363
366
|
is_default_for_currency: e.isDefault
|
|
364
367
|
};
|
|
365
368
|
}
|
|
366
|
-
function
|
|
369
|
+
function K(e) {
|
|
367
370
|
return {
|
|
368
371
|
name: e.name.trim(),
|
|
369
372
|
account_holder_name: e.accountHolderName.trim(),
|
|
@@ -376,54 +379,54 @@ function W(e) {
|
|
|
376
379
|
country: "US"
|
|
377
380
|
};
|
|
378
381
|
}
|
|
379
|
-
function
|
|
382
|
+
function q(e) {
|
|
380
383
|
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e);
|
|
381
384
|
}
|
|
382
|
-
function
|
|
385
|
+
function J(e, t) {
|
|
383
386
|
let n = {};
|
|
384
387
|
return e.line1.trim().length === 0 && (n.line1 = t.addressLine1Required), e.city.trim().length === 0 && (n.city = t.cityRequired), e.state.trim().length === 0 && (n.state = t.stateRequired), e.postalCode.trim().length === 0 && (n.postalCode = t.postalCodeRequired), n;
|
|
385
388
|
}
|
|
386
|
-
function
|
|
389
|
+
function Y(e) {
|
|
387
390
|
return Object.values(e).some(Boolean);
|
|
388
391
|
}
|
|
389
|
-
function
|
|
392
|
+
function X(e) {
|
|
390
393
|
if (!/^\d{9}$/.test(e)) return !1;
|
|
391
394
|
let t = [...e].map(Number);
|
|
392
395
|
return (3 * (t[0] + t[3] + t[6]) + 7 * (t[1] + t[4] + t[7]) + (t[2] + t[5] + t[8])) % 10 == 0;
|
|
393
396
|
}
|
|
394
|
-
function
|
|
395
|
-
let
|
|
396
|
-
return a.length === 0 && (
|
|
397
|
+
function Z(e, t = i) {
|
|
398
|
+
let r = {}, a = e.accountHolderName.trim(), o = e.routingNumber.trim(), s = e.accountNumber.trim();
|
|
399
|
+
return a.length === 0 && (r.accountHolderName = t.accountHolderNameRequired), (o.length === 0 || !X(o)) && (r.routingNumber = t.routingNumberInvalid), n(s) || (r.accountNumber = t.accountNumberInvalid), r;
|
|
397
400
|
}
|
|
398
|
-
function
|
|
401
|
+
function Q(e, t, n = i, r = "customer", a = !1) {
|
|
399
402
|
let o = {};
|
|
400
|
-
if (e.entityType === "organization" ? e.legalName.trim().length === 0 && (o.legalName = n.legalNameRequired) : (e.firstName.trim().length === 0 && (o.firstName = n.firstNameRequired), e.lastName.trim().length === 0 && (o.lastName = n.lastNameRequired)), e.email.trim().length === 0 ? o.email = n.emailRequired :
|
|
401
|
-
let t =
|
|
402
|
-
|
|
403
|
+
if (e.entityType === "organization" ? e.legalName.trim().length === 0 && (o.legalName = n.legalNameRequired) : (e.firstName.trim().length === 0 && (o.firstName = n.firstNameRequired), e.lastName.trim().length === 0 && (o.lastName = n.lastNameRequired)), e.email.trim().length === 0 ? o.email = n.emailRequired : q(e.email.trim()) || (o.email = n.emailInvalid), t === "create" && r === "vendor" || j(e.address)) {
|
|
404
|
+
let t = J(e.address, n);
|
|
405
|
+
Y(t) && (o.address = t);
|
|
403
406
|
}
|
|
404
|
-
if (
|
|
405
|
-
let t =
|
|
406
|
-
|
|
407
|
+
if (r === "vendor" && (a || L(e))) {
|
|
408
|
+
let t = Z(e.bankAccount, n);
|
|
409
|
+
Y(t) && (o.bankAccount = t);
|
|
407
410
|
}
|
|
408
411
|
return o;
|
|
409
412
|
}
|
|
410
|
-
function
|
|
413
|
+
function $(e) {
|
|
411
414
|
let { address: t, bankAccount: n, ...r } = e;
|
|
412
|
-
return
|
|
415
|
+
return Y(r) || (t ? Y(t) : !1) || (n ? Y(n) : !1);
|
|
413
416
|
}
|
|
414
|
-
function
|
|
417
|
+
function ee(e, t = i) {
|
|
415
418
|
let n = {};
|
|
416
419
|
return e.accountNumber.trim().length === 0 && e.iban.trim().length === 0 && (n.accountNumber = t.bankAccountIdentifierRequired), e.currency.trim().length === 0 && (n.currency = t.bankAccountCurrencyRequired), n;
|
|
417
420
|
}
|
|
418
|
-
function
|
|
419
|
-
return
|
|
421
|
+
function te(e) {
|
|
422
|
+
return Y(e);
|
|
420
423
|
}
|
|
421
|
-
function
|
|
422
|
-
return
|
|
424
|
+
function ne(e, t = i) {
|
|
425
|
+
return J(e, t);
|
|
423
426
|
}
|
|
424
|
-
function
|
|
427
|
+
function re() {
|
|
425
428
|
let e = globalThis.getSelection?.();
|
|
426
429
|
return !!(e && e.toString().length > 0);
|
|
427
430
|
}
|
|
428
431
|
//#endregion
|
|
429
|
-
export {
|
|
432
|
+
export { D as addressFormToCreatePayload, O as addressFormToUpdatePayload, E as addressResponseToFormValues, G as bankAccountFormToCreatePayload, K as bankAccountFormToUpdatePayload, W as bankAccountToFormValues, h as buildAnalyticsMap, S as buildBankAccountItems, b as buildCounterpartDetailsView, _ as buildCounterpartRows, R as counterpartFormBankAccountToCreatePayload, z as counterpartFormBankAccountToUpdatePayload, N as counterpartFormToCreatePayload, P as counterpartFormToUpdatePayload, A as counterpartToFormValues, U as emptyBankAccountFormValues, k as emptyCounterpartFormValues, d as formatCounterpartDate, l as formatMoney, c as fromMinorUnits, C as getAchInstructions, p as getCounterpartEmail, f as getCounterpartName, o as getCurrencyOptions, w as getPayableAchInstructions, I as hasAchFormValues, te as hasBankAccountFormErrors, F as hasCounterpartFormAddressValues, L as hasCounterpartFormBankAccountValues, $ as hasCounterpartFormErrors, re as hasSelectedText, V as isAchCompatibleBankAccount, H as resolveCounterpartBankAccountWrite, Z as validateAchFormValues, ne as validateAddressForm, ee as validateBankAccountForm, Q as validateCounterpartForm };
|
|
@@ -16,6 +16,7 @@ var e = {
|
|
|
16
16
|
accountNumberInvalid: "Enter a valid account number",
|
|
17
17
|
vatIdValueRequired: "VAT ID is required",
|
|
18
18
|
genericError: "Something went wrong. Please try again.",
|
|
19
|
+
amountsUnavailable: "Some amounts could not be loaded. Try refreshing the page.",
|
|
19
20
|
deleteTitle: "Delete “{name}”?",
|
|
20
21
|
deleteBankAccountTitle: "Delete bank account “{account}”?",
|
|
21
22
|
deleteCounterpartMessage: "This record and its contacts, bank accounts, and tax ID will be permanently removed. You can't undo this action.",
|
package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { ACH_FIELD_GROUP_LABELS_EN as e,
|
|
1
|
+
import { ACH_FIELD_GROUP_LABELS_EN as e, ADDRESS_FORM_SHEET_LABELS_EN as t, COUNTERPART_FORM_SHEET_LABELS_EN as n, COUNTERPART_TYPE_BADGE_LABELS_EN as r } from "./index2.js";
|
|
2
2
|
import "./index3.js";
|
|
3
|
-
import { AchFieldGroup as
|
|
4
|
-
import { EMPTY_ADDRESS_FORM_VALUES as
|
|
3
|
+
import { AchFieldGroup as i } from "./index5.js";
|
|
4
|
+
import { AddressFieldGroup as a, EMPTY_ADDRESS_FORM_VALUES as o } from "./index6.js";
|
|
5
5
|
import "./index7.js";
|
|
6
|
-
import { CounterpartFormFields as
|
|
6
|
+
import { CounterpartFormFields as s, CounterpartFormSheet 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
|
-
import
|
|
11
|
-
import { ConfirmDeleteDialog as
|
|
12
|
-
import { CounterpartSelector as
|
|
13
|
-
export { e as ACH_FIELD_GROUP_LABELS_EN,
|
|
10
|
+
import "./index13.js";
|
|
11
|
+
import { ConfirmDeleteDialog as d } from "./index14.js";
|
|
12
|
+
import { CounterpartSelector as f } from "./index15.js";
|
|
13
|
+
export { e as ACH_FIELD_GROUP_LABELS_EN, t as ADDRESS_FORM_SHEET_LABELS_EN, i as AchFieldGroup, a as AddressFieldGroup, u as BankAccountFormSheet, n as COUNTERPART_FORM_SHEET_LABELS_EN, r as COUNTERPART_TYPE_BADGE_LABELS_EN, d as ConfirmDeleteDialog, s as CounterpartFormFields, c as CounterpartFormSheet, f as CounterpartSelector, o as EMPTY_ADDRESS_FORM_VALUES, l as useFocusFirstInvalidField };
|