@tesouro/embedded-components-react 0.7.17 → 0.7.18

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