@tesouro/embedded-components-react 0.5.231 → 0.5.233
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 +1 -0
- package/dist/index.css +4 -0
- package/dist/index.d.ts +105 -2
- package/dist/index.js +1 -1
- package/dist/lib/ReceivablesWidget.d.ts +105 -2
- package/dist/lib/ReceivablesWidget.js +1 -1
- 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 +92 -55
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index11.js +67 -142
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index12.js +186 -17
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index13.js +27 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index3.js +45 -74
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index4.js +68 -53
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index5.js +66 -32
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index6.js +28 -34
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index7.js +24 -166
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index8.js +177 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index9.js +42 -95
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index13.js +36 -33
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index14.js +38 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index16.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index17.js +206 -147
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index18.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index19.js +39 -58
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index20.js +53 -227
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index21.js +216 -287
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index22.js +453 -43
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index23.js +103 -126
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index24.js +122 -146
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index25.js +145 -41
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index26.js +39 -115
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index27.js +113 -90
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index28.js +81 -98
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index29.js +111 -27
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index30.js +26 -633
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index31.js +639 -39
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index32.js +41 -40
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index33.js +35 -74
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index34.js +73 -130
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index35.js +133 -329
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index36.js +345 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +13 -12
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index10.js +15 -12
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index19.js +35 -24
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index21.js +8 -71
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index22.js +70 -17
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index23.js +31 -12
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index24.js +18 -30
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index25.js +12 -301
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index26.js +33 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index27.js +14 -46
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index28.js +23 -67
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index29.js +76 -485
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index30.js +395 -95
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index31.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index32.js +48 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index33.js +72 -4
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index34.js +496 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index35.js +97 -91
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index37.js +2 -236
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index38.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index39.js +1 -249
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index40.js +89 -82
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index41.js +23 -54
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index42.js +223 -340
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index43.js +3 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index44.js +249 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index45.js +93 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index46.js +59 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index47.js +353 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index9.js +18 -1
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +41 -41
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/clientRegistry.js +6 -3
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +75 -43
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index36.js +0 -28
package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index23.js
CHANGED
|
@@ -1,131 +1,108 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import { buildReceivableAuditHistory as e } from "../../../shared/util/dist/lib/auditHistory/buildReceivableAuditHistory.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 { useWidgetConfig as ee } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
10
|
+
import { useOrganizationUserNames as r } from "../../../shared/feature/dist/lib/user/useOrganizationUserNames.js";
|
|
11
|
+
import "../../../shared/feature/dist/index.js";
|
|
12
|
+
import { RECEIVABLE_DETAILS_SECTION as i } from "../../ui/dist/index21.js";
|
|
13
|
+
import "../../ui/dist/index.js";
|
|
14
|
+
import { useAllReceivableHistoryQuery as a } from "../../data-access/dist/index3.js";
|
|
15
|
+
import { usePaymentAccountsQuery as o } from "../../data-access/dist/index4.js";
|
|
16
|
+
import { useReceivablePaymentRecordsQuery as s } from "../../data-access/dist/index9.js";
|
|
17
|
+
import { useReceivablePdfLinkQuery as c, useReceivableQuery as te, useReceivablesByIdQueries as l } from "../../data-access/dist/index11.js";
|
|
18
|
+
import { useOverdueRemindersQuery as u, usePaymentRemindersQuery as ne, useRecurrenceQuery as d } from "../../data-access/dist/index12.js";
|
|
19
|
+
import "../../data-access/dist/index.js";
|
|
20
|
+
import { buildReceivableAuditHistoryLabels as f } from "./index19.js";
|
|
21
|
+
import { getBankAccountPermissions as re } from "./index20.js";
|
|
22
|
+
import { buildReceivableDetailsView as p, buildUnsupportedDetailsView as m } from "./index22.js";
|
|
23
|
+
import { useMemo as h, useState as g } from "react";
|
|
1
24
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index23.js
|
|
2
|
-
var
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
if (!c(e)) return null;
|
|
44
|
-
let { loc: t, msg: n, type: r } = e;
|
|
45
|
-
if (typeof n != "string" || !n.trim()) return null;
|
|
46
|
-
let i = Array.isArray(t) ? t.filter(o) : [];
|
|
25
|
+
var _ = [i.attachments];
|
|
26
|
+
function v({ selectedReceivableId: v, enabled: y = !0, messages: b, statusLabels: x, auditHistoryLabels: S, onOpenReceivable: C }) {
|
|
27
|
+
let { initResponse: w } = ee(), T = h(() => re(w?.scopes), [w?.scopes]), E = te(v, { enabled: y }), D = E.data, O = D?.type === "invoice" ? D : void 0, k = c(v, { enabled: y && !!O }), ie = ne({ enabled: y && !!O?.payment_reminder_id }), ae = u({ enabled: y && !!O?.overdue_reminder_id }), A = o({
|
|
28
|
+
enabled: y && !!O,
|
|
29
|
+
canReadEmbedded: T.canReadEmbedded,
|
|
30
|
+
canReadExternal: T.canReadExternal
|
|
31
|
+
}), j = d(y ? O?.recurrence_id : void 0), M = j.data, N = s(O?.id, { enabled: y }), P = a(O?.id, { enabled: y && !!O }), F = h(() => O?.status === "recurring" ? (M?.iterations ?? []).flatMap((e) => e.issued_invoice_id ? [e.issued_invoice_id] : []) : [], [O?.status, M?.iterations]), I = l(F, { enabled: y }), L = h(() => new Map(I.filter((e) => !!e).map((e) => [e.id, e])), [I]), [R, z] = g(_), [B, V] = g(v);
|
|
32
|
+
B !== v && (V(v), z(_));
|
|
33
|
+
let H = R.includes(i.auditHistory), U = h(() => P.data?.data ?? [], [P.data]), W = U.some((e) => e.recorded_by === "user" && !!e.entity_user_id), G = t(w?.scopes, [n.UserReadOrg]), { userNames: K, isError: q } = r({ enabled: y && H && G && W }), J = h(() => ({
|
|
34
|
+
...f(b, x),
|
|
35
|
+
...S
|
|
36
|
+
}), [
|
|
37
|
+
b,
|
|
38
|
+
x,
|
|
39
|
+
S
|
|
40
|
+
]), Y = h(() => {
|
|
41
|
+
let t = O ? e(U, K, J, {
|
|
42
|
+
documentType: "invoice",
|
|
43
|
+
currency: O.currency,
|
|
44
|
+
documentNumber: O.document_id,
|
|
45
|
+
dueDate: O.due_date
|
|
46
|
+
}) : [];
|
|
47
|
+
return {
|
|
48
|
+
rows: t,
|
|
49
|
+
countLabel: P.data && !P.isLoading && !P.isError ? String(t.length) : void 0,
|
|
50
|
+
isLoading: P.isLoading,
|
|
51
|
+
isError: P.isError,
|
|
52
|
+
showNamesError: G && q && W
|
|
53
|
+
};
|
|
54
|
+
}, [
|
|
55
|
+
O,
|
|
56
|
+
U,
|
|
57
|
+
K,
|
|
58
|
+
J,
|
|
59
|
+
P.data,
|
|
60
|
+
P.isLoading,
|
|
61
|
+
P.isError,
|
|
62
|
+
G,
|
|
63
|
+
q,
|
|
64
|
+
W
|
|
65
|
+
]), X = ie.data?.data.find((e) => e.id === O?.payment_reminder_id), Z = ae.data?.data.find((e) => e.id === O?.overdue_reminder_id), Q = A.paymentAccounts.find((e) => e.id === O?.bank_account_id), $ = k.data?.file_url || void 0;
|
|
47
66
|
return {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
return n.unknownError;
|
|
87
|
-
}
|
|
88
|
-
function g(e) {
|
|
89
|
-
return e.replace(/^(invoice|quote)\./, "");
|
|
90
|
-
}
|
|
91
|
-
var _ = /^line_items\.(?:(add|replace)\.)?(\d+)\.(?:data\.)?(.+)$/;
|
|
92
|
-
function v(e, t, n) {
|
|
93
|
-
return e === "add" ? n.added?.[t] : e === "replace" ? n.replaced?.[t] : n.created?.[t];
|
|
94
|
-
}
|
|
95
|
-
function y(e, r) {
|
|
96
|
-
let i = {}, a;
|
|
97
|
-
for (let { path: o, msg: s } of e) {
|
|
98
|
-
if (!o) continue;
|
|
99
|
-
let e = g(o);
|
|
100
|
-
if (e === "line_items") {
|
|
101
|
-
a = s;
|
|
102
|
-
continue;
|
|
103
|
-
}
|
|
104
|
-
let c = t[e];
|
|
105
|
-
if (c) {
|
|
106
|
-
i[c] = s;
|
|
107
|
-
continue;
|
|
108
|
-
}
|
|
109
|
-
let l = e.match(_);
|
|
110
|
-
if (!l) continue;
|
|
111
|
-
let [, u, d, f] = l;
|
|
112
|
-
if (f === "tax_rate_value") {
|
|
113
|
-
i.taxRate = s;
|
|
114
|
-
continue;
|
|
115
|
-
}
|
|
116
|
-
let p = n[f], m = v(u, Number(d), r);
|
|
117
|
-
p && m && (i.lineItems = {
|
|
118
|
-
...i.lineItems,
|
|
119
|
-
[m]: {
|
|
120
|
-
...i.lineItems?.[m],
|
|
121
|
-
[p]: s
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
return {
|
|
126
|
-
errors: i,
|
|
127
|
-
listError: a
|
|
67
|
+
receivable: D,
|
|
68
|
+
recurrence: M,
|
|
69
|
+
detailsView: h(() => p({
|
|
70
|
+
receivable: D,
|
|
71
|
+
pdfUrl: $,
|
|
72
|
+
paymentReminder: X,
|
|
73
|
+
overdueReminder: Z,
|
|
74
|
+
depositAccount: Q,
|
|
75
|
+
isAccountListIncomplete: A.isIncomplete,
|
|
76
|
+
recurrence: M,
|
|
77
|
+
paymentRecords: N.data?.data,
|
|
78
|
+
isLoadingPaymentRecords: N.isLoading,
|
|
79
|
+
iterationInvoices: L,
|
|
80
|
+
auditHistory: Y,
|
|
81
|
+
statusLabels: x,
|
|
82
|
+
messages: b,
|
|
83
|
+
onOpenReceivable: C
|
|
84
|
+
}), [
|
|
85
|
+
D,
|
|
86
|
+
$,
|
|
87
|
+
X,
|
|
88
|
+
Z,
|
|
89
|
+
Q,
|
|
90
|
+
A.isIncomplete,
|
|
91
|
+
M,
|
|
92
|
+
N.data,
|
|
93
|
+
N.isLoading,
|
|
94
|
+
L,
|
|
95
|
+
Y,
|
|
96
|
+
x,
|
|
97
|
+
b,
|
|
98
|
+
C
|
|
99
|
+
]),
|
|
100
|
+
unsupportedView: h(() => m(D, b), [D, b]),
|
|
101
|
+
openSections: R,
|
|
102
|
+
setOpenSections: z,
|
|
103
|
+
isLoading: E.isLoading || k.isLoading || j.isLoading,
|
|
104
|
+
isError: E.isError
|
|
128
105
|
};
|
|
129
106
|
}
|
|
130
107
|
//#endregion
|
|
131
|
-
export {
|
|
108
|
+
export { v as useReceivableDetails };
|
package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index24.js
CHANGED
|
@@ -1,155 +1,131 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
"use client";
|
|
3
|
-
"use client";
|
|
4
|
-
"use client";
|
|
5
|
-
import { toFileArray as e, validateAttachmentFile as t } from "./index7.js";
|
|
6
|
-
import { useDeleteReceivableAttachmentMutation as n, useUploadReceivableAttachmentMutation as r } from "../../data-access/dist/index4.js";
|
|
7
|
-
import "../../data-access/dist/index.js";
|
|
8
|
-
import { useCallback as i, useEffect as a, useRef as o, useState as s } from "react";
|
|
9
1
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index24.js
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
2
|
+
var e = {
|
|
3
|
+
invoice: [
|
|
4
|
+
"ReceivableFacadeCreateQuotePayload",
|
|
5
|
+
"ReceivableCreateBasedOnPayload",
|
|
6
|
+
"UpdateQuotePayload",
|
|
7
|
+
"UpdateCreditNotePayload",
|
|
8
|
+
"UpdateIssuedInvoicePayload"
|
|
9
|
+
],
|
|
10
|
+
quote: [
|
|
11
|
+
"ReceivableFacadeCreateInvoicePayload",
|
|
12
|
+
"ReceivableCreateBasedOnPayload",
|
|
13
|
+
"UpdateInvoicePayload",
|
|
14
|
+
"UpdateCreditNotePayload",
|
|
15
|
+
"UpdateIssuedInvoicePayload"
|
|
16
|
+
]
|
|
17
|
+
}, t = {
|
|
18
|
+
counterpart_id: "customerId",
|
|
19
|
+
counterpart_billing_address_id: "customerId",
|
|
20
|
+
counterpart_shipping_address_id: "customerId",
|
|
21
|
+
bank_account_id: "bankAccountId",
|
|
22
|
+
bank_account_type: "bankAccountId",
|
|
23
|
+
payment_terms_id: "paymentTermsId",
|
|
24
|
+
"payment_terms.term_final.end_date": "paymentTermsId",
|
|
25
|
+
"payment_terms.term_final.number_of_days": "paymentTermsId",
|
|
26
|
+
memo: "openingNote",
|
|
27
|
+
footer: "closingNote",
|
|
28
|
+
"discount.amount": "discount"
|
|
29
|
+
}, n = {
|
|
30
|
+
quantity: "quantity",
|
|
31
|
+
"product.name": "name",
|
|
32
|
+
"product.price.value": "price",
|
|
33
|
+
"product.price.currency": "price",
|
|
34
|
+
"product.measure_unit.name": "measureUnit"
|
|
35
|
+
}, r = (e) => typeof e == "number" || /^\d+$/.test(e), i = (e) => /^[A-Z]/.test(e) || e.includes("[") || e.includes("-"), a = (e) => e.filter((e, t) => t !== 0 || e !== "body").filter((e) => r(e) || !i(String(e))).join("."), o = (e) => typeof e == "string" || typeof e == "number", s = (e, t) => e === t || RegExp(`(^|[^A-Za-z0-9_])${t}([^A-Za-z0-9_]|$)`).test(e), c = (e) => typeof e == "object" && !!e;
|
|
36
|
+
function l(e) {
|
|
37
|
+
if (typeof e == "string") return e.trim() ? {
|
|
38
|
+
path: "",
|
|
39
|
+
loc: [],
|
|
40
|
+
msg: e,
|
|
41
|
+
type: ""
|
|
42
|
+
} : null;
|
|
43
|
+
if (!c(e)) return null;
|
|
44
|
+
let { loc: t, msg: n, type: r } = e;
|
|
45
|
+
if (typeof n != "string" || !n.trim()) return null;
|
|
46
|
+
let i = Array.isArray(t) ? t.filter(o) : [];
|
|
47
|
+
return {
|
|
48
|
+
path: a(i),
|
|
49
|
+
loc: i,
|
|
50
|
+
msg: n,
|
|
51
|
+
type: typeof r == "string" ? r : ""
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function u(e, t = []) {
|
|
55
|
+
if (!c(e) || !Array.isArray(e.detail)) return [];
|
|
56
|
+
let n = [], r = /* @__PURE__ */ new Set();
|
|
57
|
+
for (let i of e.detail) {
|
|
58
|
+
let e = l(i);
|
|
59
|
+
if (!e || e.loc.some((e) => typeof e == "string" && t.some((t) => s(e, t)))) continue;
|
|
60
|
+
let a = `${e.path}:${e.msg}`;
|
|
61
|
+
r.has(a) || (r.add(a), n.push(e));
|
|
62
|
+
}
|
|
63
|
+
return n;
|
|
64
|
+
}
|
|
65
|
+
var d = 3;
|
|
66
|
+
function f(e, t) {
|
|
67
|
+
let n = [...new Set(e.map(({ msg: e }) => e))];
|
|
68
|
+
if (!n.length) return "";
|
|
69
|
+
let r = n.slice(0, d).join("; "), i = n.length - d;
|
|
70
|
+
return i > 0 ? t.apiErrorsSummary.replace("{message}", r).replace("{count}", String(i)) : r;
|
|
71
|
+
}
|
|
72
|
+
var p = 200;
|
|
73
|
+
function m(e) {
|
|
74
|
+
let t = e.trim();
|
|
75
|
+
if (!(!t || t.length > p) && !t.includes("<")) return t;
|
|
76
|
+
}
|
|
77
|
+
function h(e, { irrelevantVariants: t, messages: n }) {
|
|
78
|
+
if (e instanceof Error) return e.message;
|
|
79
|
+
if (typeof e == "string") return m(e) ?? n.unknownError;
|
|
80
|
+
if (!c(e)) return n.unknownError;
|
|
81
|
+
if (c(e.error) && typeof e.error.message == "string") return e.error.message;
|
|
82
|
+
if (Array.isArray(e.detail)) {
|
|
83
|
+
let r = f(u(e, t), n);
|
|
84
|
+
if (r) return r;
|
|
85
|
+
}
|
|
86
|
+
return n.unknownError;
|
|
87
|
+
}
|
|
88
|
+
function g(e) {
|
|
89
|
+
return e.replace(/^(invoice|quote)\./, "");
|
|
90
|
+
}
|
|
91
|
+
var _ = /^line_items\.(?:(add|replace)\.)?(\d+)\.(?:data\.)?(.+)$/;
|
|
92
|
+
function v(e, t, n) {
|
|
93
|
+
return e === "add" ? n.added?.[t] : e === "replace" ? n.replaced?.[t] : n.created?.[t];
|
|
94
|
+
}
|
|
95
|
+
function y(e, r) {
|
|
96
|
+
let i = {}, a;
|
|
97
|
+
for (let { path: o, msg: s } of e) {
|
|
98
|
+
if (!o) continue;
|
|
99
|
+
let e = g(o);
|
|
100
|
+
if (e === "line_items") {
|
|
101
|
+
a = s;
|
|
102
|
+
continue;
|
|
90
103
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
w
|
|
96
|
-
]), E = i((e, t) => {
|
|
97
|
-
l((n) => n.map((n) => n.id === e ? {
|
|
98
|
-
...n,
|
|
99
|
-
includeInEmail: t
|
|
100
|
-
} : n));
|
|
101
|
-
}, [l]), D = i((e) => {
|
|
102
|
-
g(!1);
|
|
103
|
-
let t = p.find((t) => t.id === e);
|
|
104
|
-
if (t) {
|
|
105
|
-
t.status === "uploading" && v.current.add(e), m((t) => t.filter((t) => t.id !== e));
|
|
106
|
-
return;
|
|
104
|
+
let c = t[e];
|
|
105
|
+
if (c) {
|
|
106
|
+
i[c] = s;
|
|
107
|
+
continue;
|
|
107
108
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
let l = e.match(_);
|
|
110
|
+
if (!l) continue;
|
|
111
|
+
let [, u, d, f] = l;
|
|
112
|
+
if (f === "tax_rate_value") {
|
|
113
|
+
i.taxRate = s;
|
|
114
|
+
continue;
|
|
111
115
|
}
|
|
112
|
-
f(
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
u,
|
|
120
|
-
l
|
|
121
|
-
]), O = i(() => {
|
|
122
|
-
x.current += 1, v.current.clear(), y.current.clear(), b.current.clear(), m([]), g(!1);
|
|
123
|
-
}, []), k = i(() => {
|
|
124
|
-
let e = new Set(y.current);
|
|
125
|
-
for (let t of e) f({
|
|
126
|
-
path: { file_id: t },
|
|
127
|
-
receivableId: u
|
|
128
|
-
});
|
|
129
|
-
l((t) => t.filter(({ id: t }) => !e.has(t))), O();
|
|
130
|
-
}, [
|
|
131
|
-
f,
|
|
132
|
-
u,
|
|
133
|
-
O,
|
|
134
|
-
l
|
|
135
|
-
]), A = i(() => {
|
|
136
|
-
for (let e of b.current) f({
|
|
137
|
-
path: { file_id: e },
|
|
138
|
-
receivableId: u
|
|
116
|
+
let p = n[f], m = v(u, Number(d), r);
|
|
117
|
+
p && m && (i.lineItems = {
|
|
118
|
+
...i.lineItems,
|
|
119
|
+
[m]: {
|
|
120
|
+
...i.lineItems?.[m],
|
|
121
|
+
[p]: s
|
|
122
|
+
}
|
|
139
123
|
});
|
|
140
|
-
|
|
141
|
-
}, [f, u]);
|
|
124
|
+
}
|
|
142
125
|
return {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
isCountLimitReached: h,
|
|
146
|
-
selectFiles: T,
|
|
147
|
-
setIncludeInEmail: E,
|
|
148
|
-
remove: D,
|
|
149
|
-
reset: O,
|
|
150
|
-
discardUploads: k,
|
|
151
|
-
commitRemovals: A
|
|
126
|
+
errors: i,
|
|
127
|
+
listError: a
|
|
152
128
|
};
|
|
153
129
|
}
|
|
154
130
|
//#endregion
|
|
155
|
-
export {
|
|
131
|
+
export { e as UNSUBMITTED_PAYLOAD_VARIANTS, y as apiValidationErrorsToFormErrors, h as getApiErrorMessage, u as parseApiValidationErrors, f as summarizeApiValidationErrors, g as toCreatePayloadPath };
|