@tesouro/embedded-components-react 0.3.34 → 0.3.36

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 (38) hide show
  1. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/data-access/dist/index5.js +33 -31
  2. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/index6.js +5 -9
  3. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/index7.js +98 -92
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index.js +12 -11
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index10.js +26 -300
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index11.js +314 -12
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index12.js +13 -26
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index13.js +20 -40
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index14.js +39 -25
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index15.js +36 -0
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index3.js +5 -29
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index4.js +28 -102
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index5.js +115 -65
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index6.js +60 -16
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index7.js +18 -63
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index8.js +50 -29
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index9.js +39 -30
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +1 -1
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +1 -1
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +1 -1
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +1 -1
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +2 -2
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +8 -8
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +9 -8
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +1 -1
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +1 -1
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +1 -1
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +1 -1
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index4.js +1 -1
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +2 -2
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +4 -4
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +3 -3
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +2 -2
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +1 -1
  35. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +2 -2
  36. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +6 -10
  37. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  38. package/package.json +1 -1
@@ -3,48 +3,28 @@
3
3
  "use client";
4
4
  "use client";
5
5
  import { useEmbedApi as e } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
6
- import { organizationHeaders as t } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
7
- import { getPayablesAnalyticsOptions as n, getPayablesIdOptions as r, getPayablesOptions as i } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
8
- import { withAuthEpoch as a } from "../../../shared/data-access/dist/lib/withAuthEpoch.js";
6
+ import { withAuthEpoch as t } from "../../../shared/data-access/dist/lib/withAuthEpoch.js";
9
7
  import "../../../shared/data-access/dist/index.js";
10
- import { payableOcrQueryOptions as o } from "./index11.js";
11
- import { useQuery as s } from "@tanstack/react-query";
8
+ import { payableOcrQueryOptions as n } from "./index12.js";
9
+ import { useQueries as r } from "@tanstack/react-query";
12
10
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index13.js
13
- function c({ enabled: n, ...r } = {}) {
14
- let { client: o, organizationId: c, widgetToken: l, authEpoch: u } = e(), d = !!(c && l) && (n === !0 || n === void 0), f = i({
15
- client: o,
16
- headers: t(c),
17
- query: r
18
- });
19
- return s({
20
- ...a(f, u),
21
- enabled: d
22
- });
23
- }
24
- function l({ enabled: r } = {}) {
25
- let { client: i, organizationId: o, widgetToken: c, authEpoch: l } = e(), u = !!(o && c) && (r === !0 || r === void 0), d = n({
26
- client: i,
27
- headers: t(o)
28
- });
29
- return s({
30
- ...a(d, l),
31
- enabled: u
32
- });
33
- }
34
- function u(n, { enabled: i = !0, pollWhileOcrProcessing: c = !1 } = {}) {
35
- let { client: l, organizationId: u, widgetToken: d, authEpoch: f } = e(), p = !!(u && d && n) && i, m = c ? o({
36
- client: l,
37
- organizationId: u,
38
- payableId: n ?? ""
39
- }) : r({
40
- client: l,
41
- headers: t(u),
42
- path: { payable_id: n ?? "" }
43
- });
44
- return s({
45
- ...a(m, f),
46
- enabled: p
11
+ function i({ payableIds: i, enabled: a }) {
12
+ let { client: o, organizationId: s, widgetToken: c, authEpoch: l } = e(), u = !!(s && c) && (a === !0 || a === void 0);
13
+ return r({
14
+ queries: i.map((e) => ({
15
+ ...t(n({
16
+ client: o,
17
+ organizationId: s,
18
+ payableId: e
19
+ }), l),
20
+ enabled: u && !!e
21
+ })),
22
+ combine: (e) => e.map((e, t) => ({
23
+ payableId: i[t],
24
+ ocrStatus: e.data?.ocr_status,
25
+ isError: e.isError
26
+ }))
47
27
  });
48
28
  }
49
29
  //#endregion
50
- export { u as usePayableQuery, c as usePayablesQuery, l as usePayablesTotalCountQuery };
30
+ export { i as usePayableOcrQueries };
@@ -4,33 +4,47 @@
4
4
  "use client";
5
5
  import { useEmbedApi as e } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
6
6
  import { organizationHeaders as t } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
7
- import { getPayablesIdSuggestionsOptions as n } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
8
- import { withAuthEpoch as r } from "../../../shared/data-access/dist/lib/withAuthEpoch.js";
9
- import { isApiNotFoundError as i } from "../../../shared/data-access/dist/lib/isApiNotFoundError.js";
7
+ import { getPayablesAnalyticsOptions as n, getPayablesIdOptions as r, getPayablesOptions as i } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
8
+ import { withAuthEpoch as a } from "../../../shared/data-access/dist/lib/withAuthEpoch.js";
10
9
  import "../../../shared/data-access/dist/index.js";
11
- import { useQuery as a } from "@tanstack/react-query";
10
+ import { payableOcrQueryOptions as o } from "./index12.js";
11
+ import { useQuery as s } from "@tanstack/react-query";
12
12
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index14.js
13
- function o(o, { enabled: s = !0 } = {}) {
14
- let { client: c, organizationId: l, widgetToken: u, authEpoch: d } = e(), f = !!(l && u && o) && s, p = n({
15
- client: c,
16
- headers: t(l),
17
- path: { payable_id: o ?? "" }
18
- }), { queryKey: m, queryFn: h } = r(p, d);
19
- return a({
20
- queryKey: m,
21
- enabled: f,
22
- retry: !1,
23
- queryFn: async (e) => {
24
- try {
25
- if (typeof h != "function") throw Error("getPayablesIdSuggestionsOptions has no queryFn");
26
- return await h(e);
27
- } catch (e) {
28
- if (i(e)) return null;
29
- throw e;
30
- }
31
- },
32
- select: (e) => e ?? void 0
13
+ function c({ enabled: n, ...r } = {}) {
14
+ let { client: o, organizationId: c, widgetToken: l, authEpoch: u } = e(), d = !!(c && l) && (n === !0 || n === void 0), f = i({
15
+ client: o,
16
+ headers: t(c),
17
+ query: r
18
+ });
19
+ return s({
20
+ ...a(f, u),
21
+ enabled: d
22
+ });
23
+ }
24
+ function l({ enabled: r } = {}) {
25
+ let { client: i, organizationId: o, widgetToken: c, authEpoch: l } = e(), u = !!(o && c) && (r === !0 || r === void 0), d = n({
26
+ client: i,
27
+ headers: t(o)
28
+ });
29
+ return s({
30
+ ...a(d, l),
31
+ enabled: u
32
+ });
33
+ }
34
+ function u(n, { enabled: i = !0, pollWhileOcrProcessing: c = !1 } = {}) {
35
+ let { client: l, organizationId: u, widgetToken: d, authEpoch: f } = e(), p = !!(u && d && n) && i, m = c ? o({
36
+ client: l,
37
+ organizationId: u,
38
+ payableId: n ?? ""
39
+ }) : r({
40
+ client: l,
41
+ headers: t(u),
42
+ path: { payable_id: n ?? "" }
43
+ });
44
+ return s({
45
+ ...a(m, f),
46
+ enabled: p
33
47
  });
34
48
  }
35
49
  //#endregion
36
- export { o as usePayableSuggestionsQuery };
50
+ export { u as usePayableQuery, c as usePayablesQuery, l as usePayablesTotalCountQuery };
@@ -0,0 +1,36 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { useEmbedApi as e } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
6
+ import { organizationHeaders as t } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
7
+ import { getPayablesIdSuggestionsOptions as n } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
8
+ import { withAuthEpoch as r } from "../../../shared/data-access/dist/lib/withAuthEpoch.js";
9
+ import { isApiNotFoundError as i } from "../../../shared/data-access/dist/lib/isApiNotFoundError.js";
10
+ import "../../../shared/data-access/dist/index.js";
11
+ import { useQuery as a } from "@tanstack/react-query";
12
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index15.js
13
+ function o(o, { enabled: s = !0 } = {}) {
14
+ let { client: c, organizationId: l, widgetToken: u, authEpoch: d } = e(), f = !!(l && u && o) && s, p = n({
15
+ client: c,
16
+ headers: t(l),
17
+ path: { payable_id: o ?? "" }
18
+ }), { queryKey: m, queryFn: h } = r(p, d);
19
+ return a({
20
+ queryKey: m,
21
+ enabled: f,
22
+ retry: !1,
23
+ queryFn: async (e) => {
24
+ try {
25
+ if (typeof h != "function") throw Error("getPayablesIdSuggestionsOptions has no queryFn");
26
+ return await h(e);
27
+ } catch (e) {
28
+ if (i(e)) return null;
29
+ throw e;
30
+ }
31
+ },
32
+ select: (e) => e ?? void 0
33
+ });
34
+ }
35
+ //#endregion
36
+ export { o as usePayableSuggestionsQuery };
@@ -1,31 +1,7 @@
1
- import { organizationHeaders as e } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
2
- import { getApprovalRequestsQueryKey as t, getPayablesAnalyticsQueryKey as n, getPayablesIdHistoryQueryKey as r, getPayablesIdLineItemsQueryKey as i, getPayablesIdQueryKey as a, getPayablesQueryKey as o, getPaymentRecordsQueryKey as s } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
3
- import "../../../shared/data-access/dist/index.js";
4
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index3.js
5
- var c = ({ client: t, organizationId: n }) => o({
6
- client: t,
7
- headers: e(n)
8
- }), l = ({ client: n, organizationId: r }) => t({
9
- client: n,
10
- headers: e(r)
11
- }), u = ({ client: t, organizationId: r }) => n({
12
- client: t,
13
- headers: e(r)
14
- }), d = ({ client: t, organizationId: n, payableId: r }) => a({
15
- client: t,
16
- headers: e(n),
17
- path: { payable_id: r }
18
- }), f = ({ client: t, organizationId: n, payableId: i }) => r({
19
- client: t,
20
- headers: e(n),
21
- path: { payable_id: i }
22
- }), p = ({ client: t, organizationId: n, payableId: r }) => i({
23
- client: t,
24
- headers: e(n),
25
- path: { payable_id: r }
26
- }), m = ({ client: t, organizationId: n }) => s({
27
- client: t,
28
- headers: e(n)
29
- });
2
+ var e = /* @__PURE__ */ new Set(["created", "processing"]);
3
+ function t(t) {
4
+ return !!t.status && e.has(t.status) && !!t.payment_intent_id;
5
+ }
30
6
  //#endregion
31
- export { l as approvalRequestsInvalidationKey, f as payableHistoryInvalidationKey, d as payableInvalidationKey, p as payableLineItemsInvalidationKey, m as payablePaymentRecordsInvalidationKey, u as payablesAnalyticsInvalidationKey, c as payablesInvalidationKey };
7
+ export { t as isLiveScheduledPaymentRecord };
@@ -1,105 +1,31 @@
1
- import { cancelAllClients as e, invalidateAllClients as t, removeInactiveFromAllClients as n } from "../../../shared/data-access/dist/lib/clientRegistry.js";
2
- import { organizationHeaders as r } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
3
- import { getPayablesId as i, getPaymentRecords as a } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
1
+ import { organizationHeaders as e } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
2
+ import { getApprovalRequestsQueryKey as t, getPayablesAnalyticsQueryKey as n, getPayablesIdHistoryQueryKey as r, getPayablesIdLineItemsQueryKey as i, getPayablesIdQueryKey as a, getPayablesQueryKey as o, getPaymentRecordsQueryKey as s } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
4
3
  import "../../../shared/data-access/dist/index.js";
5
- import { approvalRequestsInvalidationKey as o, payableHistoryInvalidationKey as s, payableInvalidationKey as c, payableLineItemsInvalidationKey as l, payablePaymentRecordsInvalidationKey as u, payablesAnalyticsInvalidationKey as d, payablesInvalidationKey as f } from "./index3.js";
6
4
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index4.js
7
- async function p({ client: e, organizationId: n, payableId: r, includeLineItems: i, includeApprovalRequests: a }) {
8
- let p = {
9
- client: e,
10
- organizationId: n
11
- }, m = r ? {
12
- ...p,
13
- payableId: r
14
- } : void 0, h = [
15
- f(p),
16
- d(p),
17
- ...a ? [o(p)] : [],
18
- ...m ? [
19
- c(m),
20
- s(m),
21
- u(m)
22
- ] : [],
23
- ...m && i ? [l(m)] : []
24
- ];
25
- await Promise.all(h.map((e) => t(e)));
26
- }
27
- async function m({ client: r, organizationId: i, payableId: a }) {
28
- let o = {
29
- client: r,
30
- organizationId: i
31
- };
32
- if (await Promise.all([t(f(o)), t(d(o))]), !a) return;
33
- let u = {
34
- ...o,
35
- payableId: a
36
- }, p = [
37
- c(u),
38
- s(u),
39
- l(u)
40
- ];
41
- await Promise.all(p.map((t) => e(t))), p.forEach((e) => n(e));
42
- }
43
- var h = 500;
44
- async function g({ client: e, organizationId: n, payableId: r }) {
45
- await t(o({
46
- client: e,
47
- organizationId: n
48
- })), await new Promise((e) => {
49
- setTimeout(e, h);
50
- }), await p({
51
- client: e,
52
- organizationId: n,
53
- payableId: r
54
- });
55
- }
56
- var _ = 2e4, v = 1e3, y = /* @__PURE__ */ new Set(["created", "processing"]);
57
- async function b({ client: e, organizationId: t, payableId: n }) {
58
- let i = Date.now() + _, o = !1;
59
- for (; !o && Date.now() < i;) {
60
- await new Promise((e) => {
61
- setTimeout(e, v);
62
- });
63
- try {
64
- let { data: i } = await a({
65
- client: e,
66
- headers: r(t),
67
- query: {
68
- limit: 100,
69
- object_id__in: [n],
70
- order: "desc",
71
- sort: "paid_at"
72
- }
73
- });
74
- o = (i?.data ?? []).some((e) => !!e.status && y.has(e.status));
75
- } catch {}
76
- }
77
- return await p({
78
- client: e,
79
- organizationId: t,
80
- payableId: n
81
- }), o;
82
- }
83
- async function x({ client: e, organizationId: t, payableId: n }) {
84
- let a = Date.now() + _, o = !1;
85
- for (; !o && Date.now() < a;) {
86
- await new Promise((e) => {
87
- setTimeout(e, v);
88
- });
89
- try {
90
- let { data: a } = await i({
91
- client: e,
92
- headers: r(t),
93
- path: { payable_id: n }
94
- });
95
- o = !a?.scheduled_payment_date;
96
- } catch {}
97
- }
98
- return await p({
99
- client: e,
100
- organizationId: t,
101
- payableId: n
102
- }), o;
103
- }
5
+ var c = ({ client: t, organizationId: n }) => o({
6
+ client: t,
7
+ headers: e(n)
8
+ }), l = ({ client: n, organizationId: r }) => t({
9
+ client: n,
10
+ headers: e(r)
11
+ }), u = ({ client: t, organizationId: r }) => n({
12
+ client: t,
13
+ headers: e(r)
14
+ }), d = ({ client: t, organizationId: n, payableId: r }) => a({
15
+ client: t,
16
+ headers: e(n),
17
+ path: { payable_id: r }
18
+ }), f = ({ client: t, organizationId: n, payableId: i }) => r({
19
+ client: t,
20
+ headers: e(n),
21
+ path: { payable_id: i }
22
+ }), p = ({ client: t, organizationId: n, payableId: r }) => i({
23
+ client: t,
24
+ headers: e(n),
25
+ path: { payable_id: r }
26
+ }), m = ({ client: t, organizationId: n }) => s({
27
+ client: t,
28
+ headers: e(n)
29
+ });
104
30
  //#endregion
105
- export { g as invalidateApprovalDecisionQueries, m as invalidateDeletedPayableQueries, p as invalidatePayableQueries, x as reconcileCancelledPaymentQueries, b as reconcileScheduledPaymentQueries };
31
+ export { l as approvalRequestsInvalidationKey, f as payableHistoryInvalidationKey, d as payableInvalidationKey, p as payableLineItemsInvalidationKey, m as payablePaymentRecordsInvalidationKey, u as payablesAnalyticsInvalidationKey, c as payablesInvalidationKey };
@@ -1,74 +1,124 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { useEmbedApi as e } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
6
- import { organizationHeaders as t } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
7
- import { postApprovalRequestsIdApprove as n, postApprovalRequestsIdReject as r } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
8
- import { getApprovalRequestsOptions as i } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
9
- import { withAuthEpoch as a } from "../../../shared/data-access/dist/lib/withAuthEpoch.js";
1
+ import { cancelAllClients as e, invalidateAllClients as t, removeInactiveFromAllClients as n } from "../../../shared/data-access/dist/lib/clientRegistry.js";
2
+ import { organizationHeaders as r } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
3
+ import { getPayablesId as i, getPaymentRecords as a } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
10
4
  import "../../../shared/data-access/dist/index.js";
11
- import { invalidateApprovalDecisionQueries as o } from "./index4.js";
12
- import { useMutation as s, useQuery as c } from "@tanstack/react-query";
5
+ import { isLiveScheduledPaymentRecord as o } from "./index3.js";
6
+ import { approvalRequestsInvalidationKey as s, payableHistoryInvalidationKey as c, payableInvalidationKey as l, payableLineItemsInvalidationKey as u, payablePaymentRecordsInvalidationKey as d, payablesAnalyticsInvalidationKey as f, payablesInvalidationKey as p } from "./index4.js";
13
7
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index5.js
14
- var l = "payable", u = "desc";
15
- function d(n, { enabled: r } = {}) {
16
- let { client: o, organizationId: s, widgetToken: d, authEpoch: f } = e(), p = !!(s && d && n) && r !== !1, m = i({
17
- client: o,
18
- headers: t(s),
19
- query: {
20
- object_id: n ?? "",
21
- object_type: l,
22
- order: u
23
- }
24
- });
25
- return c({
26
- ...a(m, f),
27
- enabled: p
28
- });
8
+ async function m({ client: e, organizationId: n, payableId: r, includeLineItems: i, includeApprovalRequests: a }) {
9
+ let o = {
10
+ client: e,
11
+ organizationId: n
12
+ }, m = r ? {
13
+ ...o,
14
+ payableId: r
15
+ } : void 0, h = [
16
+ p(o),
17
+ f(o),
18
+ ...a ? [s(o)] : [],
19
+ ...m ? [
20
+ l(m),
21
+ c(m),
22
+ d(m)
23
+ ] : [],
24
+ ...m && i ? [u(m)] : []
25
+ ];
26
+ await Promise.all(h.map((e) => t(e)));
29
27
  }
30
- function f() {
31
- let { client: r, organizationId: i } = e();
32
- return s({
33
- mutationFn: async ({ path: e }) => {
34
- let { data: a } = await n({
35
- client: r,
36
- headers: t(i),
37
- path: e,
38
- throwOnError: !0
39
- });
40
- return a;
41
- },
42
- onSuccess: async (e) => {
43
- await o({
44
- client: r,
45
- organizationId: i,
46
- payableId: e?.object_id
47
- });
48
- }
28
+ async function h({ client: r, organizationId: i, payableId: a }) {
29
+ let o = {
30
+ client: r,
31
+ organizationId: i
32
+ };
33
+ if (await Promise.all([t(p(o)), t(f(o))]), !a) return;
34
+ let s = {
35
+ ...o,
36
+ payableId: a
37
+ }, d = [
38
+ l(s),
39
+ c(s),
40
+ u(s)
41
+ ];
42
+ await Promise.all(d.map((t) => e(t))), d.forEach((e) => n(e));
43
+ }
44
+ var g = 500;
45
+ async function _({ client: e, organizationId: n, payableId: r }) {
46
+ await t(s({
47
+ client: e,
48
+ organizationId: n
49
+ })), await new Promise((e) => {
50
+ setTimeout(e, g);
51
+ }), await m({
52
+ client: e,
53
+ organizationId: n,
54
+ payableId: r
49
55
  });
50
56
  }
51
- function p() {
52
- let { client: n, organizationId: i } = e();
53
- return s({
54
- mutationFn: async ({ path: e, body: a }) => {
55
- let { data: o } = await r({
56
- client: n,
57
- headers: t(i),
58
- path: e,
59
- body: a?.reject_reason ? a : void 0,
60
- throwOnError: !0
57
+ var v = 2e4, y = 1e3, b = 100;
58
+ async function x({ client: e, organizationId: t, payableId: n }) {
59
+ let r = Date.now() + v, i = !1;
60
+ for (; !i && Date.now() < r;) await new Promise((e) => {
61
+ setTimeout(e, y);
62
+ }), i = await S({
63
+ client: e,
64
+ organizationId: t,
65
+ payableId: n
66
+ }) === !0;
67
+ return await m({
68
+ client: e,
69
+ organizationId: t,
70
+ payableId: n
71
+ }), i;
72
+ }
73
+ async function S({ client: e, organizationId: t, payableId: n }) {
74
+ let i = /* @__PURE__ */ new Set(), s;
75
+ try {
76
+ do {
77
+ let { data: c } = await a({
78
+ client: e,
79
+ headers: r(t),
80
+ query: {
81
+ limit: b,
82
+ object_id__in: [n],
83
+ order: "desc",
84
+ sort: "paid_at",
85
+ is_external: !1,
86
+ ...s ? { pagination_token: s } : {}
87
+ }
61
88
  });
62
- return o;
63
- },
64
- onSuccess: async (e) => {
65
- await o({
66
- client: n,
67
- organizationId: i,
68
- payableId: e?.object_id
89
+ if ((c?.data ?? []).some(o)) return !0;
90
+ let l = c?.next_pagination_token ?? void 0;
91
+ s = l && !i.has(l) ? (i.add(l), l) : void 0;
92
+ } while (s);
93
+ return !1;
94
+ } catch {
95
+ return;
96
+ }
97
+ }
98
+ async function C({ client: e, organizationId: t, payableId: n }) {
99
+ let a = Date.now() + v, o = !1;
100
+ for (; !o && Date.now() < a;) {
101
+ await new Promise((e) => {
102
+ setTimeout(e, y);
103
+ });
104
+ try {
105
+ let { data: a } = await i({
106
+ client: e,
107
+ headers: r(t),
108
+ path: { payable_id: n }
69
109
  });
70
- }
71
- });
110
+ o = !a?.scheduled_payment_date && await S({
111
+ client: e,
112
+ organizationId: t,
113
+ payableId: n
114
+ }) === !1;
115
+ } catch {}
116
+ }
117
+ return await m({
118
+ client: e,
119
+ organizationId: t,
120
+ payableId: n
121
+ }), o;
72
122
  }
73
123
  //#endregion
74
- export { f as useApprovePayableApprovalRequestMutation, d as usePayableApprovalRequestsQuery, p as useRejectPayableApprovalRequestMutation };
124
+ export { _ as invalidateApprovalDecisionQueries, h as invalidateDeletedPayableQueries, m as invalidatePayableQueries, C as reconcileCancelledPaymentQueries, x as reconcileScheduledPaymentQueries };
@@ -4,27 +4,71 @@
4
4
  "use client";
5
5
  import { useEmbedApi as e } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
6
6
  import { organizationHeaders as t } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
7
- import { getPayablesIdHistoryOptions as n } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
8
- import { withAuthEpoch as r } from "../../../shared/data-access/dist/lib/withAuthEpoch.js";
7
+ import { postApprovalRequestsIdApprove as n, postApprovalRequestsIdReject as r } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
8
+ import { getApprovalRequestsOptions as i } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
9
+ import { withAuthEpoch as a } from "../../../shared/data-access/dist/lib/withAuthEpoch.js";
9
10
  import "../../../shared/data-access/dist/index.js";
10
- import { useQuery as i } from "@tanstack/react-query";
11
+ import { invalidateApprovalDecisionQueries as o } from "./index5.js";
12
+ import { useMutation as s, useQuery as c } from "@tanstack/react-query";
11
13
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index6.js
12
- var a = 100;
13
- function o(o, { enabled: s } = {}) {
14
- let { client: c, organizationId: l, widgetToken: u, authEpoch: d } = e(), f = !!(l && u && o) && s !== !1, p = n({
15
- client: c,
16
- headers: t(l),
17
- path: { payable_id: o ?? "" },
14
+ var l = "payable", u = "desc";
15
+ function d(n, { enabled: r } = {}) {
16
+ let { client: o, organizationId: s, widgetToken: d, authEpoch: f } = e(), p = !!(s && d && n) && r !== !1, m = i({
17
+ client: o,
18
+ headers: t(s),
18
19
  query: {
19
- sort: "timestamp",
20
- order: "asc",
21
- limit: a
20
+ object_id: n ?? "",
21
+ object_type: l,
22
+ order: u
22
23
  }
23
24
  });
24
- return i({
25
- ...r(p, d),
26
- enabled: f
25
+ return c({
26
+ ...a(m, f),
27
+ enabled: p
28
+ });
29
+ }
30
+ function f() {
31
+ let { client: r, organizationId: i } = e();
32
+ return s({
33
+ mutationFn: async ({ path: e }) => {
34
+ let { data: a } = await n({
35
+ client: r,
36
+ headers: t(i),
37
+ path: e,
38
+ throwOnError: !0
39
+ });
40
+ return a;
41
+ },
42
+ onSuccess: async (e) => {
43
+ await o({
44
+ client: r,
45
+ organizationId: i,
46
+ payableId: e?.object_id
47
+ });
48
+ }
49
+ });
50
+ }
51
+ function p() {
52
+ let { client: n, organizationId: i } = e();
53
+ return s({
54
+ mutationFn: async ({ path: e, body: a }) => {
55
+ let { data: o } = await r({
56
+ client: n,
57
+ headers: t(i),
58
+ path: e,
59
+ body: a?.reject_reason ? a : void 0,
60
+ throwOnError: !0
61
+ });
62
+ return o;
63
+ },
64
+ onSuccess: async (e) => {
65
+ await o({
66
+ client: n,
67
+ organizationId: i,
68
+ payableId: e?.object_id
69
+ });
70
+ }
27
71
  });
28
72
  }
29
73
  //#endregion
30
- export { o as usePayableHistoryQuery };
74
+ export { f as useApprovePayableApprovalRequestMutation, d as usePayableApprovalRequestsQuery, p as useRejectPayableApprovalRequestMutation };