@tesouro/embedded-components-react 0.3.53 → 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 (38) hide show
  1. package/README.md +0 -20
  2. package/dist/index.d.ts +2 -22
  3. package/dist/index.js +44 -48
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +1 -1
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +65 -3
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +4 -5
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +5 -4
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +3 -32
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +30 -37
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +37 -158
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +165 -28
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +48 -1
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +1 -50
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +47 -4
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +4 -13
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +13 -14
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +7 -57
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +54 -16
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +24 -60
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +1 -1
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +1 -1
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +2 -2
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +6 -6
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +98 -98
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +51 -53
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +1 -1
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +131 -140
  28. package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index.js +4 -4
  29. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index22.js +1 -1
  30. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index98.js +47 -29
  31. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/data-access/dist/index5.js +6 -6
  32. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/index.js +6 -5
  33. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/helpers.js +2 -3
  34. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/usePayableAchInstructions.js +18 -0
  35. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  36. package/package.json +1 -1
  37. package/dist/lib/CreateCardWidget.d.ts +0 -823
  38. package/dist/lib/CreateCardWidget.js +0 -5
@@ -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,
@@ -4,88 +4,88 @@
4
4
  "use client";
5
5
  import { usePayableSuggestionsQuery as e } from "../../data-access/dist/index16.js";
6
6
  import "../../data-access/dist/index.js";
7
- import { maskAccountNumber as t } from "./index18.js";
8
- import { VENDOR_SECTION_PROPS_LABELS_EN as n } from "./index40.js";
9
- import { buildVendorPrefill as r } from "./index42.js";
10
- import { counterpartFormBankAccountToCreatePayload as ee, counterpartFormBankAccountToUpdatePayload as i, getAchInstructions as a, getCounterpartEmail as o, getCounterpartName as s, getPayableAchInstructions as c, hasAchFormValues as l, resolveCounterpartBankAccountWrite as te, validateAchFormValues as ne } from "../../../shared/counterpart-management/feature/dist/lib/helpers.js";
11
- import { useCounterpartsQuery as re } from "../../../shared/counterpart-management/data-access/dist/index3.js";
12
- import { useCreateCounterpartBankAccountMutation as ie, useUpdateCounterpartBankAccountMutation as ae } from "../../../shared/counterpart-management/data-access/dist/index5.js";
13
- import { useCounterpartDetails as oe } from "../../../shared/counterpart-management/feature/dist/lib/useCounterpartDetails.js";
7
+ import { maskAccountNumber as t } from "./index19.js";
8
+ import { counterpartFormBankAccountToCreatePayload as n, counterpartFormBankAccountToUpdatePayload as ee, getAchInstructions as r, getCounterpartEmail as i, getCounterpartName as a, getPayableAchInstructions as o, hasAchFormValues as s, resolveCounterpartBankAccountWrite as c, validateAchFormValues as te } from "../../../shared/counterpart-management/feature/dist/lib/helpers.js";
9
+ import { useCounterpartsQuery as ne } from "../../../shared/counterpart-management/data-access/dist/index3.js";
10
+ import { useCreateCounterpartBankAccountMutation as re, useUpdateCounterpartBankAccountMutation as ie } from "../../../shared/counterpart-management/data-access/dist/index5.js";
11
+ import { useCounterpartDetails as ae } from "../../../shared/counterpart-management/feature/dist/lib/useCounterpartDetails.js";
14
12
  import "../../../shared/counterpart-management/feature/dist/index.js";
15
- import { VendorInlineForm as se } from "./index43.js";
16
- import { useCallback as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
17
- import { jsx as ce } from "react/jsx-runtime";
13
+ import { VENDOR_SECTION_PROPS_LABELS_EN as oe } from "./index40.js";
14
+ import { buildVendorPrefill as se } from "./index42.js";
15
+ import { VendorInlineForm as ce } from "./index43.js";
16
+ import { useCallback as l, useEffect as u, useMemo as d, useRef as f, useState as p } from "react";
17
+ import { jsx as le } from "react/jsx-runtime";
18
18
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js
19
- var le = 10, h = 300, g = {
19
+ var m = 10, ue = 300, h = {
20
20
  accountHolderName: "",
21
21
  routingNumber: "",
22
22
  accountNumber: ""
23
23
  };
24
- function _({ payableId: _, counterpartId: v, payableCounterpartId: y, payableCounterpartBankAccountId: b, onCounterpartChange: x, requiredError: S, extractedVendor: C, labels: ue }) {
25
- let w = {
26
- ...n,
27
- ...ue
28
- }, [T, de] = m(""), [E, D] = m(""), [O, k] = m(), [fe, A] = m(!1), [j, M] = m(g), N = p(j);
29
- N.current = j;
30
- let [pe, P] = m(!1), F = l(j) || pe, [I, L] = m(), [R, z] = m(), B = p(v), [V, me] = m(!1), H = u(() => {
31
- A(!1), M(g), L(void 0), z(void 0);
32
- }, []), U = u((e) => {
33
- me(!0), x(e);
34
- }, [x]), W = e(_, { enabled: !!_ && !v && !y }).data?.suggested_counterpart?.id;
35
- d(() => {
36
- !V && !v && !y && W && U(W);
24
+ function g({ payableId: g, counterpartId: _, payableCounterpartId: v, payableCounterpartBankAccountId: y, onCounterpartChange: b, requiredError: de, extractedVendor: x, labels: fe }) {
25
+ let S = {
26
+ ...oe,
27
+ ...fe
28
+ }, [C, w] = p(""), [T, E] = p(""), [D, O] = p(), [pe, k] = p(!1), [A, j] = p(h), M = f(A);
29
+ M.current = A;
30
+ let [N, P] = p(!1), F = s(A) || N, [I, L] = p(), [R, z] = p(), B = f(_), [V, me] = p(!1), H = l(() => {
31
+ k(!1), j(h), L(void 0), z(void 0);
32
+ }, []), U = l((e) => {
33
+ me(!0), b(e);
34
+ }, [b]), W = e(g, { enabled: !!g && !_ && !v }).data?.suggested_counterpart?.id;
35
+ u(() => {
36
+ !V && !_ && !v && W && U(W);
37
37
  }, [
38
+ _,
38
39
  v,
39
- y,
40
40
  V,
41
41
  W,
42
42
  U
43
- ]), d(() => {
44
- B.current !== v && (B.current = v, H());
45
- }, [v, H]), d(() => {
43
+ ]), u(() => {
44
+ B.current !== _ && (B.current = _, H());
45
+ }, [_, H]), u(() => {
46
46
  let e = setTimeout(() => {
47
- D(T.trim());
48
- }, h);
47
+ E(C.trim());
48
+ }, ue);
49
49
  return () => clearTimeout(e);
50
- }, [T]);
51
- let G = re({
50
+ }, [C]);
51
+ let G = ne({
52
52
  sort: "counterpart_name",
53
53
  order: "asc",
54
- limit: le,
55
- counterpart_name__icontains: E || void 0,
54
+ limit: m,
55
+ counterpart_name__icontains: T || void 0,
56
56
  is_vendor: !0,
57
- enabled: !!E
58
- }), K = oe({ selectedId: v }), q = ie(), J = ae(), Y = f(() => {
57
+ enabled: !!T
58
+ }), K = ae({ selectedId: _ }), q = re(), J = ie(), Y = d(() => {
59
59
  let e = K.counterpart;
60
60
  if (!e) return;
61
61
  if (K.isBankAccountsLoading) return {
62
- name: s(e),
63
- email: o(e),
64
- methodLabel: w.paymentMethodLoading,
62
+ name: a(e),
63
+ email: i(e),
64
+ methodLabel: S.paymentMethodLoading,
65
65
  fields: []
66
66
  };
67
67
  if (K.isBankAccountsError) return {
68
- name: s(e),
69
- email: o(e),
70
- methodLabel: w.paymentMethodUnavailable,
68
+ name: a(e),
69
+ email: i(e),
70
+ methodLabel: S.paymentMethodUnavailable,
71
71
  fields: []
72
72
  };
73
- let n = c(K.bankAccounts);
73
+ let n = o(K.bankAccounts);
74
74
  return {
75
- name: s(e),
76
- email: o(e),
77
- methodLabel: n ? w.achMethod : w.noMethod,
75
+ name: a(e),
76
+ email: i(e),
77
+ methodLabel: n ? S.achMethod : S.noMethod,
78
78
  fields: n ? [
79
79
  {
80
- label: w.accountHolder,
80
+ label: S.accountHolder,
81
81
  value: n.account_holder_name ?? ""
82
82
  },
83
83
  {
84
- label: w.routingNumber,
84
+ label: S.routingNumber,
85
85
  value: n.routing_number ?? ""
86
86
  },
87
87
  {
88
- label: w.accountNumber,
88
+ label: S.accountNumber,
89
89
  value: n.account_number ?? "",
90
90
  maskedValue: n.account_number ? t(n.account_number) : ""
91
91
  }
@@ -96,43 +96,43 @@ function _({ payableId: _, counterpartId: v, payableCounterpartId: y, payableCou
96
96
  K.counterpart,
97
97
  K.isBankAccountsError,
98
98
  K.isBankAccountsLoading,
99
- w
100
- ]), X = f(() => a(K.bankAccounts), [K.bankAccounts]), Z = f(() => c(K.bankAccounts)?.id, [K.bankAccounts]), Q = u(async () => {
101
- let e = N.current;
102
- if (!v) return { ok: !0 };
103
- if (!l(e)) return b && v === y ? {
99
+ S
100
+ ]), X = d(() => r(K.bankAccounts), [K.bankAccounts]), Z = d(() => o(K.bankAccounts)?.id, [K.bankAccounts]), Q = l(async () => {
101
+ let e = M.current;
102
+ if (!_) return { ok: !0 };
103
+ if (!s(e)) return y && _ === v ? {
104
104
  ok: !0,
105
- counterpartBankAccountId: b
105
+ counterpartBankAccountId: y
106
106
  } : K.isBankAccountsLoading || K.isBankAccountsFetching || K.isBankAccountsError ? { ok: !1 } : {
107
107
  ok: !0,
108
108
  counterpartBankAccountId: Z
109
109
  };
110
110
  if (K.isBankAccountsLoading || K.isBankAccountsFetching || K.isBankAccountsError) return { ok: !1 };
111
- let t = ne(e);
112
- if (Object.keys(t).length > 0) return L(t), A(!0), { ok: !1 };
111
+ let t = te(e);
112
+ if (Object.keys(t).length > 0) return L(t), k(!0), { ok: !1 };
113
113
  L(void 0);
114
- let n = te(K.bankAccounts, R ?? X?.id);
115
- if (n.kind === "update") return await J.mutateAsync({
114
+ let r = c(K.bankAccounts, R ?? X?.id);
115
+ if (r.kind === "update") return await J.mutateAsync({
116
116
  path: {
117
- counterpart_id: v,
118
- bank_account_id: n.bankAccountId
117
+ counterpart_id: _,
118
+ bank_account_id: r.bankAccountId
119
119
  },
120
- body: i(e, { includeAchDefaults: n.includeAchDefaults })
121
- }), z(n.bankAccountId), {
120
+ body: ee(e, { includeAchDefaults: r.includeAchDefaults })
121
+ }), z(r.bankAccountId), {
122
122
  ok: !0,
123
- counterpartBankAccountId: n.bankAccountId
123
+ counterpartBankAccountId: r.bankAccountId
124
124
  };
125
- let r = await q.mutateAsync({
126
- path: { counterpart_id: v },
127
- body: ee(e, { isDefaultForCurrency: n.isDefaultForCurrency })
125
+ let i = await q.mutateAsync({
126
+ path: { counterpart_id: _ },
127
+ body: n(e, { isDefaultForCurrency: r.isDefaultForCurrency })
128
128
  });
129
- return z(r?.id), {
129
+ return z(i?.id), {
130
130
  ok: !0,
131
- counterpartBankAccountId: r?.id
131
+ counterpartBankAccountId: i?.id
132
132
  };
133
133
  }, [
134
134
  X,
135
- v,
135
+ _,
136
136
  q,
137
137
  K.bankAccounts,
138
138
  K.isBankAccountsError,
@@ -140,29 +140,29 @@ function _({ payableId: _, counterpartId: v, payableCounterpartId: y, payableCou
140
140
  K.isBankAccountsLoading,
141
141
  R,
142
142
  Z,
143
- b,
144
143
  y,
144
+ v,
145
145
  J
146
- ]), he = f(() => (G.data?.data ?? []).map((e) => ({
147
- name: s(e),
148
- email: o(e),
146
+ ]), he = d(() => (G.data?.data ?? []).map((e) => ({
147
+ name: a(e),
148
+ email: i(e),
149
149
  onSelect: () => U(e.id)
150
- })), [G.data, U]), ge = f(() => r(C), [C]), $ = u(() => {
151
- k(void 0), P(!1);
152
- }, []), _e = u((e) => {
153
- k(void 0), P(!1), U(e);
150
+ })), [G.data, U]), ge = d(() => se(x), [x]), $ = l(() => {
151
+ O(void 0), P(!1);
152
+ }, []), _e = l((e) => {
153
+ O(void 0), P(!1), U(e);
154
154
  }, [U]);
155
- if (O) return {
155
+ if (D) return {
156
156
  mode: "creating",
157
- newVendorForm: /* @__PURE__ */ ce(se, {
158
- mode: O,
159
- counterpart: O === "edit" ? K.counterpart : void 0,
160
- primaryAddress: O === "edit" ? K.primaryAddress : void 0,
161
- bankAccounts: O === "edit" ? K.bankAccounts : void 0,
162
- isBankAccountsLoading: O === "edit" ? K.isBankAccountsLoading : void 0,
163
- isBankAccountsError: O === "edit" ? K.isBankAccountsError : void 0,
164
- initialName: O === "create" ? T : void 0,
165
- initialValues: O === "create" ? ge : void 0,
157
+ newVendorForm: /* @__PURE__ */ le(ce, {
158
+ mode: D,
159
+ counterpart: D === "edit" ? K.counterpart : void 0,
160
+ primaryAddress: D === "edit" ? K.primaryAddress : void 0,
161
+ bankAccounts: D === "edit" ? K.bankAccounts : void 0,
162
+ isBankAccountsLoading: D === "edit" ? K.isBankAccountsLoading : void 0,
163
+ isBankAccountsError: D === "edit" ? K.isBankAccountsError : void 0,
164
+ initialName: D === "create" ? C : void 0,
165
+ initialValues: D === "create" ? ge : void 0,
166
166
  onSaved: _e,
167
167
  onCancel: $,
168
168
  onDirtyChange: P
@@ -175,21 +175,21 @@ function _({ payableId: _, counterpartId: v, payableCounterpartId: y, payableCou
175
175
  return {
176
176
  mode: "resolved",
177
177
  summary: Y,
178
- onEdit: e ? void 0 : () => k("edit"),
178
+ onEdit: e ? void 0 : () => O("edit"),
179
179
  onClear: () => U(void 0),
180
180
  paymentInstructions: e ? void 0 : {
181
- isOpen: fe,
182
- values: j,
181
+ isOpen: pe,
182
+ values: A,
183
183
  errors: I,
184
184
  onOpen: () => {
185
- A(!0), X && (M({
185
+ k(!0), X && (j({
186
186
  accountHolderName: X.account_holder_name ?? "",
187
187
  routingNumber: X.routing_number ?? "",
188
188
  accountNumber: X.account_number ?? ""
189
189
  }), z(X.id));
190
190
  },
191
191
  onChange: (e) => {
192
- M((t) => ({
192
+ j((t) => ({
193
193
  ...t,
194
194
  ...e
195
195
  })), L(void 0);
@@ -201,12 +201,12 @@ function _({ payableId: _, counterpartId: v, payableCounterpartId: y, payableCou
201
201
  }
202
202
  return {
203
203
  mode: "selecting",
204
- error: G.isError ? w.searchFailed : K.isError ? w.vendorDetailsFailed : S,
204
+ error: G.isError ? S.searchFailed : K.isError ? S.vendorDetailsFailed : de,
205
205
  search: {
206
- query: T,
207
- onQueryChange: de,
206
+ query: C,
207
+ onQueryChange: w,
208
208
  isLoading: G.isLoading,
209
- onAddVendor: () => k("create"),
209
+ onAddVendor: () => O("create"),
210
210
  results: he
211
211
  },
212
212
  savePaymentInstructions: Q,
@@ -214,4 +214,4 @@ function _({ payableId: _, counterpartId: v, payableCounterpartId: y, payableCou
214
214
  };
215
215
  }
216
216
  //#endregion
217
- export { _ as useVendorSectionProps };
217
+ export { g as useVendorSectionProps };