@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.
Files changed (29) hide show
  1. package/README.md +22 -1
  2. package/dist/index.d.ts +72 -22
  3. package/dist/index.js +38 -36
  4. package/dist/lib/CounterpartsWidget.d.ts +21 -18
  5. package/dist/lib/CounterpartsWidget.js +1 -2
  6. package/dist/lib/CounterpartsWidgetPublic.d.ts +976 -0
  7. package/dist/lib/CounterpartsWidgetPublic.js +10 -0
  8. package/dist/lib/CustomersWidget.d.ts +955 -0
  9. package/dist/lib/CustomersWidget.js +3 -0
  10. package/dist/lib/ReceivablesWidget.d.ts +2 -0
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index90.js +1 -0
  12. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/index4.js +98 -89
  13. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/index7.js +114 -108
  14. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/index8.js +40 -42
  15. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index2.js +1 -0
  16. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index3.js +90 -76
  17. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index4.js +300 -226
  18. package/dist/libs/tesouro-embedded-components-react/customers-widget/feature/dist/index.js +2 -0
  19. package/dist/libs/tesouro-embedded-components-react/customers-widget/feature/dist/index2.js +4 -0
  20. package/dist/libs/tesouro-embedded-components-react/customers-widget/feature/dist/index3.js +45 -0
  21. package/dist/libs/tesouro-embedded-components-react/customers-widget/feature/dist/index4.js +42 -0
  22. package/dist/libs/tesouro-embedded-components-react/customers-widget/feature/dist/index5.js +27 -0
  23. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/index.js +11 -12
  24. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/helpers.js +103 -100
  25. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/labels.js +1 -0
  26. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index.js +9 -9
  27. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index13.js +4 -74
  28. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  29. package/package.json +1 -1
@@ -0,0 +1,2 @@
1
+ import { CustomersWidget as e } from "./index5.js";
2
+ export { e as CustomersWidget };
@@ -0,0 +1,4 @@
1
+ //#region ../../libs/tesouro-embedded-components-react/customers-widget/feature/dist/index2.js
2
+ var e = { Mounted: "customers_widget.mounted" }, t = "customers_widget";
3
+ //#endregion
4
+ export { e as CustomersWidgetAnalyticsEvent, t as WIDGET_NAME };
@@ -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 { AddressFormSheet as u } from "../../ui/dist/index13.js";
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 f } from "./lib/labels.js";
13
- import { buildAnalyticsMap as p, buildCounterpartRows as m, counterpartFormBankAccountToCreatePayload as h, counterpartFormBankAccountToUpdatePayload as g, formatCounterpartDate as _, formatMoney as v, getAchInstructions as y, getCounterpartEmail as b, getCounterpartName as x, getPayableAchInstructions as S, hasSelectedText as C, isAchCompatibleBankAccount as w, resolveCounterpartBankAccountWrite as T, validateAchFormValues as E } from "./lib/helpers.js";
14
- import { useAddressForm as D } from "./lib/useAddressForm.js";
15
- import { useCounterpartDetails as O } from "./lib/useCounterpartDetails.js";
16
- import { usePayableAchInstructions as k } from "./lib/usePayableAchInstructions.js";
17
- import { useCounterpartForm as A } from "./lib/useCounterpartForm.js";
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 j } from "./lib/CounterpartSelector.js";
20
- import { useDeleteController as M } from "./lib/useDeleteController.js";
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 N } from "./lib/subEntityForms.js";
23
- export { u as AddressFormSheet, l as BankAccountFormSheet, f as COUNTERPART_MESSAGE_LABELS_EN, d as ConfirmDeleteDialog, o as CounterpartFormFields, s as CounterpartFormSheet, j as CounterpartSelector, p as buildAnalyticsMap, m as buildCounterpartRows, h as counterpartFormBankAccountToCreatePayload, g as counterpartFormBankAccountToUpdatePayload, _ as formatCounterpartDate, v as formatMoney, y as getAchInstructions, b as getCounterpartEmail, x as getCounterpartName, S as getPayableAchInstructions, C as hasSelectedText, w as isAchCompatibleBankAccount, T as resolveCounterpartBankAccountWrite, D as useAddressForm, N as useBankAccountForm, i as useCounterpartAddressesForRowsQuery, a as useCounterpartAddressesQuery, O as useCounterpartDetails, A as useCounterpartForm, e as useCounterpartsByIdsQuery, t as useCounterpartsQuery, n as useCreateCounterpartBankAccountMutation, M as useDeleteController, c as useFocusFirstInvalidField, k as usePayableAchInstructions, r as useUpdateCounterpartBankAccountMutation, E as validateAchFormValues };
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 { isValidAchAccountNumber as t } from "../../../../util/dist/lib/isValidAchAccountNumber.js";
3
- import { EMPTY_ADDRESS_FORM_VALUES as n } from "../../../ui/dist/index6.js";
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 r } from "./labels.js";
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 i = [
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 a(e) {
22
- return Array.from(/* @__PURE__ */ new Set([...i, ...e ? [e] : []])).sort().map((e) => ({
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 o(e) {
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 s(e, t) {
38
- return e / 10 ** o(t);
38
+ function c(e, t) {
39
+ return e / 10 ** s(t);
39
40
  }
40
- function c(t, n = "USD") {
41
- return e(s(t, n), { currencyCode: n });
41
+ function l(t, n = "USD") {
42
+ return e(c(t, n), { currencyCode: n });
42
43
  }
43
- var l = new Intl.DateTimeFormat(void 0, {
44
+ var u = new Intl.DateTimeFormat(void 0, {
44
45
  year: "numeric",
45
46
  month: "short",
46
47
  day: "numeric"
47
48
  });
48
- function u(e) {
49
+ function d(e) {
49
50
  if (!e) return "";
50
51
  let t = new Date(e);
51
- return Number.isNaN(t.getTime()) ? "" : l.format(t);
52
+ return Number.isNaN(t.getTime()) ? "" : u.format(t);
52
53
  }
53
- function d(e) {
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 f(e) {
59
+ function p(e) {
59
60
  return "organization" in e ? e.organization.email ?? "" : e.individual.email ?? "";
60
61
  }
61
- function p(e) {
62
+ function m(e) {
62
63
  return "organization" in e ? e.organization.phone ?? "" : e.individual.phone ?? "";
63
64
  }
64
- function m(e) {
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
- function h({ counterparts: e, addresses: t, billedAmounts: n, dueOrOwedAmounts: r, isBilledAmountLoading: i = !1, isDueOrOwedAmountLoading: a = !1 }) {
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 o = n?.get(e.id) ?? 0, s = r?.get(e.id) ?? 0, l = o - s, u = i || a;
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: d(e),
76
+ name: _,
77
+ initials: t(_),
75
78
  entityType: e.type,
76
- locationLabel: _(t?.get(e.id)),
77
- billedAmountLabel: n && !i ? c(o) : "",
78
- receivedOrPaidAmountLabel: n && r && !u ? c(l) : "",
79
- dueOrOwedAmountLabel: r && !a ? c(s) : "",
80
- isBilledAmountLoading: i,
81
- isReceivedOrPaidAmountLoading: u,
82
- isDueOrOwedAmountLoading: a
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 g(e) {
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 _(e) {
101
- return e ? [e.city, e.country].filter(Boolean).join(", ") : "";
103
+ function y(e) {
104
+ return e ? [e.country, e.city].filter(Boolean).join(" • ") : "";
102
105
  }
103
- function v({ counterpart: e, primaryAddress: t }) {
106
+ function b({ counterpart: e, primaryAddress: t }) {
104
107
  return {
105
- name: d(e),
108
+ name: f(e),
106
109
  entityType: e.type,
107
- email: f(e),
108
- phone: p(e),
110
+ email: p(e),
111
+ phone: m(e),
109
112
  taxId: e.tax_id ?? "",
110
- addressLines: g(t),
111
- createdAtLabel: u(e.created_at),
112
- updatedAtLabel: u(e.updated_at)
113
+ addressLines: v(t),
114
+ createdAtLabel: d(e.created_at),
115
+ updatedAtLabel: d(e.updated_at)
113
116
  };
114
117
  }
115
- function y(e) {
118
+ function x(e) {
116
119
  if (e) return `•••• ${e.slice(-4)}`;
117
120
  }
118
- function b(e) {
121
+ function S(e) {
119
122
  return (e ?? []).map((e) => {
120
- let t = y(e.iban || e.account_number || void 0), n = [e.currency, t].filter(Boolean).join(" · ");
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 x(e) {
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 S(e, t = "USD", n) {
134
- let r = n && (e ?? []).find((e) => e.id === n && z(e));
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 C(e, t = {}) {
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 w(e) {
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 T(e) {
160
- return C(e);
162
+ function D(e) {
163
+ return T(e);
161
164
  }
162
- function E(e) {
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 D(e = "organization", t) {
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: { ...n },
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 O(e, t) {
192
- let n = D(e.type);
193
- return n.email = f(e), n.phone = p(e), n.taxId = e.tax_id ?? "", n.remindersEnabled = !!e.reminders_enabled, t && (n.address = w(t)), "organization" in e ? n.legalName = e.organization.legal_name : (n.firstName = e.individual.first_name, n.lastName = e.individual.last_name), n;
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 k(e) {
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 A(e) {
205
- return k(e) ? C(e) : void 0;
207
+ function M(e) {
208
+ return j(e) ? T(e) : void 0;
206
209
  }
207
- function j(e, t) {
208
- let n = t === "customer", r = t === "vendor", i = A(e.address), a = e.taxId.trim() || void 0, o = e.email.trim(), s = e.phone.trim() || void 0, c = {
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 M(e, t) {
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 N(e) {
262
- return k(e.address);
264
+ function F(e) {
265
+ return j(e.address);
263
266
  }
264
- function P(e) {
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 F(e) {
272
- return P(e.bankAccount);
274
+ function L(e) {
275
+ return I(e.bankAccount);
273
276
  }
274
- function I(e, t = {}) {
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 L(e, t = {}) {
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 R(e) {
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 z(e) {
305
- return !!(R(e) || e.currency === "USD" && (e.routing_number || e.account_number));
307
+ function V(e) {
308
+ return !!(B(e) || e.currency === "USD" && (e.routing_number || e.account_number));
306
309
  }
307
- function B(e, t) {
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 ? R(n) : !1
316
+ includeAchDefaults: n ? B(n) : !1
314
317
  };
315
318
  }
316
- let n = e?.find(R);
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 V() {
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 H(e) {
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 U(e) {
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 W(e) {
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 G(e) {
382
+ function q(e) {
380
383
  return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e);
381
384
  }
382
- function K(e, t) {
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 q(e) {
389
+ function Y(e) {
387
390
  return Object.values(e).some(Boolean);
388
391
  }
389
- function J(e) {
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 Y(e, n = r) {
395
- let i = {}, a = e.accountHolderName.trim(), o = e.routingNumber.trim(), s = e.accountNumber.trim();
396
- return a.length === 0 && (i.accountHolderName = n.accountHolderNameRequired), (o.length === 0 || !J(o)) && (i.routingNumber = n.routingNumberInvalid), t(s) || (i.accountNumber = n.accountNumberInvalid), i;
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 X(e, t, n = r, i = "customer", a = !1) {
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 : G(e.email.trim()) || (o.email = n.emailInvalid), t === "create" && i === "vendor" || k(e.address)) {
401
- let t = K(e.address, n);
402
- q(t) && (o.address = t);
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 (i === "vendor" && (a || F(e))) {
405
- let t = Y(e.bankAccount, n);
406
- q(t) && (o.bankAccount = t);
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 Z(e) {
413
+ function $(e) {
411
414
  let { address: t, bankAccount: n, ...r } = e;
412
- return q(r) || (t ? q(t) : !1) || (n ? q(n) : !1);
415
+ return Y(r) || (t ? Y(t) : !1) || (n ? Y(n) : !1);
413
416
  }
414
- function Q(e, t = r) {
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 $(e) {
419
- return q(e);
421
+ function te(e) {
422
+ return Y(e);
420
423
  }
421
- function ee(e, t = r) {
422
- return K(e, t);
424
+ function ne(e, t = i) {
425
+ return J(e, t);
423
426
  }
424
- function te() {
427
+ function re() {
425
428
  let e = globalThis.getSelection?.();
426
429
  return !!(e && e.toString().length > 0);
427
430
  }
428
431
  //#endregion
429
- export { T as addressFormToCreatePayload, E as addressFormToUpdatePayload, w as addressResponseToFormValues, U as bankAccountFormToCreatePayload, W as bankAccountFormToUpdatePayload, H as bankAccountToFormValues, m as buildAnalyticsMap, b as buildBankAccountItems, v as buildCounterpartDetailsView, h as buildCounterpartRows, I as counterpartFormBankAccountToCreatePayload, L as counterpartFormBankAccountToUpdatePayload, j as counterpartFormToCreatePayload, M as counterpartFormToUpdatePayload, O as counterpartToFormValues, V as emptyBankAccountFormValues, D as emptyCounterpartFormValues, u as formatCounterpartDate, c as formatMoney, s as fromMinorUnits, x as getAchInstructions, f as getCounterpartEmail, d as getCounterpartName, a as getCurrencyOptions, S as getPayableAchInstructions, P as hasAchFormValues, $ as hasBankAccountFormErrors, N as hasCounterpartFormAddressValues, F as hasCounterpartFormBankAccountValues, Z as hasCounterpartFormErrors, te as hasSelectedText, z as isAchCompatibleBankAccount, B as resolveCounterpartBankAccountWrite, Y as validateAchFormValues, ee as validateAddressForm, Q as validateBankAccountForm, X as validateCounterpartForm };
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.",
@@ -1,13 +1,13 @@
1
- import { ACH_FIELD_GROUP_LABELS_EN as e, COUNTERPART_FORM_SHEET_LABELS_EN as t, COUNTERPART_TYPE_BADGE_LABELS_EN as n } from "./index2.js";
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 r } from "./index5.js";
4
- import { EMPTY_ADDRESS_FORM_VALUES as i } from "./index6.js";
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 a, CounterpartFormSheet as o, useFocusFirstInvalidField as s } from "./index9.js";
6
+ import { CounterpartFormFields as s, CounterpartFormSheet as c, useFocusFirstInvalidField as l } from "./index9.js";
7
7
  import "./index10.js";
8
- import { BankAccountFormSheet as c } from "./index11.js";
8
+ import { BankAccountFormSheet as u } from "./index11.js";
9
9
  import "./index12.js";
10
- import { AddressFormSheet as l } from "./index13.js";
11
- import { ConfirmDeleteDialog as u } from "./index14.js";
12
- import { CounterpartSelector as d } from "./index15.js";
13
- export { e as ACH_FIELD_GROUP_LABELS_EN, r as AchFieldGroup, l as AddressFormSheet, c as BankAccountFormSheet, t as COUNTERPART_FORM_SHEET_LABELS_EN, n as COUNTERPART_TYPE_BADGE_LABELS_EN, u as ConfirmDeleteDialog, a as CounterpartFormFields, o as CounterpartFormSheet, d as CounterpartSelector, i as EMPTY_ADDRESS_FORM_VALUES, s as useFocusFirstInvalidField };
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 };