@tesouro/embedded-components-react 0.5.295 → 0.5.296

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.
@@ -67,15 +67,15 @@ function w({ payableId: t, form: y, counterpartId: b, isVendorPending: x, onVend
67
67
  N,
68
68
  W,
69
69
  Z
70
- ]), $ = _(async (e, t) => {
71
- let n = !I && L ? {
70
+ ]), $ = _(async (e, t, n) => {
71
+ let s = !I && L ? {
72
72
  base64EncodedFile: await r(L),
73
73
  fileName: L.name
74
- } : void 0, s = y.isTotalsDirty ? {
74
+ } : void 0, c = y.isTotalsDirty ? {
75
75
  discount: y.discount,
76
76
  tax: y.tax,
77
77
  total: y.totalOverride
78
- } : void 0, c = i({
78
+ } : void 0, l = i({
79
79
  values: y.values,
80
80
  initialLineItems: I ? void 0 : y.lineItems,
81
81
  counterpartId: t ?? b,
@@ -87,29 +87,32 @@ function w({ payableId: t, form: y, counterpartId: b, isVendorPending: x, onVend
87
87
  total: y.totalOverride
88
88
  },
89
89
  lineItems: y.lineItems,
90
- editedTotals: s,
91
- document: n
92
- }), l = I;
93
- if (l ? await q.mutateAsync({
94
- path: { payable_id: l },
95
- body: c
96
- }) : (l = (await G.mutateAsync({ body: c }))?.id, l && (F(l), O?.(l), n && R(void 0))), !l) throw Error("Payable was created without an id");
90
+ editedTotals: c,
91
+ document: s
92
+ }), u = n ? {
93
+ ...l,
94
+ counterpart_raw_data: n
95
+ } : l, d = I;
96
+ if (d ? await q.mutateAsync({
97
+ path: { payable_id: d },
98
+ body: u
99
+ }) : (d = (await G.mutateAsync({ body: u }))?.id, d && (F(d), O?.(d), s && R(void 0))), !d) throw Error("Payable was created without an id");
97
100
  if (z) {
98
101
  try {
99
- await K.mutateAsync({ path: { payable_id: l } });
102
+ await K.mutateAsync({ path: { payable_id: d } });
100
103
  } catch {}
101
104
  B(!1);
102
105
  }
103
106
  return await J.mutateAsync({
104
- path: { payable_id: l },
107
+ path: { payable_id: d },
105
108
  body: { data: a(y.lineItems) }
106
- }), s && await q.mutateAsync({
107
- path: { payable_id: l },
109
+ }), c && await q.mutateAsync({
110
+ path: { payable_id: d },
108
111
  body: o({
109
112
  lineItems: y.lineItems,
110
- editedTotals: s
113
+ editedTotals: c
111
114
  })
112
- }), l;
115
+ }), d;
113
116
  }, [
114
117
  b,
115
118
  T,
@@ -137,7 +140,7 @@ function w({ payableId: t, form: y, counterpartId: b, isVendorPending: x, onVend
137
140
  try {
138
141
  let t = await E?.({ allowIncompleteVendor: !0 });
139
142
  if (t && !t.ok) return;
140
- let n = await $(t?.counterpartBankAccountId, t?.counterpartId);
143
+ let n = await $(t?.counterpartBankAccountId, t?.counterpartId, t?.counterpartRawData);
141
144
  y.setErrors(void 0), D?.(n), A?.(n);
142
145
  let r = await k?.();
143
146
  return e.success(r === "draft" ? N.submittedDemoted : N.draftSaved), n;
@@ -1,127 +1,125 @@
1
1
  import { Badge as e, Command as t, CommandGroup as n, CommandInput as r, CommandItem as i, CommandList as a, CommandSeparator as o, FieldDescription as s, FieldRequirement as c, Label as l, Popover as u, PopoverContent as d, PopoverTrigger as f, Skeleton as p, cn as m } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
2
2
  import { mergeVendorSearchComboboxLabels as h } from "./index23.js";
3
3
  import { useId as g, useState as _ } from "react";
4
- import { jsx as v, jsxs as y } from "react/jsx-runtime";
5
- import { ChevronDown as b, Plus as x } from "lucide-react";
4
+ import { Fragment as v, jsx as y, jsxs as b } from "react/jsx-runtime";
5
+ import { ChevronDown as x, Plus as S } from "lucide-react";
6
6
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index24.js
7
- var S = 5, C = "ttw:min-h-44";
8
- function w({ query: w, onQueryChange: T, results: E, isLoading: D, onAddVendor: O, selectedLabel: k, badge: A, helperText: j, resultsHeading: M, addVendorDescription: N, testId: P, labels: F }) {
9
- let I = h(F), L = g(), R = g(), [z, B] = _(!1);
10
- return /* @__PURE__ */ y("div", {
7
+ var C = 5, w = "ttw:min-h-44";
8
+ function T({ query: T, onQueryChange: E, results: D, isLoading: O, onAddVendor: k, selectedLabel: A, badge: j, helperText: M, resultsHeading: N, addVendorDescription: P, testId: F, labels: I }) {
9
+ let L = h(I), R = g(), z = g(), [B, V] = _(!1);
10
+ return /* @__PURE__ */ b("div", {
11
11
  className: "ttw:flex ttw:flex-col ttw:gap-1.5",
12
- "data-testid": P,
12
+ "data-testid": F,
13
13
  children: [
14
- /* @__PURE__ */ v(l, {
15
- htmlFor: L,
14
+ /* @__PURE__ */ y(l, {
15
+ htmlFor: R,
16
16
  requirement: c.Required,
17
- labels: I.fieldMarkers,
18
- children: I.fieldLabel
17
+ labels: L.fieldMarkers,
18
+ children: L.fieldLabel
19
19
  }),
20
- /* @__PURE__ */ y(u, {
20
+ /* @__PURE__ */ b(u, {
21
21
  modal: !0,
22
- open: z,
23
- onOpenChange: B,
24
- children: [/* @__PURE__ */ v(f, {
22
+ open: B,
23
+ onOpenChange: V,
24
+ children: [/* @__PURE__ */ y(f, {
25
25
  asChild: !0,
26
- children: /* @__PURE__ */ y("button", {
26
+ children: /* @__PURE__ */ b("button", {
27
27
  type: "button",
28
- id: L,
28
+ id: R,
29
29
  role: "combobox",
30
- "aria-expanded": z,
30
+ "aria-expanded": B,
31
31
  "aria-required": !0,
32
- "aria-describedby": j ? R : void 0,
32
+ "aria-describedby": M ? z : void 0,
33
33
  className: "ttw:flex ttw:h-10 ttw:w-full ttw:items-center ttw:justify-between ttw:gap-2 ttw:rounded-md ttw:border ttw:border-border ttw:bg-background ttw:px-3 ttw:text-left ttw:text-sm ttw:shadow-xs ttw:outline-none ttw:focus-visible:border-ring ttw:focus-visible:ring-[3px] ttw:focus-visible:ring-ring/50",
34
34
  children: [
35
- /* @__PURE__ */ v("span", {
36
- className: m("ttw:min-w-0 ttw:flex-1 ttw:truncate", k ? "ttw:text-foreground" : "ttw:text-muted-foreground"),
37
- children: k || I.triggerPlaceholder
35
+ /* @__PURE__ */ y("span", {
36
+ className: m("ttw:min-w-0 ttw:flex-1 ttw:truncate", A ? "ttw:text-foreground" : "ttw:text-muted-foreground"),
37
+ children: A || L.triggerPlaceholder
38
38
  }),
39
- A ? /* @__PURE__ */ v(e, {
39
+ j ? /* @__PURE__ */ y(e, {
40
40
  variant: "secondary",
41
- children: A
41
+ children: j
42
42
  }) : null,
43
- /* @__PURE__ */ v(b, {
43
+ /* @__PURE__ */ y(x, {
44
44
  "aria-hidden": !0,
45
45
  className: "ttw:size-4 ttw:shrink-0 ttw:opacity-50"
46
46
  })
47
47
  ]
48
48
  })
49
- }), /* @__PURE__ */ v(d, {
49
+ }), /* @__PURE__ */ y(d, {
50
50
  align: "start",
51
51
  className: "ttw:w-[var(--radix-popover-trigger-width)] ttw:p-0",
52
- children: /* @__PURE__ */ y(t, {
52
+ children: /* @__PURE__ */ b(t, {
53
53
  shouldFilter: !1,
54
- children: [/* @__PURE__ */ v(r, {
55
- value: w,
56
- onValueChange: T,
57
- placeholder: I.placeholder,
58
- "aria-label": I.placeholder
59
- }), /* @__PURE__ */ y(a, {
60
- className: m("ttw:max-h-72", C),
61
- children: [
62
- D ? /* @__PURE__ */ y("div", {
63
- className: "ttw:flex ttw:flex-col ttw:gap-2 ttw:p-2",
64
- "aria-busy": "true",
65
- children: [/* @__PURE__ */ v("span", {
66
- className: "ttw:sr-only",
67
- children: I.loading
68
- }), Array.from({ length: S }).map((e, t) => /* @__PURE__ */ y("div", {
69
- className: "ttw:flex ttw:items-center ttw:justify-between ttw:gap-4 ttw:px-2 ttw:py-1.5",
70
- children: [/* @__PURE__ */ v(p, {
71
- height: 14,
72
- width: "55%"
73
- }), /* @__PURE__ */ v(p, {
74
- height: 14,
75
- width: "30%"
76
- })]
77
- }, t))]
78
- }) : E.length === 0 ? /* @__PURE__ */ v("div", {
79
- className: m("ttw:flex ttw:items-center ttw:justify-center ttw:py-6 ttw:text-center ttw:text-sm", C),
80
- children: I.emptyResults
81
- }) : /* @__PURE__ */ v(n, {
82
- heading: M,
83
- children: E.map((e, t) => /* @__PURE__ */ v(i, {
84
- value: `${e.name} ${e.email} ${t}`,
85
- onSelect: () => e.onSelect(),
86
- children: /* @__PURE__ */ y("div", {
87
- className: "ttw:flex ttw:min-w-0 ttw:flex-col",
88
- children: [/* @__PURE__ */ v("span", {
89
- className: "ttw:truncate ttw:text-foreground",
90
- children: e.name
91
- }), e.email ? /* @__PURE__ */ v("span", {
92
- className: "ttw:truncate ttw:text-xs ttw:text-muted-foreground",
93
- children: e.email
94
- }) : null]
95
- })
96
- }, `${e.name}:${e.email}:${t}`))
97
- }),
98
- /* @__PURE__ */ v(o, {}),
99
- /* @__PURE__ */ y(i, {
100
- value: "__add_vendor__",
101
- onSelect: O,
102
- className: "ttw:sticky ttw:bottom-0 ttw:bg-popover ttw:text-primary",
103
- children: [/* @__PURE__ */ v(x, { className: "ttw:size-4 ttw:text-primary" }), /* @__PURE__ */ y("div", {
54
+ children: [/* @__PURE__ */ y(r, {
55
+ value: T,
56
+ onValueChange: E,
57
+ placeholder: L.placeholder,
58
+ "aria-label": L.placeholder
59
+ }), /* @__PURE__ */ b(a, {
60
+ className: m("ttw:max-h-72", w),
61
+ children: [O ? /* @__PURE__ */ b("div", {
62
+ className: "ttw:flex ttw:flex-col ttw:gap-2 ttw:p-2",
63
+ "aria-busy": "true",
64
+ children: [/* @__PURE__ */ y("span", {
65
+ className: "ttw:sr-only",
66
+ children: L.loading
67
+ }), Array.from({ length: C }).map((e, t) => /* @__PURE__ */ b("div", {
68
+ className: "ttw:flex ttw:items-center ttw:justify-between ttw:gap-4 ttw:px-2 ttw:py-1.5",
69
+ children: [/* @__PURE__ */ y(p, {
70
+ height: 14,
71
+ width: "55%"
72
+ }), /* @__PURE__ */ y(p, {
73
+ height: 14,
74
+ width: "30%"
75
+ })]
76
+ }, t))]
77
+ }) : D.length === 0 ? /* @__PURE__ */ y("div", {
78
+ className: m("ttw:flex ttw:items-center ttw:justify-center ttw:py-6 ttw:text-center ttw:text-sm", w),
79
+ children: L.emptyResults
80
+ }) : /* @__PURE__ */ y(n, {
81
+ heading: N,
82
+ children: D.map((e, t) => /* @__PURE__ */ y(i, {
83
+ value: `${e.name} ${e.email} ${t}`,
84
+ onSelect: () => e.onSelect(),
85
+ children: /* @__PURE__ */ b("div", {
104
86
  className: "ttw:flex ttw:min-w-0 ttw:flex-col",
105
- children: [/* @__PURE__ */ v("span", {
106
- className: "ttw:truncate",
107
- children: I.addVendorAction
108
- }), N ? /* @__PURE__ */ v("span", {
87
+ children: [/* @__PURE__ */ y("span", {
88
+ className: "ttw:truncate ttw:text-foreground",
89
+ children: e.name
90
+ }), e.email ? /* @__PURE__ */ y("span", {
109
91
  className: "ttw:truncate ttw:text-xs ttw:text-muted-foreground",
110
- children: N
92
+ children: e.email
111
93
  }) : null]
112
- })]
113
- })
114
- ]
94
+ })
95
+ }, `${e.name}:${e.email}:${t}`))
96
+ }), k ? /* @__PURE__ */ b(v, { children: [/* @__PURE__ */ y(o, {}), /* @__PURE__ */ b(i, {
97
+ value: "__add_vendor__",
98
+ onSelect: () => {
99
+ V(!1), k();
100
+ },
101
+ className: "ttw:sticky ttw:bottom-0 ttw:bg-popover ttw:text-primary",
102
+ children: [/* @__PURE__ */ y(S, { className: "ttw:size-4 ttw:text-primary" }), /* @__PURE__ */ b("div", {
103
+ className: "ttw:flex ttw:min-w-0 ttw:flex-col",
104
+ children: [/* @__PURE__ */ y("span", {
105
+ className: "ttw:truncate",
106
+ children: L.addVendorAction
107
+ }), P ? /* @__PURE__ */ y("span", {
108
+ className: "ttw:truncate ttw:text-xs ttw:text-muted-foreground",
109
+ children: P
110
+ }) : null]
111
+ })]
112
+ })] }) : null]
115
113
  })]
116
114
  })
117
115
  })]
118
116
  }),
119
- j ? /* @__PURE__ */ v(s, {
120
- id: R,
121
- children: j
117
+ M ? /* @__PURE__ */ y(s, {
118
+ id: z,
119
+ children: M
122
120
  }) : null
123
121
  ]
124
122
  });
125
123
  }
126
124
  //#endregion
127
- export { w as VendorSearchCombobox, w as default };
125
+ export { T as VendorSearchCombobox, T as default };
@@ -3,31 +3,31 @@
3
3
  "use client";
4
4
  "use client";
5
5
  import { extractApiErrorMessage as e } from "../../../../util/dist/lib/apiErrors.js";
6
- import { addressFormToCreatePayload as t, addressFormToUpdatePayload as n, addressResponseToFormValues as r, counterpartFormBankAccountToCreatePayload as i, counterpartFormBankAccountToUpdatePayload as ee, counterpartFormToCreatePayload as a, counterpartFormToUpdatePayload as o, counterpartToFormValues as s, emptyCounterpartFormValues as c, getAchInstructions as l, hasCounterpartFormAddressValues as u, hasCounterpartFormBankAccountValues as d, hasCounterpartFormErrors as f, resolveCounterpartBankAccountWrite as p, validateCounterpartForm as m, withoutUnchangedContactErrors as te } from "./helpers.js";
7
- import { useCreateCounterpartMutation as h, useUpdateCounterpartMutation as g } from "../../../data-access/dist/index3.js";
8
- import { useCreateCounterpartBankAccountMutation as _, useUpdateCounterpartBankAccountMutation as v } from "../../../data-access/dist/index5.js";
9
- import { useCreateCounterpartAddressMutation as y, useUpdateCounterpartAddressMutation as b } from "../../../data-access/dist/index7.js";
6
+ import { addressFormToCreatePayload as t, addressFormToUpdatePayload as n, addressResponseToFormValues as r, counterpartFormBankAccountToCreatePayload as i, counterpartFormBankAccountToUpdatePayload as a, counterpartFormToCreatePayload as o, counterpartFormToUpdatePayload as s, counterpartToFormValues as c, emptyCounterpartFormValues as l, getAchInstructions as u, hasCounterpartFormAddressValues as d, hasCounterpartFormBankAccountValues as f, hasCounterpartFormErrors as p, resolveCounterpartBankAccountWrite as ee, validateCounterpartForm as m, withoutUnchangedContactErrors as h } from "./helpers.js";
7
+ import { useCreateCounterpartMutation as g, useUpdateCounterpartMutation as _ } from "../../../data-access/dist/index3.js";
8
+ import { useCreateCounterpartBankAccountMutation as v, useUpdateCounterpartBankAccountMutation as y } from "../../../data-access/dist/index5.js";
9
+ import { useCreateCounterpartAddressMutation as b, useUpdateCounterpartAddressMutation as x } from "../../../data-access/dist/index7.js";
10
10
  import "../../../data-access/dist/index.js";
11
- import { useCallback as x, useState as S } from "react";
11
+ import { useCallback as S, useLayoutEffect as C, useState as w } 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 u(e);
13
+ function te(e, t) {
14
+ if (!t) return d(e);
15
15
  let n = r(t);
16
16
  return e.address.line1.trim() !== n.line1.trim() || e.address.line2.trim() !== n.line2.trim() || e.address.city.trim() !== n.city.trim() || e.address.state.trim() !== n.state.trim() || e.address.postalCode.trim() !== n.postalCode.trim();
17
17
  }
18
- function w(e) {
18
+ function T(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 d(e);
27
- let n = w(t);
25
+ function ne(e, t) {
26
+ if (!t) return f(e);
27
+ let n = T(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 E(e, t) {
30
+ function re(e, t) {
31
31
  let n = { ...e };
32
32
  if ([
33
33
  "legalName",
@@ -52,148 +52,146 @@ function E(e, t) {
52
52
  }
53
53
  return JSON.stringify(n) === JSON.stringify(e) ? e : n;
54
54
  }
55
- function D({ view: r, setView: D, selectedId: O, setSelectedId: k, messages: A, counterpartType: j, counterpart: M, primaryAddress: N, bankAccounts: P, isBankAccountsLoading: F, isBankAccountsError: I, includeBankAccount: L = !0 }) {
56
- let R = j === "vendor" && L, z = h(), B = y(), V = _(), H = g(), U = b(), W = v(), [G, K] = S(() => c()), [q, J] = S({}), [ne, Y] = S({
55
+ function E({ view: r, setView: E, selectedId: D, setSelectedId: O, messages: k, counterpartType: A, counterpart: j, primaryAddress: M, bankAccounts: N, isBankAccountsLoading: P, isBankAccountsError: F, includeBankAccount: I = !0 }) {
56
+ let L = A === "vendor" && I, R = g(), z = b(), B = v(), V = _(), H = x(), U = y(), [W, G] = w(() => l()), [ie, K] = w({}), [ae, q] = w({
57
57
  address: !1,
58
58
  bankAccount: !1
59
- }), [X, Z] = S(), [Q, $] = S(), re = z.isPending || B.isPending || V.isPending || W.isPending || H.isPending || U.isPending, ie = x(() => {
60
- k(void 0), $(void 0), Z(void 0), Y({
61
- address: j === "vendor",
59
+ }), [J, Y] = w(), [X, Z] = w(), oe = R.isPending || z.isPending || B.isPending || U.isPending || V.isPending || H.isPending, se = S(() => {
60
+ O(void 0), Z(void 0), Y(void 0), q({
61
+ address: A === "vendor",
62
62
  bankAccount: !1
63
- }), K(c("organization", j)), J({}), D("create");
63
+ }), G(l("organization", A)), K({}), E("create");
64
64
  }, [
65
- j,
66
- k,
67
- D
68
- ]), ae = x(() => {
69
- if (!M || R && (F || I)) return;
70
- let e = R ? l(P) : void 0, t = s(M, N);
71
- $(void 0), Z(e?.id), Y({
72
- address: u(t),
65
+ A,
66
+ O,
67
+ E
68
+ ]), ce = S(() => {
69
+ if (!j || L && (P || F)) return;
70
+ let e = L ? u(N) : void 0, t = c(j, M);
71
+ Z(void 0), Y(e?.id), q({
72
+ address: d(t),
73
73
  bankAccount: !1
74
- }), K({
74
+ }), G({
75
75
  ...t,
76
- ...e ? { bankAccount: w(e) } : {}
77
- }), J({}), D("edit");
76
+ ...e ? { bankAccount: T(e) } : {}
77
+ }), K({}), E("edit");
78
78
  }, [
79
+ N,
80
+ j,
81
+ F,
79
82
  P,
80
83
  M,
81
- I,
82
- F,
83
- N,
84
- D,
85
- R
86
- ]), oe = x(() => {
87
- D("none");
88
- }, [D]), se = x(() => {
89
- Y((e) => ({
84
+ E,
85
+ L
86
+ ]), le = S(() => {
87
+ E("none");
88
+ }, [E]), ue = S(() => {
89
+ q((e) => ({
90
90
  ...e,
91
91
  address: !0
92
92
  }));
93
- }, []), ce = x((e) => {
94
- K((t) => {
95
- let n = typeof e == "function" ? e(t) : e;
96
- return J((e) => f(e) ? E(e, m(n, r === "edit" ? "edit" : "create", A, j, r === "edit" && R && !!X)) : e), n;
97
- });
93
+ }, []), [Q, $] = w(!1), de = S(() => $(!0), []);
94
+ return C(() => {
95
+ let e = r === "edit" ? "edit" : "create", t = m(W, e, k, A, e === "edit" && L && !!J);
96
+ if (Q) {
97
+ $(!1), K(t);
98
+ return;
99
+ }
100
+ K((e) => p(e) ? re(e, t) : e);
98
101
  }, [
99
- X,
100
- j,
102
+ J,
101
103
  A,
104
+ Q,
105
+ k,
106
+ W,
102
107
  r,
103
- R
104
- ]), le = x(() => {
105
- K((e) => (J(m(e, r === "edit" ? "edit" : "create", A, j)), e));
106
- }, [
107
- j,
108
- A,
109
- r
110
- ]);
111
- return {
112
- values: G,
113
- errors: q,
114
- setValues: ce,
115
- isSubmitting: re,
116
- sectionsToExpand: ne,
117
- expandAddress: se,
118
- openCreate: ie,
119
- openEdit: ae,
120
- close: oe,
121
- submit: x(async () => {
122
- let c = r === "edit" ? "edit" : "create", h = te(m(G, c, A, j, c === "edit" && R && !!X), G, c === "edit" && M ? s(M, N) : void 0);
123
- if (f(h)) return J(h), Y((e) => ({
124
- address: e.address || !!h.address,
125
- bankAccount: e.bankAccount || !!h.bankAccount
108
+ L
109
+ ]), {
110
+ values: W,
111
+ errors: ie,
112
+ setValues: G,
113
+ isSubmitting: oe,
114
+ sectionsToExpand: ae,
115
+ expandAddress: ue,
116
+ openCreate: se,
117
+ openEdit: ce,
118
+ close: le,
119
+ submit: S(async () => {
120
+ let l = r === "edit" ? "edit" : "create", g = h(m(W, l, k, A, l === "edit" && L && !!J), W, l === "edit" && j ? c(j, M) : void 0);
121
+ if (p(g)) return K(g), q((e) => ({
122
+ address: e.address || !!g.address,
123
+ bankAccount: e.bankAccount || !!g.bankAccount
126
124
  })), { ok: !1 };
127
- J({}), Y({
125
+ K({}), q({
128
126
  address: !1,
129
127
  bankAccount: !1
130
128
  });
131
- let g = Q;
129
+ let _ = X;
132
130
  try {
133
- if (r === "edit" && O) {
134
- $(void 0), await H.mutateAsync({
135
- path: { counterpart_id: O },
136
- body: o(G, j)
131
+ if (r === "edit" && D) {
132
+ Z(void 0), await V.mutateAsync({
133
+ path: { counterpart_id: D },
134
+ body: s(W, A)
137
135
  });
138
- let e = N ? C(G, N) ? U.mutateAsync({
136
+ let e = M ? te(W, M) ? H.mutateAsync({
139
137
  path: {
140
- counterpart_id: O,
141
- address_id: N.id
138
+ counterpart_id: D,
139
+ address_id: M.id
142
140
  },
143
- body: n(G.address)
144
- }) : void 0 : u(G) ? B.mutateAsync({
145
- path: { counterpart_id: O },
146
- body: t(G.address)
147
- }) : void 0, r = R && T(G, l(P)) ? p(P, X) : void 0, a = r?.kind === "update" ? W.mutateAsync({
141
+ body: n(W.address)
142
+ }) : void 0 : d(W) ? z.mutateAsync({
143
+ path: { counterpart_id: D },
144
+ body: t(W.address)
145
+ }) : void 0, r = L && ne(W, u(N)) ? ee(N, J) : void 0, o = r?.kind === "update" ? U.mutateAsync({
148
146
  path: {
149
- counterpart_id: O,
147
+ counterpart_id: D,
150
148
  bank_account_id: r.bankAccountId
151
149
  },
152
- body: ee(G.bankAccount, { includeAchDefaults: r.includeAchDefaults })
153
- }) : r?.kind === "create" ? V.mutateAsync({
154
- path: { counterpart_id: O },
155
- body: i(G.bankAccount, { isDefaultForCurrency: r.isDefaultForCurrency })
156
- }) : void 0, [s, c] = await Promise.allSettled([e, a]);
157
- if (r?.kind === "create" && c.status === "fulfilled" && Z(c.value?.id), s.status === "rejected") throw s.reason;
158
- if (c.status === "rejected") throw c.reason;
159
- return D("none"), {
150
+ body: a(W.bankAccount, { includeAchDefaults: r.includeAchDefaults })
151
+ }) : r?.kind === "create" ? B.mutateAsync({
152
+ path: { counterpart_id: D },
153
+ body: i(W.bankAccount, { isDefaultForCurrency: r.isDefaultForCurrency })
154
+ }) : void 0, [c, l] = await Promise.allSettled([e, o]);
155
+ if (r?.kind === "create" && l.status === "fulfilled" && Y(l.value?.id), c.status === "rejected") throw c.reason;
156
+ if (l.status === "rejected") throw l.reason;
157
+ return E("none"), {
160
158
  ok: !0,
161
- counterpartId: O
159
+ counterpartId: D
162
160
  };
163
161
  }
164
- return g ||= (await z.mutateAsync({ body: a(G, j) }))?.id, g && R && d(G) && ($(g), await V.mutateAsync({
165
- path: { counterpart_id: g },
166
- body: i(G.bankAccount)
167
- })), $(void 0), D("none"), g && k(g), {
162
+ return _ ||= (await R.mutateAsync({ body: o(W, A) }))?.id, _ && L && f(W) && (Z(_), await B.mutateAsync({
163
+ path: { counterpart_id: _ },
164
+ body: i(W.bankAccount)
165
+ })), Z(void 0), E("none"), _ && O(_), {
168
166
  ok: !0,
169
- counterpartId: g
167
+ counterpartId: _
170
168
  };
171
169
  } catch (t) {
172
- return g && ($(g), k(g)), J({ form: e(t) ?? A.genericError }), { ok: !1 };
170
+ return _ && (Z(_), O(_)), K({ form: e(t) ?? k.genericError }), { ok: !1 };
173
171
  }
174
172
  }, [
175
173
  r,
176
- G,
177
- O,
178
- Q,
174
+ W,
175
+ D,
176
+ X,
177
+ k,
179
178
  A,
180
179
  j,
181
180
  M,
182
181
  N,
183
- P,
184
- X,
185
- B,
186
- V,
182
+ J,
187
183
  z,
188
- U,
189
- W,
184
+ B,
185
+ R,
190
186
  H,
191
- D,
192
- k,
193
- R
187
+ U,
188
+ V,
189
+ E,
190
+ O,
191
+ L
194
192
  ]),
195
- revealErrors: le
193
+ revealErrors: de
196
194
  };
197
195
  }
198
196
  //#endregion
199
- export { D as useCounterpartForm };
197
+ export { E as useCounterpartForm };
@@ -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.295", n = "39bfa1177515d639e75bfc53d233e90bc22c66c6", r = Object.freeze({
2
+ var e = "@tesouro/embedded-components-react", t = "0.5.296", n = "6b18e8f6b106c920f597e3837fcd53571fcb5b9a", 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.295",
3
+ "version": "0.5.296",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": [