@tesouro/embedded-components-react 0.7.28 → 0.7.30
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/dist/index.d.ts +1 -12
- package/dist/lib/CounterpartsWidget.d.ts +1 -12
- package/dist/lib/CounterpartsWidgetPublic.d.ts +1 -12
- package/dist/lib/CustomersWidget.d.ts +0 -2
- package/dist/lib/ReceivablesWidget.d.ts +0 -2
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartDetailsContainer.js +59 -38
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartDetailsPanel.js +137 -0
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartsWidget.js +86 -182
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartDetailsActions.js +116 -0
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartDetailsSheetView.js +16 -16
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartsWidget.js +51 -108
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useRebaseOnRefresh.js +33 -0
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/viewModels.js +40 -39
- 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/index4.js +2 -65
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index5.js +37 -181
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index6.js +193 -502
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index7.js +520 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/data-access/dist/index.js +3 -3
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/data-access/dist/index5.js +31 -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 +98 -163
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/labels.js +1 -3
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/subEntityForms.js +37 -32
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useCounterpartForm.js +86 -93
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index10.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index12.js +42 -173
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index2.js +3 -12
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index5.js +16 -16
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +42 -42
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +117 -125
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
|
@@ -8,228 +8,132 @@ import { useAnalyticsTrack as t } from "../../../../../shared/feature/dist/lib/a
|
|
|
8
8
|
import { WidgetProvider as n } from "../../../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
|
|
9
9
|
import "../../../../../shared/feature/dist/index.js";
|
|
10
10
|
import { CounterpartFormSheet as r } from "../../../../../shared/counterpart-management/ui/dist/index10.js";
|
|
11
|
-
import {
|
|
12
|
-
import { ConfirmDeleteDialog as a } from "../../../../../shared/counterpart-management/ui/dist/index15.js";
|
|
13
|
-
import { buildCounterpartFormTaxIdField as o } from "../../../../../shared/counterpart-management/feature/dist/lib/helpers.js";
|
|
11
|
+
import { buildCounterpartFormTaxIdField as i } from "../../../../../shared/counterpart-management/feature/dist/lib/helpers.js";
|
|
14
12
|
import "../../../../../shared/counterpart-management/feature/dist/index.js";
|
|
15
|
-
import { CounterpartsWidgetAnalyticsEvent as
|
|
16
|
-
import {
|
|
17
|
-
import { EDIT_FORM_FIELD_KEYS as u, addressFormLabelOverrides as d, buildCounterpartEditFormView as f, editFormLabelOverrides as p, withAddressLabelOverrides as m } from "./viewModels.js";
|
|
18
|
-
import { COUNTERPART_DETAILS_SHEET_LABELS_EN as h } from "../../../../ui/dist/index2.js";
|
|
19
|
-
import { CounterpartsScreen as g } from "../../../../ui/dist/index3.js";
|
|
20
|
-
import { CounterpartDetailsSheet as _ } from "../../../../ui/dist/index6.js";
|
|
13
|
+
import { CounterpartsWidgetAnalyticsEvent as a, WIDGET_NAME as o } from "../analytics/events.js";
|
|
14
|
+
import { CounterpartsScreen as s } from "../../../../ui/dist/index3.js";
|
|
21
15
|
import "../../../../ui/dist/index.js";
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
16
|
+
import { CounterpartDetailsPanel as c } from "./CounterpartDetailsPanel.js";
|
|
17
|
+
import { PAGE_SIZE_OPTIONS as l } from "./constants.js";
|
|
18
|
+
import { useCounterpartsWidget as u } from "./useCounterpartsWidget.js";
|
|
19
|
+
import { useEffect as d } from "react";
|
|
20
|
+
import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
25
21
|
//#region ../../libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartsWidget.js
|
|
26
|
-
function
|
|
27
|
-
let
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}, [
|
|
31
|
-
let { stateOptions:
|
|
22
|
+
function h({ counterpartType: n, pageSizeOptions: o = l, onViewAllDocuments: h, onCreateDocument: g, screenLabels: _, formLabels: v, detailsLabels: y, bankAccountLabels: b, addressLabels: x, deleteLabels: S, messageLabels: C }) {
|
|
23
|
+
let w = t();
|
|
24
|
+
d(() => {
|
|
25
|
+
w(a.Mounted);
|
|
26
|
+
}, [w]);
|
|
27
|
+
let { stateOptions: T, selectedId: E, view: D, table: O, details: k, detailsSheetView: A, permissions: j, isPermissionLoading: M, actions: N, handleRowClick: P, closeDetails: F } = u({
|
|
32
28
|
counterpartType: n,
|
|
33
|
-
detailsLabels:
|
|
34
|
-
messageLabels:
|
|
35
|
-
}),
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}) : void 0, [
|
|
40
|
-
n,
|
|
41
|
-
Z,
|
|
42
|
-
H.errors,
|
|
43
|
-
H.values,
|
|
44
|
-
Y,
|
|
45
|
-
I
|
|
46
|
-
]), $ = y(() => F && z ? {
|
|
47
|
-
id: F,
|
|
48
|
-
name: z.name
|
|
49
|
-
} : void 0, [z, F]);
|
|
50
|
-
return /* @__PURE__ */ S(b, { children: [
|
|
51
|
-
/* @__PURE__ */ x(e, {}),
|
|
52
|
-
/* @__PURE__ */ x(g, {
|
|
29
|
+
detailsLabels: y,
|
|
30
|
+
messageLabels: C
|
|
31
|
+
}), { form: I } = N;
|
|
32
|
+
return /* @__PURE__ */ m(f, { children: [
|
|
33
|
+
/* @__PURE__ */ p(e, {}),
|
|
34
|
+
/* @__PURE__ */ p(s, {
|
|
53
35
|
mode: n,
|
|
54
|
-
counterparts:
|
|
55
|
-
isLoading:
|
|
56
|
-
isError:
|
|
57
|
-
sorting:
|
|
58
|
-
onSortingChange:
|
|
59
|
-
pageSize:
|
|
60
|
-
onPageSizeChange:
|
|
61
|
-
pageSizeOptions:
|
|
62
|
-
hasNextPage:
|
|
63
|
-
hasPrevPage:
|
|
64
|
-
onNextPage:
|
|
65
|
-
onPrevPage:
|
|
66
|
-
searchValue:
|
|
67
|
-
onSearchChange:
|
|
68
|
-
entityFilter:
|
|
69
|
-
onEntityFilterChange:
|
|
70
|
-
isFiltering:
|
|
71
|
-
canCreate:
|
|
72
|
-
isAccessRestricted: !
|
|
73
|
-
onCreateClick:
|
|
74
|
-
onRowClick:
|
|
75
|
-
onRetry:
|
|
76
|
-
labels:
|
|
36
|
+
counterparts: O.rows,
|
|
37
|
+
isLoading: M || O.isLoading,
|
|
38
|
+
isError: O.isError,
|
|
39
|
+
sorting: O.sorting,
|
|
40
|
+
onSortingChange: O.onSortingChange,
|
|
41
|
+
pageSize: O.pageSize,
|
|
42
|
+
onPageSizeChange: O.onPageSizeChange,
|
|
43
|
+
pageSizeOptions: o,
|
|
44
|
+
hasNextPage: O.hasNextPage,
|
|
45
|
+
hasPrevPage: O.hasPrevPage,
|
|
46
|
+
onNextPage: O.onNextPage,
|
|
47
|
+
onPrevPage: O.onPrevPage,
|
|
48
|
+
searchValue: O.searchValue,
|
|
49
|
+
onSearchChange: O.onSearchChange,
|
|
50
|
+
entityFilter: O.entityFilter,
|
|
51
|
+
onEntityFilterChange: O.onEntityFilterChange,
|
|
52
|
+
isFiltering: O.isFiltering,
|
|
53
|
+
canCreate: j.canCreate,
|
|
54
|
+
isAccessRestricted: !M && !j.canRead,
|
|
55
|
+
onCreateClick: j.canCreate ? I.openCreate : () => void 0,
|
|
56
|
+
onRowClick: P,
|
|
57
|
+
onRetry: O.onRetry,
|
|
58
|
+
labels: _,
|
|
77
59
|
emptyStateTestId: "counterparts-widget-empty-state",
|
|
78
60
|
accessRestrictedTestId: "counterparts-widget-access-restricted"
|
|
79
61
|
}),
|
|
80
|
-
/* @__PURE__ */
|
|
81
|
-
open:
|
|
62
|
+
/* @__PURE__ */ p(r, {
|
|
63
|
+
open: D === "create",
|
|
82
64
|
onOpenChange: (e) => {
|
|
83
|
-
e ||
|
|
65
|
+
e || I.close();
|
|
84
66
|
},
|
|
85
67
|
mode: "create",
|
|
86
68
|
counterpartMode: n,
|
|
87
|
-
values:
|
|
88
|
-
errors:
|
|
89
|
-
stateOptions:
|
|
90
|
-
taxIdField:
|
|
91
|
-
inProgress:
|
|
92
|
-
submitDisabled:
|
|
93
|
-
onChange: (e) =>
|
|
69
|
+
values: I.values,
|
|
70
|
+
errors: I.errors,
|
|
71
|
+
stateOptions: T,
|
|
72
|
+
taxIdField: i(I.values.entityType, n, v),
|
|
73
|
+
inProgress: I.isSubmitting,
|
|
74
|
+
submitDisabled: I.isSubmitting,
|
|
75
|
+
onChange: (e) => I.setValues((t) => ({
|
|
94
76
|
...t,
|
|
95
77
|
...e
|
|
96
78
|
})),
|
|
97
|
-
onAddressChange: (e) =>
|
|
79
|
+
onAddressChange: (e) => I.setValues((t) => ({
|
|
98
80
|
...t,
|
|
99
81
|
address: {
|
|
100
82
|
...t.address,
|
|
101
83
|
...e
|
|
102
84
|
}
|
|
103
85
|
})),
|
|
104
|
-
onBankAccountChange: (e) =>
|
|
86
|
+
onBankAccountChange: (e) => I.setValues((t) => ({
|
|
105
87
|
...t,
|
|
106
88
|
bankAccount: {
|
|
107
89
|
...t.bankAccount,
|
|
108
90
|
...e
|
|
109
91
|
}
|
|
110
92
|
})),
|
|
111
|
-
onSubmit:
|
|
112
|
-
onCancel:
|
|
113
|
-
labels:
|
|
114
|
-
}),
|
|
115
|
-
/* @__PURE__ */ x(_, {
|
|
116
|
-
open: F !== void 0 && (I === "none" || I === "edit"),
|
|
117
|
-
onOpenChange: (e) => {
|
|
118
|
-
e || q();
|
|
119
|
-
},
|
|
120
|
-
privacyResetKey: F,
|
|
121
|
-
mode: n,
|
|
122
|
-
counterpart: z,
|
|
123
|
-
isLoading: R.isLoading,
|
|
124
|
-
isError: R.isError,
|
|
125
|
-
canEdit: B.canUpdate,
|
|
126
|
-
canDelete: B.canDelete,
|
|
127
|
-
onEdit: J,
|
|
128
|
-
onDelete: G.requestDeleteCounterpart,
|
|
129
|
-
onClose: q,
|
|
130
|
-
onAddAddress: W.openCreate,
|
|
131
|
-
onEditAddress: W.openEdit,
|
|
132
|
-
onAddBankAccount: U.form.openCreate,
|
|
133
|
-
onEditBankAccount: U.form.openEdit,
|
|
134
|
-
onViewAllDocuments: C && $ ? () => C($) : void 0,
|
|
135
|
-
onCreateDocument: w && $ ? () => w($) : void 0,
|
|
136
|
-
onDeleteBankAccount: (e) => G.requestDelete({
|
|
137
|
-
kind: "bankAccount",
|
|
138
|
-
id: e,
|
|
139
|
-
label: R.bankItems.find((t) => t.id === e)?.primary ?? ""
|
|
140
|
-
}),
|
|
141
|
-
editForm: Q && {
|
|
142
|
-
...Q,
|
|
143
|
-
...Z,
|
|
144
|
-
stateOptions: N,
|
|
145
|
-
inProgress: H.isSubmitting,
|
|
146
|
-
submitDisabled: !P,
|
|
147
|
-
onFieldChange: (e, t) => H.setValues((n) => ({
|
|
148
|
-
...n,
|
|
149
|
-
[u[e]]: t
|
|
150
|
-
})),
|
|
151
|
-
onRemindersChange: (e) => H.setValues((t) => ({
|
|
152
|
-
...t,
|
|
153
|
-
remindersEnabled: e
|
|
154
|
-
})),
|
|
155
|
-
onAddressChange: (e) => H.setValues((t) => ({
|
|
156
|
-
...t,
|
|
157
|
-
address: {
|
|
158
|
-
...t.address,
|
|
159
|
-
...e
|
|
160
|
-
}
|
|
161
|
-
})),
|
|
162
|
-
onSubmit: H.submit,
|
|
163
|
-
onCancel: H.close
|
|
164
|
-
},
|
|
165
|
-
addressForm: W.open ? {
|
|
166
|
-
hasExistingAddress: !!R.primaryAddress,
|
|
167
|
-
values: W.values,
|
|
168
|
-
errors: W.errors,
|
|
169
|
-
stateOptions: N,
|
|
170
|
-
inProgress: W.isPending,
|
|
171
|
-
submitDisabled: !te,
|
|
172
|
-
formError: W.formError,
|
|
173
|
-
...X,
|
|
174
|
-
onChange: (e) => W.setValues((t) => ({
|
|
175
|
-
...t,
|
|
176
|
-
...e
|
|
177
|
-
})),
|
|
178
|
-
onSubmit: W.submit,
|
|
179
|
-
onCancel: W.close
|
|
180
|
-
} : void 0,
|
|
181
|
-
labels: Y
|
|
182
|
-
}),
|
|
183
|
-
/* @__PURE__ */ x(i, {
|
|
184
|
-
open: U.form.sheet.open,
|
|
185
|
-
onOpenChange: (e) => {
|
|
186
|
-
e || U.form.close();
|
|
187
|
-
},
|
|
188
|
-
mode: U.form.sheet.mode,
|
|
189
|
-
values: U.form.values,
|
|
190
|
-
errors: U.form.errors,
|
|
191
|
-
currencyOptions: U.currencyOptions,
|
|
192
|
-
inProgress: U.inProgress,
|
|
193
|
-
onChange: (e) => U.form.setValues((t) => ({
|
|
194
|
-
...t,
|
|
195
|
-
...e
|
|
196
|
-
})),
|
|
197
|
-
onSubmit: U.form.submit,
|
|
198
|
-
onCancel: U.form.close,
|
|
199
|
-
labels: O
|
|
93
|
+
onSubmit: I.submit,
|
|
94
|
+
onCancel: I.close,
|
|
95
|
+
labels: v
|
|
200
96
|
}),
|
|
201
|
-
/* @__PURE__ */
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
97
|
+
/* @__PURE__ */ p(c, {
|
|
98
|
+
counterpartType: n,
|
|
99
|
+
open: E !== void 0 && (D === "none" || D === "edit"),
|
|
100
|
+
selectedId: E,
|
|
101
|
+
view: D,
|
|
102
|
+
details: k,
|
|
103
|
+
detailsSheetView: A,
|
|
104
|
+
actions: N,
|
|
105
|
+
stateOptions: T,
|
|
106
|
+
canEdit: j.canUpdate,
|
|
107
|
+
canDelete: j.canDelete,
|
|
108
|
+
onClose: F,
|
|
109
|
+
onViewAllDocuments: h,
|
|
110
|
+
onCreateDocument: g,
|
|
111
|
+
formLabels: v,
|
|
112
|
+
detailsLabels: y,
|
|
113
|
+
bankAccountLabels: b,
|
|
114
|
+
addressLabels: x,
|
|
115
|
+
deleteLabels: S
|
|
212
116
|
})
|
|
213
117
|
] });
|
|
214
118
|
}
|
|
215
|
-
function
|
|
216
|
-
return /* @__PURE__ */
|
|
217
|
-
widgetName:
|
|
119
|
+
function g({ baseUrl: e, widgetToken: t, organizationId: r, configClient: i, gatewayRouting: a, linkComponent: s, implementation: c, uiFramework: l, errorFallback: u, onError: d, analytics: f, disclosuresAcceptance: m, providerLabels: g, passThrough: _, ...v }) {
|
|
120
|
+
return /* @__PURE__ */ p(n, {
|
|
121
|
+
widgetName: _ === !0 && e === void 0 && t === void 0 ? void 0 : o,
|
|
218
122
|
baseUrl: e,
|
|
219
123
|
widgetToken: t,
|
|
220
124
|
organizationId: r,
|
|
221
125
|
configClient: i,
|
|
222
126
|
gatewayRouting: a,
|
|
223
|
-
linkComponent:
|
|
224
|
-
implementation:
|
|
127
|
+
linkComponent: s,
|
|
128
|
+
implementation: c,
|
|
225
129
|
uiFramework: l,
|
|
226
130
|
errorFallback: u,
|
|
227
131
|
onError: d,
|
|
228
132
|
analytics: f,
|
|
229
|
-
disclosuresAcceptance:
|
|
230
|
-
providerLabels:
|
|
231
|
-
children: /* @__PURE__ */
|
|
133
|
+
disclosuresAcceptance: m,
|
|
134
|
+
providerLabels: g,
|
|
135
|
+
children: /* @__PURE__ */ p(h, { ...v }, v.counterpartType)
|
|
232
136
|
});
|
|
233
137
|
}
|
|
234
138
|
//#endregion
|
|
235
|
-
export {
|
|
139
|
+
export { g as CounterpartsWidget, g as default };
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import { addressResponseToFormValues as e, bankAccountToAchFormValues as t, counterpartToFormValues as n } from "../../../../../shared/counterpart-management/feature/dist/lib/helpers.js";
|
|
6
|
+
import { useAddressForm as r } from "../../../../../shared/counterpart-management/feature/dist/lib/useAddressForm.js";
|
|
7
|
+
import { useCounterpartForm as i } from "../../../../../shared/counterpart-management/feature/dist/lib/useCounterpartForm.js";
|
|
8
|
+
import { useDeleteController as a } from "../../../../../shared/counterpart-management/feature/dist/lib/useDeleteController.js";
|
|
9
|
+
import { useBankAccountForm as o } from "../../../../../shared/counterpart-management/feature/dist/lib/subEntityForms.js";
|
|
10
|
+
import "../../../../../shared/counterpart-management/feature/dist/index.js";
|
|
11
|
+
import { useRebaseOnRefresh as s } from "./useRebaseOnRefresh.js";
|
|
12
|
+
import { useCallback as c, useMemo as l } from "react";
|
|
13
|
+
//#region ../../libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartDetailsActions.js
|
|
14
|
+
var u = {
|
|
15
|
+
line1: "",
|
|
16
|
+
line2: "",
|
|
17
|
+
city: "",
|
|
18
|
+
state: "",
|
|
19
|
+
postalCode: ""
|
|
20
|
+
};
|
|
21
|
+
function d(e, t) {
|
|
22
|
+
return e.line1 === t.line1 && e.line2 === t.line2 && e.city === t.city && e.state === t.state && e.postalCode === t.postalCode;
|
|
23
|
+
}
|
|
24
|
+
function f({ counterpartType: f, selectedId: p, setSelectedId: m, view: h, setView: g, details: _, messages: v }) {
|
|
25
|
+
let y = f === "customer", b = i({
|
|
26
|
+
view: h,
|
|
27
|
+
setView: g,
|
|
28
|
+
selectedId: p,
|
|
29
|
+
setSelectedId: m,
|
|
30
|
+
messages: v,
|
|
31
|
+
counterpartType: f,
|
|
32
|
+
counterpart: _.counterpart,
|
|
33
|
+
primaryAddress: y && h === "edit" ? void 0 : _.primaryAddress,
|
|
34
|
+
includeBankAccount: h === "create"
|
|
35
|
+
}), x = o({
|
|
36
|
+
items: _.bankAccounts,
|
|
37
|
+
selectedId: p,
|
|
38
|
+
messages: v
|
|
39
|
+
}), S = r({
|
|
40
|
+
selectedId: p,
|
|
41
|
+
primaryAddress: _.primaryAddress,
|
|
42
|
+
messages: v
|
|
43
|
+
}), C = a({
|
|
44
|
+
selectedId: p,
|
|
45
|
+
setSelectedId: m,
|
|
46
|
+
detailsView: _.detailsView,
|
|
47
|
+
messages: v
|
|
48
|
+
}), w = l(() => {
|
|
49
|
+
if (!_.counterpart) return;
|
|
50
|
+
let e = n(_.counterpart, _.primaryAddress);
|
|
51
|
+
return y ? {
|
|
52
|
+
...e,
|
|
53
|
+
address: u
|
|
54
|
+
} : e;
|
|
55
|
+
}, [
|
|
56
|
+
_.counterpart,
|
|
57
|
+
_.primaryAddress,
|
|
58
|
+
y
|
|
59
|
+
]), T = l(() => _.primaryAddress ? e(_.primaryAddress) : u, [_.primaryAddress]), E = l(() => {
|
|
60
|
+
if (x.form.sheet.mode !== "edit") return;
|
|
61
|
+
let e = _.bankAccounts?.find((e) => e.id === x.form.sheet.id);
|
|
62
|
+
return e ? t(e) : void 0;
|
|
63
|
+
}, [
|
|
64
|
+
x.form.sheet.id,
|
|
65
|
+
x.form.sheet.mode,
|
|
66
|
+
_.bankAccounts
|
|
67
|
+
]);
|
|
68
|
+
s({
|
|
69
|
+
open: h === "edit",
|
|
70
|
+
seed: w,
|
|
71
|
+
setValues: b.setValues
|
|
72
|
+
}), s({
|
|
73
|
+
open: S.open,
|
|
74
|
+
seed: T,
|
|
75
|
+
setValues: S.setValues
|
|
76
|
+
}), s({
|
|
77
|
+
open: x.form.sheet.open,
|
|
78
|
+
seed: E,
|
|
79
|
+
setValues: x.form.setValues
|
|
80
|
+
}), x.form.sheet.open && x.form.sheet.mode === "edit" && _.bankAccounts !== void 0 && !_.isBankAccountsFetching && !E && x.form.close();
|
|
81
|
+
let D = l(() => {
|
|
82
|
+
if (!w) return !1;
|
|
83
|
+
let e = b.values;
|
|
84
|
+
return e.legalName !== w.legalName || e.firstName !== w.firstName || e.lastName !== w.lastName || e.email !== w.email || e.phone !== w.phone || e.taxId !== w.taxId || e.remindersEnabled !== w.remindersEnabled || !y && !d(e.address, w.address);
|
|
85
|
+
}, [
|
|
86
|
+
w,
|
|
87
|
+
b.values,
|
|
88
|
+
y
|
|
89
|
+
]), O = l(() => !d(S.values, T), [S.values, T]), { close: k } = S, { openEdit: A, setValues: j } = b;
|
|
90
|
+
return {
|
|
91
|
+
form: b,
|
|
92
|
+
bank: x,
|
|
93
|
+
address: S,
|
|
94
|
+
del: C,
|
|
95
|
+
isEditDirty: D,
|
|
96
|
+
isAddressDirty: O,
|
|
97
|
+
closeAddress: k,
|
|
98
|
+
handleEditProfile: c(() => {
|
|
99
|
+
if (!y) {
|
|
100
|
+
k(), A();
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
A(), j((e) => ({
|
|
104
|
+
...e,
|
|
105
|
+
address: u
|
|
106
|
+
}));
|
|
107
|
+
}, [
|
|
108
|
+
k,
|
|
109
|
+
A,
|
|
110
|
+
j,
|
|
111
|
+
y
|
|
112
|
+
])
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
//#endregion
|
|
116
|
+
export { f as useCounterpartDetailsActions };
|
|
@@ -5,8 +5,8 @@
|
|
|
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 {
|
|
8
|
+
import { buildPaymentMethodView as r, buildRecentDocumentRows as i, formatDetailsDate as a, maskTaxId as o } from "./viewModels.js";
|
|
9
|
+
import { PAYABLES_BILLED_STATUSES as s, PAYABLES_OWED_STATUSES as c, PAYABLES_REJECTED_STATUSES as l, RECEIVABLES_BILLED_STATUSES as u, RECEIVABLES_DUE_STATUSES as d } from "./constants.js";
|
|
10
10
|
import { usePayablesAnalyticsByCounterpartQuery as f, useReceivablesAnalyticsByCounterpartQuery as p } from "../../../../data-access/dist/index2.js";
|
|
11
11
|
import { useRecentPayablesByCounterpartQuery as m, useRecentReceivablesByCounterpartQuery as h } from "../../../../data-access/dist/index3.js";
|
|
12
12
|
import "../../../../data-access/dist/index.js";
|
|
@@ -18,26 +18,26 @@ function _({ selectedId: _, isCustomer: v, enabled: y, detailsText: b }) {
|
|
|
18
18
|
enabled: y
|
|
19
19
|
}), S = g(() => _ ? [_] : [], [_]), C = S.length > 0, w = p({
|
|
20
20
|
type: "invoice",
|
|
21
|
-
statusIn: [...
|
|
21
|
+
statusIn: [...u],
|
|
22
22
|
counterpartIdIn: S,
|
|
23
23
|
enabled: y && v && C
|
|
24
24
|
}), T = p({
|
|
25
25
|
metric: "amount_due",
|
|
26
26
|
type: "invoice",
|
|
27
|
-
statusIn: [...
|
|
27
|
+
statusIn: [...d],
|
|
28
28
|
counterpartIdIn: S,
|
|
29
29
|
enabled: y && v && C
|
|
30
30
|
}), E = f({
|
|
31
|
-
statusIn: [...
|
|
31
|
+
statusIn: [...s],
|
|
32
32
|
counterpartIdIn: S,
|
|
33
33
|
enabled: y && !v && C
|
|
34
34
|
}), D = f({
|
|
35
35
|
metric: "amount_due",
|
|
36
|
-
statusIn: [...
|
|
36
|
+
statusIn: [...c],
|
|
37
37
|
counterpartIdIn: S,
|
|
38
38
|
enabled: y && !v && C
|
|
39
39
|
}), O = f({
|
|
40
|
-
statusIn: [...
|
|
40
|
+
statusIn: [...l],
|
|
41
41
|
counterpartIdIn: S,
|
|
42
42
|
enabled: y && !v && C
|
|
43
43
|
}), k = h({
|
|
@@ -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), s = e(v ? T.data?.data : D.data?.data), c = n.get(_) ?? 0, l = s.get(_) ?? 0, u = c - l, d = v ? w.isLoading : E.isLoading, f = v ? T.isLoading : D.isLoading, p = e(O.data?.data), m = v ? 0 : p.get(_) ?? 0, h = v ? k.data?.data : A.data?.data, g = r(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}", a(x.counterpart?.created_at)),
|
|
58
58
|
entityTypeLabel: x.detailsView.entityType === "individual" ? b.entityTypePersonLabel : b.entityTypeBusinessLabel,
|
|
59
|
-
taxIdMasked:
|
|
59
|
+
taxIdMasked: o(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(
|
|
62
|
+
primaryAmountLabel: t(l),
|
|
63
|
+
billedAmountLabel: t(c),
|
|
64
|
+
receivedOrPaidAmountLabel: t(u),
|
|
65
65
|
rejectedAmountLabel: v ? void 0 : t(m),
|
|
66
66
|
isPrimaryAmountLoading: f,
|
|
67
|
-
isBilledAmountLoading:
|
|
68
|
-
isReceivedOrPaidAmountLoading:
|
|
67
|
+
isBilledAmountLoading: d,
|
|
68
|
+
isReceivedOrPaidAmountLoading: d || f,
|
|
69
69
|
isRejectedAmountLoading: v ? void 0 : O.isLoading
|
|
70
70
|
},
|
|
71
|
-
recentDocuments:
|
|
71
|
+
recentDocuments: i(h, v ? "invoice" : "bill", b),
|
|
72
72
|
paymentMethod: g
|
|
73
73
|
};
|
|
74
74
|
}, [
|