@tesouro/embedded-components-react 0.9.38 → 0.9.40

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 (14) hide show
  1. package/dist/experimental/ApprovalRequests.d.ts +8 -0
  2. package/dist/experimental/index.d.ts +8 -0
  3. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/data-access/dist/index.js +2 -1
  4. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/data-access/dist/index7.js +31 -0
  5. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/ApprovalRequestsWidget/ApprovalRequestsWidget.js +40 -35
  6. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/ApprovalRequestsWidget/buildApprovalRequestRows.js +24 -11
  7. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/ApprovalRequestsWidget/labels.js +1 -0
  8. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/ApprovalRequestsWidget/permissions.js +9 -0
  9. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/ApprovalRequestsWidget/useApprovalRequestNames.js +66 -0
  10. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/ApprovalRequestsWidget/useApprovalRequestsTable.js +37 -31
  11. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/ui/dist/index2.js +6 -1
  12. package/dist/libs/tesouro-embedded-components-react/approval-requests-widget/ui/dist/index3.js +69 -41
  13. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  14. package/package.json +1 -1
@@ -600,13 +600,19 @@ interface WidgetProviderProps extends WidgetProviderBaseProps {
600
600
 
601
601
  interface ApprovalRequestsScreenLabels {
602
602
  columnInvoiceNumber: string;
603
+ columnVendor: string;
603
604
  columnIssueDate: string;
604
605
  columnDueDate: string;
605
606
  columnStatus: string;
606
607
  columnAmount: string;
608
+ columnAddedBy: string;
609
+ /** Read by screen readers in a cell whose name is still loading. */
610
+ loadingValue: string;
607
611
  errorTitle: string;
608
612
  errorDescription: string;
609
613
  errorRetry: string;
614
+ accessRestrictedTitle: string;
615
+ accessRestrictedDescription: string;
610
616
  }
611
617
 
612
618
  interface ApprovalRequestsListLabels {
@@ -616,6 +622,8 @@ interface ApprovalRequestsListLabels {
616
622
  filterEmptyDescription: string;
617
623
  /** Shown in a cell whose value the request's payable does not carry. */
618
624
  missingValue: string;
625
+ /** Shown for a vendor or creator this session may not read, or whose lookup failed. */
626
+ unavailableValue: string;
619
627
  status: Record<ApprovalRequestStatus, string>;
620
628
  }
621
629
 
@@ -600,13 +600,19 @@ interface WidgetProviderProps extends WidgetProviderBaseProps {
600
600
 
601
601
  interface ApprovalRequestsScreenLabels {
602
602
  columnInvoiceNumber: string;
603
+ columnVendor: string;
603
604
  columnIssueDate: string;
604
605
  columnDueDate: string;
605
606
  columnStatus: string;
606
607
  columnAmount: string;
608
+ columnAddedBy: string;
609
+ /** Read by screen readers in a cell whose name is still loading. */
610
+ loadingValue: string;
607
611
  errorTitle: string;
608
612
  errorDescription: string;
609
613
  errorRetry: string;
614
+ accessRestrictedTitle: string;
615
+ accessRestrictedDescription: string;
610
616
  }
611
617
 
612
618
  interface ApprovalRequestsListLabels {
@@ -616,6 +622,8 @@ interface ApprovalRequestsListLabels {
616
622
  filterEmptyDescription: string;
617
623
  /** Shown in a cell whose value the request's payable does not carry. */
618
624
  missingValue: string;
625
+ /** Shown for a vendor or creator this session may not read, or whose lookup failed. */
626
+ unavailableValue: string;
619
627
  status: Record<ApprovalRequestStatus, string>;
620
628
  }
621
629
 
@@ -5,4 +5,5 @@ import { useApprovalRequestsQuery as e } from "./index3.js";
5
5
  import "./index4.js";
6
6
  import "./index5.js";
7
7
  import "./index6.js";
8
- export { e as useApprovalRequestsQuery };
8
+ import { useEntityUsersByIdsQuery as t } from "./index7.js";
9
+ export { e as useApprovalRequestsQuery, t as useEntityUsersByIdsQuery };
@@ -0,0 +1,31 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { getEntityUsersOptions as e } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
6
+ import { withAuthEpoch as t } from "../../../shared/data-access/dist/lib/withAuthEpoch.js";
7
+ import { useEmbedApi as n } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
8
+ import { organizationHeaders as r } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
9
+ import "../../../shared/data-access/dist/index.js";
10
+ import { useMemo as i } from "react";
11
+ import { useQuery as a } from "@tanstack/react-query";
12
+ //#region ../../libs/tesouro-embedded-components-react/approval-requests-widget/data-access/dist/index7.js
13
+ function o({ ids: o, enabled: s }) {
14
+ let { client: c, organizationId: l, widgetToken: u, authEpoch: d, organizationStatus: f } = n(), p = i(() => [...new Set(o.filter(Boolean))].sort().slice(0, 100), [o]), m = e({
15
+ client: c,
16
+ headers: r(l),
17
+ query: {
18
+ id__in: p,
19
+ limit: 100
20
+ }
21
+ });
22
+ return a({
23
+ ...t(m, {
24
+ authEpoch: d,
25
+ organizationStatus: f
26
+ }, { carryWithinOrg: !0 }),
27
+ enabled: !!(l && u) && (s === !0 || s === void 0) && p.length > 0
28
+ });
29
+ }
30
+ //#endregion
31
+ export { o as useEntityUsersByIdsQuery };
@@ -7,54 +7,59 @@ import { useEmbedApi as t } from "../../../../../shared/data-access/dist/lib/Emb
7
7
  import "../../../../../shared/data-access/dist/index.js";
8
8
  import { useAnalyticsTrack as n } from "../../../../../shared/feature/dist/lib/analytics/hooks.js";
9
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";
10
+ import { useRefetchWidget as i, useWidgetConfig as a, useWidgetError as o, useWidgetInitStaleForToken as s, useWidgetLoading as c } from "../../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
11
11
  import "../../../../../shared/feature/dist/index.js";
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";
12
+ import { ApprovalRequestsWidgetAnalyticsEvent as l, WIDGET_NAME as u } from "../analytics/events.js";
13
+ import { APPROVAL_REQUESTS_LIST_LABELS_EN as d } from "./labels.js";
14
+ import { getApprovalRequestPermissions as f } from "./permissions.js";
15
+ import { useApprovalRequestsTable as p } from "./useApprovalRequestsTable.js";
16
+ import { ApprovalRequestsScreen as m } from "../../../../ui/dist/index3.js";
16
17
  import "../../../../ui/dist/index.js";
17
- import { useEffect as p, useMemo as m } from "react";
18
- import { jsx as h } from "react/jsx-runtime";
18
+ import { useEffect as h, useMemo as g } from "react";
19
+ import { jsx as _ } from "react/jsx-runtime";
19
20
  //#region ../../libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/ApprovalRequestsWidget/ApprovalRequestsWidget.js
20
- function g({ screenLabels: r, listLabels: l }) {
21
- let g = n();
22
- p(() => {
23
- g(c.Mounted);
24
- }, [g]);
25
- let _ = m(() => ({
21
+ function v({ screenLabels: r, listLabels: u }) {
22
+ let v = n();
23
+ h(() => {
24
+ v(l.Mounted);
25
+ }, [v]);
26
+ let y = g(() => ({
27
+ ...d,
26
28
  ...u,
27
- ...l,
28
29
  status: {
29
- ...u.status,
30
- ...l?.status
30
+ ...d.status,
31
+ ...u?.status
31
32
  }
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,
33
+ }), [u]), { initResponse: b, widgetToken: x } = a(), S = c(), C = o(), w = s(), T = i(), { organizationStatus: E } = t(), D = g(() => f(w ? void 0 : b?.scopes), [w, b?.scopes]), O = !(!x || b || C) || S && !b || w, k = !!C && (!b || w), A = p({
34
+ labels: y,
35
+ enabled: D.canRead
36
+ });
37
+ return /* @__PURE__ */ _(m, {
38
+ rows: A.rows,
39
+ isLoading: A.isLoading || (O || e(E)) && A.rows.length === 0,
40
+ isError: k || A.isError,
41
+ isAccessRestricted: !O && !k && !D.canRead,
42
+ pageSize: A.pageSize,
43
+ onPageSizeChange: A.onPageSizeChange,
44
+ pageSizeOptions: A.pageSizeOptions,
45
+ hasNextPage: A.hasNextPage,
46
+ hasPrevPage: A.hasPrevPage,
47
+ onNextPage: A.onNextPage,
48
+ onPrevPage: A.onPrevPage,
49
+ emptyState: A.emptyState,
50
+ onRetry: k ? T : A.onRetry,
46
51
  labels: r
47
52
  });
48
53
  }
49
- function _({ screenLabels: e, listLabels: t, ...n }) {
50
- return /* @__PURE__ */ h(r, {
54
+ function y({ screenLabels: e, listLabels: t, ...n }) {
55
+ return /* @__PURE__ */ _(r, {
51
56
  ...n,
52
- widgetName: l,
53
- children: /* @__PURE__ */ h(g, {
57
+ widgetName: u,
58
+ children: /* @__PURE__ */ _(v, {
54
59
  screenLabels: e,
55
60
  listLabels: t
56
61
  })
57
62
  });
58
63
  }
59
64
  //#endregion
60
- export { _ as ApprovalRequestsWidget, _ as default };
65
+ export { y as ApprovalRequestsWidget, y as default };
@@ -2,28 +2,41 @@ import { createCurrencyFormatter as e } from "../../../../../shared/util/dist/li
2
2
  import { formatCalendarDate as t } from "../../../../../shared/util/dist/lib/formatCalendarDate.js";
3
3
  import "../../../../../shared/util/dist/index.js";
4
4
  import { STATUS_TONE as n } from "./constants.js";
5
+ import { NameLookupState as r } from "./useApprovalRequestNames.js";
5
6
  //#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) {
7
+ var i = { day: "2-digit" };
8
+ function a(t, n) {
8
9
  let r = new Intl.NumberFormat("en-US", {
9
10
  style: "currency",
10
11
  currency: n
11
12
  }).resolvedOptions().maximumFractionDigits ?? 2;
12
13
  return e(n).format(t / 10 ** r);
13
14
  }
14
- function a(e, a) {
15
- return e.map(({ request: e, payable: o }) => {
16
- let s = o?.amount_to_pay, c = o?.currency;
15
+ function o(e, t, n) {
16
+ if (!e) return n.missingValue;
17
+ let i = t.names.get(e);
18
+ if (i) return i;
19
+ switch (t.state) {
20
+ case r.Resolving: return;
21
+ case r.Unavailable: return n.unavailableValue;
22
+ case r.Settled: return n.missingValue;
23
+ }
24
+ }
25
+ function s(e, r, s) {
26
+ return e.map(({ request: e, payable: c }) => {
27
+ let l = c?.amount_to_pay, u = c?.currency;
17
28
  return {
18
29
  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],
30
+ invoiceNumber: c?.document_id || s.missingValue,
31
+ vendor: o(c?.counterpart_id, r.vendors, s),
32
+ issueDate: t(c?.issued_at, i) || s.missingValue,
33
+ dueDate: t(c?.due_date, i) || s.missingValue,
34
+ statusLabel: s.status[e.status],
23
35
  statusTone: n[e.status],
24
- amount: typeof s == "number" && c ? i(s, c) : a.missingValue
36
+ amount: typeof l == "number" && u ? a(l, u) : s.missingValue,
37
+ addedBy: o(e.created_by, r.users, s)
25
38
  };
26
39
  });
27
40
  }
28
41
  //#endregion
29
- export { a as buildApprovalRequestRows };
42
+ export { s as buildApprovalRequestRows };
@@ -5,6 +5,7 @@ var e = {
5
5
  filterEmptyTitle: "No approval requests found",
6
6
  filterEmptyDescription: "Try adjusting your filter criteria.",
7
7
  missingValue: "—",
8
+ unavailableValue: "Unavailable",
8
9
  status: {
9
10
  waiting: "In approval",
10
11
  approved: "Approved",
@@ -0,0 +1,9 @@
1
+ import { Scope as e } from "../../../../../shared/data-access/dist/lib/scopes.js";
2
+ import "../../../../../shared/data-access/dist/index.js";
3
+ //#region ../../libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/ApprovalRequestsWidget/permissions.js
4
+ function t(t) {
5
+ let n = new Set(t ?? []);
6
+ return { canRead: n.has(e.ApprovalRequestReadOrg) && n.has(e.PayableReadOrg) };
7
+ }
8
+ //#endregion
9
+ export { t as getApprovalRequestPermissions };
@@ -0,0 +1,66 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { hasAnyScope as e } from "../../../../../shared/data-access/dist/lib/hasAnyScope.js";
6
+ import { Scope as t } from "../../../../../shared/data-access/dist/lib/scopes.js";
7
+ import "../../../../../shared/data-access/dist/index.js";
8
+ import { useWidgetConfig as n, useWidgetInitStaleForToken as r } from "../../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
9
+ import "../../../../../shared/feature/dist/index.js";
10
+ import { getCounterpartName as i } from "../../../../../shared/counterpart-management/feature/dist/lib/helpers.js";
11
+ import { useCounterpartsByIdsQuery as a } from "../../../../../shared/counterpart-management/data-access/dist/index3.js";
12
+ import "../../../../../shared/counterpart-management/feature/dist/index.js";
13
+ import { useEntityUsersByIdsQuery as o } from "../../../../data-access/dist/index7.js";
14
+ import "../../../../data-access/dist/index.js";
15
+ import { useMemo as s } from "react";
16
+ //#region ../../libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/ApprovalRequestsWidget/useApprovalRequestNames.js
17
+ var c = {
18
+ Resolving: "resolving",
19
+ Unavailable: "unavailable",
20
+ Settled: "settled"
21
+ }, l = /* @__PURE__ */ new Map();
22
+ function u(e, t) {
23
+ let n = /* @__PURE__ */ new Map();
24
+ for (let r of e ?? []) {
25
+ let e = t(r);
26
+ e && n.set(r.id, e);
27
+ }
28
+ return n;
29
+ }
30
+ function d({ isInitResolved: e, canRead: t, isPaused: n }, { isFetching: r, isError: i }) {
31
+ return !e || n ? c.Resolving : t ? r ? c.Resolving : i ? c.Unavailable : c.Settled : c.Unavailable;
32
+ }
33
+ function f({ items: c }) {
34
+ let { initResponse: f } = n(), p = r(), m = !!f, h = e(f?.scopes, [t.CounterpartReadOrg]), g = e(f?.scopes, [t.UserReadOrg]), _ = s(() => c.map(({ payable: e }) => e?.counterpart_id).filter((e) => !!e), [c]), v = s(() => c.map(({ request: e }) => e.created_by).filter((e) => !!e), [c]), y = a({
35
+ counterpartIds: _,
36
+ enabled: h && !p
37
+ }), b = o({
38
+ ids: v,
39
+ enabled: g && !p
40
+ }), x = m && !h && !p, S = m && !g && !p, C = s(() => x ? l : u(y.data?.data, i), [y.data, x]), w = s(() => S ? l : u(b.data?.data, (e) => `${e.first_name ?? ""} ${e.last_name ?? ""}`.trim()), [b.data, S]), T = d({
41
+ isInitResolved: m,
42
+ canRead: h,
43
+ isPaused: p
44
+ }, y), E = d({
45
+ isInitResolved: m,
46
+ canRead: g,
47
+ isPaused: p
48
+ }, b);
49
+ return s(() => ({
50
+ vendors: {
51
+ names: C,
52
+ state: T
53
+ },
54
+ users: {
55
+ names: w,
56
+ state: E
57
+ }
58
+ }), [
59
+ C,
60
+ T,
61
+ w,
62
+ E
63
+ ]);
64
+ }
65
+ //#endregion
66
+ export { c as NameLookupState, f as useApprovalRequestNames };
@@ -5,12 +5,13 @@
5
5
  import { useEmbedApi as e } from "../../../../../shared/data-access/dist/lib/EmbedApiContext.js";
6
6
  import "../../../../../shared/data-access/dist/index.js";
7
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";
8
+ import { useApprovalRequestsQuery as n } from "../../../../data-access/dist/index3.js";
10
9
  import "../../../../data-access/dist/index.js";
11
- import { useCallback as i, useMemo as a, useState as o } from "react";
10
+ import { useApprovalRequestNames as r } from "./useApprovalRequestNames.js";
11
+ import { buildApprovalRequestRows as i } from "./buildApprovalRequestRows.js";
12
+ import { useCallback as a, useMemo as o, useState as s } from "react";
12
13
  //#region ../../libs/tesouro-embedded-components-react/approval-requests-widget/feature/dist/lib/ApprovalRequestsWidget/useApprovalRequestsTable.js
13
- function s(e, t) {
14
+ function c(e, t) {
14
15
  return e ? {
15
16
  title: t.filterEmptyTitle,
16
17
  description: t.filterEmptyDescription
@@ -19,35 +20,40 @@ function s(e, t) {
19
20
  description: t.emptyDescription
20
21
  };
21
22
  }
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]);
23
+ function l({ labels: l, enabled: u = !0 }) {
24
+ let [d, f] = s(t[0]), [p, m] = s(), { organizationId: h } = e(), [g, _] = s(h);
25
+ h && h !== g && (_(h), m(void 0));
26
+ let v = n({
27
+ limit: d,
28
+ pagination_token: p,
29
+ enabled: u
30
+ }), y = o(() => v.data?.data ?? [], [v.data]), b = r({ items: y }), x = o(() => i(y, b, l), [
31
+ y,
32
+ b,
33
+ l
34
+ ]), S = v.isPlaceholderData ? void 0 : v.data, C = S?.next_pagination_token ?? void 0, w = S?.prev_pagination_token ?? void 0, T = a((e) => {
35
+ f(e), m(void 0);
36
+ }, []), E = a(() => {
37
+ C && m(C);
38
+ }, [C]), D = a(() => {
39
+ w && m(w);
40
+ }, [w]), { refetch: O } = v, k = a(() => {
41
+ O();
42
+ }, [O]);
37
43
  return {
38
- rows: _,
39
- isLoading: g.isLoading,
40
- isError: g.isError,
41
- pageSize: l,
44
+ rows: x,
45
+ isLoading: v.isLoading,
46
+ isError: v.isError,
47
+ pageSize: d,
42
48
  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
49
+ onPageSizeChange: T,
50
+ hasNextPage: !!C,
51
+ hasPrevPage: !!w,
52
+ onNextPage: E,
53
+ onPrevPage: D,
54
+ emptyState: c(!1, l),
55
+ onRetry: k
50
56
  };
51
57
  }
52
58
  //#endregion
53
- export { s as selectEmptyState, c as useApprovalRequestsTable };
59
+ export { c as selectEmptyState, l as useApprovalRequestsTable };
@@ -1,13 +1,18 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/approval-requests-widget/ui/dist/index2.js
2
2
  var e = {
3
3
  columnInvoiceNumber: "Invoice #",
4
+ columnVendor: "Vendor",
4
5
  columnIssueDate: "Issue date",
5
6
  columnDueDate: "Due date",
6
7
  columnStatus: "Status",
7
8
  columnAmount: "Amount",
9
+ columnAddedBy: "Added by",
10
+ loadingValue: "Loading",
8
11
  errorTitle: "Couldn't load approval requests",
9
12
  errorDescription: "Try again.",
10
- errorRetry: "Try again"
13
+ errorRetry: "Try again",
14
+ accessRestrictedTitle: "Access restricted",
15
+ accessRestrictedDescription: "You don't have permission to view approval requests."
11
16
  };
12
17
  //#endregion
13
18
  export { e as APPROVAL_REQUESTS_SCREEN_LABELS_EN };
@@ -1,71 +1,99 @@
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";
1
+ import { Badge as e, DataTable as t, Skeleton as n } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { EmptyState as r } from "../../../shared/ui/dist/lib/EmptyState/EmptyState.js";
3
+ import { ErrorState as i } from "../../../shared/ui/dist/lib/ErrorState/ErrorState.js";
4
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";
5
+ import { APPROVAL_REQUESTS_SCREEN_LABELS_EN as a } from "./index2.js";
6
+ import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
7
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 = [
8
+ var l = [], u = () => void 0;
9
+ function d({ name: e, loadingLabel: t }) {
10
+ return e === void 0 ? /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s(n, {
11
+ className: "ttw:h-4 ttw:w-32",
12
+ "aria-hidden": !0
13
+ }), /* @__PURE__ */ s("span", {
14
+ className: "ttw:sr-only",
15
+ children: t
16
+ })] }) : /* @__PURE__ */ s(o, { children: e });
17
+ }
18
+ function f({ rows: n, isLoading: o, isError: c, isAccessRestricted: f, pageSize: p, onPageSizeChange: m, pageSizeOptions: h, hasNextPage: g, hasPrevPage: _, onNextPage: v, onPrevPage: y, emptyState: b, onRetry: x, labels: S }) {
19
+ let C = {
20
+ ...a,
21
+ ...S
22
+ }, w = [
14
23
  {
15
24
  accessorKey: "invoiceNumber",
16
- header: x.columnInvoiceNumber
25
+ header: C.columnInvoiceNumber
26
+ },
27
+ {
28
+ accessorKey: "vendor",
29
+ header: C.columnVendor,
30
+ cell: ({ row: e }) => /* @__PURE__ */ s(d, {
31
+ name: e.original.vendor,
32
+ loadingLabel: C.loadingValue
33
+ })
17
34
  },
18
35
  {
19
36
  accessorKey: "issueDate",
20
- header: x.columnIssueDate
37
+ header: C.columnIssueDate
21
38
  },
22
39
  {
23
40
  accessorKey: "dueDate",
24
- header: x.columnDueDate
41
+ header: C.columnDueDate
25
42
  },
26
43
  {
27
44
  accessorKey: "statusLabel",
28
- header: x.columnStatus,
29
- cell: ({ row: t }) => /* @__PURE__ */ a(e, {
45
+ header: C.columnStatus,
46
+ cell: ({ row: t }) => /* @__PURE__ */ s(e, {
30
47
  tone: t.original.statusTone,
31
48
  children: t.original.statusLabel
32
49
  })
33
50
  },
34
51
  {
35
52
  accessorKey: "amount",
36
- header: () => /* @__PURE__ */ a("div", {
53
+ header: () => /* @__PURE__ */ s("div", {
37
54
  className: "ttw:text-right",
38
- children: x.columnAmount
55
+ children: C.columnAmount
39
56
  }),
40
- cell: ({ row: e }) => /* @__PURE__ */ a("div", {
57
+ cell: ({ row: e }) => /* @__PURE__ */ s("div", {
41
58
  className: "ttw:text-right ttw:tabular-nums",
42
59
  children: e.original.amount
43
60
  })
61
+ },
62
+ {
63
+ accessorKey: "addedBy",
64
+ header: C.columnAddedBy,
65
+ cell: ({ row: e }) => /* @__PURE__ */ s(d, {
66
+ name: e.original.addedBy,
67
+ loadingLabel: C.loadingValue
68
+ })
44
69
  }
45
70
  ];
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
71
+ return f ? /* @__PURE__ */ s(i, {
72
+ title: C.accessRestrictedTitle,
73
+ description: C.accessRestrictedDescription
74
+ }) : c ? /* @__PURE__ */ s(i, {
75
+ title: C.errorTitle,
76
+ description: C.errorDescription,
77
+ retryLabel: x ? C.errorRetry : void 0,
78
+ onRetry: x
79
+ }) : /* @__PURE__ */ s(t, {
80
+ columns: w,
81
+ data: n,
82
+ isLoading: o,
83
+ sorting: l,
84
+ onSortingChange: u,
85
+ pageSize: p,
86
+ onPageSizeChange: m,
87
+ pageSizeOptions: h,
88
+ hasNextPage: g,
89
+ hasPrevPage: _,
90
+ onNextPage: v,
91
+ onPrevPage: y,
92
+ children: /* @__PURE__ */ s(r, {
93
+ title: b.title,
94
+ description: b.description
67
95
  })
68
96
  });
69
97
  }
70
98
  //#endregion
71
- export { c as ApprovalRequestsScreen, c as default };
99
+ export { f as ApprovalRequestsScreen, f as default };
@@ -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.38", n = "c747cb8a674d8b9420e5f06a290af1a8ac7fd73c", r = Object.freeze({
2
+ var e = "@tesouro/embedded-components-react", t = "0.9.40", n = "f9977fa659d9b5a376c67729dd2762d7e065f98c", r = Object.freeze({
3
3
  library_name: e,
4
4
  library_version: t,
5
5
  library_sha: n
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tesouro/embedded-components-react",
3
- "version": "0.9.38",
3
+ "version": "0.9.40",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": [