@tesouro/embedded-components-react 0.2.317 → 0.2.319

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 (136) hide show
  1. package/README.md +5 -4
  2. package/dist/index.css +9 -0
  3. package/dist/index.d.ts +4 -1
  4. package/dist/index.js +1 -1
  5. package/dist/lib/BillPayWidget.d.ts +4 -1
  6. package/dist/lib/BillPayWidget.js +1 -1
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index.js +10 -7
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index10.js +170 -32
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index11.js +13 -32
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index12.js +30 -0
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index13.js +50 -0
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index14.js +36 -0
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index3.js +11 -8
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index4.js +33 -16
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index5.js +47 -2
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index6.js +18 -63
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index7.js +40 -131
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index8.js +48 -11
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index9.js +30 -20
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +18 -16
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +29 -97
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js +1 -9
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +13 -109
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js +24 -4
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +30 -21
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +19 -46
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +49 -76
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +4 -45
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +73 -3
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +50 -2
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index2.js +4 -50
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +7 -43
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +38 -1
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +115 -31
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +56 -8
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +206 -16
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +195 -5
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +58 -64
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +46 -139
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +34 -5
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +155 -6
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index3.js +3 -60
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +36 -7
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +92 -73
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +9 -3
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +191 -6
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +4 -114
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +26 -1
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +78 -21
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +92 -0
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +3 -0
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +4 -0
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index4.js +5 -206
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +45 -0
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +1 -0
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +53 -0
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +11 -0
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +18 -0
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +8 -0
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +79 -0
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +148 -0
  62. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +5 -0
  63. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +8 -0
  64. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js +3 -197
  65. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +9 -0
  66. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +85 -0
  67. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +3 -0
  68. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +8 -0
  69. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +115 -0
  70. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +1 -0
  71. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +25 -0
  72. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +30 -41
  73. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +38 -30
  74. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +20 -151
  75. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +158 -31
  76. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +29 -17
  77. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index12.js +13 -7
  78. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index13.js +13 -47
  79. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index14.js +24 -2
  80. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index15.js +2 -22
  81. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index16.js +31 -283
  82. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index17.js +261 -1
  83. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index18.js +2 -16
  84. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index19.js +7 -118
  85. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index20.js +49 -2
  86. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index21.js +2 -10
  87. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index22.js +20 -94
  88. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index23.js +286 -2
  89. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index24.js +1 -12
  90. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index25.js +14 -56
  91. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index26.js +120 -2
  92. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index27.js +1 -19
  93. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index28.js +8 -157
  94. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index29.js +96 -2
  95. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index30.js +2 -7
  96. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index31.js +11 -42
  97. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index32.js +57 -1
  98. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index33.js +2 -14
  99. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index34.js +50 -20
  100. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index35.js +138 -1
  101. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index36.js +1 -54
  102. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index37.js +5 -227
  103. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index38.js +37 -188
  104. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index39.js +2 -10
  105. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index40.js +55 -5
  106. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index41.js +229 -84
  107. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index42.js +195 -0
  108. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index43.js +10 -2
  109. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index44.js +4 -3
  110. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index45.js +88 -25
  111. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index47.js +2 -14
  112. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index48.js +5 -87
  113. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index49.js +30 -2
  114. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index50.js +2 -0
  115. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index51.js +7 -0
  116. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index52.js +34 -0
  117. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index53.js +2 -0
  118. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index54.js +12 -0
  119. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index55.js +106 -0
  120. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index56.js +2 -0
  121. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index57.js +18 -0
  122. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index58.js +10 -0
  123. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index59.js +170 -0
  124. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index60.js +2 -0
  125. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index61.js +14 -0
  126. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index62.js +89 -0
  127. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index63.js +2 -0
  128. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +21 -21
  129. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +189 -156
  130. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +157 -97
  131. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/zod.gen.js +1834 -1819
  132. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/index.js +10 -10
  133. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  134. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index7.js +1 -1
  135. package/package.json +1 -1
  136. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index46.js +0 -2
@@ -1,8 +1,198 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { maskAccountNumber as e } from "./index5.js";
6
+ import { usePayableSuggestionsQuery as t } from "../../data-access/dist/index14.js";
7
+ import "../../data-access/dist/index.js";
8
+ import { VENDOR_SECTION_PROPS_LABELS_EN as n } from "./index22.js";
9
+ import { counterpartFormBankAccountToCreatePayload as ee, counterpartFormBankAccountToUpdatePayload as r, getAchInstructions as i, getCounterpartEmail as a, getCounterpartName as o, getPayableAchInstructions as s, hasAchFormValues as c, resolveCounterpartBankAccountWrite as te, validateAchFormValues as ne } from "../../../shared/counterpart-management/feature/dist/lib/helpers.js";
10
+ import { useCounterpartsQuery as re } from "../../../shared/counterpart-management/data-access/dist/index3.js";
11
+ import { useCreateCounterpartBankAccountMutation as ie, useUpdateCounterpartBankAccountMutation as l } from "../../../shared/counterpart-management/data-access/dist/index5.js";
12
+ import { useCounterpartDetails as ae } from "../../../shared/counterpart-management/feature/dist/lib/useCounterpartDetails.js";
13
+ import "../../../shared/counterpart-management/feature/dist/index.js";
14
+ import { VendorInlineForm as oe } from "./index24.js";
15
+ import { useCallback as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
16
+ import { jsx as h } from "react/jsx-runtime";
1
17
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js
2
- var e = {
3
- root: "bill-pay-bills-tab",
4
- uploadTray: "bill-pay-upload-tray",
5
- detailsSheet: "bill-pay-details-sheet"
18
+ var se = 10, ce = 300, g = {
19
+ accountHolderName: "",
20
+ routingNumber: "",
21
+ accountNumber: ""
6
22
  };
23
+ function _({ payableId: _, counterpartId: v, payableCounterpartId: y, onCounterpartChange: b, requiredError: x, labels: S }) {
24
+ let C = {
25
+ ...n,
26
+ ...S
27
+ }, [w, T] = m(""), [E, D] = m(""), [O, k] = m(), [le, A] = m(!1), [j, M] = m(g), N = p(j);
28
+ N.current = j;
29
+ let [ue, P] = m(!1), F = c(j) || ue, [I, L] = m(), [R, z] = m(), B = p(v), [V, H] = m(!1), U = u(() => {
30
+ A(!1), M(g), L(void 0), z(void 0);
31
+ }, []), W = u((e) => {
32
+ H(!0), b(e);
33
+ }, [b]), G = t(_, { enabled: !!_ && !v && !y }).data?.suggested_counterpart?.id;
34
+ d(() => {
35
+ !V && !v && !y && G && W(G);
36
+ }, [
37
+ v,
38
+ y,
39
+ V,
40
+ G,
41
+ W
42
+ ]), d(() => {
43
+ B.current !== v && (B.current = v, U());
44
+ }, [v, U]), d(() => {
45
+ let e = setTimeout(() => {
46
+ D(w.trim());
47
+ }, ce);
48
+ return () => clearTimeout(e);
49
+ }, [w]);
50
+ let K = re({
51
+ sort: "counterpart_name",
52
+ order: "asc",
53
+ limit: se,
54
+ counterpart_name__icontains: E || void 0,
55
+ is_vendor: !0,
56
+ enabled: !!E
57
+ }), q = ae({ selectedId: v }), J = ie(), Y = l(), X = f(() => {
58
+ let t = q.counterpart;
59
+ if (!t) return;
60
+ if (q.isBankAccountsLoading) return {
61
+ name: o(t),
62
+ email: a(t),
63
+ methodLabel: C.paymentMethodLoading,
64
+ fields: []
65
+ };
66
+ if (q.isBankAccountsError) return {
67
+ name: o(t),
68
+ email: a(t),
69
+ methodLabel: C.paymentMethodUnavailable,
70
+ fields: []
71
+ };
72
+ let n = s(q.bankAccounts);
73
+ return {
74
+ name: o(t),
75
+ email: a(t),
76
+ methodLabel: n ? C.achMethod : C.noMethod,
77
+ fields: n ? [
78
+ {
79
+ label: C.accountHolder,
80
+ value: n.account_holder_name ?? ""
81
+ },
82
+ {
83
+ label: C.routingNumber,
84
+ value: n.routing_number ?? ""
85
+ },
86
+ {
87
+ label: C.accountNumber,
88
+ value: n.account_number ?? "",
89
+ maskedValue: n.account_number ? e(n.account_number) : ""
90
+ }
91
+ ] : []
92
+ };
93
+ }, [
94
+ q.bankAccounts,
95
+ q.counterpart,
96
+ q.isBankAccountsError,
97
+ q.isBankAccountsLoading,
98
+ C
99
+ ]), Z = f(() => i(q.bankAccounts), [q.bankAccounts]), Q = u(async () => {
100
+ let e = N.current;
101
+ if (!v || !c(e)) return !0;
102
+ if (q.isBankAccountsLoading || q.isBankAccountsError) return !1;
103
+ let t = ne(e);
104
+ if (Object.keys(t).length > 0) return L(t), A(!0), !1;
105
+ L(void 0);
106
+ let n = te(q.bankAccounts, R ?? Z?.id);
107
+ if (n.kind === "update") return await Y.mutateAsync({
108
+ path: {
109
+ counterpart_id: v,
110
+ bank_account_id: n.bankAccountId
111
+ },
112
+ body: r(e, { includeAchDefaults: n.includeAchDefaults })
113
+ }), z(n.bankAccountId), !0;
114
+ let i = await J.mutateAsync({
115
+ path: { counterpart_id: v },
116
+ body: ee(e)
117
+ });
118
+ return z(i?.id), !0;
119
+ }, [
120
+ Z,
121
+ v,
122
+ J,
123
+ q.bankAccounts,
124
+ q.isBankAccountsError,
125
+ q.isBankAccountsLoading,
126
+ R,
127
+ Y
128
+ ]), de = f(() => (K.data?.data ?? []).map((e) => ({
129
+ name: o(e),
130
+ email: a(e),
131
+ onSelect: () => W(e.id)
132
+ })), [K.data, W]), $ = u(() => {
133
+ k(void 0), P(!1);
134
+ }, []), fe = u((e) => {
135
+ k(void 0), P(!1), W(e);
136
+ }, [W]);
137
+ if (O) return {
138
+ mode: "creating",
139
+ newVendorForm: /* @__PURE__ */ h(oe, {
140
+ mode: O,
141
+ counterpart: O === "edit" ? q.counterpart : void 0,
142
+ primaryAddress: O === "edit" ? q.primaryAddress : void 0,
143
+ bankAccounts: O === "edit" ? q.bankAccounts : void 0,
144
+ isBankAccountsLoading: O === "edit" ? q.isBankAccountsLoading : void 0,
145
+ isBankAccountsError: O === "edit" ? q.isBankAccountsError : void 0,
146
+ initialName: O === "create" ? w : void 0,
147
+ onSaved: fe,
148
+ onCancel: $,
149
+ onDirtyChange: P
150
+ }),
151
+ onClear: $,
152
+ hasUnsavedVendorChanges: F
153
+ };
154
+ if (X) {
155
+ let e = q.isBankAccountsLoading || q.isBankAccountsError;
156
+ return {
157
+ mode: "resolved",
158
+ summary: X,
159
+ onEdit: e ? void 0 : () => k("edit"),
160
+ onClear: () => W(void 0),
161
+ paymentInstructions: e ? void 0 : {
162
+ isOpen: le,
163
+ values: j,
164
+ errors: I,
165
+ onOpen: () => {
166
+ A(!0), Z && (M({
167
+ accountHolderName: Z.account_holder_name ?? "",
168
+ routingNumber: Z.routing_number ?? "",
169
+ accountNumber: Z.account_number ?? ""
170
+ }), z(Z.id));
171
+ },
172
+ onChange: (e) => {
173
+ M((t) => ({
174
+ ...t,
175
+ ...e
176
+ })), L(void 0);
177
+ }
178
+ },
179
+ savePaymentInstructions: Q,
180
+ hasUnsavedVendorChanges: F
181
+ };
182
+ }
183
+ return {
184
+ mode: "selecting",
185
+ error: K.isError ? C.searchFailed : q.isError ? C.vendorDetailsFailed : x,
186
+ search: {
187
+ query: w,
188
+ onQueryChange: T,
189
+ isLoading: K.isLoading,
190
+ onAddVendor: () => k("create"),
191
+ results: de
192
+ },
193
+ savePaymentInstructions: Q,
194
+ hasUnsavedVendorChanges: F
195
+ };
196
+ }
7
197
  //#endregion
8
- export { e as billsTabTestIds };
198
+ export { _ as useVendorSectionProps };
@@ -2,73 +2,67 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { formatCalendarDate as e } from "../../../shared/util/dist/lib/formatCalendarDate.js";
6
- import { formatMoneyExact as t } from "../../../shared/util/dist/lib/formatMoneyExact.js";
7
- import { usePayablesQuery as n, usePayablesTotalCountQuery as r } from "../../data-access/dist/index10.js";
5
+ import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
+ import "../../../shared/ui/dist/index.js";
7
+ import { useUpdatePayableMutation as t } from "../../data-access/dist/index10.js";
8
8
  import "../../data-access/dist/index.js";
9
- import { derivePayableStatus as i } from "./index15.js";
10
- import { DEFAULT_BILL_QUEUE as a, billQueueStatuses as o, billSortField as s } from "./index22.js";
11
- import { useCallback as c, useEffect as l, useMemo as u, useState as d } from "react";
9
+ import { counterpartFormBankAccountToCreatePayload as n, validateAchFormValues as r } from "../../../shared/counterpart-management/feature/dist/lib/helpers.js";
10
+ import { useCreateCounterpartBankAccountMutation as i } from "../../../shared/counterpart-management/data-access/dist/index5.js";
11
+ import "../../../shared/counterpart-management/feature/dist/index.js";
12
+ import { useCallback as a, useRef as o, useState as s } from "react";
12
13
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js
13
- var f = 10, p = [{
14
- id: "addedOnLabel",
15
- desc: !0
16
- }];
17
- function m({ enabled: m = !0, onOpenBill: h }) {
18
- let [g, _] = d(a), [v, y] = d(p), [b, x] = d(f), [S, C] = d(), [w, T] = d(""), [E, D] = d(""), O = c(() => C(void 0), []);
19
- l(() => {
20
- let e = setTimeout(() => {
21
- D(w), O();
22
- }, 300);
23
- return () => clearTimeout(e);
24
- }, [w, O]);
25
- let k = v[0], A = s(k?.id), j = n({
26
- limit: b,
27
- pagination_token: S,
28
- status__in: o(g),
29
- counterpart_name__icontains: E || void 0,
30
- sort: A,
31
- order: A ? k?.desc ? "desc" : "asc" : void 0,
32
- enabled: m
33
- }), M = j.data?.data.length === 0, N = r({ enabled: m && M }), P = !M || (N.data?.count ?? 1) > 0, F = u(() => (j.data?.data ?? []).map((n) => {
34
- let r = i(n.status, n.due_date);
35
- return {
36
- vendorLabel: n.counterpart_raw_data?.name ?? "",
37
- dueDateLabel: e(n.due_date),
38
- amountDueLabel: t((n.amount_due ?? n.total_amount ?? 0) / 100, { currencyCode: n.currency ?? "USD" }),
39
- status: r.status,
40
- statusTone: r.tone,
41
- addedOnLabel: e(n.created_at?.slice(0, 10)),
42
- onOpen: () => h(n.id, r.status === "draft")
43
- };
44
- }), [j.data?.data, h]), I = c((e) => {
45
- _(e), O();
46
- }, [O]), L = c((e) => {
47
- y((t) => typeof e == "function" ? e(t) : e), O();
48
- }, [O]), R = c((e) => {
49
- x(e), O();
50
- }, [O]), z = c(() => C(j.data?.next_pagination_token), [j.data?.next_pagination_token]), B = c(() => C(j.data?.prev_pagination_token), [j.data?.prev_pagination_token]), V = c(() => {
51
- j.refetch();
52
- }, [j.refetch]);
14
+ var c = {
15
+ accountHolderName: "",
16
+ routingNumber: "",
17
+ accountNumber: ""
18
+ };
19
+ function l({ payableId: l, counterpartId: u, saveErrorMessage: d }) {
20
+ let [f, p] = s(!1), [m, h] = s(c), [g, _] = s(), v = i(), y = t(), b = o(void 0), x = a(() => {
21
+ h(c), _(void 0), b.current = void 0, p(!0);
22
+ }, []), S = a(() => {
23
+ p(!1);
24
+ }, []), C = a((e) => {
25
+ h((t) => ({
26
+ ...t,
27
+ ...e
28
+ }));
29
+ }, []), w = a(async () => {
30
+ if (!l || !u) return !1;
31
+ let t = r(m);
32
+ if (Object.keys(t).length > 0) return _(t), !1;
33
+ try {
34
+ if (!b.current) {
35
+ let e = await v.mutateAsync({
36
+ path: { counterpart_id: u },
37
+ body: n(m)
38
+ });
39
+ b.current = e.id;
40
+ }
41
+ return await y.mutateAsync({
42
+ path: { payable_id: l },
43
+ body: { counterpart_bank_account_id: b.current }
44
+ }), b.current = void 0, p(!1), !0;
45
+ } catch {
46
+ return e.error(d), !1;
47
+ }
48
+ }, [
49
+ u,
50
+ v,
51
+ l,
52
+ d,
53
+ y,
54
+ m
55
+ ]);
53
56
  return {
54
- rows: F,
55
- isLoading: j.isLoading || M && N.isLoading,
56
- isError: j.isError,
57
- onRetry: V,
58
- selectedFilterTabId: g,
59
- onFilterTabChange: I,
60
- searchValue: w,
61
- onSearchChange: T,
62
- hasAnyBills: P,
63
- sorting: v,
64
- onSortingChange: L,
65
- pageSize: b,
66
- onPageSizeChange: R,
67
- hasNextPage: !!j.data?.next_pagination_token,
68
- hasPrevPage: !!j.data?.prev_pagination_token,
69
- onNextPage: z,
70
- onPrevPage: B
57
+ isOpen: f,
58
+ values: m,
59
+ errors: g,
60
+ isSaving: v.isPending || y.isPending,
61
+ open: x,
62
+ close: S,
63
+ onChange: C,
64
+ save: w
71
65
  };
72
66
  }
73
67
  //#endregion
74
- export { m as useBillsTable };
68
+ export { l as usePaymentInstructionsForm };
@@ -1,143 +1,50 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
- import { hasAnyScope as t } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
7
- import { Scope as n } from "../../../shared/data-access/dist/lib/scopes.js";
8
- import "../../../shared/data-access/dist/index.js";
9
- import "../../../shared/ui/dist/index.js";
10
- import { useWidgetConfig as r } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
11
- import "../../../shared/feature/dist/index.js";
12
- import { AddBillDialog as i } from "../../ui/dist/index10.js";
13
- import { BillsScreen as a } from "../../ui/dist/index38.js";
14
- import "../../ui/dist/index.js";
15
- import { BillCreateDialog as o } from "./index12.js";
16
- import "./index13.js";
17
- import { BillDetailsContainer as s } from "./index17.js";
18
- import "./index18.js";
19
- import { BILL_QUEUE_ORDER as c, BillQueue as l } from "./index22.js";
20
- import { BILLS_TAB_LABELS_EN as u } from "./index24.js";
21
- import { billsTabTestIds as d } from "./index25.js";
22
- import { useBillsTable as f } from "./index26.js";
23
- import { copyTextToClipboard as p } from "./index23.js";
24
- import { useCallback as m, useEffect as h, useMemo as g, useState as _ } from "react";
25
- import { jsx as v, jsxs as y } from "react/jsx-runtime";
26
- import { CheckIcon as b, FilePenIcon as x, ListIcon as S, LoaderCircleIcon as C } from "lucide-react";
1
+ import { parseDecimalAmountToMinorUnits as e } from "../../../shared/util/dist/lib/parseDecimalAmountToMinorUnits.js";
2
+ import "../../data-access/dist/index.js";
27
3
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js
28
- var w = "bills@business-banking.app", T = {
29
- [l.Drafts]: /* @__PURE__ */ v(x, {
30
- className: "ttw:size-4",
31
- "aria-hidden": !0
32
- }),
33
- [l.Pending]: /* @__PURE__ */ v(C, {
34
- className: "ttw:size-4",
35
- "aria-hidden": !0
36
- }),
37
- [l.Paid]: /* @__PURE__ */ v(b, {
38
- className: "ttw:size-4",
39
- "aria-hidden": !0
40
- }),
41
- [l.All]: /* @__PURE__ */ v(S, {
42
- className: "ttw:size-4",
43
- "aria-hidden": !0
44
- })
45
- };
46
- function E({ labels: l, onEnqueueFiles: b, openPayableId: x, onOpenPayableHandled: S }) {
47
- let C = g(() => ({
48
- ...u,
49
- ...l,
50
- queues: {
51
- ...u.queues,
52
- ...l?.queues
53
- }
54
- }), [l]), [E, D] = _(!1), [O, k] = _(), [A, j] = _(!1), [M, N] = _(), [P, F] = _(!1), [I, L] = _(!1), { initResponse: R } = r(), z = t(R?.scopes, [n.PayableReadOrg]), B = t(R?.scopes, [n.PayableWriteOrg]), V = !R || z, H = !R || B, U = m((e, t) => {
55
- if (t && H) {
56
- k(e), j(!0);
57
- return;
58
- }
59
- N(e), F(!0);
60
- }, [H]), W = f({
61
- enabled: V,
62
- onOpenBill: U
63
- }), G = g(() => c.map((e) => ({
64
- id: e,
65
- label: C.queues[e],
66
- icon: T[e]
67
- })), [C.queues]), K = () => {
68
- F(!1), L(!0);
69
- }, q = g(() => ({
70
- createButton: C.createButton,
71
- addBill: { heading: C.emptyHeading }
72
- }), [C.createButton, C.emptyHeading]), J = () => {
73
- D(!1), k(void 0), j(!0);
74
- }, Y = (e) => {
75
- D(!1), b?.(e);
76
- }, X = async () => {
77
- await p(w) ? e.success(C.emailCopiedToast) : e.error(C.emailCopyFailedToast);
78
- };
79
- return h(() => {
80
- x && (k(x), j(!0), S?.());
81
- }, [S, x]), /* @__PURE__ */ y("div", {
82
- "data-testid": d.root,
83
- children: [
84
- /* @__PURE__ */ v(a, {
85
- rows: W.rows,
86
- isLoading: W.isLoading || !R,
87
- isError: W.isError,
88
- onRetry: W.onRetry,
89
- sorting: W.sorting,
90
- onSortingChange: W.onSortingChange,
91
- pageSize: W.pageSize,
92
- onPageSizeChange: W.onPageSizeChange,
93
- hasNextPage: W.hasNextPage,
94
- hasPrevPage: W.hasPrevPage,
95
- onNextPage: W.onNextPage,
96
- onPrevPage: W.onPrevPage,
97
- filterTabs: G,
98
- selectedFilterTabId: W.selectedFilterTabId,
99
- onFilterTabChange: W.onFilterTabChange,
100
- searchValue: W.searchValue,
101
- onSearchChange: W.onSearchChange,
102
- isFiltering: W.hasAnyBills,
103
- onCreateClick: H ? () => D(!0) : void 0,
104
- onEnterManually: H ? J : void 0,
105
- onFilesSelected: H ? Y : void 0,
106
- emailAddress: w,
107
- onCopyEmail: X,
108
- labels: q
109
- }),
110
- H ? /* @__PURE__ */ v(i, {
111
- open: E,
112
- onOpenChange: D,
113
- onFilesSelected: Y,
114
- onEnterManually: J,
115
- emailAddress: w,
116
- onCopyEmail: X,
117
- labels: { heading: W.hasAnyBills ? C.nonEmptyHeading : C.emptyHeading }
118
- }) : null,
119
- A ? /* @__PURE__ */ v(o, {
120
- open: A,
121
- onOpenChange: j,
122
- payableId: O
123
- }) : null,
124
- P ? /* @__PURE__ */ v(s, {
125
- open: P,
126
- onOpenChange: F,
127
- payableId: M,
128
- onClose: () => F(!1),
129
- onExpand: K,
130
- testId: d.detailsSheet
131
- }) : null,
132
- I ? /* @__PURE__ */ v(o, {
133
- open: I,
134
- onOpenChange: L,
135
- payableId: M,
136
- readOnly: !0,
137
- copy: { readOnlyTitle: C.viewBillTitle }
138
- }) : null
139
- ]
4
+ var t = "USD";
5
+ function n(n) {
6
+ return e(n, t);
7
+ }
8
+ function r(e) {
9
+ let t = e.trim();
10
+ if (!t) return null;
11
+ let n = Number(t);
12
+ return Number.isFinite(n) && n > 0 ? n : null;
13
+ }
14
+ function i(e) {
15
+ return !!(e.description.trim() || e.glCode.trim() || n(e.price) !== null || n(e.amount) !== null);
16
+ }
17
+ function a(e) {
18
+ return n(e) ?? 0;
19
+ }
20
+ function o(e) {
21
+ let t = Number.parseFloat(e);
22
+ return Number.isFinite(t) ? t : 0;
23
+ }
24
+ function s(e) {
25
+ return (e / 100).toFixed(2);
26
+ }
27
+ function c({ values: e, counterpartId: r, clearCounterpart: i, editedTotals: a }) {
28
+ let o = { currency: t };
29
+ return r ? o.counterpart_id = r : i && (o.counterpart_id = null), e.invoiceNumber && (o.document_id = e.invoiceNumber), e.invoiceDate && (o.issued_at = e.invoiceDate), e.dueDate && (o.due_date = e.dueDate), a && (o.discount = n(a.discount) ?? 0, o.tax_amount = n(a.tax) ?? 0, a.total !== void 0 && (o.total_amount = n(a.total) ?? 0)), o;
30
+ }
31
+ function l(e) {
32
+ return e.filter(i).map((e) => {
33
+ let t = n(e.amount), i = r(e.quantity) ?? 1, a = n(e.price) ?? (t === null ? 0 : Math.round(t / i)), o = Math.round(i * a);
34
+ return {
35
+ name: e.description,
36
+ quantity: i,
37
+ unit_price: a,
38
+ ...t !== null && t !== o ? { subtotal: t } : {},
39
+ ...e.glCode ? { ledger_account_id: e.glCode } : {}
40
+ };
140
41
  });
141
42
  }
43
+ function u(e, t) {
44
+ return s(Math.round(o(e) * a(t)));
45
+ }
46
+ function d(e, t, n) {
47
+ return s(e.reduce((e, t) => e + a(t.amount), 0) + a(t) - a(n));
48
+ }
142
49
  //#endregion
143
- export { E as BillsTab, E as default };
50
+ export { d as calculateTotal, u as displayLineAmount, i as isPersistableLineItem, c as mapBillFormToPayload, l as mapLineItemsToPayload, n as parseMoneyToMinorUnits, r as parseQuantity };
@@ -1,5 +1,34 @@
1
- import "./index22.js";
2
- import "./index24.js";
3
- import "./index25.js";
4
- import "./index26.js";
5
- import "./index27.js";
1
+ import { BILL_CREATE_MESSAGE_LABELS_EN as e } from "./index22.js";
2
+ import { isPersistableLineItem as t, parseMoneyToMinorUnits as n, parseQuantity as r } from "./index27.js";
3
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js
4
+ var i = /^(?:\d{1,3}(?:,\d{3})+(?:\.\d+)?|\d+(?:\.\d+)?|\.\d+)$/;
5
+ function a(e) {
6
+ let t = e.trim();
7
+ return !t || n(t) !== null ? !0 : i.test(t) ? Number(t.replaceAll(",", "")) === 0 : !1;
8
+ }
9
+ function o(t, i = e) {
10
+ let a = {};
11
+ for (let e of t) {
12
+ let t = n(e.price), o = n(e.amount), s = {};
13
+ e.price.trim() && t === null && (s.price = i.unreadableMoney), e.amount.trim() && o === null && (s.amount = i.unreadableMoney), (t !== null || o !== null) && r(e.quantity) === null && (s.quantity = i.unusableQuantity), Object.keys(s).length && (a[e.id] = s);
14
+ }
15
+ return Object.keys(a).length ? a : void 0;
16
+ }
17
+ function s(i, a, o, s = e) {
18
+ let c = {};
19
+ a || (c.vendor = s.requiredField), i.invoiceNumber.trim() || (c.invoiceNumber = s.requiredField), i.invoiceDate.trim() || (c.invoiceDate = s.requiredField), i.dueDate.trim() || (c.dueDate = s.requiredField);
20
+ let l = {};
21
+ return o.forEach((e, i) => {
22
+ if (i > 0 && !t(e)) return;
23
+ let a = {};
24
+ e.description.trim() || (a.description = s.requiredField), r(e.quantity) === null && (a.quantity = s.requiredField), n(e.price) === null && n(e.amount) === null && (a.price = s.requiredField, a.amount = s.requiredField), Object.keys(a).length && (l[e.id] = a);
25
+ }), {
26
+ formErrors: Object.keys(c).length ? c : void 0,
27
+ lineItemErrors: Object.keys(l).length ? l : void 0
28
+ };
29
+ }
30
+ function c(t, r, i, o = e) {
31
+ return !a(t) || !a(r) || i !== void 0 && n(i) === null ? { form: o.totalsNeedAttention } : void 0;
32
+ }
33
+ //#endregion
34
+ export { s as validateBillCompleteness, c as validateBillTotals, o as validateLineItems };