@tesouro/embedded-components-react 0.3.49 → 0.3.51

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 (144) hide show
  1. package/dist/index.css +8 -2
  2. package/dist/index.js +2 -2
  3. package/dist/lib/BillPayWidget.js +1 -1
  4. package/dist/lib/LinkedAccountsWidget.js +1 -1
  5. package/dist/libs/shared/util-validation/dist/{index22.js → index23.js} +1 -1
  6. package/dist/libs/shared/util-validation/dist/index7.js +6 -0
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index.js +11 -10
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index10.js +39 -30
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index11.js +26 -311
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index12.js +325 -12
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index13.js +13 -26
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index14.js +20 -40
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index15.js +75 -24
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index16.js +36 -0
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index5.js +80 -68
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index6.js +86 -73
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index7.js +77 -14
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index8.js +18 -63
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index9.js +50 -29
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +22 -18
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +82 -30
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js +7 -42
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +15 -159
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js +23 -33
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +66 -1
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +2 -50
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +3 -4
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +5 -14
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +3 -14
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +31 -63
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index2.js +23 -18
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +37 -24
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +161 -61
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +29 -130
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +1 -25
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +47 -4
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +4 -41
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +12 -55
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +13 -4
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +63 -72
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +26 -49
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index3.js +23 -23
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +62 -93
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +133 -34
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +20 -163
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +4 -77
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +39 -21
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +5 -210
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +70 -211
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +47 -103
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +92 -12
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +34 -47
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index4.js +59 -62
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +163 -29
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +67 -181
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +20 -32
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +203 -94
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +214 -15
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +98 -312
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +16 -4
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +49 -31
  62. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +29 -80
  63. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +183 -156
  64. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js +9 -2
  65. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +38 -3
  66. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +102 -2
  67. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +18 -44
  68. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +343 -1
  69. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +4 -8
  70. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +30 -8
  71. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +79 -88
  72. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +179 -3
  73. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +3 -9
  74. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +2 -20
  75. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +4 -2
  76. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +38 -51
  77. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +0 -2
  78. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +6 -126
  79. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +9 -9
  80. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +92 -44
  81. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +3 -23
  82. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +123 -26
  83. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +7 -82
  84. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +8 -48
  85. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +45 -250
  86. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +69 -5
  87. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +21 -113
  88. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js +27 -208
  89. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +86 -4
  90. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +47 -5
  91. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js +244 -106
  92. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +115 -1
  93. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js +201 -16
  94. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index77.js +4 -0
  95. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index78.js +8 -0
  96. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index79.js +115 -0
  97. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +44 -5
  98. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index80.js +1 -0
  99. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index81.js +25 -0
  100. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +94 -3
  101. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +19 -19
  102. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index18.js +1 -0
  103. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index50.js +28 -28
  104. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index59.js +1 -3
  105. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index60.js +6 -16
  106. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index73.js +119 -16
  107. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index74.js +24 -111
  108. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index75.js +89 -2
  109. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index76.js +2 -7
  110. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index77.js +5 -28
  111. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index78.js +30 -2
  112. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index79.js +2 -7
  113. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index80.js +5 -32
  114. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index81.js +34 -2
  115. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index82.js +2 -12
  116. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index83.js +10 -104
  117. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index84.js +105 -1
  118. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index85.js +2 -17
  119. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index86.js +15 -123
  120. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index87.js +125 -2
  121. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index88.js +2 -18
  122. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index89.js +14 -6
  123. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index90.js +7 -167
  124. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index91.js +170 -2
  125. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index92.js +2 -14
  126. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index93.js +11 -105
  127. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index94.js +108 -2
  128. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index95.js +2 -10
  129. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index96.js +8 -45
  130. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index97.js +47 -2
  131. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index98.js +2 -0
  132. package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index8.js +95 -94
  133. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index.js +1 -1
  134. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index10.js +45 -0
  135. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index7.js +18 -55
  136. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index8.js +46 -265
  137. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index9.js +273 -34
  138. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/useApproverOptions.js +1 -1
  139. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +23 -23
  140. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +87 -71
  141. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  142. package/dist/libs/tesouro-embedded-components-react/team-widget/feature/dist/index11.js +1 -1
  143. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index8.js +1 -1
  144. package/package.json +1 -1
@@ -2,136 +2,35 @@
2
2
  "use client";
3
3
  "use client";
4
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/index6.js";
10
- import { useCancelPayableMutation as i, useCancelScheduledPaymentMutation as a, useForceApprovePayableMutation as o, useForceRejectPayableMutation as s, useReopenPayableMutation as c } from "../../data-access/dist/index11.js";
11
- import "../../data-access/dist/index.js";
12
- import { getBillDetailActions as l } from "./index21.js";
13
- import { useState as u } from "react";
14
- import { HandIcon as d } from "lucide-react";
5
+ import { resolveVendor as e } from "./index5.js";
6
+ import { ReviewTransactionDialog as t } from "../../ui/dist/index84.js";
7
+ import { SchedulePaymentDialog as n } from "../../ui/dist/index91.js";
8
+ import "../../ui/dist/index.js";
9
+ import { resolveAmountDueMinorUnits as r } from "./index16.js";
10
+ import { payBillFlowTestIds as i } from "./index17.js";
11
+ import { usePayBillFlow as a } from "./index21.js";
12
+ import { useImperativeHandle as o } from "react";
13
+ import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
15
14
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js
16
- function f({ payableId: d, status: f, currentApprovalRequestId: m, isPolicyApprover: _, hasWaitingRequest: v, arePendingApproversUnknown: y, hasScheduledPayment: b, scheduledPaymentIntentId: x, isScheduledPaymentUnknown: S, labels: C, isMarkAsPaidPending: w, pendingApprovers: T, onPayBillSelect: E, onMarkAsPaidSelect: D, onActionSucceeded: O }) {
17
- let { initResponse: k } = t(), A = r(), j = n(), M = i(), N = a(), P = c(), F = o(), I = s(), L = w || A.isPending || j.isPending || M.isPending || N.isPending || P.isPending || F.isPending || I.isPending, [R, z] = u(), B = R && (R.id !== "cancelScheduledPayment" || R.scheduledPaymentIntentId === x) ? R : void 0, V = d && f ? l({
18
- status: f,
19
- scopes: k?.scopes,
20
- canDecideApprovalRequest: !!m,
21
- isPolicyApprover: _,
22
- hasWaitingRequest: v,
23
- arePendingApproversUnknown: y,
24
- hasScheduledPayment: b || S,
25
- scheduledPaymentIntentId: x,
26
- labels: C
27
- }) : [], H = (t) => ({
28
- onError: () => e.error(C.actionError),
29
- onSuccess: () => {
30
- e.success(C.actionSuccess[t]), O?.();
31
- }
32
- }), U = {
33
- reject: {
34
- isPending: A.isPending,
35
- run: (e) => m && A.mutate({
36
- path: { approval_request_id: m },
37
- body: e ? { reject_reason: e } : void 0
38
- }, H("reject"))
39
- },
40
- approve: {
41
- isPending: j.isPending,
42
- run: () => m && j.mutate({ path: { approval_request_id: m } }, H("approve"))
43
- },
44
- cancel: {
45
- isPending: M.isPending,
46
- run: () => d && M.mutate({ path: { payable_id: d } }, H("cancel"))
47
- },
48
- cancelScheduledPayment: {
49
- isPending: N.isPending,
50
- run: () => {
51
- let e = B?.scheduledPaymentIntentId;
52
- !d || !e || N.mutate({
53
- path: { payment_intent_id: e },
54
- payableId: d
55
- }, H("cancelScheduledPayment"));
56
- }
57
- },
58
- reopen: {
59
- isPending: P.isPending,
60
- run: () => d && P.mutate({ path: { payable_id: d } }, H("reopen"))
61
- },
62
- forceApprove: {
63
- isPending: F.isPending,
64
- run: () => d && F.mutate({ path: { payable_id: d } }, H("forceApprove"))
65
- },
66
- forceReject: {
67
- isPending: I.isPending,
68
- run: () => d && I.mutate({ path: { payable_id: d } }, H("forceReject"))
69
- }
70
- }, W = V.map((e) => ({
71
- ...e,
72
- disabled: L,
73
- loading: e.id === "markAsPaid" ? w : U[e.id]?.isPending ?? !1,
74
- onSelect: () => {
75
- if (!(L || !d)) {
76
- if (e.id === "payBill") {
77
- E();
78
- return;
79
- }
80
- if (e.id === "markAsPaid") {
81
- D();
82
- return;
83
- }
84
- if (h(e.id)) {
85
- z({
86
- id: e.id,
87
- scheduledPaymentIntentId: x
88
- });
89
- return;
90
- }
91
- U[e.id]?.run();
92
- }
93
- }
94
- }));
95
- return {
96
- isActionPending: L,
97
- actions: {
98
- row: W.filter((e) => e.surface === "row"),
99
- menu: W.filter((e) => e.surface === "menu")
100
- },
101
- decisionDialog: {
102
- open: !!B,
103
- copy: B ? {
104
- ...C.decisionDialog[B.id],
105
- presentation: g(B.id) ? p : void 0,
106
- pendingApprovers: g(B.id) ? T ?? [] : void 0
107
- } : void 0,
108
- isPending: B ? U[B.id]?.isPending ?? !1 : !1,
109
- onCancel: () => {
110
- L || z(void 0);
111
- },
112
- onConfirm: (e) => {
113
- !B || L || (U[B.id]?.run(e), z(void 0));
114
- }
115
- }
116
- };
117
- }
118
- var p = {
119
- alignment: "center",
120
- icon: d,
121
- tone: "destructive",
122
- actionWidth: "equal"
123
- }, m = [
124
- "reject",
125
- "cancel",
126
- "cancelScheduledPayment",
127
- "forceApprove",
128
- "forceReject"
129
- ];
130
- function h(e) {
131
- return m.includes(e);
132
- }
133
- function g(e) {
134
- return e === "forceApprove" || e === "forceReject";
15
+ function u({ ref: u, payable: d, poweredByBankName: f, labels: p }) {
16
+ let m = e(d), h = a({
17
+ payableId: d.id,
18
+ amountDueMinorUnits: r(d) ?? 0,
19
+ currencyCode: d.currency ?? void 0,
20
+ dueDate: d.due_date,
21
+ vendorName: m?.name ?? void 0,
22
+ vendorEmail: m?.email ?? void 0,
23
+ vendorBankAccount: m?.bank_account ?? void 0,
24
+ poweredByBankName: f,
25
+ labels: p
26
+ });
27
+ return o(u, () => ({ open: h.open }), [h.open]), /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c(n, {
28
+ ...h.dialogProps,
29
+ testId: i.scheduleDialog
30
+ }), /* @__PURE__ */ c(t, {
31
+ ...h.reviewProps,
32
+ testId: i.reviewDialog
33
+ })] });
135
34
  }
136
35
  //#endregion
137
- export { f as usePayableDetailActions };
36
+ export { u as PayBillFlow, u as default };
@@ -1,25 +1 @@
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 { Scope as t } from "../../../shared/data-access/dist/lib/scopes.js";
7
- import "../../../shared/data-access/dist/index.js";
8
- import { formatCalendarDate as n } from "../../../shared/util/dist/lib/formatCalendarDate.js";
9
- import { useWidgetConfig as r } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
10
- import "../../../shared/feature/dist/index.js";
11
- import { isLiveScheduledPaymentRecord as i } from "../../data-access/dist/index3.js";
12
- import { usePayablePaymentRecordsQuery as a } from "../../data-access/dist/index9.js";
13
- import "../../data-access/dist/index.js";
14
- //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js
15
- function o({ payableId: o, scheduledPaymentDate: s, enabled: c = !0 }) {
16
- let { initResponse: l } = r(), u = e(l?.scopes, [t.PaymentRecordReadOrg]), d = a(c ? o : void 0, { enabled: c && u }), f = d.paymentRecords.find(i), p = !!f || !!s, m = f?.planned_payment_date ?? (p ? s : void 0);
17
- return {
18
- hasScheduledPayment: p,
19
- isResolving: d.isResolving,
20
- scheduledDateLabel: m ? n(m) : void 0,
21
- scheduledPaymentIntentId: f?.payment_intent_id ?? void 0
22
- };
23
- }
24
- //#endregion
25
- export { o as useScheduledPayment };
1
+ import "./index22.js";
@@ -1,7 +1,50 @@
1
+ import { ApprovalPoliciesSettingsDefaultLabels as e } from "../../../shared/approval-policy/feature/dist/lib/labels.js";
2
+ import { parseApprovalPolicyScript as t } from "../../../shared/approval-policy/util/dist/lib/policyScript.js";
3
+ import { parseApprovalPolicyTrigger as n } from "../../../shared/approval-policy/util/dist/lib/policyTrigger.js";
4
+ import { buildPolicySentence as r, buildPolicyTitle as i } from "../../../shared/approval-policy/feature/dist/lib/policyViewModel.js";
5
+ import "../../../shared/approval-policy/feature/dist/index.js";
1
6
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js
2
- var e = /* @__PURE__ */ new Set(["draft", "new"]);
3
- function t(t) {
4
- return !!(t && e.has(t));
7
+ var a = {
8
+ ruleTitleRange: e.ruleTitleRange,
9
+ ruleTitleUpTo: e.ruleTitleUpTo,
10
+ ruleTitleFrom: e.ruleTitleFrom,
11
+ ruleTitleAny: e.ruleTitleAny,
12
+ ruleSentenceRange: e.ruleSentenceRange,
13
+ ruleSentenceUpTo: e.ruleSentenceUpTo,
14
+ ruleSentenceFrom: e.ruleSentenceFrom,
15
+ ruleSentenceAny: e.ruleSentenceAny
16
+ };
17
+ function o({ policy: a, lookup: o, approvedUserIds: s, approvedRoleIds: c, copy: l }) {
18
+ let u = t(a.script);
19
+ if (!u.groups.length || !u.isSupported) return;
20
+ let d = [];
21
+ for (let [e, t] of u.groups.entries()) {
22
+ let n = [];
23
+ for (let e of [...t.roleIds, ...t.userIds]) {
24
+ let t = o.get(e);
25
+ t && n.push({
26
+ id: e,
27
+ label: t.label,
28
+ approved: t.kind === "user" ? s.has(e) : !!c?.has(e)
29
+ });
30
+ }
31
+ n.length && d.push({
32
+ id: `group-${e + 1}`,
33
+ chips: n
34
+ });
35
+ }
36
+ if (!d.length) return;
37
+ let { condition: f, hasKnownAmountBounds: p } = n(a.trigger);
38
+ if (!p) return;
39
+ let m = {
40
+ ...e,
41
+ ...l
42
+ };
43
+ return {
44
+ title: i(f, m),
45
+ sentence: r(f, m),
46
+ steps: d
47
+ };
5
48
  }
6
49
  //#endregion
7
- export { t as isEditablePayableStatus };
50
+ export { a as APPROVAL_POLICY_RULE_COPY_EN, o as buildApprovalPolicyCardView };
@@ -1,44 +1,7 @@
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/index11.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/index25.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;
23
- 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
- }
41
- };
2
+ function e(e, t) {
3
+ let n = e ?? [];
4
+ return t ? n.filter((e) => !e.created_at || e.created_at >= t) : n.slice(0, 1);
42
5
  }
43
6
  //#endregion
44
- export { o as useDraftDelete };
7
+ export { e as currentApprovalRound };
@@ -1,59 +1,16 @@
1
+ import { currentApprovalRound as e } from "./index25.js";
1
2
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js
2
- var e = /* @__PURE__ */ new Set([
3
- "new",
4
- "approve_in_progress",
5
- "waiting_to_be_paid",
6
- "partially_paid"
7
- ]);
8
- function t(e, t) {
9
- let n = /* @__PURE__ */ new Date(`${e.slice(0, 10)}T00:00:00Z`), r = Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate());
10
- return n.getTime() < r;
11
- }
12
- function n({ apiStatus: n, dueDate: r, scheduledPaymentDate: i, hasScheduledPayment: a = !!i, now: o = /* @__PURE__ */ new Date() }) {
13
- if (e.has(n) && a) return {
14
- status: "scheduled",
15
- tone: "accent",
16
- isOverdue: !1
17
- };
18
- let s = !!(e.has(n) && r && t(r, o));
19
- switch (n) {
20
- case "draft": return {
21
- status: "draft",
22
- tone: "neutral",
23
- isOverdue: s
24
- };
25
- case "new":
26
- case "approve_in_progress": return {
27
- status: "pending_approval",
28
- tone: "warning",
29
- isOverdue: s
30
- };
31
- case "waiting_to_be_paid": return {
32
- status: "ready_to_pay",
33
- tone: "info",
34
- isOverdue: s
35
- };
36
- case "partially_paid": return {
37
- status: "partially_paid",
38
- tone: "success",
39
- isOverdue: s
40
- };
41
- case "paid": return {
42
- status: "paid",
43
- tone: "success",
44
- isOverdue: s
45
- };
46
- case "canceled": return {
47
- status: "canceled",
48
- tone: "muted",
49
- isOverdue: s
50
- };
51
- case "rejected": return {
52
- status: "rejected",
53
- tone: "danger",
54
- isOverdue: s
55
- };
3
+ function t({ requestsNewestFirst: t, roundStartedAt: n, lookup: r }) {
4
+ let i = e(t, n), a = [];
5
+ for (let e of i) {
6
+ if (e.status !== "waiting") continue;
7
+ let t = [...e.role_ids ?? [], ...e.user_ids ?? []].map((e) => r.get(e)?.label).filter((e) => !!e);
8
+ t.length && a.push({
9
+ id: e.id,
10
+ names: t
11
+ });
56
12
  }
13
+ return a;
57
14
  }
58
15
  //#endregion
59
- export { n as derivePayableStatus };
16
+ export { t as buildPendingApproverGroups };
@@ -1,8 +1,17 @@
1
- import { formatMoneyExact as e } from "../../../shared/util/dist/lib/formatMoneyExact.js";
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { usePayableHistoryQuery as e } from "../../data-access/dist/index8.js";
2
6
  import "../../data-access/dist/index.js";
3
7
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js
4
- function t(t, n) {
5
- if (typeof t == "number") return e(t / 100, { currencyCode: n ?? "USD" });
8
+ var t = "submitted_for_approval";
9
+ function n({ payableId: n, enabled: r = !0 }) {
10
+ let i = e(n, { enabled: r });
11
+ return {
12
+ roundStartedAt: (i.data?.data ?? []).reduce((e, n) => n.event_type === t ? n.timestamp : e, void 0),
13
+ isLoading: i.isLoading
14
+ };
6
15
  }
7
16
  //#endregion
8
- export { t as formatBillMoney };
17
+ export { n as usePayableApprovalRoundStart };
@@ -1,76 +1,67 @@
1
- import { formatCalendarDate as e } from "../../../shared/util/dist/lib/formatCalendarDate.js";
2
- import { resolveAmountDueMinorUnits as t } from "./index6.js";
3
- import { resolveVendor as n } from "./index7.js";
4
- import { derivePayableStatus as r } from "./index26.js";
5
- import { formatBillMoney as i } from "./index27.js";
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 { 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";
13
+ 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";
6
21
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js
7
- function a({ payable: a, lineItems: o, glCodeOptions: s, glCodeRosterAvailable: c = !0, history: l, approvalPolicy: u, labels: d, hasScheduledPayment: f }) {
8
- let p = a.currency, m = r({
9
- apiStatus: a.status,
10
- dueDate: a.due_date,
11
- scheduledPaymentDate: a.scheduled_payment_date,
12
- hasScheduledPayment: f
13
- }), h = n(a), g = h?.bank_account?.account_number, _ = e(a.issued_at) || d.notProvided, v = e(a.due_date) || d.notProvided, y = new Map(s.map((e) => [e.value, e.label])), b = [
14
- {
15
- label: d.subtotalRow,
16
- minorUnits: a.subtotal
17
- },
18
- {
19
- label: d.discountRow,
20
- minorUnits: a.discount
21
- },
22
- {
23
- label: d.taxRow,
24
- minorUnits: a.tax_amount
25
- }
26
- ].map((e) => ({
27
- label: e.label,
28
- value: i(e.minorUnits, p)
29
- })).filter((e) => !!e.value), x = i(a.total_amount, p);
30
- return x && b.push({
31
- label: d.totalRow,
32
- value: x,
33
- emphasis: !0
34
- }), {
35
- amountDue: i(t(a), p) ?? "",
36
- invoiceDateLabel: _,
37
- dueDateLabel: v,
38
- dueDateTone: m.isOverdue ? "danger" : "default",
39
- status: m.status,
40
- statusTone: m.tone,
41
- payTo: {
42
- name: h?.name || d.notProvided,
43
- email: h?.email ?? void 0,
44
- paymentInstructionsLabel: g ? d.paymentInstructionsValue(g.slice(-4)) : void 0
45
- },
46
- invoiceFields: [
47
- {
48
- label: d.invoiceDateRow,
49
- value: _
50
- },
51
- {
52
- label: d.dueDateRow,
53
- value: v
54
- },
55
- {
56
- label: d.invoiceNumberRow,
57
- value: a.document_id || d.notProvided
58
- }
59
- ],
60
- lineItems: o.map((e) => {
61
- let t = i(e.unit_price, p);
62
- return {
63
- id: e.id,
64
- description: e.name ?? e.description ?? "",
65
- glCodeLabel: e.ledger_account_id ? y.get(e.ledger_account_id) ?? (c ? d.glCodeMissing : d.glCodeUnavailable) : d.glCodeMissing,
66
- qtyPriceLabel: e.quantity != null && t ? d.qtyPriceValue(String(e.quantity), t) : "",
67
- amount: i(e.subtotal, p) ?? ""
68
- };
69
- }),
70
- amountRows: b,
71
- approvalPolicy: u,
72
- history: l
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]);
38
+ 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)
73
64
  };
74
65
  }
75
66
  //#endregion
76
- export { a as buildBillDetailView };
67
+ export { f as useApprovalPolicyCardView };
@@ -1,52 +1,29 @@
1
- import { BILL_STATUS_BADGE_LABELS_EN as e } from "../../ui/dist/index18.js";
2
- import "../../ui/dist/index.js";
3
- import { derivePayableStatus as t } from "./index26.js";
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/index7.js";
12
+ import "../../data-access/dist/index.js";
13
+ import { currentApprovalRound as a } from "./index25.js";
14
+ import { usePayableApprovalRoundStart as o } from "./index27.js";
4
15
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js
5
- var n = /* @__PURE__ */ new Set([
6
- "credit_note_linked",
7
- "credit_note_unlinked",
8
- "line_item_added",
9
- "line_item_updated",
10
- "line_item_removed",
11
- "deleted"
12
- ]);
13
- function r(n, r, i) {
14
- switch (n) {
15
- case "payable_created": return r?.source_of_payable_data === "ocr" ? i.billUploaded : i.billAdded;
16
- case "payable_updated": return i.billUpdated;
17
- case "file_attached": return i.attachmentAdded;
18
- case "submitted_for_approval": return i.submittedForApproval;
19
- case "approval_requested": return i.approvalRequested;
20
- case "approval_action": {
21
- let e = r?.action, t = r?.reject_reason;
22
- return e === "approve" ? i.approved : e === "reject" ? typeof t == "string" && t ? i.rejectedWithReason(t) : i.rejected : void 0;
23
- }
24
- case "auto_approved": return i.autoApproved;
25
- case "reopened": return i.reopened;
26
- case "marked_as_paid": return i.markedAsPaid;
27
- case "marked_as_partially_paid": return i.markedAsPartiallyPaid;
28
- case "payment_reverted": return i.paymentReverted;
29
- case "status_changed": {
30
- let n = r?.new_status;
31
- if (typeof n != "string") return;
32
- let a = t({ apiStatus: n }).status;
33
- return i.statusChanged(e[a] ?? e.unknown);
34
- }
35
- default: return;
36
- }
37
- }
38
- function i(e, t, i) {
39
- let a = new Map(t.map((e) => [e.id, e.name]));
40
- return e.filter((e) => !n.has(e.event_type)).map((e) => {
41
- let t = r(e.event_type, e.event_data, i);
42
- if (!t) return;
43
- let n = e.entity_user_id ? a.get(e.entity_user_id) : void 0;
44
- return {
45
- id: e.id,
46
- dateLabel: i.dateLabel(e.timestamp),
47
- description: n ? i.byActor(t, n) : t
48
- };
49
- }).filter((e) => !!e);
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
+ };
50
27
  }
51
28
  //#endregion
52
- export { i as buildBillHistory };
29
+ export { s as useCurrentApprovalRequestId };