@tesouro/embedded-components-react 0.5.258 → 0.5.260
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.
- package/README.md +2 -1
- package/dist/index.css +109 -9
- package/dist/index.d.ts +41 -10
- package/dist/lib/ReceivablesWidget.d.ts +41 -10
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index.js +11 -10
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index10.js +42 -94
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index11.js +91 -76
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index12.js +67 -173
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index13.js +186 -17
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index14.js +27 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index4.js +28 -72
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index5.js +128 -53
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index6.js +66 -28
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index7.js +28 -34
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index8.js +24 -168
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index9.js +173 -44
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +274 -267
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/helpers.js +99 -95
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/labels.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/paymentTerms.js +28 -25
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/preview.js +49 -43
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/unsavedChanges.js +13 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActions.js +4 -4
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActionsModal.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableAttachmentUploads.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableBankAccount.js +77 -72
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableDetails.js +4 -4
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableForm.js +363 -295
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableIssuePreflight.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablePaymentRecord.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablePreview.js +36 -21
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableReminders.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableStatusCards.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesTable.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +12 -10
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +21 -14
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index15.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index16.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index20.js +68 -64
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index38.js +383 -379
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index40.js +22 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index41.js +8 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index43.js +258 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index44.js +2 -100
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index45.js +95 -23
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index46.js +23 -231
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index47.js +237 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index48.js +3 -249
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index49.js +234 -78
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index50.js +87 -53
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index51.js +49 -349
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index52.js +359 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index53.js +45 -0
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +40 -40
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +247 -214
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +175 -147
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/index.js +12 -12
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index2.js +2 -1
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index6.js +109 -89
- package/package.json +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index42.js +0 -4
|
@@ -2,19 +2,25 @@ import { minorExponentForCurrency as e } from "../../../../../shared/util/dist/l
|
|
|
2
2
|
import "../../../../ui/dist/index19.js";
|
|
3
3
|
import "../../../../ui/dist/index.js";
|
|
4
4
|
import { isBlankLineItem as t, keepsSavedTaxRates as n, lineItemTaxRateMinorUnits as r, parseQuantity as i, priceInputToMinorUnits as a, taxRateToMinorUnits as o } from "./lineItems.js";
|
|
5
|
-
import {
|
|
5
|
+
import { formatPreviewDate as s, resolveIssueDate as c, termDueDate as l } from "./paymentTerms.js";
|
|
6
6
|
import { formatMoney as u } from "./helpers.js";
|
|
7
7
|
import { differenceInCalendarDays as d, parseISO as f } from "date-fns";
|
|
8
8
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/preview.js
|
|
9
9
|
var p = "US", m = 100;
|
|
10
10
|
function h(e) {
|
|
11
|
+
return (e ?? []).some(({ status: e, direction: t }) => e === "active" && t === "receive");
|
|
12
|
+
}
|
|
13
|
+
function g(e) {
|
|
14
|
+
return e?.invoice?.display_organization_bank_account ?? e?.display_organization_bank_account ?? !0;
|
|
15
|
+
}
|
|
16
|
+
function _(e) {
|
|
11
17
|
try {
|
|
12
18
|
return new Intl.DisplayNames(void 0, { type: "region" }).of(e) ?? e;
|
|
13
19
|
} catch {
|
|
14
20
|
return e;
|
|
15
21
|
}
|
|
16
22
|
}
|
|
17
|
-
function
|
|
23
|
+
function v({ address: e, issuerCountry: t, formatCountry: n = _ }) {
|
|
18
24
|
if (!e) return [];
|
|
19
25
|
let r = [e.city, e.state].filter(Boolean).join(", "), i = e.country === p && t === p;
|
|
20
26
|
return [
|
|
@@ -23,65 +29,65 @@ function g({ address: e, issuerCountry: t, formatCountry: n = h }) {
|
|
|
23
29
|
e.country && !i ? n(e.country) : ""
|
|
24
30
|
].filter(Boolean);
|
|
25
31
|
}
|
|
26
|
-
var
|
|
32
|
+
var y = { kind: "pending" }, b = (e) => ({
|
|
27
33
|
kind: "text",
|
|
28
34
|
lines: e
|
|
29
35
|
});
|
|
30
|
-
function
|
|
36
|
+
function x(e, t) {
|
|
31
37
|
return e.previewNetDays.replace("{days}", String(t));
|
|
32
38
|
}
|
|
33
|
-
function
|
|
39
|
+
function S(e, t) {
|
|
34
40
|
let n = e.previewEarlyPaymentDays.replace("{days}", String(t.number_of_days));
|
|
35
41
|
return t.discount ? `${n}, ${e.previewEarlyPaymentDiscount.replace("{rate}", String(t.discount / m))}` : n;
|
|
36
42
|
}
|
|
37
|
-
function
|
|
43
|
+
function C({ paymentTermsId: e, paymentTermsCustomDate: t, paymentTerms: n, issueDate: r, messages: i }) {
|
|
38
44
|
let a = {
|
|
39
|
-
dueDate:
|
|
40
|
-
paymentTerms:
|
|
45
|
+
dueDate: y,
|
|
46
|
+
paymentTerms: y
|
|
41
47
|
};
|
|
42
48
|
if (e === "custom") {
|
|
43
49
|
if (!t) return a;
|
|
44
50
|
let e = f(t), n = Math.max(0, d(e, r));
|
|
45
51
|
return {
|
|
46
|
-
dueDate:
|
|
47
|
-
paymentTerms:
|
|
52
|
+
dueDate: b([s(e)]),
|
|
53
|
+
paymentTerms: b([x(i, n)])
|
|
48
54
|
};
|
|
49
55
|
}
|
|
50
56
|
if (e === "receipt_due") return {
|
|
51
|
-
dueDate:
|
|
52
|
-
paymentTerms:
|
|
57
|
+
dueDate: b([s(r)]),
|
|
58
|
+
paymentTerms: b([i.previewDueOnReceipt])
|
|
53
59
|
};
|
|
54
60
|
let o = n?.find((t) => t.id === e);
|
|
55
61
|
if (!o) return a;
|
|
56
62
|
let c = l(o, r), u = [
|
|
57
|
-
o.term_1 &&
|
|
58
|
-
o.term_2 &&
|
|
59
|
-
o.term_final &&
|
|
63
|
+
o.term_1 && S(i, o.term_1),
|
|
64
|
+
o.term_2 && S(i, o.term_2),
|
|
65
|
+
o.term_final && x(i, o.term_final.number_of_days)
|
|
60
66
|
].filter((e) => !!e);
|
|
61
67
|
return {
|
|
62
|
-
dueDate: c ?
|
|
63
|
-
paymentTerms: u.length > 0 ?
|
|
68
|
+
dueDate: c ? b([s(c)]) : y,
|
|
69
|
+
paymentTerms: u.length > 0 ? b(u) : y
|
|
64
70
|
};
|
|
65
71
|
}
|
|
66
|
-
function
|
|
72
|
+
function w(e, t) {
|
|
67
73
|
return t ? e.previewTaxId.replace("{taxId}", t) : void 0;
|
|
68
74
|
}
|
|
69
|
-
function
|
|
75
|
+
function T(e) {
|
|
70
76
|
return e.length > 0 ? e : void 0;
|
|
71
77
|
}
|
|
72
|
-
function
|
|
78
|
+
function E(e, t) {
|
|
73
79
|
return e ? {
|
|
74
80
|
name: e.type === "organization" ? e.organization.legal_name : void 0,
|
|
75
|
-
addressLines:
|
|
81
|
+
addressLines: T(v({
|
|
76
82
|
address: e.address,
|
|
77
83
|
issuerCountry: e.address?.country
|
|
78
84
|
})),
|
|
79
|
-
taxIdLine:
|
|
85
|
+
taxIdLine: w(t, e.tax_id),
|
|
80
86
|
email: e.email ?? void 0,
|
|
81
87
|
phone: e.phone ?? void 0
|
|
82
88
|
} : {};
|
|
83
89
|
}
|
|
84
|
-
function
|
|
90
|
+
function D(e) {
|
|
85
91
|
let t = "organization" in e ? e.organization : e.individual;
|
|
86
92
|
return {
|
|
87
93
|
name: "organization" in e ? e.organization.legal_name : [e.individual.first_name, e.individual.last_name].filter(Boolean).join(" "),
|
|
@@ -89,22 +95,22 @@ function T(e) {
|
|
|
89
95
|
phone: t.phone
|
|
90
96
|
};
|
|
91
97
|
}
|
|
92
|
-
function
|
|
98
|
+
function O({ counterpart: e, billingAddress: t, issuerCountry: n, messages: r }) {
|
|
93
99
|
if (!e) return { kind: "pending" };
|
|
94
|
-
let { name: i, email: a, phone: o } =
|
|
100
|
+
let { name: i, email: a, phone: o } = D(e);
|
|
95
101
|
return i ? {
|
|
96
102
|
kind: "party",
|
|
97
103
|
name: i,
|
|
98
|
-
addressLines:
|
|
104
|
+
addressLines: T(v({
|
|
99
105
|
address: t,
|
|
100
106
|
issuerCountry: n
|
|
101
107
|
})),
|
|
102
|
-
taxIdLine:
|
|
108
|
+
taxIdLine: w(r, e.tax_id),
|
|
103
109
|
email: a || void 0,
|
|
104
110
|
phone: o || void 0
|
|
105
111
|
} : { kind: "pending" };
|
|
106
112
|
}
|
|
107
|
-
function
|
|
113
|
+
function k({ lineItems: e, currency: n, unitNamesById: r, messages: o }) {
|
|
108
114
|
return e.filter((e) => !t(e)).map((e) => {
|
|
109
115
|
let t = a(e.price, n), s = i(e.quantity), c = r[e.measureUnitId] || e.measureUnitName;
|
|
110
116
|
return {
|
|
@@ -126,19 +132,19 @@ function D({ lineItems: e, currency: n, unitNamesById: r, messages: o }) {
|
|
|
126
132
|
};
|
|
127
133
|
});
|
|
128
134
|
}
|
|
129
|
-
function
|
|
135
|
+
function A(t, n) {
|
|
130
136
|
return n ? new Intl.NumberFormat(void 0, {
|
|
131
137
|
style: "currency",
|
|
132
138
|
currency: n,
|
|
133
139
|
currencySign: "accounting"
|
|
134
140
|
}).format(-t / 10 ** e(n)) : "";
|
|
135
141
|
}
|
|
136
|
-
function
|
|
142
|
+
function j(e, i) {
|
|
137
143
|
if (!e.taxRate) return i.previewTax;
|
|
138
144
|
let a = o(e.taxRate), s = n(e.taxRate, e.savedTaxRate);
|
|
139
145
|
return new Set(e.lineItems.filter((e) => e.taxable && !t(e)).map((e) => r(e, a, s))).size > 1 ? i.previewTax : i.previewTaxWithRate.replace("{rate}", String(a / m));
|
|
140
146
|
}
|
|
141
|
-
function
|
|
147
|
+
function M({ totals: e, currency: t, taxLabel: n, messages: r }) {
|
|
142
148
|
let i = (e) => u({
|
|
143
149
|
amount: e,
|
|
144
150
|
currency: t,
|
|
@@ -151,7 +157,7 @@ function A({ totals: e, currency: t, taxLabel: n, messages: r }) {
|
|
|
151
157
|
return a && c.push({
|
|
152
158
|
id: "discount",
|
|
153
159
|
label: r.previewDiscount,
|
|
154
|
-
value:
|
|
160
|
+
value: A(e.discountAmount, t)
|
|
155
161
|
}), s && (o || a) && c.push({
|
|
156
162
|
id: "nonTaxableSubtotal",
|
|
157
163
|
label: r.previewNonTaxableSubtotal,
|
|
@@ -174,7 +180,7 @@ function A({ totals: e, currency: t, taxLabel: n, messages: r }) {
|
|
|
174
180
|
}
|
|
175
181
|
};
|
|
176
182
|
}
|
|
177
|
-
function
|
|
183
|
+
function N({ bankDetails: e, canReceivePayments: t, messages: n }) {
|
|
178
184
|
let r = e ? [
|
|
179
185
|
[n.previewAccountHolderName, e.accountHolderName],
|
|
180
186
|
[n.previewRoutingNumber, e.routingNumber],
|
|
@@ -185,13 +191,13 @@ function j({ bankDetails: e, canReceivePayments: t, messages: n }) {
|
|
|
185
191
|
bankLines: r
|
|
186
192
|
};
|
|
187
193
|
}
|
|
188
|
-
function
|
|
189
|
-
let p =
|
|
194
|
+
function P({ values: e, totals: t, entity: n, counterpart: r, billingAddress: i, paymentTerms: a, unitNamesById: o, bankDetails: l, canReceivePayments: u = !1, messages: d, today: f = /* @__PURE__ */ new Date() }) {
|
|
195
|
+
let p = k({
|
|
190
196
|
lineItems: e.lineItems,
|
|
191
197
|
currency: e.currency,
|
|
192
198
|
unitNamesById: o,
|
|
193
199
|
messages: d
|
|
194
|
-
}), m = n?.logo?.url, h =
|
|
200
|
+
}), m = n?.logo?.url, h = E(n, d), g = c(e.issueDate, f);
|
|
195
201
|
return {
|
|
196
202
|
issuer: h,
|
|
197
203
|
logo: m ? {
|
|
@@ -199,15 +205,15 @@ function M({ values: e, totals: t, entity: n, counterpart: r, billingAddress: i,
|
|
|
199
205
|
src: m,
|
|
200
206
|
alt: h.name ? d.previewLogoAlt.replace("{name}", h.name) : d.previewLogoAltNoName
|
|
201
207
|
} : { kind: "placeholder" },
|
|
202
|
-
billTo:
|
|
208
|
+
billTo: O({
|
|
203
209
|
counterpart: r,
|
|
204
210
|
billingAddress: i,
|
|
205
211
|
issuerCountry: n?.address?.country,
|
|
206
212
|
messages: d
|
|
207
213
|
}),
|
|
208
|
-
invoiceNumber:
|
|
214
|
+
invoiceNumber: y,
|
|
209
215
|
issueDate: s(g),
|
|
210
|
-
...
|
|
216
|
+
...C({
|
|
211
217
|
paymentTermsId: e.paymentTermsId,
|
|
212
218
|
paymentTermsCustomDate: e.paymentTermsCustomDate,
|
|
213
219
|
paymentTerms: a,
|
|
@@ -219,14 +225,14 @@ function M({ values: e, totals: t, entity: n, counterpart: r, billingAddress: i,
|
|
|
219
225
|
kind: "rows",
|
|
220
226
|
rows: p
|
|
221
227
|
} : { kind: "empty" },
|
|
222
|
-
totals: p.length > 0 ?
|
|
228
|
+
totals: p.length > 0 ? M({
|
|
223
229
|
totals: t,
|
|
224
230
|
currency: e.currency,
|
|
225
|
-
taxLabel:
|
|
231
|
+
taxLabel: j(e, d),
|
|
226
232
|
messages: d
|
|
227
233
|
}) : void 0,
|
|
228
234
|
closingNote: e.closingNote || void 0,
|
|
229
|
-
payment:
|
|
235
|
+
payment: N({
|
|
230
236
|
bankDetails: l,
|
|
231
237
|
canReceivePayments: u,
|
|
232
238
|
messages: d
|
|
@@ -234,4 +240,4 @@ function M({ values: e, totals: t, entity: n, counterpart: r, billingAddress: i,
|
|
|
234
240
|
};
|
|
235
241
|
}
|
|
236
242
|
//#endregion
|
|
237
|
-
export {
|
|
243
|
+
export { v as buildPreviewAddressLines, C as buildPreviewPaymentTerms, P as buildReceivablePreviewView, g as displaysBankAccount, _ as formatCountryName, A as formatDeduction, h as hasReceivePaymentMethod };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/unsavedChanges.js
|
|
2
|
+
function e(t, n) {
|
|
3
|
+
if (Object.is(t, n)) return !0;
|
|
4
|
+
if (Array.isArray(t) || Array.isArray(n)) return !Array.isArray(t) || !Array.isArray(n) || t.length !== n.length ? !1 : t.every((t, r) => e(t, n[r]));
|
|
5
|
+
if (!t || !n || typeof t != "object" || typeof n != "object") return !1;
|
|
6
|
+
let r = t, i = n;
|
|
7
|
+
return [.../* @__PURE__ */ new Set([...Object.keys(r), ...Object.keys(i)])].every((t) => e(r[t], i[t]));
|
|
8
|
+
}
|
|
9
|
+
function t(t, n) {
|
|
10
|
+
return !e(t, n);
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { t as hasUnsavedChanges };
|
|
@@ -7,10 +7,10 @@ import { extractApiErrorMessage as t } from "../../../../../shared/util/dist/lib
|
|
|
7
7
|
import "../../../../../shared/ui/dist/index.js";
|
|
8
8
|
import { defaultSendValues as n, formatMoney as r, hasSendErrors as i, isReceivableReadyToIssue as a, splitEmailList as o, validateSendValues as s } from "./helpers.js";
|
|
9
9
|
import { getIssueReminderBlocker as c, hasSelectedReminder as ee } from "./reminders.js";
|
|
10
|
-
import { useSendReceivableEmailMutation as l } from "../../../../data-access/dist/
|
|
11
|
-
import { useAcceptReceivableMutation as u, useCancelReceivableMutation as d, useCloneReceivableMutation as f, useDeclineReceivableMutation as te, useDeleteReceivableMutation as ne, useIssueReceivableMutation as p } from "../../../../data-access/dist/
|
|
12
|
-
import { useMarkReceivablePaidMutation as re, useMarkReceivableUncollectibleMutation as ie } from "../../../../data-access/dist/
|
|
13
|
-
import { useCancelRecurrenceMutation as ae, usePauseRecurrenceMutation as m, useResumeRecurrenceMutation as oe } from "../../../../data-access/dist/
|
|
10
|
+
import { useSendReceivableEmailMutation as l } from "../../../../data-access/dist/index8.js";
|
|
11
|
+
import { useAcceptReceivableMutation as u, useCancelReceivableMutation as d, useCloneReceivableMutation as f, useDeclineReceivableMutation as te, useDeleteReceivableMutation as ne, useIssueReceivableMutation as p } from "../../../../data-access/dist/index9.js";
|
|
12
|
+
import { useMarkReceivablePaidMutation as re, useMarkReceivableUncollectibleMutation as ie } from "../../../../data-access/dist/index11.js";
|
|
13
|
+
import { useCancelRecurrenceMutation as ae, usePauseRecurrenceMutation as m, useResumeRecurrenceMutation as oe } from "../../../../data-access/dist/index13.js";
|
|
14
14
|
import "../../../../data-access/dist/index.js";
|
|
15
15
|
import { useReceivableIssuePreflight as h } from "./useReceivableIssuePreflight.js";
|
|
16
16
|
import { useReceivablePaymentRecord as g } from "./useReceivablePaymentRecord.js";
|
|
@@ -11,8 +11,8 @@ import { useCreateProductMutation as i } from "../../../../../shared/product-cat
|
|
|
11
11
|
import { useMeasureUnits as a } from "../../../../../shared/product-catalog/feature/dist/lib/useMeasureUnits.js";
|
|
12
12
|
import "../../../../../shared/product-catalog/feature/dist/index.js";
|
|
13
13
|
import { getInlineItemPriceLabel as o, getIssueAttachments as s, getIssueSubject as c, getProductsStepTitle as l, inlineItemToProductRequest as u } from "./actionsModal.js";
|
|
14
|
-
import { useSendReceivableEmailMutation as d } from "../../../../data-access/dist/
|
|
15
|
-
import { useReceivableQuery as f } from "../../../../data-access/dist/
|
|
14
|
+
import { useSendReceivableEmailMutation as d } from "../../../../data-access/dist/index8.js";
|
|
15
|
+
import { useReceivableQuery as f } from "../../../../data-access/dist/index12.js";
|
|
16
16
|
import "../../../../data-access/dist/index.js";
|
|
17
17
|
import { useCallback as p, useMemo as m, useState as h } from "react";
|
|
18
18
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActionsModal.js
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
5
|
import { toFileArray as e, validateAttachmentFile as t } from "./attachments.js";
|
|
6
|
-
import { useDeleteReceivableAttachmentMutation as n, useUploadReceivableAttachmentMutation as r } from "../../../../data-access/dist/
|
|
6
|
+
import { useDeleteReceivableAttachmentMutation as n, useUploadReceivableAttachmentMutation as r } from "../../../../data-access/dist/index6.js";
|
|
7
7
|
import "../../../../data-access/dist/index.js";
|
|
8
8
|
import { useCallback as i, useEffect as a, useRef as o, useState as s } from "react";
|
|
9
9
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableAttachmentUploads.js
|
|
@@ -7,98 +7,103 @@ import { extractApiErrorMessage as t } from "../../../../../shared/util/dist/lib
|
|
|
7
7
|
import "../../../../../shared/ui/dist/index.js";
|
|
8
8
|
import { useWidgetConfig as n } from "../../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
9
9
|
import "../../../../../shared/feature/dist/index.js";
|
|
10
|
-
import { useCreateEntityBankAccountMutation as r,
|
|
10
|
+
import { useCreateEntityBankAccountMutation as r, usePaymentAccountQuery as i, usePaymentAccountsQuery as a } from "../../../../data-access/dist/index5.js";
|
|
11
11
|
import "../../../../data-access/dist/index.js";
|
|
12
|
-
import { EMPTY_BANK_ACCOUNT_FORM_VALUES as
|
|
13
|
-
import { useCallback as
|
|
12
|
+
import { EMPTY_BANK_ACCOUNT_FORM_VALUES as o, bankAccountFormToPayload as s, buildBankAccountSectionView as c, buildPaymentAccountOptions as l, getBankAccountPermissions as u, validateBankAccountForm as d } from "./bankAccounts.js";
|
|
13
|
+
import { useCallback as f, useEffect as p, useMemo as m, useRef as h, useState as g } from "react";
|
|
14
14
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableBankAccount.js
|
|
15
|
-
function
|
|
16
|
-
let { initResponse:
|
|
17
|
-
enabled:
|
|
18
|
-
canReadEmbedded:
|
|
19
|
-
canReadExternal:
|
|
20
|
-
}),
|
|
21
|
-
|
|
15
|
+
function _({ open: _, bankAccountId: v, bankAccountType: y, embeddedBankName: b, messages: x, onSelect: S }) {
|
|
16
|
+
let { initResponse: C } = n(), w = m(() => u(C?.scopes), [C?.scopes]), { paymentAccounts: T, isLoading: E, isIncomplete: D } = a({
|
|
17
|
+
enabled: _,
|
|
18
|
+
canReadEmbedded: w.canReadEmbedded,
|
|
19
|
+
canReadExternal: w.canReadExternal
|
|
20
|
+
}), O = r(), [k, A] = g(!1), [j, M] = g(o), [N, P] = g({}), F = h(!1), I = f(() => {
|
|
21
|
+
F.current = !1, A(!1), M(o), P({});
|
|
22
22
|
}, []);
|
|
23
|
-
|
|
24
|
-
if (!
|
|
25
|
-
let [e] =
|
|
26
|
-
|
|
23
|
+
p(() => {
|
|
24
|
+
if (!_ || D || F.current || T.length !== 1) return;
|
|
25
|
+
let [e] = T;
|
|
26
|
+
F.current = !0, S({
|
|
27
27
|
bankAccountId: e.id,
|
|
28
28
|
bankAccountType: e.type
|
|
29
|
-
});
|
|
29
|
+
}, { automatic: !0 });
|
|
30
30
|
}, [
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
31
|
+
D,
|
|
32
|
+
S,
|
|
33
|
+
_,
|
|
34
|
+
T
|
|
35
35
|
]);
|
|
36
|
-
let
|
|
37
|
-
let t =
|
|
38
|
-
t &&
|
|
36
|
+
let L = f((e) => {
|
|
37
|
+
let t = T.find((t) => t.id === e);
|
|
38
|
+
t && S({
|
|
39
39
|
bankAccountId: t.id,
|
|
40
40
|
bankAccountType: t.type
|
|
41
41
|
});
|
|
42
|
-
}, [
|
|
43
|
-
|
|
44
|
-
}, []),
|
|
42
|
+
}, [S, T]), R = f(() => A(!0), []), z = f(() => {
|
|
43
|
+
A(!1), M(o), P({});
|
|
44
|
+
}, []), B = f((e) => M((t) => ({
|
|
45
45
|
...t,
|
|
46
46
|
...e
|
|
47
|
-
})), []),
|
|
48
|
-
let n =
|
|
49
|
-
if (
|
|
50
|
-
let t = await
|
|
51
|
-
|
|
47
|
+
})), []), V = f(async () => {
|
|
48
|
+
let n = d(j, x);
|
|
49
|
+
if (P(n), !(Object.keys(n).length > 0)) try {
|
|
50
|
+
let t = await O.mutateAsync({ body: s(j) });
|
|
51
|
+
A(!1), M(o), S({
|
|
52
52
|
bankAccountId: t.id,
|
|
53
53
|
bankAccountType: "BANK_DETAILS"
|
|
54
|
-
}), e.success(
|
|
54
|
+
}), e.success(x.bankAccountCreated.replace("{name}", t.display_name ?? ""));
|
|
55
55
|
} catch (n) {
|
|
56
|
-
e.error(t(n) ??
|
|
56
|
+
e.error(t(n) ?? x.bankAccountCreateFailed);
|
|
57
57
|
}
|
|
58
58
|
}, [
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
]),
|
|
64
|
-
accounts:
|
|
65
|
-
embeddedBankName:
|
|
66
|
-
messages:
|
|
59
|
+
O,
|
|
60
|
+
j,
|
|
61
|
+
x,
|
|
62
|
+
S
|
|
63
|
+
]), H = m(() => l({
|
|
64
|
+
accounts: T,
|
|
65
|
+
embeddedBankName: b,
|
|
66
|
+
messages: x
|
|
67
|
+
}), [
|
|
68
|
+
b,
|
|
69
|
+
x,
|
|
70
|
+
T
|
|
71
|
+
]), U = m(() => c({
|
|
72
|
+
options: H,
|
|
73
|
+
isLoading: E,
|
|
74
|
+
selectedId: v,
|
|
75
|
+
isAddingAccount: k,
|
|
76
|
+
canAddAccount: w.canAddAccount,
|
|
77
|
+
formValues: j,
|
|
78
|
+
formErrors: N,
|
|
79
|
+
isSaving: O.isPending
|
|
67
80
|
}), [
|
|
68
81
|
v,
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
82
|
+
O.isPending,
|
|
83
|
+
N,
|
|
84
|
+
j,
|
|
85
|
+
k,
|
|
86
|
+
E,
|
|
87
|
+
H,
|
|
88
|
+
w.canAddAccount
|
|
89
|
+
]), W = m(() => T.find((e) => e.id === v), [v, T]), { paymentAccount: G } = i({
|
|
90
|
+
id: v,
|
|
91
|
+
type: y || (v ? "BANK_DETAILS" : void 0),
|
|
92
|
+
enabled: _ && !E && !W
|
|
93
|
+
});
|
|
72
94
|
return {
|
|
73
|
-
view:
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
E.isPending,
|
|
85
|
-
j,
|
|
86
|
-
k,
|
|
87
|
-
D,
|
|
88
|
-
w,
|
|
89
|
-
B,
|
|
90
|
-
S.canAddAccount
|
|
91
|
-
]),
|
|
92
|
-
isLoading: w,
|
|
93
|
-
hasAccounts: C.length > 0,
|
|
94
|
-
canAddAccount: S.canAddAccount,
|
|
95
|
-
reset: P,
|
|
96
|
-
selectAccount: F,
|
|
97
|
-
openAddAccount: I,
|
|
98
|
-
cancelAddAccount: L,
|
|
99
|
-
updateAccountForm: R,
|
|
100
|
-
saveAccount: z
|
|
95
|
+
view: U,
|
|
96
|
+
selectedAccount: W ?? G,
|
|
97
|
+
isLoading: E,
|
|
98
|
+
hasAccounts: T.length > 0,
|
|
99
|
+
canAddAccount: w.canAddAccount,
|
|
100
|
+
reset: I,
|
|
101
|
+
selectAccount: L,
|
|
102
|
+
openAddAccount: R,
|
|
103
|
+
cancelAddAccount: z,
|
|
104
|
+
updateAccountForm: B,
|
|
105
|
+
saveAccount: V
|
|
101
106
|
};
|
|
102
107
|
}
|
|
103
108
|
//#endregion
|
|
104
|
-
export {
|
|
109
|
+
export { _ as useReceivableBankAccount };
|
|
@@ -12,10 +12,10 @@ import "../../../../../shared/feature/dist/index.js";
|
|
|
12
12
|
import { RECEIVABLE_DETAILS_SECTION as i } from "../../../../ui/dist/index25.js";
|
|
13
13
|
import "../../../../ui/dist/index.js";
|
|
14
14
|
import { useAllReceivableHistoryQuery as a } from "../../../../data-access/dist/index3.js";
|
|
15
|
-
import { usePaymentAccountsQuery as te } from "../../../../data-access/dist/
|
|
16
|
-
import { useReceivablePaymentRecordsQuery as o } from "../../../../data-access/dist/
|
|
17
|
-
import { useReceivablePdfLinkQuery as s, useReceivableQuery as ne, useReceivablesByIdQueries as re } from "../../../../data-access/dist/
|
|
18
|
-
import { useOverdueRemindersQuery as c, usePaymentRemindersQuery as ie, useRecurrenceQuery as l } from "../../../../data-access/dist/
|
|
15
|
+
import { usePaymentAccountsQuery as te } from "../../../../data-access/dist/index5.js";
|
|
16
|
+
import { useReceivablePaymentRecordsQuery as o } from "../../../../data-access/dist/index10.js";
|
|
17
|
+
import { useReceivablePdfLinkQuery as s, useReceivableQuery as ne, useReceivablesByIdQueries as re } from "../../../../data-access/dist/index12.js";
|
|
18
|
+
import { useOverdueRemindersQuery as c, usePaymentRemindersQuery as ie, useRecurrenceQuery as l } from "../../../../data-access/dist/index13.js";
|
|
19
19
|
import "../../../../data-access/dist/index.js";
|
|
20
20
|
import { canRecordPayments as u } from "./paymentRecord.js";
|
|
21
21
|
import { buildReceivableAuditHistoryLabels as d } from "./auditHistory/labels.js";
|