@tesouro/embedded-components-react 0.4.4 → 0.4.5
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.
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index.js +8 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index10.js +50 -29
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index11.js +39 -30
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index12.js +26 -311
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index13.js +326 -12
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index14.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index15.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index4.js +13 -27
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index5.js +28 -245
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index6.js +256 -92
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index7.js +86 -73
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index8.js +77 -14
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index9.js +18 -63
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index3.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +2 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +4 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index97.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index98.js +32 -27
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index6.js
CHANGED
|
@@ -1,106 +1,270 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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 { deletePayablesId as n, postPayablesIdCancel as r, postPayablesIdDuplicatesIdConfirm as i, postPayablesIdDuplicatesIdDismiss as a } from "../../../shared/data-access/dist/lib/rest/sdk.gen.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 { getApprovalRequests as i, getPayablesId as a, getPayablesIdHistory as o, getPaymentRecords as s } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
|
|
8
4
|
import "../../../shared/data-access/dist/index.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
5
|
+
import { isLiveScheduledPaymentRecord as c } from "./index3.js";
|
|
6
|
+
import { NEWEST_REQUEST_FIRST as l, PAYABLE_OBJECT_TYPE as u, approvalRequestsInvalidationKey as d, payableHistoryInvalidationKey as f, payableInvalidationKey as p, payableLineItemsInvalidationKey as m, payablePaymentRecordsInvalidationKey as h, payablesAnalyticsInvalidationKey as g, payablesInvalidationKey as _ } from "./index5.js";
|
|
7
|
+
import { OCR_POLL_INTERVAL_MS as v } from "./index4.js";
|
|
11
8
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index6.js
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
]
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
9
|
+
async function y({ client: e, organizationId: n, payableId: r, payableIds: i, deletedPayableIds: a, includeLineItems: o, includeApprovalRequests: s }) {
|
|
10
|
+
let c = {
|
|
11
|
+
client: e,
|
|
12
|
+
organizationId: n
|
|
13
|
+
}, l = new Set(a ?? []), u = [.../* @__PURE__ */ new Set([...i ?? [], r])].filter((e) => !!e && !l.has(e)).map((e) => ({
|
|
14
|
+
...c,
|
|
15
|
+
payableId: e
|
|
16
|
+
})), v = [
|
|
17
|
+
_(c),
|
|
18
|
+
g(c),
|
|
19
|
+
...s ? [d(c)] : [],
|
|
20
|
+
...u.flatMap((e) => [
|
|
21
|
+
p(e),
|
|
22
|
+
f(e),
|
|
23
|
+
h(e),
|
|
24
|
+
...o ? [m(e)] : []
|
|
25
|
+
])
|
|
26
|
+
];
|
|
27
|
+
await Promise.all(v.map((e) => t(e))), await Promise.all([...l].map((t) => b({
|
|
28
|
+
client: e,
|
|
29
|
+
organizationId: n,
|
|
30
|
+
payableId: t
|
|
31
|
+
})));
|
|
21
32
|
}
|
|
22
|
-
function
|
|
23
|
-
|
|
33
|
+
async function b({ client: t, organizationId: r, payableId: i }) {
|
|
34
|
+
if (!i) return;
|
|
35
|
+
let a = {
|
|
36
|
+
client: t,
|
|
37
|
+
organizationId: r,
|
|
38
|
+
payableId: i
|
|
39
|
+
}, o = [
|
|
40
|
+
p(a),
|
|
41
|
+
f(a),
|
|
42
|
+
m(a)
|
|
43
|
+
];
|
|
44
|
+
await Promise.all(o.map((t) => e(t))), o.forEach((e) => n(e));
|
|
24
45
|
}
|
|
25
|
-
function
|
|
26
|
-
|
|
46
|
+
async function x({ client: e, organizationId: n, payableId: r }) {
|
|
47
|
+
let i = {
|
|
48
|
+
client: e,
|
|
49
|
+
organizationId: n
|
|
50
|
+
};
|
|
51
|
+
await Promise.all([t(_(i)), t(g(i))]), await b({
|
|
52
|
+
client: e,
|
|
53
|
+
organizationId: n,
|
|
54
|
+
payableId: r
|
|
55
|
+
});
|
|
27
56
|
}
|
|
28
|
-
|
|
29
|
-
|
|
57
|
+
var S = 2e4, C = 1e3, w = 1.5, T = 5e3, E = (e) => Math.min(e * w, T), D = /* @__PURE__ */ new Set(["new", "approve_in_progress"]), O = 6e4;
|
|
58
|
+
async function k({ client: e, organizationId: n, payableId: r }) {
|
|
59
|
+
await t(d({
|
|
60
|
+
client: e,
|
|
61
|
+
organizationId: n
|
|
62
|
+
})), await y({
|
|
63
|
+
client: e,
|
|
64
|
+
organizationId: n,
|
|
65
|
+
payableId: r
|
|
66
|
+
});
|
|
30
67
|
}
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
68
|
+
var A = 100;
|
|
69
|
+
async function j({ client: e, organizationId: t, payableId: n }) {
|
|
70
|
+
try {
|
|
71
|
+
let { data: a } = await i({
|
|
72
|
+
client: e,
|
|
73
|
+
headers: r(t),
|
|
74
|
+
query: {
|
|
75
|
+
object_id: n,
|
|
76
|
+
object_type: u,
|
|
77
|
+
order: l,
|
|
78
|
+
limit: A
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
return (a?.data ?? []).map((e) => `${e.id}:${e.status}`).sort().join(",");
|
|
82
|
+
} catch {
|
|
83
|
+
return;
|
|
38
84
|
}
|
|
39
|
-
};
|
|
40
|
-
function h(e) {
|
|
41
|
-
return e.payableIds.length > 0 || e.deletedPayableIds.length > 0;
|
|
42
85
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
client: c,
|
|
66
|
-
headers: s,
|
|
67
|
-
path: { payable_id: e.payableId },
|
|
68
|
-
throwOnError: !0
|
|
69
|
-
}), u.push(e.payableId));
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
let l = /* @__PURE__ */ new Set(), f = e === p.Remove ? i : a;
|
|
73
|
-
for (let e of o) l.has(e.duplicateId) || d.includes(e.payableId) || e.matchedPayableId && d.includes(e.matchedPayableId) || (l.add(e.duplicateId), await f({
|
|
74
|
-
client: c,
|
|
75
|
-
headers: s,
|
|
76
|
-
path: {
|
|
77
|
-
payable_id: e.payableId,
|
|
78
|
-
duplicate_id: e.duplicateId
|
|
79
|
-
},
|
|
80
|
-
throwOnError: !0
|
|
81
|
-
}), u.push(e.payableId), e.matchedPayableId && u.push(e.matchedPayableId));
|
|
82
|
-
} catch (e) {
|
|
83
|
-
throw new m(h(), e);
|
|
86
|
+
var M = 3, N = 250;
|
|
87
|
+
async function P(e) {
|
|
88
|
+
let t = 0;
|
|
89
|
+
for (;;) {
|
|
90
|
+
let n = await L(e);
|
|
91
|
+
if (t += 1, n.readable || t >= M) return n;
|
|
92
|
+
await new Promise((e) => {
|
|
93
|
+
setTimeout(e, N * t);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
var F = "submitted_for_approval", I = 100;
|
|
98
|
+
async function L({ client: e, organizationId: t, payableId: n }) {
|
|
99
|
+
try {
|
|
100
|
+
let { data: i } = await o({
|
|
101
|
+
client: e,
|
|
102
|
+
headers: r(t),
|
|
103
|
+
path: { payable_id: n },
|
|
104
|
+
query: {
|
|
105
|
+
sort: "timestamp",
|
|
106
|
+
order: "asc",
|
|
107
|
+
limit: I
|
|
84
108
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
109
|
+
});
|
|
110
|
+
return {
|
|
111
|
+
readable: !0,
|
|
112
|
+
at: (i?.data ?? []).reduce((e, t) => t.event_type === F ? t.timestamp : e, void 0)
|
|
113
|
+
};
|
|
114
|
+
} catch {
|
|
115
|
+
return { readable: !1 };
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
async function R(e, { requireRoundMarker: t = !1 } = {}) {
|
|
119
|
+
let [n, r] = await Promise.all([j(e), t ? P(e) : void 0]), i = n, a = async () => {
|
|
120
|
+
if (!r?.readable) return !0;
|
|
121
|
+
let t = await L(e);
|
|
122
|
+
return t.readable && t.at !== r.at;
|
|
123
|
+
}, o = !1;
|
|
124
|
+
return { async poll() {
|
|
125
|
+
let t = await j(e);
|
|
126
|
+
return t !== void 0 && i === void 0 ? (i = t, o = !0, await a() ? "changed" : "resynced") : (t !== void 0 && t !== i && (o = !0), o && await a() ? "changed" : "unchanged");
|
|
127
|
+
} };
|
|
128
|
+
}
|
|
129
|
+
async function z({ client: e, organizationId: t, payableId: n, watch: i }) {
|
|
130
|
+
let o = Date.now() + O, s = C, c = !1;
|
|
131
|
+
for (; !c && Date.now() < o;) {
|
|
132
|
+
await new Promise((e) => {
|
|
133
|
+
setTimeout(e, s);
|
|
134
|
+
}), s = E(s);
|
|
135
|
+
try {
|
|
136
|
+
let { data: i } = await a({
|
|
137
|
+
client: e,
|
|
138
|
+
headers: r(t),
|
|
139
|
+
path: { payable_id: n }
|
|
93
140
|
});
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
141
|
+
c = !!(i?.status && !D.has(i.status));
|
|
142
|
+
} catch {}
|
|
143
|
+
if (!c) {
|
|
144
|
+
let r = await i.poll();
|
|
145
|
+
c = r === "changed", r === "resynced" && await y({
|
|
146
|
+
client: e,
|
|
147
|
+
organizationId: t,
|
|
148
|
+
payableId: n,
|
|
149
|
+
includeApprovalRequests: !0
|
|
101
150
|
});
|
|
102
151
|
}
|
|
103
|
-
}
|
|
152
|
+
}
|
|
153
|
+
return await y({
|
|
154
|
+
client: e,
|
|
155
|
+
organizationId: t,
|
|
156
|
+
payableId: n,
|
|
157
|
+
includeApprovalRequests: !0
|
|
158
|
+
}), c;
|
|
159
|
+
}
|
|
160
|
+
var B = 15e4, V = 3e3;
|
|
161
|
+
async function H({ client: e, organizationId: t, payableId: n, watch: r }) {
|
|
162
|
+
let i = Date.now() + B, a = V, o = !1;
|
|
163
|
+
for (; !o && Date.now() < i;) {
|
|
164
|
+
await new Promise((e) => {
|
|
165
|
+
setTimeout(e, a);
|
|
166
|
+
}), a = E(a);
|
|
167
|
+
let i = await r.poll();
|
|
168
|
+
o = i === "changed", i === "resynced" && await y({
|
|
169
|
+
client: e,
|
|
170
|
+
organizationId: t,
|
|
171
|
+
payableId: n,
|
|
172
|
+
includeApprovalRequests: !0
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
return await y({
|
|
176
|
+
client: e,
|
|
177
|
+
organizationId: t,
|
|
178
|
+
payableId: n,
|
|
179
|
+
includeApprovalRequests: !0
|
|
180
|
+
}), o;
|
|
181
|
+
}
|
|
182
|
+
var U = 100;
|
|
183
|
+
async function W({ client: e, organizationId: t, payableId: n }) {
|
|
184
|
+
let r = Date.now() + S, i = !1;
|
|
185
|
+
for (; !i && Date.now() < r;) await new Promise((e) => {
|
|
186
|
+
setTimeout(e, C);
|
|
187
|
+
}), i = await G({
|
|
188
|
+
client: e,
|
|
189
|
+
organizationId: t,
|
|
190
|
+
payableId: n
|
|
191
|
+
}) === !0;
|
|
192
|
+
return await y({
|
|
193
|
+
client: e,
|
|
194
|
+
organizationId: t,
|
|
195
|
+
payableId: n
|
|
196
|
+
}), i;
|
|
197
|
+
}
|
|
198
|
+
async function G({ client: e, organizationId: t, payableId: n }) {
|
|
199
|
+
let i = /* @__PURE__ */ new Set(), a;
|
|
200
|
+
try {
|
|
201
|
+
do {
|
|
202
|
+
let { data: o } = await s({
|
|
203
|
+
client: e,
|
|
204
|
+
headers: r(t),
|
|
205
|
+
query: {
|
|
206
|
+
limit: U,
|
|
207
|
+
object_id__in: [n],
|
|
208
|
+
order: "desc",
|
|
209
|
+
sort: "paid_at",
|
|
210
|
+
is_external: !1,
|
|
211
|
+
...a ? { pagination_token: a } : {}
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
if ((o?.data ?? []).some(c)) return !0;
|
|
215
|
+
let l = o?.next_pagination_token ?? void 0;
|
|
216
|
+
a = l && !i.has(l) ? (i.add(l), l) : void 0;
|
|
217
|
+
} while (a);
|
|
218
|
+
return !1;
|
|
219
|
+
} catch {
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
async function K({ client: e, organizationId: t, payableId: n }) {
|
|
224
|
+
let i = Date.now() + S, o = !1;
|
|
225
|
+
for (; !o && Date.now() < i;) {
|
|
226
|
+
await new Promise((e) => {
|
|
227
|
+
setTimeout(e, C);
|
|
228
|
+
});
|
|
229
|
+
try {
|
|
230
|
+
let { data: i } = await a({
|
|
231
|
+
client: e,
|
|
232
|
+
headers: r(t),
|
|
233
|
+
path: { payable_id: n }
|
|
234
|
+
});
|
|
235
|
+
o = !i?.scheduled_payment_date && await G({
|
|
236
|
+
client: e,
|
|
237
|
+
organizationId: t,
|
|
238
|
+
payableId: n
|
|
239
|
+
}) === !1;
|
|
240
|
+
} catch {}
|
|
241
|
+
}
|
|
242
|
+
return await y({
|
|
243
|
+
client: e,
|
|
244
|
+
organizationId: t,
|
|
245
|
+
payableId: n
|
|
246
|
+
}), o;
|
|
247
|
+
}
|
|
248
|
+
async function q({ client: e, organizationId: t, payableId: n }) {
|
|
249
|
+
let i = Date.now() + S, o = !1;
|
|
250
|
+
for (; !o && Date.now() < i;) {
|
|
251
|
+
await new Promise((e) => {
|
|
252
|
+
setTimeout(e, v);
|
|
253
|
+
});
|
|
254
|
+
try {
|
|
255
|
+
let { data: i } = await a({
|
|
256
|
+
client: e,
|
|
257
|
+
headers: r(t),
|
|
258
|
+
path: { payable_id: n }
|
|
259
|
+
});
|
|
260
|
+
o = i?.ocr_status !== "processing";
|
|
261
|
+
} catch {}
|
|
262
|
+
}
|
|
263
|
+
return await y({
|
|
264
|
+
client: e,
|
|
265
|
+
organizationId: t,
|
|
266
|
+
payableId: n
|
|
267
|
+
}), o;
|
|
104
268
|
}
|
|
105
269
|
//#endregion
|
|
106
|
-
export {
|
|
270
|
+
export { R as beginApprovalRequestWatch, k as invalidateApprovalDecisionQueries, x as invalidateDeletedPayableQueries, y as invalidatePayableQueries, z as reconcileApprovalDecisionQueries, K as reconcileCancelledPaymentQueries, W as reconcileScheduledPaymentQueries, H as reconcileSubmittedForApprovalQueries, q as reconcileUploadedPayableOcr };
|
package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index7.js
CHANGED
|
@@ -4,90 +4,103 @@
|
|
|
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 {
|
|
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";
|
|
7
|
+
import { deletePayablesId as n, postPayablesIdCancel as r, postPayablesIdDuplicatesIdConfirm as i, postPayablesIdDuplicatesIdDismiss as a } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
|
|
10
8
|
import "../../../shared/data-access/dist/index.js";
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { useMutation as d, useQuery as f } from "@tanstack/react-query";
|
|
9
|
+
import { invalidatePayableQueries as o } from "./index6.js";
|
|
10
|
+
import { useMutation as s } from "@tanstack/react-query";
|
|
14
11
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index7.js
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
});
|
|
25
|
-
return f({
|
|
26
|
-
...a(m, d),
|
|
27
|
-
enabled: p
|
|
28
|
-
});
|
|
12
|
+
var c = [
|
|
13
|
+
"suspected",
|
|
14
|
+
"dismissed",
|
|
15
|
+
"confirmed"
|
|
16
|
+
];
|
|
17
|
+
function l(e) {
|
|
18
|
+
if (typeof e != "object" || !e) return !1;
|
|
19
|
+
let t = e;
|
|
20
|
+
return typeof t.id == "string" && typeof t.matched_payable_id == "string" && c.includes(t.status);
|
|
29
21
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
client: e,
|
|
33
|
-
organizationId: t,
|
|
34
|
-
payableId: n
|
|
35
|
-
}) : void 0;
|
|
36
|
-
await l({
|
|
37
|
-
client: e,
|
|
38
|
-
organizationId: t,
|
|
39
|
-
payableId: n
|
|
40
|
-
}), !(!n || !i) && u({
|
|
41
|
-
client: e,
|
|
42
|
-
organizationId: t,
|
|
43
|
-
payableId: n,
|
|
44
|
-
watch: i
|
|
45
|
-
}).catch(() => {});
|
|
22
|
+
function u(e) {
|
|
23
|
+
return Array.isArray(e?.duplicates) ? e.duplicates.filter(l) : [];
|
|
46
24
|
}
|
|
47
|
-
function
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
requestStatus: e?.status
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
});
|
|
25
|
+
function d(e) {
|
|
26
|
+
return u(e).filter((e) => e.status === "suspected");
|
|
27
|
+
}
|
|
28
|
+
function f(e) {
|
|
29
|
+
return d(e).length > 0;
|
|
30
|
+
}
|
|
31
|
+
var p = {
|
|
32
|
+
Keep: "keep",
|
|
33
|
+
Remove: "remove"
|
|
34
|
+
}, m = class extends Error {
|
|
35
|
+
applied;
|
|
36
|
+
constructor(e, t) {
|
|
37
|
+
super("A duplicate verdict batch failed partway through.", { cause: t }), this.name = "DuplicateVerdictBatchError", this.applied = e;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
function h(e) {
|
|
41
|
+
return e.payableIds.length > 0 || e.deletedPayableIds.length > 0;
|
|
68
42
|
}
|
|
69
43
|
function g() {
|
|
70
|
-
let { client:
|
|
71
|
-
return
|
|
72
|
-
mutationFn: async ({
|
|
73
|
-
let
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
path: e,
|
|
77
|
-
body: a?.reject_reason ? a : void 0,
|
|
78
|
-
throwOnError: !0
|
|
44
|
+
let { client: c, organizationId: l } = e();
|
|
45
|
+
return s({
|
|
46
|
+
mutationFn: async ({ verdict: e, targets: o }) => {
|
|
47
|
+
let s = t(l), u = [], d = [], f = () => o.filter((e) => e.matchedPayableId !== void 0 && d.includes(e.payableId) && !d.includes(e.matchedPayableId)).map((e) => e.matchedPayableId), h = () => ({
|
|
48
|
+
payableIds: [.../* @__PURE__ */ new Set([...u, ...f()])],
|
|
49
|
+
deletedPayableIds: [...new Set(d)]
|
|
79
50
|
});
|
|
80
|
-
|
|
51
|
+
try {
|
|
52
|
+
let t = /* @__PURE__ */ new Set();
|
|
53
|
+
if (e === p.Remove) {
|
|
54
|
+
for (let e of o) if (!t.has(e.payableId)) {
|
|
55
|
+
if (t.add(e.payableId), e.removeBy === "delete") {
|
|
56
|
+
await n({
|
|
57
|
+
client: c,
|
|
58
|
+
headers: s,
|
|
59
|
+
path: { payable_id: e.payableId },
|
|
60
|
+
throwOnError: !0
|
|
61
|
+
}), d.push(e.payableId);
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
e.removeBy === "cancel" && (await r({
|
|
65
|
+
client: c,
|
|
66
|
+
headers: s,
|
|
67
|
+
path: { payable_id: e.payableId },
|
|
68
|
+
throwOnError: !0
|
|
69
|
+
}), u.push(e.payableId));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
let l = /* @__PURE__ */ new Set(), f = e === p.Remove ? i : a;
|
|
73
|
+
for (let e of o) l.has(e.duplicateId) || d.includes(e.payableId) || e.matchedPayableId && d.includes(e.matchedPayableId) || (l.add(e.duplicateId), await f({
|
|
74
|
+
client: c,
|
|
75
|
+
headers: s,
|
|
76
|
+
path: {
|
|
77
|
+
payable_id: e.payableId,
|
|
78
|
+
duplicate_id: e.duplicateId
|
|
79
|
+
},
|
|
80
|
+
throwOnError: !0
|
|
81
|
+
}), u.push(e.payableId), e.matchedPayableId && u.push(e.matchedPayableId));
|
|
82
|
+
} catch (e) {
|
|
83
|
+
throw new m(h(), e);
|
|
84
|
+
}
|
|
85
|
+
return h();
|
|
81
86
|
},
|
|
82
87
|
onSuccess: async (e) => {
|
|
83
|
-
await
|
|
84
|
-
client:
|
|
85
|
-
organizationId:
|
|
86
|
-
|
|
87
|
-
|
|
88
|
+
await o({
|
|
89
|
+
client: c,
|
|
90
|
+
organizationId: l,
|
|
91
|
+
payableIds: e.payableIds,
|
|
92
|
+
deletedPayableIds: e.deletedPayableIds
|
|
93
|
+
});
|
|
94
|
+
},
|
|
95
|
+
onError: async (e) => {
|
|
96
|
+
!(e instanceof m) || !h(e.applied) || await o({
|
|
97
|
+
client: c,
|
|
98
|
+
organizationId: l,
|
|
99
|
+
payableIds: e.applied.payableIds,
|
|
100
|
+
deletedPayableIds: e.applied.deletedPayableIds
|
|
88
101
|
});
|
|
89
102
|
}
|
|
90
103
|
});
|
|
91
104
|
}
|
|
92
105
|
//#endregion
|
|
93
|
-
export {
|
|
106
|
+
export { p as DuplicateVerdict, m as DuplicateVerdictBatchError, f as hasSuspectedPayableDuplicate, u as readPayableDuplicates, d as suspectedPayableDuplicates, g as useApplyDuplicateVerdictsMutation };
|
package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index8.js
CHANGED
|
@@ -4,27 +4,90 @@
|
|
|
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 {
|
|
8
|
-
import {
|
|
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 {
|
|
11
|
+
import { NEWEST_REQUEST_FIRST as o, PAYABLE_OBJECT_TYPE as s } from "./index5.js";
|
|
12
|
+
import { beginApprovalRequestWatch as c, invalidateApprovalDecisionQueries as l, reconcileApprovalDecisionQueries as u } from "./index6.js";
|
|
13
|
+
import { useMutation as d, useQuery as f } from "@tanstack/react-query";
|
|
11
14
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index8.js
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
let { client: c, organizationId: l, widgetToken: u, authEpoch: d } = e(), f = !!(l && u && o) && s !== !1, p = n({
|
|
15
|
+
function p(n, { enabled: r } = {}) {
|
|
16
|
+
let { client: c, organizationId: l, widgetToken: u, authEpoch: d } = e(), p = !!(l && u && n) && r !== !1, m = i({
|
|
15
17
|
client: c,
|
|
16
18
|
headers: t(l),
|
|
17
|
-
path: { payable_id: o ?? "" },
|
|
18
19
|
query: {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
object_id: n ?? "",
|
|
21
|
+
object_type: s,
|
|
22
|
+
order: o
|
|
22
23
|
}
|
|
23
24
|
});
|
|
24
|
-
return
|
|
25
|
-
...
|
|
26
|
-
enabled:
|
|
25
|
+
return f({
|
|
26
|
+
...a(m, d),
|
|
27
|
+
enabled: p
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
async function m({ client: e, organizationId: t, payableId: n, requestStatus: r }) {
|
|
31
|
+
let i = n && r !== "waiting" && n ? await c({
|
|
32
|
+
client: e,
|
|
33
|
+
organizationId: t,
|
|
34
|
+
payableId: n
|
|
35
|
+
}) : void 0;
|
|
36
|
+
await l({
|
|
37
|
+
client: e,
|
|
38
|
+
organizationId: t,
|
|
39
|
+
payableId: n
|
|
40
|
+
}), !(!n || !i) && u({
|
|
41
|
+
client: e,
|
|
42
|
+
organizationId: t,
|
|
43
|
+
payableId: n,
|
|
44
|
+
watch: i
|
|
45
|
+
}).catch(() => {});
|
|
46
|
+
}
|
|
47
|
+
function h() {
|
|
48
|
+
let { client: r, organizationId: i } = e();
|
|
49
|
+
return d({
|
|
50
|
+
mutationFn: async ({ path: e }) => {
|
|
51
|
+
let { data: a } = await n({
|
|
52
|
+
client: r,
|
|
53
|
+
headers: t(i),
|
|
54
|
+
path: e,
|
|
55
|
+
throwOnError: !0
|
|
56
|
+
});
|
|
57
|
+
return a;
|
|
58
|
+
},
|
|
59
|
+
onSuccess: async (e) => {
|
|
60
|
+
await m({
|
|
61
|
+
client: r,
|
|
62
|
+
organizationId: i,
|
|
63
|
+
payableId: e?.object_id,
|
|
64
|
+
requestStatus: e?.status
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
function g() {
|
|
70
|
+
let { client: n, organizationId: i } = e();
|
|
71
|
+
return d({
|
|
72
|
+
mutationFn: async ({ path: e, body: a }) => {
|
|
73
|
+
let { data: o } = await r({
|
|
74
|
+
client: n,
|
|
75
|
+
headers: t(i),
|
|
76
|
+
path: e,
|
|
77
|
+
body: a?.reject_reason ? a : void 0,
|
|
78
|
+
throwOnError: !0
|
|
79
|
+
});
|
|
80
|
+
return o;
|
|
81
|
+
},
|
|
82
|
+
onSuccess: async (e) => {
|
|
83
|
+
await m({
|
|
84
|
+
client: n,
|
|
85
|
+
organizationId: i,
|
|
86
|
+
payableId: e?.object_id,
|
|
87
|
+
requestStatus: e?.status
|
|
88
|
+
});
|
|
89
|
+
}
|
|
27
90
|
});
|
|
28
91
|
}
|
|
29
92
|
//#endregion
|
|
30
|
-
export {
|
|
93
|
+
export { h as useApprovePayableApprovalRequestMutation, p as usePayableApprovalRequestsQuery, g as useRejectPayableApprovalRequestMutation };
|