@tesouro/embedded-components-react 0.5.280 → 0.5.282

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 (53) hide show
  1. package/dist/index.css +8 -0
  2. package/dist/index.d.ts +2 -2
  3. package/dist/lib/BankAccountOnboardingWidget.d.ts +2 -2
  4. package/dist/lib/WidgetSuite.d.ts +2 -2
  5. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/BankAccountOnboardingWidget/labels.js +2 -2
  6. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/ui/dist/index30.js +1 -1
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index18.js +1 -0
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index.js +6 -6
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index13.js +8 -8
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index14.js +7 -28
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index15.js +8 -160
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index16.js +20 -13
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index17.js +148 -27
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index18.js +21 -96
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index19.js +37 -79
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index20.js +98 -3
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index21.js +83 -54
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index22.js +3 -113
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index23.js +54 -184
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index24.js +108 -75
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index25.js +181 -29
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index26.js +74 -83
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index27.js +27 -412
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index28.js +88 -12
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index29.js +413 -77
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index30.js +13 -80
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index31.js +77 -226
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index32.js +78 -41
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index33.js +216 -234
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index34.js +44 -23
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index35.js +233 -611
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index36.js +25 -4
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index37.js +647 -39
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index38.js +4 -243
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index39.js +42 -3
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index40.js +250 -3
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index41.js +2 -66
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index42.js +5 -1
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index43.js +67 -0
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index44.js +1 -0
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index12.js +11 -11
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index15.js +47 -47
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/lib/invalidatePayableQueries/invalidatePayableQueries.js +2 -2
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/lib/invalidatePayableQueries/reconcileCancelledPaymentQueries.js +19 -19
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidgetNative/BillsTab.js +1 -1
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/pay-bill/data-access/dist/index4.js +15 -15
  47. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index22.js +1 -1
  48. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/zod.gen.js +2 -0
  49. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/user/useAllOrganizationUsersQuery.js +1 -0
  50. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  51. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/OnboardingShell/OnboardingShell.js +1 -1
  52. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/OnboardingShell/labels.js +2 -2
  53. package/package.json +1 -1
package/dist/index.css CHANGED
@@ -4957,6 +4957,14 @@
4957
4957
  .ttw\:hover\:\!text-sidebar-accent-foreground:hover {
4958
4958
  color: var(--ttw-sidebar-accent-foreground) !important;
4959
4959
  }
4960
+ .ttw\:hover\:text-\[color-mix\(in_srgb\,var\(--ttw-destructive\)\,black_10\%\)\]:hover {
4961
+ color: var(--ttw-destructive);
4962
+ }
4963
+ @supports (color: color-mix(in lab, red, red)) {
4964
+ .ttw\:hover\:text-\[color-mix\(in_srgb\,var\(--ttw-destructive\)\,black_10\%\)\]:hover {
4965
+ color: color-mix(in srgb,var(--ttw-destructive),black 10%);
4966
+ }
4967
+ }
4960
4968
  .ttw\:hover\:text-accent-foreground:hover {
4961
4969
  color: var(--ttw-accent-foreground);
4962
4970
  }
package/dist/index.d.ts CHANGED
@@ -1969,7 +1969,7 @@ interface BankAccountOnboardingWidgetLabels {
1969
1969
  /** The prompt shown when closing with unsaved changes. */
1970
1970
  unsavedApplicationDialog: Partial<UnsavedApplicationDialogLabels>;
1971
1971
  /**
1972
- * The prompt confirming "Cancel and delete application". Its bold run
1972
+ * The prompt confirming "Delete". Its bold run
1973
1973
  * defaults to `saveAndClose`, so it names the footer's save control.
1974
1974
  */
1975
1975
  deleteApplicationDialog: Partial<DeleteApplicationDialogLabels>;
@@ -1982,7 +1982,7 @@ interface BankAccountOnboardingWidgetLabels {
1982
1982
  deleteApplication: string;
1983
1983
  /** Shown once the application has been deleted. */
1984
1984
  applicationDeletedToast: string;
1985
- /** Shown after "Save and close" or the close prompt's "Save changes" writes the application. */
1985
+ /** Shown after "Save and continue later" or the close prompt's "Save changes" writes the application. */
1986
1986
  applicationSavedToast: string;
1987
1987
  businessReviewTitle: string;
1988
1988
  businessReviewSubtitle: string;
@@ -1037,7 +1037,7 @@ interface BankAccountOnboardingWidgetLabels {
1037
1037
  /** The prompt shown when closing with unsaved changes. */
1038
1038
  unsavedApplicationDialog: Partial<UnsavedApplicationDialogLabels>;
1039
1039
  /**
1040
- * The prompt confirming "Cancel and delete application". Its bold run
1040
+ * The prompt confirming "Delete". Its bold run
1041
1041
  * defaults to `saveAndClose`, so it names the footer's save control.
1042
1042
  */
1043
1043
  deleteApplicationDialog: Partial<DeleteApplicationDialogLabels>;
@@ -1050,7 +1050,7 @@ interface BankAccountOnboardingWidgetLabels {
1050
1050
  deleteApplication: string;
1051
1051
  /** Shown once the application has been deleted. */
1052
1052
  applicationDeletedToast: string;
1053
- /** Shown after "Save and close" or the close prompt's "Save changes" writes the application. */
1053
+ /** Shown after "Save and continue later" or the close prompt's "Save changes" writes the application. */
1054
1054
  applicationSavedToast: string;
1055
1055
  businessReviewTitle: string;
1056
1056
  businessReviewSubtitle: string;
@@ -1086,7 +1086,7 @@ interface BankAccountOnboardingWidgetLabels {
1086
1086
  /** The prompt shown when closing with unsaved changes. */
1087
1087
  unsavedApplicationDialog: Partial<UnsavedApplicationDialogLabels>;
1088
1088
  /**
1089
- * The prompt confirming "Cancel and delete application". Its bold run
1089
+ * The prompt confirming "Delete". Its bold run
1090
1090
  * defaults to `saveAndClose`, so it names the footer's save control.
1091
1091
  */
1092
1092
  deleteApplicationDialog: Partial<DeleteApplicationDialogLabels>;
@@ -1099,7 +1099,7 @@ interface BankAccountOnboardingWidgetLabels {
1099
1099
  deleteApplication: string;
1100
1100
  /** Shown once the application has been deleted. */
1101
1101
  applicationDeletedToast: string;
1102
- /** Shown after "Save and close" or the close prompt's "Save changes" writes the application. */
1102
+ /** Shown after "Save and continue later" or the close prompt's "Save changes" writes the application. */
1103
1103
  applicationSavedToast: string;
1104
1104
  businessReviewTitle: string;
1105
1105
  businessReviewSubtitle: string;
@@ -59,8 +59,8 @@ var n = {
59
59
  cancel: "Cancel",
60
60
  next: "Next",
61
61
  submit: "Submit application",
62
- saveAndClose: "Save and close",
63
- deleteApplication: "Cancel and delete application",
62
+ saveAndClose: "Save and continue later",
63
+ deleteApplication: "Delete",
64
64
  applicationDeletedToast: "Application deleted.",
65
65
  applicationSavedToast: "Application saved. You can continue later.",
66
66
  businessReviewTitle: "Review your business details",
@@ -2,7 +2,7 @@
2
2
  var e = {
3
3
  title: "Delete this application?",
4
4
  descriptionBeforeEmphasis: "Everything you've entered so far will be permanently removed. If you'd rather come back later, use ",
5
- descriptionEmphasis: "Save and close",
5
+ descriptionEmphasis: "Save and continue later",
6
6
  descriptionAfterEmphasis: " instead.",
7
7
  keepEditingButton: "Keep editing",
8
8
  deleteButton: "Delete application"
@@ -29,6 +29,7 @@ function d(d, { enabled: f } = {}) {
29
29
  organizationStatus: _
30
30
  }, { suffix: ["all"] }),
31
31
  enabled: y,
32
+ staleTime: 3e4,
32
33
  initialPageParam: void 0,
33
34
  queryFn: async ({ signal: t, pageParam: n }) => {
34
35
  let { data: r } = await e({
@@ -1,12 +1,12 @@
1
- import "./index18.js";
2
- import "./index23.js";
3
- import "./index31.js";
1
+ import "./index20.js";
2
+ import "./index25.js";
4
3
  import "./index33.js";
5
4
  import "./index35.js";
6
- import "./index36.js";
7
5
  import "./index37.js";
8
6
  import "./index38.js";
9
7
  import "./index39.js";
10
- import { BillCreateWidget as e, BillDetailsWidget as t } from "./index41.js";
11
- import "./index42.js";
8
+ import "./index40.js";
9
+ import "./index41.js";
10
+ import { BillCreateWidget as e, BillDetailsWidget as t } from "./index43.js";
11
+ import "./index44.js";
12
12
  export { e as BillCreateWidget, t as BillDetailsWidget };
@@ -1,13 +1,13 @@
1
- import { formatRejectionDate as e } from "../../../../shared/util/dist/lib/formatRejectionDate.js";
2
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index13.js
3
- function t({ payableStatus: t, approvalRequests: n, userNames: r, payableUpdatedAt: i, labels: a, now: o }) {
4
- let s = n.find((e) => e.status === "rejected");
5
- if (!s) return t !== "rejected" || !i ? void 0 : { actorLabel: a.rejectedOn(e(i, o)) };
6
- let c = s.rejected_by ? r.get(s.rejected_by) : void 0, l = e(s.updated_at, o);
2
+ function e({ isCapabilityUnknown: e, canApproveNow: t, canOverridePolicy: n, status: r, hasApprovalPolicy: i, pendingApproverNames: a, labels: o }) {
3
+ if (e) return { showApprovalOverrideNotice: !1 };
4
+ if (n) return { showApprovalOverrideNotice: !t };
5
+ if (t || r !== "approve_in_progress" || !i) return { showApprovalOverrideNotice: !1 };
6
+ let s = [...new Set(a)];
7
7
  return {
8
- actorLabel: c ? a.rejectedByOn(c, l) : a.rejectedOn(l),
9
- message: s.reject_reason ? a.rejectionMessage(s.reject_reason) : void 0
8
+ showApprovalOverrideNotice: !1,
9
+ awaitingApprovalNotice: s.length ? o.awaitingApprovalNotice(s) : o.awaitingApprovalUnknownNotice
10
10
  };
11
11
  }
12
12
  //#endregion
13
- export { t as resolveBillRejectionNotice };
13
+ export { e as resolveApprovalNotices };
@@ -1,33 +1,12 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { hasAnyScope as e } from "../../../../shared/data-access/dist/lib/hasAnyScope.js";
6
- import { useCurrentUserQuery as t } from "../../../../shared/data-access/dist/lib/useCurrentUserQuery.js";
7
- import { Scope as n } from "../../../../shared/data-access/dist/lib/scopes.js";
8
- import "../../../../shared/data-access/dist/index.js";
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/index2.js";
12
- import "../../data-access/dist/index.js";
13
- import { currentApprovalRound as a } from "./index3.js";
14
- import { usePayableApprovalRoundStart as o } from "./index11.js";
15
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index14.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, { roundStartedAt: f } = o({
18
- payableId: s,
19
- enabled: d
20
- }), p = t({ enabled: d }), m = p.data?.id, h = (e) => e.caller_is_policy_approver ?? !!(m && e.user_ids.includes(m)), g = i(s, {
21
- enabled: d,
22
- hasAwaitedRequest: d ? (e) => a(e, f).some(h) : void 0,
23
- currentRoundStartedAt: f
24
- }), _ = d ? a(g.data?.data, f) : [], v = _.some(h), y = _.filter((e) => e.status === "waiting");
2
+ function e(e, t) {
3
+ if (!e) return;
4
+ let { onOpen: n, canEditExisting: r, ...i } = e;
25
5
  return {
26
- id: y.filter(h).find((e) => !(m && (e.approved_by ?? []).includes(m)))?.id,
27
- isPolicyApprover: v,
28
- hasWaitingRequest: y.length > 0,
29
- isLoading: g.isLoading || p.isLoading
6
+ ...i,
7
+ onEditExisting: t && r ? n : void 0,
8
+ onAdd: t ? void 0 : n
30
9
  };
31
10
  }
32
11
  //#endregion
33
- export { s as useCurrentApprovalRequestId };
12
+ export { e as resolvePaymentInstructionsGestures };
@@ -1,165 +1,13 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { toast as e } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
6
- import "../../../../shared/ui/dist/index.js";
7
- import { useWidgetConfig as t } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
8
- import "../../../../shared/feature/dist/index.js";
9
- import { useApprovePayableApprovalRequestMutation as n, useRejectPayableApprovalRequestMutation as r } from "../../data-access/dist/index2.js";
10
- import { useCancelPayableMutation as i } from "../../data-access/dist/index6.js";
11
- import { useCancelScheduledPaymentMutation as a } from "../../data-access/dist/index7.js";
12
- import { useForceApprovePayableMutation as o } from "../../data-access/dist/index11.js";
13
- import { useForceRejectPayableMutation as s } from "../../data-access/dist/index12.js";
14
- import { useReopenPayableMutation as c } from "../../data-access/dist/index13.js";
15
- import "../../data-access/dist/index.js";
16
- import { getBillDetailActions as l } from "./index7.js";
17
- import { useState as u } from "react";
18
- import { BanIcon as d, HandIcon as f } from "lucide-react";
1
+ import { formatRejectionDate as e } from "../../../../shared/util/dist/lib/formatRejectionDate.js";
19
2
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index15.js
20
- function p({ payableId: d, status: f, currentApprovalRequestId: p, arePendingApproversUnknown: m, hasScheduledPayment: h, scheduledPaymentIntentId: g, isScheduledPaymentUnknown: v, isPayabilityUnknown: x, labels: S, isMarkAsPaidPending: C, hasApprovalPolicy: w = !0, hasWaitingRequest: T, pendingApprovers: E, onPayBillSelect: D, onMarkAsPaidSelect: O, onEditSelect: k, onActionSucceeded: A }) {
21
- let { initResponse: j } = t(), M = r(), N = n(), P = i(), F = a(), I = c(), L = o(), R = s(), z = C || M.isPending || N.isPending || P.isPending || F.isPending || I.isPending || L.isPending || R.isPending, [B, V] = u(), H = B && (B.id !== "cancelScheduledPayment" || B.scheduledPaymentIntentId === g) ? B : void 0, U = d && f ? l({
22
- status: f,
23
- scopes: j?.scopes,
24
- canDecideApprovalRequest: !!p,
25
- arePendingApproversUnknown: m,
26
- hasApprovalPolicy: w,
27
- hasWaitingRequest: T,
28
- hasScheduledPayment: h || v,
29
- scheduledPaymentIntentId: g,
30
- isPayabilityUnknown: x,
31
- canEdit: !!k,
32
- labels: S
33
- }) : [], W = (t) => ({
34
- onError: () => e.error(S.actionError),
35
- onSuccess: () => {
36
- let n = b(t) && !w ? `${t}NoApprovalPolicy` : t;
37
- e.success(S.actionSuccess[n]), A?.(t);
38
- }
39
- }), G = {
40
- reject: {
41
- isPending: M.isPending,
42
- run: (e) => p && M.mutate({
43
- path: { approval_request_id: p },
44
- body: e ? { reject_reason: e } : void 0
45
- }, W("reject"))
46
- },
47
- approve: {
48
- isPending: N.isPending,
49
- run: () => p && N.mutate({ path: { approval_request_id: p } }, W("approve"))
50
- },
51
- cancel: {
52
- isPending: P.isPending,
53
- run: () => d && P.mutate({ path: { payable_id: d } }, W("cancel"))
54
- },
55
- cancelScheduledPayment: {
56
- isPending: F.isPending,
57
- run: () => {
58
- let e = H?.scheduledPaymentIntentId;
59
- d && e && F.mutate({
60
- path: { payment_intent_id: e },
61
- payableId: d
62
- }, W("cancelScheduledPayment"));
63
- }
64
- },
65
- reopen: {
66
- isPending: I.isPending,
67
- run: () => d && I.mutate({ path: { payable_id: d } }, W("reopen"))
68
- },
69
- forceApprove: {
70
- isPending: L.isPending,
71
- run: () => d && L.mutate({ path: { payable_id: d } }, W("forceApprove"))
72
- },
73
- forceReject: {
74
- isPending: R.isPending,
75
- run: () => d && R.mutate({ path: { payable_id: d } }, W("forceReject"))
76
- }
77
- }, K = U.map((e) => ({
78
- ...e,
79
- disabled: z,
80
- loading: e.id === "markAsPaid" ? C : G[e.id]?.isPending ?? !1,
81
- onSelect: () => {
82
- if (!z && d) {
83
- if (e.id === "payBill") {
84
- D();
85
- return;
86
- }
87
- if (e.id === "markAsPaid") {
88
- O();
89
- return;
90
- }
91
- if (e.id === "edit") {
92
- k?.();
93
- return;
94
- }
95
- if (y(e.id)) {
96
- V({
97
- id: e.id,
98
- scheduledPaymentIntentId: g
99
- });
100
- return;
101
- }
102
- G[e.id]?.run();
103
- }
104
- }
105
- }));
3
+ function t({ payableStatus: t, approvalRequests: n, userNames: r, payableUpdatedAt: i, labels: a, now: o }) {
4
+ let s = n.find((e) => e.status === "rejected");
5
+ if (!s) return t !== "rejected" || !i ? void 0 : { actorLabel: a.rejectedOn(e(i, o)) };
6
+ let c = s.rejected_by ? r.get(s.rejected_by) : void 0, l = e(s.updated_at, o);
106
7
  return {
107
- isActionPending: z,
108
- actions: {
109
- row: K.filter((e) => e.surface === "row"),
110
- menu: K.filter((e) => e.surface === "menu")
111
- },
112
- decisionDialog: {
113
- open: !!H,
114
- copy: H ? {
115
- ...S.decisionDialog[H.id],
116
- ...b(H.id) && !w ? S.decisionDialog[H.id].noApprovalPolicy : void 0,
117
- presentation: _(H.id),
118
- pendingApprovers: b(H.id) ? E ?? [] : void 0
119
- } : void 0,
120
- isPending: H ? G[H.id]?.isPending ?? !1 : !1,
121
- onCancel: () => {
122
- z || V(void 0);
123
- },
124
- onConfirm: (e) => {
125
- H && !z && (G[H.id]?.run(e), V(void 0));
126
- }
127
- }
8
+ actorLabel: c ? a.rejectedByOn(c, l) : a.rejectedOn(l),
9
+ message: s.reject_reason ? a.rejectionMessage(s.reject_reason) : void 0
128
10
  };
129
11
  }
130
- var m = {
131
- alignment: "center",
132
- icon: f,
133
- tone: "destructive",
134
- actionWidth: "equal"
135
- }, h = {
136
- alignment: "center",
137
- icon: d,
138
- tone: "destructive",
139
- actionWidth: "equal"
140
- }, g = {
141
- alignment: "center",
142
- icon: d,
143
- tone: "destructive",
144
- actionWidth: "equal"
145
- };
146
- function _(e) {
147
- if (b(e)) return m;
148
- if (e === "reject") return h;
149
- if (e === "cancel") return g;
150
- }
151
- var v = [
152
- "reject",
153
- "cancel",
154
- "cancelScheduledPayment",
155
- "forceApprove",
156
- "forceReject"
157
- ];
158
- function y(e) {
159
- return v.includes(e);
160
- }
161
- function b(e) {
162
- return e === "forceApprove" || e === "forceReject";
163
- }
164
12
  //#endregion
165
- export { p as usePayableDetailActions };
13
+ export { t as resolveBillRejectionNotice };
@@ -3,24 +3,31 @@
3
3
  "use client";
4
4
  "use client";
5
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";
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";
7
8
  import "../../../../shared/data-access/dist/index.js";
8
- import { useWidgetConfig as n } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
9
+ import { useWidgetConfig as r } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
9
10
  import "../../../../shared/feature/dist/index.js";
10
- import { isLiveScheduledPaymentRecord as r } from "../../../util/dist/lib/isLiveScheduledPaymentRecord.js";
11
- import { usePayablePaymentRecordsQuery as i } from "../../data-access/dist/index18.js";
11
+ import { usePayableApprovalRequestsQuery as i } from "../../data-access/dist/index2.js";
12
12
  import "../../data-access/dist/index.js";
13
+ import { currentApprovalRound as a } from "./index3.js";
14
+ import { usePayableApprovalRoundStart as o } from "./index11.js";
13
15
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index16.js
14
- function a({ payableId: a, scheduledPaymentDate: o, enabled: s = !0 }) {
15
- let { initResponse: c } = n(), l = e(c?.scopes, [t.PaymentRecordReadOrg]), u = i(s ? a : void 0, { enabled: s && l }), d = u.paymentRecords.find(r), f = !!d || !!o, p = d?.planned_payment_date ?? (f ? o : void 0);
16
+ function s({ payableId: s, status: c }) {
17
+ let { initResponse: l } = r(), u = e(l?.scopes, [n.ApprovalRequestReadOrg]), d = c === "approve_in_progress" && u, { roundStartedAt: f } = o({
18
+ payableId: s,
19
+ enabled: d
20
+ }), p = t({ enabled: d }), m = p.data?.id, h = (e) => e.caller_is_policy_approver ?? !!(m && e.user_ids.includes(m)), g = i(s, {
21
+ enabled: d,
22
+ hasAwaitedRequest: d ? (e) => a(e, f).some(h) : void 0,
23
+ currentRoundStartedAt: f
24
+ }), _ = d ? a(g.data?.data, f) : [], v = _.some(h), y = _.filter((e) => e.status === "waiting");
16
25
  return {
17
- hasScheduledPayment: f,
18
- paymentRecords: u.paymentRecords,
19
- isError: u.isError,
20
- isResolving: u.isResolving,
21
- scheduledDate: p ?? void 0,
22
- scheduledPaymentIntentId: d?.payment_intent_id ?? void 0
26
+ id: y.filter(h).find((e) => !(m && (e.approved_by ?? []).includes(m)))?.id,
27
+ isPolicyApprover: v,
28
+ hasWaitingRequest: y.length > 0,
29
+ isLoading: g.isLoading || p.isLoading
23
30
  };
24
31
  }
25
32
  //#endregion
26
- export { a as useScheduledPayment };
33
+ export { s as useCurrentApprovalRequestId };
@@ -3,42 +3,163 @@
3
3
  "use client";
4
4
  "use client";
5
5
  import { toast as e } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
6
- import { hasAnyScope as t } from "../../../../shared/data-access/dist/lib/hasAnyScope.js";
7
- import { Scope as n } from "../../../../shared/data-access/dist/lib/scopes.js";
8
- import "../../../../shared/data-access/dist/index.js";
9
6
  import "../../../../shared/ui/dist/index.js";
10
- import { useWidgetConfig as r } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
7
+ import { useWidgetConfig as t } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
11
8
  import "../../../../shared/feature/dist/index.js";
12
- import { useDeletePayableMutation as i } from "../../data-access/dist/index10.js";
9
+ import { useApprovePayableApprovalRequestMutation as n, useRejectPayableApprovalRequestMutation as r } from "../../data-access/dist/index2.js";
10
+ import { useCancelPayableMutation as i } from "../../data-access/dist/index6.js";
11
+ import { useCancelScheduledPaymentMutation as a } from "../../data-access/dist/index7.js";
12
+ import { useForceApprovePayableMutation as o } from "../../data-access/dist/index11.js";
13
+ import { useForceRejectPayableMutation as s } from "../../data-access/dist/index12.js";
14
+ import { useReopenPayableMutation as c } from "../../data-access/dist/index13.js";
13
15
  import "../../data-access/dist/index.js";
14
- import { useState as a } from "react";
16
+ import { getBillDetailActions as l } from "./index7.js";
17
+ import { useState as u } from "react";
18
+ import { BanIcon as d, HandIcon as f } from "lucide-react";
15
19
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index17.js
16
- function o({ payableId: o, status: s, enabled: c = !0, labels: l, onDeleted: u }) {
17
- let { initResponse: d } = r(), f = i(), [p, m] = a(!1), h = t(d?.scopes, [n.PayableWriteOrg]), g = !!(c && o && s === "draft" && h), _ = g ? [{
18
- id: "deleteDraft",
19
- label: l.menuItem,
20
- destructive: !0,
21
- onSelect: () => m(!0)
22
- }] : [], v = p && g;
20
+ function p({ payableId: d, status: f, currentApprovalRequestId: p, arePendingApproversUnknown: m, hasScheduledPayment: h, scheduledPaymentIntentId: g, isScheduledPaymentUnknown: v, isPayabilityUnknown: x, labels: S, isMarkAsPaidPending: C, hasApprovalPolicy: w = !0, hasWaitingRequest: T, pendingApprovers: E, onPayBillSelect: D, onMarkAsPaidSelect: O, onEditSelect: k, onActionSucceeded: A }) {
21
+ let { initResponse: j } = t(), M = r(), N = n(), P = i(), F = a(), I = c(), L = o(), R = s(), z = C || M.isPending || N.isPending || P.isPending || F.isPending || I.isPending || L.isPending || R.isPending, [B, V] = u(), H = B && (B.id !== "cancelScheduledPayment" || B.scheduledPaymentIntentId === g) ? B : void 0, U = d && f ? l({
22
+ status: f,
23
+ scopes: j?.scopes,
24
+ canDecideApprovalRequest: !!p,
25
+ arePendingApproversUnknown: m,
26
+ hasApprovalPolicy: w,
27
+ hasWaitingRequest: T,
28
+ hasScheduledPayment: h || v,
29
+ scheduledPaymentIntentId: g,
30
+ isPayabilityUnknown: x,
31
+ canEdit: !!k,
32
+ labels: S
33
+ }) : [], W = (t) => ({
34
+ onError: () => e.error(S.actionError),
35
+ onSuccess: () => {
36
+ let n = b(t) && !w ? `${t}NoApprovalPolicy` : t;
37
+ e.success(S.actionSuccess[n]), A?.(t);
38
+ }
39
+ }), G = {
40
+ reject: {
41
+ isPending: M.isPending,
42
+ run: (e) => p && M.mutate({
43
+ path: { approval_request_id: p },
44
+ body: e ? { reject_reason: e } : void 0
45
+ }, W("reject"))
46
+ },
47
+ approve: {
48
+ isPending: N.isPending,
49
+ run: () => p && N.mutate({ path: { approval_request_id: p } }, W("approve"))
50
+ },
51
+ cancel: {
52
+ isPending: P.isPending,
53
+ run: () => d && P.mutate({ path: { payable_id: d } }, W("cancel"))
54
+ },
55
+ cancelScheduledPayment: {
56
+ isPending: F.isPending,
57
+ run: () => {
58
+ let e = H?.scheduledPaymentIntentId;
59
+ d && e && F.mutate({
60
+ path: { payment_intent_id: e },
61
+ payableId: d
62
+ }, W("cancelScheduledPayment"));
63
+ }
64
+ },
65
+ reopen: {
66
+ isPending: I.isPending,
67
+ run: () => d && I.mutate({ path: { payable_id: d } }, W("reopen"))
68
+ },
69
+ forceApprove: {
70
+ isPending: L.isPending,
71
+ run: () => d && L.mutate({ path: { payable_id: d } }, W("forceApprove"))
72
+ },
73
+ forceReject: {
74
+ isPending: R.isPending,
75
+ run: () => d && R.mutate({ path: { payable_id: d } }, W("forceReject"))
76
+ }
77
+ }, K = U.map((e) => ({
78
+ ...e,
79
+ disabled: z,
80
+ loading: e.id === "markAsPaid" ? C : G[e.id]?.isPending ?? !1,
81
+ onSelect: () => {
82
+ if (!z && d) {
83
+ if (e.id === "payBill") {
84
+ D();
85
+ return;
86
+ }
87
+ if (e.id === "markAsPaid") {
88
+ O();
89
+ return;
90
+ }
91
+ if (e.id === "edit") {
92
+ k?.();
93
+ return;
94
+ }
95
+ if (y(e.id)) {
96
+ V({
97
+ id: e.id,
98
+ scheduledPaymentIntentId: g
99
+ });
100
+ return;
101
+ }
102
+ G[e.id]?.run();
103
+ }
104
+ }
105
+ }));
23
106
  return {
24
- menuItems: _,
25
- dialog: {
26
- open: v,
27
- copy: v ? l.dialog : void 0,
28
- isPending: f.isPending,
107
+ isActionPending: z,
108
+ actions: {
109
+ row: K.filter((e) => e.surface === "row"),
110
+ menu: K.filter((e) => e.surface === "menu")
111
+ },
112
+ decisionDialog: {
113
+ open: !!H,
114
+ copy: H ? {
115
+ ...S.decisionDialog[H.id],
116
+ ...b(H.id) && !w ? S.decisionDialog[H.id].noApprovalPolicy : void 0,
117
+ presentation: _(H.id),
118
+ pendingApprovers: b(H.id) ? E ?? [] : void 0
119
+ } : void 0,
120
+ isPending: H ? G[H.id]?.isPending ?? !1 : !1,
29
121
  onCancel: () => {
30
- f.isPending || m(!1);
122
+ z || V(void 0);
31
123
  },
32
- onConfirm: () => {
33
- g && o && !f.isPending && f.mutate({ path: { payable_id: o } }, {
34
- onError: () => e.error(l.error),
35
- onSuccess: () => {
36
- m(!1), u();
37
- }
38
- });
124
+ onConfirm: (e) => {
125
+ H && !z && (G[H.id]?.run(e), V(void 0));
39
126
  }
40
127
  }
41
128
  };
42
129
  }
130
+ var m = {
131
+ alignment: "center",
132
+ icon: f,
133
+ tone: "destructive",
134
+ actionWidth: "equal"
135
+ }, h = {
136
+ alignment: "center",
137
+ icon: d,
138
+ tone: "destructive",
139
+ actionWidth: "equal"
140
+ }, g = {
141
+ alignment: "center",
142
+ icon: d,
143
+ tone: "destructive",
144
+ actionWidth: "equal"
145
+ };
146
+ function _(e) {
147
+ if (b(e)) return m;
148
+ if (e === "reject") return h;
149
+ if (e === "cancel") return g;
150
+ }
151
+ var v = [
152
+ "reject",
153
+ "cancel",
154
+ "cancelScheduledPayment",
155
+ "forceApprove",
156
+ "forceReject"
157
+ ];
158
+ function y(e) {
159
+ return v.includes(e);
160
+ }
161
+ function b(e) {
162
+ return e === "forceApprove" || e === "forceReject";
163
+ }
43
164
  //#endregion
44
- export { o as useDraftDelete };
165
+ export { p as usePayableDetailActions };