@tesouro/embedded-components-react 0.5.227 → 0.5.230
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 +22 -21
- package/dist/index.d.ts +87 -34
- package/dist/index.js +1 -1
- package/dist/lib/ReceivablesWidget.d.ts +87 -34
- package/dist/lib/ReceivablesWidget.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index10.js +29 -59
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index11.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index5.js +32 -33
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index6.js +34 -32
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index7.js +1 -1
- 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/index10.js +120 -52
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index11.js +44 -100
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index12.js +93 -442
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index13.js +356 -201
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index14.js +225 -157
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index15.js +152 -21
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index16.js +18 -221
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index17.js +220 -31
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index18.js +125 -124
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index19.js +58 -150
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index20.js +232 -46
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index21.js +303 -122
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index22.js +43 -58
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index23.js +125 -98
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index24.js +140 -106
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index25.js +46 -232
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index26.js +119 -29
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index27.js +81 -613
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index28.js +116 -39
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index29.js +27 -33
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index30.js +634 -72
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index31.js +39 -119
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index32.js +36 -317
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index33.js +82 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index34.js +139 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index35.js +340 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index5.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index7.js +15 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index8.js +55 -468
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index9.js +443 -97
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +24 -22
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index10.js +32 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index11.js +205 -84
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index12.js +161 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +12 -20
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index14.js +25 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index15.js +4 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index16.js +95 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index17.js +3 -18
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index18.js +24 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index19.js +42 -4
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index2.js +14 -7
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index20.js +19 -12
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index21.js +73 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index22.js +17 -261
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index23.js +12 -44
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index24.js +28 -68
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index25.js +288 -479
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index26.js +1 -106
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index27.js +48 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index28.js +72 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index29.js +496 -4
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index3.js +121 -27
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index30.js +106 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index32.js +2 -28
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index33.js +4 -236
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index34.js +0 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index35.js +90 -239
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index36.js +24 -89
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index37.js +231 -54
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index38.js +3 -353
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index39.js +249 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index4.js +100 -207
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index40.js +93 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index41.js +59 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index42.js +353 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index5.js +35 -29
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index6.js +2 -216
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index7.js +9 -159
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index8.js +27 -14
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index9.js +216 -23
- 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 +189 -211
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +43 -59
- 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/package.json +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index31.js +0 -100
package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index5.js
CHANGED
|
@@ -1,37 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
"use client";
|
|
3
|
-
"use client";
|
|
4
|
-
"use client";
|
|
5
|
-
import { postReceivablesIdSend as e } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
|
|
6
|
-
import { invalidateAllClients as t } from "../../../shared/data-access/dist/lib/clientRegistry.js";
|
|
7
|
-
import { useEmbedApi as n } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
|
|
8
|
-
import { organizationHeaders as r } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
|
|
1
|
+
import { invalidateAllClients as e } from "../../../shared/data-access/dist/lib/clientRegistry.js";
|
|
9
2
|
import "../../../shared/data-access/dist/index.js";
|
|
10
|
-
import { receivableHistoryInvalidationKey as i,
|
|
11
|
-
import { useMutation as o } from "@tanstack/react-query";
|
|
3
|
+
import { receivableHistoryInvalidationKey as t, receivableInvalidationKey as n, receivablePdfInvalidationKey as r, receivablesAnalyticsInvalidationKey as i, receivablesInvalidationKey as a } from "./index2.js";
|
|
12
4
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index5.js
|
|
13
|
-
function s
|
|
14
|
-
let
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
5
|
+
async function o({ client: o, organizationId: s, receivableId: c }) {
|
|
6
|
+
let l = [
|
|
7
|
+
a({
|
|
8
|
+
client: o,
|
|
9
|
+
organizationId: s
|
|
10
|
+
}),
|
|
11
|
+
i({
|
|
12
|
+
client: o,
|
|
13
|
+
organizationId: s
|
|
14
|
+
}),
|
|
15
|
+
...c ? [
|
|
16
|
+
n({
|
|
17
|
+
client: o,
|
|
18
|
+
organizationId: s,
|
|
19
|
+
receivableId: c
|
|
20
|
+
}),
|
|
21
|
+
t({
|
|
22
|
+
client: o,
|
|
23
|
+
organizationId: s,
|
|
24
|
+
receivableId: c
|
|
25
|
+
}),
|
|
26
|
+
r({
|
|
27
|
+
client: o,
|
|
28
|
+
organizationId: s,
|
|
29
|
+
receivableId: c
|
|
30
|
+
})
|
|
31
|
+
] : []
|
|
32
|
+
];
|
|
33
|
+
await Promise.all(l.map((t) => e(t)));
|
|
35
34
|
}
|
|
36
35
|
//#endregion
|
|
37
|
-
export {
|
|
36
|
+
export { o as invalidateReceivable };
|
package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index6.js
CHANGED
|
@@ -1,36 +1,38 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import { postReceivablesIdSend as e } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
|
|
6
|
+
import { invalidateAllClients as t } from "../../../shared/data-access/dist/lib/clientRegistry.js";
|
|
7
|
+
import { useEmbedApi as n } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
|
|
8
|
+
import { organizationHeaders as r } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
|
|
2
9
|
import "../../../shared/data-access/dist/index.js";
|
|
3
|
-
import {
|
|
10
|
+
import { receivableMailsInvalidationKey as i } from "./index2.js";
|
|
11
|
+
import { invalidateReceivable as a } from "./index5.js";
|
|
12
|
+
import { useMutation as o } from "@tanstack/react-query";
|
|
4
13
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index6.js
|
|
5
|
-
|
|
6
|
-
let
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
client: o,
|
|
28
|
-
organizationId: s,
|
|
29
|
-
receivableId: c
|
|
30
|
-
})
|
|
31
|
-
] : []
|
|
32
|
-
];
|
|
33
|
-
await Promise.all(l.map((t) => e(t)));
|
|
14
|
+
function s() {
|
|
15
|
+
let { client: s, organizationId: c } = n();
|
|
16
|
+
return o({
|
|
17
|
+
mutationFn: async ({ path: t, body: n }) => {
|
|
18
|
+
let { data: i } = await e({
|
|
19
|
+
client: s,
|
|
20
|
+
headers: r(c),
|
|
21
|
+
path: t,
|
|
22
|
+
body: n,
|
|
23
|
+
throwOnError: !0
|
|
24
|
+
});
|
|
25
|
+
return i;
|
|
26
|
+
},
|
|
27
|
+
onSuccess: async (e, n) => {
|
|
28
|
+
let r = {
|
|
29
|
+
client: s,
|
|
30
|
+
organizationId: c,
|
|
31
|
+
receivableId: n.path.receivable_id
|
|
32
|
+
};
|
|
33
|
+
await Promise.all([t(i(r)), a(r)]);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
34
36
|
}
|
|
35
37
|
//#endregion
|
|
36
|
-
export {
|
|
38
|
+
export { s as useSendReceivableEmailMutation };
|
package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index7.js
CHANGED
|
@@ -6,7 +6,7 @@ import { deleteReceivablesId as e, patchReceivablesId as t, postReceivables as n
|
|
|
6
6
|
import { useEmbedApi as c } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
|
|
7
7
|
import { organizationHeaders as l } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
|
|
8
8
|
import "../../../shared/data-access/dist/index.js";
|
|
9
|
-
import { invalidateReceivable as u } from "./
|
|
9
|
+
import { invalidateReceivable as u } from "./index5.js";
|
|
10
10
|
import { useMutation as d } from "@tanstack/react-query";
|
|
11
11
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index7.js
|
|
12
12
|
function f() {
|
package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index10.js
CHANGED
|
@@ -1,59 +1,127 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { RECEIVABLE_PAYMENT_TERMS_CUSTOM_DATE as e, RECEIVABLE_PAYMENT_TERMS_RECEIPT_DUE as t } from "../../ui/dist/index15.js";
|
|
2
|
+
import "../../ui/dist/index.js";
|
|
3
|
+
import { addDays as n, addYears as r, format as i, isValid as a, max as o, min as s, parseISO as c, subYears as l } from "date-fns";
|
|
3
4
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index10.js
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
return
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
function
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
function u(e) {
|
|
5
|
+
var u = "MMM d, yyyy", d = "yyyy-MM-dd", f = 10, p = 5;
|
|
6
|
+
function m(e) {
|
|
7
|
+
let t = (e) => e ? {
|
|
8
|
+
number_of_days: e.number_of_days ?? null,
|
|
9
|
+
discount: e.discount ?? null
|
|
10
|
+
} : null;
|
|
11
|
+
return JSON.stringify({
|
|
12
|
+
name: e.name,
|
|
13
|
+
description: e.description ?? null,
|
|
14
|
+
term_final: { number_of_days: e.term_final?.number_of_days ?? null },
|
|
15
|
+
term_1: t(e.term_1),
|
|
16
|
+
term_2: t(e.term_2)
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function h(e) {
|
|
20
|
+
let t = /* @__PURE__ */ new Set();
|
|
21
|
+
return e.filter((e) => {
|
|
22
|
+
let n = m(e);
|
|
23
|
+
return !t.has(n) && (t.add(n), !0);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function g(e) {
|
|
27
|
+
return i(e, u);
|
|
28
|
+
}
|
|
29
|
+
function _(e, t) {
|
|
30
|
+
let r = e.term_final?.number_of_days;
|
|
31
|
+
return r ? n(t, r) : void 0;
|
|
32
|
+
}
|
|
33
|
+
function v(e, t = /* @__PURE__ */ new Date()) {
|
|
34
|
+
let n = c(e);
|
|
35
|
+
return a(n) ? n : t;
|
|
36
|
+
}
|
|
37
|
+
function y(e, t) {
|
|
38
|
+
let n = _(e, t);
|
|
40
39
|
return {
|
|
41
|
-
|
|
42
|
-
|
|
40
|
+
value: e.id,
|
|
41
|
+
label: e.name,
|
|
42
|
+
...n ? { dueDateLabel: g(n) } : {}
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
-
function
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
function b(e) {
|
|
46
|
+
return e ? c(e) : void 0;
|
|
47
|
+
}
|
|
48
|
+
function x({ terms: e, isLoading: t, fields: n, customDatePickerOpen: r, isRecurring: i = !1, messages: a, issueDate: o = /* @__PURE__ */ new Date() }) {
|
|
49
|
+
if (t) return { kind: "loading" };
|
|
50
|
+
let s = h(e ?? []).map((e) => y(e, o)), c = b(n.paymentTermsCustomDate), l;
|
|
51
|
+
if (n.paymentTermsId === "receipt_due") l = { kind: "receiptDue" };
|
|
52
|
+
else if (n.paymentTermsId === "custom") l = {
|
|
53
|
+
kind: "customDate",
|
|
54
|
+
hasDate: !!c,
|
|
55
|
+
dateLabel: c ? g(c) : a.paymentTermsCustomDatePlaceholder
|
|
56
|
+
};
|
|
57
|
+
else {
|
|
58
|
+
let e = s.find((e) => e.value === n.paymentTermsId);
|
|
59
|
+
e && (l = {
|
|
60
|
+
kind: "term",
|
|
61
|
+
option: e
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
kind: "ready",
|
|
66
|
+
value: n.paymentTermsId,
|
|
67
|
+
options: s,
|
|
68
|
+
selection: l,
|
|
69
|
+
customDatePicker: { open: r },
|
|
70
|
+
showCustomDate: !i,
|
|
71
|
+
...i ? { description: a.recurrenceSeriesPaymentTerms } : {}
|
|
72
|
+
};
|
|
51
73
|
}
|
|
52
|
-
function
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
74
|
+
function S(e, t = /* @__PURE__ */ new Date()) {
|
|
75
|
+
let n = b(e), i = l(t, f), a = r(t, p);
|
|
76
|
+
return {
|
|
77
|
+
selected: n,
|
|
78
|
+
startMonth: n ? s([i, n]) : i,
|
|
79
|
+
endMonth: n ? o([a, n]) : a
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
function C(e, t) {
|
|
83
|
+
return t === "custom" ? {
|
|
84
|
+
paymentTermsId: t,
|
|
85
|
+
paymentTermsCustomDate: e.paymentTermsId === "custom" ? e.paymentTermsCustomDate : ""
|
|
86
|
+
} : {
|
|
87
|
+
paymentTermsId: t,
|
|
88
|
+
paymentTermsCustomDate: ""
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function w(e) {
|
|
92
|
+
return e.paymentTermsId === "custom" && !e.paymentTermsCustomDate ? {
|
|
93
|
+
paymentTermsId: "",
|
|
94
|
+
paymentTermsCustomDate: ""
|
|
95
|
+
} : e;
|
|
96
|
+
}
|
|
97
|
+
function T(e) {
|
|
98
|
+
return e ? i(e, d) : "";
|
|
99
|
+
}
|
|
100
|
+
function E(e) {
|
|
101
|
+
return e.paymentTermsId === "custom" ? e.paymentTermsCustomDate ? { payment_terms: { term_final: { end_date: e.paymentTermsCustomDate } } } : { payment_terms: { term_final: { number_of_days: 0 } } } : e.paymentTermsId === "receipt_due" ? { payment_terms: { term_final: { number_of_days: 0 } } } : e.paymentTermsId ? { payment_terms_id: e.paymentTermsId } : {};
|
|
102
|
+
}
|
|
103
|
+
function D(e) {
|
|
104
|
+
return e.paymentTermsId ? E(e) : {
|
|
105
|
+
payment_terms_id: null,
|
|
106
|
+
payment_terms: null
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
function O(n) {
|
|
110
|
+
if (n?.id) return {
|
|
111
|
+
paymentTermsId: n.id,
|
|
112
|
+
paymentTermsCustomDate: ""
|
|
113
|
+
};
|
|
114
|
+
let r = n?.term_final?.end_date;
|
|
115
|
+
return r ? {
|
|
116
|
+
paymentTermsId: e,
|
|
117
|
+
paymentTermsCustomDate: r.slice(0, 10)
|
|
118
|
+
} : n?.term_final?.number_of_days === 0 ? {
|
|
119
|
+
paymentTermsId: t,
|
|
120
|
+
paymentTermsCustomDate: ""
|
|
121
|
+
} : {
|
|
122
|
+
paymentTermsId: "",
|
|
123
|
+
paymentTermsCustomDate: ""
|
|
124
|
+
};
|
|
57
125
|
}
|
|
58
126
|
//#endregion
|
|
59
|
-
export {
|
|
127
|
+
export { S as buildCustomDateCalendar, E as buildPaymentTermsPayload, D as buildPaymentTermsUpdatePayload, x as buildPaymentTermsView, w as closeCustomDatePickerFields, h as dedupePaymentTerms, g as formatTermDate, O as paymentTermsToFormFields, v as resolveIssueDate, C as selectPaymentTermsFields, _ as termDueDate, T as toCustomDateValue };
|
package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index11.js
CHANGED
|
@@ -1,115 +1,59 @@
|
|
|
1
1
|
import { minorExponentForCurrency as e } from "../../../shared/util/dist/lib/amountOutputToMajorUnits.js";
|
|
2
|
-
import {
|
|
3
|
-
import { discountFromDraft as s } from "./index10.js";
|
|
2
|
+
import { escapeRegex as t, getNumberSeparators as n, parseLocaleDecimal as r } from "./index6.js";
|
|
4
3
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index11.js
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
return Math.round(o(e.price, t) * a(e.quantity));
|
|
4
|
+
function i(t, n) {
|
|
5
|
+
return t === "percentage" ? 2 : e(n);
|
|
8
6
|
}
|
|
9
|
-
function
|
|
10
|
-
let
|
|
11
|
-
|
|
12
|
-
let e = l(n, t);
|
|
13
|
-
n.taxable ? i += e : a += e;
|
|
14
|
-
}
|
|
15
|
-
return {
|
|
16
|
-
taxableItemsSubtotal: i,
|
|
17
|
-
nonTaxableItemsSubtotal: a,
|
|
18
|
-
subtotal: i + a,
|
|
19
|
-
rateMinorUnits: r
|
|
20
|
-
};
|
|
7
|
+
function a(e, r, a, o = n()) {
|
|
8
|
+
let s = `0-9${t(o.digits.join(""))}${t(o.decimal)}${o.group ? t(o.group) : ""}`, c = e.replace(RegExp(`[^${s}]`, "gu"), ""), l = c.indexOf(o.decimal);
|
|
9
|
+
return l === -1 ? c : c.slice(0, l + o.decimal.length) + Array.from(c.slice(l + o.decimal.length).split(o.decimal).join("")).slice(0, i(r, a)).join("");
|
|
21
10
|
}
|
|
22
|
-
function
|
|
23
|
-
|
|
24
|
-
let n = e.value ?? (e.type === "amount" ? e.amount : Math.round(t * e.amount / 1e4));
|
|
25
|
-
return Math.min(Math.max(n, 0), t);
|
|
11
|
+
function o(e, t, a, o = n()) {
|
|
12
|
+
return Math.round(r(e, o) * 10 ** i(t, a));
|
|
26
13
|
}
|
|
27
|
-
function
|
|
28
|
-
let r =
|
|
29
|
-
return {
|
|
30
|
-
|
|
31
|
-
|
|
14
|
+
function s(e, t, n) {
|
|
15
|
+
let r = i(t, n);
|
|
16
|
+
return new Intl.NumberFormat(void 0, {
|
|
17
|
+
minimumFractionDigits: r,
|
|
18
|
+
maximumFractionDigits: r
|
|
19
|
+
}).format(e / 10 ** r);
|
|
20
|
+
}
|
|
21
|
+
function c(e, t, n) {
|
|
22
|
+
let r = i(t, n), a = {
|
|
23
|
+
minimumFractionDigits: r,
|
|
24
|
+
maximumFractionDigits: r
|
|
32
25
|
};
|
|
33
|
-
|
|
34
|
-
function p({ lineItems: e, currency: t, rateMinorUnits: n, keepSavedRate: i, taxableItemsSubtotal: a, taxableSubtotal: o }) {
|
|
35
|
-
if (a <= 0) return 0;
|
|
36
|
-
let s = /* @__PURE__ */ new Map();
|
|
37
|
-
for (let a of e) {
|
|
38
|
-
if (!a.taxable) continue;
|
|
39
|
-
let e = r(a, n, i);
|
|
40
|
-
s.set(e, (s.get(e) ?? 0) + l(a, t));
|
|
41
|
-
}
|
|
42
|
-
let u = [...s], d = o, f = 0;
|
|
43
|
-
return u.forEach(([e, t], n) => {
|
|
44
|
-
let r = n === u.length - 1 ? d : Math.round(o * t / a);
|
|
45
|
-
d -= r, f += r * e;
|
|
46
|
-
}), Math.round(f / c);
|
|
47
|
-
}
|
|
48
|
-
function m({ lineItems: e, currency: t, taxRate: n, keepSavedRate: r = !1, discount: i }) {
|
|
49
|
-
let a = u({
|
|
50
|
-
lineItems: e,
|
|
51
|
-
currency: t,
|
|
52
|
-
taxRate: n
|
|
53
|
-
}), o = d({
|
|
54
|
-
discount: i,
|
|
55
|
-
subtotal: a.subtotal
|
|
56
|
-
}), { taxableSubtotal: s, nonTaxableSubtotal: c } = f({
|
|
26
|
+
return t === "percentage" ? new Intl.NumberFormat(void 0, {
|
|
57
27
|
...a,
|
|
58
|
-
|
|
59
|
-
})
|
|
60
|
-
lineItems: e,
|
|
61
|
-
currency: t,
|
|
62
|
-
rateMinorUnits: a.rateMinorUnits,
|
|
63
|
-
keepSavedRate: r,
|
|
64
|
-
taxableItemsSubtotal: a.taxableItemsSubtotal,
|
|
65
|
-
taxableSubtotal: s
|
|
66
|
-
}), m = a.subtotal - o;
|
|
67
|
-
return {
|
|
28
|
+
style: "percent"
|
|
29
|
+
}).format(e / 10 ** (r + 2)) : new Intl.NumberFormat(void 0, {
|
|
68
30
|
...a,
|
|
69
|
-
discountAmount: o,
|
|
70
|
-
discountedSubtotal: m,
|
|
71
|
-
taxableSubtotal: s,
|
|
72
|
-
nonTaxableSubtotal: c,
|
|
73
|
-
totalTaxes: l,
|
|
74
|
-
total: m + l
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
function h(e) {
|
|
78
|
-
return m({
|
|
79
|
-
lineItems: e.lineItems.filter((e) => !t(e)),
|
|
80
|
-
currency: e.currency,
|
|
81
|
-
taxRate: Number(e.taxRate) || void 0,
|
|
82
|
-
keepSavedRate: n(e.taxRate, e.savedTaxRate),
|
|
83
|
-
discount: s(e)
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
function g(e, t) {
|
|
87
|
-
let n = s(e);
|
|
88
|
-
if (n) return n.type === "percentage" ? n.amount > 1e4 ? t.discountPercentageTooHigh : void 0 : n.amount > h(e).subtotal ? t.discountExceedsSubtotal : void 0;
|
|
89
|
-
}
|
|
90
|
-
function _(e, n) {
|
|
91
|
-
if (e.lineItems.filter((e) => !t(e)).some((t) => o(t.price, e.currency) > 9e15)) return;
|
|
92
|
-
let { subtotal: r, total: a } = h(e), s = i(e.currency);
|
|
93
|
-
if (r > 9e15) return n.invoiceSubtotalTooHigh.replace("{maxAmount}", s);
|
|
94
|
-
if (a > 9e15) return n.invoiceTotalTooHigh.replace("{maxAmount}", s);
|
|
95
|
-
}
|
|
96
|
-
function v(t, n, r) {
|
|
97
|
-
return new Intl.NumberFormat(void 0, {
|
|
98
31
|
style: "currency",
|
|
99
32
|
currency: n,
|
|
100
|
-
currencyDisplay: "narrowSymbol"
|
|
101
|
-
|
|
102
|
-
|
|
33
|
+
currencyDisplay: "narrowSymbol"
|
|
34
|
+
}).format(e / 10 ** r);
|
|
35
|
+
}
|
|
36
|
+
function l({ value: e, type: t, currency: n }) {
|
|
37
|
+
return s(o(e, t, n), t, n);
|
|
103
38
|
}
|
|
104
|
-
function
|
|
39
|
+
function u(e) {
|
|
105
40
|
return {
|
|
106
|
-
|
|
107
|
-
discount:
|
|
108
|
-
nonTaxableSubtotal: v(e.nonTaxableSubtotal, t),
|
|
109
|
-
taxableSubtotal: v(e.taxableSubtotal, t),
|
|
110
|
-
tax: v(e.totalTaxes, t),
|
|
111
|
-
total: v(e.total, t)
|
|
41
|
+
discountType: "amount",
|
|
42
|
+
discount: s(0, "amount", e)
|
|
112
43
|
};
|
|
113
44
|
}
|
|
45
|
+
function d(e) {
|
|
46
|
+
let t = o(e.discount, e.discountType, e.currency);
|
|
47
|
+
return t > 0 ? {
|
|
48
|
+
type: e.discountType,
|
|
49
|
+
amount: t
|
|
50
|
+
} : null;
|
|
51
|
+
}
|
|
52
|
+
function f(e, t) {
|
|
53
|
+
return e ? {
|
|
54
|
+
discountType: e.type,
|
|
55
|
+
discount: s(e.amount, e.type, t)
|
|
56
|
+
} : u(t);
|
|
57
|
+
}
|
|
114
58
|
//#endregion
|
|
115
|
-
export {
|
|
59
|
+
export { l as convertDiscountInput, u as createEmptyDiscount, c as decorateDiscountInput, d as discountFromDraft, o as discountInputToMinorUnits, f as discountToDraft, s as formatDiscountInput, a as sanitizeDiscountInput };
|