@tesouro/embedded-components-react 0.11.176 → 0.11.180

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 (83) hide show
  1. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index.js +24 -23
  2. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index10.js +16 -18
  3. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index11.js +3 -3
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index12.js +5 -7
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index13.js +2 -2
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index14.js +4 -3
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index15.js +13 -27
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index16.js +34 -19
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index17.js +23 -16
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index18.js +26 -12
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index19.js +12 -57
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index2.js +34 -85
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index20.js +48 -29
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index21.js +36 -20
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index22.js +20 -18
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index23.js +14 -37
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index24.js +31 -14
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index25.js +26 -2
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index26.js +2 -0
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index3.js +90 -20
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index4.js +30 -8
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index5.js +8 -74
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index6.js +60 -19
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index7.js +6 -5
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index8.js +12 -17
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index9.js +20 -12
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index.js +7 -7
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index10.js +17 -36
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index11.js +42 -54
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index12.js +89 -6
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index13.js +5 -21
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index14.js +15 -92
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index15.js +103 -10
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index16.js +10 -9
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index17.js +8 -7
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index18.js +7 -9
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index19.js +11 -29
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index20.js +24 -24
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index21.js +22 -14
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index22.js +14 -137
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index23.js +139 -13
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index24.js +12 -18
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index25.js +15 -32
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index26.js +39 -108
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index27.js +96 -80
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index28.js +94 -3
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index29.js +4 -57
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index30.js +56 -116
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index31.js +114 -197
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index32.js +194 -75
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index33.js +75 -67
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index34.js +69 -111
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index35.js +108 -459
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index36.js +450 -102
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index37.js +117 -9
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index38.js +8 -85
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index39.js +73 -67
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index4.js +1 -1
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index40.js +71 -246
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index41.js +251 -40
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index42.js +38 -237
  62. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index43.js +244 -21
  63. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index44.js +21 -529
  64. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index45.js +530 -4
  65. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index46.js +4 -44
  66. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index47.js +41 -242
  67. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index48.js +245 -3
  68. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index49.js +3 -5
  69. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index50.js +4 -63
  70. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index51.js +64 -1
  71. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index52.js +1 -0
  72. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index9.js +6 -18
  73. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index3.js +7 -3
  74. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/lib/invalidatePayableQueries/approvalDecisionQueries.js +22 -19
  75. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/lib/invalidatePayableQueries/invalidatePayableQueries.js +20 -20
  76. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/lib/queryKeys.js +32 -21
  77. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidget/BillsTab.js +1 -1
  78. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/index.js +4 -4
  79. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +42 -42
  80. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +237 -215
  81. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +151 -135
  82. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  83. package/package.json +1 -1
@@ -2,34 +2,75 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { postPayablesIdAttachFile as e } from "../../../../shared/data-access/dist/lib/rest/sdk.gen.js";
6
- import { useEmbedApi as t } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
7
- import { organizationHeaders as n } from "../../../../shared/data-access/dist/lib/organizationHeaders.js";
5
+ import { getPayablesIdLineItems as e, putPayablesIdLineItems as t } from "../../../../shared/data-access/dist/lib/rest/sdk.gen.js";
6
+ import { getPayablesIdLineItemsOptions as n } from "../../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
7
+ import { withAuthEpochInfinite 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 { getAllPagesNextPaginationTokenParam as o, isAllPagesResolving as s, useAutoFetchNextPage as c } from "../../../../shared/data-access/dist/lib/allPages.js";
8
11
  import "../../../../shared/data-access/dist/index.js";
9
- import { invalidatePayableQueries as r } from "../../../data-access/dist/lib/invalidatePayableQueries/invalidatePayableQueries.js";
12
+ import { invalidatePayableQueries as l } from "../../../data-access/dist/lib/invalidatePayableQueries/invalidatePayableQueries.js";
10
13
  import "../../../data-access/dist/invalidation.js";
11
- import { useMutation as i } from "@tanstack/react-query";
14
+ import { dataOrThrowWithStatus as u } from "./index5.js";
15
+ import { useMemo as d } from "react";
16
+ import { useInfiniteQuery as f, useMutation as p } from "@tanstack/react-query";
12
17
  // ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index6.js
13
- function a() {
14
- let { client: a, organizationId: o } = t();
15
- return i({
16
- mutationFn: async ({ path: t, file: r }) => {
18
+ var m = 100;
19
+ function h(t, { enabled: l } = {}) {
20
+ let { client: u, organizationId: p, widgetToken: h, authEpoch: g, organizationStatus: _ } = i(), v = a(p), y = !!(p && h && t) && l !== !1, b = n({
21
+ client: u,
22
+ headers: v,
23
+ path: { payable_id: t ?? "" },
24
+ query: { limit: m }
25
+ }), x = f({
26
+ ...r(b.queryKey, {
27
+ authEpoch: g,
28
+ organizationStatus: _
29
+ }, { suffix: ["all"] }),
30
+ enabled: y,
31
+ initialPageParam: void 0,
32
+ queryFn: async ({ signal: n, pageParam: r }) => {
17
33
  let { data: i } = await e({
18
- client: a,
19
- headers: n(o),
20
- path: t,
21
- body: { file: r },
34
+ client: u,
35
+ headers: v,
36
+ path: { payable_id: t ?? "" },
37
+ query: {
38
+ limit: m,
39
+ ...r ? { pagination_token: r } : {}
40
+ },
41
+ signal: n,
22
42
  throwOnError: !0
23
43
  });
24
44
  return i;
25
45
  },
26
- onSuccess: async (e, t) => {
27
- await r({
28
- client: a,
29
- organizationId: o,
30
- payableId: t.path.payable_id
46
+ getNextPageParam: o
47
+ });
48
+ c(x, y);
49
+ let S = d(() => x.data?.pages.flatMap((e) => e.data ?? []) ?? [], [x.data]);
50
+ return {
51
+ ...x,
52
+ lineItems: S,
53
+ isResolving: s(x)
54
+ };
55
+ }
56
+ function g() {
57
+ let { client: e, organizationId: n } = i();
58
+ return p({
59
+ mutationFn: async ({ path: r, body: i }) => u(t({
60
+ client: e,
61
+ headers: a(n),
62
+ path: r,
63
+ body: i,
64
+ throwOnError: !1
65
+ })),
66
+ onSuccess: async (t, r) => {
67
+ await l({
68
+ client: e,
69
+ organizationId: n,
70
+ payableId: r.path.payable_id,
71
+ includeLineItems: !0
31
72
  });
32
73
  }
33
74
  });
34
75
  }
35
- export { a as useAttachPayableFileMutation };
76
+ export { h as useAllPayableLineItemsQuery, g as useReplacePayableLineItemsMutation };
@@ -2,7 +2,7 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { postPayablesIdCancel as e } from "../../../../shared/data-access/dist/lib/rest/sdk.gen.js";
5
+ import { postPayablesIdAttachFile as e } from "../../../../shared/data-access/dist/lib/rest/sdk.gen.js";
6
6
  import { useEmbedApi as t } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
7
7
  import { organizationHeaders as n } from "../../../../shared/data-access/dist/lib/organizationHeaders.js";
8
8
  import "../../../../shared/data-access/dist/index.js";
@@ -13,14 +13,15 @@ import { useMutation as i } from "@tanstack/react-query";
13
13
  function a() {
14
14
  let { client: a, organizationId: o } = t();
15
15
  return i({
16
- mutationFn: async ({ path: t }) => {
17
- let { data: r } = await e({
16
+ mutationFn: async ({ path: t, file: r }) => {
17
+ let { data: i } = await e({
18
18
  client: a,
19
19
  headers: n(o),
20
20
  path: t,
21
+ body: { file: r },
21
22
  throwOnError: !0
22
23
  });
23
- return r;
24
+ return i;
24
25
  },
25
26
  onSuccess: async (e, t) => {
26
27
  await r({
@@ -31,4 +32,4 @@ function a() {
31
32
  }
32
33
  });
33
34
  }
34
- export { a as useCancelPayableMutation };
35
+ export { a as useAttachPayableFileMutation };
@@ -2,22 +2,21 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { postPaymentIntentsIdCancel as e } from "../../../../shared/data-access/dist/lib/rest/sdk.gen.js";
5
+ import { postPayablesIdCancel as e } from "../../../../shared/data-access/dist/lib/rest/sdk.gen.js";
6
6
  import { useEmbedApi as t } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
7
7
  import { organizationHeaders as n } from "../../../../shared/data-access/dist/lib/organizationHeaders.js";
8
8
  import "../../../../shared/data-access/dist/index.js";
9
9
  import { invalidatePayableQueries as r } from "../../../data-access/dist/lib/invalidatePayableQueries/invalidatePayableQueries.js";
10
- import { reconcileCancelledPaymentQueries as i } from "../../../data-access/dist/lib/invalidatePayableQueries/reconcileCancelledPaymentQueries.js";
11
10
  import "../../../data-access/dist/invalidation.js";
12
- import { useMutation as a } from "@tanstack/react-query";
11
+ import { useMutation as i } from "@tanstack/react-query";
13
12
  // ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index8.js
14
- function o() {
15
- let { client: o, organizationId: s } = t();
16
- return a({
13
+ function a() {
14
+ let { client: a, organizationId: o } = t();
15
+ return i({
17
16
  mutationFn: async ({ path: t }) => {
18
17
  let { data: r } = await e({
19
- client: o,
20
- headers: n(s),
18
+ client: a,
19
+ headers: n(o),
21
20
  path: t,
22
21
  throwOnError: !0
23
22
  });
@@ -25,15 +24,11 @@ function o() {
25
24
  },
26
25
  onSuccess: async (e, t) => {
27
26
  await r({
28
- client: o,
29
- organizationId: s,
30
- payableId: t.payableId
31
- }), i({
32
- client: o,
33
- organizationId: s,
34
- payableId: t.payableId
35
- }).catch(() => {});
27
+ client: a,
28
+ organizationId: o,
29
+ payableId: t.path.payable_id
30
+ });
36
31
  }
37
32
  });
38
33
  }
39
- export { o as useCancelScheduledPaymentMutation };
34
+ export { a as useCancelPayableMutation };
@@ -2,30 +2,38 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { postPayables as e } from "../../../../shared/data-access/dist/lib/rest/sdk.gen.js";
5
+ import { postPaymentIntentsIdCancel as e } from "../../../../shared/data-access/dist/lib/rest/sdk.gen.js";
6
6
  import { useEmbedApi as t } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
7
7
  import { organizationHeaders as n } from "../../../../shared/data-access/dist/lib/organizationHeaders.js";
8
8
  import "../../../../shared/data-access/dist/index.js";
9
9
  import { invalidatePayableQueries as r } from "../../../data-access/dist/lib/invalidatePayableQueries/invalidatePayableQueries.js";
10
+ import { reconcileCancelledPaymentQueries as i } from "../../../data-access/dist/lib/invalidatePayableQueries/reconcileCancelledPaymentQueries.js";
10
11
  import "../../../data-access/dist/invalidation.js";
11
- import { dataOrThrowWithStatus as i } from "./index4.js";
12
12
  import { useMutation as a } from "@tanstack/react-query";
13
13
  // ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index9.js
14
14
  function o() {
15
15
  let { client: o, organizationId: s } = t();
16
16
  return a({
17
- mutationFn: async ({ body: t }) => i(e({
18
- client: o,
19
- headers: n(s),
20
- body: t,
21
- throwOnError: !1
22
- })),
23
- onSuccess: async () => {
24
- await r({
17
+ mutationFn: async ({ path: t }) => {
18
+ let { data: r } = await e({
25
19
  client: o,
26
- organizationId: s
20
+ headers: n(s),
21
+ path: t,
22
+ throwOnError: !0
27
23
  });
24
+ return r;
25
+ },
26
+ onSuccess: async (e, t) => {
27
+ await r({
28
+ client: o,
29
+ organizationId: s,
30
+ payableId: t.payableId
31
+ }), i({
32
+ client: o,
33
+ organizationId: s,
34
+ payableId: t.payableId
35
+ }).catch(() => {});
28
36
  }
29
37
  });
30
38
  }
31
- export { o as useCreatePayableMutation };
39
+ export { o as useCancelScheduledPaymentMutation };
@@ -1,11 +1,11 @@
1
- import "./index26.js";
2
- import "./index31.js";
3
- import "./index40.js";
4
- import "./index42.js";
5
- import "./index44.js";
1
+ import "./index27.js";
2
+ import "./index32.js";
3
+ import "./index41.js";
4
+ import "./index43.js";
6
5
  import "./index45.js";
7
6
  import "./index46.js";
8
7
  import "./index47.js";
9
8
  import "./index48.js";
10
- export { BillDetailsWidget, BillDialogWidget } from "./index50.js";
11
- import "./index51.js";
9
+ import "./index49.js";
10
+ export { BillDetailsWidget, BillDialogWidget } from "./index51.js";
11
+ import "./index52.js";
@@ -1,39 +1,20 @@
1
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
2
  import "../../../../shared/approval-policy/feature/dist/index.js";
6
3
  // ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index10.js
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
- };
33
- return {
34
- title: i(f, m),
35
- sentence: r(f, m),
36
- steps: d
37
- };
38
- }
39
- export { a as buildApprovalPolicyCardView };
4
+ var t = {
5
+ deletedBadge: "Deleted",
6
+ deletedNote: "This rule was deleted after this bill was submitted.",
7
+ deletedApprovalsNote: "The approvals below still apply to this bill.",
8
+ noRuleTitle: "No approval rule",
9
+ noRuleSentence: "No rule covered this bill when it was submitted.",
10
+ approvalProgress: "{approved} of {required} approvals in",
11
+ ruleTitleRange: e.ruleTitleRange,
12
+ ruleTitleUpTo: e.ruleTitleUpTo,
13
+ ruleTitleFrom: e.ruleTitleFrom,
14
+ ruleTitleAny: e.ruleTitleAny,
15
+ ruleSentenceRange: e.ruleSentenceRange,
16
+ ruleSentenceUpTo: e.ruleSentenceUpTo,
17
+ ruleSentenceFrom: e.ruleSentenceFrom,
18
+ ruleSentenceAny: e.ruleSentenceAny
19
+ };
20
+ export { t as APPROVAL_POLICY_RULE_COPY_EN };
@@ -1,60 +1,48 @@
1
- import { APPROVAL_POLICY_RULE_COPY_EN as e } from "./index9.js";
2
- import { buildApprovalPolicyCardView as t } from "./index10.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";
3
6
  // ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index11.js
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
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)
7
+ function a({ policy: e, lookup: n, approvedUserIds: r, approvedRoleIds: i, copy: a }) {
8
+ let s = t(e.script);
9
+ if (!s.groups.length || !s.isSupported) return;
10
+ let c = [];
11
+ for (let [e, t] of s.groups.entries()) {
12
+ let a = [];
13
+ for (let e of [...t.roleIds, ...t.userIds]) {
14
+ let t = n.get(e);
15
+ t && a.push({
16
+ id: e,
17
+ label: t.label,
18
+ approved: t.kind === "user" ? r.has(e) : !!i?.has(e)
51
19
  });
52
20
  }
53
- s.length && n.push({
54
- id: `request-${r + 1}`,
55
- chips: s
21
+ a.length && c.push({
22
+ id: `group-${e + 1}`,
23
+ chips: a
56
24
  });
57
25
  }
58
- return n;
26
+ if (!c.length) return;
27
+ let l = o({
28
+ trigger: e.trigger,
29
+ copy: a
30
+ });
31
+ return l ? {
32
+ ...l,
33
+ steps: c
34
+ } : void 0;
35
+ }
36
+ function o({ trigger: t, copy: a }) {
37
+ let { condition: o, hasKnownAmountBounds: s } = n(t);
38
+ if (!s) return;
39
+ let c = {
40
+ ...e,
41
+ ...a
42
+ };
43
+ return {
44
+ title: i(o, c),
45
+ sentence: r(o, c)
46
+ };
59
47
  }
60
- export { n as resolveApprovalPolicySection };
48
+ export { a as buildApprovalPolicyCardView, o as buildApprovalPolicyHeading };
@@ -1,8 +1,91 @@
1
- import { policyAssignmentDeadline as e, policyAssignmentFirstSeenAt as t } from "../../data-access/dist/index21.js";
2
- import "../../data-access/dist/index.js";
1
+ import { formatLabel as e } from "../../../../shared/approval-policy/feature/dist/lib/labels.js";
2
+ import "../../../../shared/approval-policy/feature/dist/index.js";
3
+ import { APPROVAL_POLICY_RULE_COPY_EN as t } from "./index10.js";
4
+ import { buildApprovalPolicyCardView as n, buildApprovalPolicyHeading as r } from "./index11.js";
3
5
  // ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index12.js
4
- function n(n, r) {
5
- let i = e(n, t(n));
6
- return i !== void 0 && (r ?? 0) < i;
6
+ var i = /* @__PURE__ */ new Set(["waiting", "not_started"]);
7
+ function a({ approvalPolicyId: e, livePolicies: a, snapshotPolicyName: s, routedSteps: c, currentRound: l, lookup: u, approvedUserIds: d, approvedRoleIds: f, copy: p }) {
8
+ let m = {
9
+ ...t,
10
+ ...p
11
+ };
12
+ if (!e) return {
13
+ source: "none",
14
+ view: {
15
+ title: m.noRuleTitle,
16
+ sentence: m.noRuleSentence,
17
+ steps: []
18
+ }
19
+ };
20
+ let h = a?.find((t) => t.id === e);
21
+ if (h && c) {
22
+ let e = o(c, u, "step", m);
23
+ if (e.length) return {
24
+ source: "routed",
25
+ view: {
26
+ ...r({
27
+ trigger: h.trigger,
28
+ copy: p
29
+ }) ?? { title: s },
30
+ steps: e.map(({ step: e }) => e)
31
+ },
32
+ pendingApprovers: e.filter(({ record: e }) => i.has(e.status ?? "")).map(({ step: e }) => ({
33
+ id: e.id,
34
+ names: e.chips.filter((e) => !e.approved).map((e) => e.label)
35
+ })).filter((e) => e.names.length > 0)
36
+ };
37
+ }
38
+ let g = h ? n({
39
+ policy: h,
40
+ lookup: u,
41
+ approvedUserIds: d,
42
+ approvedRoleIds: f,
43
+ copy: p
44
+ }) : void 0;
45
+ if (g) return {
46
+ source: "live",
47
+ view: g
48
+ };
49
+ let _ = !!a && !h, v = o([...l].reverse(), u, "request", m).map(({ step: e }) => e), y = v.length ? `${m.deletedNote} ${m.deletedApprovalsNote}` : m.deletedNote;
50
+ if (s || _ || v.length) return {
51
+ source: "snapshot",
52
+ view: {
53
+ title: s,
54
+ ..._ ? {
55
+ badge: m.deletedBadge,
56
+ note: y
57
+ } : {},
58
+ steps: v
59
+ }
60
+ };
7
61
  }
8
- export { n as isAwaitingPolicyAssignment };
62
+ function o(t, n, r, i) {
63
+ let a = [];
64
+ for (let [o, s] of t.entries()) {
65
+ let t = s.approved_by ?? [], c = s.user_ids ?? [], l = s.required_approval_count ?? 1, u = t.filter((e) => !c.includes(e)).length >= l, d = [];
66
+ for (let e of [...s.role_ids ?? [], ...c]) {
67
+ let r = n.get(e);
68
+ r && d.push({
69
+ id: e,
70
+ label: r.label,
71
+ approved: r.kind === "user" ? t.includes(e) : u
72
+ });
73
+ }
74
+ if (d.length) {
75
+ let n = l > 1 ? e(i.approvalProgress, {
76
+ approved: String(Math.min(t.length, l)),
77
+ required: String(l)
78
+ }) : void 0;
79
+ a.push({
80
+ step: {
81
+ id: `${r}-${o + 1}`,
82
+ chips: d,
83
+ ...n ? { caption: n } : {}
84
+ },
85
+ record: s
86
+ });
87
+ }
88
+ }
89
+ return a;
90
+ }
91
+ export { a as resolveApprovalPolicySection };
@@ -1,24 +1,8 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { usePayableHistoryQuery as e } from "../../data-access/dist/index3.js";
1
+ import { policyAssignmentDeadline as e, policyAssignmentFirstSeenAt as t } from "../../data-access/dist/index22.js";
6
2
  import "../../data-access/dist/index.js";
7
3
  // ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index13.js
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));
12
- return {
13
- roundStartedAt: s,
14
- snapshotPolicyName: c,
15
- isLoading: o.isLoading,
16
- isError: o.isError
17
- };
4
+ function n(n, r) {
5
+ let i = e(n, t(n));
6
+ return i !== void 0 && (r ?? 0) < i;
18
7
  }
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 };
8
+ export { n as isAwaitingPolicyAssignment };
@@ -2,100 +2,23 @@
2
2
  "use client";
3
3
  "use client";
4
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";
5
+ import { usePayableHistoryQuery as e } from "../../data-access/dist/index4.js";
15
6
  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";
23
7
  // ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index14.js
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
- ]);
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));
95
12
  return {
96
- view: G?.view,
97
- pendingApprovers: K,
98
- isLoading: !!g && (!b || k.isResolving || A.isResolving || j.isResolving || M.isLoading || M.isError || !E)
13
+ roundStartedAt: s,
14
+ snapshotPolicyName: c,
15
+ isLoading: o.isLoading,
16
+ isError: o.isError
99
17
  };
100
18
  }
101
- export { h as useApprovalPolicyCardView };
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 };