@tesouro/embedded-components-react 0.9.36 → 0.9.38
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/experimental/ApprovalRequests.d.ts +30 -3
- package/dist/experimental/index.d.ts +30 -3
- package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/data-access/dist/index.js +8 -0
- package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/data-access/dist/index2.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/data-access/dist/index3.js +72 -0
- package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/data-access/dist/index4.js +7 -0
- package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/data-access/dist/index5.js +7 -0
- package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/data-access/dist/index6.js +6 -0
- package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/ApprovalRequestsWidget/ApprovalRequestsWidget.js +50 -16
- package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/ApprovalRequestsWidget/buildApprovalRequestRows.js +29 -0
- package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/ApprovalRequestsWidget/constants.js +14 -0
- package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/ApprovalRequestsWidget/labels.js +16 -0
- package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/ApprovalRequestsWidget/useApprovalRequestsTable.js +53 -0
- package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/ui/dist/index.js +3 -0
- package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/ui/dist/index2.js +13 -0
- package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/ui/dist/index3.js +71 -0
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/util/dist/lib/formatCalendarDate.js +1 -0
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ComponentType, AnchorHTMLAttributes, ReactNode, ErrorInfo } from 'react';
|
|
3
|
+
import { PartialDeep } from 'type-fest';
|
|
3
4
|
import { FallbackProps } from 'react-error-boundary';
|
|
4
5
|
|
|
5
6
|
type AuthToken = string | undefined;
|
|
@@ -326,6 +327,7 @@ type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean
|
|
|
326
327
|
type ClientOptions = {
|
|
327
328
|
baseUrl: 'https://api.stage.tesouro.com' | 'https://api.sandbox.stage.tesouro.com' | 'https://api.stage.business-banking.app' | 'https://api.tesouro.com' | 'https://api.sandbox.tesouro.com' | 'https://api.business-banking.app' | (string & {});
|
|
328
329
|
};
|
|
330
|
+
type ApprovalRequestStatus = 'waiting' | 'approved' | 'rejected' | 'canceled';
|
|
329
331
|
|
|
330
332
|
type EmbeddedClient = Client;
|
|
331
333
|
type ExtractLiterals<T> = T extends string ? string extends T ? never : T : never;
|
|
@@ -596,13 +598,38 @@ interface WidgetProviderProps extends WidgetProviderBaseProps {
|
|
|
596
598
|
providerLabels?: Partial<WidgetProviderLabels>;
|
|
597
599
|
}
|
|
598
600
|
|
|
601
|
+
interface ApprovalRequestsScreenLabels {
|
|
602
|
+
columnInvoiceNumber: string;
|
|
603
|
+
columnIssueDate: string;
|
|
604
|
+
columnDueDate: string;
|
|
605
|
+
columnStatus: string;
|
|
606
|
+
columnAmount: string;
|
|
607
|
+
errorTitle: string;
|
|
608
|
+
errorDescription: string;
|
|
609
|
+
errorRetry: string;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
interface ApprovalRequestsListLabels {
|
|
613
|
+
emptyTitle: string;
|
|
614
|
+
emptyDescription: string;
|
|
615
|
+
filterEmptyTitle: string;
|
|
616
|
+
filterEmptyDescription: string;
|
|
617
|
+
/** Shown in a cell whose value the request's payable does not carry. */
|
|
618
|
+
missingValue: string;
|
|
619
|
+
status: Record<ApprovalRequestStatus, string>;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
interface ApprovalRequestsWidgetOwnProps {
|
|
623
|
+
screenLabels?: Partial<ApprovalRequestsScreenLabels>;
|
|
624
|
+
listLabels?: PartialDeep<ApprovalRequestsListLabels>;
|
|
625
|
+
}
|
|
599
626
|
/** Public props for {@link ApprovalRequestsWidget}. */
|
|
600
|
-
type ApprovalRequestsWidgetProps = WidgetProviderProps;
|
|
627
|
+
type ApprovalRequestsWidgetProps = WidgetProviderProps & ApprovalRequestsWidgetOwnProps;
|
|
601
628
|
/**
|
|
602
629
|
* Self-contained approval requests widget, a native port of Monite's approval
|
|
603
|
-
* requests (FOPS-97).
|
|
630
|
+
* requests (FOPS-97). Exported only from the package's `/experimental` entry.
|
|
604
631
|
*/
|
|
605
|
-
declare function ApprovalRequestsWidget(widgetProviderProps: ApprovalRequestsWidgetProps): React.JSX.Element;
|
|
632
|
+
declare function ApprovalRequestsWidget({ screenLabels, listLabels, ...widgetProviderProps }: ApprovalRequestsWidgetProps): React.JSX.Element;
|
|
606
633
|
|
|
607
634
|
export { ApprovalRequestsWidget };
|
|
608
635
|
export type { ApprovalRequestsWidgetProps };
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ComponentType, AnchorHTMLAttributes, ReactNode, ErrorInfo } from 'react';
|
|
3
|
+
import { PartialDeep } from 'type-fest';
|
|
3
4
|
import { FallbackProps } from 'react-error-boundary';
|
|
4
5
|
|
|
5
6
|
type AuthToken = string | undefined;
|
|
@@ -326,6 +327,7 @@ type Options<TData extends TDataShape = TDataShape, ThrowOnError extends boolean
|
|
|
326
327
|
type ClientOptions = {
|
|
327
328
|
baseUrl: 'https://api.stage.tesouro.com' | 'https://api.sandbox.stage.tesouro.com' | 'https://api.stage.business-banking.app' | 'https://api.tesouro.com' | 'https://api.sandbox.tesouro.com' | 'https://api.business-banking.app' | (string & {});
|
|
328
329
|
};
|
|
330
|
+
type ApprovalRequestStatus = 'waiting' | 'approved' | 'rejected' | 'canceled';
|
|
329
331
|
|
|
330
332
|
type EmbeddedClient = Client;
|
|
331
333
|
type ExtractLiterals<T> = T extends string ? string extends T ? never : T : never;
|
|
@@ -596,13 +598,38 @@ interface WidgetProviderProps extends WidgetProviderBaseProps {
|
|
|
596
598
|
providerLabels?: Partial<WidgetProviderLabels>;
|
|
597
599
|
}
|
|
598
600
|
|
|
601
|
+
interface ApprovalRequestsScreenLabels {
|
|
602
|
+
columnInvoiceNumber: string;
|
|
603
|
+
columnIssueDate: string;
|
|
604
|
+
columnDueDate: string;
|
|
605
|
+
columnStatus: string;
|
|
606
|
+
columnAmount: string;
|
|
607
|
+
errorTitle: string;
|
|
608
|
+
errorDescription: string;
|
|
609
|
+
errorRetry: string;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
interface ApprovalRequestsListLabels {
|
|
613
|
+
emptyTitle: string;
|
|
614
|
+
emptyDescription: string;
|
|
615
|
+
filterEmptyTitle: string;
|
|
616
|
+
filterEmptyDescription: string;
|
|
617
|
+
/** Shown in a cell whose value the request's payable does not carry. */
|
|
618
|
+
missingValue: string;
|
|
619
|
+
status: Record<ApprovalRequestStatus, string>;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
interface ApprovalRequestsWidgetOwnProps {
|
|
623
|
+
screenLabels?: Partial<ApprovalRequestsScreenLabels>;
|
|
624
|
+
listLabels?: PartialDeep<ApprovalRequestsListLabels>;
|
|
625
|
+
}
|
|
599
626
|
/** Public props for {@link ApprovalRequestsWidget}. */
|
|
600
|
-
type ApprovalRequestsWidgetProps = WidgetProviderProps;
|
|
627
|
+
type ApprovalRequestsWidgetProps = WidgetProviderProps & ApprovalRequestsWidgetOwnProps;
|
|
601
628
|
/**
|
|
602
629
|
* Self-contained approval requests widget, a native port of Monite's approval
|
|
603
|
-
* requests (FOPS-97).
|
|
630
|
+
* requests (FOPS-97). Exported only from the package's `/experimental` entry.
|
|
604
631
|
*/
|
|
605
|
-
declare function ApprovalRequestsWidget(widgetProviderProps: ApprovalRequestsWidgetProps): React.JSX.Element;
|
|
632
|
+
declare function ApprovalRequestsWidget({ screenLabels, listLabels, ...widgetProviderProps }: ApprovalRequestsWidgetProps): React.JSX.Element;
|
|
606
633
|
|
|
607
634
|
interface CheckAmountAndDetailScreenLabels {
|
|
608
635
|
title: string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import "../../../shared/data-access/dist/lib/useCurrentUserQuery.js";
|
|
2
|
+
import "../../../shared/data-access/dist/index.js";
|
|
3
|
+
import "./index2.js";
|
|
4
|
+
import { useApprovalRequestsQuery as e } from "./index3.js";
|
|
5
|
+
import "./index4.js";
|
|
6
|
+
import "./index5.js";
|
|
7
|
+
import "./index6.js";
|
|
8
|
+
export { e as useApprovalRequestsQuery };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "../../../shared/data-access/dist/index.js";
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import { getApprovalRequests as e, getPayables as t } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
|
|
6
|
+
import { getApprovalRequestsQueryKey as n } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
|
|
7
|
+
import { withAuthEpoch as r } from "../../../shared/data-access/dist/lib/withAuthEpoch.js";
|
|
8
|
+
import { useEmbedApi as i } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
|
|
9
|
+
import { organizationHeaders as a } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
|
|
10
|
+
import "../../../shared/data-access/dist/index.js";
|
|
11
|
+
import { queryOptions as o, useQuery as s } from "@tanstack/react-query";
|
|
12
|
+
//#region ../../libs/tesouro-embedded-components-react/approval-requests-widget/data-access/dist/index3.js
|
|
13
|
+
var c = "with-payables";
|
|
14
|
+
async function l({ client: n, headers: r, query: i, signal: a }) {
|
|
15
|
+
let { data: o } = await e({
|
|
16
|
+
client: n,
|
|
17
|
+
headers: r,
|
|
18
|
+
query: i,
|
|
19
|
+
signal: a,
|
|
20
|
+
throwOnError: !0
|
|
21
|
+
}), s = [...new Set(o.data.map((e) => e.object_id))], c = /* @__PURE__ */ new Map();
|
|
22
|
+
if (s.length > 0) {
|
|
23
|
+
let { data: e } = await t({
|
|
24
|
+
client: n,
|
|
25
|
+
headers: r,
|
|
26
|
+
query: {
|
|
27
|
+
id__in: s,
|
|
28
|
+
limit: s.length
|
|
29
|
+
},
|
|
30
|
+
signal: a,
|
|
31
|
+
throwOnError: !0
|
|
32
|
+
});
|
|
33
|
+
for (let t of e.data) c.set(t.id, t);
|
|
34
|
+
}
|
|
35
|
+
return {
|
|
36
|
+
data: o.data.map((e) => ({
|
|
37
|
+
request: e,
|
|
38
|
+
payable: c.get(e.object_id)
|
|
39
|
+
})),
|
|
40
|
+
next_pagination_token: o.next_pagination_token,
|
|
41
|
+
prev_pagination_token: o.prev_pagination_token
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function u({ enabled: e, ...t } = {}) {
|
|
45
|
+
let { client: u, organizationId: d, widgetToken: f, authEpoch: p, organizationStatus: m } = i(), h = a(d), g = {
|
|
46
|
+
...t,
|
|
47
|
+
sort: "updated_at",
|
|
48
|
+
order: "desc",
|
|
49
|
+
object_type: "payable"
|
|
50
|
+
};
|
|
51
|
+
return s({
|
|
52
|
+
...r(o({
|
|
53
|
+
queryKey: [...n({
|
|
54
|
+
client: u,
|
|
55
|
+
headers: h,
|
|
56
|
+
query: g
|
|
57
|
+
}), c],
|
|
58
|
+
queryFn: ({ signal: e }) => l({
|
|
59
|
+
client: u,
|
|
60
|
+
headers: h,
|
|
61
|
+
query: g,
|
|
62
|
+
signal: e
|
|
63
|
+
})
|
|
64
|
+
}), {
|
|
65
|
+
authEpoch: p,
|
|
66
|
+
organizationStatus: m
|
|
67
|
+
}, { carryWithinOrg: !0 }),
|
|
68
|
+
enabled: !!(d && f) && (e === !0 || e === void 0)
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
export { u as useApprovalRequestsQuery };
|
|
@@ -2,25 +2,59 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { isOrganizationOnItsWay as e } from "../../../../../shared/data-access/dist/lib/organizationStatus.js";
|
|
6
|
+
import { useEmbedApi as t } from "../../../../../shared/data-access/dist/lib/EmbedApiContext.js";
|
|
7
|
+
import "../../../../../shared/data-access/dist/index.js";
|
|
8
|
+
import { useAnalyticsTrack as n } from "../../../../../shared/feature/dist/lib/analytics/hooks.js";
|
|
9
|
+
import { WidgetProvider as r } from "../../../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
|
|
10
|
+
import { useRefetchWidget as i, useWidgetConfig as a, useWidgetError as o, useWidgetInitStaleForToken as s } from "../../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
7
11
|
import "../../../../../shared/feature/dist/index.js";
|
|
8
|
-
import { ApprovalRequestsWidgetAnalyticsEvent as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
12
|
+
import { ApprovalRequestsWidgetAnalyticsEvent as c, WIDGET_NAME as l } from "../analytics/events.js";
|
|
13
|
+
import { APPROVAL_REQUESTS_LIST_LABELS_EN as u } from "./labels.js";
|
|
14
|
+
import { useApprovalRequestsTable as d } from "./useApprovalRequestsTable.js";
|
|
15
|
+
import { ApprovalRequestsScreen as f } from "../../../../ui/dist/index3.js";
|
|
16
|
+
import "../../../../ui/dist/index.js";
|
|
17
|
+
import { useEffect as p, useMemo as m } from "react";
|
|
18
|
+
import { jsx as h } from "react/jsx-runtime";
|
|
11
19
|
//#region ../../libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/ApprovalRequestsWidget/ApprovalRequestsWidget.js
|
|
12
|
-
function
|
|
13
|
-
let
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}, [
|
|
20
|
+
function g({ screenLabels: r, listLabels: l }) {
|
|
21
|
+
let g = n();
|
|
22
|
+
p(() => {
|
|
23
|
+
g(c.Mounted);
|
|
24
|
+
}, [g]);
|
|
25
|
+
let _ = m(() => ({
|
|
26
|
+
...u,
|
|
27
|
+
...l,
|
|
28
|
+
status: {
|
|
29
|
+
...u.status,
|
|
30
|
+
...l?.status
|
|
31
|
+
}
|
|
32
|
+
}), [l]), v = d({ labels: _ }), { initResponse: y } = a(), b = o(), x = s(), S = i(), { organizationStatus: C } = t(), w = !!b && (!y || x);
|
|
33
|
+
return /* @__PURE__ */ h(f, {
|
|
34
|
+
rows: v.rows,
|
|
35
|
+
isLoading: v.isLoading || e(C) && v.rows.length === 0,
|
|
36
|
+
isError: w || v.isError,
|
|
37
|
+
pageSize: v.pageSize,
|
|
38
|
+
onPageSizeChange: v.onPageSizeChange,
|
|
39
|
+
pageSizeOptions: v.pageSizeOptions,
|
|
40
|
+
hasNextPage: v.hasNextPage,
|
|
41
|
+
hasPrevPage: v.hasPrevPage,
|
|
42
|
+
onNextPage: v.onNextPage,
|
|
43
|
+
onPrevPage: v.onPrevPage,
|
|
44
|
+
emptyState: v.emptyState,
|
|
45
|
+
onRetry: w ? S : v.onRetry,
|
|
46
|
+
labels: r
|
|
47
|
+
});
|
|
17
48
|
}
|
|
18
|
-
function
|
|
19
|
-
return /* @__PURE__ */
|
|
20
|
-
...
|
|
21
|
-
widgetName:
|
|
22
|
-
children: /* @__PURE__ */
|
|
49
|
+
function _({ screenLabels: e, listLabels: t, ...n }) {
|
|
50
|
+
return /* @__PURE__ */ h(r, {
|
|
51
|
+
...n,
|
|
52
|
+
widgetName: l,
|
|
53
|
+
children: /* @__PURE__ */ h(g, {
|
|
54
|
+
screenLabels: e,
|
|
55
|
+
listLabels: t
|
|
56
|
+
})
|
|
23
57
|
});
|
|
24
58
|
}
|
|
25
59
|
//#endregion
|
|
26
|
-
export {
|
|
60
|
+
export { _ as ApprovalRequestsWidget, _ as default };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createCurrencyFormatter as e } from "../../../../../shared/util/dist/lib/createCurrencyFormatter.js";
|
|
2
|
+
import { formatCalendarDate as t } from "../../../../../shared/util/dist/lib/formatCalendarDate.js";
|
|
3
|
+
import "../../../../../shared/util/dist/index.js";
|
|
4
|
+
import { STATUS_TONE as n } from "./constants.js";
|
|
5
|
+
//#region ../../libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/ApprovalRequestsWidget/buildApprovalRequestRows.js
|
|
6
|
+
var r = { day: "2-digit" };
|
|
7
|
+
function i(t, n) {
|
|
8
|
+
let r = new Intl.NumberFormat("en-US", {
|
|
9
|
+
style: "currency",
|
|
10
|
+
currency: n
|
|
11
|
+
}).resolvedOptions().maximumFractionDigits ?? 2;
|
|
12
|
+
return e(n).format(t / 10 ** r);
|
|
13
|
+
}
|
|
14
|
+
function a(e, a) {
|
|
15
|
+
return e.map(({ request: e, payable: o }) => {
|
|
16
|
+
let s = o?.amount_to_pay, c = o?.currency;
|
|
17
|
+
return {
|
|
18
|
+
id: e.id,
|
|
19
|
+
invoiceNumber: o?.document_id || a.missingValue,
|
|
20
|
+
issueDate: t(o?.issued_at, r) || a.missingValue,
|
|
21
|
+
dueDate: t(o?.due_date, r) || a.missingValue,
|
|
22
|
+
statusLabel: a.status[e.status],
|
|
23
|
+
statusTone: n[e.status],
|
|
24
|
+
amount: typeof s == "number" && c ? i(s, c) : a.missingValue
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
//#endregion
|
|
29
|
+
export { a as buildApprovalRequestRows };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region ../../libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/ApprovalRequestsWidget/constants.js
|
|
2
|
+
var e = [
|
|
3
|
+
10,
|
|
4
|
+
25,
|
|
5
|
+
50,
|
|
6
|
+
100
|
|
7
|
+
], t = {
|
|
8
|
+
waiting: "warning",
|
|
9
|
+
approved: "success",
|
|
10
|
+
rejected: "destructive",
|
|
11
|
+
canceled: "neutral"
|
|
12
|
+
};
|
|
13
|
+
//#endregion
|
|
14
|
+
export { e as PAGE_SIZE_OPTIONS, t as STATUS_TONE };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
//#region ../../libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/ApprovalRequestsWidget/labels.js
|
|
2
|
+
var e = {
|
|
3
|
+
emptyTitle: "No approval requests",
|
|
4
|
+
emptyDescription: "You don't have any approval requests yet.",
|
|
5
|
+
filterEmptyTitle: "No approval requests found",
|
|
6
|
+
filterEmptyDescription: "Try adjusting your filter criteria.",
|
|
7
|
+
missingValue: "—",
|
|
8
|
+
status: {
|
|
9
|
+
waiting: "In approval",
|
|
10
|
+
approved: "Approved",
|
|
11
|
+
rejected: "Rejected",
|
|
12
|
+
canceled: "Canceled"
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
//#endregion
|
|
16
|
+
export { e as APPROVAL_REQUESTS_LIST_LABELS_EN };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import { useEmbedApi as e } from "../../../../../shared/data-access/dist/lib/EmbedApiContext.js";
|
|
6
|
+
import "../../../../../shared/data-access/dist/index.js";
|
|
7
|
+
import { PAGE_SIZE_OPTIONS as t } from "./constants.js";
|
|
8
|
+
import { buildApprovalRequestRows as n } from "./buildApprovalRequestRows.js";
|
|
9
|
+
import { useApprovalRequestsQuery as r } from "../../../../data-access/dist/index3.js";
|
|
10
|
+
import "../../../../data-access/dist/index.js";
|
|
11
|
+
import { useCallback as i, useMemo as a, useState as o } from "react";
|
|
12
|
+
//#region ../../libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/ApprovalRequestsWidget/useApprovalRequestsTable.js
|
|
13
|
+
function s(e, t) {
|
|
14
|
+
return e ? {
|
|
15
|
+
title: t.filterEmptyTitle,
|
|
16
|
+
description: t.filterEmptyDescription
|
|
17
|
+
} : {
|
|
18
|
+
title: t.emptyTitle,
|
|
19
|
+
description: t.emptyDescription
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function c({ labels: c }) {
|
|
23
|
+
let [l, u] = o(t[0]), [d, f] = o(), { organizationId: p } = e(), [m, h] = o(p);
|
|
24
|
+
p && p !== m && (h(p), f(void 0));
|
|
25
|
+
let g = r({
|
|
26
|
+
limit: l,
|
|
27
|
+
pagination_token: d
|
|
28
|
+
}), _ = a(() => n(g.data?.data ?? [], c), [g.data, c]), v = g.isPlaceholderData ? void 0 : g.data, y = v?.next_pagination_token ?? void 0, b = v?.prev_pagination_token ?? void 0, x = i((e) => {
|
|
29
|
+
u(e), f(void 0);
|
|
30
|
+
}, []), S = i(() => {
|
|
31
|
+
y && f(y);
|
|
32
|
+
}, [y]), C = i(() => {
|
|
33
|
+
b && f(b);
|
|
34
|
+
}, [b]), { refetch: w } = g, T = i(() => {
|
|
35
|
+
w();
|
|
36
|
+
}, [w]);
|
|
37
|
+
return {
|
|
38
|
+
rows: _,
|
|
39
|
+
isLoading: g.isLoading,
|
|
40
|
+
isError: g.isError,
|
|
41
|
+
pageSize: l,
|
|
42
|
+
pageSizeOptions: t,
|
|
43
|
+
onPageSizeChange: x,
|
|
44
|
+
hasNextPage: !!y,
|
|
45
|
+
hasPrevPage: !!b,
|
|
46
|
+
onNextPage: S,
|
|
47
|
+
onPrevPage: C,
|
|
48
|
+
emptyState: s(!1, c),
|
|
49
|
+
onRetry: T
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
export { s as selectEmptyState, c as useApprovalRequestsTable };
|
package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/ui/dist/index2.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region ../../libs/tesouro-embedded-components-react/approval-requests-widget/ui/dist/index2.js
|
|
2
|
+
var e = {
|
|
3
|
+
columnInvoiceNumber: "Invoice #",
|
|
4
|
+
columnIssueDate: "Issue date",
|
|
5
|
+
columnDueDate: "Due date",
|
|
6
|
+
columnStatus: "Status",
|
|
7
|
+
columnAmount: "Amount",
|
|
8
|
+
errorTitle: "Couldn't load approval requests",
|
|
9
|
+
errorDescription: "Try again.",
|
|
10
|
+
errorRetry: "Try again"
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { e as APPROVAL_REQUESTS_SCREEN_LABELS_EN };
|
package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/ui/dist/index3.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Badge as e, DataTable as t } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
+
import { EmptyState as n } from "../../../shared/ui/dist/lib/EmptyState/EmptyState.js";
|
|
3
|
+
import { ErrorState as r } from "../../../shared/ui/dist/lib/ErrorState/ErrorState.js";
|
|
4
|
+
import "../../../shared/ui/dist/index.js";
|
|
5
|
+
import { APPROVAL_REQUESTS_SCREEN_LABELS_EN as i } from "./index2.js";
|
|
6
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
7
|
+
//#region ../../libs/tesouro-embedded-components-react/approval-requests-widget/ui/dist/index3.js
|
|
8
|
+
var o = [], s = () => void 0;
|
|
9
|
+
function c({ rows: c, isLoading: l, isError: u, pageSize: d, onPageSizeChange: f, pageSizeOptions: p, hasNextPage: m, hasPrevPage: h, onNextPage: g, onPrevPage: _, emptyState: v, onRetry: y, labels: b }) {
|
|
10
|
+
let x = {
|
|
11
|
+
...i,
|
|
12
|
+
...b
|
|
13
|
+
}, S = [
|
|
14
|
+
{
|
|
15
|
+
accessorKey: "invoiceNumber",
|
|
16
|
+
header: x.columnInvoiceNumber
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
accessorKey: "issueDate",
|
|
20
|
+
header: x.columnIssueDate
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
accessorKey: "dueDate",
|
|
24
|
+
header: x.columnDueDate
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
accessorKey: "statusLabel",
|
|
28
|
+
header: x.columnStatus,
|
|
29
|
+
cell: ({ row: t }) => /* @__PURE__ */ a(e, {
|
|
30
|
+
tone: t.original.statusTone,
|
|
31
|
+
children: t.original.statusLabel
|
|
32
|
+
})
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
accessorKey: "amount",
|
|
36
|
+
header: () => /* @__PURE__ */ a("div", {
|
|
37
|
+
className: "ttw:text-right",
|
|
38
|
+
children: x.columnAmount
|
|
39
|
+
}),
|
|
40
|
+
cell: ({ row: e }) => /* @__PURE__ */ a("div", {
|
|
41
|
+
className: "ttw:text-right ttw:tabular-nums",
|
|
42
|
+
children: e.original.amount
|
|
43
|
+
})
|
|
44
|
+
}
|
|
45
|
+
];
|
|
46
|
+
return u ? /* @__PURE__ */ a(r, {
|
|
47
|
+
title: x.errorTitle,
|
|
48
|
+
description: x.errorDescription,
|
|
49
|
+
retryLabel: y ? x.errorRetry : void 0,
|
|
50
|
+
onRetry: y
|
|
51
|
+
}) : /* @__PURE__ */ a(t, {
|
|
52
|
+
columns: S,
|
|
53
|
+
data: c,
|
|
54
|
+
isLoading: l,
|
|
55
|
+
sorting: o,
|
|
56
|
+
onSortingChange: s,
|
|
57
|
+
pageSize: d,
|
|
58
|
+
onPageSizeChange: f,
|
|
59
|
+
pageSizeOptions: p,
|
|
60
|
+
hasNextPage: m,
|
|
61
|
+
hasPrevPage: h,
|
|
62
|
+
onNextPage: g,
|
|
63
|
+
onPrevPage: _,
|
|
64
|
+
children: /* @__PURE__ */ a(n, {
|
|
65
|
+
title: v.title,
|
|
66
|
+
description: v.description
|
|
67
|
+
})
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
//#endregion
|
|
71
|
+
export { c as ApprovalRequestsScreen, c as default };
|
package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
|
|
2
|
-
var e = "@tesouro/embedded-components-react", t = "0.9.
|
|
2
|
+
var e = "@tesouro/embedded-components-react", t = "0.9.38", n = "c747cb8a674d8b9420e5f06a290af1a8ac7fd73c", r = Object.freeze({
|
|
3
3
|
library_name: e,
|
|
4
4
|
library_version: t,
|
|
5
5
|
library_sha: n
|