@tesouro/embedded-components-react 0.5.270 → 0.5.271

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.
@@ -11,29 +11,33 @@ import "../../../../shared/data-access/dist/index.js";
11
11
  import { NEWEST_REQUEST_FIRST as o, PAYABLE_OBJECT_TYPE as s } from "../../../data-access/dist/lib/queryKeys.js";
12
12
  import { invalidateApprovalDecisionQueries as c, reconcileApprovalDecisionQueries as l } from "../../../data-access/dist/lib/invalidatePayableQueries/approvalDecisionQueries.js";
13
13
  import { beginApprovalRequestWatch as u } from "../../../data-access/dist/lib/invalidatePayableQueries/approvalRequestWatch.js";
14
+ import { APPROVAL_REQUEST_POLL_TIMEOUT_MS as d } from "../../../data-access/dist/lib/invalidatePayableQueries/reconcileSubmittedForApprovalQueries.js";
14
15
  import "../../../data-access/dist/invalidation.js";
15
16
  import "../../../data-access/dist/index.js";
16
- import { useMutation as d, useQuery as f } from "@tanstack/react-query";
17
+ import { useState as f } from "react";
18
+ import { useMutation as p, useQuery as m } from "@tanstack/react-query";
17
19
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/data-access/dist/index2.js
18
- function p(e, { enabled: t } = {}) {
19
- let { client: c, organizationId: l, widgetToken: u, authEpoch: d, organizationStatus: p } = i(), m = !!(l && u && e) && t !== !1, h = n({
20
- client: c,
21
- headers: a(l),
20
+ var h = 5e3, g = 3e4;
21
+ function _(e, { enabled: t, hasAwaitedRequest: c, currentRoundStartedAt: l } = {}) {
22
+ let { client: u, organizationId: p, widgetToken: _, authEpoch: v, organizationStatus: y } = i(), [b] = f(() => Date.now()), x = Math.max(l ? Date.parse(l) : b, b) + d, S = !!(p && _ && e) && t !== !1, C = n({
23
+ client: u,
24
+ headers: a(p),
22
25
  query: {
23
26
  object_id: e ?? "",
24
27
  object_type: s,
25
28
  order: o
26
29
  }
27
30
  });
28
- return f({
29
- ...r(h, {
30
- authEpoch: d,
31
- organizationStatus: p
31
+ return m({
32
+ ...r(C, {
33
+ authEpoch: v,
34
+ organizationStatus: y
32
35
  }),
33
- enabled: m
36
+ enabled: S,
37
+ refetchInterval: (e) => !c || c(e.state.data?.data ?? []) ? !1 : Date.now() < x ? h : g
34
38
  });
35
39
  }
36
- async function m({ client: e, organizationId: t, payableId: n, requestStatus: r }) {
40
+ async function v({ client: e, organizationId: t, payableId: n, requestStatus: r }) {
37
41
  let i = n && r !== "waiting" && n ? await u({
38
42
  client: e,
39
43
  organizationId: t,
@@ -50,9 +54,9 @@ async function m({ client: e, organizationId: t, payableId: n, requestStatus: r
50
54
  watch: i
51
55
  }).catch(() => {});
52
56
  }
53
- function h() {
57
+ function y() {
54
58
  let { client: t, organizationId: n } = i();
55
- return d({
59
+ return p({
56
60
  mutationFn: async ({ path: r }) => {
57
61
  let { data: i } = await e({
58
62
  client: t,
@@ -63,7 +67,7 @@ function h() {
63
67
  return i;
64
68
  },
65
69
  onSuccess: async (e) => {
66
- await m({
70
+ await v({
67
71
  client: t,
68
72
  organizationId: n,
69
73
  payableId: e?.object_id,
@@ -72,9 +76,9 @@ function h() {
72
76
  }
73
77
  });
74
78
  }
75
- function g() {
79
+ function b() {
76
80
  let { client: e, organizationId: n } = i();
77
- return d({
81
+ return p({
78
82
  mutationFn: async ({ path: r, body: i }) => {
79
83
  let { data: o } = await t({
80
84
  client: e,
@@ -86,7 +90,7 @@ function g() {
86
90
  return o;
87
91
  },
88
92
  onSuccess: async (t) => {
89
- await m({
93
+ await v({
90
94
  client: e,
91
95
  organizationId: n,
92
96
  payableId: t?.object_id,
@@ -96,4 +100,4 @@ function g() {
96
100
  });
97
101
  }
98
102
  //#endregion
99
- export { h as useApprovePayableApprovalRequestMutation, p as usePayableApprovalRequestsQuery, g as useRejectPayableApprovalRequestMutation };
103
+ export { y as useApprovePayableApprovalRequestMutation, _ as usePayableApprovalRequestsQuery, b as useRejectPayableApprovalRequestMutation };
@@ -14,15 +14,19 @@ import { currentApprovalRound as a } from "./index3.js";
14
14
  import { usePayableApprovalRoundStart as o } from "./index11.js";
15
15
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index14.js
16
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({
17
+ let { initResponse: l } = r(), u = e(l?.scopes, [n.ApprovalRequestReadOrg]), d = c === "approve_in_progress" && u, { roundStartedAt: f } = o({
18
18
  payableId: s,
19
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");
20
+ }), p = t({ enabled: d }), m = p.data?.id, h = (e) => e.caller_is_policy_approver ?? !!(m && e.user_ids.includes(m)), g = i(s, {
21
+ enabled: d,
22
+ hasAwaitedRequest: d ? (e) => a(e, f).some(h) : void 0,
23
+ currentRoundStartedAt: f
24
+ }), _ = d ? a(g.data?.data, f) : [], v = _.some(h), y = _.filter((e) => e.status === "waiting");
21
25
  return {
22
- id: y.filter(_).find((e) => !(h && (e.approved_by ?? []).includes(h)))?.id,
26
+ id: y.filter(h).find((e) => !(m && (e.approved_by ?? []).includes(m)))?.id,
23
27
  isPolicyApprover: v,
24
28
  hasWaitingRequest: y.length > 0,
25
- isLoading: f.isLoading || p.isLoading
29
+ isLoading: g.isLoading || p.isLoading
26
30
  };
27
31
  }
28
32
  //#endregion
@@ -5,7 +5,7 @@ import { beginApprovalRequestWatch as o } from "./lib/invalidatePayableQueries/a
5
5
  import { invalidateDeletedPayableQueries as s } from "./lib/invalidatePayableQueries/invalidateDeletedPayableQueries.js";
6
6
  import { hasLiveScheduledRecord as c } from "./lib/invalidatePayableQueries/hasLiveScheduledRecord.js";
7
7
  import { reconcileCancelledPaymentQueries as l } from "./lib/invalidatePayableQueries/reconcileCancelledPaymentQueries.js";
8
- import { reconcileSubmittedForApprovalQueries as u } from "./lib/invalidatePayableQueries/reconcileSubmittedForApprovalQueries.js";
8
+ import { APPROVAL_REQUEST_POLL_TIMEOUT_MS as u, reconcileSubmittedForApprovalQueries as d } from "./lib/invalidatePayableQueries/reconcileSubmittedForApprovalQueries.js";
9
9
  import "./lib/invalidatePayableQueries/index.js";
10
- import { OCR_POLL_INTERVAL_MS as d, payableOcrQueryOptions as f } from "./lib/payableOcrQueryOptions.js";
11
- export { d as OCR_POLL_INTERVAL_MS, t as PAYABLE_PROJECTION_POLL_INTERVAL_MS, n as PAYABLE_PROJECTION_POLL_TIMEOUT_MS, o as beginApprovalRequestWatch, c as hasLiveScheduledRecord, i as invalidateApprovalDecisionQueries, s as invalidateDeletedPayableQueries, e as invalidatePayableQueries, r as nextPollInterval, f as payableOcrQueryOptions, a as reconcileApprovalDecisionQueries, l as reconcileCancelledPaymentQueries, u as reconcileSubmittedForApprovalQueries };
10
+ import { OCR_POLL_INTERVAL_MS as f, payableOcrQueryOptions as p } from "./lib/payableOcrQueryOptions.js";
11
+ export { u as APPROVAL_REQUEST_POLL_TIMEOUT_MS, f as OCR_POLL_INTERVAL_MS, t as PAYABLE_PROJECTION_POLL_INTERVAL_MS, n as PAYABLE_PROJECTION_POLL_TIMEOUT_MS, o as beginApprovalRequestWatch, c as hasLiveScheduledRecord, i as invalidateApprovalDecisionQueries, s as invalidateDeletedPayableQueries, e as invalidatePayableQueries, r as nextPollInterval, p as payableOcrQueryOptions, a as reconcileApprovalDecisionQueries, l as reconcileCancelledPaymentQueries, d as reconcileSubmittedForApprovalQueries };
@@ -24,4 +24,4 @@ async function i({ client: i, organizationId: a, payableId: o, watch: s }) {
24
24
  }), u;
25
25
  }
26
26
  //#endregion
27
- export { i as reconcileSubmittedForApprovalQueries };
27
+ export { n as APPROVAL_REQUEST_POLL_TIMEOUT_MS, i as reconcileSubmittedForApprovalQueries };
@@ -1,5 +1,5 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
2
- var e = "@tesouro/embedded-components-react", t = "0.5.270", n = "14d67aa3ec857ae8a2662771ba272c4b58d32192", r = Object.freeze({
2
+ var e = "@tesouro/embedded-components-react", t = "0.5.271", n = "8dab6570778b10180c6641788625a690f8f812c8", r = Object.freeze({
3
3
  library_name: e,
4
4
  library_version: t,
5
5
  library_sha: n
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tesouro/embedded-components-react",
3
- "version": "0.5.270",
3
+ "version": "0.5.271",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "packageDepSync": {