@tesouro/embedded-components-react 0.4.15 → 0.4.17

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 (125) hide show
  1. package/dist/index.css +39 -2
  2. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index.js +5 -4
  3. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index14.js +47 -21
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index15.js +22 -77
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index16.js +75 -24
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index17.js +36 -0
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js +63 -43
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +1 -1
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +2 -2
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +2 -2
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +64 -48
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index4.js +2 -1
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +10 -2
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +1 -1
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +141 -118
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +93 -93
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +83 -67
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +235 -218
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +1 -1
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +5 -5
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +19 -12
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +1 -0
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +42 -24
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +1 -1
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +1 -1
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js +17 -17
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index77.js +1 -1
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index78.js +1 -1
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index81.js +2 -2
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +2 -2
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +39 -39
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index100.js +2 -10
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index101.js +8 -50
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index102.js +52 -2
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index103.js +2 -0
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index16.js +1 -0
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index17.js +7 -7
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index25.js +26 -49
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index26.js +19 -306
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index27.js +154 -2
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index28.js +2 -9
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index29.js +60 -45
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index30.js +251 -1
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index31.js +2 -18
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index32.js +7 -48
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index33.js +49 -2
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index34.js +2 -23
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index35.js +15 -337
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index36.js +50 -2
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index37.js +2 -16
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index38.js +21 -118
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index39.js +340 -2
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index40.js +2 -12
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index41.js +10 -97
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index42.js +99 -2
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index43.js +1 -12
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index44.js +11 -57
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index45.js +58 -1
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index46.js +1 -54
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index47.js +52 -10
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index48.js +10 -179
  62. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index49.js +181 -1
  63. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index50.js +2 -4
  64. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index51.js +2 -39
  65. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index52.js +41 -2
  66. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index53.js +2 -7
  67. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index54.js +5 -90
  68. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index55.js +92 -2
  69. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index56.js +2 -4
  70. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index57.js +2 -14
  71. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index58.js +16 -2
  72. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index59.js +1 -87
  73. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index60.js +83 -291
  74. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index61.js +292 -9
  75. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index62.js +13 -1
  76. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index63.js +1 -8
  77. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index64.js +6 -37
  78. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index65.js +39 -2
  79. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index66.js +2 -39
  80. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index67.js +36 -9
  81. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index68.js +10 -199
  82. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index69.js +201 -3
  83. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index70.js +3 -17
  84. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index71.js +15 -345
  85. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index72.js +345 -8
  86. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index73.js +6 -4
  87. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index74.js +7 -91
  88. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index75.js +93 -0
  89. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index77.js +2 -127
  90. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index78.js +122 -25
  91. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index79.js +26 -87
  92. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index80.js +94 -2
  93. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index81.js +2 -7
  94. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index82.js +5 -28
  95. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index83.js +30 -2
  96. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index84.js +2 -7
  97. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index85.js +5 -32
  98. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index86.js +34 -2
  99. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index87.js +2 -12
  100. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index88.js +10 -104
  101. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index89.js +105 -1
  102. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index90.js +2 -17
  103. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index91.js +15 -123
  104. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index92.js +125 -2
  105. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index93.js +2 -18
  106. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index94.js +14 -6
  107. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index95.js +7 -167
  108. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index96.js +170 -2
  109. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index97.js +2 -14
  110. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index98.js +11 -105
  111. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index99.js +108 -2
  112. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/index4.js +8 -8
  113. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index9.js +4 -4
  114. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/data-access/dist/index.js +5 -5
  115. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/index.js +19 -19
  116. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/helpers.js +39 -33
  117. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/subEntityForms.js +15 -15
  118. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useAddressForm.js +9 -9
  119. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useCounterpartDetails.js +7 -7
  120. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useCounterpartForm.js +37 -37
  121. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useCounterpartSelector.js +15 -15
  122. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/usePayableAchInstructions.js +7 -7
  123. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  124. package/package.json +1 -1
  125. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index76.js +0 -2
@@ -2,92 +2,92 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { usePayableSuggestionsQuery as e } from "../../data-access/dist/index16.js";
5
+ import { useCounterpartsQuery as e } from "../../../shared/counterpart-management/data-access/dist/index3.js";
6
+ import { useCreateCounterpartBankAccountMutation as t, useUpdateCounterpartBankAccountMutation as n } from "../../../shared/counterpart-management/data-access/dist/index5.js";
7
+ import { usePayableSuggestionsQuery as r } from "../../data-access/dist/index17.js";
6
8
  import "../../data-access/dist/index.js";
7
- import { maskAccountNumber as t } from "./index21.js";
8
- import { counterpartFormBankAccountToCreatePayload as n, counterpartFormBankAccountToUpdatePayload as ee, getAchInstructions as r, getCounterpartEmail as i, getCounterpartName as a, getPayableAchInstructions as o, hasAchFormValues as s, resolveCounterpartBankAccountWrite as c, validateAchFormValues as te } from "../../../shared/counterpart-management/feature/dist/lib/helpers.js";
9
- import { useCounterpartsQuery as ne } from "../../../shared/counterpart-management/data-access/dist/index3.js";
10
- import { useCreateCounterpartBankAccountMutation as re, useUpdateCounterpartBankAccountMutation as ie } from "../../../shared/counterpart-management/data-access/dist/index5.js";
9
+ import { maskAccountNumber as ee } from "./index21.js";
10
+ import { counterpartFormBankAccountToCreatePayload as i, counterpartFormBankAccountToUpdatePayload as te, getAchInstructions as ne, getCounterpartEmail as a, getCounterpartName as o, getPayableAchInstructions as s, hasAchFormValues as c, resolveCounterpartBankAccountWrite as re, validateAchFormValues as ie } from "../../../shared/counterpart-management/feature/dist/lib/helpers.js";
11
11
  import { useCounterpartDetails as ae } from "../../../shared/counterpart-management/feature/dist/lib/useCounterpartDetails.js";
12
12
  import "../../../shared/counterpart-management/feature/dist/index.js";
13
13
  import { VENDOR_SECTION_PROPS_LABELS_EN as oe } from "./index43.js";
14
14
  import { buildVendorPrefill as se } from "./index45.js";
15
15
  import { VendorInlineForm as ce } from "./index46.js";
16
16
  import { useCallback as l, useEffect as u, useMemo as d, useRef as f, useState as p } from "react";
17
- import { jsx as le } from "react/jsx-runtime";
17
+ import { jsx as m } from "react/jsx-runtime";
18
18
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js
19
- var m = 10, ue = 300, h = {
19
+ var h = 10, le = 300, g = {
20
20
  accountHolderName: "",
21
21
  routingNumber: "",
22
22
  accountNumber: ""
23
23
  };
24
- function g({ payableId: g, counterpartId: _, payableCounterpartId: v, payableCounterpartBankAccountId: y, onCounterpartChange: b, requiredError: de, extractedVendor: x, labels: fe }) {
25
- let S = {
24
+ function _({ payableId: _, counterpartId: v, payableCounterpartId: y, payableCounterpartBankAccountId: b, onCounterpartChange: x, requiredError: S, extractedVendor: C, labels: ue }) {
25
+ let w = {
26
26
  ...oe,
27
- ...fe
28
- }, [C, w] = p(""), [T, E] = p(""), [D, O] = p(), [pe, k] = p(!1), [A, j] = p(h), M = f(A);
29
- M.current = A;
30
- let [N, P] = p(!1), F = s(A) || N, [I, L] = p(), [R, z] = p(), B = f(_), [V, me] = p(!1), H = l(() => {
31
- k(!1), j(h), L(void 0), z(void 0);
27
+ ...ue
28
+ }, [T, E] = p(""), [D, de] = p(""), [O, k] = p(), [fe, A] = p(!1), [j, M] = p(g), N = f(j);
29
+ N.current = j;
30
+ let [pe, P] = p(!1), F = c(j) || pe, [I, L] = p(), [R, z] = p(), B = f(v), [V, me] = p(!1), H = l(() => {
31
+ A(!1), M(g), L(void 0), z(void 0);
32
32
  }, []), U = l((e) => {
33
- me(!0), b(e);
34
- }, [b]), W = e(g, { enabled: !!g && !_ && !v }).data?.suggested_counterpart?.id;
33
+ me(!0), x(e);
34
+ }, [x]), W = r(_, { enabled: !!_ && !v && !y }).data?.suggested_counterpart?.id;
35
35
  u(() => {
36
- !V && !_ && !v && W && U(W);
36
+ !V && !v && !y && W && U(W);
37
37
  }, [
38
- _,
39
38
  v,
39
+ y,
40
40
  V,
41
41
  W,
42
42
  U
43
43
  ]), u(() => {
44
- B.current !== _ && (B.current = _, H());
45
- }, [_, H]), u(() => {
44
+ B.current !== v && (B.current = v, H());
45
+ }, [v, H]), u(() => {
46
46
  let e = setTimeout(() => {
47
- E(C.trim());
48
- }, ue);
47
+ de(T.trim());
48
+ }, le);
49
49
  return () => clearTimeout(e);
50
- }, [C]);
51
- let G = ne({
50
+ }, [T]);
51
+ let G = e({
52
52
  sort: "counterpart_name",
53
53
  order: "asc",
54
- limit: m,
55
- counterpart_name__icontains: T || void 0,
54
+ limit: h,
55
+ counterpart_name__icontains: D || void 0,
56
56
  is_vendor: !0,
57
- enabled: !!T
58
- }), K = ae({ selectedId: _ }), q = re(), J = ie(), Y = d(() => {
57
+ enabled: !!D
58
+ }), K = ae({ selectedId: v }), q = t(), J = n(), Y = d(() => {
59
59
  let e = K.counterpart;
60
60
  if (!e) return;
61
61
  if (K.isBankAccountsLoading) return {
62
- name: a(e),
63
- email: i(e),
64
- methodLabel: S.paymentMethodLoading,
62
+ name: o(e),
63
+ email: a(e),
64
+ methodLabel: w.paymentMethodLoading,
65
65
  fields: []
66
66
  };
67
67
  if (K.isBankAccountsError) return {
68
- name: a(e),
69
- email: i(e),
70
- methodLabel: S.paymentMethodUnavailable,
68
+ name: o(e),
69
+ email: a(e),
70
+ methodLabel: w.paymentMethodUnavailable,
71
71
  fields: []
72
72
  };
73
- let n = o(K.bankAccounts);
73
+ let t = s(K.bankAccounts);
74
74
  return {
75
- name: a(e),
76
- email: i(e),
77
- methodLabel: n ? S.achMethod : S.noMethod,
78
- fields: n ? [
75
+ name: o(e),
76
+ email: a(e),
77
+ methodLabel: t ? w.achMethod : w.noMethod,
78
+ fields: t ? [
79
79
  {
80
- label: S.accountHolder,
81
- value: n.account_holder_name ?? ""
80
+ label: w.accountHolder,
81
+ value: t.account_holder_name ?? ""
82
82
  },
83
83
  {
84
- label: S.routingNumber,
85
- value: n.routing_number ?? ""
84
+ label: w.routingNumber,
85
+ value: t.routing_number ?? ""
86
86
  },
87
87
  {
88
- label: S.accountNumber,
89
- value: n.account_number ?? "",
90
- maskedValue: n.account_number ? t(n.account_number) : ""
88
+ label: w.accountNumber,
89
+ value: t.account_number ?? "",
90
+ maskedValue: t.account_number ? ee(t.account_number) : ""
91
91
  }
92
92
  ] : []
93
93
  };
@@ -96,43 +96,43 @@ function g({ payableId: g, counterpartId: _, payableCounterpartId: v, payableCou
96
96
  K.counterpart,
97
97
  K.isBankAccountsError,
98
98
  K.isBankAccountsLoading,
99
- S
100
- ]), X = d(() => r(K.bankAccounts), [K.bankAccounts]), Z = d(() => o(K.bankAccounts)?.id, [K.bankAccounts]), Q = l(async () => {
101
- let e = M.current;
102
- if (!_) return { ok: !0 };
103
- if (!s(e)) return y && _ === v ? {
99
+ w
100
+ ]), X = d(() => ne(K.bankAccounts), [K.bankAccounts]), Z = d(() => s(K.bankAccounts)?.id, [K.bankAccounts]), Q = l(async () => {
101
+ let e = N.current;
102
+ if (!v) return { ok: !0 };
103
+ if (!c(e)) return b && v === y ? {
104
104
  ok: !0,
105
- counterpartBankAccountId: y
105
+ counterpartBankAccountId: b
106
106
  } : K.isBankAccountsLoading || K.isBankAccountsFetching || K.isBankAccountsError ? { ok: !1 } : {
107
107
  ok: !0,
108
108
  counterpartBankAccountId: Z
109
109
  };
110
110
  if (K.isBankAccountsLoading || K.isBankAccountsFetching || K.isBankAccountsError) return { ok: !1 };
111
- let t = te(e);
112
- if (Object.keys(t).length > 0) return L(t), k(!0), { ok: !1 };
111
+ let t = ie(e);
112
+ if (Object.keys(t).length > 0) return L(t), A(!0), { ok: !1 };
113
113
  L(void 0);
114
- let r = c(K.bankAccounts, R ?? X?.id);
115
- if (r.kind === "update") return await J.mutateAsync({
114
+ let n = re(K.bankAccounts, R ?? X?.id);
115
+ if (n.kind === "update") return await J.mutateAsync({
116
116
  path: {
117
- counterpart_id: _,
118
- bank_account_id: r.bankAccountId
117
+ counterpart_id: v,
118
+ bank_account_id: n.bankAccountId
119
119
  },
120
- body: ee(e, { includeAchDefaults: r.includeAchDefaults })
121
- }), z(r.bankAccountId), {
120
+ body: te(e, { includeAchDefaults: n.includeAchDefaults })
121
+ }), z(n.bankAccountId), {
122
122
  ok: !0,
123
- counterpartBankAccountId: r.bankAccountId
123
+ counterpartBankAccountId: n.bankAccountId
124
124
  };
125
- let i = await q.mutateAsync({
126
- path: { counterpart_id: _ },
127
- body: n(e, { isDefaultForCurrency: r.isDefaultForCurrency })
125
+ let r = await q.mutateAsync({
126
+ path: { counterpart_id: v },
127
+ body: i(e, { isDefaultForCurrency: n.isDefaultForCurrency })
128
128
  });
129
- return z(i?.id), {
129
+ return z(r?.id), {
130
130
  ok: !0,
131
- counterpartBankAccountId: i?.id
131
+ counterpartBankAccountId: r?.id
132
132
  };
133
133
  }, [
134
134
  X,
135
- _,
135
+ v,
136
136
  q,
137
137
  K.bankAccounts,
138
138
  K.isBankAccountsError,
@@ -140,29 +140,29 @@ function g({ payableId: g, counterpartId: _, payableCounterpartId: v, payableCou
140
140
  K.isBankAccountsLoading,
141
141
  R,
142
142
  Z,
143
+ b,
143
144
  y,
144
- v,
145
145
  J
146
146
  ]), he = d(() => (G.data?.data ?? []).map((e) => ({
147
- name: a(e),
148
- email: i(e),
147
+ name: o(e),
148
+ email: a(e),
149
149
  onSelect: () => U(e.id)
150
- })), [G.data, U]), ge = d(() => se(x), [x]), $ = l(() => {
151
- O(void 0), P(!1);
150
+ })), [G.data, U]), ge = d(() => se(C), [C]), $ = l(() => {
151
+ k(void 0), P(!1);
152
152
  }, []), _e = l((e) => {
153
- O(void 0), P(!1), U(e);
153
+ k(void 0), P(!1), U(e);
154
154
  }, [U]);
155
- if (D) return {
155
+ if (O) return {
156
156
  mode: "creating",
157
- newVendorForm: /* @__PURE__ */ le(ce, {
158
- mode: D,
159
- counterpart: D === "edit" ? K.counterpart : void 0,
160
- primaryAddress: D === "edit" ? K.primaryAddress : void 0,
161
- bankAccounts: D === "edit" ? K.bankAccounts : void 0,
162
- isBankAccountsLoading: D === "edit" ? K.isBankAccountsLoading : void 0,
163
- isBankAccountsError: D === "edit" ? K.isBankAccountsError : void 0,
164
- initialName: D === "create" ? C : void 0,
165
- initialValues: D === "create" ? ge : void 0,
157
+ newVendorForm: /* @__PURE__ */ m(ce, {
158
+ mode: O,
159
+ counterpart: O === "edit" ? K.counterpart : void 0,
160
+ primaryAddress: O === "edit" ? K.primaryAddress : void 0,
161
+ bankAccounts: O === "edit" ? K.bankAccounts : void 0,
162
+ isBankAccountsLoading: O === "edit" ? K.isBankAccountsLoading : void 0,
163
+ isBankAccountsError: O === "edit" ? K.isBankAccountsError : void 0,
164
+ initialName: O === "create" ? T : void 0,
165
+ initialValues: O === "create" ? ge : void 0,
166
166
  onSaved: _e,
167
167
  onCancel: $,
168
168
  onDirtyChange: P
@@ -175,21 +175,21 @@ function g({ payableId: g, counterpartId: _, payableCounterpartId: v, payableCou
175
175
  return {
176
176
  mode: "resolved",
177
177
  summary: Y,
178
- onEdit: e ? void 0 : () => O("edit"),
178
+ onEdit: e ? void 0 : () => k("edit"),
179
179
  onClear: () => U(void 0),
180
180
  paymentInstructions: e ? void 0 : {
181
- isOpen: pe,
182
- values: A,
181
+ isOpen: fe,
182
+ values: j,
183
183
  errors: I,
184
184
  onOpen: () => {
185
- k(!0), X && (j({
185
+ A(!0), X && (M({
186
186
  accountHolderName: X.account_holder_name ?? "",
187
187
  routingNumber: X.routing_number ?? "",
188
188
  accountNumber: X.account_number ?? ""
189
189
  }), z(X.id));
190
190
  },
191
191
  onChange: (e) => {
192
- j((t) => ({
192
+ M((t) => ({
193
193
  ...t,
194
194
  ...e
195
195
  })), L(void 0);
@@ -201,12 +201,12 @@ function g({ payableId: g, counterpartId: _, payableCounterpartId: v, payableCou
201
201
  }
202
202
  return {
203
203
  mode: "selecting",
204
- error: G.isError ? S.searchFailed : K.isError ? S.vendorDetailsFailed : de,
204
+ error: G.isError ? w.searchFailed : K.isError ? w.vendorDetailsFailed : S,
205
205
  search: {
206
- query: C,
207
- onQueryChange: w,
206
+ query: T,
207
+ onQueryChange: E,
208
208
  isLoading: G.isLoading,
209
- onAddVendor: () => O("create"),
209
+ onAddVendor: () => k("create"),
210
210
  results: he
211
211
  },
212
212
  savePaymentInstructions: Q,
@@ -214,4 +214,4 @@ function g({ payableId: g, counterpartId: _, payableCounterpartId: v, payableCou
214
214
  };
215
215
  }
216
216
  //#endregion
217
- export { g as useVendorSectionProps };
217
+ export { _ as useVendorSectionProps };
@@ -5,104 +5,120 @@
5
5
  import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
6
  import "../../../shared/ui/dist/index.js";
7
7
  import { useUpdatePayableMutation as t } from "../../data-access/dist/index13.js";
8
+ import { useCounterpartBankAccountsQuery as n, useCreateCounterpartBankAccountMutation as r } from "../../../shared/counterpart-management/data-access/dist/index5.js";
9
+ import { useUpdatePayableCounterpartBankAccountMutation as i } from "../../data-access/dist/index14.js";
8
10
  import "../../data-access/dist/index.js";
9
- import { counterpartFormBankAccountToCreatePayload as n, counterpartFormBankAccountToUpdatePayload as r, getAchInstructions as i, resolveCounterpartBankAccountWrite as a, validateAchFormValues as o } from "../../../shared/counterpart-management/feature/dist/lib/helpers.js";
10
- import { useCounterpartBankAccountsQuery as s, useCreateCounterpartBankAccountMutation as c, useUpdateCounterpartBankAccountMutation as l } from "../../../shared/counterpart-management/data-access/dist/index5.js";
11
+ import { counterpartFormBankAccountToCreatePayload as a, counterpartFormBankAccountToUpdatePayload as o, getAchInstructions as s, isAchCompatibleBankAccount as c, resolveCounterpartBankAccountWrite as l, validateAchFormValues as u } from "../../../shared/counterpart-management/feature/dist/lib/helpers.js";
11
12
  import "../../../shared/counterpart-management/feature/dist/index.js";
12
- import { useCallback as u, useEffect as d, useRef as f, useState as p } from "react";
13
+ import { useCallback as d, useEffect as f, useRef as p, useState as m } from "react";
13
14
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js
14
- var m = {
15
+ var h = {
15
16
  accountHolderName: "",
16
17
  routingNumber: "",
17
18
  accountNumber: ""
18
19
  };
19
- function h({ payableId: h, counterpartId: g, saveErrorMessage: _, linkErrorMessage: v }) {
20
- let [y, b] = p(!1), [x, S] = p(m), [C, w] = p(), T = s(g), E = T.data?.data, D = c(), O = l(), k = t(), A = f(void 0), j = f(!1);
21
- d(() => {
22
- A.current = void 0;
23
- }, [g]);
24
- let M = u(() => {
25
- let e = T.isFetching ? void 0 : i(E);
26
- S(e ? {
20
+ function g(e, t) {
21
+ return e?.find((e) => e.id === t && c(e)) ?? s(e);
22
+ }
23
+ function _({ payableId: c, counterpartId: _, currentBankAccountId: v, canReadCounterpartBankAccounts: y = !0, saveErrorMessage: b, linkErrorMessage: x }) {
24
+ let [S, C] = m(!1), [w, T] = m(h), [E, D] = m(), O = n(_, { enabled: y }), k = O.data?.data, A = r(), j = i(), M = t(), N = p(void 0), P = p(!1);
25
+ f(() => {
26
+ N.current = void 0;
27
+ }, [_, c]);
28
+ let F = d(() => {
29
+ if (S) return;
30
+ let e = O.isFetching ? void 0 : g(k, v);
31
+ T(e ? {
27
32
  accountHolderName: e.account_holder_name ?? "",
28
33
  routingNumber: e.routing_number ?? "",
29
34
  accountNumber: e.account_number ?? ""
30
- } : m), A.current = e?.id ?? A.current, j.current = !T.isFetching, w(void 0), b(!0);
31
- }, [E, T.isFetching]);
32
- d(() => {
33
- if (!y || j.current || T.isFetching) return;
34
- j.current = !0;
35
- let e = i(E);
36
- e && (S((t) => t.accountHolderName === "" && t.routingNumber === "" && t.accountNumber === "" ? {
35
+ } : h), N.current = e?.id ?? N.current, P.current = !O.isFetching, D(void 0), C(!0);
36
+ }, [
37
+ k,
38
+ O.isFetching,
39
+ v,
40
+ S
41
+ ]);
42
+ f(() => {
43
+ if (!S || P.current || O.isFetching) return;
44
+ P.current = !0;
45
+ let e = g(k, v);
46
+ e && (T((t) => t.accountHolderName === "" && t.routingNumber === "" && t.accountNumber === "" ? {
37
47
  accountHolderName: e.account_holder_name ?? "",
38
48
  routingNumber: e.routing_number ?? "",
39
49
  accountNumber: e.account_number ?? ""
40
- } : t), A.current = e.id);
50
+ } : t), N.current = e.id);
41
51
  }, [
42
- y,
43
- T.isFetching,
44
- E
52
+ S,
53
+ O.isFetching,
54
+ k,
55
+ v,
56
+ y
45
57
  ]);
46
- let N = u(() => {
47
- b(!1);
48
- }, []), P = u((e) => {
49
- S((t) => ({
58
+ let I = d(() => {
59
+ C(!1);
60
+ }, []), L = d((e) => {
61
+ T((t) => ({
50
62
  ...t,
51
63
  ...e
52
64
  }));
53
- }, []), F = u(async () => {
54
- if (!h || !g) return !1;
55
- let t = o(x);
56
- if (Object.keys(t).length > 0) return w(t), !1;
57
- if (w(void 0), T.isFetching || T.isError) return e.error(_), !1;
58
- let s = A.current;
65
+ }, []), R = d(async () => {
66
+ if (!c || !_) return !1;
67
+ let t = u(w);
68
+ if (Object.keys(t).length > 0) return D(t), !1;
69
+ if (D(void 0), !y || O.isFetching || O.isError) return e.error(b), !1;
70
+ let n = N.current;
59
71
  try {
60
- let e = a(E, s ?? i(E)?.id);
61
- e.kind === "update" ? (await O.mutateAsync({
72
+ let e = l(k, n ?? s(k)?.id);
73
+ e.kind === "update" ? (await j.mutateAsync({
62
74
  path: {
63
- counterpart_id: g,
75
+ counterpart_id: _,
64
76
  bank_account_id: e.bankAccountId
65
77
  },
66
- body: r(x, { includeAchDefaults: e.includeAchDefaults })
67
- }), s = e.bankAccountId) : s = (await D.mutateAsync({
68
- path: { counterpart_id: g },
69
- body: n(x, { isDefaultForCurrency: e.isDefaultForCurrency })
70
- }))?.id, A.current = s;
78
+ body: o(w, { includeAchDefaults: e.includeAchDefaults }),
79
+ payableId: c,
80
+ makeDefault: e.includeAchDefaults || !k?.find((t) => t.id === e.bankAccountId)?.is_default_for_currency
81
+ }), n = e.bankAccountId) : n = (await A.mutateAsync({
82
+ path: { counterpart_id: _ },
83
+ body: a(w, { isDefaultForCurrency: e.isDefaultForCurrency })
84
+ }))?.id, N.current = n;
71
85
  } catch {
72
- return e.error(_), !1;
86
+ return e.error(b), !1;
73
87
  }
74
- try {
75
- await k.mutateAsync({
76
- path: { payable_id: h },
77
- body: { counterpart_bank_account_id: s }
88
+ if (n !== v) try {
89
+ await M.mutateAsync({
90
+ path: { payable_id: c },
91
+ body: { counterpart_bank_account_id: n }
78
92
  });
79
93
  } catch {
80
- return e.error(v), !1;
94
+ return e.error(x), !1;
81
95
  }
82
- return b(!1), !0;
96
+ return C(!1), !0;
83
97
  }, [
84
- E,
85
- T.isError,
86
- T.isFetching,
87
- g,
88
- D,
89
- v,
90
- h,
91
- _,
92
- O,
93
98
  k,
94
- x
99
+ O.isError,
100
+ O.isFetching,
101
+ y,
102
+ _,
103
+ A,
104
+ v,
105
+ x,
106
+ c,
107
+ b,
108
+ j,
109
+ M,
110
+ w
95
111
  ]);
96
112
  return {
97
- isOpen: y,
98
- values: x,
99
- errors: C,
100
- isSaving: D.isPending || O.isPending || k.isPending,
101
- open: M,
102
- close: N,
103
- onChange: P,
104
- save: F
113
+ isOpen: S,
114
+ values: w,
115
+ errors: E,
116
+ isSaving: A.isPending || j.isPending || M.isPending,
117
+ open: F,
118
+ close: I,
119
+ onChange: L,
120
+ save: R
105
121
  };
106
122
  }
107
123
  //#endregion
108
- export { h as usePaymentInstructionsForm };
124
+ export { _ as usePaymentInstructionsForm };