@tesouro/embedded-components-react 0.5.243 → 0.5.245
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 +2 -0
- package/dist/lib/ReceivablesWidget.d.ts +2 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +253 -251
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/details.js +84 -80
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/permissions.js +13 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActionsModal.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableDetails.js +28 -26
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableStatusCards.js +16 -16
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesTable.js +60 -58
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesWidget.js +188 -115
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index51.js +222 -219
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
|
@@ -171,7 +171,7 @@ function E({ invoice: e, recurrence: t, iterationInvoices: n, date: r, statusLab
|
|
|
171
171
|
};
|
|
172
172
|
});
|
|
173
173
|
}
|
|
174
|
-
function
|
|
174
|
+
function ee(e) {
|
|
175
175
|
if (!e?.line1) return;
|
|
176
176
|
let t = [e.city, [e.state, e.postal_code].filter(Boolean).join(" ")].filter(Boolean).join(", ");
|
|
177
177
|
return [
|
|
@@ -180,7 +180,7 @@ function D(e) {
|
|
|
180
180
|
e.country ? l(e.country) : void 0
|
|
181
181
|
].filter(Boolean).join(", ");
|
|
182
182
|
}
|
|
183
|
-
function
|
|
183
|
+
function te(e, t, n) {
|
|
184
184
|
let r = {
|
|
185
185
|
label: n.detailsAmountReceived,
|
|
186
186
|
value: t(e.amount_paid)
|
|
@@ -242,7 +242,7 @@ function ee(e, t, n) {
|
|
|
242
242
|
};
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
|
-
function
|
|
245
|
+
function ne(t, i, a) {
|
|
246
246
|
let o = t.line_items.reduce((t, n) => {
|
|
247
247
|
let r = n.total_before_tax ?? 0;
|
|
248
248
|
return e(n.tax_status) ? {
|
|
@@ -287,161 +287,165 @@ function te(t, i, a) {
|
|
|
287
287
|
emphasis: !0
|
|
288
288
|
}), m;
|
|
289
289
|
}
|
|
290
|
-
|
|
290
|
+
var D = {
|
|
291
|
+
primary: [],
|
|
292
|
+
overflow: []
|
|
293
|
+
};
|
|
294
|
+
function O({ receivable: e, pdfUrl: n, paymentReminder: r, overdueReminder: s, depositAccount: l, isAccountListIncomplete: u, recurrence: h, paymentRecords: S = [], isLoadingPaymentRecords: C = !1, iterationInvoices: T = /* @__PURE__ */ new Map(), auditHistory: O, statusLabels: k, messages: A, canWrite: j = !0, onOpenReceivable: M, now: N }) {
|
|
291
295
|
if (!e || e.type !== "invoice") return;
|
|
292
|
-
let
|
|
296
|
+
let P = e, F = (e) => o({
|
|
293
297
|
amount: e ?? 0,
|
|
294
|
-
currency:
|
|
298
|
+
currency: P.currency,
|
|
295
299
|
fallback: ""
|
|
296
|
-
}),
|
|
297
|
-
...
|
|
300
|
+
}), I = (e) => a(e, "-"), L = (e) => e ? I(e) : A.detailsPending, { status: R } = P, z = R === "canceled", B = R === "recurring" ? h : void 0, V = P.recurrence_id && R !== "recurring" ? h : void 0, H = R === "overdue" ? m(P.due_date, N) : 0, { amountTone: U, amountRows: W } = te(P, F, A), G = P.counterpart_contact, K = ee(P.counterpart_billing_address), re = [
|
|
301
|
+
...P.counterpart_name ? [{
|
|
298
302
|
label: A.detailsCustomerName,
|
|
299
|
-
value:
|
|
303
|
+
value: P.counterpart_name
|
|
300
304
|
}] : [],
|
|
301
|
-
...
|
|
305
|
+
...G?.email ? [{
|
|
302
306
|
label: A.detailsCustomerEmail,
|
|
303
|
-
value:
|
|
307
|
+
value: G.email
|
|
304
308
|
}] : [],
|
|
305
|
-
...
|
|
309
|
+
...G?.phone ? [{
|
|
306
310
|
label: A.detailsCustomerPhone,
|
|
307
|
-
value:
|
|
311
|
+
value: G.phone
|
|
308
312
|
}] : [],
|
|
309
|
-
...
|
|
313
|
+
...K ? [{
|
|
310
314
|
label: A.detailsCustomerAddress,
|
|
311
|
-
value:
|
|
315
|
+
value: K
|
|
312
316
|
}] : []
|
|
313
317
|
], q = {
|
|
314
318
|
label: A.detailsPaymentReminders,
|
|
315
319
|
value: g({
|
|
316
320
|
paymentReminder: r,
|
|
317
321
|
overdueReminder: s,
|
|
318
|
-
remindersConfigured: !!(
|
|
322
|
+
remindersConfigured: !!(P.payment_reminder_id || P.overdue_reminder_id),
|
|
319
323
|
messages: A
|
|
320
324
|
})
|
|
321
325
|
}, J = {
|
|
322
326
|
label: A.detailsDepositAccount,
|
|
323
|
-
value: l ? c(l, A) : u &&
|
|
327
|
+
value: l ? c(l, A) : u && P.bank_account_id ? "-" : A.detailsNotProvided
|
|
324
328
|
}, Y = {
|
|
325
329
|
label: A.detailsPaymentTerms,
|
|
326
|
-
value:
|
|
327
|
-
},
|
|
330
|
+
value: P.payment_terms?.name ?? A.detailsPending
|
|
331
|
+
}, ie = B ? [
|
|
328
332
|
{
|
|
329
333
|
label: A.detailsFrequency,
|
|
330
|
-
value: _(
|
|
334
|
+
value: _(B.frequency, A)
|
|
331
335
|
},
|
|
332
336
|
{
|
|
333
337
|
label: A.detailsInvoiceAmount,
|
|
334
|
-
value: P
|
|
338
|
+
value: F(P.total_amount)
|
|
335
339
|
},
|
|
336
340
|
Y,
|
|
337
341
|
q,
|
|
338
342
|
{
|
|
339
343
|
label: A.detailsPoNumber,
|
|
340
|
-
value:
|
|
344
|
+
value: P.purchase_order || A.detailsNotProvided
|
|
341
345
|
},
|
|
342
346
|
J
|
|
343
347
|
] : [
|
|
344
|
-
...
|
|
348
|
+
...P.document_id ? [{
|
|
345
349
|
label: A.detailsInvoiceNumber,
|
|
346
|
-
value:
|
|
350
|
+
value: P.document_id
|
|
347
351
|
}] : [],
|
|
348
352
|
{
|
|
349
353
|
label: A.detailsInvoiceAmount,
|
|
350
|
-
value: P
|
|
354
|
+
value: F(P.total_amount)
|
|
351
355
|
},
|
|
352
356
|
{
|
|
353
357
|
label: A.detailsInvoiceDate,
|
|
354
|
-
value:
|
|
358
|
+
value: L(P.issue_date)
|
|
355
359
|
},
|
|
356
360
|
{
|
|
357
361
|
label: A.detailsDueDate,
|
|
358
|
-
value:
|
|
362
|
+
value: L(P.due_date)
|
|
359
363
|
},
|
|
360
364
|
Y,
|
|
361
365
|
q,
|
|
362
|
-
...
|
|
366
|
+
...P.purchase_order ? [{
|
|
363
367
|
label: A.detailsPoNumber,
|
|
364
|
-
value:
|
|
368
|
+
value: P.purchase_order
|
|
365
369
|
}] : [],
|
|
366
370
|
J
|
|
367
|
-
], X =
|
|
371
|
+
], X = B ? void 0 : i(P), { primary: Z, overflow: Q } = j ? d[R] ?? {
|
|
368
372
|
primary: [],
|
|
369
373
|
overflow: ["clone"]
|
|
370
|
-
};
|
|
371
|
-
if (
|
|
372
|
-
let e =
|
|
373
|
-
Q =
|
|
374
|
+
} : D;
|
|
375
|
+
if (B && j) {
|
|
376
|
+
let e = B.status === "active" || B.status === "paused";
|
|
377
|
+
Q = B.status === "active" ? ["pauseRecurrence", "cancelRecurrence"] : B.status === "paused" ? ["resumeRecurrence", "cancelRecurrence"] : [], Z = e ? ["edit"] : [];
|
|
374
378
|
}
|
|
375
|
-
let
|
|
379
|
+
let ae = f.has(R) ? {
|
|
376
380
|
rows: S.map((e) => ({
|
|
377
381
|
id: e.id,
|
|
378
|
-
dateLabel:
|
|
379
|
-
amountLabel:
|
|
382
|
+
dateLabel: I(e.paid_at),
|
|
383
|
+
amountLabel: F(e.amount)
|
|
380
384
|
})),
|
|
381
|
-
totalLabel: P
|
|
382
|
-
emptyTone:
|
|
385
|
+
totalLabel: F(P.amount_paid),
|
|
386
|
+
emptyTone: R === "overdue" ? "danger" : "default",
|
|
383
387
|
isLoading: C
|
|
384
|
-
} : void 0,
|
|
385
|
-
statusLabel: y(
|
|
386
|
-
statusTone: b[
|
|
387
|
-
statusIcon: x[
|
|
388
|
-
amountLabel: P
|
|
389
|
-
amountPeriodLabel: v(
|
|
390
|
-
startsOnLabel:
|
|
391
|
-
endsOnLabel:
|
|
392
|
-
scheduleTitle: A.detailsScheduleTitle.replace("{frequency}", _(
|
|
388
|
+
} : void 0, oe = B ? {
|
|
389
|
+
statusLabel: y(B.status, A),
|
|
390
|
+
statusTone: b[B.status] ?? "neutral",
|
|
391
|
+
statusIcon: x[B.status],
|
|
392
|
+
amountLabel: F(P.total_amount),
|
|
393
|
+
amountPeriodLabel: v(B.frequency, A),
|
|
394
|
+
startsOnLabel: L(B.start_date),
|
|
395
|
+
endsOnLabel: I(B.end_date),
|
|
396
|
+
scheduleTitle: A.detailsScheduleTitle.replace("{frequency}", _(B.frequency, A)),
|
|
393
397
|
schedule: E({
|
|
394
|
-
invoice:
|
|
395
|
-
recurrence:
|
|
398
|
+
invoice: P,
|
|
399
|
+
recurrence: B,
|
|
396
400
|
iterationInvoices: T,
|
|
397
|
-
date:
|
|
401
|
+
date: I,
|
|
398
402
|
statusLabels: k,
|
|
399
403
|
messages: A,
|
|
400
|
-
onOpenReceivable:
|
|
404
|
+
onOpenReceivable: M
|
|
401
405
|
})
|
|
402
|
-
} : void 0, $ =
|
|
406
|
+
} : void 0, $ = V ? w(P, V, A) : void 0, se = V && $ ? {
|
|
403
407
|
title: $,
|
|
404
408
|
backLabel: A.detailsSeriesBack.replace("{title}", $),
|
|
405
|
-
onOpen: () =>
|
|
409
|
+
onOpen: () => M(V.invoice_id)
|
|
406
410
|
} : void 0;
|
|
407
411
|
return {
|
|
408
|
-
id:
|
|
409
|
-
type:
|
|
410
|
-
title:
|
|
411
|
-
status:
|
|
412
|
-
statusTone: p[
|
|
412
|
+
id: P.id,
|
|
413
|
+
type: P.type,
|
|
414
|
+
title: B ? w(P, B, A) : P.counterpart_name ?? A.invoiceType,
|
|
415
|
+
status: R,
|
|
416
|
+
statusTone: p[R] ?? "neutral",
|
|
413
417
|
pdfUrl: n,
|
|
414
|
-
lineItems:
|
|
418
|
+
lineItems: P.line_items.map((e, t) => ({
|
|
415
419
|
id: `${e.product.id ?? "item"}-${t}`,
|
|
416
420
|
name: e.product.name,
|
|
417
421
|
quantityLabel: String(e.quantity),
|
|
418
|
-
unitPriceLabel:
|
|
419
|
-
totalLabel:
|
|
422
|
+
unitPriceLabel: F(e.product.price?.value),
|
|
423
|
+
totalLabel: F(e.total_before_tax ?? (e.product.price?.value ?? 0) * e.quantity)
|
|
420
424
|
})),
|
|
421
425
|
panel: {
|
|
422
|
-
subtitle:
|
|
423
|
-
statusLabel:
|
|
424
|
-
recurring: !!
|
|
425
|
-
overdueLabel:
|
|
426
|
-
amountTone:
|
|
427
|
-
amountRows:
|
|
428
|
-
issueDateLabel:
|
|
429
|
-
dueDateLabel:
|
|
430
|
-
dueDateCaption:
|
|
431
|
-
paymentHistory:
|
|
432
|
-
customerContact:
|
|
433
|
-
recurringSeries:
|
|
434
|
-
seriesLink:
|
|
435
|
-
billingItems:
|
|
436
|
-
lineItemsSection:
|
|
437
|
-
countLabel: String(
|
|
438
|
-
totals:
|
|
426
|
+
subtitle: B ? A.detailsSeriesSubtitle : P.document_id ? A.detailsInvoiceSubtitle.replace("{number}", P.document_id) : void 0,
|
|
427
|
+
statusLabel: R === "partially_paid" ? k.issued : k[R] ?? k.unknown,
|
|
428
|
+
recurring: !!P.recurrence_id || R === "recurring",
|
|
429
|
+
overdueLabel: H > 0 ? A.detailsDaysOverdue.replace("{days}", String(H)) : void 0,
|
|
430
|
+
amountTone: U,
|
|
431
|
+
amountRows: W,
|
|
432
|
+
issueDateLabel: L(P.issue_date),
|
|
433
|
+
dueDateLabel: z ? I(P.updated_at) : L(P.due_date),
|
|
434
|
+
dueDateCaption: z ? A.detailsCancelledOnCaption : A.detailsDueDate,
|
|
435
|
+
paymentHistory: ae,
|
|
436
|
+
customerContact: re,
|
|
437
|
+
recurringSeries: oe,
|
|
438
|
+
seriesLink: se,
|
|
439
|
+
billingItems: ie,
|
|
440
|
+
lineItemsSection: B ? void 0 : {
|
|
441
|
+
countLabel: String(P.line_items.length),
|
|
442
|
+
totals: ne(P, F, A)
|
|
439
443
|
},
|
|
440
444
|
notes: X && {
|
|
441
445
|
...X,
|
|
442
446
|
countLabel: String([X.opening, X.closing].filter(Boolean).length)
|
|
443
447
|
},
|
|
444
|
-
attachments: t(
|
|
448
|
+
attachments: t(P, A),
|
|
445
449
|
auditHistory: O,
|
|
446
450
|
primaryActions: Z,
|
|
447
451
|
overflowActions: Q
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { hasAnyScope as e } from "../../../../../shared/data-access/dist/lib/hasAnyScope.js";
|
|
2
|
+
import { Scope as t } from "../../../../../shared/data-access/dist/lib/scopes.js";
|
|
3
|
+
import "../../../../../shared/data-access/dist/index.js";
|
|
4
|
+
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/permissions.js
|
|
5
|
+
function n(n) {
|
|
6
|
+
let r = new Set(n ?? []);
|
|
7
|
+
return {
|
|
8
|
+
canRead: e(r, [t.InvoiceReadOrg]),
|
|
9
|
+
canWrite: e(r, [t.InvoiceWriteOrg])
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { n as getReceivablePermissions };
|
|
@@ -4,40 +4,40 @@
|
|
|
4
4
|
"use client";
|
|
5
5
|
import { buildReceivableAuditHistory as e } from "../../../../../shared/util/dist/lib/auditHistory/buildReceivableAuditHistory.js";
|
|
6
6
|
import { hasAnyScope as t } from "../../../../../shared/data-access/dist/lib/hasAnyScope.js";
|
|
7
|
-
import { Scope as
|
|
7
|
+
import { Scope as ee } from "../../../../../shared/data-access/dist/lib/scopes.js";
|
|
8
8
|
import "../../../../../shared/data-access/dist/index.js";
|
|
9
|
-
import { useWidgetConfig as
|
|
10
|
-
import { useOrganizationUserNames as
|
|
9
|
+
import { useWidgetConfig as te } from "../../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
10
|
+
import { useOrganizationUserNames as n } from "../../../../../shared/feature/dist/lib/user/useOrganizationUserNames.js";
|
|
11
11
|
import "../../../../../shared/feature/dist/index.js";
|
|
12
|
-
import { RECEIVABLE_DETAILS_SECTION as
|
|
12
|
+
import { RECEIVABLE_DETAILS_SECTION as r } from "../../../../ui/dist/index25.js";
|
|
13
13
|
import "../../../../ui/dist/index.js";
|
|
14
|
-
import { useAllReceivableHistoryQuery as
|
|
15
|
-
import { usePaymentAccountsQuery as
|
|
16
|
-
import { useReceivablePaymentRecordsQuery as
|
|
17
|
-
import { useReceivablePdfLinkQuery as
|
|
18
|
-
import { useOverdueRemindersQuery as
|
|
14
|
+
import { useAllReceivableHistoryQuery as ne } from "../../../../data-access/dist/index3.js";
|
|
15
|
+
import { usePaymentAccountsQuery as i } from "../../../../data-access/dist/index4.js";
|
|
16
|
+
import { useReceivablePaymentRecordsQuery as a } from "../../../../data-access/dist/index9.js";
|
|
17
|
+
import { useReceivablePdfLinkQuery as o, useReceivableQuery as s, useReceivablesByIdQueries as re } from "../../../../data-access/dist/index11.js";
|
|
18
|
+
import { useOverdueRemindersQuery as ie, usePaymentRemindersQuery as c, useRecurrenceQuery as l } from "../../../../data-access/dist/index12.js";
|
|
19
19
|
import "../../../../data-access/dist/index.js";
|
|
20
|
-
import { buildReceivableAuditHistoryLabels as
|
|
21
|
-
import { getBankAccountPermissions as
|
|
22
|
-
import { buildReceivableDetailsView as
|
|
23
|
-
import { useMemo as
|
|
20
|
+
import { buildReceivableAuditHistoryLabels as u } from "./auditHistory/labels.js";
|
|
21
|
+
import { getBankAccountPermissions as d } from "./bankAccounts.js";
|
|
22
|
+
import { buildReceivableDetailsView as f, buildUnsupportedDetailsView as p } from "./details.js";
|
|
23
|
+
import { useMemo as m, useState as h } from "react";
|
|
24
24
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableDetails.js
|
|
25
|
-
var
|
|
26
|
-
function
|
|
27
|
-
let { initResponse: w } =
|
|
28
|
-
enabled:
|
|
25
|
+
var g = [r.attachments];
|
|
26
|
+
function _({ selectedReceivableId: _, enabled: v = !0, canWrite: y = !0, messages: b, statusLabels: x, auditHistoryLabels: S, onOpenReceivable: C }) {
|
|
27
|
+
let { initResponse: w } = te(), T = m(() => d(w?.scopes), [w?.scopes]), E = s(_, { enabled: v }), D = E.data, O = D?.type === "invoice" ? D : void 0, k = o(_, { enabled: v && !!O }), ae = c({ enabled: v && !!O?.payment_reminder_id }), oe = ie({ enabled: v && !!O?.overdue_reminder_id }), A = i({
|
|
28
|
+
enabled: v && !!O,
|
|
29
29
|
canReadEmbedded: T.canReadEmbedded,
|
|
30
30
|
canReadExternal: T.canReadExternal
|
|
31
|
-
}), j =
|
|
32
|
-
B !==
|
|
33
|
-
let H = R.includes(
|
|
34
|
-
...
|
|
31
|
+
}), j = l(v ? O?.recurrence_id : void 0), M = j.data, N = a(O?.id, { enabled: v }), P = ne(O?.id, { enabled: v && !!O }), F = m(() => O?.status === "recurring" ? (M?.iterations ?? []).flatMap((e) => e.issued_invoice_id ? [e.issued_invoice_id] : []) : [], [O?.status, M?.iterations]), I = re(F, { enabled: v }), L = m(() => new Map(I.filter((e) => !!e).map((e) => [e.id, e])), [I]), [R, z] = h(g), [B, V] = h(_);
|
|
32
|
+
B !== _ && (V(_), z(g));
|
|
33
|
+
let H = R.includes(r.auditHistory), U = m(() => P.data?.data ?? [], [P.data]), W = U.some((e) => e.recorded_by === "user" && !!e.entity_user_id), G = t(w?.scopes, [ee.UserReadOrg]), { userNames: K, isError: q } = n({ enabled: v && H && G && W }), J = m(() => ({
|
|
34
|
+
...u(b, x),
|
|
35
35
|
...S
|
|
36
36
|
}), [
|
|
37
37
|
b,
|
|
38
38
|
x,
|
|
39
39
|
S
|
|
40
|
-
]), Y =
|
|
40
|
+
]), Y = m(() => {
|
|
41
41
|
let t = O ? e(U, K, J, {
|
|
42
42
|
documentType: "invoice",
|
|
43
43
|
currency: O.currency,
|
|
@@ -62,11 +62,11 @@ function v({ selectedReceivableId: v, enabled: y = !0, messages: b, statusLabels
|
|
|
62
62
|
G,
|
|
63
63
|
q,
|
|
64
64
|
W
|
|
65
|
-
]), X =
|
|
65
|
+
]), X = ae.data?.data.find((e) => e.id === O?.payment_reminder_id), Z = oe.data?.data.find((e) => e.id === O?.overdue_reminder_id), Q = A.paymentAccounts.find((e) => e.id === O?.bank_account_id), $ = k.data?.file_url || void 0;
|
|
66
66
|
return {
|
|
67
67
|
receivable: D,
|
|
68
68
|
recurrence: M,
|
|
69
|
-
detailsView:
|
|
69
|
+
detailsView: m(() => f({
|
|
70
70
|
receivable: D,
|
|
71
71
|
pdfUrl: $,
|
|
72
72
|
paymentReminder: X,
|
|
@@ -80,6 +80,7 @@ function v({ selectedReceivableId: v, enabled: y = !0, messages: b, statusLabels
|
|
|
80
80
|
auditHistory: Y,
|
|
81
81
|
statusLabels: x,
|
|
82
82
|
messages: b,
|
|
83
|
+
canWrite: y,
|
|
83
84
|
onOpenReceivable: C
|
|
84
85
|
}), [
|
|
85
86
|
D,
|
|
@@ -95,9 +96,10 @@ function v({ selectedReceivableId: v, enabled: y = !0, messages: b, statusLabels
|
|
|
95
96
|
Y,
|
|
96
97
|
x,
|
|
97
98
|
b,
|
|
99
|
+
y,
|
|
98
100
|
C
|
|
99
101
|
]),
|
|
100
|
-
unsupportedView:
|
|
102
|
+
unsupportedView: m(() => p(D, b), [D, b]),
|
|
101
103
|
openSections: R,
|
|
102
104
|
setOpenSections: z,
|
|
103
105
|
isLoading: E.isLoading || k.isLoading || j.isLoading,
|
|
@@ -105,4 +107,4 @@ function v({ selectedReceivableId: v, enabled: y = !0, messages: b, statusLabels
|
|
|
105
107
|
};
|
|
106
108
|
}
|
|
107
109
|
//#endregion
|
|
108
|
-
export {
|
|
110
|
+
export { _ as useReceivableDetails };
|
|
@@ -7,36 +7,36 @@ import "../../../../data-access/dist/index.js";
|
|
|
7
7
|
import { buildReceivableStatusCardsView as t } from "./statusCards.js";
|
|
8
8
|
import { useMemo as n } from "react";
|
|
9
9
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableStatusCards.js
|
|
10
|
-
function r({ enabled: r,
|
|
11
|
-
let
|
|
10
|
+
function r({ enabled: r, visible: i = r, statusFilter: a, messages: o, statusLabels: s }) {
|
|
11
|
+
let c = e({
|
|
12
12
|
enabled: r,
|
|
13
13
|
dimension: "status",
|
|
14
14
|
metric: "id",
|
|
15
15
|
aggregation_function: "count",
|
|
16
16
|
type: "invoice"
|
|
17
|
-
}),
|
|
17
|
+
}), l = e({
|
|
18
18
|
enabled: r,
|
|
19
19
|
dimension: "status",
|
|
20
20
|
metric: "total_amount",
|
|
21
21
|
aggregation_function: "summary",
|
|
22
22
|
type: "invoice"
|
|
23
|
-
}),
|
|
23
|
+
}), u = c.data?.data, d = l.data?.data, f = c.isPending || l.isPending;
|
|
24
24
|
return n(() => {
|
|
25
|
-
if (
|
|
26
|
-
counts:
|
|
27
|
-
amounts:
|
|
28
|
-
statusFilter:
|
|
29
|
-
statusLabels:
|
|
30
|
-
fallback:
|
|
25
|
+
if (i) return f ? { kind: "loading" } : t({
|
|
26
|
+
counts: u ?? [],
|
|
27
|
+
amounts: d ?? [],
|
|
28
|
+
statusFilter: a,
|
|
29
|
+
statusLabels: s,
|
|
30
|
+
fallback: o.notAvailable
|
|
31
31
|
});
|
|
32
32
|
}, [
|
|
33
|
-
u,
|
|
34
|
-
l,
|
|
35
|
-
r,
|
|
36
33
|
d,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
o
|
|
34
|
+
u,
|
|
35
|
+
f,
|
|
36
|
+
o.notAvailable,
|
|
37
|
+
a,
|
|
38
|
+
s,
|
|
39
|
+
i
|
|
40
40
|
]);
|
|
41
41
|
}
|
|
42
42
|
//#endregion
|
|
@@ -11,79 +11,81 @@ import { useReceivableStatusCards as o } from "./useReceivableStatusCards.js";
|
|
|
11
11
|
import { useCallback as s, useEffect as c, useMemo as l, useState as u } from "react";
|
|
12
12
|
//#region ../../libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesTable.js
|
|
13
13
|
var d = [];
|
|
14
|
-
function f({ activeTab: f, initialCounterpartId: m, messages: h, statusLabels: g, filterLabels: _ }) {
|
|
15
|
-
let [
|
|
14
|
+
function f({ activeTab: f, initialCounterpartId: m, messages: h, statusLabels: g, filterLabels: _, enabled: v = !0, visible: y = v }) {
|
|
15
|
+
let [b, x] = u([]), [S, C] = u(10), [w, T] = u(), [E, D] = u(""), [O, k] = u(""), [A, j] = u("all"), M = f === "invoices", N = s(() => T(void 0), []), P = i({
|
|
16
16
|
initialCounterpartId: m,
|
|
17
|
-
search:
|
|
18
|
-
onSearchChange:
|
|
19
|
-
onFiltersChange:
|
|
17
|
+
search: E,
|
|
18
|
+
onSearchChange: D,
|
|
19
|
+
onFiltersChange: N,
|
|
20
20
|
statusLabels: g,
|
|
21
21
|
labels: _
|
|
22
|
-
}),
|
|
22
|
+
}), F = P.reset;
|
|
23
23
|
c(() => {
|
|
24
|
-
|
|
25
|
-
}, [f,
|
|
24
|
+
T(void 0), j("all"), D(""), k(""), F();
|
|
25
|
+
}, [f, F]), c(() => {
|
|
26
26
|
let e = setTimeout(() => {
|
|
27
|
-
|
|
27
|
+
k(E), T(void 0);
|
|
28
28
|
}, 300);
|
|
29
29
|
return () => clearTimeout(e);
|
|
30
|
-
}, [
|
|
31
|
-
let
|
|
30
|
+
}, [E]);
|
|
31
|
+
let I = b[0]?.id, L = I ? p[I] : void 0, R = b[0] ? b[0].desc ? "desc" : "asc" : void 0, z = r({
|
|
32
|
+
enabled: v,
|
|
32
33
|
type: n(f),
|
|
33
|
-
limit:
|
|
34
|
-
pagination_token:
|
|
35
|
-
search_text:
|
|
36
|
-
...
|
|
37
|
-
...
|
|
38
|
-
sort:
|
|
39
|
-
order:
|
|
34
|
+
limit: S,
|
|
35
|
+
pagination_token: w,
|
|
36
|
+
search_text: O || void 0,
|
|
37
|
+
...M ? P.query : { status: A === "all" ? void 0 : A },
|
|
38
|
+
...L ? {
|
|
39
|
+
sort: L,
|
|
40
|
+
order: R
|
|
40
41
|
} : {}
|
|
41
|
-
}),
|
|
42
|
-
enabled:
|
|
43
|
-
|
|
42
|
+
}), B = o({
|
|
43
|
+
enabled: v && M,
|
|
44
|
+
visible: y && M,
|
|
45
|
+
statusFilter: P.cardStatus,
|
|
44
46
|
messages: h,
|
|
45
47
|
statusLabels: g
|
|
46
|
-
}),
|
|
47
|
-
receivables:
|
|
48
|
+
}), V = z.data?.data ?? d, H = l(() => new Map(V.map((e) => [e.id, e])), [V]), U = s((e) => H.get(e), [H]), W = a(V), G = l(() => e({
|
|
49
|
+
receivables: V,
|
|
48
50
|
messages: h,
|
|
49
|
-
customerNames:
|
|
51
|
+
customerNames: W
|
|
50
52
|
}), [
|
|
51
|
-
|
|
53
|
+
W,
|
|
52
54
|
h,
|
|
53
|
-
|
|
54
|
-
]),
|
|
55
|
-
let t = typeof e == "function" ? e(
|
|
56
|
-
|
|
57
|
-
}, [
|
|
58
|
-
|
|
59
|
-
}, []),
|
|
60
|
-
|
|
61
|
-
}, []),
|
|
62
|
-
|
|
63
|
-
}, [
|
|
55
|
+
V
|
|
56
|
+
]), K = M ? P.isFiltering : !!O || A !== "all", q = s((e) => {
|
|
57
|
+
let t = typeof e == "function" ? e(b) : e;
|
|
58
|
+
x(t), T(void 0);
|
|
59
|
+
}, [b]), J = s((e) => {
|
|
60
|
+
C(e), T(void 0);
|
|
61
|
+
}, []), Y = s((e) => {
|
|
62
|
+
j(e), T(void 0);
|
|
63
|
+
}, []), X = s(() => T(z.data?.next_pagination_token ?? void 0), [z.data?.next_pagination_token]), Z = s(() => T(z.data?.prev_pagination_token ?? void 0), [z.data?.prev_pagination_token]), Q = s(() => {
|
|
64
|
+
z.refetch();
|
|
65
|
+
}, [z]);
|
|
64
66
|
return {
|
|
65
|
-
rows:
|
|
66
|
-
isLoading:
|
|
67
|
-
isError:
|
|
68
|
-
sorting:
|
|
69
|
-
onSortingChange:
|
|
70
|
-
pageSize:
|
|
71
|
-
onPageSizeChange:
|
|
72
|
-
hasNextPage: !!
|
|
73
|
-
hasPrevPage: !!
|
|
74
|
-
onNextPage:
|
|
75
|
-
onPrevPage:
|
|
76
|
-
searchValue:
|
|
77
|
-
onSearchChange:
|
|
78
|
-
statusFilter:
|
|
79
|
-
statusOptions: t(
|
|
80
|
-
onStatusFilterChange:
|
|
81
|
-
statusCards:
|
|
82
|
-
onStatusCardSelect:
|
|
83
|
-
invoicesFilterBar:
|
|
84
|
-
isFiltering:
|
|
85
|
-
onRetry:
|
|
86
|
-
getReceivableById:
|
|
67
|
+
rows: G,
|
|
68
|
+
isLoading: z.isLoading,
|
|
69
|
+
isError: z.isError,
|
|
70
|
+
sorting: b,
|
|
71
|
+
onSortingChange: q,
|
|
72
|
+
pageSize: S,
|
|
73
|
+
onPageSizeChange: J,
|
|
74
|
+
hasNextPage: !!z.data?.next_pagination_token,
|
|
75
|
+
hasPrevPage: !!z.data?.prev_pagination_token,
|
|
76
|
+
onNextPage: X,
|
|
77
|
+
onPrevPage: Z,
|
|
78
|
+
searchValue: E,
|
|
79
|
+
onSearchChange: D,
|
|
80
|
+
statusFilter: A,
|
|
81
|
+
statusOptions: t(A),
|
|
82
|
+
onStatusFilterChange: Y,
|
|
83
|
+
statusCards: B,
|
|
84
|
+
onStatusCardSelect: P.selectStatusCard,
|
|
85
|
+
invoicesFilterBar: M ? P.filterBar : void 0,
|
|
86
|
+
isFiltering: K,
|
|
87
|
+
onRetry: Q,
|
|
88
|
+
getReceivableById: U
|
|
87
89
|
};
|
|
88
90
|
}
|
|
89
91
|
var p = {
|