@tesouro/embedded-components-react 0.5.205 → 0.5.207
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 -1
- package/dist/index.d.ts +51 -4
- package/dist/index.js +1 -1
- package/dist/lib/ReceivablesWidget.d.ts +51 -4
- package/dist/lib/ReceivablesWidget.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index10.js +84 -2
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index2.js +31 -25
- 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 +109 -193
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index11.js +154 -37
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index12.js +193 -135
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index13.js +37 -58
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index14.js +140 -86
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index15.js +42 -47
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index16.js +58 -313
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index17.js +91 -65
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index18.js +108 -102
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index19.js +48 -249
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index20.js +365 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index21.js +75 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index22.js +115 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index23.js +285 -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/index8.js +93 -407
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index9.js +430 -86
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index.js +17 -12
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index10.js +92 -16
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index11.js +3 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index12.js +24 -4
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +0 -10
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index14.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index15.js +3 -264
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index16.js +16 -70
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index17.js +1 -424
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index18.js +4 -106
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index19.js +12 -93
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index2.js +5 -179
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index20.js +1 -344
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index21.js +264 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index22.js +72 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index23.js +402 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index24.js +106 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index25.js +249 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index26.js +93 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index27.js +344 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index3.js +195 -32
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index4.js +29 -202
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index5.js +183 -137
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index6.js +157 -20
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index7.js +16 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index8.js +25 -3
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index9.js +4 -3
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/index.js +11 -11
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +38 -38
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +220 -198
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +124 -84
- 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/feature/dist/index18.js
CHANGED
|
@@ -2,114 +2,120 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
5
|
+
import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
6
|
+
import { extractApiErrorMessage as t } from "../../../shared/util/dist/lib/apiErrors.js";
|
|
7
|
+
import { usePaymentTermsQuery as n } from "../../../shared/data-access/dist/lib/reference-data/usePaymentTermsQuery.js";
|
|
8
|
+
import "../../../shared/ui/dist/index.js";
|
|
9
|
+
import { useWidgetConfig as r } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
6
10
|
import "../../../shared/feature/dist/index.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import { useReceivableDetails as c } from "./index11.js";
|
|
12
|
-
import { hasSelectedText as l } from "../../../shared/product-catalog/feature/dist/lib/helpers.js";
|
|
13
|
-
import "../../../shared/product-catalog/feature/dist/index.js";
|
|
14
|
-
import { useReceivableForm as u } from "./index16.js";
|
|
15
|
-
import { useReceivablesTable as d } from "./index17.js";
|
|
16
|
-
import { useCallback as f, useEffect as p, useMemo as m, useState as h } from "react";
|
|
11
|
+
import { areOverdueTermsValid as i, buildOverdueReminderPayload as a, buildPaymentReminderPayload as o, buildRemindersView as s, canCreateReminders as c, getImpliedDueDate as l, isBeforeDueDaysValid as u, sanitizeReminderDays as d } from "./index11.js";
|
|
12
|
+
import { useCreateOverdueReminderMutation as f, useCreatePaymentReminderMutation as p, useOverdueRemindersQuery as m, usePaymentRemindersQuery as h } from "../../data-access/dist/index10.js";
|
|
13
|
+
import "../../data-access/dist/index.js";
|
|
14
|
+
import { useCallback as g, useMemo as _, useState as v } from "react";
|
|
17
15
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index18.js
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
p(() => {
|
|
21
|
-
|
|
22
|
-
}, [
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
16
|
+
var y = [""];
|
|
17
|
+
function b({ open: b, isInvoice: x, disabled: S, paymentTermsId: C, paymentTermsCustomDate: w, paymentReminderId: T, overdueReminderId: E, messages: D, onSelect: O }) {
|
|
18
|
+
let { initResponse: k } = r(), A = n().data?.data, j = _(() => c(k?.scopes), [k?.scopes]), [M, N] = v(!1), [P, F] = v(""), [I, L] = v(y), R = b && x && M, z = h({ enabled: R }), B = m({ enabled: R }), V = p(), H = f(), U = g((e) => {
|
|
19
|
+
N(e), F(""), L(y);
|
|
20
|
+
}, []), W = g((e) => {
|
|
21
|
+
e || (O({
|
|
22
|
+
paymentReminderId: "",
|
|
23
|
+
overdueReminderId: ""
|
|
24
|
+
}), F(""), L(y)), N(e);
|
|
25
|
+
}, [O]), G = g((e) => O({ paymentReminderId: e }), [O]), K = g((e) => O({ overdueReminderId: e }), [O]), q = g((e) => F(d(e)), []), J = g((e, t) => {
|
|
26
|
+
let n = d(t);
|
|
27
|
+
L((t) => t.map((t, r) => r === e ? n : t));
|
|
28
|
+
}, []), Y = g(() => {
|
|
29
|
+
L((e) => e.length < 3 ? [...e, ""] : e);
|
|
30
|
+
}, []), X = g(() => L(y), []), Z = g(() => l({
|
|
31
|
+
paymentTermsId: C,
|
|
32
|
+
paymentTermsCustomDate: w,
|
|
33
|
+
paymentTerms: A,
|
|
34
|
+
today: /* @__PURE__ */ new Date()
|
|
35
|
+
}), [
|
|
36
|
+
A,
|
|
37
|
+
w,
|
|
38
|
+
C
|
|
39
|
+
]), Q = g(async () => {
|
|
40
|
+
if (u(P)) try {
|
|
41
|
+
let t = await V.mutateAsync({ body: o({
|
|
42
|
+
daysBefore: Number(P),
|
|
43
|
+
dueDate: Z(),
|
|
44
|
+
messages: D
|
|
45
|
+
}) });
|
|
46
|
+
F(""), O({ paymentReminderId: t.id }), e.success(D.reminderAdded);
|
|
47
|
+
} catch (n) {
|
|
48
|
+
e.error(t(n) ?? D.genericError);
|
|
49
|
+
}
|
|
35
50
|
}, [
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
counterpartMessageLabels: g,
|
|
52
|
-
embeddedBankName: v,
|
|
53
|
-
onCreated: M
|
|
54
|
-
}), I = f(() => {
|
|
55
|
-
let e = a(E);
|
|
56
|
-
F.openCreate(e === "quote" ? "quote" : "invoice");
|
|
57
|
-
}, [E, F.openCreate]), L = s({
|
|
58
|
-
selectedReceivable: P.receivable,
|
|
59
|
-
messages: w,
|
|
60
|
-
onCreated: M,
|
|
61
|
-
onDeleted: (e) => {
|
|
62
|
-
e === O && (k(void 0), j(!1));
|
|
51
|
+
P,
|
|
52
|
+
V,
|
|
53
|
+
Z,
|
|
54
|
+
D,
|
|
55
|
+
O
|
|
56
|
+
]), $ = g(async () => {
|
|
57
|
+
if (i(I)) try {
|
|
58
|
+
let t = await H.mutateAsync({ body: a({
|
|
59
|
+
terms: I,
|
|
60
|
+
dueDate: Z(),
|
|
61
|
+
messages: D
|
|
62
|
+
}) });
|
|
63
|
+
L(y), O({ overdueReminderId: t.id }), e.success(D.reminderAdded);
|
|
64
|
+
} catch (n) {
|
|
65
|
+
e.error(t(n) ?? D.genericError);
|
|
63
66
|
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
+
}, [
|
|
68
|
+
H,
|
|
69
|
+
Z,
|
|
70
|
+
D,
|
|
71
|
+
O,
|
|
72
|
+
I
|
|
73
|
+
]);
|
|
67
74
|
return {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
75
|
+
view: _(() => x ? s({
|
|
76
|
+
showReminders: M,
|
|
77
|
+
paymentTermsId: C,
|
|
78
|
+
paymentTermsCustomDate: w,
|
|
79
|
+
paymentReminderId: T,
|
|
80
|
+
overdueReminderId: E,
|
|
81
|
+
paymentReminders: z.data?.data,
|
|
82
|
+
overdueReminders: B.data?.data,
|
|
83
|
+
canCreate: j,
|
|
84
|
+
disabled: S,
|
|
85
|
+
beforeDueInput: P,
|
|
86
|
+
overdueTerms: I,
|
|
87
|
+
isCreatingPaymentReminder: V.isPending,
|
|
88
|
+
isCreatingOverdueReminder: H.isPending,
|
|
89
|
+
today: /* @__PURE__ */ new Date(),
|
|
90
|
+
messages: D
|
|
91
|
+
}) : void 0, [
|
|
92
|
+
P,
|
|
93
|
+
j,
|
|
94
|
+
H.isPending,
|
|
95
|
+
V.isPending,
|
|
96
|
+
S,
|
|
97
|
+
x,
|
|
98
|
+
D,
|
|
99
|
+
E,
|
|
100
|
+
B.data?.data,
|
|
101
|
+
I,
|
|
102
|
+
T,
|
|
103
|
+
z.data?.data,
|
|
104
|
+
w,
|
|
105
|
+
C,
|
|
106
|
+
M
|
|
96
107
|
]),
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}, [
|
|
108
|
-
L,
|
|
109
|
-
P.receivable,
|
|
110
|
-
F.openEdit
|
|
111
|
-
])
|
|
108
|
+
reset: U,
|
|
109
|
+
toggle: W,
|
|
110
|
+
selectPaymentReminder: G,
|
|
111
|
+
selectOverdueReminder: K,
|
|
112
|
+
changeBeforeDueInput: q,
|
|
113
|
+
saveBeforeDue: Q,
|
|
114
|
+
changeOverdueTerm: J,
|
|
115
|
+
addOverdueTerm: Y,
|
|
116
|
+
clearOverdueTerms: X,
|
|
117
|
+
saveOverdue: $
|
|
112
118
|
};
|
|
113
119
|
}
|
|
114
120
|
//#endregion
|
|
115
|
-
export {
|
|
121
|
+
export { b as useReceivableReminders };
|
package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index19.js
CHANGED
|
@@ -1,253 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
"use client";
|
|
3
|
-
"use client";
|
|
4
|
-
"use client";
|
|
5
|
-
import { EmbeddedToaster as e } from "../../../shared/ui/dist/lib/EmbeddedToaster.js";
|
|
6
|
-
import "../../../shared/ui/dist/index.js";
|
|
7
|
-
import { useAnalyticsTrack as t } from "../../../shared/feature/dist/lib/analytics/hooks.js";
|
|
8
|
-
import { WidgetProvider as n } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
|
|
9
|
-
import "../../../shared/feature/dist/index.js";
|
|
10
|
-
import { CounterpartFormSheet as r } from "../../../shared/counterpart-management/ui/dist/index9.js";
|
|
11
|
-
import { CounterpartSelector as i } from "../../../shared/counterpart-management/feature/dist/lib/CounterpartSelector.js";
|
|
12
|
-
import "../../../shared/counterpart-management/feature/dist/index.js";
|
|
13
|
-
import { ReceivablesWidgetAnalyticsEvent as a, WIDGET_NAME as o } from "./index2.js";
|
|
14
|
-
import { PAGE_SIZE_OPTIONS as s } from "./index4.js";
|
|
15
|
-
import { ReceivableActionDialog as c } from "../../ui/dist/index3.js";
|
|
16
|
-
import { ReceivableBankAccountSection as l } from "../../ui/dist/index4.js";
|
|
17
|
-
import { ReceivableDetailsSheet as u } from "../../ui/dist/index15.js";
|
|
18
|
-
import { ReceivableFormSheet as d } from "../../ui/dist/index17.js";
|
|
19
|
-
import { ReceivablePaymentDialog as f } from "../../ui/dist/index18.js";
|
|
20
|
-
import { ReceivableSendDialog as p } from "../../ui/dist/index19.js";
|
|
21
|
-
import { ReceivablesScreen as m } from "../../ui/dist/index20.js";
|
|
22
|
-
import "../../ui/dist/index.js";
|
|
23
|
-
import { ReceivableAttachmentsSection as h } from "./index5.js";
|
|
24
|
-
import { MeasureUnitsManagerContainer as g } from "../../../shared/product-catalog/feature/dist/lib/MeasureUnitsManagerContainer.js";
|
|
25
|
-
import { ProductSelector as _ } from "../../../shared/product-catalog/feature/dist/lib/ProductSelector.js";
|
|
26
|
-
import "../../../shared/product-catalog/feature/dist/index.js";
|
|
27
|
-
import { useReceivablesWidget as v } from "./index18.js";
|
|
28
|
-
import { useEffect as y, useId as b, useState as x } from "react";
|
|
29
|
-
import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
1
|
+
import { parseQuantity as e, priceInputToMinorUnits as t } from "./index6.js";
|
|
30
2
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index19.js
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}), [W, G] = x(!1), K = b();
|
|
45
|
-
return /* @__PURE__ */ w(S, { children: [
|
|
46
|
-
/* @__PURE__ */ C(e, {}),
|
|
47
|
-
/* @__PURE__ */ C(m, {
|
|
48
|
-
rows: U.table.rows,
|
|
49
|
-
activeTab: U.activeTab,
|
|
50
|
-
enabledTabs: U.enabledTabs,
|
|
51
|
-
onTabChange: U.setActiveTab,
|
|
52
|
-
isLoading: U.table.isLoading,
|
|
53
|
-
isError: U.table.isError,
|
|
54
|
-
sorting: U.table.sorting,
|
|
55
|
-
onSortingChange: U.table.onSortingChange,
|
|
56
|
-
pageSize: U.table.pageSize,
|
|
57
|
-
onPageSizeChange: U.table.onPageSizeChange,
|
|
58
|
-
pageSizeOptions: I,
|
|
59
|
-
hasNextPage: U.table.hasNextPage,
|
|
60
|
-
hasPrevPage: U.table.hasPrevPage,
|
|
61
|
-
onNextPage: U.table.onNextPage,
|
|
62
|
-
onPrevPage: U.table.onPrevPage,
|
|
63
|
-
searchValue: U.table.searchValue,
|
|
64
|
-
onSearchChange: U.table.onSearchChange,
|
|
65
|
-
statusFilter: U.table.statusFilter,
|
|
66
|
-
statusOptions: U.table.statusOptions,
|
|
67
|
-
onStatusFilterChange: U.table.onStatusFilterChange,
|
|
68
|
-
isFiltering: U.table.isFiltering,
|
|
69
|
-
onCreateClick: U.openCreate,
|
|
70
|
-
onTemplateSettingsClick: F,
|
|
71
|
-
onRowClick: U.handleRowClick,
|
|
72
|
-
onActionClick: U.handleActionClick,
|
|
73
|
-
onRetry: U.table.onRetry,
|
|
74
|
-
labels: z
|
|
75
|
-
}),
|
|
76
|
-
/* @__PURE__ */ C(d, {
|
|
77
|
-
open: U.form.open,
|
|
78
|
-
onOpenChange: (e) => {
|
|
79
|
-
e || U.form.close();
|
|
80
|
-
},
|
|
81
|
-
mode: U.form.mode,
|
|
82
|
-
values: U.form.sheetValues,
|
|
83
|
-
errors: U.form.errors,
|
|
84
|
-
currencyOptions: U.form.currencyOptions,
|
|
85
|
-
paymentTermsOptions: U.form.paymentTermsOptions,
|
|
86
|
-
unitOptions: U.form.lineItemUnitOptions,
|
|
87
|
-
currencySymbol: U.form.currencySymbol,
|
|
88
|
-
lineItemControls: U.form.lineItemControls,
|
|
89
|
-
autoFocusLineItemId: U.form.autoFocusLineItemId,
|
|
90
|
-
lineItemsLoading: U.form.lineItemsLoading,
|
|
91
|
-
inProgress: U.form.isSubmitting,
|
|
92
|
-
customerSelector: /* @__PURE__ */ C(i, {
|
|
93
|
-
mode: "customer",
|
|
94
|
-
value: U.form.values.customerId || void 0,
|
|
95
|
-
onValueChange: (e) => U.form.updateValues({ customerId: e }),
|
|
96
|
-
onCreateClick: U.form.openCounterpartCreate
|
|
97
|
-
}),
|
|
98
|
-
renderProductSelector: (e, t) => /* @__PURE__ */ C(_, {
|
|
99
|
-
...t,
|
|
100
|
-
inputValue: e.name,
|
|
101
|
-
selectedProductId: U.form.values.lineItems.find((t) => t.id === e.id)?.productId || void 0,
|
|
102
|
-
currency: U.form.values.currency,
|
|
103
|
-
maxLength: 100,
|
|
104
|
-
onInputValueChange: (t) => U.form.updateLineItem(e.id, { name: t }),
|
|
105
|
-
onProductSelect: (t) => U.form.selectProduct(e.id, t)
|
|
106
|
-
}),
|
|
107
|
-
onChange: U.form.updateValues,
|
|
108
|
-
onLineItemChange: U.form.updateLineItem,
|
|
109
|
-
onLineItemCommit: U.form.commitLineItem,
|
|
110
|
-
onLineItemQuantityStep: U.form.stepLineItem,
|
|
111
|
-
onTaxRateCommit: U.form.commitTaxRate,
|
|
112
|
-
onManageUnits: () => G(!0),
|
|
113
|
-
onAddLineItem: U.form.addLineItem,
|
|
114
|
-
onRemoveLineItem: U.form.removeLineItem,
|
|
115
|
-
bankAccountSection: /* @__PURE__ */ C(l, {
|
|
116
|
-
idPrefix: K,
|
|
117
|
-
view: U.form.bankAccount.view,
|
|
118
|
-
disabled: U.form.isSubmitting,
|
|
119
|
-
onAccountSelect: U.form.bankAccount.selectAccount,
|
|
120
|
-
onAddAccountClick: U.form.bankAccount.openAddAccount,
|
|
121
|
-
onFormChange: U.form.bankAccount.updateAccountForm,
|
|
122
|
-
onFormSave: U.form.bankAccount.saveAccount,
|
|
123
|
-
onFormCancel: U.form.bankAccount.cancelAddAccount,
|
|
124
|
-
labels: k
|
|
125
|
-
}),
|
|
126
|
-
attachmentsSection: U.form.attachmentsView && /* @__PURE__ */ C(h, {
|
|
127
|
-
view: U.form.attachmentsView,
|
|
128
|
-
disabled: U.form.isSubmitting,
|
|
129
|
-
onFilesSelect: U.form.selectAttachmentFiles,
|
|
130
|
-
onIncludeInEmailChange: U.form.setAttachmentIncludeInEmail,
|
|
131
|
-
onRemove: U.form.removeAttachment,
|
|
132
|
-
labels: k
|
|
133
|
-
}),
|
|
134
|
-
cancelDisabled: U.form.attachmentsUploading,
|
|
135
|
-
saveDisabled: U.form.saveDisabled,
|
|
136
|
-
onSubmit: U.form.submit,
|
|
137
|
-
onCancel: U.form.close,
|
|
138
|
-
labels: k
|
|
139
|
-
}),
|
|
140
|
-
/* @__PURE__ */ C(u, {
|
|
141
|
-
open: U.detailsOpen,
|
|
142
|
-
onOpenChange: (e) => {
|
|
143
|
-
e || U.closeDetails();
|
|
144
|
-
},
|
|
145
|
-
details: U.details.detailsView,
|
|
146
|
-
isLoading: U.details.isLoading,
|
|
147
|
-
isError: U.details.isError,
|
|
148
|
-
onActionClick: U.handleDetailsActionClick,
|
|
149
|
-
onClose: U.closeDetails,
|
|
150
|
-
labels: E
|
|
151
|
-
}),
|
|
152
|
-
/* @__PURE__ */ C(p, {
|
|
153
|
-
open: U.actions.sendOpen,
|
|
154
|
-
onOpenChange: (e) => {
|
|
155
|
-
e || U.actions.closeSend();
|
|
156
|
-
},
|
|
157
|
-
values: U.actions.sendValues,
|
|
158
|
-
errors: U.actions.sendErrors,
|
|
159
|
-
inProgress: U.actions.sendInProgress,
|
|
160
|
-
onChange: (e) => U.actions.setSendValues((t) => ({
|
|
161
|
-
...t,
|
|
162
|
-
...e
|
|
163
|
-
})),
|
|
164
|
-
onSubmit: U.actions.submitSend,
|
|
165
|
-
onCancel: U.actions.closeSend,
|
|
166
|
-
labels: B
|
|
167
|
-
}),
|
|
168
|
-
/* @__PURE__ */ C(f, {
|
|
169
|
-
open: U.actions.paymentOpen,
|
|
170
|
-
onOpenChange: (e) => {
|
|
171
|
-
e || U.actions.closePayment();
|
|
172
|
-
},
|
|
173
|
-
values: U.actions.paymentValues,
|
|
174
|
-
errors: U.actions.paymentErrors,
|
|
175
|
-
inProgress: U.actions.paymentInProgress,
|
|
176
|
-
onChange: (e) => U.actions.setPaymentValues((t) => ({
|
|
177
|
-
...t,
|
|
178
|
-
...e
|
|
179
|
-
})),
|
|
180
|
-
onSubmit: U.actions.submitPayment,
|
|
181
|
-
onCancel: U.actions.closePayment,
|
|
182
|
-
labels: L
|
|
183
|
-
}),
|
|
184
|
-
U.actions.actionDialog && /* @__PURE__ */ C(c, {
|
|
185
|
-
open: !!U.actions.actionTarget,
|
|
186
|
-
onOpenChange: (e) => {
|
|
187
|
-
e || U.actions.closeAction();
|
|
188
|
-
},
|
|
189
|
-
title: U.actions.actionDialog.title,
|
|
190
|
-
description: U.actions.actionDialog.description,
|
|
191
|
-
confirmLabel: U.actions.actionDialog.confirmLabel,
|
|
192
|
-
destructive: U.actions.actionDialog.destructive,
|
|
193
|
-
error: U.actions.actionError,
|
|
194
|
-
inProgress: U.actions.actionInProgress,
|
|
195
|
-
onConfirm: U.actions.confirmAction,
|
|
196
|
-
onCancel: U.actions.closeAction,
|
|
197
|
-
labels: V
|
|
198
|
-
}),
|
|
199
|
-
/* @__PURE__ */ C(r, {
|
|
200
|
-
open: U.form.counterpartView === "create",
|
|
201
|
-
onOpenChange: (e) => {
|
|
202
|
-
e || U.form.counterpartForm.close();
|
|
203
|
-
},
|
|
204
|
-
mode: "create",
|
|
205
|
-
values: U.form.counterpartForm.values,
|
|
206
|
-
errors: U.form.counterpartForm.errors,
|
|
207
|
-
stateOptions: U.form.stateOptions,
|
|
208
|
-
inProgress: U.form.counterpartForm.isSubmitting,
|
|
209
|
-
onChange: (e) => U.form.counterpartForm.setValues((t) => ({
|
|
210
|
-
...t,
|
|
211
|
-
...e
|
|
212
|
-
})),
|
|
213
|
-
onAddressChange: (e) => U.form.counterpartForm.setValues((t) => ({
|
|
214
|
-
...t,
|
|
215
|
-
address: {
|
|
216
|
-
...t.address,
|
|
217
|
-
...e
|
|
218
|
-
}
|
|
219
|
-
})),
|
|
220
|
-
onSubmit: U.form.counterpartForm.submit,
|
|
221
|
-
onCancel: U.form.counterpartForm.close,
|
|
222
|
-
labels: n
|
|
223
|
-
}),
|
|
224
|
-
/* @__PURE__ */ C(g, {
|
|
225
|
-
open: W,
|
|
226
|
-
onClose: () => G(!1),
|
|
227
|
-
managerLabels: j,
|
|
228
|
-
deleteLabels: A,
|
|
229
|
-
messageLabels: R
|
|
230
|
-
})
|
|
231
|
-
] });
|
|
3
|
+
var n = 1e4;
|
|
4
|
+
function r({ lineItems: n, currency: r, taxRate: i }) {
|
|
5
|
+
let a = i ? i / 100 : 0, o = 0, s = 0;
|
|
6
|
+
for (let i of n) {
|
|
7
|
+
let n = Math.round(t(i.price, r) * e(i.quantity));
|
|
8
|
+
i.taxable ? o += n : s += n;
|
|
9
|
+
}
|
|
10
|
+
return {
|
|
11
|
+
taxableItemsSubtotal: o,
|
|
12
|
+
nonTaxableItemsSubtotal: s,
|
|
13
|
+
subtotal: o + s,
|
|
14
|
+
rate: a
|
|
15
|
+
};
|
|
232
16
|
}
|
|
233
|
-
function
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
})
|
|
17
|
+
function i({ discount: e, subtotal: t }) {
|
|
18
|
+
if (!e) return 0;
|
|
19
|
+
let r = e.value ?? (e.type === "amount" ? e.amount : Math.round(t * e.amount / n));
|
|
20
|
+
return Math.min(Math.max(r, 0), t);
|
|
21
|
+
}
|
|
22
|
+
function a({ taxableItemsSubtotal: e, nonTaxableItemsSubtotal: t, discountAmount: n }) {
|
|
23
|
+
let r = e + t, i = r > 0 ? Math.round(e / r * n) : 0;
|
|
24
|
+
return {
|
|
25
|
+
taxableSubtotal: e - i,
|
|
26
|
+
nonTaxableSubtotal: t - (n - i)
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
function o({ lineItems: e, currency: t, taxRate: n, discount: o }) {
|
|
30
|
+
let s = r({
|
|
31
|
+
lineItems: e,
|
|
32
|
+
currency: t,
|
|
33
|
+
taxRate: n
|
|
34
|
+
}), c = i({
|
|
35
|
+
discount: o,
|
|
36
|
+
subtotal: s.subtotal
|
|
37
|
+
}), { taxableSubtotal: l, nonTaxableSubtotal: u } = a({
|
|
38
|
+
...s,
|
|
39
|
+
discountAmount: c
|
|
40
|
+
}), d = s.rate ? Math.round(l * s.rate) : 0, f = s.subtotal - c;
|
|
41
|
+
return {
|
|
42
|
+
...s,
|
|
43
|
+
discountAmount: c,
|
|
44
|
+
discountedSubtotal: f,
|
|
45
|
+
taxableSubtotal: l,
|
|
46
|
+
nonTaxableSubtotal: u,
|
|
47
|
+
totalTaxes: d,
|
|
48
|
+
total: f + d
|
|
49
|
+
};
|
|
251
50
|
}
|
|
252
51
|
//#endregion
|
|
253
|
-
export {
|
|
52
|
+
export { a as allocateDiscount, o as calculateInvoiceTotals, r as calculateItemsSubtotals, i as resolveDiscountAmount };
|