@tesouro/embedded-components-react 0.5.67 → 0.5.69

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.
@@ -93,7 +93,7 @@ function D({ labels: u, onEnqueueFiles: b, openPayableId: x, onOpenPayableHandle
93
93
  k(e), j(!0);
94
94
  return;
95
95
  }
96
- N(e), F(!0);
96
+ N(e), L(!0);
97
97
  }, [G]), se = t(B?.scopes, [n.CounterpartReadOrg]), q = f({
98
98
  enabled: W,
99
99
  canReadVendors: se,
@@ -107,7 +107,7 @@ function D({ labels: u, onEnqueueFiles: b, openPayableId: x, onOpenPayableHandle
107
107
  label: D.queues[e],
108
108
  icon: E[e]
109
109
  })), [D.queues]), ue = (e) => {
110
- z(!1), N(e), F(!0);
110
+ z(!1), N(e), L(!0);
111
111
  }, de = () => {
112
112
  F(!1), L(!0);
113
113
  }, fe = () => {
@@ -28,10 +28,9 @@ function p({ labels: n }) {
28
28
  }), x = l(n), S = s(g).map((e) => ({
29
29
  ...e,
30
30
  ariaLabel: x.viewButtonAriaLabel.replace("{title}", e.title)
31
- })), C = g?.version ? x.versionLabel.replace("{version}", g.version) : void 0;
31
+ }));
32
32
  return /* @__PURE__ */ f(u, {
33
33
  documents: S,
34
- versionLabel: C,
35
34
  isLoading: !h || _ || v,
36
35
  isError: y,
37
36
  onRetry: () => {
@@ -3,7 +3,6 @@ var e = {
3
3
  fileTypeBadge: "PDF",
4
4
  viewButton: "View",
5
5
  viewButtonAriaLabel: "View {title}",
6
- versionLabel: "Version {version}",
7
6
  emptyTitle: "No disclosures available",
8
7
  emptyDescription: "Your bank has not published any disclosures yet.",
9
8
  errorTitle: "Unable to load disclosures",
@@ -7,19 +7,19 @@ import { jsx as a, jsxs as o } from "react/jsx-runtime";
7
7
  import { ExternalLinkIcon as s, FileTextIcon as c } from "lucide-react";
8
8
  //#region ../../libs/tesouro-embedded-components-react/shared/bank-disclosures/ui/dist/index3.js
9
9
  var l = 3;
10
- function u({ documents: u, versionLabel: d, isLoading: f = !1, isError: p = !1, onRetry: m, labels: h, testIds: g }) {
11
- let _ = i(h);
10
+ function u({ documents: u, isLoading: d = !1, isError: f = !1, onRetry: p, labels: m, testIds: h }) {
11
+ let g = i(m);
12
12
  return /* @__PURE__ */ a("div", {
13
- "data-testid": g?.root,
13
+ "data-testid": h?.root,
14
14
  className: "ttw:flex ttw:flex-col ttw:gap-4",
15
- children: p ? /* @__PURE__ */ a(r, {
16
- testId: g?.error,
17
- title: _.errorTitle,
18
- description: _.errorDescription,
19
- retryLabel: m ? _.errorRetry : void 0,
20
- onRetry: m
21
- }) : f ? /* @__PURE__ */ a("div", {
22
- "data-testid": g?.loading,
15
+ children: f ? /* @__PURE__ */ a(r, {
16
+ testId: h?.error,
17
+ title: g.errorTitle,
18
+ description: g.errorDescription,
19
+ retryLabel: p ? g.errorRetry : void 0,
20
+ onRetry: p
21
+ }) : d ? /* @__PURE__ */ a("div", {
22
+ "data-testid": h?.loading,
23
23
  className: "ttw:divide-y ttw:divide-border ttw:rounded-lg ttw:border ttw:border-border ttw:bg-background",
24
24
  children: Array.from({ length: l }, (e, n) => /* @__PURE__ */ o("div", {
25
25
  className: "ttw:flex ttw:items-center ttw:gap-4 ttw:p-4",
@@ -30,15 +30,12 @@ function u({ documents: u, versionLabel: d, isLoading: f = !1, isError: p = !1,
30
30
  ]
31
31
  }, n))
32
32
  }) : u.length === 0 ? /* @__PURE__ */ a(n, {
33
- testId: g?.empty,
34
- title: _.emptyTitle,
35
- description: _.emptyDescription
36
- }) : /* @__PURE__ */ o("div", {
33
+ testId: h?.empty,
34
+ title: g.emptyTitle,
35
+ description: g.emptyDescription
36
+ }) : /* @__PURE__ */ a("div", {
37
37
  className: "ttw:flex ttw:flex-col ttw:gap-2",
38
- children: [d ? /* @__PURE__ */ a("span", {
39
- className: "ttw:text-xs ttw:text-muted-foreground",
40
- children: d
41
- }) : null, /* @__PURE__ */ a("ul", {
38
+ children: /* @__PURE__ */ a("ul", {
42
39
  className: "ttw:divide-y ttw:divide-border ttw:rounded-lg ttw:border ttw:border-border ttw:bg-background",
43
40
  children: u.map((t) => /* @__PURE__ */ o("li", {
44
41
  className: "ttw:flex ttw:items-center ttw:gap-4 ttw:p-4",
@@ -48,7 +45,7 @@ function u({ documents: u, versionLabel: d, isLoading: f = !1, isError: p = !1,
48
45
  className: "ttw:flex ttw:h-12 ttw:w-10 ttw:shrink-0 ttw:flex-col ttw:items-center ttw:justify-center ttw:gap-0.5 ttw:rounded ttw:border ttw:border-border ttw:text-muted-foreground",
49
46
  children: [/* @__PURE__ */ a(c, { className: "ttw:size-4" }), /* @__PURE__ */ a("span", {
50
47
  className: "ttw:text-[9px] ttw:font-medium ttw:uppercase ttw:tracking-wide",
51
- children: _.fileTypeBadge
48
+ children: g.fileTypeBadge
52
49
  })]
53
50
  }),
54
51
  /* @__PURE__ */ a("span", {
@@ -67,12 +64,12 @@ function u({ documents: u, versionLabel: d, isLoading: f = !1, isError: p = !1,
67
64
  children: [/* @__PURE__ */ a(s, {
68
65
  "aria-hidden": !0,
69
66
  className: "ttw:size-4"
70
- }), _.viewButton]
67
+ }), g.viewButton]
71
68
  })
72
69
  })
73
70
  ]
74
71
  }, t.url))
75
- })]
72
+ })
76
73
  })
77
74
  });
78
75
  }
@@ -1,6 +1,6 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/labels.js
2
2
  var e = {
3
- legalNameRequired: "Legal name is required",
3
+ legalNameRequired: "Business name is required",
4
4
  firstNameRequired: "First name is required",
5
5
  lastNameRequired: "Last name is required",
6
6
  emailRequired: "Email is required",
@@ -18,7 +18,7 @@ var e = {
18
18
  genericError: "Something went wrong. Please try again.",
19
19
  deleteTitle: "Delete “{name}”?",
20
20
  deleteBankAccountTitle: "Delete bank account “{account}”?",
21
- deleteCounterpartMessage: "This counterpart and its contacts, bank accounts, and VAT IDs will be permanently removed. You can't undo this action.",
21
+ deleteCounterpartMessage: "This record and its contacts, bank accounts, and tax ID will be permanently removed. You can't undo this action.",
22
22
  deleteBankAccountMessage: "This removes these payment instructions from the vendor. The vendor will not be deleted. You can't undo this action."
23
23
  };
24
24
  //#endregion
@@ -7,48 +7,71 @@ import { useCreateCounterpartMutation as t, useUpdateCounterpartMutation as n }
7
7
  import { useCreateCounterpartBankAccountMutation as r, useUpdateCounterpartBankAccountMutation as i } from "../../../data-access/dist/index5.js";
8
8
  import { useCreateCounterpartAddressMutation as a, useUpdateCounterpartAddressMutation as o } from "../../../data-access/dist/index7.js";
9
9
  import "../../../data-access/dist/index.js";
10
- import { addressFormToCreatePayload as s, addressFormToUpdatePayload as c, addressResponseToFormValues as l, counterpartFormBankAccountToCreatePayload as u, counterpartFormBankAccountToUpdatePayload as d, counterpartFormToCreatePayload as f, counterpartFormToUpdatePayload as p, counterpartToFormValues as m, emptyCounterpartFormValues as h, getAchInstructions as g, hasCounterpartFormAddressValues as _, hasCounterpartFormBankAccountValues as v, hasCounterpartFormErrors as ee, resolveCounterpartBankAccountWrite as y, validateCounterpartForm as b } from "./helpers.js";
11
- import { useCallback as x, useState as S } from "react";
10
+ import { addressFormToCreatePayload as s, addressFormToUpdatePayload as c, addressResponseToFormValues as l, counterpartFormBankAccountToCreatePayload as u, counterpartFormBankAccountToUpdatePayload as ee, counterpartFormToCreatePayload as te, counterpartFormToUpdatePayload as d, counterpartToFormValues as f, emptyCounterpartFormValues as p, getAchInstructions as m, hasCounterpartFormAddressValues as h, hasCounterpartFormBankAccountValues as g, hasCounterpartFormErrors as _, resolveCounterpartBankAccountWrite as v, validateCounterpartForm as y } from "./helpers.js";
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 C(e, t) {
14
- if (!t) return _(e);
13
+ function S(e, t) {
14
+ if (!t) return h(e);
15
15
  let n = l(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 w(e) {
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 T(e, t) {
26
- if (!t) return v(e);
27
- let n = w(t);
25
+ function w(e, t) {
26
+ if (!t) return g(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 T(e, t) {
31
+ let n = { ...e };
32
+ if ([
33
+ "legalName",
34
+ "firstName",
35
+ "lastName",
36
+ "email"
37
+ ].forEach((e) => {
38
+ n[e] && !t[e] && delete n[e];
39
+ }), e.address) {
40
+ let r = { ...e.address };
41
+ Object.keys(r).forEach((e) => {
42
+ r[e] && !t.address?.[e] && delete r[e];
43
+ }), n.address = Object.keys(r).length ? r : void 0;
44
+ }
45
+ if (e.bankAccount) {
46
+ let r = { ...e.bankAccount };
47
+ Object.keys(r).forEach((e) => {
48
+ r[e] && !t.bankAccount?.[e] && delete r[e];
49
+ }), n.bankAccount = Object.keys(r).length ? r : void 0;
50
+ }
51
+ return n;
52
+ }
30
53
  function E({ view: l, setView: E, selectedId: D, setSelectedId: O, messages: k, counterpartType: A, counterpart: j, primaryAddress: M, bankAccounts: N, isBankAccountsLoading: P, isBankAccountsError: F, includeBankAccount: I = !0 }) {
31
- let L = A === "vendor" && I, R = t(), z = a(), B = r(), V = n(), H = o(), U = i(), [W, G] = S(() => h()), [K, q] = S({}), [J, Y] = S({
54
+ let L = A === "vendor" && I, R = t(), z = a(), B = r(), V = n(), H = o(), U = i(), [W, G] = x(() => p()), [K, q] = x({}), [J, Y] = x({
32
55
  address: !1,
33
56
  bankAccount: !1
34
- }), [X, Z] = S(), [Q, $] = S(), te = R.isPending || z.isPending || B.isPending || U.isPending || V.isPending || H.isPending, ne = x(() => {
57
+ }), [X, Z] = x(), [Q, $] = x(), ne = R.isPending || z.isPending || B.isPending || U.isPending || V.isPending || H.isPending, re = b(() => {
35
58
  O(void 0), $(void 0), Z(void 0), Y({
36
59
  address: A === "vendor",
37
60
  bankAccount: !1
38
- }), G(h("organization", A)), q({}), E("create");
61
+ }), G(p("organization", A)), q({}), E("create");
39
62
  }, [
40
63
  A,
41
64
  O,
42
65
  E
43
- ]), re = x(() => {
66
+ ]), ie = b(() => {
44
67
  if (!j || L && (P || F)) return;
45
- let e = L ? g(N) : void 0, t = m(j, M);
68
+ let e = L ? m(N) : void 0, t = f(j, M);
46
69
  $(void 0), Z(e?.id), Y({
47
- address: _(t),
70
+ address: h(t),
48
71
  bankAccount: !1
49
72
  }), G({
50
73
  ...t,
51
- ...e ? { bankAccount: w(e) } : {}
74
+ ...e ? { bankAccount: C(e) } : {}
52
75
  }), q({}), E("edit");
53
76
  }, [
54
77
  N,
@@ -58,27 +81,38 @@ function E({ view: l, setView: E, selectedId: D, setSelectedId: O, messages: k,
58
81
  M,
59
82
  E,
60
83
  L
61
- ]), ie = x(() => {
84
+ ]), ae = b(() => {
62
85
  E("none");
63
- }, [E]);
86
+ }, [E]), oe = b(() => {
87
+ Y((e) => ({
88
+ ...e,
89
+ address: !0
90
+ }));
91
+ }, []);
64
92
  return {
65
93
  values: W,
66
94
  errors: K,
67
- setValues: G,
68
- isSubmitting: te,
95
+ setValues: b((e) => {
96
+ G((t) => {
97
+ let n = typeof e == "function" ? e(t) : e;
98
+ return q((e) => _(e) ? T(e, y(n, l === "edit" ? "edit" : "create", k, A, l === "edit" && L && !!X)) : e), n;
99
+ });
100
+ }, [
101
+ X,
102
+ A,
103
+ k,
104
+ l,
105
+ L
106
+ ]),
107
+ isSubmitting: ne,
69
108
  sectionsToExpand: J,
70
- expandAddress: x(() => {
71
- Y((e) => ({
72
- ...e,
73
- address: !0
74
- }));
75
- }, []),
76
- openCreate: ne,
77
- openEdit: re,
78
- close: ie,
79
- submit: x(async () => {
80
- let t = l === "edit" ? "edit" : "create", n = b(W, t, k, A, t === "edit" && L && !!X);
81
- if (ee(n)) return q(n), Y((e) => ({
109
+ expandAddress: oe,
110
+ openCreate: re,
111
+ openEdit: ie,
112
+ close: ae,
113
+ submit: b(async () => {
114
+ let t = l === "edit" ? "edit" : "create", n = y(W, t, k, A, t === "edit" && L && !!X);
115
+ if (_(n)) return q(n), Y((e) => ({
82
116
  address: e.address || !!n.address,
83
117
  bankAccount: e.bankAccount || !!n.bankAccount
84
118
  })), { ok: !1 };
@@ -91,23 +125,23 @@ function E({ view: l, setView: E, selectedId: D, setSelectedId: O, messages: k,
91
125
  if (l === "edit" && D) {
92
126
  $(void 0), await V.mutateAsync({
93
127
  path: { counterpart_id: D },
94
- body: p(W, A)
128
+ body: d(W, A)
95
129
  });
96
- let e = M ? C(W, M) ? H.mutateAsync({
130
+ let e = M ? S(W, M) ? H.mutateAsync({
97
131
  path: {
98
132
  counterpart_id: D,
99
133
  address_id: M.id
100
134
  },
101
135
  body: c(W.address)
102
- }) : void 0 : _(W) ? z.mutateAsync({
136
+ }) : void 0 : h(W) ? z.mutateAsync({
103
137
  path: { counterpart_id: D },
104
138
  body: s(W.address)
105
- }) : void 0, t = L && T(W, g(N)) ? y(N, X) : void 0, n = t?.kind === "update" ? U.mutateAsync({
139
+ }) : void 0, t = L && w(W, m(N)) ? v(N, X) : void 0, n = t?.kind === "update" ? U.mutateAsync({
106
140
  path: {
107
141
  counterpart_id: D,
108
142
  bank_account_id: t.bankAccountId
109
143
  },
110
- body: d(W.bankAccount, { includeAchDefaults: t.includeAchDefaults })
144
+ body: ee(W.bankAccount, { includeAchDefaults: t.includeAchDefaults })
111
145
  }) : t?.kind === "create" ? B.mutateAsync({
112
146
  path: { counterpart_id: D },
113
147
  body: u(W.bankAccount, { isDefaultForCurrency: t.isDefaultForCurrency })
@@ -119,7 +153,7 @@ function E({ view: l, setView: E, selectedId: D, setSelectedId: O, messages: k,
119
153
  counterpartId: D
120
154
  };
121
155
  }
122
- return r ||= (await R.mutateAsync({ body: f(W, A) }))?.id, r && L && v(W) && ($(r), await B.mutateAsync({
156
+ return r ||= (await R.mutateAsync({ body: te(W, A) }))?.id, r && L && g(W) && ($(r), await B.mutateAsync({
123
157
  path: { counterpart_id: r },
124
158
  body: u(W.bankAccount)
125
159
  })), $(void 0), E("none"), r && O(r), {
@@ -57,7 +57,7 @@ var n = {
57
57
  paymentRemindersLabel: "Payment reminders",
58
58
  paymentRemindersDescription: "Send automatic reminders for unpaid customer invoices.",
59
59
  paymentMethodsHeading: "Accepted payment methods",
60
- paymentMethodsDescription: "Optional ACH bank transfer details for this vendor.",
60
+ paymentMethodsDescription: "ACH bank transfer details for this vendor.",
61
61
  accountHolderNameLabel: "Account holder name",
62
62
  routingNumberLabel: "Routing number",
63
63
  accountNumberLabel: "Account number",
@@ -1,5 +1,5 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
2
- var e = "@tesouro/embedded-components-react", t = "0.5.67", n = "7426395559729900fa647ef8cfc5ad4c4048564b", r = Object.freeze({
2
+ var e = "@tesouro/embedded-components-react", t = "0.5.69", n = "a4d77b036b5ea457e3c6507a73d1361a685d094a", r = Object.freeze({
3
3
  library_name: e,
4
4
  library_version: t,
5
5
  library_sha: n
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tesouro/embedded-components-react",
3
- "version": "0.5.67",
3
+ "version": "0.5.69",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "packageDepSync": {