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