@tesouro/embedded-components-react 0.11.129 → 0.11.131

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 (59) hide show
  1. package/dist/fixtures/index.d.ts +4 -4
  2. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index.js +5 -4
  3. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index21.js +20 -17
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index22.js +14 -37
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index23.js +31 -14
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index24.js +26 -2
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index25.js +2 -0
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index.js +7 -7
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index10.js +35 -12
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index11.js +57 -65
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index12.js +6 -11
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index13.js +20 -8
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index14.js +97 -7
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index15.js +10 -10
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index16.js +10 -29
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index17.js +7 -27
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index18.js +8 -18
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index19.js +24 -139
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index20.js +24 -13
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index21.js +14 -17
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index22.js +130 -27
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index23.js +17 -100
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index24.js +21 -82
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index25.js +41 -3
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index26.js +98 -53
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index27.js +82 -113
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index28.js +3 -193
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index29.js +57 -81
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index30.js +110 -66
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index31.js +190 -111
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index32.js +71 -456
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index33.js +69 -114
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index34.js +113 -8
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index35.js +458 -79
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index36.js +116 -79
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index37.js +10 -256
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index38.js +78 -36
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index39.js +73 -236
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index4.js +1 -1
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index40.js +256 -21
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index41.js +43 -516
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index42.js +245 -4
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index43.js +20 -40
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index44.js +497 -211
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index45.js +3 -2
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index46.js +40 -3
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index47.js +235 -57
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index48.js +2 -0
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index49.js +5 -0
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index50.js +64 -0
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index51.js +1 -0
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index6.js +4 -47
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index7.js +13 -4
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index8.js +8 -13
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index9.js +18 -9
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index3.js +44 -34
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidget/BillsTab.js +1 -1
  58. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  59. package/package.json +1 -1
@@ -1802,7 +1802,7 @@ type FileResponse = {
1802
1802
  url: string;
1803
1803
  };
1804
1804
  /**
1805
- * Represents a file (such as a PDF invoice) that was uploaded to Monite.
1805
+ * Represents a file (such as a PDF invoice) that was uploaded.
1806
1806
  */
1807
1807
  type FileSchema = {
1808
1808
  /**
@@ -1810,7 +1810,7 @@ type FileSchema = {
1810
1810
  */
1811
1811
  id: string;
1812
1812
  /**
1813
- * UTC date and time when this file was uploaded to Monite. Timestamps follow the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
1813
+ * UTC date and time when this file was uploaded. Timestamps follow the [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
1814
1814
  */
1815
1815
  created_at: string;
1816
1816
  /**
@@ -2875,8 +2875,8 @@ type OwnerBusinessDetailsOutput = {
2875
2875
  };
2876
2876
  type OwnerType = 'INDIVIDUAL' | 'BUSINESS';
2877
2877
  /**
2878
- * When a PDF document is uploaded to Monite, it extracts individual pages from the document
2879
- * and saves them as PNG images. This object contains the image and metadata of a single page.
2878
+ * When a PDF document is uploaded, individual pages are extracted from the document
2879
+ * and saved as PNG images. This object contains the image and metadata of a single page.
2880
2880
  */
2881
2881
  type PageSchema = {
2882
2882
  /**
@@ -16,7 +16,8 @@ import { useValidatePayableMutation as _ } from "./index17.js";
16
16
  import "./index18.js";
17
17
  import { usePayablePaymentRecordsQuery as v } from "./index19.js";
18
18
  import { usePayableSuggestionsQuery as y } from "./index20.js";
19
- import { usePayableQuery as b } from "./index22.js";
20
- import { usePayablesByIdsQueries as x } from "./index23.js";
21
- import "./index24.js";
22
- export { i as useAllPayableLineItemsQuery, e as useApprovePayableApprovalRequestMutation, o as useAttachPayableFileMutation, s as useCancelPayableMutation, c as useCancelScheduledPaymentMutation, l as useCreatePayableMutation, u as useDeletePayableFileMutation, d as useDeletePayableMutation, f as useForceApprovePayableMutation, p as useForceRejectPayableMutation, t as usePayableApprovalRequestsQuery, r as usePayableHistoryQuery, v as usePayablePaymentRecordsQuery, b as usePayableQuery, y as usePayableSuggestionsQuery, x as usePayablesByIdsQueries, n as useRejectPayableApprovalRequestMutation, m as useReopenPayableMutation, a as useReplacePayableLineItemsMutation, h as useSubmitPayableForApprovalMutation, g as useUpdatePayableMutation, _ as useValidatePayableMutation };
19
+ import { policyAssignmentDeadline as b, policyAssignmentFirstSeenAt as x } from "./index21.js";
20
+ import { usePayableQuery as S } from "./index23.js";
21
+ import { usePayablesByIdsQueries as C } from "./index24.js";
22
+ import "./index25.js";
23
+ export { b as policyAssignmentDeadline, x as policyAssignmentFirstSeenAt, i as useAllPayableLineItemsQuery, e as useApprovePayableApprovalRequestMutation, o as useAttachPayableFileMutation, s as useCancelPayableMutation, c as useCancelScheduledPaymentMutation, l as useCreatePayableMutation, u as useDeletePayableFileMutation, d as useDeletePayableMutation, f as useForceApprovePayableMutation, p as useForceRejectPayableMutation, t as usePayableApprovalRequestsQuery, r as usePayableHistoryQuery, v as usePayablePaymentRecordsQuery, S as usePayableQuery, y as usePayableSuggestionsQuery, C as usePayablesByIdsQueries, n as useRejectPayableApprovalRequestMutation, m as useReopenPayableMutation, a as useReplacePayableLineItemsMutation, h as useSubmitPayableForApprovalMutation, g as useUpdatePayableMutation, _ as useValidatePayableMutation };
@@ -1,19 +1,22 @@
1
- import { getPayablesIdOptions as e } from "../../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
2
- import { organizationHeaders as t } from "../../../../shared/data-access/dist/lib/organizationHeaders.js";
3
- import "../../../../shared/data-access/dist/index.js";
4
1
  // ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index21.js
5
- var n = 1e3;
6
- function r({ client: r, organizationId: i, payableId: a }) {
7
- return {
8
- ...e({
9
- client: r,
10
- headers: t(i),
11
- path: { payable_id: a }
12
- }),
13
- refetchInterval: (e) => {
14
- let t = e.state.data;
15
- return !t || t.approval_policy_id || t.status !== "approve_in_progress" || !t.updated_at ? !1 : Date.now() - new Date(t.updated_at).getTime() < 1e4 && n;
16
- }
17
- };
2
+ var e = 1e4;
3
+ function t(e) {
4
+ if (e && !e.approval_policy_id && e.status === "approve_in_progress" && e.updated_at) return `${e.id ?? ""}|${e.updated_at}`;
18
5
  }
19
- export { r as payablePolicyAssignmentQueryOptions };
6
+ function n(n, r) {
7
+ if (!t(n) || !n?.updated_at) return;
8
+ let i = new Date(n.updated_at).getTime() + e;
9
+ return r === void 0 ? i : Math.min(i, r + e);
10
+ }
11
+ var r = /* @__PURE__ */ new Map();
12
+ function i(e, n) {
13
+ let i = t(e);
14
+ if (!i) return;
15
+ let a = r.get(i);
16
+ return a !== void 0 || !n ? a : (r.set(i, n), n);
17
+ }
18
+ function a(e) {
19
+ let n = t(e);
20
+ return n ? r.get(n) : void 0;
21
+ }
22
+ export { e as POLICY_ASSIGNMENT_POLL_WINDOW_MS, n as policyAssignmentDeadline, a as policyAssignmentFirstSeenAt, t as policyAssignmentKey, i as recordPolicyAssignmentFirstSeen };
@@ -1,43 +1,20 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
1
  import { getPayablesIdOptions 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";
2
+ import { organizationHeaders as t } from "../../../../shared/data-access/dist/lib/organizationHeaders.js";
9
3
  import "../../../../shared/data-access/dist/index.js";
10
- import { payableOcrQueryOptions as i } from "../../../data-access/dist/lib/payableOcrQueryOptions.js";
11
- import "../../../data-access/dist/invalidation.js";
12
- import { payablePolicyAssignmentQueryOptions as a } from "./index21.js";
13
- import { useQuery as o } from "@tanstack/react-query";
4
+ import { policyAssignmentDeadline as n, recordPolicyAssignmentFirstSeen as r } from "./index21.js";
14
5
  // ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index22.js
15
- function s(s, { enabled: c = !0, pollWhileOcrProcessing: l = !1, pollWhilePolicyAssignmentUnsettled: u = !1 } = {}) {
16
- let { client: d, organizationId: f, widgetToken: p, authEpoch: m, organizationStatus: h } = n(), g = !!(f && p && s) && c, _ = l ? i({
17
- client: d,
18
- organizationId: f,
19
- payableId: s ?? ""
20
- }) : void 0, v = u ? a({
21
- client: d,
22
- organizationId: f,
23
- payableId: s ?? ""
24
- }) : void 0, y = _ ?? v ?? e({
25
- client: d,
26
- headers: r(f),
27
- path: { payable_id: s ?? "" }
28
- }), b = _ && v ? {
29
- ...y,
6
+ var i = 1e3;
7
+ function a({ client: a, organizationId: o, payableId: s }) {
8
+ return {
9
+ ...e({
10
+ client: a,
11
+ headers: t(o),
12
+ path: { payable_id: s }
13
+ }),
30
14
  refetchInterval: (e) => {
31
- let t = [_.refetchInterval(e), v.refetchInterval(e)].filter((e) => e !== !1);
32
- return t.length ? Math.min(...t) : !1;
15
+ let t = n(e.state.data, r(e.state.data, e.state.dataUpdatedAt)), a = t === void 0 ? 0 : t - Date.now();
16
+ return a > 0 && Math.min(i, a);
33
17
  }
34
- } : y;
35
- return o({
36
- ...t(b, {
37
- authEpoch: m,
38
- organizationStatus: h
39
- }),
40
- enabled: g
41
- });
18
+ };
42
19
  }
43
- export { s as usePayableQuery };
20
+ export { a as payablePolicyAssignmentQueryOptions };
@@ -7,20 +7,37 @@ import { withAuthEpoch as t } from "../../../../shared/data-access/dist/lib/with
7
7
  import { useEmbedApi as n } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
8
8
  import { organizationHeaders as r } from "../../../../shared/data-access/dist/lib/organizationHeaders.js";
9
9
  import "../../../../shared/data-access/dist/index.js";
10
- import { useQueries as i } from "@tanstack/react-query";
10
+ import { payableOcrQueryOptions as i } from "../../../data-access/dist/lib/payableOcrQueryOptions.js";
11
+ import "../../../data-access/dist/invalidation.js";
12
+ import { payablePolicyAssignmentQueryOptions as a } from "./index22.js";
13
+ import { useQuery as o } from "@tanstack/react-query";
11
14
  // ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index23.js
12
- function a(a, { enabled: o = !0 } = {}) {
13
- let { client: s, organizationId: c, widgetToken: l, authEpoch: u, organizationStatus: d } = n(), f = !!(c && l) && o, p = r(c);
14
- return i({ queries: a.map((n) => ({
15
- ...t(e({
16
- client: s,
17
- headers: p,
18
- path: { payable_id: n }
19
- }), {
20
- authEpoch: u,
21
- organizationStatus: d
15
+ function s(s, { enabled: c = !0, pollWhileOcrProcessing: l = !1, pollWhilePolicyAssignmentUnsettled: u = !1 } = {}) {
16
+ let { client: d, organizationId: f, widgetToken: p, authEpoch: m, organizationStatus: h } = n(), g = !!(f && p && s) && c, _ = l ? i({
17
+ client: d,
18
+ organizationId: f,
19
+ payableId: s ?? ""
20
+ }) : void 0, v = u ? a({
21
+ client: d,
22
+ organizationId: f,
23
+ payableId: s ?? ""
24
+ }) : void 0, y = _ ?? v ?? e({
25
+ client: d,
26
+ headers: r(f),
27
+ path: { payable_id: s ?? "" }
28
+ }), b = _ && v ? {
29
+ ...y,
30
+ refetchInterval: (e) => {
31
+ let t = [_.refetchInterval(e), v.refetchInterval(e)].filter((e) => e !== !1);
32
+ return t.length ? Math.min(...t) : !1;
33
+ }
34
+ } : y;
35
+ return o({
36
+ ...t(b, {
37
+ authEpoch: m,
38
+ organizationStatus: h
22
39
  }),
23
- enabled: f
24
- })) });
40
+ enabled: g
41
+ });
25
42
  }
26
- export { a as usePayablesByIdsQueries };
43
+ export { s as usePayableQuery };
@@ -1,2 +1,26 @@
1
- import "./index22.js";
2
- import "./index23.js";
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { getPayablesIdOptions 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 { useQueries as i } from "@tanstack/react-query";
11
+ // ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index24.js
12
+ function a(a, { enabled: o = !0 } = {}) {
13
+ let { client: s, organizationId: c, widgetToken: l, authEpoch: u, organizationStatus: d } = n(), f = !!(c && l) && o, p = r(c);
14
+ return i({ queries: a.map((n) => ({
15
+ ...t(e({
16
+ client: s,
17
+ headers: p,
18
+ path: { payable_id: n }
19
+ }), {
20
+ authEpoch: u,
21
+ organizationStatus: d
22
+ }),
23
+ enabled: f
24
+ })) });
25
+ }
26
+ export { a as usePayablesByIdsQueries };
@@ -0,0 +1,2 @@
1
+ import "./index23.js";
2
+ import "./index24.js";
@@ -1,11 +1,11 @@
1
- import "./index23.js";
2
- import "./index28.js";
3
- import "./index37.js";
4
- import "./index39.js";
5
- import "./index41.js";
1
+ import "./index26.js";
2
+ import "./index31.js";
3
+ import "./index40.js";
6
4
  import "./index42.js";
7
- import "./index43.js";
8
5
  import "./index44.js";
9
6
  import "./index45.js";
10
- export { BillDetailsWidget, BillDialogWidget } from "./index47.js";
7
+ import "./index46.js";
8
+ import "./index47.js";
11
9
  import "./index48.js";
10
+ export { BillDetailsWidget, BillDialogWidget } from "./index50.js";
11
+ import "./index51.js";
@@ -1,16 +1,39 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { usePayableHistoryQuery as e } from "../../data-access/dist/index3.js";
6
- import "../../data-access/dist/index.js";
1
+ import { ApprovalPoliciesSettingsDefaultLabels as e } from "../../../../shared/approval-policy/feature/dist/lib/labels.js";
2
+ import { parseApprovalPolicyScript as t } from "../../../../shared/approval-policy/util/dist/lib/policyScript.js";
3
+ import { parseApprovalPolicyTrigger as n } from "../../../../shared/approval-policy/util/dist/lib/policyTrigger.js";
4
+ import { buildPolicySentence as r, buildPolicyTitle as i } from "../../../../shared/approval-policy/feature/dist/lib/policyViewModel.js";
5
+ import "../../../../shared/approval-policy/feature/dist/index.js";
7
6
  // ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index10.js
8
- var t = "submitted_for_approval";
9
- function n({ payableId: n, enabled: r = !0 }) {
10
- let i = e(n, { enabled: r });
7
+ function a({ policy: a, lookup: o, approvedUserIds: s, approvedRoleIds: c, copy: l }) {
8
+ let u = t(a.script);
9
+ if (!u.groups.length || !u.isSupported) return;
10
+ let d = [];
11
+ for (let [e, t] of u.groups.entries()) {
12
+ let n = [];
13
+ for (let e of [...t.roleIds, ...t.userIds]) {
14
+ let t = o.get(e);
15
+ t && n.push({
16
+ id: e,
17
+ label: t.label,
18
+ approved: t.kind === "user" ? s.has(e) : !!c?.has(e)
19
+ });
20
+ }
21
+ n.length && d.push({
22
+ id: `group-${e + 1}`,
23
+ chips: n
24
+ });
25
+ }
26
+ if (!d.length) return;
27
+ let { condition: f, hasKnownAmountBounds: p } = n(a.trigger);
28
+ if (!p) return;
29
+ let m = {
30
+ ...e,
31
+ ...l
32
+ };
11
33
  return {
12
- roundStartedAt: (i.data?.data ?? []).reduce((e, n) => n.event_type === t ? n.timestamp : e, void 0),
13
- isLoading: i.isLoading
34
+ title: i(f, m),
35
+ sentence: r(f, m),
36
+ steps: d
14
37
  };
15
38
  }
16
- export { n as usePayableApprovalRoundStart };
39
+ export { a as buildApprovalPolicyCardView };
@@ -1,68 +1,60 @@
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 { useAllOrganizationRolesQuery as n } from "../../../../shared/data-access/dist/lib/role/useAllOrganizationRolesQuery.js";
8
- import { useAllOrganizationUsersQuery as r } from "../../../../shared/data-access/dist/lib/user/useAllOrganizationUsersQuery.js";
9
- import "../../../../shared/data-access/dist/index.js";
10
- import { useWidgetConfig as i } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
11
- import "../../../../shared/feature/dist/index.js";
12
- import { useGetApprovalPoliciesQuery as a } from "../../../../shared/approval-policy/data-access/dist/lib/approvalPoliciesApi.js";
13
- import "../../../../shared/approval-policy/data-access/dist/index.js";
14
- import { buildApprovalPolicyCardView as o } from "./index6.js";
15
- import { usePayableApprovalRequestsQuery as s } from "../../data-access/dist/index2.js";
16
- import "../../data-access/dist/index.js";
17
- import { currentApprovalRound as c } from "./index7.js";
18
- import { buildPendingApproverGroups as l } from "./index8.js";
19
- import { buildPendingApproverGroupsFromCardView as u } from "./index9.js";
20
- import { usePayableApprovalRoundStart as d } from "./index10.js";
21
- import { useMemo as f } from "react";
1
+ import { APPROVAL_POLICY_RULE_COPY_EN as e } from "./index9.js";
2
+ import { buildApprovalPolicyCardView as t } from "./index10.js";
22
3
  // ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index11.js
23
- function p({ payableId: p, approvalPolicyId: m, enabled: h = !0, copy: g }) {
24
- let _ = h && !!m, { initResponse: v } = i(), y = e(v?.scopes, [t.ApprovalPolicyReadOrg]), b = e(v?.scopes, [t.ApprovalRequestReadOrg]), x = e(v?.scopes, [t.RoleReadOrg]), S = e(v?.scopes, [t.UserReadOrg]), C = a({ enabled: _ && y }), w = n({ enabled: _ && x }), T = r({ enabled: _ && S }), E = s(p, { enabled: _ && b }), { roundStartedAt: D } = d({
25
- payableId: p,
26
- enabled: _ && b
27
- }), O = f(() => {
28
- let e = /* @__PURE__ */ new Map();
29
- for (let t of w.data?.data ?? []) e.set(t.id, {
30
- label: t.name,
31
- kind: "role"
32
- });
33
- for (let t of T.data?.data ?? []) e.set(t.id, {
34
- label: t.name,
35
- kind: "user"
36
- });
37
- return e;
38
- }, [w.data, T.data]), k = f(() => c(E.data?.data, D), [E.data, D]), A = f(() => new Set(k.flatMap((e) => e.approved_by ?? [])), [k]), j = f(() => new Set(k.filter((e) => (e.approved_by ?? []).length > 0).flatMap((e) => e.role_ids ?? [])), [k]), M = f(() => m ? C.data?.data.find((e) => e.id === m) : void 0, [C.data, m]), N = f(() => _ && M ? o({
39
- policy: M,
40
- lookup: O,
41
- approvedUserIds: A,
42
- approvedRoleIds: j,
43
- copy: g
44
- }) : void 0, [
45
- _,
46
- M,
47
- O,
48
- A,
49
- j,
50
- g
51
- ]);
52
- return {
53
- view: N,
54
- pendingApprovers: f(() => _ ? N ? u(N) : l({
55
- requestsNewestFirst: E.data?.data,
56
- roundStartedAt: D,
57
- lookup: O
58
- }) : [], [
59
- _,
60
- N,
61
- E.data,
62
- D,
63
- O
64
- ]),
65
- isLoading: !!m && (!h || C.isResolving || w.isResolving || T.isResolving || E.isLoading || E.isError || !b)
4
+ function n({ approvalPolicyId: n, livePolicies: i, snapshotPolicyName: a, currentRound: o, lookup: s, approvedUserIds: c, approvedRoleIds: l, copy: u }) {
5
+ let d = {
6
+ ...e,
7
+ ...u
8
+ };
9
+ if (!n) return {
10
+ source: "none",
11
+ view: {
12
+ title: d.noRuleTitle,
13
+ sentence: d.noRuleSentence,
14
+ steps: []
15
+ }
16
+ };
17
+ let f = i?.find((e) => e.id === n), p = f ? t({
18
+ policy: f,
19
+ lookup: s,
20
+ approvedUserIds: c,
21
+ approvedRoleIds: l,
22
+ copy: u
23
+ }) : void 0;
24
+ if (p) return {
25
+ source: "live",
26
+ view: p
66
27
  };
28
+ let m = !!i && !f, h = r(o, s), g = h.length ? `${d.deletedNote} ${d.deletedApprovalsNote}` : d.deletedNote;
29
+ if (a || m || h.length) return {
30
+ source: "snapshot",
31
+ view: {
32
+ title: a,
33
+ ...m ? {
34
+ badge: d.deletedBadge,
35
+ note: g
36
+ } : {},
37
+ steps: h
38
+ }
39
+ };
40
+ }
41
+ function r(e, t) {
42
+ let n = [];
43
+ for (let [r, i] of [...e].reverse().entries()) {
44
+ let e = i.approved_by ?? [], a = i.user_ids ?? [], o = e.filter((e) => !a.includes(e)), s = [];
45
+ for (let n of [...i.role_ids ?? [], ...a]) {
46
+ let r = t.get(n);
47
+ r && s.push({
48
+ id: n,
49
+ label: r.label,
50
+ approved: r.kind === "user" ? e.includes(n) : o.length >= (i.required_approval_count ?? 1)
51
+ });
52
+ }
53
+ s.length && n.push({
54
+ id: `request-${r + 1}`,
55
+ chips: s
56
+ });
57
+ }
58
+ return n;
67
59
  }
68
- export { p as useApprovalPolicyCardView };
60
+ export { n as resolveApprovalPolicySection };
@@ -1,13 +1,8 @@
1
+ import { policyAssignmentDeadline as e, policyAssignmentFirstSeenAt as t } from "../../data-access/dist/index21.js";
2
+ import "../../data-access/dist/index.js";
1
3
  // ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index12.js
2
- function e(e) {
3
- return [e.nominal_code, e.name].filter(Boolean).join(" — ");
4
+ function n(n, r) {
5
+ let i = e(n, t(n));
6
+ return i !== void 0 && (r ?? 0) < i;
4
7
  }
5
- function t({ isInitResolved: e, canReadGlCodes: t, isResolving: n, isError: r, optionCount: i, labels: a }) {
6
- let o;
7
- return e ? t ? r ? o = a.loadError : !n && i === 0 && (o = a.empty) : o = a.noAccess : o = void 0, {
8
- unavailableMessage: o,
9
- disabled: !e || !!o || n,
10
- rosterAvailable: t && !n && !r
11
- };
12
- }
13
- export { e as formatGlCodeLabel, t as resolveGlCodeAvailability };
8
+ export { n as isAwaitingPolicyAssignment };
@@ -1,12 +1,24 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { usePayableHistoryQuery as e } from "../../data-access/dist/index3.js";
6
+ import "../../data-access/dist/index.js";
1
7
  // ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index13.js
2
- function e({ isCapabilityUnknown: e, canApproveNow: t, canOverridePolicy: n, status: r, hasApprovalPolicy: i, pendingApproverNames: a, labels: o }) {
3
- if (e) return { showApprovalOverrideNotice: !1 };
4
- if (n) return { showApprovalOverrideNotice: !t };
5
- if (t || r !== "approve_in_progress" || !i) return { showApprovalOverrideNotice: !1 };
6
- let s = [...new Set(a)];
8
+ var t = "submitted_for_approval", n = "approval_requested";
9
+ function r({ payableId: r, enabled: a = !0 }) {
10
+ let o = e(r, { enabled: a }), s, c;
11
+ for (let e of o.data?.data ?? []) e.event_type === t ? s = e.timestamp : e.event_type === n && (c = i(e.event_data));
7
12
  return {
8
- showApprovalOverrideNotice: !1,
9
- awaitingApprovalNotice: s.length ? o.awaitingApprovalNotice(s) : o.awaitingApprovalUnknownNotice
13
+ roundStartedAt: s,
14
+ snapshotPolicyName: c,
15
+ isLoading: o.isLoading,
16
+ isError: o.isError
10
17
  };
11
18
  }
12
- export { e as resolveApprovalNotices };
19
+ function i(e) {
20
+ if (!e || typeof e != "object" || !("approval_policy_name" in e)) return;
21
+ let t = e.approval_policy_name;
22
+ return typeof t == "string" && t ? t : void 0;
23
+ }
24
+ export { r as usePayableApprovalRoundStart };
@@ -1,11 +1,101 @@
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 { useAllOrganizationRolesQuery as n } from "../../../../shared/data-access/dist/lib/role/useAllOrganizationRolesQuery.js";
8
+ import { useAllOrganizationUsersQuery as r } from "../../../../shared/data-access/dist/lib/user/useAllOrganizationUsersQuery.js";
9
+ import "../../../../shared/data-access/dist/index.js";
10
+ import { useWidgetConfig as i } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
11
+ import "../../../../shared/feature/dist/index.js";
12
+ import { useGetApprovalPoliciesQuery as a } from "../../../../shared/approval-policy/data-access/dist/lib/approvalPoliciesApi.js";
13
+ import "../../../../shared/approval-policy/data-access/dist/index.js";
14
+ import { usePayableApprovalRequestsQuery as o } from "../../data-access/dist/index2.js";
15
+ import "../../data-access/dist/index.js";
16
+ import { currentApprovalRound as s } from "./index6.js";
17
+ import { buildPendingApproverGroups as c } from "./index7.js";
18
+ import { buildPendingApproverGroupsFromCardView as l } from "./index8.js";
19
+ import { resolveApprovalPolicySection as u } from "./index11.js";
20
+ import { isAwaitingPolicyAssignment as d } from "./index12.js";
21
+ import { usePayableApprovalRoundStart as f } from "./index13.js";
22
+ import { useMemo as p } from "react";
1
23
  // ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index14.js
2
- function e(e, t) {
3
- if (!e) return;
4
- let { onOpen: n, canEditExisting: r, ...i } = e;
24
+ var m = /* @__PURE__ */ new Set([
25
+ "approve_in_progress",
26
+ "waiting_to_be_paid",
27
+ "partially_paid",
28
+ "paid",
29
+ "rejected"
30
+ ]);
31
+ function h({ payableId: h, approvalPolicyId: g, status: _, updatedAt: v, payableFetchedAt: y, enabled: b = !0, copy: x }) {
32
+ let S = !!g, C = b && S, { initResponse: w } = i(), T = e(w?.scopes, [t.ApprovalPolicyReadOrg]), E = e(w?.scopes, [t.ApprovalRequestReadOrg]), D = e(w?.scopes, [t.RoleReadOrg]), O = e(w?.scopes, [t.UserReadOrg]), k = a({ enabled: C && T }), A = n({ enabled: C && D }), j = r({ enabled: C && O }), M = o(h, { enabled: C && E }), { roundStartedAt: N, snapshotPolicyName: P, isLoading: F, isError: I } = f({
33
+ payableId: h,
34
+ enabled: b
35
+ }), L = d({
36
+ id: h,
37
+ status: _,
38
+ approval_policy_id: g,
39
+ updated_at: v
40
+ }, y), R = !!N || I && m.has(_ ?? ""), z = p(() => {
41
+ let e = /* @__PURE__ */ new Map();
42
+ for (let t of A.data?.data ?? []) e.set(t.id, {
43
+ label: t.name,
44
+ kind: "role"
45
+ });
46
+ for (let t of j.data?.data ?? []) e.set(t.id, {
47
+ label: t.name,
48
+ kind: "user"
49
+ });
50
+ return e;
51
+ }, [A.data, j.data]), B = p(() => s(M.data?.data, N), [M.data, N]), V = p(() => new Set(B.flatMap((e) => e.approved_by ?? [])), [B]), H = p(() => new Set(B.filter((e) => (e.approved_by ?? []).some((t) => !(e.user_ids ?? []).includes(t))).flatMap((e) => e.role_ids ?? [])), [B]), U = T && !k.isResolving && !k.isError ? k.data?.data : void 0, W = U && (!k.isFetching || U.some((e) => e.id === g)) ? U : void 0, G = p(() => {
52
+ if (b && !F && (S || R) && !L && !(S && (T && k.isResolving || D && A.isResolving || O && j.isResolving || E && M.isLoading))) return u({
53
+ approvalPolicyId: g,
54
+ livePolicies: W,
55
+ snapshotPolicyName: P,
56
+ currentRound: B,
57
+ lookup: z,
58
+ approvedUserIds: V,
59
+ approvedRoleIds: H,
60
+ copy: x
61
+ });
62
+ }, [
63
+ b,
64
+ F,
65
+ S,
66
+ R,
67
+ L,
68
+ T,
69
+ k.isResolving,
70
+ D,
71
+ A.isResolving,
72
+ O,
73
+ j.isResolving,
74
+ E,
75
+ M.isLoading,
76
+ g,
77
+ W,
78
+ P,
79
+ B,
80
+ z,
81
+ V,
82
+ H,
83
+ x
84
+ ]), K = p(() => C ? G?.source === "live" ? l(G.view) : c({
85
+ requestsNewestFirst: M.data?.data,
86
+ roundStartedAt: N,
87
+ lookup: z
88
+ }) : [], [
89
+ C,
90
+ G,
91
+ M.data,
92
+ N,
93
+ z
94
+ ]);
5
95
  return {
6
- ...i,
7
- onEditExisting: t && r ? n : void 0,
8
- onAdd: t ? void 0 : n
96
+ view: G?.view,
97
+ pendingApprovers: K,
98
+ isLoading: !!g && (!b || k.isResolving || A.isResolving || j.isResolving || M.isLoading || M.isError || !E)
9
99
  };
10
100
  }
11
- export { e as resolvePaymentInstructionsGestures };
101
+ export { h as useApprovalPolicyCardView };
@@ -1,13 +1,13 @@
1
- import { formatRejectionDate as e } from "../../../../shared/util/dist/lib/formatRejectionDate.js";
2
- import "../../../../shared/util/dist/index.js";
3
1
  // ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index15.js
4
- function t({ payableStatus: t, approvalRequests: n, userNames: r, payableUpdatedAt: i, labels: a, now: o }) {
5
- let s = n.find((e) => e.status === "rejected");
6
- if (!s) return t !== "rejected" || !i ? void 0 : { actorLabel: a.rejectedOn(e(i, o)) };
7
- let c = s.rejected_by ? r.get(s.rejected_by) : void 0, l = e(s.updated_at, o);
8
- return {
9
- actorLabel: c ? a.rejectedByOn(c, l) : a.rejectedOn(l),
10
- message: s.reject_reason ? a.rejectionMessage(s.reject_reason) : void 0
2
+ function e(e) {
3
+ return [e.nominal_code, e.name].filter(Boolean).join(" — ");
4
+ }
5
+ function t({ isInitResolved: e, canReadGlCodes: t, isResolving: n, isError: r, optionCount: i, labels: a }) {
6
+ let o;
7
+ return e ? t ? r ? o = a.loadError : !n && i === 0 && (o = a.empty) : o = a.noAccess : o = void 0, {
8
+ unavailableMessage: o,
9
+ disabled: !e || !!o || n,
10
+ rosterAvailable: t && !n && !r
11
11
  };
12
12
  }
13
- export { t as resolveBillRejectionNotice };
13
+ export { e as formatGlCodeLabel, t as resolveGlCodeAvailability };