@tesouro/embedded-components-react 0.3.38 → 0.3.39
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/index11.js +59 -48
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index4.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index5.js +163 -51
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index6.js +39 -20
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +5 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index55.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index66.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index67.js +156 -138
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +23 -23
- 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/index11.js
CHANGED
|
@@ -6,12 +6,12 @@ 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 { deletePayablesId as n, deletePayablesIdFile as r, patchPayablesId as i, postPayables as a, postPayablesIdApprovePaymentOperation as o, postPayablesIdAttachFile as s, postPayablesIdCancel as c, postPayablesIdMarkAsPaid as l, postPayablesIdReject as u, postPayablesIdReopen as d, postPayablesIdSubmitForApproval as f, postPayablesIdValidate as p, postPayablesUploadFromFile as m, postPaymentIntentsIdCancel as h } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
|
|
8
8
|
import "../../../shared/data-access/dist/index.js";
|
|
9
|
-
import {
|
|
10
|
-
import { useMutation as
|
|
9
|
+
import { beginApprovalRequestWatch as g, invalidateDeletedPayableQueries as _, invalidatePayableQueries as v, reconcileCancelledPaymentQueries as y, reconcileSubmittedForApprovalQueries as b } from "./index5.js";
|
|
10
|
+
import { useMutation as x } from "@tanstack/react-query";
|
|
11
11
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index11.js
|
|
12
|
-
function
|
|
12
|
+
function S() {
|
|
13
13
|
let { client: n, organizationId: r } = e();
|
|
14
|
-
return
|
|
14
|
+
return x({
|
|
15
15
|
mutationFn: async ({ body: e }) => {
|
|
16
16
|
let { data: i } = await a({
|
|
17
17
|
client: n,
|
|
@@ -22,16 +22,16 @@ function b() {
|
|
|
22
22
|
return i;
|
|
23
23
|
},
|
|
24
24
|
onSuccess: async () => {
|
|
25
|
-
await
|
|
25
|
+
await v({
|
|
26
26
|
client: n,
|
|
27
27
|
organizationId: r
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
|
-
function
|
|
32
|
+
function C() {
|
|
33
33
|
let { client: n, organizationId: r } = e();
|
|
34
|
-
return
|
|
34
|
+
return x({
|
|
35
35
|
mutationFn: async ({ path: e, body: a }) => {
|
|
36
36
|
let { data: o } = await i({
|
|
37
37
|
client: n,
|
|
@@ -43,7 +43,7 @@ function x() {
|
|
|
43
43
|
return o;
|
|
44
44
|
},
|
|
45
45
|
onSuccess: async (e, t) => {
|
|
46
|
-
await
|
|
46
|
+
await v({
|
|
47
47
|
client: n,
|
|
48
48
|
organizationId: r,
|
|
49
49
|
payableId: t.path.payable_id
|
|
@@ -51,9 +51,9 @@ function x() {
|
|
|
51
51
|
}
|
|
52
52
|
});
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function w() {
|
|
55
55
|
let { client: r, organizationId: i } = e();
|
|
56
|
-
return
|
|
56
|
+
return x({
|
|
57
57
|
mutationFn: async ({ path: e }) => {
|
|
58
58
|
await n({
|
|
59
59
|
client: r,
|
|
@@ -63,7 +63,7 @@ function S() {
|
|
|
63
63
|
});
|
|
64
64
|
},
|
|
65
65
|
onSuccess: async (e, t) => {
|
|
66
|
-
await
|
|
66
|
+
await _({
|
|
67
67
|
client: r,
|
|
68
68
|
organizationId: i,
|
|
69
69
|
payableId: t.path.payable_id
|
|
@@ -71,9 +71,9 @@ function S() {
|
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
|
-
function
|
|
74
|
+
function T() {
|
|
75
75
|
let { client: n, organizationId: r } = e();
|
|
76
|
-
return
|
|
76
|
+
return x({
|
|
77
77
|
mutationFn: async ({ file: e }) => {
|
|
78
78
|
let { data: a } = await m({
|
|
79
79
|
client: n,
|
|
@@ -96,16 +96,16 @@ function C() {
|
|
|
96
96
|
return a;
|
|
97
97
|
},
|
|
98
98
|
onSuccess: async () => {
|
|
99
|
-
await
|
|
99
|
+
await v({
|
|
100
100
|
client: n,
|
|
101
101
|
organizationId: r
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
|
-
function
|
|
106
|
+
function E() {
|
|
107
107
|
let { client: n, organizationId: r } = e();
|
|
108
|
-
return
|
|
108
|
+
return x({
|
|
109
109
|
mutationFn: async ({ path: e, file: i }) => {
|
|
110
110
|
let { data: a } = await s({
|
|
111
111
|
client: n,
|
|
@@ -117,7 +117,7 @@ function w() {
|
|
|
117
117
|
return a;
|
|
118
118
|
},
|
|
119
119
|
onSuccess: async (e, t) => {
|
|
120
|
-
await
|
|
120
|
+
await v({
|
|
121
121
|
client: n,
|
|
122
122
|
organizationId: r,
|
|
123
123
|
payableId: t.path.payable_id
|
|
@@ -125,9 +125,9 @@ function w() {
|
|
|
125
125
|
}
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function D() {
|
|
129
129
|
let { client: n, organizationId: i } = e();
|
|
130
|
-
return
|
|
130
|
+
return x({
|
|
131
131
|
mutationFn: async ({ path: e }) => {
|
|
132
132
|
await r({
|
|
133
133
|
client: n,
|
|
@@ -137,7 +137,7 @@ function T() {
|
|
|
137
137
|
});
|
|
138
138
|
},
|
|
139
139
|
onSuccess: async (e, t) => {
|
|
140
|
-
await
|
|
140
|
+
await v({
|
|
141
141
|
client: n,
|
|
142
142
|
organizationId: i,
|
|
143
143
|
payableId: t.path.payable_id
|
|
@@ -145,9 +145,9 @@ function T() {
|
|
|
145
145
|
}
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
|
-
function
|
|
148
|
+
function O() {
|
|
149
149
|
let { client: n, organizationId: r } = e();
|
|
150
|
-
return
|
|
150
|
+
return x({ mutationFn: async ({ path: e }) => {
|
|
151
151
|
let { data: i } = await p({
|
|
152
152
|
client: n,
|
|
153
153
|
headers: t(r),
|
|
@@ -160,9 +160,14 @@ function E() {
|
|
|
160
160
|
};
|
|
161
161
|
} });
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
function k() {
|
|
164
164
|
let { client: n, organizationId: r } = e();
|
|
165
|
-
return
|
|
165
|
+
return x({
|
|
166
|
+
onMutate: async ({ path: e }) => g({
|
|
167
|
+
client: n,
|
|
168
|
+
organizationId: r,
|
|
169
|
+
payableId: e.payable_id
|
|
170
|
+
}, { requireRoundMarker: !0 }),
|
|
166
171
|
mutationFn: async ({ path: e }) => {
|
|
167
172
|
let { data: i } = await f({
|
|
168
173
|
client: n,
|
|
@@ -172,19 +177,25 @@ function D() {
|
|
|
172
177
|
});
|
|
173
178
|
return i;
|
|
174
179
|
},
|
|
175
|
-
onSuccess: async (e, t) => {
|
|
176
|
-
|
|
180
|
+
onSuccess: async (e, t, i) => {
|
|
181
|
+
let a = t.path.payable_id, o = e?.status === "approve_in_progress";
|
|
182
|
+
await v({
|
|
177
183
|
client: n,
|
|
178
184
|
organizationId: r,
|
|
179
|
-
payableId:
|
|
185
|
+
payableId: a,
|
|
180
186
|
includeApprovalRequests: !0
|
|
181
|
-
})
|
|
187
|
+
}), !(!o || !i) && b({
|
|
188
|
+
client: n,
|
|
189
|
+
organizationId: r,
|
|
190
|
+
payableId: a,
|
|
191
|
+
watch: i
|
|
192
|
+
}).catch(() => {});
|
|
182
193
|
}
|
|
183
194
|
});
|
|
184
195
|
}
|
|
185
|
-
function
|
|
196
|
+
function A() {
|
|
186
197
|
let { client: n, organizationId: r } = e();
|
|
187
|
-
return
|
|
198
|
+
return x({
|
|
188
199
|
mutationFn: async ({ path: e }) => {
|
|
189
200
|
let { data: i } = await o({
|
|
190
201
|
client: n,
|
|
@@ -195,7 +206,7 @@ function O() {
|
|
|
195
206
|
return i;
|
|
196
207
|
},
|
|
197
208
|
onSuccess: async (e, t) => {
|
|
198
|
-
await
|
|
209
|
+
await v({
|
|
199
210
|
client: n,
|
|
200
211
|
organizationId: r,
|
|
201
212
|
payableId: t.path.payable_id,
|
|
@@ -204,9 +215,9 @@ function O() {
|
|
|
204
215
|
}
|
|
205
216
|
});
|
|
206
217
|
}
|
|
207
|
-
function
|
|
218
|
+
function j() {
|
|
208
219
|
let { client: n, organizationId: r } = e();
|
|
209
|
-
return
|
|
220
|
+
return x({
|
|
210
221
|
mutationFn: async ({ path: e }) => {
|
|
211
222
|
let { data: i } = await u({
|
|
212
223
|
client: n,
|
|
@@ -217,7 +228,7 @@ function k() {
|
|
|
217
228
|
return i;
|
|
218
229
|
},
|
|
219
230
|
onSuccess: async (e, t) => {
|
|
220
|
-
await
|
|
231
|
+
await v({
|
|
221
232
|
client: n,
|
|
222
233
|
organizationId: r,
|
|
223
234
|
payableId: t.path.payable_id,
|
|
@@ -226,9 +237,9 @@ function k() {
|
|
|
226
237
|
}
|
|
227
238
|
});
|
|
228
239
|
}
|
|
229
|
-
function
|
|
240
|
+
function M() {
|
|
230
241
|
let { client: n, organizationId: r } = e();
|
|
231
|
-
return
|
|
242
|
+
return x({
|
|
232
243
|
mutationFn: async ({ path: e }) => {
|
|
233
244
|
let { data: i } = await c({
|
|
234
245
|
client: n,
|
|
@@ -239,7 +250,7 @@ function A() {
|
|
|
239
250
|
return i;
|
|
240
251
|
},
|
|
241
252
|
onSuccess: async (e, t) => {
|
|
242
|
-
await
|
|
253
|
+
await v({
|
|
243
254
|
client: n,
|
|
244
255
|
organizationId: r,
|
|
245
256
|
payableId: t.path.payable_id
|
|
@@ -247,9 +258,9 @@ function A() {
|
|
|
247
258
|
}
|
|
248
259
|
});
|
|
249
260
|
}
|
|
250
|
-
function
|
|
261
|
+
function N() {
|
|
251
262
|
let { client: n, organizationId: r } = e();
|
|
252
|
-
return
|
|
263
|
+
return x({
|
|
253
264
|
mutationFn: async ({ path: e }) => {
|
|
254
265
|
let { data: i } = await h({
|
|
255
266
|
client: n,
|
|
@@ -260,11 +271,11 @@ function j() {
|
|
|
260
271
|
return i;
|
|
261
272
|
},
|
|
262
273
|
onSuccess: async (e, t) => {
|
|
263
|
-
await
|
|
274
|
+
await v({
|
|
264
275
|
client: n,
|
|
265
276
|
organizationId: r,
|
|
266
277
|
payableId: t.payableId
|
|
267
|
-
}),
|
|
278
|
+
}), y({
|
|
268
279
|
client: n,
|
|
269
280
|
organizationId: r,
|
|
270
281
|
payableId: t.payableId
|
|
@@ -272,9 +283,9 @@ function j() {
|
|
|
272
283
|
}
|
|
273
284
|
});
|
|
274
285
|
}
|
|
275
|
-
function
|
|
286
|
+
function P() {
|
|
276
287
|
let { client: n, organizationId: r } = e();
|
|
277
|
-
return
|
|
288
|
+
return x({
|
|
278
289
|
mutationFn: async ({ path: e }) => {
|
|
279
290
|
let { data: i } = await d({
|
|
280
291
|
client: n,
|
|
@@ -285,7 +296,7 @@ function M() {
|
|
|
285
296
|
return i;
|
|
286
297
|
},
|
|
287
298
|
onSuccess: async (e, t) => {
|
|
288
|
-
await
|
|
299
|
+
await v({
|
|
289
300
|
client: n,
|
|
290
301
|
organizationId: r,
|
|
291
302
|
payableId: t.path.payable_id
|
|
@@ -293,9 +304,9 @@ function M() {
|
|
|
293
304
|
}
|
|
294
305
|
});
|
|
295
306
|
}
|
|
296
|
-
function
|
|
307
|
+
function F() {
|
|
297
308
|
let { client: n, organizationId: r } = e();
|
|
298
|
-
return
|
|
309
|
+
return x({
|
|
299
310
|
mutationFn: async ({ path: e, body: i }) => {
|
|
300
311
|
let { data: a } = await l({
|
|
301
312
|
client: n,
|
|
@@ -307,7 +318,7 @@ function N() {
|
|
|
307
318
|
return a;
|
|
308
319
|
},
|
|
309
320
|
onSuccess: async (e, t) => {
|
|
310
|
-
await
|
|
321
|
+
await v({
|
|
311
322
|
client: n,
|
|
312
323
|
organizationId: r,
|
|
313
324
|
payableId: t.path.payable_id
|
|
@@ -316,4 +327,4 @@ function N() {
|
|
|
316
327
|
});
|
|
317
328
|
}
|
|
318
329
|
//#endregion
|
|
319
|
-
export {
|
|
330
|
+
export { E as useAttachPayableFileMutation, M as useCancelPayableMutation, N as useCancelScheduledPaymentMutation, S as useCreatePayableMutation, D as useDeletePayableFileMutation, w as useDeletePayableMutation, A as useForceApprovePayableMutation, j as useForceRejectPayableMutation, F as useMarkPayableAsPaidMutation, P as useReopenPayableMutation, k as useSubmitPayableForApprovalMutation, C as useUpdatePayableMutation, T as useUploadPayableFromFileMutation, O as useValidatePayableMutation };
|
package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index4.js
CHANGED
|
@@ -26,6 +26,6 @@ var c = ({ client: t, organizationId: n }) => o({
|
|
|
26
26
|
}), m = ({ client: t, organizationId: n }) => s({
|
|
27
27
|
client: t,
|
|
28
28
|
headers: e(n)
|
|
29
|
-
});
|
|
29
|
+
}), h = "payable", g = "desc";
|
|
30
30
|
//#endregion
|
|
31
|
-
export { l as approvalRequestsInvalidationKey, f as payableHistoryInvalidationKey, d as payableInvalidationKey, p as payableLineItemsInvalidationKey, m as payablePaymentRecordsInvalidationKey, u as payablesAnalyticsInvalidationKey, c as payablesInvalidationKey };
|
|
31
|
+
export { g as NEWEST_REQUEST_FIRST, h as PAYABLE_OBJECT_TYPE, l as approvalRequestsInvalidationKey, f as payableHistoryInvalidationKey, d as payableInvalidationKey, p as payableLineItemsInvalidationKey, m as payablePaymentRecordsInvalidationKey, u as payablesAnalyticsInvalidationKey, c as payablesInvalidationKey };
|
package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index5.js
CHANGED
|
@@ -1,124 +1,236 @@
|
|
|
1
1
|
import { cancelAllClients as e, invalidateAllClients as t, removeInactiveFromAllClients as n } from "../../../shared/data-access/dist/lib/clientRegistry.js";
|
|
2
2
|
import { organizationHeaders as r } from "../../../shared/data-access/dist/lib/organizationHeaders.js";
|
|
3
|
-
import {
|
|
3
|
+
import { getApprovalRequests as i, getPayablesId as a, getPayablesIdHistory as o, getPaymentRecords as s } from "../../../shared/data-access/dist/lib/rest/sdk.gen.js";
|
|
4
4
|
import "../../../shared/data-access/dist/index.js";
|
|
5
|
-
import { isLiveScheduledPaymentRecord as
|
|
6
|
-
import { approvalRequestsInvalidationKey as
|
|
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 "./index4.js";
|
|
7
7
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index5.js
|
|
8
|
-
async function
|
|
8
|
+
async function v({ client: e, organizationId: n, payableId: r, includeLineItems: i, includeApprovalRequests: a }) {
|
|
9
9
|
let o = {
|
|
10
10
|
client: e,
|
|
11
11
|
organizationId: n
|
|
12
|
-
},
|
|
12
|
+
}, s = r ? {
|
|
13
13
|
...o,
|
|
14
14
|
payableId: r
|
|
15
|
-
} : void 0,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
...a ? [
|
|
19
|
-
...
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
15
|
+
} : void 0, c = [
|
|
16
|
+
_(o),
|
|
17
|
+
g(o),
|
|
18
|
+
...a ? [d(o)] : [],
|
|
19
|
+
...s ? [
|
|
20
|
+
p(s),
|
|
21
|
+
f(s),
|
|
22
|
+
h(s)
|
|
23
23
|
] : [],
|
|
24
|
-
...
|
|
24
|
+
...s && i ? [m(s)] : []
|
|
25
25
|
];
|
|
26
|
-
await Promise.all(
|
|
26
|
+
await Promise.all(c.map((e) => t(e)));
|
|
27
27
|
}
|
|
28
|
-
async function
|
|
28
|
+
async function y({ client: r, organizationId: i, payableId: a }) {
|
|
29
29
|
let o = {
|
|
30
30
|
client: r,
|
|
31
31
|
organizationId: i
|
|
32
32
|
};
|
|
33
|
-
if (await Promise.all([t(
|
|
33
|
+
if (await Promise.all([t(_(o)), t(g(o))]), !a) return;
|
|
34
34
|
let s = {
|
|
35
35
|
...o,
|
|
36
36
|
payableId: a
|
|
37
|
-
},
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
}, c = [
|
|
38
|
+
p(s),
|
|
39
|
+
f(s),
|
|
40
|
+
m(s)
|
|
41
41
|
];
|
|
42
|
-
await Promise.all(
|
|
42
|
+
await Promise.all(c.map((t) => e(t))), c.forEach((e) => n(e));
|
|
43
43
|
}
|
|
44
|
-
var
|
|
45
|
-
async function
|
|
46
|
-
await t(
|
|
44
|
+
var b = 2e4, x = 1e3, S = 1.5, C = 5e3, w = (e) => Math.min(e * S, C), T = /* @__PURE__ */ new Set(["new", "approve_in_progress"]), E = 6e4;
|
|
45
|
+
async function D({ client: e, organizationId: n, payableId: r }) {
|
|
46
|
+
await t(d({
|
|
47
47
|
client: e,
|
|
48
48
|
organizationId: n
|
|
49
|
-
})), await
|
|
50
|
-
setTimeout(e, g);
|
|
51
|
-
}), await m({
|
|
49
|
+
})), await v({
|
|
52
50
|
client: e,
|
|
53
51
|
organizationId: n,
|
|
54
52
|
payableId: r
|
|
55
53
|
});
|
|
56
54
|
}
|
|
57
|
-
var
|
|
58
|
-
async function
|
|
59
|
-
|
|
55
|
+
var O = 100;
|
|
56
|
+
async function k({ client: e, organizationId: t, payableId: n }) {
|
|
57
|
+
try {
|
|
58
|
+
let { data: a } = await i({
|
|
59
|
+
client: e,
|
|
60
|
+
headers: r(t),
|
|
61
|
+
query: {
|
|
62
|
+
object_id: n,
|
|
63
|
+
object_type: u,
|
|
64
|
+
order: l,
|
|
65
|
+
limit: O
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
return (a?.data ?? []).map((e) => `${e.id}:${e.status}`).sort().join(",");
|
|
69
|
+
} catch {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
var A = 3, j = 250;
|
|
74
|
+
async function M(e) {
|
|
75
|
+
let t = 0;
|
|
76
|
+
for (;;) {
|
|
77
|
+
let n = await F(e);
|
|
78
|
+
if (t += 1, n.readable || t >= A) return n;
|
|
79
|
+
await new Promise((e) => {
|
|
80
|
+
setTimeout(e, j * t);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
var N = "submitted_for_approval", P = 100;
|
|
85
|
+
async function F({ client: e, organizationId: t, payableId: n }) {
|
|
86
|
+
try {
|
|
87
|
+
let { data: i } = await o({
|
|
88
|
+
client: e,
|
|
89
|
+
headers: r(t),
|
|
90
|
+
path: { payable_id: n },
|
|
91
|
+
query: {
|
|
92
|
+
sort: "timestamp",
|
|
93
|
+
order: "asc",
|
|
94
|
+
limit: P
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
return {
|
|
98
|
+
readable: !0,
|
|
99
|
+
at: (i?.data ?? []).reduce((e, t) => t.event_type === N ? t.timestamp : e, void 0)
|
|
100
|
+
};
|
|
101
|
+
} catch {
|
|
102
|
+
return { readable: !1 };
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
async function I(e, { requireRoundMarker: t = !1 } = {}) {
|
|
106
|
+
let [n, r] = await Promise.all([k(e), t ? M(e) : void 0]), i = n, a = async () => {
|
|
107
|
+
if (!r?.readable) return !0;
|
|
108
|
+
let t = await F(e);
|
|
109
|
+
return t.readable && t.at !== r.at;
|
|
110
|
+
}, o = !1;
|
|
111
|
+
return { async poll() {
|
|
112
|
+
let t = await k(e);
|
|
113
|
+
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");
|
|
114
|
+
} };
|
|
115
|
+
}
|
|
116
|
+
async function L({ client: e, organizationId: t, payableId: n, watch: i }) {
|
|
117
|
+
let o = Date.now() + E, s = x, c = !1;
|
|
118
|
+
for (; !c && Date.now() < o;) {
|
|
119
|
+
await new Promise((e) => {
|
|
120
|
+
setTimeout(e, s);
|
|
121
|
+
}), s = w(s);
|
|
122
|
+
try {
|
|
123
|
+
let { data: i } = await a({
|
|
124
|
+
client: e,
|
|
125
|
+
headers: r(t),
|
|
126
|
+
path: { payable_id: n }
|
|
127
|
+
});
|
|
128
|
+
c = !!(i?.status && !T.has(i.status));
|
|
129
|
+
} catch {}
|
|
130
|
+
if (!c) {
|
|
131
|
+
let r = await i.poll();
|
|
132
|
+
c = r === "changed", r === "resynced" && await v({
|
|
133
|
+
client: e,
|
|
134
|
+
organizationId: t,
|
|
135
|
+
payableId: n,
|
|
136
|
+
includeApprovalRequests: !0
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return await v({
|
|
141
|
+
client: e,
|
|
142
|
+
organizationId: t,
|
|
143
|
+
payableId: n,
|
|
144
|
+
includeApprovalRequests: !0
|
|
145
|
+
}), c;
|
|
146
|
+
}
|
|
147
|
+
var R = 15e4, z = 3e3;
|
|
148
|
+
async function B({ client: e, organizationId: t, payableId: n, watch: r }) {
|
|
149
|
+
let i = Date.now() + R, a = z, o = !1;
|
|
150
|
+
for (; !o && Date.now() < i;) {
|
|
151
|
+
await new Promise((e) => {
|
|
152
|
+
setTimeout(e, a);
|
|
153
|
+
}), a = w(a);
|
|
154
|
+
let i = await r.poll();
|
|
155
|
+
o = i === "changed", i === "resynced" && await v({
|
|
156
|
+
client: e,
|
|
157
|
+
organizationId: t,
|
|
158
|
+
payableId: n,
|
|
159
|
+
includeApprovalRequests: !0
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
return await v({
|
|
163
|
+
client: e,
|
|
164
|
+
organizationId: t,
|
|
165
|
+
payableId: n,
|
|
166
|
+
includeApprovalRequests: !0
|
|
167
|
+
}), o;
|
|
168
|
+
}
|
|
169
|
+
var V = 100;
|
|
170
|
+
async function H({ client: e, organizationId: t, payableId: n }) {
|
|
171
|
+
let r = Date.now() + b, i = !1;
|
|
60
172
|
for (; !i && Date.now() < r;) await new Promise((e) => {
|
|
61
|
-
setTimeout(e,
|
|
62
|
-
}), i = await
|
|
173
|
+
setTimeout(e, x);
|
|
174
|
+
}), i = await U({
|
|
63
175
|
client: e,
|
|
64
176
|
organizationId: t,
|
|
65
177
|
payableId: n
|
|
66
178
|
}) === !0;
|
|
67
|
-
return await
|
|
179
|
+
return await v({
|
|
68
180
|
client: e,
|
|
69
181
|
organizationId: t,
|
|
70
182
|
payableId: n
|
|
71
183
|
}), i;
|
|
72
184
|
}
|
|
73
|
-
async function
|
|
74
|
-
let i = /* @__PURE__ */ new Set(),
|
|
185
|
+
async function U({ client: e, organizationId: t, payableId: n }) {
|
|
186
|
+
let i = /* @__PURE__ */ new Set(), a;
|
|
75
187
|
try {
|
|
76
188
|
do {
|
|
77
|
-
let { data:
|
|
189
|
+
let { data: o } = await s({
|
|
78
190
|
client: e,
|
|
79
191
|
headers: r(t),
|
|
80
192
|
query: {
|
|
81
|
-
limit:
|
|
193
|
+
limit: V,
|
|
82
194
|
object_id__in: [n],
|
|
83
195
|
order: "desc",
|
|
84
196
|
sort: "paid_at",
|
|
85
197
|
is_external: !1,
|
|
86
|
-
...
|
|
198
|
+
...a ? { pagination_token: a } : {}
|
|
87
199
|
}
|
|
88
200
|
});
|
|
89
|
-
if ((
|
|
90
|
-
let l =
|
|
91
|
-
|
|
92
|
-
} while (
|
|
201
|
+
if ((o?.data ?? []).some(c)) return !0;
|
|
202
|
+
let l = o?.next_pagination_token ?? void 0;
|
|
203
|
+
a = l && !i.has(l) ? (i.add(l), l) : void 0;
|
|
204
|
+
} while (a);
|
|
93
205
|
return !1;
|
|
94
206
|
} catch {
|
|
95
207
|
return;
|
|
96
208
|
}
|
|
97
209
|
}
|
|
98
|
-
async function
|
|
99
|
-
let
|
|
100
|
-
for (; !o && Date.now() <
|
|
210
|
+
async function W({ client: e, organizationId: t, payableId: n }) {
|
|
211
|
+
let i = Date.now() + b, o = !1;
|
|
212
|
+
for (; !o && Date.now() < i;) {
|
|
101
213
|
await new Promise((e) => {
|
|
102
|
-
setTimeout(e,
|
|
214
|
+
setTimeout(e, x);
|
|
103
215
|
});
|
|
104
216
|
try {
|
|
105
|
-
let { data:
|
|
217
|
+
let { data: i } = await a({
|
|
106
218
|
client: e,
|
|
107
219
|
headers: r(t),
|
|
108
220
|
path: { payable_id: n }
|
|
109
221
|
});
|
|
110
|
-
o = !
|
|
222
|
+
o = !i?.scheduled_payment_date && await U({
|
|
111
223
|
client: e,
|
|
112
224
|
organizationId: t,
|
|
113
225
|
payableId: n
|
|
114
226
|
}) === !1;
|
|
115
227
|
} catch {}
|
|
116
228
|
}
|
|
117
|
-
return await
|
|
229
|
+
return await v({
|
|
118
230
|
client: e,
|
|
119
231
|
organizationId: t,
|
|
120
232
|
payableId: n
|
|
121
233
|
}), o;
|
|
122
234
|
}
|
|
123
235
|
//#endregion
|
|
124
|
-
export {
|
|
236
|
+
export { I as beginApprovalRequestWatch, D as invalidateApprovalDecisionQueries, y as invalidateDeletedPayableQueries, v as invalidatePayableQueries, L as reconcileApprovalDecisionQueries, W as reconcileCancelledPaymentQueries, H as reconcileScheduledPaymentQueries, B as reconcileSubmittedForApprovalQueries };
|