@tesouro/embedded-components-react 0.3.55 → 0.3.57

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 (30) hide show
  1. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +1 -1
  2. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +65 -3
  3. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +4 -5
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +5 -4
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +3 -32
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +30 -37
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +37 -158
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +165 -28
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +48 -1
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +1 -50
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +47 -4
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +4 -13
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +13 -14
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +7 -57
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +54 -16
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +24 -60
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +1 -1
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +1 -1
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +2 -2
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +6 -6
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +98 -98
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +51 -53
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +1 -1
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +131 -140
  25. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/data-access/dist/index5.js +6 -6
  26. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/index.js +6 -5
  27. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/helpers.js +2 -3
  28. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/usePayableAchInstructions.js +18 -0
  29. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  30. package/package.json +1 -1
@@ -1 +1,48 @@
1
- import "./index22.js";
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { useWidgetConfig as e } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
6
+ import "../../../shared/feature/dist/index.js";
7
+ import { resolveVendor as t } from "./index5.js";
8
+ import { ReviewTransactionDialog as n } from "../../ui/dist/index84.js";
9
+ import { SchedulePaymentDialog as r } from "../../ui/dist/index91.js";
10
+ import "../../ui/dist/index.js";
11
+ import { canReadCounterpartBankAccounts as i } from "./index16.js";
12
+ import { resolveAmountDueMinorUnits as a } from "./index17.js";
13
+ import { payBillFlowTestIds as o } from "./index18.js";
14
+ import { usePayBillFlow as s } from "./index22.js";
15
+ import { usePayableAchInstructions as c } from "../../../shared/counterpart-management/feature/dist/lib/usePayableAchInstructions.js";
16
+ import "../../../shared/counterpart-management/feature/dist/index.js";
17
+ import { useImperativeHandle as l } from "react";
18
+ import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
19
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js
20
+ function p({ ref: p, payable: m, onMissingAchInstructions: h, poweredByBankName: g, labels: _ }) {
21
+ let v = t(m), { initResponse: y } = e(), b = i(y?.scopes), { achInstructions: x, isLoading: S, isError: C } = c({
22
+ counterpartId: m.counterpart_id,
23
+ currency: m.currency,
24
+ enabled: b
25
+ }), w = s({
26
+ payableId: m.id,
27
+ amountDueMinorUnits: a(m) ?? 0,
28
+ currencyCode: m.currency ?? void 0,
29
+ dueDate: m.due_date,
30
+ vendorName: v?.name ?? void 0,
31
+ vendorEmail: v?.email ?? void 0,
32
+ vendorBankAccount: x,
33
+ isVendorBankAccountLoading: S,
34
+ isVendorBankAccountError: C,
35
+ onMissingAchInstructions: h,
36
+ poweredByBankName: g,
37
+ labels: _
38
+ });
39
+ return l(p, () => ({ open: w.open }), [w.open]), /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(r, {
40
+ ...w.dialogProps,
41
+ testId: o.scheduleDialog
42
+ }), /* @__PURE__ */ d(n, {
43
+ ...w.reviewProps,
44
+ testId: o.reviewDialog
45
+ })] });
46
+ }
47
+ //#endregion
48
+ export { p as PayBillFlow, p as default };
@@ -1,50 +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
- import "../../../shared/approval-policy/feature/dist/index.js";
6
- //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js
7
- var a = {
8
- ruleTitleRange: e.ruleTitleRange,
9
- ruleTitleUpTo: e.ruleTitleUpTo,
10
- ruleTitleFrom: e.ruleTitleFrom,
11
- ruleTitleAny: e.ruleTitleAny,
12
- ruleSentenceRange: e.ruleSentenceRange,
13
- ruleSentenceUpTo: e.ruleSentenceUpTo,
14
- ruleSentenceFrom: e.ruleSentenceFrom,
15
- ruleSentenceAny: e.ruleSentenceAny
16
- };
17
- function o({ policy: a, lookup: o, approvedUserIds: s, approvedRoleIds: c, copy: l }) {
18
- let u = t(a.script);
19
- if (!u.groups.length || !u.isSupported) return;
20
- let d = [];
21
- for (let [e, t] of u.groups.entries()) {
22
- let n = [];
23
- for (let e of [...t.roleIds, ...t.userIds]) {
24
- let t = o.get(e);
25
- t && n.push({
26
- id: e,
27
- label: t.label,
28
- approved: t.kind === "user" ? s.has(e) : !!c?.has(e)
29
- });
30
- }
31
- n.length && d.push({
32
- id: `group-${e + 1}`,
33
- chips: n
34
- });
35
- }
36
- if (!d.length) return;
37
- let { condition: f, hasKnownAmountBounds: p } = n(a.trigger);
38
- if (!p) return;
39
- let m = {
40
- ...e,
41
- ...l
42
- };
43
- return {
44
- title: i(f, m),
45
- sentence: r(f, m),
46
- steps: d
47
- };
48
- }
49
- //#endregion
50
- export { a as APPROVAL_POLICY_RULE_COPY_EN, o as buildApprovalPolicyCardView };
1
+ import "./index23.js";
@@ -1,7 +1,50 @@
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";
1
6
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js
2
- function e(e, t) {
3
- let n = e ?? [];
4
- return t ? n.filter((e) => !e.created_at || e.created_at >= t) : n.slice(0, 1);
7
+ var a = {
8
+ ruleTitleRange: e.ruleTitleRange,
9
+ ruleTitleUpTo: e.ruleTitleUpTo,
10
+ ruleTitleFrom: e.ruleTitleFrom,
11
+ ruleTitleAny: e.ruleTitleAny,
12
+ ruleSentenceRange: e.ruleSentenceRange,
13
+ ruleSentenceUpTo: e.ruleSentenceUpTo,
14
+ ruleSentenceFrom: e.ruleSentenceFrom,
15
+ ruleSentenceAny: e.ruleSentenceAny
16
+ };
17
+ function o({ policy: a, lookup: o, approvedUserIds: s, approvedRoleIds: c, copy: l }) {
18
+ let u = t(a.script);
19
+ if (!u.groups.length || !u.isSupported) return;
20
+ let d = [];
21
+ for (let [e, t] of u.groups.entries()) {
22
+ let n = [];
23
+ for (let e of [...t.roleIds, ...t.userIds]) {
24
+ let t = o.get(e);
25
+ t && n.push({
26
+ id: e,
27
+ label: t.label,
28
+ approved: t.kind === "user" ? s.has(e) : !!c?.has(e)
29
+ });
30
+ }
31
+ n.length && d.push({
32
+ id: `group-${e + 1}`,
33
+ chips: n
34
+ });
35
+ }
36
+ if (!d.length) return;
37
+ let { condition: f, hasKnownAmountBounds: p } = n(a.trigger);
38
+ if (!p) return;
39
+ let m = {
40
+ ...e,
41
+ ...l
42
+ };
43
+ return {
44
+ title: i(f, m),
45
+ sentence: r(f, m),
46
+ steps: d
47
+ };
5
48
  }
6
49
  //#endregion
7
- export { e as currentApprovalRound };
50
+ export { a as APPROVAL_POLICY_RULE_COPY_EN, o as buildApprovalPolicyCardView };
@@ -1,16 +1,7 @@
1
- import { currentApprovalRound as e } from "./index25.js";
2
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js
3
- function t({ requestsNewestFirst: t, roundStartedAt: n, lookup: r }) {
4
- let i = e(t, n), a = [];
5
- for (let e of i) {
6
- if (e.status !== "waiting") continue;
7
- let t = [...e.role_ids ?? [], ...e.user_ids ?? []].map((e) => r.get(e)?.label).filter((e) => !!e);
8
- t.length && a.push({
9
- id: e.id,
10
- names: t
11
- });
12
- }
13
- return a;
2
+ function e(e, t) {
3
+ let n = e ?? [];
4
+ return t ? n.filter((e) => !e.created_at || e.created_at >= t) : n.slice(0, 1);
14
5
  }
15
6
  //#endregion
16
- export { t as buildPendingApproverGroups };
7
+ export { e as currentApprovalRound };
@@ -1,17 +1,16 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { usePayableHistoryQuery as e } from "../../data-access/dist/index8.js";
6
- import "../../data-access/dist/index.js";
1
+ import { currentApprovalRound as e } from "./index26.js";
7
2
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js
8
- var t = "submitted_for_approval";
9
- function n({ payableId: n, enabled: r = !0 }) {
10
- let i = e(n, { enabled: r });
11
- return {
12
- roundStartedAt: (i.data?.data ?? []).reduce((e, n) => n.event_type === t ? n.timestamp : e, void 0),
13
- isLoading: i.isLoading
14
- };
3
+ function t({ requestsNewestFirst: t, roundStartedAt: n, lookup: r }) {
4
+ let i = e(t, n), a = [];
5
+ for (let e of i) {
6
+ if (e.status !== "waiting") continue;
7
+ let t = [...e.role_ids ?? [], ...e.user_ids ?? []].map((e) => r.get(e)?.label).filter((e) => !!e);
8
+ t.length && a.push({
9
+ id: e.id,
10
+ names: t
11
+ });
12
+ }
13
+ return a;
15
14
  }
16
15
  //#endregion
17
- export { n as usePayableApprovalRoundStart };
16
+ export { t as buildPendingApproverGroups };
@@ -2,66 +2,16 @@
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 { usePayableApprovalRequestsQuery as a } from "../../data-access/dist/index7.js";
5
+ import { usePayableHistoryQuery as e } from "../../data-access/dist/index8.js";
13
6
  import "../../data-access/dist/index.js";
14
- import { useGetApprovalPoliciesQuery as o } from "../../../shared/approval-policy/data-access/dist/lib/approvalPoliciesApi.js";
15
- import "../../../shared/approval-policy/data-access/dist/index.js";
16
- import { buildApprovalPolicyCardView as s } from "./index24.js";
17
- import { currentApprovalRound as c } from "./index25.js";
18
- import { buildPendingApproverGroups as l } from "./index26.js";
19
- import { usePayableApprovalRoundStart as u } from "./index27.js";
20
- import { useMemo as d } from "react";
21
7
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js
22
- function f({ payableId: f, approvalPolicyId: p, enabled: m = !0, copy: h }) {
23
- let g = m && !!p, { initResponse: _ } = i(), v = e(_?.scopes, [t.ApprovalPolicyReadOrg]), y = e(_?.scopes, [t.ApprovalRequestReadOrg]), b = e(_?.scopes, [t.RoleReadOrg]), x = e(_?.scopes, [t.UserReadOrg]), S = o({ enabled: g && v }), C = n({ enabled: g && b }), w = r({ enabled: g && x }), T = a(f, { enabled: g && y }), { roundStartedAt: E } = u({
24
- payableId: f,
25
- enabled: g && y
26
- }), D = d(() => {
27
- let e = /* @__PURE__ */ new Map();
28
- for (let t of C.data?.data ?? []) e.set(t.id, {
29
- label: t.name,
30
- kind: "role"
31
- });
32
- for (let t of w.data?.data ?? []) e.set(t.id, {
33
- label: t.name,
34
- kind: "user"
35
- });
36
- return e;
37
- }, [C.data, w.data]), O = d(() => c(T.data?.data, E), [T.data, E]), k = d(() => new Set(O.flatMap((e) => e.approved_by ?? [])), [O]), A = d(() => new Set(O.filter((e) => (e.approved_by ?? []).length > 0).flatMap((e) => e.role_ids ?? [])), [O]), j = d(() => p ? S.data?.data.find((e) => e.id === p) : void 0, [S.data, p]);
8
+ var t = "submitted_for_approval";
9
+ function n({ payableId: n, enabled: r = !0 }) {
10
+ let i = e(n, { enabled: r });
38
11
  return {
39
- view: d(() => g && j ? s({
40
- policy: j,
41
- lookup: D,
42
- approvedUserIds: k,
43
- approvedRoleIds: A,
44
- copy: h
45
- }) : void 0, [
46
- g,
47
- j,
48
- D,
49
- k,
50
- A,
51
- h
52
- ]),
53
- pendingApprovers: d(() => g ? l({
54
- requestsNewestFirst: T.data?.data,
55
- roundStartedAt: E,
56
- lookup: D
57
- }) : [], [
58
- g,
59
- T.data,
60
- E,
61
- D
62
- ]),
63
- isLoading: g && (S.isResolving || C.isResolving || w.isResolving || T.isLoading)
12
+ roundStartedAt: (i.data?.data ?? []).reduce((e, n) => n.event_type === t ? n.timestamp : e, void 0),
13
+ isLoading: i.isLoading
64
14
  };
65
15
  }
66
16
  //#endregion
67
- export { f as useApprovalPolicyCardView };
17
+ export { n as usePayableApprovalRoundStart };
@@ -3,27 +3,65 @@
3
3
  "use client";
4
4
  "use client";
5
5
  import { hasAnyScope as e } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
6
- import { useCurrentUserQuery as t } from "../../../shared/data-access/dist/lib/useCurrentUserQuery.js";
7
- import { Scope as n } from "../../../shared/data-access/dist/lib/scopes.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";
8
9
  import "../../../shared/data-access/dist/index.js";
9
- import { useWidgetConfig as r } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
10
+ import { useWidgetConfig as i } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
10
11
  import "../../../shared/feature/dist/index.js";
11
- import { usePayableApprovalRequestsQuery as i } from "../../data-access/dist/index7.js";
12
+ import { usePayableApprovalRequestsQuery as a } from "../../data-access/dist/index7.js";
12
13
  import "../../data-access/dist/index.js";
13
- import { currentApprovalRound as a } from "./index25.js";
14
- import { usePayableApprovalRoundStart as o } from "./index27.js";
14
+ import { useGetApprovalPoliciesQuery as o } from "../../../shared/approval-policy/data-access/dist/lib/approvalPoliciesApi.js";
15
+ import "../../../shared/approval-policy/data-access/dist/index.js";
16
+ import { buildApprovalPolicyCardView as s } from "./index25.js";
17
+ import { currentApprovalRound as c } from "./index26.js";
18
+ import { buildPendingApproverGroups as l } from "./index27.js";
19
+ import { usePayableApprovalRoundStart as u } from "./index28.js";
20
+ import { useMemo as d } from "react";
15
21
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js
16
- function s({ payableId: s, status: c }) {
17
- let { initResponse: l } = r(), u = e(l?.scopes, [n.ApprovalRequestReadOrg]), d = c === "approve_in_progress" && u, f = i(s, { enabled: d }), p = t({ enabled: d }), { roundStartedAt: m } = o({
18
- payableId: s,
19
- enabled: d
20
- }), h = p.data?.id, g = d ? a(f.data?.data, m) : [], _ = (e) => e.caller_is_policy_approver ?? !!(h && e.user_ids.includes(h)), v = g.some(_), y = g.filter((e) => e.status === "waiting");
22
+ function f({ payableId: f, approvalPolicyId: p, enabled: m = !0, copy: h }) {
23
+ let g = m && !!p, { initResponse: _ } = i(), v = e(_?.scopes, [t.ApprovalPolicyReadOrg]), y = e(_?.scopes, [t.ApprovalRequestReadOrg]), b = e(_?.scopes, [t.RoleReadOrg]), x = e(_?.scopes, [t.UserReadOrg]), S = o({ enabled: g && v }), C = n({ enabled: g && b }), w = r({ enabled: g && x }), T = a(f, { enabled: g && y }), { roundStartedAt: E } = u({
24
+ payableId: f,
25
+ enabled: g && y
26
+ }), D = d(() => {
27
+ let e = /* @__PURE__ */ new Map();
28
+ for (let t of C.data?.data ?? []) e.set(t.id, {
29
+ label: t.name,
30
+ kind: "role"
31
+ });
32
+ for (let t of w.data?.data ?? []) e.set(t.id, {
33
+ label: t.name,
34
+ kind: "user"
35
+ });
36
+ return e;
37
+ }, [C.data, w.data]), O = d(() => c(T.data?.data, E), [T.data, E]), k = d(() => new Set(O.flatMap((e) => e.approved_by ?? [])), [O]), A = d(() => new Set(O.filter((e) => (e.approved_by ?? []).length > 0).flatMap((e) => e.role_ids ?? [])), [O]), j = d(() => p ? S.data?.data.find((e) => e.id === p) : void 0, [S.data, p]);
21
38
  return {
22
- id: y.filter(_).find((e) => !(h && (e.approved_by ?? []).includes(h)))?.id,
23
- isPolicyApprover: v,
24
- hasWaitingRequest: y.length > 0,
25
- isLoading: f.isLoading || p.isLoading
39
+ view: d(() => g && j ? s({
40
+ policy: j,
41
+ lookup: D,
42
+ approvedUserIds: k,
43
+ approvedRoleIds: A,
44
+ copy: h
45
+ }) : void 0, [
46
+ g,
47
+ j,
48
+ D,
49
+ k,
50
+ A,
51
+ h
52
+ ]),
53
+ pendingApprovers: d(() => g ? l({
54
+ requestsNewestFirst: T.data?.data,
55
+ roundStartedAt: E,
56
+ lookup: D
57
+ }) : [], [
58
+ g,
59
+ T.data,
60
+ E,
61
+ D
62
+ ]),
63
+ isLoading: g && (S.isResolving || C.isResolving || w.isResolving || T.isLoading)
26
64
  };
27
65
  }
28
66
  //#endregion
29
- export { s as useCurrentApprovalRequestId };
67
+ export { f as useApprovalPolicyCardView };
@@ -1,65 +1,29 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
1
5
  import { hasAnyScope as e } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
2
- import { Scope as t } from "../../../shared/data-access/dist/lib/scopes.js";
6
+ import { useCurrentUserQuery as t } from "../../../shared/data-access/dist/lib/useCurrentUserQuery.js";
7
+ import { Scope as n } from "../../../shared/data-access/dist/lib/scopes.js";
3
8
  import "../../../shared/data-access/dist/index.js";
4
- import { BanIcon as n, CalendarXIcon as r, RotateCcwIcon as i, ThumbsDownIcon as a, ThumbsUpIcon as o } from "lucide-react";
9
+ import { useWidgetConfig as r } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
10
+ import "../../../shared/feature/dist/index.js";
11
+ import { usePayableApprovalRequestsQuery as i } from "../../data-access/dist/index7.js";
12
+ import "../../data-access/dist/index.js";
13
+ import { currentApprovalRound as a } from "./index26.js";
14
+ import { usePayableApprovalRoundStart as o } from "./index28.js";
5
15
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js
6
- function s({ status: s, scopes: c, canDecideApprovalRequest: l, hasScheduledPayment: u, scheduledPaymentIntentId: d, isPolicyApprover: f, hasWaitingRequest: p, arePendingApproversUnknown: m, labels: h }) {
7
- let g = e(c, [t.PayablePayOrg]), _ = e(c, [t.BankAccountReadOrg]), v = e(c, [t.PaymentRailAch]), y = e(c, [t.PayableWriteOrg]), b = g, x = e(c, [t.PayableApproveOrg]), S = [];
8
- s === "approve_in_progress" && l && (S.push({
9
- id: "approve",
10
- label: h.approve,
11
- variant: "default",
12
- surface: "row"
13
- }), S.push({
14
- id: "reject",
15
- label: h.reject,
16
- variant: "ghost",
17
- surface: "row"
18
- })), s === "approve_in_progress" && p && x && !f && !m && (S.push({
19
- id: "forceApprove",
20
- label: h.forceApprove,
21
- variant: "ghost",
22
- surface: "menu",
23
- icon: o,
24
- sectionHeading: h.policyOverridesHeading
25
- }), S.push({
26
- id: "forceReject",
27
- label: h.forceReject,
28
- variant: "ghost",
29
- surface: "menu",
30
- icon: a,
31
- sectionHeading: h.policyOverridesHeading
32
- }));
33
- let C = s === "waiting_to_be_paid" && g && !u, w = s === "waiting_to_be_paid" && g && _ && v && !u;
34
- return C && S.push({
35
- id: "markAsPaid",
36
- label: h.markAsPaid,
37
- variant: "outline",
38
- surface: "row"
39
- }), w && S.push({
40
- id: "payBill",
41
- label: h.payBill,
42
- variant: "default",
43
- surface: "row"
44
- }), s === "new" && y && S.push({
45
- id: "cancel",
46
- label: h.cancel,
47
- variant: "ghost",
48
- surface: "menu",
49
- icon: n
50
- }), (s === "rejected" || s === "waiting_to_be_paid" && !u) && y && S.push({
51
- id: "reopen",
52
- label: h.reopen,
53
- variant: "ghost",
54
- surface: "menu",
55
- icon: i
56
- }), s === "waiting_to_be_paid" && u && d && b && S.push({
57
- id: "cancelScheduledPayment",
58
- label: h.cancelScheduledPayment,
59
- variant: "ghost",
60
- surface: "menu",
61
- icon: r
62
- }), S;
16
+ function s({ payableId: s, status: c }) {
17
+ let { initResponse: l } = r(), u = e(l?.scopes, [n.ApprovalRequestReadOrg]), d = c === "approve_in_progress" && u, f = i(s, { enabled: d }), p = t({ enabled: d }), { roundStartedAt: m } = o({
18
+ payableId: s,
19
+ enabled: d
20
+ }), h = p.data?.id, g = d ? a(f.data?.data, m) : [], _ = (e) => e.caller_is_policy_approver ?? !!(h && e.user_ids.includes(h)), v = g.some(_), y = g.filter((e) => e.status === "waiting");
21
+ return {
22
+ id: y.filter(_).find((e) => !(h && (e.approved_by ?? []).includes(h)))?.id,
23
+ isPolicyApprover: v,
24
+ hasWaitingRequest: y.length > 0,
25
+ isLoading: f.isLoading || p.isLoading
26
+ };
63
27
  }
64
28
  //#endregion
65
- export { s as getBillDetailActions };
29
+ export { s as useCurrentApprovalRequestId };
@@ -9,7 +9,7 @@ import "../../../shared/feature/dist/index.js";
9
9
  import { useApprovePayableApprovalRequestMutation as n, useRejectPayableApprovalRequestMutation as r } from "../../data-access/dist/index7.js";
10
10
  import { useCancelPayableMutation as i, useCancelScheduledPaymentMutation as a, useForceApprovePayableMutation as o, useForceRejectPayableMutation as s, useReopenPayableMutation as c } from "../../data-access/dist/index12.js";
11
11
  import "../../data-access/dist/index.js";
12
- import { getBillDetailActions as l } from "./index30.js";
12
+ import { getBillDetailActions as l } from "./index16.js";
13
13
  import { useState as u } from "react";
14
14
  import { HandIcon as d } from "lucide-react";
15
15
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js
@@ -1,7 +1,7 @@
1
1
  import { formatCalendarDate as e } from "../../../shared/util/dist/lib/formatCalendarDate.js";
2
2
  import { derivePayableStatus as t } from "./index4.js";
3
3
  import { resolveVendor as n } from "./index5.js";
4
- import { resolveAmountDueMinorUnits as r } from "./index16.js";
4
+ import { resolveAmountDueMinorUnits as r } from "./index17.js";
5
5
  import { formatBillMoney as i } from "./index35.js";
6
6
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js
7
7
  function a({ payable: a, lineItems: o, glCodeOptions: s, glCodeRosterAvailable: c = !0, history: l, approvalPolicy: u, labels: d, hasScheduledPayment: f }) {
@@ -1,9 +1,9 @@
1
1
  import { UNSAVED_BILL_DIALOG_LABELS_EN as e } from "../../ui/dist/index96.js";
2
2
  import "../../ui/dist/index.js";
3
- import { PAY_BILL_FLOW_LABELS_EN as t, mergePayBillFlowLabels as n } from "./index20.js";
3
+ import { PAY_BILL_FLOW_LABELS_EN as t, mergePayBillFlowLabels as n } from "./index21.js";
4
4
  import { MARK_AS_PAID_FLOW_LABELS_EN as r, mergeMarkAsPaidFlowLabels as i } from "./index12.js";
5
5
  import "./index15.js";
6
- import { APPROVAL_POLICY_RULE_COPY_EN as a } from "./index24.js";
6
+ import { APPROVAL_POLICY_RULE_COPY_EN as a } from "./index25.js";
7
7
  import { BILL_DETAIL_ACTIONS_LABELS_EN as o, SCHEDULED_SUMMARY_LABEL_EN as s, mergeBillDetailActionsLabels as c } from "./index38.js";
8
8
  import { SOURCE_DOCUMENT_PREVIEW_LABELS_EN as l } from "./index39.js";
9
9
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js
@@ -6,28 +6,28 @@ import { Button as e } from "../../../../../packages/shared-ui-shadcn/dist/index
6
6
  import { getStateOptions as t } from "../../../shared/util/dist/lib/usStates.js";
7
7
  import { AchFieldGroup as n } from "../../../shared/counterpart-management/ui/dist/index5.js";
8
8
  import { CounterpartFormFields as r, useFocusFirstInvalidField as i } from "../../../shared/counterpart-management/ui/dist/index9.js";
9
- import { VENDOR_INLINE_FORM_LABELS_EN as a } from "./index40.js";
10
- import { COUNTERPART_MESSAGE_LABELS_EN as o } from "../../../shared/counterpart-management/feature/dist/lib/labels.js";
11
- import { useCounterpartForm as s } from "../../../shared/counterpart-management/feature/dist/lib/useCounterpartForm.js";
9
+ import { COUNTERPART_MESSAGE_LABELS_EN as a } from "../../../shared/counterpart-management/feature/dist/lib/labels.js";
10
+ import { useCounterpartForm as o } from "../../../shared/counterpart-management/feature/dist/lib/useCounterpartForm.js";
12
11
  import "../../../shared/counterpart-management/feature/dist/index.js";
12
+ import { VENDOR_INLINE_FORM_LABELS_EN as s } from "./index40.js";
13
13
  import { useCallback as c, useEffect as l, useMemo as u, useRef as d, useState as f } from "react";
14
14
  import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
15
15
  import { Landmark as g, Plus as _, X as v } from "lucide-react";
16
16
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js
17
17
  function y({ mode: y, counterpart: b, primaryAddress: x, bankAccounts: S, isBankAccountsLoading: C, isBankAccountsError: w, initialName: T, initialValues: E, onSaved: D, onCancel: O, onDirtyChange: k, labels: A }) {
18
18
  let j = {
19
- ...a,
19
+ ...s,
20
20
  ...A
21
21
  }, [M, N] = f("none"), [P, F] = f(b?.id), [I, L] = f(!1), [R, z] = f(!1);
22
22
  l(() => {
23
23
  k?.(R);
24
24
  }, [R, k]);
25
- let B = u(() => t(), []), V = d(M), H = d(!1), U = s({
25
+ let B = u(() => t(), []), V = d(M), H = d(!1), U = o({
26
26
  view: M,
27
27
  setView: N,
28
28
  selectedId: P,
29
29
  setSelectedId: F,
30
- messages: o,
30
+ messages: a,
31
31
  counterpartType: "vendor",
32
32
  counterpart: b,
33
33
  primaryAddress: x,