@tesouro/embedded-components-react 0.5.194 → 0.5.196
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 -2
- package/dist/index.css +3 -3
- package/dist/index.d.ts +12 -3
- package/dist/index.js +1 -1
- package/dist/lib/ReceivablesWidget.d.ts +12 -3
- package/dist/lib/ReceivablesWidget.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 +245 -65
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index11.js +66 -106
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index12.js +102 -223
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index13.js +225 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index5.js +182 -371
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index6.js +401 -60
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index7.js +62 -193
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index8.js +184 -31
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index9.js +31 -149
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +292 -161
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index2.js +11 -3
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/index4.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/index5.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index15.js +4 -1
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +36 -36
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/zod.gen.js +597 -604
- 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/data-access/dist/index.js +12 -11
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index10.js +16 -23
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index11.js +7 -8
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index12.js +17 -18
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index13.js +36 -0
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index3.js +43 -16
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index4.js +23 -13
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index5.js +13 -30
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index6.js +18 -23
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index7.js +22 -16
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index8.js +22 -15
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/data-access/dist/index9.js +10 -11
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/index.js +10 -9
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/MeasureUnitsManagerContainer.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/ProductSelector.js +9 -13
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/useMeasureUnits.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/useProductForm.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/feature/dist/lib/useProductSelector.js +28 -41
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index.js +6 -6
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index2.js +7 -15
- package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index6.js +100 -69
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -563,9 +563,8 @@ A self-contained native widget for listing, creating, editing, and acting on cus
|
|
|
563
563
|
| `sendLabels` | `Partial<ReceivableSendDialogLabels>` | English defaults | Overrides send-email dialog labels and buttons. |
|
|
564
564
|
| `paymentLabels` | `Partial<ReceivablePaymentDialogLabels>` | English defaults | Overrides manual payment dialog labels and buttons. |
|
|
565
565
|
| `actionLabels` | `Partial<ReceivableActionDialogLabels>` | English defaults | Overrides generic confirmation dialog buttons. Action-specific title and body copy come from `messageLabels`. |
|
|
566
|
-
| `productFormLabels` | `Partial<ProductFormSheetLabels>` | English defaults | Overrides inline product creation copy from the shared product catalog flow. |
|
|
567
566
|
| `counterpartFormLabels` | `Partial<CounterpartFormSheetLabels>` | English defaults | Overrides inline customer creation copy from the shared counterpart-management flow. |
|
|
568
|
-
| `measureUnitsLabels` | `Partial<MeasureUnitsManagerLabels>` | English defaults | Overrides measure-unit manager
|
|
567
|
+
| `measureUnitsLabels` | `Partial<MeasureUnitsManagerLabels>` | English defaults | Overrides copy of the measure-unit manager opened from a line item's unit select. |
|
|
569
568
|
| `measureUnitDeleteLabels` | `Partial<MeasureUnitDeleteDialogLabels>` | English defaults | Overrides measure-unit delete confirmation copy. |
|
|
570
569
|
| `messageLabels` | `Partial<ReceivableMessageLabels>` | English defaults | Overrides validation, fallback, summary, activity, and action-confirmation messages generated by the feature layer. |
|
|
571
570
|
| `productMessageLabels` | `Partial<ProductMessageLabels>` | English defaults | Overrides product flow validation and error messages. |
|
package/dist/index.css
CHANGED
|
@@ -924,6 +924,9 @@
|
|
|
924
924
|
.ttw\:max-h-80 {
|
|
925
925
|
max-height: calc(var(--ttw-spacing) * 80);
|
|
926
926
|
}
|
|
927
|
+
.ttw\:max-h-87 {
|
|
928
|
+
max-height: calc(var(--ttw-spacing) * 87);
|
|
929
|
+
}
|
|
927
930
|
.ttw\:max-h-96 {
|
|
928
931
|
max-height: calc(var(--ttw-spacing) * 96);
|
|
929
932
|
}
|
|
@@ -1790,9 +1793,6 @@
|
|
|
1790
1793
|
.ttw\:grid-cols-\[0_1fr\] {
|
|
1791
1794
|
grid-template-columns: 0 1fr;
|
|
1792
1795
|
}
|
|
1793
|
-
.ttw\:grid-cols-\[1fr_120px_40px\] {
|
|
1794
|
-
grid-template-columns: 1fr 120px 40px;
|
|
1795
|
-
}
|
|
1796
1796
|
.ttw\:grid-cols-\[2fr_2fr_80px\] {
|
|
1797
1797
|
grid-template-columns: 2fr 2fr 80px;
|
|
1798
1798
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -4908,8 +4908,16 @@ interface ReceivableFormSheetLabels {
|
|
|
4908
4908
|
paymentTermsPlaceholder: string;
|
|
4909
4909
|
paymentTermsNone: string;
|
|
4910
4910
|
lineItemsHeading: string;
|
|
4911
|
+
lineItemsDescription: string;
|
|
4911
4912
|
productLabel: string;
|
|
4912
4913
|
quantityLabel: string;
|
|
4914
|
+
unitLabel: string;
|
|
4915
|
+
unitPlaceholder: string;
|
|
4916
|
+
unitNone: string;
|
|
4917
|
+
manageUnitsOption: string;
|
|
4918
|
+
priceLabel: string;
|
|
4919
|
+
decreaseQuantityButton: string;
|
|
4920
|
+
increaseQuantityButton: string;
|
|
4913
4921
|
addLineItemButton: string;
|
|
4914
4922
|
removeLineItemButton: string;
|
|
4915
4923
|
cancelButton: string;
|
|
@@ -4984,13 +4992,15 @@ interface ReceivableMessageLabels {
|
|
|
4984
4992
|
customerRequired: string;
|
|
4985
4993
|
customerAddressRequired: string;
|
|
4986
4994
|
currencyRequired: string;
|
|
4987
|
-
|
|
4988
|
-
|
|
4995
|
+
lineItemNameTooLong: string;
|
|
4996
|
+
/** `{maxAmount}` is replaced with the formatted cap. */
|
|
4997
|
+
lineItemPriceTooHigh: string;
|
|
4989
4998
|
sendToRequired: string;
|
|
4990
4999
|
sendSubjectRequired: string;
|
|
4991
5000
|
sendBodyRequired: string;
|
|
4992
5001
|
paymentAmountInvalid: string;
|
|
4993
5002
|
genericError: string;
|
|
5003
|
+
lineItemsLoading: string;
|
|
4994
5004
|
untitledDocument: string;
|
|
4995
5005
|
unknownCustomer: string;
|
|
4996
5006
|
notAvailable: string;
|
|
@@ -5054,7 +5064,6 @@ interface ReceivablesWidgetOwnProps {
|
|
|
5054
5064
|
sendLabels?: Partial<ReceivableSendDialogLabels>;
|
|
5055
5065
|
paymentLabels?: Partial<ReceivablePaymentDialogLabels>;
|
|
5056
5066
|
actionLabels?: Partial<ReceivableActionDialogLabels>;
|
|
5057
|
-
productFormLabels?: Partial<ProductFormSheetLabels>;
|
|
5058
5067
|
counterpartFormLabels?: PartialDeep<CounterpartFormSheetLabels>;
|
|
5059
5068
|
measureUnitsLabels?: Partial<MeasureUnitsManagerLabels>;
|
|
5060
5069
|
measureUnitDeleteLabels?: Partial<MeasureUnitDeleteDialogLabels>;
|
package/dist/index.js
CHANGED
|
@@ -27,7 +27,7 @@ import { InsightsWidget as L } from "./libs/tesouro-embedded-components-react/in
|
|
|
27
27
|
import { UploadReceiptWidget as R } from "./libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index2.js";
|
|
28
28
|
import { ExpenseManagementWidget as z } from "./libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index21.js";
|
|
29
29
|
import { InvoicingWidget as B } from "./libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index3.js";
|
|
30
|
-
import { ReceivablesWidget as V } from "./libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/
|
|
30
|
+
import { ReceivablesWidget as V } from "./libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index13.js";
|
|
31
31
|
import { SettingsSection as H } from "./libs/tesouro-embedded-components-react/settings-widget/feature/dist/index4.js";
|
|
32
32
|
import { HELP_FAQ_EN as U } from "./libs/tesouro-embedded-components-react/settings-widget/help/ui/contract/dist/index3.js";
|
|
33
33
|
import { SettingsWidget as W } from "./libs/tesouro-embedded-components-react/settings-widget/feature/dist/index6.js";
|
|
@@ -952,8 +952,16 @@ interface ReceivableFormSheetLabels {
|
|
|
952
952
|
paymentTermsPlaceholder: string;
|
|
953
953
|
paymentTermsNone: string;
|
|
954
954
|
lineItemsHeading: string;
|
|
955
|
+
lineItemsDescription: string;
|
|
955
956
|
productLabel: string;
|
|
956
957
|
quantityLabel: string;
|
|
958
|
+
unitLabel: string;
|
|
959
|
+
unitPlaceholder: string;
|
|
960
|
+
unitNone: string;
|
|
961
|
+
manageUnitsOption: string;
|
|
962
|
+
priceLabel: string;
|
|
963
|
+
decreaseQuantityButton: string;
|
|
964
|
+
increaseQuantityButton: string;
|
|
957
965
|
addLineItemButton: string;
|
|
958
966
|
removeLineItemButton: string;
|
|
959
967
|
cancelButton: string;
|
|
@@ -1028,13 +1036,15 @@ interface ReceivableMessageLabels {
|
|
|
1028
1036
|
customerRequired: string;
|
|
1029
1037
|
customerAddressRequired: string;
|
|
1030
1038
|
currencyRequired: string;
|
|
1031
|
-
|
|
1032
|
-
|
|
1039
|
+
lineItemNameTooLong: string;
|
|
1040
|
+
/** `{maxAmount}` is replaced with the formatted cap. */
|
|
1041
|
+
lineItemPriceTooHigh: string;
|
|
1033
1042
|
sendToRequired: string;
|
|
1034
1043
|
sendSubjectRequired: string;
|
|
1035
1044
|
sendBodyRequired: string;
|
|
1036
1045
|
paymentAmountInvalid: string;
|
|
1037
1046
|
genericError: string;
|
|
1047
|
+
lineItemsLoading: string;
|
|
1038
1048
|
untitledDocument: string;
|
|
1039
1049
|
unknownCustomer: string;
|
|
1040
1050
|
notAvailable: string;
|
|
@@ -1098,7 +1108,6 @@ interface ReceivablesWidgetOwnProps {
|
|
|
1098
1108
|
sendLabels?: Partial<ReceivableSendDialogLabels>;
|
|
1099
1109
|
paymentLabels?: Partial<ReceivablePaymentDialogLabels>;
|
|
1100
1110
|
actionLabels?: Partial<ReceivableActionDialogLabels>;
|
|
1101
|
-
productFormLabels?: Partial<ProductFormSheetLabels>;
|
|
1102
1111
|
counterpartFormLabels?: PartialDeep<CounterpartFormSheetLabels>;
|
|
1103
1112
|
measureUnitsLabels?: Partial<MeasureUnitsManagerLabels>;
|
|
1104
1113
|
measureUnitDeleteLabels?: Partial<MeasureUnitDeleteDialogLabels>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ReceivablesWidget as e } from "../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/
|
|
1
|
+
import { ReceivablesWidget as e } from "../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index13.js";
|
|
2
2
|
import "../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index.js";
|
|
3
3
|
export { e as ReceivablesWidget };
|
package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index10.js
CHANGED
|
@@ -2,74 +2,254 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { getStateOptions as e } from "../../../shared/util/dist/lib/usStates.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 { COUNTERPART_MESSAGE_LABELS_EN as r } from "../../../shared/counterpart-management/feature/dist/lib/labels.js";
|
|
9
|
+
import { useCounterpartAddressesQuery as i } from "../../../shared/counterpart-management/data-access/dist/index7.js";
|
|
10
|
+
import { useCounterpartForm as ee } from "../../../shared/counterpart-management/feature/dist/lib/useCounterpartForm.js";
|
|
11
|
+
import "../../../shared/counterpart-management/feature/dist/index.js";
|
|
12
|
+
import { buildLineItemControls as a, commitLineItemField as te, convertPriceInput as ne, createLineItem as re, getCurrencySymbol as o, lineItemFromProduct as s, reconcileMeasureUnits as c, sanitizeLineItemPatch as l, stepLineItemQuantity as u, stripBlankLineItems as ie, summarizeLineItemErrors as ae, toSheetLineItem as d, validateLineItems as oe } from "./index5.js";
|
|
13
|
+
import { createEmptyReceivableFormValues as f, getPaymentTermOptions as se, hasReceivableFormErrors as ce, receivableFormValuesToCreatePayload as le, receivableFormValuesToLineItemChanges as ue, receivableFormValuesToUpdatePayload as de, receivableToFormValues as fe, validateReceivableForm as p } from "./index6.js";
|
|
14
|
+
import { useCreateReceivableMutation as m, useUpdateReceivableMutation as pe } from "../../data-access/dist/index6.js";
|
|
7
15
|
import "../../data-access/dist/index.js";
|
|
8
|
-
import {
|
|
16
|
+
import { getCurrencyOptions as me } from "../../../shared/product-catalog/feature/dist/lib/helpers.js";
|
|
17
|
+
import { useMeasureUnitsQuery as he } from "../../../shared/product-catalog/data-access/dist/index9.js";
|
|
18
|
+
import { useMeasureUnits as ge } from "../../../shared/product-catalog/feature/dist/lib/useMeasureUnits.js";
|
|
19
|
+
import "../../../shared/product-catalog/feature/dist/index.js";
|
|
20
|
+
import { useCallback as h, useEffect as g, useMemo as _, useRef as v, useState as y } from "react";
|
|
9
21
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index10.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
|
-
|
|
22
|
+
function b({ messages: b, counterpartMessageLabels: x, onCreated: S }) {
|
|
23
|
+
let C = m(), w = pe(), T = v([]), E = v(""), D = n(), [O, k] = y(!1), [A, j] = y("create"), [M, N] = y(), [P, F] = y(() => f()), [I, L] = y({}), [R, _e] = y("none"), z = ge(), B = he(), V = B.data?.data, { unitNamesById: H } = z, [ve, U] = y(), [W, G] = y(!1), K = v(!1), ye = _(() => e(), []), be = _(() => ({
|
|
24
|
+
...r,
|
|
25
|
+
...x
|
|
26
|
+
}), [x]), q = i(P.customerId), xe = q.data?.data?.[0], J = q.data?.data?.[0]?.id, Se = h((e) => {
|
|
27
|
+
F((t) => ({
|
|
28
|
+
...t,
|
|
29
|
+
customerId: e ?? ""
|
|
30
|
+
}));
|
|
31
|
+
}, []), Y = ee({
|
|
32
|
+
view: R,
|
|
33
|
+
setView: _e,
|
|
34
|
+
selectedId: P.customerId || void 0,
|
|
35
|
+
setSelectedId: Se,
|
|
36
|
+
messages: be,
|
|
37
|
+
counterpartType: "customer",
|
|
38
|
+
counterpart: void 0,
|
|
39
|
+
primaryAddress: xe
|
|
40
|
+
}), X = h(() => {
|
|
41
|
+
T.current = [], U(void 0), j("create"), N(void 0), F(f()), L({}), G(!1);
|
|
42
|
+
}, []), Ce = h((e = "invoice") => {
|
|
43
|
+
T.current = [], U(void 0), j("create"), N(void 0), F({
|
|
44
|
+
...f(),
|
|
45
|
+
type: e
|
|
46
|
+
}), L({}), G(!1), k(!0);
|
|
47
|
+
}, []), we = h((e) => {
|
|
48
|
+
e.type !== "credit_note" && (T.current = e.line_items, E.current = e.currency, U(void 0), j("edit"), N(e.id), F(fe(e, V)), L({}), G(!1), k(!0));
|
|
49
|
+
}, [V]);
|
|
50
|
+
g(() => {
|
|
51
|
+
V?.length && F((e) => {
|
|
52
|
+
let t = c(e.lineItems, V);
|
|
53
|
+
return t === e.lineItems ? e : {
|
|
54
|
+
...e,
|
|
55
|
+
lineItems: t
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
}, [V]);
|
|
59
|
+
let Te = h(() => {
|
|
60
|
+
k(!1), L({});
|
|
61
|
+
}, []), Ee = h((e) => {
|
|
62
|
+
let { currency: t } = e;
|
|
63
|
+
if (t === void 0) {
|
|
64
|
+
F((t) => ({
|
|
65
|
+
...t,
|
|
66
|
+
...e
|
|
67
|
+
}));
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
K.current = !0, F((n) => n.currency === t ? {
|
|
71
|
+
...n,
|
|
72
|
+
...e
|
|
73
|
+
} : {
|
|
74
|
+
...n,
|
|
75
|
+
...e,
|
|
76
|
+
lineItems: n.lineItems.map((e) => ({
|
|
77
|
+
...e,
|
|
78
|
+
price: ne(e.price, n.currency, t)
|
|
79
|
+
}))
|
|
80
|
+
});
|
|
81
|
+
}, []), Z = h((e, t) => {
|
|
82
|
+
let n = oe(e, {
|
|
83
|
+
currency: t,
|
|
84
|
+
messages: b
|
|
85
|
+
});
|
|
86
|
+
L((e) => ({
|
|
87
|
+
...e,
|
|
88
|
+
lineItems: n,
|
|
89
|
+
lineItemsSummary: ae(n)
|
|
90
|
+
}));
|
|
91
|
+
}, [b]), Q = h((e, { validate: t }) => {
|
|
92
|
+
t && (K.current = !0), F((t) => ({
|
|
93
|
+
...t,
|
|
94
|
+
lineItems: e(t.lineItems)
|
|
95
|
+
}));
|
|
96
|
+
}, []);
|
|
97
|
+
g(() => {
|
|
98
|
+
K.current && (K.current = !1, Z(P.lineItems, P.currency));
|
|
99
|
+
}, [
|
|
100
|
+
Z,
|
|
101
|
+
P.currency,
|
|
102
|
+
P.lineItems
|
|
103
|
+
]);
|
|
104
|
+
let De = h((e, t) => {
|
|
105
|
+
let { unit: n, ...r } = t, i = l(r);
|
|
106
|
+
i.name !== void 0 && (i.productId = ""), n !== void 0 && (i.measureUnitId = n, i.measureUnitName = ""), Q((t) => t.map((t) => t.id === e ? {
|
|
107
|
+
...t,
|
|
108
|
+
...i
|
|
109
|
+
} : t), { validate: W });
|
|
110
|
+
}, [Q, W]), Oe = h((e, t) => {
|
|
111
|
+
Q((n) => n.map((n) => n.id === e ? {
|
|
112
|
+
...n,
|
|
113
|
+
...s({
|
|
114
|
+
product: t,
|
|
115
|
+
currency: P.currency,
|
|
116
|
+
unitNamesById: H
|
|
117
|
+
})
|
|
118
|
+
} : n), { validate: !0 });
|
|
119
|
+
}, [
|
|
120
|
+
Q,
|
|
121
|
+
H,
|
|
122
|
+
P.currency
|
|
123
|
+
]), $ = h((e, t) => {
|
|
124
|
+
t && Q((n) => t.kind === "remove" ? n.filter((t) => t.id !== e) : n.map((n) => n.id === e ? {
|
|
125
|
+
...n,
|
|
126
|
+
...t.patch
|
|
127
|
+
} : n), { validate: !0 });
|
|
128
|
+
}, [Q]), ke = h((e, t) => {
|
|
129
|
+
let n = P.lineItems.find((t) => t.id === e);
|
|
130
|
+
n && $(e, te({
|
|
131
|
+
lineItem: n,
|
|
132
|
+
field: t,
|
|
133
|
+
rowCount: P.lineItems.length,
|
|
134
|
+
currency: P.currency
|
|
135
|
+
}));
|
|
136
|
+
}, [
|
|
137
|
+
$,
|
|
138
|
+
P.currency,
|
|
139
|
+
P.lineItems
|
|
140
|
+
]), Ae = h((e, t) => {
|
|
141
|
+
let n = P.lineItems.find((t) => t.id === e);
|
|
142
|
+
n && $(e, u({
|
|
143
|
+
lineItem: n,
|
|
144
|
+
step: t,
|
|
145
|
+
rowCount: P.lineItems.length
|
|
146
|
+
}));
|
|
147
|
+
}, [$, P.lineItems]), je = h(() => {
|
|
148
|
+
let e = re(P.currency);
|
|
149
|
+
U(e.id), F((t) => ({
|
|
150
|
+
...t,
|
|
151
|
+
lineItems: [...t.lineItems, e]
|
|
152
|
+
}));
|
|
153
|
+
}, [P.currency]), Me = h((e) => {
|
|
154
|
+
Q((t) => t.length <= 1 ? t : t.filter((t) => t.id !== e), { validate: !0 });
|
|
155
|
+
}, [Q]), Ne = h(async () => {
|
|
156
|
+
if (B.isLoading) {
|
|
157
|
+
L({ form: b.lineItemsLoading });
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
let e = ie(P.lineItems), n = e.length === P.lineItems.length ? P : {
|
|
161
|
+
...P,
|
|
162
|
+
lineItems: e
|
|
163
|
+
};
|
|
164
|
+
n !== P && F(n);
|
|
165
|
+
let r = p({
|
|
166
|
+
values: n,
|
|
167
|
+
billingAddressId: J,
|
|
168
|
+
messages: b
|
|
169
|
+
});
|
|
170
|
+
if (ce(r)) {
|
|
171
|
+
L(r), G(!0);
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
L({});
|
|
175
|
+
try {
|
|
176
|
+
if (A === "edit" && M) {
|
|
177
|
+
let e = { receivable_id: M };
|
|
178
|
+
await w.mutateAsync({
|
|
179
|
+
path: e,
|
|
180
|
+
body: de({
|
|
181
|
+
values: n,
|
|
182
|
+
billingAddressId: J ?? "",
|
|
183
|
+
lineItemChanges: ue({
|
|
184
|
+
values: n,
|
|
185
|
+
originalLineItems: T.current,
|
|
186
|
+
originalCurrency: E.current,
|
|
187
|
+
unitNamesById: H,
|
|
188
|
+
units: V
|
|
189
|
+
})
|
|
190
|
+
})
|
|
191
|
+
}), k(!1), X();
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
let e = await C.mutateAsync({ body: le({
|
|
195
|
+
values: n,
|
|
196
|
+
billingAddressId: J ?? "",
|
|
197
|
+
unitNamesById: H
|
|
198
|
+
}) });
|
|
199
|
+
k(!1), X(), e?.id && S?.(e.id, e.type);
|
|
200
|
+
} catch (e) {
|
|
201
|
+
L({ form: t(e) ?? b.genericError });
|
|
202
|
+
}
|
|
203
|
+
}, [
|
|
204
|
+
J,
|
|
205
|
+
C,
|
|
206
|
+
M,
|
|
207
|
+
b,
|
|
208
|
+
A,
|
|
209
|
+
S,
|
|
210
|
+
X,
|
|
211
|
+
V,
|
|
212
|
+
H,
|
|
213
|
+
B.isLoading,
|
|
214
|
+
w,
|
|
215
|
+
P
|
|
216
|
+
]), Pe = _(() => ({
|
|
217
|
+
...P,
|
|
218
|
+
lineItems: P.lineItems.map(d)
|
|
219
|
+
}), [P]), Fe = _(() => a(P.lineItems), [P.lineItems]);
|
|
44
220
|
return {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
221
|
+
open: O,
|
|
222
|
+
setOpen: k,
|
|
223
|
+
mode: A,
|
|
224
|
+
values: P,
|
|
225
|
+
sheetValues: Pe,
|
|
226
|
+
errors: I,
|
|
227
|
+
setValues: F,
|
|
228
|
+
updateValues: Ee,
|
|
229
|
+
updateLineItem: De,
|
|
230
|
+
selectProduct: Oe,
|
|
231
|
+
commitLineItem: ke,
|
|
232
|
+
stepLineItem: Ae,
|
|
233
|
+
addLineItem: je,
|
|
234
|
+
removeLineItem: Me,
|
|
235
|
+
autoFocusLineItemId: ve,
|
|
236
|
+
lineItemUnitOptions: z.unitOptions,
|
|
237
|
+
lineItemsLoading: B.isLoading,
|
|
238
|
+
lineItemControls: Fe,
|
|
239
|
+
currencySymbol: o(P.currency),
|
|
240
|
+
isSubmitting: C.isPending || w.isPending,
|
|
241
|
+
currencyOptions: me(P.currency),
|
|
242
|
+
paymentTermsOptions: se(D.data?.data),
|
|
243
|
+
openCreate: Ce,
|
|
244
|
+
openEdit: we,
|
|
245
|
+
close: Te,
|
|
246
|
+
submit: Ne,
|
|
247
|
+
units: z,
|
|
248
|
+
counterpartView: R,
|
|
249
|
+
counterpartForm: Y,
|
|
250
|
+
stateOptions: ye,
|
|
251
|
+
openCounterpartCreate: Y.openCreate
|
|
64
252
|
};
|
|
65
253
|
}
|
|
66
|
-
var u = {
|
|
67
|
-
documentLabel: "document_id",
|
|
68
|
-
customerLabel: "counterpart_name",
|
|
69
|
-
status: "status",
|
|
70
|
-
issueDateLabel: "issue_date",
|
|
71
|
-
dueDateLabel: "due_date",
|
|
72
|
-
totalLabel: "total_amount"
|
|
73
|
-
};
|
|
74
254
|
//#endregion
|
|
75
|
-
export {
|
|
255
|
+
export { b as useReceivableForm };
|
package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index11.js
CHANGED
|
@@ -2,114 +2,74 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import "
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import { RECEIVABLE_MESSAGE_LABELS_EN as o } from "./index6.js";
|
|
10
|
-
import { useReceivableActions as s } from "./index7.js";
|
|
11
|
-
import { useReceivableDetails as c } from "./index8.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 "./index9.js";
|
|
15
|
-
import { useReceivablesTable as d } from "./index10.js";
|
|
16
|
-
import { useCallback as f, useEffect as p, useMemo as m, useState as h } from "react";
|
|
5
|
+
import { buildReceivableRows as e, statusFilterOptions as t, typeForTab as n } from "./index6.js";
|
|
6
|
+
import { useReceivablesQuery as r } from "../../data-access/dist/index9.js";
|
|
7
|
+
import "../../data-access/dist/index.js";
|
|
8
|
+
import { useCallback as i, useEffect as a, useMemo as o, useState as s } from "react";
|
|
17
9
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index11.js
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
p(()
|
|
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
|
-
}), P =
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}),
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
counterpartMessageLabels: g,
|
|
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));
|
|
63
|
-
}
|
|
64
|
-
}), R = f((e) => {
|
|
65
|
-
l() || (k(e.id), j(!0), x?.(e.id, e.type));
|
|
66
|
-
}, [x]);
|
|
10
|
+
var c = [];
|
|
11
|
+
function l({ activeTab: l, messages: d }) {
|
|
12
|
+
let [f, p] = s([]), [m, h] = s(10), [g, _] = s(), [v, y] = s(""), [b, x] = s(""), [S, C] = s("all");
|
|
13
|
+
a(() => {
|
|
14
|
+
_(void 0), C("all");
|
|
15
|
+
}, [l]), a(() => {
|
|
16
|
+
let e = setTimeout(() => {
|
|
17
|
+
x(v), _(void 0);
|
|
18
|
+
}, 300);
|
|
19
|
+
return () => clearTimeout(e);
|
|
20
|
+
}, [v]);
|
|
21
|
+
let w = f[0]?.id, T = w ? u[w] : void 0, E = f[0] ? f[0].desc ? "desc" : "asc" : void 0, D = r({
|
|
22
|
+
type: n(l),
|
|
23
|
+
limit: m,
|
|
24
|
+
pagination_token: g,
|
|
25
|
+
search_text: b || void 0,
|
|
26
|
+
status: S === "all" ? void 0 : S,
|
|
27
|
+
...T ? {
|
|
28
|
+
sort: T,
|
|
29
|
+
order: E
|
|
30
|
+
} : {}
|
|
31
|
+
}), O = D.data?.data ?? c, k = o(() => new Map(O.map((e) => [e.id, e])), [O]), A = i((e) => k.get(e), [k]), j = o(() => e({
|
|
32
|
+
receivables: O,
|
|
33
|
+
messages: d
|
|
34
|
+
}), [d, O]), M = !!b || S !== "all", N = i((e) => {
|
|
35
|
+
let t = typeof e == "function" ? e(f) : e;
|
|
36
|
+
p(t), _(void 0);
|
|
37
|
+
}, [f]), P = i((e) => {
|
|
38
|
+
h(e), _(void 0);
|
|
39
|
+
}, []), F = i((e) => {
|
|
40
|
+
C(e), _(void 0);
|
|
41
|
+
}, []), I = i(() => _(D.data?.next_pagination_token ?? void 0), [D.data?.next_pagination_token]), L = i(() => _(D.data?.prev_pagination_token ?? void 0), [D.data?.prev_pagination_token]), R = i(() => {
|
|
42
|
+
D.refetch();
|
|
43
|
+
}, [D]);
|
|
67
44
|
return {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
k(t.id), j(!0);
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
k(t.id), L.openAction(e, t, n ?? null);
|
|
92
|
-
}, [
|
|
93
|
-
L,
|
|
94
|
-
F.openEdit,
|
|
95
|
-
N.getReceivableById
|
|
96
|
-
]),
|
|
97
|
-
handleDetailsActionClick: f((e, t) => {
|
|
98
|
-
if (e === "edit") {
|
|
99
|
-
P.receivable && (F.openEdit(P.receivable), j(!1));
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
L.openAction(e, {
|
|
103
|
-
id: t.id,
|
|
104
|
-
title: t.title,
|
|
105
|
-
type: t.type
|
|
106
|
-
}, P.receivable ?? null);
|
|
107
|
-
}, [
|
|
108
|
-
L,
|
|
109
|
-
P.receivable,
|
|
110
|
-
F.openEdit
|
|
111
|
-
])
|
|
45
|
+
rows: j,
|
|
46
|
+
isLoading: D.isLoading,
|
|
47
|
+
isError: D.isError,
|
|
48
|
+
sorting: f,
|
|
49
|
+
onSortingChange: N,
|
|
50
|
+
pageSize: m,
|
|
51
|
+
onPageSizeChange: P,
|
|
52
|
+
hasNextPage: !!D.data?.next_pagination_token,
|
|
53
|
+
hasPrevPage: !!D.data?.prev_pagination_token,
|
|
54
|
+
onNextPage: I,
|
|
55
|
+
onPrevPage: L,
|
|
56
|
+
searchValue: v,
|
|
57
|
+
onSearchChange: y,
|
|
58
|
+
statusFilter: S,
|
|
59
|
+
statusOptions: t(),
|
|
60
|
+
onStatusFilterChange: F,
|
|
61
|
+
isFiltering: M,
|
|
62
|
+
onRetry: R,
|
|
63
|
+
getReceivableById: A
|
|
112
64
|
};
|
|
113
65
|
}
|
|
66
|
+
var u = {
|
|
67
|
+
documentLabel: "document_id",
|
|
68
|
+
customerLabel: "counterpart_name",
|
|
69
|
+
status: "status",
|
|
70
|
+
issueDateLabel: "issue_date",
|
|
71
|
+
dueDateLabel: "due_date",
|
|
72
|
+
totalLabel: "total_amount"
|
|
73
|
+
};
|
|
114
74
|
//#endregion
|
|
115
|
-
export {
|
|
75
|
+
export { l as useReceivablesTable };
|