@tesouro/embedded-components-react 0.5.169 → 0.5.170

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 (129) hide show
  1. package/dist/index.css +39 -17
  2. package/dist/index.js +1 -1
  3. package/dist/lib/BillPayWidget.js +1 -1
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index.js +11 -11
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index17.js +95 -80
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index7.js +37 -11
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +13 -15
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +56 -67
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js +4 -43
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +6 -115
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js +202 -63
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +2 -4
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +1 -1
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +84 -4
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +3 -84
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +5 -4
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +4 -5
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +32 -3
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +36 -30
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +167 -35
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +40 -164
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +1 -49
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +50 -1
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +11 -45
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +8 -13
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +14 -8
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +59 -7
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +8 -64
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +24 -8
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +150 -18
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +9 -152
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +25 -9
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +19 -21
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +32 -14
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +14 -39
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +8 -16
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +4 -8
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +98 -4
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +68 -83
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +3 -83
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +143 -3
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +44 -143
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +114 -45
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +189 -111
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js +13 -0
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +72 -186
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +31 -76
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +89 -32
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +406 -83
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +12 -411
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +84 -12
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +67 -72
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +222 -73
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +37 -223
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +245 -37
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +5 -23
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +23 -252
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +626 -21
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +4 -586
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +45 -4
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +256 -41
  62. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +3 -263
  63. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +4 -3
  64. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +44 -2
  65. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +1 -46
  66. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +8 -1
  67. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +22 -57
  68. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +11 -6
  69. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js +130 -11
  70. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +3 -132
  71. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +6 -3
  72. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js +129 -3
  73. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +8 -124
  74. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js +7 -8
  75. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index77.js +82 -8
  76. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index78.js +19 -48
  77. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index79.js +20 -21
  78. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +14 -6
  79. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index80.js +28 -19
  80. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index81.js +82 -27
  81. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index82.js +47 -83
  82. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index83.js +260 -47
  83. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index84.js +24 -251
  84. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index85.js +382 -25
  85. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index86.js +294 -144
  86. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index87.js +4 -223
  87. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index88.js +7 -4
  88. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index89.js +112 -5
  89. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +37 -5
  90. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index90.js +1 -114
  91. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index91.js +26 -0
  92. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +18 -21
  93. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index100.js +126 -10
  94. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index101.js +1 -105
  95. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index102.js +33 -2
  96. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index103.js +7 -28
  97. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index104.js +126 -73
  98. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index105.js +1 -1
  99. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index106.js +11 -30
  100. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index107.js +106 -8
  101. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index108.js +2 -181
  102. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index109.js +10 -2
  103. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index110.js +50 -12
  104. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index111.js +2 -108
  105. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index38.js +6 -0
  106. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index46.js +8 -4
  107. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index73.js +8 -1
  108. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index74.js +154 -23
  109. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index83.js +1 -0
  110. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index84.js +343 -250
  111. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index90.js +5 -123
  112. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index91.js +28 -26
  113. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index92.js +2 -94
  114. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index93.js +7 -2
  115. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index94.js +32 -5
  116. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index95.js +2 -30
  117. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index96.js +12 -2
  118. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index97.js +104 -5
  119. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index98.js +2 -34
  120. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index99.js +31 -2
  121. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  122. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index8.js +1 -1
  123. package/dist/packages/shared-ui-shadcn/dist/index.js +2458 -2284
  124. package/package.json +2 -1
  125. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index92.js +0 -27
  126. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index112.js +0 -2
  127. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index113.js +0 -10
  128. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index114.js +0 -52
  129. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index115.js +0 -2
@@ -2,28 +2,160 @@
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 { 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";
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";
10
8
  import "../../../shared/feature/dist/index.js";
11
- import { usePayableApprovalRequestsQuery as i } from "../../data-access/dist/index8.js";
9
+ import { useApprovePayableApprovalRequestMutation as n, useRejectPayableApprovalRequestMutation as r } from "../../data-access/dist/index8.js";
10
+ import { useCancelPayableMutation as i, useCancelScheduledPaymentMutation as a, useForceApprovePayableMutation as o, useForceRejectPayableMutation as s, useReopenPayableMutation as c } from "../../data-access/dist/index13.js";
12
11
  import "../../data-access/dist/index.js";
13
- import { currentApprovalRound as a } from "./index4.js";
14
- import { usePayableApprovalRoundStart as o } from "./index32.js";
12
+ import { getBillDetailActions as l } from "./index19.js";
13
+ import { useState as u } from "react";
14
+ import { BanIcon as d, HandIcon as f } from "lucide-react";
15
15
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.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");
16
+ 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 }) {
17
+ 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({
18
+ status: f,
19
+ scopes: j?.scopes,
20
+ canDecideApprovalRequest: !!p,
21
+ arePendingApproversUnknown: m,
22
+ hasApprovalPolicy: w,
23
+ hasWaitingRequest: T,
24
+ hasScheduledPayment: h || v,
25
+ scheduledPaymentIntentId: g,
26
+ isPayabilityUnknown: x,
27
+ canEdit: !!k,
28
+ labels: S
29
+ }) : [], W = (t) => ({
30
+ onError: () => e.error(S.actionError),
31
+ onSuccess: () => {
32
+ let n = b(t) && !w ? `${t}NoApprovalPolicy` : t;
33
+ e.success(S.actionSuccess[n]), A?.(t);
34
+ }
35
+ }), G = {
36
+ reject: {
37
+ isPending: M.isPending,
38
+ run: (e) => p && M.mutate({
39
+ path: { approval_request_id: p },
40
+ body: e ? { reject_reason: e } : void 0
41
+ }, W("reject"))
42
+ },
43
+ approve: {
44
+ isPending: N.isPending,
45
+ run: () => p && N.mutate({ path: { approval_request_id: p } }, W("approve"))
46
+ },
47
+ cancel: {
48
+ isPending: P.isPending,
49
+ run: () => d && P.mutate({ path: { payable_id: d } }, W("cancel"))
50
+ },
51
+ cancelScheduledPayment: {
52
+ isPending: F.isPending,
53
+ run: () => {
54
+ let e = H?.scheduledPaymentIntentId;
55
+ d && e && F.mutate({
56
+ path: { payment_intent_id: e },
57
+ payableId: d
58
+ }, W("cancelScheduledPayment"));
59
+ }
60
+ },
61
+ reopen: {
62
+ isPending: I.isPending,
63
+ run: () => d && I.mutate({ path: { payable_id: d } }, W("reopen"))
64
+ },
65
+ forceApprove: {
66
+ isPending: L.isPending,
67
+ run: () => d && L.mutate({ path: { payable_id: d } }, W("forceApprove"))
68
+ },
69
+ forceReject: {
70
+ isPending: R.isPending,
71
+ run: () => d && R.mutate({ path: { payable_id: d } }, W("forceReject"))
72
+ }
73
+ }, K = U.map((e) => ({
74
+ ...e,
75
+ disabled: z,
76
+ loading: e.id === "markAsPaid" ? C : G[e.id]?.isPending ?? !1,
77
+ onSelect: () => {
78
+ if (!z && d) {
79
+ if (e.id === "payBill") {
80
+ D();
81
+ return;
82
+ }
83
+ if (e.id === "markAsPaid") {
84
+ O();
85
+ return;
86
+ }
87
+ if (e.id === "edit") {
88
+ k?.();
89
+ return;
90
+ }
91
+ if (y(e.id)) {
92
+ V({
93
+ id: e.id,
94
+ scheduledPaymentIntentId: g
95
+ });
96
+ return;
97
+ }
98
+ G[e.id]?.run();
99
+ }
100
+ }
101
+ }));
21
102
  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
103
+ isActionPending: z,
104
+ actions: {
105
+ row: K.filter((e) => e.surface === "row"),
106
+ menu: K.filter((e) => e.surface === "menu")
107
+ },
108
+ decisionDialog: {
109
+ open: !!H,
110
+ copy: H ? {
111
+ ...S.decisionDialog[H.id],
112
+ ...b(H.id) && !w ? S.decisionDialog[H.id].noApprovalPolicy : void 0,
113
+ presentation: _(H.id),
114
+ pendingApprovers: b(H.id) ? E ?? [] : void 0
115
+ } : void 0,
116
+ isPending: H ? G[H.id]?.isPending ?? !1 : !1,
117
+ onCancel: () => {
118
+ z || V(void 0);
119
+ },
120
+ onConfirm: (e) => {
121
+ H && !z && (G[H.id]?.run(e), V(void 0));
122
+ }
123
+ }
26
124
  };
27
125
  }
126
+ var m = {
127
+ alignment: "center",
128
+ icon: f,
129
+ tone: "destructive",
130
+ actionWidth: "equal"
131
+ }, h = {
132
+ alignment: "center",
133
+ icon: d,
134
+ tone: "destructive",
135
+ actionWidth: "equal"
136
+ }, g = {
137
+ alignment: "center",
138
+ icon: d,
139
+ tone: "destructive",
140
+ actionWidth: "equal"
141
+ };
142
+ function _(e) {
143
+ if (b(e)) return m;
144
+ if (e === "reject") return h;
145
+ if (e === "cancel") return g;
146
+ }
147
+ var v = [
148
+ "reject",
149
+ "cancel",
150
+ "cancelScheduledPayment",
151
+ "forceApprove",
152
+ "forceReject"
153
+ ];
154
+ function y(e) {
155
+ return v.includes(e);
156
+ }
157
+ function b(e) {
158
+ return e === "forceApprove" || e === "forceReject";
159
+ }
28
160
  //#endregion
29
- export { s as useCurrentApprovalRequestId };
161
+ export { p as usePayableDetailActions };
@@ -1,155 +1,12 @@
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/index8.js";
10
- import { useCancelPayableMutation as i, useCancelScheduledPaymentMutation as a, useForceApprovePayableMutation as o, useForceRejectPayableMutation as s, useReopenPayableMutation as c } from "../../data-access/dist/index13.js";
11
- import "../../data-access/dist/index.js";
12
- import { getBillDetailActions as l } from "./index20.js";
13
- import { useState as u } from "react";
14
- import { BanIcon as d, HandIcon as f } from "lucide-react";
1
+ import { formatCalendarDate as e } from "../../../shared/util/dist/lib/formatCalendarDate.js";
2
+ import { getRelativeCalendarDay as t } from "../../../shared/util/dist/lib/relativeCalendarDay.js";
15
3
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js
16
- function p({ payableId: d, status: f, currentApprovalRequestId: p, arePendingApproversUnknown: m, hasScheduledPayment: h, scheduledPaymentIntentId: _, isScheduledPaymentUnknown: b, isPayabilityUnknown: x, labels: S, isMarkAsPaidPending: C, hasApprovalPolicy: w = !0, hasWaitingRequest: T, pendingApprovers: E, onPayBillSelect: D, onMarkAsPaidSelect: O, onEditSelect: k, onActionSucceeded: A }) {
17
- 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 === _) ? B : void 0, U = d && f ? l({
18
- status: f,
19
- scopes: j?.scopes,
20
- canDecideApprovalRequest: !!p,
21
- arePendingApproversUnknown: m,
22
- hasApprovalPolicy: w,
23
- hasWaitingRequest: T,
24
- hasScheduledPayment: h || b,
25
- scheduledPaymentIntentId: _,
26
- isPayabilityUnknown: x,
27
- canEdit: !!k,
28
- labels: S
29
- }) : [], W = (t) => ({
30
- onError: () => e.error(S.actionError),
31
- onSuccess: () => {
32
- let n = y(t) && !w ? `${t}NoApprovalPolicy` : t;
33
- e.success(S.actionSuccess[n]), A?.(t);
34
- }
35
- }), G = {
36
- reject: {
37
- isPending: M.isPending,
38
- run: (e) => p && M.mutate({
39
- path: { approval_request_id: p },
40
- body: e ? { reject_reason: e } : void 0
41
- }, W("reject"))
42
- },
43
- approve: {
44
- isPending: N.isPending,
45
- run: () => p && N.mutate({ path: { approval_request_id: p } }, W("approve"))
46
- },
47
- cancel: {
48
- isPending: P.isPending,
49
- run: () => d && P.mutate({ path: { payable_id: d } }, W("cancel"))
50
- },
51
- cancelScheduledPayment: {
52
- isPending: F.isPending,
53
- run: () => {
54
- let e = H?.scheduledPaymentIntentId;
55
- d && e && F.mutate({
56
- path: { payment_intent_id: e },
57
- payableId: d
58
- }, W("cancelScheduledPayment"));
59
- }
60
- },
61
- reopen: {
62
- isPending: I.isPending,
63
- run: () => d && I.mutate({ path: { payable_id: d } }, W("reopen"))
64
- },
65
- forceApprove: {
66
- isPending: L.isPending,
67
- run: () => d && L.mutate({ path: { payable_id: d } }, W("forceApprove"))
68
- },
69
- forceReject: {
70
- isPending: R.isPending,
71
- run: () => d && R.mutate({ path: { payable_id: d } }, W("forceReject"))
72
- }
73
- }, K = U.map((e) => ({
74
- ...e,
75
- disabled: z,
76
- loading: e.id === "markAsPaid" ? C : G[e.id]?.isPending ?? !1,
77
- onSelect: () => {
78
- if (!z && d) {
79
- if (e.id === "payBill") {
80
- D();
81
- return;
82
- }
83
- if (e.id === "markAsPaid") {
84
- O();
85
- return;
86
- }
87
- if (e.id === "edit") {
88
- k?.();
89
- return;
90
- }
91
- if (v(e.id)) {
92
- V({
93
- id: e.id,
94
- scheduledPaymentIntentId: _
95
- });
96
- return;
97
- }
98
- G[e.id]?.run();
99
- }
100
- }
101
- }));
102
- return {
103
- isActionPending: z,
104
- actions: {
105
- row: K.filter((e) => e.surface === "row"),
106
- menu: K.filter((e) => e.surface === "menu")
107
- },
108
- decisionDialog: {
109
- open: !!H,
110
- copy: H ? {
111
- ...S.decisionDialog[H.id],
112
- ...y(H.id) && !w ? S.decisionDialog[H.id].noApprovalPolicy : void 0,
113
- presentation: g(H.id),
114
- pendingApprovers: y(H.id) ? E ?? [] : void 0
115
- } : void 0,
116
- isPending: H ? G[H.id]?.isPending ?? !1 : !1,
117
- onCancel: () => {
118
- z || V(void 0);
119
- },
120
- onConfirm: (e) => {
121
- H && !z && (G[H.id]?.run(e), V(void 0));
122
- }
123
- }
124
- };
125
- }
126
- var m = {
127
- alignment: "center",
128
- icon: f,
129
- tone: "destructive",
130
- actionWidth: "equal"
131
- }, h = {
132
- alignment: "center",
133
- icon: d,
134
- tone: "destructive",
135
- actionWidth: "equal"
136
- };
137
- function g(e) {
138
- if (y(e)) return m;
139
- if (e === "reject") return h;
140
- }
141
- var _ = [
142
- "reject",
143
- "cancel",
144
- "cancelScheduledPayment",
145
- "forceApprove",
146
- "forceReject"
147
- ];
148
- function v(e) {
149
- return _.includes(e);
150
- }
151
- function y(e) {
152
- return e === "forceApprove" || e === "forceReject";
4
+ function n(n, r, i) {
5
+ let a = e(n), o = t(n, i);
6
+ return o ? {
7
+ label: r[o],
8
+ absoluteLabel: a
9
+ } : { label: a };
153
10
  }
154
11
  //#endregion
155
- export { p as usePayableDetailActions };
12
+ export { n as formatScheduledDateLabel };
@@ -1,12 +1,28 @@
1
- import { formatCalendarDate as e } from "../../../shared/util/dist/lib/formatCalendarDate.js";
2
- import { getRelativeCalendarDay as t } from "../../../shared/util/dist/lib/relativeCalendarDay.js";
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { useEffect as e, useState as t } from "react";
3
6
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js
4
- function n(n, r, i) {
5
- let a = e(n), o = t(n, i);
6
- return o ? {
7
- label: r[o],
8
- absoluteLabel: a
9
- } : { label: a };
7
+ var n = (e) => [
8
+ e.getFullYear(),
9
+ String(e.getMonth() + 1).padStart(2, "0"),
10
+ String(e.getDate()).padStart(2, "0")
11
+ ].join("-"), r = (e) => new Date(e.getFullYear(), e.getMonth(), e.getDate() + 1).getTime() - e.getTime();
12
+ function i() {
13
+ let [i, a] = t();
14
+ return e(() => {
15
+ let e, t = () => a(n(/* @__PURE__ */ new Date())), i = () => {
16
+ e = setTimeout(() => {
17
+ t(), i();
18
+ }, r(/* @__PURE__ */ new Date()));
19
+ }, o = () => {
20
+ document.visibilityState === "visible" && (t(), clearTimeout(e), i());
21
+ };
22
+ return t(), i(), document.addEventListener("visibilitychange", o), () => {
23
+ clearTimeout(e), document.removeEventListener("visibilitychange", o);
24
+ };
25
+ }, []), i;
10
26
  }
11
27
  //#endregion
12
- export { n as formatScheduledDateLabel };
28
+ export { i as useLocalCalendarDay };
@@ -2,27 +2,25 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { useEffect as e, useState as t } from "react";
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 "../../../shared/data-access/dist/index.js";
8
+ import { useWidgetConfig as n } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
9
+ import "../../../shared/feature/dist/index.js";
10
+ import { isLiveScheduledPaymentRecord as r } from "../../data-access/dist/index3.js";
11
+ import { usePayablePaymentRecordsQuery as i } from "../../data-access/dist/index11.js";
12
+ import "../../data-access/dist/index.js";
6
13
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js
7
- var n = (e) => [
8
- e.getFullYear(),
9
- String(e.getMonth() + 1).padStart(2, "0"),
10
- String(e.getDate()).padStart(2, "0")
11
- ].join("-"), r = (e) => new Date(e.getFullYear(), e.getMonth(), e.getDate() + 1).getTime() - e.getTime();
12
- function i() {
13
- let [i, a] = t();
14
- return e(() => {
15
- let e, t = () => a(n(/* @__PURE__ */ new Date())), i = () => {
16
- e = setTimeout(() => {
17
- t(), i();
18
- }, r(/* @__PURE__ */ new Date()));
19
- }, o = () => {
20
- document.visibilityState === "visible" && (t(), clearTimeout(e), i());
21
- };
22
- return t(), i(), document.addEventListener("visibilitychange", o), () => {
23
- clearTimeout(e), document.removeEventListener("visibilitychange", o);
24
- };
25
- }, []), i;
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
+ 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
23
+ };
26
24
  }
27
25
  //#endregion
28
- export { i as useLocalCalendarDay };
26
+ export { a as useScheduledPayment };
@@ -2,25 +2,43 @@
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";
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";
7
8
  import "../../../shared/data-access/dist/index.js";
8
- import { useWidgetConfig as n } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
9
+ import "../../../shared/ui/dist/index.js";
10
+ import { useWidgetConfig as r } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
9
11
  import "../../../shared/feature/dist/index.js";
10
- import { isLiveScheduledPaymentRecord as r } from "../../data-access/dist/index3.js";
11
- import { usePayablePaymentRecordsQuery as i } from "../../data-access/dist/index11.js";
12
+ import { useDeletePayableMutation as i } from "../../data-access/dist/index13.js";
12
13
  import "../../data-access/dist/index.js";
14
+ import { useState as a } from "react";
13
15
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.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 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;
16
23
  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
24
+ menuItems: _,
25
+ dialog: {
26
+ open: v,
27
+ copy: v ? l.dialog : void 0,
28
+ isPending: f.isPending,
29
+ onCancel: () => {
30
+ f.isPending || m(!1);
31
+ },
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
+ });
39
+ }
40
+ }
23
41
  };
24
42
  }
25
43
  //#endregion
26
- export { a as useScheduledPayment };
44
+ export { o as useDraftDelete };
@@ -1,44 +1,19 @@
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 { 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
- import "../../../shared/ui/dist/index.js";
10
- import { useWidgetConfig as r } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
11
- import "../../../shared/feature/dist/index.js";
12
- import { useDeletePayableMutation as i } from "../../data-access/dist/index13.js";
13
- import "../../data-access/dist/index.js";
14
- import { useState as a } from "react";
15
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.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;
2
+ var e = 1e4;
3
+ function t(e) {
4
+ return typeof e == "number" && Number.isFinite(e) ? e : 0;
5
+ }
6
+ function n(e) {
7
+ let n = t(e), r = Math.round(Number(Math.abs(n).toFixed(6)));
8
+ return n < 0 ? -r || 0 : r;
9
+ }
10
+ function r({ quantity: r, unitPrice: i, tax: a }) {
11
+ let o = n(t(r) * t(i)), s = n(o * t(a) / e);
23
12
  return {
24
- menuItems: _,
25
- dialog: {
26
- open: v,
27
- copy: v ? l.dialog : void 0,
28
- isPending: f.isPending,
29
- onCancel: () => {
30
- f.isPending || m(!1);
31
- },
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
- });
39
- }
40
- }
13
+ subtotal: o,
14
+ taxAmount: s,
15
+ total: o + s
41
16
  };
42
17
  }
43
18
  //#endregion
44
- export { o as useDraftDelete };
19
+ export { e as TAX_RATE_SCALE, r as calculateLineItemTotals, n as roundToMinorUnits };
@@ -1,19 +1,11 @@
1
+ import { calculateLineItemTotals as e } from "./index40.js";
1
2
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js
2
- var e = 1e4;
3
- function t(e) {
4
- return typeof e == "number" && Number.isFinite(e) ? e : 0;
5
- }
6
- function n(e) {
7
- let n = t(e), r = Math.round(Number(Math.abs(n).toFixed(6)));
8
- return n < 0 ? -r || 0 : r;
9
- }
10
- function r({ quantity: r, unitPrice: i, tax: a }) {
11
- let o = n(t(r) * t(i)), s = n(o * t(a) / e);
12
- return {
13
- subtotal: o,
14
- taxAmount: s,
15
- total: o + s
16
- };
3
+ function t(t) {
4
+ if (typeof t.subtotal == "number") return t.subtotal;
5
+ if (typeof t.quantity == "number" && typeof t.unit_price == "number") return e({
6
+ quantity: t.quantity,
7
+ unitPrice: t.unit_price
8
+ }).subtotal;
17
9
  }
18
10
  //#endregion
19
- export { e as TAX_RATE_SCALE, r as calculateLineItemTotals, n as roundToMinorUnits };
11
+ export { t as resolveLineItemAmountMinorUnits };
@@ -1,11 +1,7 @@
1
- import { calculateLineItemTotals as e } from "./index41.js";
2
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js
3
- function t(t) {
4
- if (typeof t.subtotal == "number") return t.subtotal;
5
- if (typeof t.quantity == "number" && typeof t.unit_price == "number") return e({
6
- quantity: t.quantity,
7
- unitPrice: t.unit_price
8
- }).subtotal;
2
+ var e = (e) => typeof e == "number" && Number.isFinite(e) && e > 0;
3
+ function t({ quantity: t, unit_price: n, subtotal: r }) {
4
+ return e(t) ? t : e(n) && e(r) && r % n === 0 ? r / n : 1;
9
5
  }
10
6
  //#endregion
11
- export { t as resolveLineItemAmountMinorUnits };
7
+ export { t as resolveLineItemQuantity };