@tesouro/embedded-components-react 0.11.65 → 0.11.68
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 +28 -28
- package/dist/index.css +6 -27
- package/dist/index.d.ts +29 -41
- package/dist/lib/CardDetailsWidget.d.ts +1 -1
- package/dist/lib/CounterpartsWidget.d.ts +26 -39
- package/dist/lib/CounterpartsWidgetPublic.d.ts +26 -39
- package/dist/lib/CreditCardsWidget.d.ts +2 -2
- package/dist/lib/CustomersWidget.d.ts +26 -39
- package/dist/lib/DebitCardsWidget.d.ts +2 -2
- package/dist/lib/ReceivablesWidget.d.ts +14 -4
- package/dist/lib/WidgetSuite.d.ts +2 -2
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/lib/CardDetailsWidget.js +0 -4
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/lib/cardDetailsView.js +7 -8
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/ActivateCardPanel/ActivateCardPanel.js +37 -39
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/CardDetailsPanel.js +72 -73
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/CardFace.js +16 -22
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartDetailsContainer.js +8 -12
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartDetailsPanel.js +93 -110
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartsWidget.js +52 -52
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartDetailsActions.js +72 -107
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartDetailsSheetView.js +27 -27
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartsTable.js +112 -145
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartsWidget.js +13 -16
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/viewModels.js +3 -122
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/mocks/labels.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index2.js +44 -65
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index3.js +157 -134
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index4.js +18 -14
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index5.js +362 -55
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/index.js +11 -11
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/helpers.js +7 -7
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/labels.js +16 -9
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useAddressForm.js +2 -66
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useDeleteController.js +48 -46
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index10.js +138 -149
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index11.js +19 -20
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index12.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index13.js +21 -27
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index2.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index3.js +0 -1
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index8.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index9.js +30 -63
- 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/counterparts-widget/ui/dist/index6.js +0 -211
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index7.js +0 -509
|
@@ -19,101 +19,101 @@ import { useCounterpartsWidget as u } from "./useCounterpartsWidget.js";
|
|
|
19
19
|
import { useEffect as d } from "react";
|
|
20
20
|
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
21
21
|
// ../../libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartsWidget.js
|
|
22
|
-
function h({ counterpartType: n, pageSizeOptions: o = l, onViewAllDocuments: h, onCreateDocument: g, screenLabels: _, formLabels: v, detailsLabels: y, bankAccountLabels: b,
|
|
23
|
-
let
|
|
22
|
+
function h({ counterpartType: n, pageSizeOptions: o = l, onViewAllDocuments: h, onCreateDocument: g, screenLabels: _, formLabels: v, detailsLabels: y, bankAccountLabels: b, deleteLabels: x, messageLabels: S }) {
|
|
23
|
+
let C = t();
|
|
24
24
|
d(() => {
|
|
25
|
-
|
|
26
|
-
}, [
|
|
27
|
-
let { stateOptions:
|
|
25
|
+
C(a.Mounted);
|
|
26
|
+
}, [C]);
|
|
27
|
+
let { stateOptions: w, selectedId: T, view: E, table: D, listError: O, details: k, detailsSheetView: A, permissions: j, isPermissionLoading: M, actions: N, handleRowClick: P, closeDetails: F } = u({
|
|
28
28
|
counterpartType: n,
|
|
29
29
|
pageSizeOptions: o,
|
|
30
30
|
detailsLabels: y,
|
|
31
|
-
messageLabels:
|
|
31
|
+
messageLabels: S,
|
|
32
32
|
screenLabels: _
|
|
33
|
-
}), { form:
|
|
33
|
+
}), { form: I } = N;
|
|
34
34
|
return /* @__PURE__ */ m(f, { children: [
|
|
35
35
|
/* @__PURE__ */ p(e, {}),
|
|
36
36
|
/* @__PURE__ */ p(s, {
|
|
37
37
|
mode: n,
|
|
38
|
-
counterparts:
|
|
39
|
-
isLoading:
|
|
40
|
-
isError:
|
|
41
|
-
errorTitle:
|
|
42
|
-
errorDescription:
|
|
43
|
-
sorting:
|
|
44
|
-
onSortingChange:
|
|
45
|
-
pageSize:
|
|
46
|
-
onPageSizeChange:
|
|
38
|
+
counterparts: D.rows,
|
|
39
|
+
isLoading: M || D.isLoading,
|
|
40
|
+
isError: D.isError,
|
|
41
|
+
errorTitle: O.title,
|
|
42
|
+
errorDescription: O.description,
|
|
43
|
+
sorting: D.sorting,
|
|
44
|
+
onSortingChange: D.onSortingChange,
|
|
45
|
+
pageSize: D.pageSize,
|
|
46
|
+
onPageSizeChange: D.onPageSizeChange,
|
|
47
47
|
pageSizeOptions: o,
|
|
48
|
-
hasNextPage:
|
|
49
|
-
hasPrevPage:
|
|
50
|
-
onNextPage:
|
|
51
|
-
onPrevPage:
|
|
52
|
-
filters:
|
|
53
|
-
isFiltering:
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
48
|
+
hasNextPage: D.hasNextPage,
|
|
49
|
+
hasPrevPage: D.hasPrevPage,
|
|
50
|
+
onNextPage: D.onNextPage,
|
|
51
|
+
onPrevPage: D.onPrevPage,
|
|
52
|
+
filters: D.filters,
|
|
53
|
+
isFiltering: D.isFiltering,
|
|
54
|
+
isAmountsError: D.isAmountsError,
|
|
55
|
+
onRetryAmounts: D.onRetryAmounts,
|
|
56
|
+
canCreate: j.canCreate,
|
|
57
|
+
isAccessRestricted: !M && !j.canRead,
|
|
58
|
+
onCreateClick: j.canCreate ? I.openCreate : () => void 0,
|
|
59
|
+
onRowClick: P,
|
|
60
|
+
onRetry: D.onRetry,
|
|
59
61
|
labels: _,
|
|
60
62
|
emptyStateTestId: "counterparts-widget-empty-state",
|
|
61
63
|
accessRestrictedTestId: "counterparts-widget-access-restricted"
|
|
62
64
|
}),
|
|
63
65
|
/* @__PURE__ */ p(r, {
|
|
64
|
-
open:
|
|
66
|
+
open: E === "create",
|
|
65
67
|
onOpenChange: (e) => {
|
|
66
|
-
e ||
|
|
68
|
+
e || I.close();
|
|
67
69
|
},
|
|
68
70
|
mode: "create",
|
|
69
71
|
counterpartMode: n,
|
|
70
|
-
values:
|
|
71
|
-
errors:
|
|
72
|
-
stateOptions:
|
|
73
|
-
taxIdField: i(
|
|
74
|
-
inProgress:
|
|
75
|
-
|
|
76
|
-
onChange: (e) => L.setValues((t) => ({
|
|
72
|
+
values: I.values,
|
|
73
|
+
errors: I.errors,
|
|
74
|
+
stateOptions: w,
|
|
75
|
+
taxIdField: i(I.values.entityType, n, v),
|
|
76
|
+
inProgress: I.isSubmitting,
|
|
77
|
+
onChange: (e) => I.setValues((t) => ({
|
|
77
78
|
...t,
|
|
78
79
|
...e
|
|
79
80
|
})),
|
|
80
|
-
onAddressChange: (e) =>
|
|
81
|
+
onAddressChange: (e) => I.setValues((t) => ({
|
|
81
82
|
...t,
|
|
82
83
|
address: {
|
|
83
84
|
...t.address,
|
|
84
85
|
...e
|
|
85
86
|
}
|
|
86
87
|
})),
|
|
87
|
-
onBankAccountChange: (e) =>
|
|
88
|
+
onBankAccountChange: (e) => I.setValues((t) => ({
|
|
88
89
|
...t,
|
|
89
90
|
bankAccount: {
|
|
90
91
|
...t.bankAccount,
|
|
91
92
|
...e
|
|
92
93
|
}
|
|
93
94
|
})),
|
|
94
|
-
onSubmit:
|
|
95
|
-
onCancel:
|
|
95
|
+
onSubmit: I.submit,
|
|
96
|
+
onCancel: I.close,
|
|
96
97
|
labels: v
|
|
97
98
|
}),
|
|
98
99
|
/* @__PURE__ */ p(c, {
|
|
99
100
|
counterpartType: n,
|
|
100
|
-
open:
|
|
101
|
-
selectedId:
|
|
102
|
-
view:
|
|
103
|
-
details:
|
|
104
|
-
detailsSheetView:
|
|
105
|
-
actions:
|
|
106
|
-
stateOptions:
|
|
107
|
-
canEdit:
|
|
108
|
-
canDelete:
|
|
109
|
-
onClose:
|
|
101
|
+
open: T !== void 0 && E !== "create",
|
|
102
|
+
selectedId: T,
|
|
103
|
+
view: E,
|
|
104
|
+
details: k,
|
|
105
|
+
detailsSheetView: A,
|
|
106
|
+
actions: N,
|
|
107
|
+
stateOptions: w,
|
|
108
|
+
canEdit: j.canUpdate,
|
|
109
|
+
canDelete: j.canDelete,
|
|
110
|
+
onClose: F,
|
|
110
111
|
onViewAllDocuments: h,
|
|
111
112
|
onCreateDocument: g,
|
|
112
113
|
formLabels: v,
|
|
113
114
|
detailsLabels: y,
|
|
114
115
|
bankAccountLabels: b,
|
|
115
|
-
|
|
116
|
-
deleteLabels: S
|
|
116
|
+
deleteLabels: x
|
|
117
117
|
})
|
|
118
118
|
] });
|
|
119
119
|
}
|
|
@@ -4,124 +4,89 @@
|
|
|
4
4
|
"use client";
|
|
5
5
|
import { toast as e } from "../../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
6
6
|
import "../../../../../shared/ui/dist/index.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { useBankAccountForm as s } from "../../../../../shared/counterpart-management/feature/dist/lib/subEntityForms.js";
|
|
7
|
+
import { bankAccountToAchFormValues as t, counterpartToFormValues as n } from "../../../../../shared/counterpart-management/feature/dist/lib/helpers.js";
|
|
8
|
+
import { useCounterpartForm as r } from "../../../../../shared/counterpart-management/feature/dist/lib/useCounterpartForm.js";
|
|
9
|
+
import { useDeleteController as i } from "../../../../../shared/counterpart-management/feature/dist/lib/useDeleteController.js";
|
|
10
|
+
import { useBankAccountForm as a } from "../../../../../shared/counterpart-management/feature/dist/lib/subEntityForms.js";
|
|
12
11
|
import "../../../../../shared/counterpart-management/feature/dist/index.js";
|
|
13
|
-
import { useRebaseOnRefresh as
|
|
14
|
-
import { useCallback as
|
|
12
|
+
import { useRebaseOnRefresh as o } from "./useRebaseOnRefresh.js";
|
|
13
|
+
import { useCallback as s, useMemo as c } from "react";
|
|
15
14
|
// ../../libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartDetailsActions.js
|
|
16
|
-
|
|
17
|
-
line1: "",
|
|
18
|
-
line2: "",
|
|
19
|
-
city: "",
|
|
20
|
-
state: "",
|
|
21
|
-
postalCode: ""
|
|
22
|
-
};
|
|
23
|
-
function f(e, t) {
|
|
15
|
+
function l(e, t) {
|
|
24
16
|
return e.line1 === t.line1 && e.line2 === t.line2 && e.city === t.city && e.state === t.state && e.postalCode === t.postalCode;
|
|
25
17
|
}
|
|
26
|
-
function p
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
selectedId:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
detailsView: y.detailsView,
|
|
52
|
-
messages: b
|
|
53
|
-
}), E = u(() => {
|
|
54
|
-
if (!y.counterpart) return;
|
|
55
|
-
let e = r(y.counterpart, y.primaryAddress);
|
|
56
|
-
return x ? {
|
|
57
|
-
...e,
|
|
58
|
-
address: d
|
|
59
|
-
} : e;
|
|
60
|
-
}, [
|
|
61
|
-
y.counterpart,
|
|
62
|
-
y.primaryAddress,
|
|
63
|
-
x
|
|
64
|
-
]), D = u(() => y.primaryAddress ? t(y.primaryAddress) : d, [y.primaryAddress]), O = u(() => {
|
|
65
|
-
if (C.form.sheet.mode !== "edit") return;
|
|
66
|
-
let e = y.bankAccounts?.find((e) => e.id === C.form.sheet.id);
|
|
67
|
-
return e ? n(e) : void 0;
|
|
18
|
+
function u({ counterpartType: u, selectedId: d, setSelectedId: f, view: p, setView: m, details: h, messages: g }) {
|
|
19
|
+
let _ = r({
|
|
20
|
+
view: p,
|
|
21
|
+
setView: m,
|
|
22
|
+
selectedId: d,
|
|
23
|
+
setSelectedId: f,
|
|
24
|
+
messages: g,
|
|
25
|
+
counterpartType: u,
|
|
26
|
+
counterpart: h.counterpart,
|
|
27
|
+
primaryAddress: h.primaryAddress,
|
|
28
|
+
includeBankAccount: p === "create"
|
|
29
|
+
}), v = a({
|
|
30
|
+
items: h.bankAccounts,
|
|
31
|
+
selectedId: d,
|
|
32
|
+
messages: g
|
|
33
|
+
}), y = i({
|
|
34
|
+
selectedId: d,
|
|
35
|
+
setSelectedId: f,
|
|
36
|
+
detailsView: h.detailsView,
|
|
37
|
+
messages: g,
|
|
38
|
+
counterpartType: u
|
|
39
|
+
}), b = c(() => h.counterpart ? n(h.counterpart, h.primaryAddress) : void 0, [h.counterpart, h.primaryAddress]), x = c(() => {
|
|
40
|
+
if (v.form.sheet.mode !== "edit") return;
|
|
41
|
+
let e = h.bankAccounts?.find((e) => e.id === v.form.sheet.id);
|
|
42
|
+
return e ? t(e) : void 0;
|
|
68
43
|
}, [
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
44
|
+
v.form.sheet.id,
|
|
45
|
+
v.form.sheet.mode,
|
|
46
|
+
h.bankAccounts
|
|
72
47
|
]);
|
|
73
|
-
|
|
74
|
-
open:
|
|
75
|
-
seed:
|
|
76
|
-
setValues:
|
|
77
|
-
}),
|
|
78
|
-
open:
|
|
79
|
-
seed:
|
|
80
|
-
setValues:
|
|
81
|
-
}),
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
if (!
|
|
88
|
-
let
|
|
89
|
-
return
|
|
90
|
-
}, [
|
|
91
|
-
E,
|
|
92
|
-
S.values,
|
|
93
|
-
x
|
|
94
|
-
]), A = u(() => !f(w.values, D), [w.values, D]), { close: j } = w, { openEdit: M, setValues: N, submit: P, values: F } = S, I = l(async () => {
|
|
95
|
-
let t = _ === "edit" ? b.updateSucceeded : b.createSucceeded, n = p(F), r = await P();
|
|
96
|
-
return r.ok && e.success(t.replace("{name}", () => n)), r;
|
|
48
|
+
o({
|
|
49
|
+
open: p === "edit",
|
|
50
|
+
seed: b,
|
|
51
|
+
setValues: _.setValues
|
|
52
|
+
}), o({
|
|
53
|
+
open: v.form.sheet.open,
|
|
54
|
+
seed: x,
|
|
55
|
+
setValues: v.form.setValues
|
|
56
|
+
}), v.form.sheet.open && v.form.sheet.mode === "edit" && h.bankAccounts !== void 0 && !h.isBankAccountsFetching && !x && v.form.close();
|
|
57
|
+
let S = c(() => {
|
|
58
|
+
if (!b) return !1;
|
|
59
|
+
let e = _.values;
|
|
60
|
+
return e.legalName !== b.legalName || e.firstName !== b.firstName || e.lastName !== b.lastName || e.email !== b.email || e.phone !== b.phone || e.taxId !== b.taxId || e.remindersEnabled !== b.remindersEnabled || !l(e.address, b.address);
|
|
61
|
+
}, [b, _.values]), { close: C, openEdit: w, submit: T } = _, E = s(async () => {
|
|
62
|
+
if (p === "edit" && !S) return C(), { ok: !0 };
|
|
63
|
+
let t = u === "vendor", n = p === "edit" ? t ? g.vendorUpdated : g.customerUpdated : t ? g.vendorAdded : g.customerAdded, r = await T();
|
|
64
|
+
return r.ok && e.success(n), r;
|
|
97
65
|
}, [
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}))) : (j(), M());
|
|
66
|
+
p,
|
|
67
|
+
S,
|
|
68
|
+
C,
|
|
69
|
+
g,
|
|
70
|
+
u,
|
|
71
|
+
T
|
|
72
|
+
]), { close: D, submit: O } = v.form, k = s(() => {
|
|
73
|
+
v.form.sheet.mode === "edit" && !v.isDirty ? D() : O();
|
|
107
74
|
}, [
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
75
|
+
v.form.sheet.mode,
|
|
76
|
+
v.isDirty,
|
|
77
|
+
D,
|
|
78
|
+
O
|
|
112
79
|
]);
|
|
113
80
|
return {
|
|
114
81
|
form: {
|
|
115
|
-
...
|
|
116
|
-
submit:
|
|
82
|
+
..._,
|
|
83
|
+
submit: E
|
|
117
84
|
},
|
|
118
|
-
bank:
|
|
119
|
-
|
|
120
|
-
del:
|
|
121
|
-
isEditDirty:
|
|
122
|
-
|
|
123
|
-
closeAddress: j,
|
|
124
|
-
handleEditProfile: L
|
|
85
|
+
bank: v,
|
|
86
|
+
submitBankAccount: k,
|
|
87
|
+
del: y,
|
|
88
|
+
isEditDirty: S,
|
|
89
|
+
handleEditProfile: w
|
|
125
90
|
};
|
|
126
91
|
}
|
|
127
|
-
export {
|
|
92
|
+
export { u as useCounterpartDetailsActions };
|
|
@@ -5,45 +5,45 @@
|
|
|
5
5
|
import { buildAnalyticsMap as e, formatMoney as t } from "../../../../../shared/counterpart-management/feature/dist/lib/helpers.js";
|
|
6
6
|
import { useCounterpartDetails as n } from "../../../../../shared/counterpart-management/feature/dist/lib/useCounterpartDetails.js";
|
|
7
7
|
import "../../../../../shared/counterpart-management/feature/dist/index.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { useRecentPayablesByCounterpartQuery as m, useRecentReceivablesByCounterpartQuery as h } from "../../../../data-access/dist/index3.js";
|
|
8
|
+
import { PAYABLES_BILLED_STATUSES as r, PAYABLES_OWED_STATUSES as i, PAYABLES_REJECTED_STATUSES as a, RECEIVABLES_BILLED_STATUSES as o, RECEIVABLES_DUE_STATUSES as s } from "./constants.js";
|
|
9
|
+
import { usePayablesAnalyticsByCounterpartQuery as c, useReceivablesAnalyticsByCounterpartQuery as l } from "../../../../data-access/dist/index2.js";
|
|
10
|
+
import { useRecentPayablesByCounterpartQuery as u, useRecentReceivablesByCounterpartQuery as d } from "../../../../data-access/dist/index3.js";
|
|
12
11
|
import "../../../../data-access/dist/index.js";
|
|
12
|
+
import { buildPaymentMethodView as f, buildRecentDocumentRows as p, formatDetailsDate as m, maskTaxId as h } from "./viewModels.js";
|
|
13
13
|
import { useMemo as g } from "react";
|
|
14
14
|
// ../../libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartDetailsSheetView.js
|
|
15
15
|
function _({ selectedId: _, isCustomer: v, enabled: y, detailsText: b }) {
|
|
16
16
|
let x = n({
|
|
17
17
|
selectedId: _,
|
|
18
18
|
enabled: y
|
|
19
|
-
}), S = g(() => _ ? [_] : [], [_]), C = S.length > 0, w =
|
|
19
|
+
}), S = g(() => _ ? [_] : [], [_]), C = S.length > 0, w = l({
|
|
20
20
|
type: "invoice",
|
|
21
|
-
statusIn: [...
|
|
21
|
+
statusIn: [...o],
|
|
22
22
|
counterpartIdIn: S,
|
|
23
23
|
enabled: y && v && C
|
|
24
|
-
}), T =
|
|
24
|
+
}), T = l({
|
|
25
25
|
metric: "amount_due",
|
|
26
26
|
type: "invoice",
|
|
27
|
-
statusIn: [...
|
|
27
|
+
statusIn: [...s],
|
|
28
28
|
counterpartIdIn: S,
|
|
29
29
|
enabled: y && v && C
|
|
30
|
-
}), E =
|
|
31
|
-
statusIn: [...
|
|
30
|
+
}), E = c({
|
|
31
|
+
statusIn: [...r],
|
|
32
32
|
counterpartIdIn: S,
|
|
33
33
|
enabled: y && !v && C
|
|
34
|
-
}), D =
|
|
34
|
+
}), D = c({
|
|
35
35
|
metric: "amount_due",
|
|
36
|
-
statusIn: [...
|
|
36
|
+
statusIn: [...i],
|
|
37
37
|
counterpartIdIn: S,
|
|
38
38
|
enabled: y && !v && C
|
|
39
|
-
}), O =
|
|
40
|
-
statusIn: [...
|
|
39
|
+
}), O = c({
|
|
40
|
+
statusIn: [...a],
|
|
41
41
|
counterpartIdIn: S,
|
|
42
42
|
enabled: y && !v && C
|
|
43
|
-
}), k =
|
|
43
|
+
}), k = d({
|
|
44
44
|
counterpartId: _,
|
|
45
45
|
enabled: y && v && C
|
|
46
|
-
}), A =
|
|
46
|
+
}), A = u({
|
|
47
47
|
counterpartId: _,
|
|
48
48
|
enabled: y && !v && C
|
|
49
49
|
});
|
|
@@ -51,24 +51,24 @@ function _({ selectedId: _, isCustomer: v, enabled: y, detailsText: b }) {
|
|
|
51
51
|
details: x,
|
|
52
52
|
detailsSheetView: g(() => {
|
|
53
53
|
if (!x.detailsView || !_) return;
|
|
54
|
-
let n = e(v ? w.data?.data : E.data?.data),
|
|
54
|
+
let n = e(v ? w.data?.data : E.data?.data), r = e(v ? T.data?.data : D.data?.data), i = n.get(_) ?? 0, a = r.get(_) ?? 0, o = i - a, s = v ? w.isLoading : E.isLoading, c = v ? T.isLoading : D.isLoading, l = e(O.data?.data), u = v ? 0 : l.get(_) ?? 0, d = v ? k.data?.data : A.data?.data, g = f(x.bankAccounts, b.paymentMethodTitle), y = v ? b.customerSubtitleLabel : b.vendorSubtitleLabel;
|
|
55
55
|
return {
|
|
56
56
|
...x.detailsView,
|
|
57
|
-
subtitle: b.subtitleTemplate.replace("{type}", y).replace("{date}",
|
|
57
|
+
subtitle: b.subtitleTemplate.replace("{type}", y).replace("{date}", m(x.counterpart?.created_at)),
|
|
58
58
|
entityTypeLabel: x.detailsView.entityType === "individual" ? b.entityTypePersonLabel : b.entityTypeBusinessLabel,
|
|
59
|
-
taxIdMasked:
|
|
59
|
+
taxIdMasked: h(x.detailsView.taxId),
|
|
60
60
|
remindersLabel: x.counterpart?.reminders_enabled ? b.remindersEnabledLabel : b.remindersDisabledLabel,
|
|
61
61
|
summary: {
|
|
62
|
-
primaryAmountLabel: t(
|
|
63
|
-
billedAmountLabel: t(
|
|
64
|
-
receivedOrPaidAmountLabel: t(
|
|
65
|
-
rejectedAmountLabel: v ? void 0 : t(
|
|
66
|
-
isPrimaryAmountLoading:
|
|
67
|
-
isBilledAmountLoading:
|
|
68
|
-
isReceivedOrPaidAmountLoading:
|
|
62
|
+
primaryAmountLabel: t(a),
|
|
63
|
+
billedAmountLabel: t(i),
|
|
64
|
+
receivedOrPaidAmountLabel: t(o),
|
|
65
|
+
rejectedAmountLabel: v ? void 0 : t(u),
|
|
66
|
+
isPrimaryAmountLoading: c,
|
|
67
|
+
isBilledAmountLoading: s,
|
|
68
|
+
isReceivedOrPaidAmountLoading: s || c,
|
|
69
69
|
isRejectedAmountLoading: v ? void 0 : O.isLoading
|
|
70
70
|
},
|
|
71
|
-
recentDocuments:
|
|
71
|
+
recentDocuments: p(d, v ? "invoice" : "bill", b),
|
|
72
72
|
paymentMethod: g
|
|
73
73
|
};
|
|
74
74
|
}, [
|