@tesouro/embedded-components-react 0.2.327 → 0.2.329

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 (133) hide show
  1. package/dist/index.css +3 -0
  2. package/dist/index.d.ts +59 -59
  3. package/dist/index.js +1 -1
  4. package/dist/lib/BillPayWidget.js +1 -1
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index.js +10 -10
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index10.js +119 -33
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index4.js +50 -21
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index5.js +39 -17
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index8.js +1 -1
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index9.js +17 -12
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +10 -10
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +2 -2
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +45 -17
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js +4 -21
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +9 -24
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +42 -9
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +25 -50
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +49 -5
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +91 -63
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +20 -49
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +52 -7
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +5 -35
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +67 -113
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +46 -53
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +80 -205
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +32 -192
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +117 -62
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +54 -45
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +205 -31
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +184 -143
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +63 -33
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +46 -100
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +32 -7
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +146 -182
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +38 -4
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +102 -24
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +10 -80
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +200 -78
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +2 -1
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +27 -2
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +78 -41
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +132 -1
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +3 -53
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +2 -9
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +43 -16
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +1 -8
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +50 -77
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +8 -145
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +18 -5
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +6 -6
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +78 -7
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +138 -75
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +2 -0
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +6 -6
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +7 -113
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +85 -1
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +2 -24
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +8 -0
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +115 -0
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +1 -0
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +25 -0
  62. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +2 -2
  63. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +33 -25
  64. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index12.js +13 -12
  65. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index13.js +58 -13
  66. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index14.js +2 -24
  67. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index15.js +22 -2
  68. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index16.js +23 -31
  69. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index17.js +1 -262
  70. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index18.js +15 -2
  71. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index19.js +23 -6
  72. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index20.js +2 -49
  73. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index21.js +41 -1
  74. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index22.js +271 -20
  75. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index23.js +2 -286
  76. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index24.js +9 -2
  77. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index25.js +47 -14
  78. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index26.js +2 -120
  79. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index27.js +22 -2
  80. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index28.js +284 -8
  81. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index29.js +2 -96
  82. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index30.js +16 -2
  83. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index31.js +118 -11
  84. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index32.js +1 -57
  85. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index33.js +10 -2
  86. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index34.js +93 -51
  87. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index35.js +1 -138
  88. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index36.js +12 -1
  89. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index37.js +56 -5
  90. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index38.js +2 -44
  91. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index39.js +53 -1
  92. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index40.js +137 -2
  93. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index41.js +2 -16
  94. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index42.js +7 -2
  95. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index43.js +42 -59
  96. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index44.js +2 -238
  97. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index45.js +2 -202
  98. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index46.js +61 -8
  99. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index47.js +2 -8
  100. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index48.js +2 -91
  101. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index49.js +16 -0
  102. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index50.js +1 -1
  103. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index51.js +67 -4
  104. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index52.js +248 -25
  105. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index53.js +204 -2
  106. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index54.js +6 -3
  107. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index55.js +6 -32
  108. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index56.js +93 -2
  109. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index58.js +1 -105
  110. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index59.js +7 -2
  111. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index60.js +28 -16
  112. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index61.js +2 -10
  113. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index62.js +4 -167
  114. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index63.js +34 -2
  115. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index64.js +2 -14
  116. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index65.js +10 -87
  117. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index66.js +105 -1
  118. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index67.js +2 -0
  119. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index68.js +18 -0
  120. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index69.js +10 -0
  121. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index70.js +170 -0
  122. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index71.js +2 -0
  123. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index72.js +14 -0
  124. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index73.js +89 -0
  125. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index74.js +2 -0
  126. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/data-access/dist/lib/approvalPoliciesApi.js +20 -20
  127. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/index.js +4 -4
  128. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +21 -21
  129. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +142 -102
  130. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  131. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index7.js +1 -1
  132. package/package.json +1 -1
  133. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index57.js +0 -12
@@ -6,16 +6,16 @@ import { useEmbedApi as e } from "../../../shared/data-access/dist/lib/EmbedApiC
6
6
  import { organizationHeaders as t } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
7
7
  import { postPayablesIdSchedulePayment as n } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
8
8
  import "../../../shared/data-access/dist/index.js";
9
- import { invalidatePayableQueries as r } from "./index4.js";
10
- import { useMutation as i } from "@tanstack/react-query";
9
+ import { invalidatePayableQueries as r, reconcileScheduledPaymentQueries as i } from "./index4.js";
10
+ import { useMutation as a } from "@tanstack/react-query";
11
11
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index9.js
12
- function a() {
13
- let { client: a, organizationId: o } = e();
14
- return i({
12
+ function o() {
13
+ let { client: o, organizationId: s } = e();
14
+ return a({
15
15
  mutationFn: async ({ payableId: e, paymentDate: r, sourceBankAccountId: i }) => {
16
- let { data: s } = await n({
17
- client: a,
18
- headers: t(o),
16
+ let { data: a } = await n({
17
+ client: o,
18
+ headers: t(s),
19
19
  path: { payable_id: e },
20
20
  body: {
21
21
  payment_date: r,
@@ -23,18 +23,23 @@ function a() {
23
23
  },
24
24
  throwOnError: !0
25
25
  });
26
- return s;
26
+ return a;
27
27
  },
28
28
  onSuccess: async (e, t) => {
29
29
  try {
30
30
  await r({
31
- client: a,
32
- organizationId: o,
31
+ client: o,
32
+ organizationId: s,
33
33
  payableId: t.payableId
34
34
  });
35
35
  } catch {}
36
+ i({
37
+ client: o,
38
+ organizationId: s,
39
+ payableId: t.payableId
40
+ }).catch(() => {});
36
41
  }
37
42
  });
38
43
  }
39
44
  //#endregion
40
- export { a as useSchedulePaymentMutation };
45
+ export { o as useSchedulePaymentMutation };
@@ -1,24 +1,24 @@
1
1
  import "./index10.js";
2
2
  import "./index11.js";
3
- import "./index16.js";
4
- import "./index22.js";
5
- import "./index29.js";
6
- import "./index31.js";
3
+ import "./index20.js";
4
+ import "./index26.js";
7
5
  import "./index33.js";
8
- import "./index34.js";
9
6
  import "./index35.js";
10
- import "./index36.js";
11
7
  import "./index37.js";
12
8
  import "./index38.js";
9
+ import "./index39.js";
10
+ import "./index40.js";
11
+ import "./index41.js";
13
12
  import "./index42.js";
14
- import "./index44.js";
15
- import "./index45.js";
16
13
  import "./index46.js";
17
- import "./index47.js";
18
14
  import "./index48.js";
19
15
  import "./index49.js";
20
16
  import "./index50.js";
21
17
  import "./index51.js";
22
18
  import "./index52.js";
23
- import { BillPayWidget as e } from "./index56.js";
19
+ import "./index53.js";
20
+ import "./index54.js";
21
+ import "./index55.js";
22
+ import "./index56.js";
23
+ import { BillPayWidget as e } from "./index60.js";
24
24
  export { e as BillPayWidget };
@@ -5,8 +5,8 @@
5
5
  import { resolveAmountDueMinorUnits as e } from "./index2.js";
6
6
  import { resolveVendor as t } from "./index3.js";
7
7
  import { payBillFlowTestIds as n } from "./index4.js";
8
- import { ReviewTransactionDialog as r } from "../../ui/dist/index58.js";
9
- import { SchedulePaymentDialog as i } from "../../ui/dist/index62.js";
8
+ import { ReviewTransactionDialog as r } from "../../ui/dist/index66.js";
9
+ import { SchedulePaymentDialog as i } from "../../ui/dist/index70.js";
10
10
  import "../../ui/dist/index.js";
11
11
  import { usePayBillFlow as a } from "./index9.js";
12
12
  import { useImperativeHandle as o } from "react";
@@ -1,22 +1,50 @@
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/index5.js";
12
- import "../../data-access/dist/index.js";
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";
13
6
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js
14
- function a({ payableId: a, status: o }) {
15
- let { initResponse: s } = r(), c = e(s?.scopes, [n.ApprovalRequestReadOrg]), l = o === "approve_in_progress" && c, u = i(a, { enabled: l }), d = t({ enabled: l }), f = d.data?.id, p = f ? u.data?.data.find((e) => e.status === "waiting" && (e.user_ids ?? []).includes(f) && !(e.approved_by ?? []).includes(f)) : void 0;
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
+ };
16
43
  return {
17
- id: e(s?.scopes, [n.ApprovalRequestUpdateOrg]) ? p?.id : void 0,
18
- isLoading: u.isLoading || d.isLoading
44
+ title: i(f, m),
45
+ sentence: r(f, m),
46
+ steps: d
19
47
  };
20
48
  }
21
49
  //#endregion
22
- export { a as useCurrentApprovalRequestId };
50
+ export { a as APPROVAL_POLICY_RULE_COPY_EN, o as buildApprovalPolicyCardView };
@@ -1,24 +1,7 @@
1
- import { hasAnyScope as e } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
2
- import { Scope as t } from "../../../shared/data-access/dist/lib/scopes.js";
3
- import "../../../shared/data-access/dist/index.js";
4
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js
5
- function n({ status: n, scopes: r, canRejectApprovalRequest: i, hasScheduledPayment: a, labels: o }) {
6
- let s = e(r, [t.PayablePayOrg]), c = e(r, [t.BankAccountReadOrg]), l = e(r, [t.PaymentRailAch]), u = [];
7
- n === "approve_in_progress" && i && u.push({
8
- id: "reject",
9
- label: o.reject,
10
- variant: "ghost"
11
- });
12
- let d = (n === "waiting_to_be_paid" || n === "partially_paid") && s && !a, f = n === "waiting_to_be_paid" && s && c && l && !a;
13
- return d && u.push({
14
- id: "markAsPaid",
15
- label: o.markAsPaid,
16
- variant: "outline"
17
- }), f && u.push({
18
- id: "payBill",
19
- label: o.payBill,
20
- variant: "default"
21
- }), u;
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);
22
5
  }
23
6
  //#endregion
24
- export { n as getBillDetailActions };
7
+ export { e as currentApprovalRound };
@@ -2,31 +2,16 @@
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 { useRejectPayableApprovalRequestMutation as n } from "../../data-access/dist/index5.js";
10
- import { useMarkPayableAsPaidMutation as r } from "../../data-access/dist/index10.js";
5
+ import { usePayableHistoryQuery as e } from "../../data-access/dist/index6.js";
11
6
  import "../../data-access/dist/index.js";
12
- import { getBillDetailActions as i } from "./index13.js";
13
7
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js
14
- function a({ payableId: a, status: o, currentApprovalRequestId: s, hasScheduledPayment: c, isScheduledPaymentUnknown: l, labels: u, onPayBillSelect: d }) {
15
- let { initResponse: f } = t(), p = r(), m = n(), h = p.isPending || m.isPending;
16
- return { actions: (a && o ? i({
17
- status: o,
18
- scopes: f?.scopes,
19
- canRejectApprovalRequest: !!s,
20
- hasScheduledPayment: c || l,
21
- labels: u
22
- }) : []).map((t) => ({
23
- ...t,
24
- disabled: h,
25
- loading: t.id === "markAsPaid" && p.isPending || t.id === "reject" && m.isPending,
26
- onSelect: () => {
27
- h || !a || (t.id === "payBill" && d(), t.id === "markAsPaid" && p.mutate({ path: { payable_id: a } }, { onError: () => e.error(u.actionError) }), t.id === "reject" && s && m.mutate({ path: { approval_request_id: s } }, { onError: () => e.error(u.actionError) }));
28
- }
29
- })) };
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
+ };
30
15
  }
31
16
  //#endregion
32
- export { a as usePayableDetailActions };
17
+ export { n as usePayableApprovalRoundStart };
@@ -4,20 +4,53 @@
4
4
  "use client";
5
5
  import { hasAnyScope as e } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
6
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";
7
9
  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 { useWidgetConfig as i } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
10
11
  import "../../../shared/feature/dist/index.js";
11
- import { usePayablePaymentRecordsQuery as i } from "../../data-access/dist/index8.js";
12
+ import { usePayableApprovalRequestsQuery as a } from "../../data-access/dist/index5.js";
12
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 "./index12.js";
17
+ import { currentApprovalRound as c } from "./index13.js";
18
+ import { usePayableApprovalRoundStart as l } from "./index14.js";
19
+ import { useMemo as u } from "react";
13
20
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js
14
- function a({ payableId: a, scheduledPaymentDate: o, enabled: s = !0 }) {
15
- let { initResponse: c } = r(), l = e(c?.scopes, [t.PaymentRecordReadOrg]), u = i(s ? a : void 0, { enabled: s && l }), d = u.paymentRecords.find((e) => e.status === "created" || e.status === "processing"), f = d?.planned_payment_date ?? o;
21
+ function d({ payableId: d, approvalPolicyId: f, enabled: p = !0, copy: m }) {
22
+ let h = p && !!f, { initResponse: g } = i(), _ = e(g?.scopes, [t.ApprovalPolicyReadOrg]), v = e(g?.scopes, [t.ApprovalRequestReadOrg]), y = e(g?.scopes, [t.RoleReadOrg]), b = e(g?.scopes, [t.UserReadOrg]), x = o({ enabled: h && _ }), S = n({ enabled: h && y }), C = r({ enabled: h && b }), w = a(d, { enabled: h && v }), { roundStartedAt: T } = l({
23
+ payableId: d,
24
+ enabled: h && v
25
+ }), E = u(() => {
26
+ let e = /* @__PURE__ */ new Map();
27
+ for (let t of S.data?.data ?? []) e.set(t.id, {
28
+ label: t.name,
29
+ kind: "role"
30
+ });
31
+ for (let t of C.data?.data ?? []) e.set(t.id, {
32
+ label: t.name,
33
+ kind: "user"
34
+ });
35
+ return e;
36
+ }, [S.data, C.data]), D = u(() => c(w.data?.data, T), [w.data, T]), O = u(() => new Set(D.flatMap((e) => e.approved_by ?? [])), [D]), k = u(() => new Set(D.filter((e) => (e.approved_by ?? []).length > 0).flatMap((e) => e.role_ids ?? [])), [D]), A = u(() => f ? x.data?.data.find((e) => e.id === f) : void 0, [x.data, f]);
16
37
  return {
17
- hasScheduledPayment: !!o || !!d,
18
- isResolving: u.isResolving,
19
- scheduledDateLabel: f ? n(f) : void 0
38
+ view: u(() => h && A ? s({
39
+ policy: A,
40
+ lookup: E,
41
+ approvedUserIds: O,
42
+ approvedRoleIds: k,
43
+ copy: m
44
+ }) : void 0, [
45
+ h,
46
+ A,
47
+ E,
48
+ O,
49
+ k,
50
+ m
51
+ ]),
52
+ isLoading: h && (x.isResolving || S.isResolving || C.isResolving || w.isLoading)
20
53
  };
21
54
  }
22
55
  //#endregion
23
- export { a as useScheduledPayment };
56
+ export { d as useApprovalPolicyCardView };
@@ -1,54 +1,29 @@
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/index5.js";
12
+ import "../../data-access/dist/index.js";
13
+ import { currentApprovalRound as a } from "./index13.js";
14
+ import { usePayableApprovalRoundStart as o } from "./index14.js";
1
15
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.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, now: a = /* @__PURE__ */ new Date() }) {
13
- if (e.has(n) && i) return {
14
- status: "scheduled",
15
- tone: "info"
16
- };
17
- if (e.has(n) && r && t(r, a)) return {
18
- status: "overdue",
19
- tone: "danger"
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
20
26
  };
21
- switch (n) {
22
- case "draft": return {
23
- status: "draft",
24
- tone: "neutral"
25
- };
26
- case "new":
27
- case "approve_in_progress": return {
28
- status: "pending_approval",
29
- tone: "warning"
30
- };
31
- case "waiting_to_be_paid": return {
32
- status: "ready_to_pay",
33
- tone: "info"
34
- };
35
- case "partially_paid": return {
36
- status: "partially_paid",
37
- tone: "success"
38
- };
39
- case "paid": return {
40
- status: "paid",
41
- tone: "success"
42
- };
43
- case "canceled": return {
44
- status: "canceled",
45
- tone: "neutral"
46
- };
47
- case "rejected": return {
48
- status: "rejected",
49
- tone: "danger"
50
- };
51
- }
52
27
  }
53
28
  //#endregion
54
- export { n as derivePayableStatus };
29
+ export { s as useCurrentApprovalRequestId };
@@ -1,8 +1,52 @@
1
- import { formatMoneyExact as e } from "../../../shared/util/dist/lib/formatMoneyExact.js";
2
- import "../../data-access/dist/index.js";
1
+ import { hasAnyScope as e } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
2
+ import { Scope as t } from "../../../shared/data-access/dist/lib/scopes.js";
3
+ import "../../../shared/data-access/dist/index.js";
3
4
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js
4
- function t(t, n) {
5
- if (typeof t == "number") return e(t / 100, { currencyCode: n ?? "USD" });
5
+ function n({ status: n, scopes: r, canDecideApprovalRequest: i, hasScheduledPayment: a, isPolicyApprover: o, hasWaitingRequest: s, labels: c }) {
6
+ let l = e(r, [t.PayablePayOrg]), u = e(r, [t.BankAccountReadOrg]), d = e(r, [t.PaymentRailAch]), f = e(r, [t.PayableWriteOrg]), p = e(r, [t.PayableApproveOrg]), m = [];
7
+ n === "approve_in_progress" && i && (m.push({
8
+ id: "approve",
9
+ label: c.approve,
10
+ variant: "default",
11
+ surface: "row"
12
+ }), m.push({
13
+ id: "reject",
14
+ label: c.reject,
15
+ variant: "ghost",
16
+ surface: "row"
17
+ })), n === "approve_in_progress" && s && p && !o && (m.push({
18
+ id: "forceApprove",
19
+ label: c.forceApprove,
20
+ variant: "ghost",
21
+ surface: "menu"
22
+ }), m.push({
23
+ id: "forceReject",
24
+ label: c.forceReject,
25
+ variant: "ghost",
26
+ surface: "menu"
27
+ }));
28
+ let h = (n === "waiting_to_be_paid" || n === "partially_paid") && l && !a, g = n === "waiting_to_be_paid" && l && u && d && !a;
29
+ return h && m.push({
30
+ id: "markAsPaid",
31
+ label: c.markAsPaid,
32
+ variant: "outline",
33
+ surface: "row"
34
+ }), g && m.push({
35
+ id: "payBill",
36
+ label: c.payBill,
37
+ variant: "default",
38
+ surface: "row"
39
+ }), (n === "new" || n === "waiting_to_be_paid" && !a) && f && m.push({
40
+ id: "cancel",
41
+ label: c.cancel,
42
+ variant: "ghost",
43
+ surface: "menu"
44
+ }), (n === "rejected" || n === "waiting_to_be_paid" && !a) && f && m.push({
45
+ id: "reopen",
46
+ label: c.reopen,
47
+ variant: "ghost",
48
+ surface: "menu"
49
+ }), m;
6
50
  }
7
51
  //#endregion
8
- export { t as formatBillMoney };
52
+ export { n as getBillDetailActions };
@@ -1,73 +1,101 @@
1
- import { formatCalendarDate as e } from "../../../shared/util/dist/lib/formatCalendarDate.js";
2
- import { resolveAmountDueMinorUnits as t } from "./index2.js";
3
- import { resolveVendor as n } from "./index3.js";
4
- import { derivePayableStatus as r } from "./index16.js";
5
- import { formatBillMoney as i } from "./index17.js";
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/index5.js";
10
+ import { useCancelPayableMutation as i, useForceApprovePayableMutation as a, useForceRejectPayableMutation as o, useMarkPayableAsPaidMutation as s, useReopenPayableMutation as c } from "../../data-access/dist/index10.js";
11
+ import "../../data-access/dist/index.js";
12
+ import { getBillDetailActions as l } from "./index17.js";
13
+ import { useState as u } from "react";
6
14
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js
7
- function a({ payable: a, lineItems: o, glCodeOptions: s, history: c, labels: l }) {
8
- let u = a.currency, d = r({
9
- apiStatus: a.status,
10
- dueDate: a.due_date,
11
- scheduledPaymentDate: a.scheduled_payment_date
12
- }), f = n(a), p = f?.bank_account?.account_number, m = e(a.issued_at) || l.notProvided, h = e(a.due_date) || l.notProvided, g = new Map(s.map((e) => [e.value, e.label])), _ = [
13
- {
14
- label: l.subtotalRow,
15
- minorUnits: a.subtotal
15
+ function d({ payableId: d, status: f, currentApprovalRequestId: m, isPolicyApprover: h, hasWaitingRequest: g, hasScheduledPayment: _, isScheduledPaymentUnknown: v, labels: y, onPayBillSelect: b }) {
16
+ let { initResponse: x } = t(), S = s(), C = r(), w = n(), T = i(), E = c(), D = a(), O = o(), k = S.isPending || C.isPending || w.isPending || T.isPending || E.isPending || D.isPending || O.isPending, [A, j] = u(), M = d && f ? l({
17
+ status: f,
18
+ scopes: x?.scopes,
19
+ canDecideApprovalRequest: !!m,
20
+ isPolicyApprover: h,
21
+ hasWaitingRequest: g,
22
+ hasScheduledPayment: _ || v,
23
+ labels: y
24
+ }) : [], N = { onError: () => e.error(y.actionError) }, P = {
25
+ markAsPaid: {
26
+ isPending: S.isPending,
27
+ run: () => d && S.mutate({ path: { payable_id: d } }, N)
16
28
  },
17
- {
18
- label: l.discountRow,
19
- minorUnits: a.discount
29
+ reject: {
30
+ isPending: C.isPending,
31
+ run: (e) => m && C.mutate({
32
+ path: { approval_request_id: m },
33
+ body: e ? { reject_reason: e } : void 0
34
+ }, N)
20
35
  },
21
- {
22
- label: l.taxRow,
23
- minorUnits: a.tax_amount
36
+ approve: {
37
+ isPending: w.isPending,
38
+ run: () => m && w.mutate({ path: { approval_request_id: m } }, N)
39
+ },
40
+ cancel: {
41
+ isPending: T.isPending,
42
+ run: () => d && T.mutate({ path: { payable_id: d } }, N)
43
+ },
44
+ reopen: {
45
+ isPending: E.isPending,
46
+ run: () => d && E.mutate({ path: { payable_id: d } }, N)
47
+ },
48
+ forceApprove: {
49
+ isPending: D.isPending,
50
+ run: () => d && D.mutate({ path: { payable_id: d } }, N)
51
+ },
52
+ forceReject: {
53
+ isPending: O.isPending,
54
+ run: () => d && O.mutate({ path: { payable_id: d } }, N)
24
55
  }
25
- ].map((e) => ({
26
- label: e.label,
27
- value: i(e.minorUnits, u)
28
- })).filter((e) => !!e.value), v = i(a.total_amount, u);
29
- return v && _.push({
30
- label: l.totalRow,
31
- value: v,
32
- emphasis: !0
33
- }), {
34
- amountDue: i(t(a), u) ?? "",
35
- invoiceDateLabel: m,
36
- dueDateLabel: h,
37
- status: d.status,
38
- statusTone: d.tone,
39
- payTo: {
40
- name: f?.name || l.notProvided,
41
- email: f?.email ?? void 0,
42
- paymentInstructionsLabel: p ? l.paymentInstructionsValue(p.slice(-4)) : void 0
56
+ }, F = M.map((e) => ({
57
+ ...e,
58
+ disabled: k,
59
+ loading: P[e.id]?.isPending ?? !1,
60
+ onSelect: () => {
61
+ if (!(k || !d)) {
62
+ if (e.id === "payBill") {
63
+ b();
64
+ return;
65
+ }
66
+ if (p(e.id)) {
67
+ j(e.id);
68
+ return;
69
+ }
70
+ P[e.id]?.run();
71
+ }
72
+ }
73
+ }));
74
+ return {
75
+ actions: {
76
+ row: F.filter((e) => e.surface === "row"),
77
+ menu: F.filter((e) => e.surface === "menu")
43
78
  },
44
- invoiceFields: [
45
- {
46
- label: l.invoiceDateRow,
47
- value: m
48
- },
49
- {
50
- label: l.dueDateRow,
51
- value: h
79
+ decisionDialog: {
80
+ open: !!A,
81
+ copy: A ? y.decisionDialog[A] : void 0,
82
+ isPending: A ? P[A]?.isPending ?? !1 : !1,
83
+ onCancel: () => {
84
+ k || j(void 0);
52
85
  },
53
- {
54
- label: l.invoiceNumberRow,
55
- value: a.document_id || l.notProvided
86
+ onConfirm: (e) => {
87
+ !A || k || (P[A]?.run(e), j(void 0));
56
88
  }
57
- ],
58
- lineItems: o.map((e) => {
59
- let t = i(e.unit_price, u);
60
- return {
61
- id: e.id,
62
- description: e.name ?? e.description ?? "",
63
- glCodeLabel: (e.ledger_account_id ? g.get(e.ledger_account_id) : void 0) || l.glCodeMissing,
64
- qtyPriceLabel: e.quantity != null && t ? l.qtyPriceValue(String(e.quantity), t) : "",
65
- amount: i(e.subtotal, u) ?? ""
66
- };
67
- }),
68
- amountRows: _,
69
- history: c
89
+ }
70
90
  };
71
91
  }
92
+ var f = [
93
+ "reject",
94
+ "forceApprove",
95
+ "forceReject"
96
+ ];
97
+ function p(e) {
98
+ return f.includes(e);
99
+ }
72
100
  //#endregion
73
- export { a as buildBillDetailView };
101
+ export { d as usePayableDetailActions };