@tesouro/embedded-components-react 0.5.63 → 0.5.67

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.
@@ -8,40 +8,41 @@ 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 "./index4.js";
12
- import { payablePolicyAssignmentQueryOptions as l } from "./index16.js";
13
- import { queryOptions as u, useQuery as d } from "@tanstack/react-query";
11
+ import { OCR_POLL_INTERVAL_MS as c, payableOcrQueryOptions as l } from "./index4.js";
12
+ import { payablePolicyAssignmentQueryOptions as u } from "./index16.js";
13
+ import { queryOptions as d, useQuery as f } from "@tanstack/react-query";
14
14
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index17.js
15
- function f({ enabled: n, ...r } = {}) {
16
- let { client: i, organizationId: o, widgetToken: c, authEpoch: l } = e(), u = !!(o && c) && (n === !0 || n === void 0), f = a({
17
- client: i,
18
- headers: t(o),
19
- query: r
15
+ function p({ enabled: n, pollWhileOcrProcessing: r = !1, ...i } = {}) {
16
+ let { client: o, organizationId: l, widgetToken: u, authEpoch: d } = e(), p = !!(l && u) && (n === !0 || n === void 0), m = a({
17
+ client: o,
18
+ headers: t(l),
19
+ query: i
20
20
  });
21
- return d({
22
- ...s(f, l),
23
- enabled: u
21
+ return f({
22
+ ...s(m, d),
23
+ enabled: p,
24
+ ...r ? { refetchInterval: (e) => (e.state.data?.data ?? []).some((e) => e.ocr_status === "processing") ? c : !1 } : {}
24
25
  });
25
26
  }
26
- var p = 100;
27
- function m({ enabled: r } = {}) {
28
- let { client: i, organizationId: a, widgetToken: c, authEpoch: l } = e(), f = t(a), m = {
27
+ var m = 100;
28
+ function h({ enabled: r } = {}) {
29
+ let { client: i, organizationId: a, widgetToken: c, authEpoch: l } = e(), u = t(a), p = {
29
30
  duplicate_match_status: "suspected",
30
- limit: p
31
- }, h = u({
31
+ limit: m
32
+ }, h = d({
32
33
  queryKey: [...o({
33
34
  client: i,
34
- headers: f,
35
- query: m
35
+ headers: u,
36
+ query: p
36
37
  }), "all"],
37
38
  queryFn: async ({ signal: e }) => {
38
39
  let t = [], r = /* @__PURE__ */ new Set(), a;
39
40
  do {
40
41
  let { data: o } = await n({
41
42
  client: i,
42
- headers: f,
43
+ headers: u,
43
44
  query: {
44
- ...m,
45
+ ...p,
45
46
  pagination_token: a
46
47
  },
47
48
  signal: e,
@@ -54,33 +55,33 @@ function m({ enabled: r } = {}) {
54
55
  return { data: t };
55
56
  }
56
57
  });
57
- return d({
58
+ return f({
58
59
  ...s(h, l),
59
60
  enabled: !!(a && c) && r !== !1
60
61
  });
61
62
  }
62
- function h({ enabled: n } = {}) {
63
+ function g({ enabled: n } = {}) {
63
64
  let { client: i, organizationId: a, widgetToken: o, authEpoch: c } = e(), l = !!(a && o) && (n === !0 || n === void 0), u = r({
64
65
  client: i,
65
66
  headers: t(a)
66
67
  });
67
- return d({
68
+ return f({
68
69
  ...s(u, c),
69
70
  enabled: l
70
71
  });
71
72
  }
72
- function g(n, { enabled: r = !0, pollWhileOcrProcessing: a = !1, pollWhilePolicyAssignmentUnsettled: o = !1 } = {}) {
73
- let { client: u, organizationId: f, widgetToken: p, authEpoch: m } = e(), h = !!(f && p && n) && r, g = a ? c({
74
- client: u,
75
- organizationId: f,
73
+ function _(n, { enabled: r = !0, pollWhileOcrProcessing: a = !1, pollWhilePolicyAssignmentUnsettled: o = !1 } = {}) {
74
+ let { client: c, organizationId: d, widgetToken: p, authEpoch: m } = e(), h = !!(d && p && n) && r, g = a ? l({
75
+ client: c,
76
+ organizationId: d,
76
77
  payableId: n ?? ""
77
- }) : void 0, _ = o ? l({
78
- client: u,
79
- organizationId: f,
78
+ }) : void 0, _ = o ? u({
79
+ client: c,
80
+ organizationId: d,
80
81
  payableId: n ?? ""
81
82
  }) : void 0, v = g ?? _ ?? i({
82
- client: u,
83
- headers: t(f),
83
+ client: c,
84
+ headers: t(d),
84
85
  path: { payable_id: n ?? "" }
85
86
  }), y = g && _ ? {
86
87
  ...v,
@@ -89,10 +90,10 @@ function g(n, { enabled: r = !0, pollWhileOcrProcessing: a = !1, pollWhilePolicy
89
90
  return t.length ? Math.min(...t) : !1;
90
91
  }
91
92
  } : v;
92
- return d({
93
+ return f({
93
94
  ...s(y, m),
94
95
  enabled: h
95
96
  });
96
97
  }
97
98
  //#endregion
98
- export { m as useAllSuspectedDuplicatePayablesQuery, g as usePayableQuery, f as usePayablesQuery, h as usePayablesTotalCountQuery };
99
+ export { h as useAllSuspectedDuplicatePayablesQuery, _ as usePayableQuery, p as usePayablesQuery, g as usePayablesTotalCountQuery };
@@ -245,19 +245,20 @@ async function K({ client: e, organizationId: t, payableId: n }) {
245
245
  payableId: n
246
246
  }), o;
247
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;) {
248
+ var q = 9e4;
249
+ async function J({ client: e, organizationId: t, payableId: n }) {
250
+ let i = Date.now() + q, o = v, s = !1;
251
+ for (; !s && Date.now() < i;) {
251
252
  await new Promise((e) => {
252
- setTimeout(e, v);
253
- });
253
+ setTimeout(e, o);
254
+ }), o = E(o);
254
255
  try {
255
256
  let { data: i } = await a({
256
257
  client: e,
257
258
  headers: r(t),
258
259
  path: { payable_id: n }
259
260
  });
260
- o = i?.ocr_status !== "processing";
261
+ s = i?.ocr_status !== "processing";
261
262
  } catch {}
262
263
  }
263
264
  return await y({
@@ -265,7 +266,7 @@ async function q({ client: e, organizationId: t, payableId: n }) {
265
266
  organizationId: t,
266
267
  payableId: n,
267
268
  includeLineItems: !0
268
- }), o;
269
+ }), s;
269
270
  }
270
271
  //#endregion
271
- 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 };
272
+ 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, J as reconcileUploadedPayableOcr };
@@ -9,126 +9,127 @@ import { hasSuspectedPayableDuplicate as ee } from "../../data-access/dist/index
9
9
  import { usePayablesQuery as r, usePayablesTotalCountQuery as i } from "../../data-access/dist/index17.js";
10
10
  import "../../data-access/dist/index.js";
11
11
  import { derivePayableStatus as te } from "./index7.js";
12
- import { resolveVendorName as a } from "./index8.js";
13
- import { isEditablePayableStatus as ne } from "./index19.js";
14
- import { BillQueue as o, DEFAULT_BILL_QUEUE as s, billQueueColumns as c, billQueueHasScheduledPayment as l, billQueueOffersAddPanel as u, billQueueStatuses as d, billSortColumnId as f, billSortField as p } from "./index73.js";
15
- import { useBillsFilters as m } from "./index81.js";
16
- import { useCallback as h, useEffect as g, useMemo as _, useState as v } from "react";
12
+ import { resolveVendorName as ne } from "./index8.js";
13
+ import { isEditablePayableStatus as re } from "./index19.js";
14
+ import { BillQueue as a, DEFAULT_BILL_QUEUE as o, billQueueColumns as s, billQueueHasScheduledPayment as c, billQueueOffersAddPanel as l, billQueueStatuses as u, billSortColumnId as d, billSortField as f } from "./index73.js";
15
+ import { useBillsFilters as p } from "./index81.js";
16
+ import { useCallback as m, useEffect as h, useMemo as g, useState as _ } from "react";
17
17
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index82.js
18
- var y = 10, b = [{
18
+ var v = 10, y = [{
19
19
  id: "addedOnLabel",
20
20
  desc: !0
21
21
  }];
22
- function x({ enabled: x = !0, canReadVendors: S = !0, isVendorFilterPaused: C = !1, filterLabels: w, onOpenBill: T, duplicateRowNote: E, attachmentLabel: D }) {
23
- let [O, k] = v(s), [A, j] = v(b), [M, N] = v(y), [P, F] = v(), [I, L] = v(""), [R, z] = v(""), B = h(() => F(void 0), []);
24
- g(() => {
22
+ function b({ enabled: b = !0, canReadVendors: x = !0, isVendorFilterPaused: S = !1, filterLabels: C, onOpenBill: w, duplicateRowNote: T, attachmentLabel: E }) {
23
+ let [D, O] = _(o), [k, A] = _(y), [j, ie] = _(v), [M, N] = _(), [P, F] = _(""), [I, L] = _(""), R = m(() => N(void 0), []);
24
+ h(() => {
25
25
  let e = setTimeout(() => {
26
- z(I), B();
26
+ L(P), R();
27
27
  }, 300);
28
28
  return () => clearTimeout(e);
29
- }, [I, B]);
30
- let V = m({
31
- offersStatusFilter: O === o.All,
32
- offersVendorFilter: S,
33
- isVendorFilterPaused: C,
34
- labels: w,
35
- onFiltersChange: B
36
- }), H = A[0], U = p(H?.id), W = U ? H?.desc ? "desc" : "asc" : void 0, G = _(() => ({
37
- ...V.query,
38
- limit: M,
39
- pagination_token: P,
40
- status__in: d(O) ?? V.query.status__in,
41
- has_scheduled_payment: l(O),
42
- counterpart_name__icontains: R || void 0,
43
- sort: U,
44
- order: W
29
+ }, [P, R]);
30
+ let z = p({
31
+ offersStatusFilter: D === a.All,
32
+ offersVendorFilter: x,
33
+ isVendorFilterPaused: S,
34
+ labels: C,
35
+ onFiltersChange: R
36
+ }), B = k[0], V = f(B?.id), H = V ? B?.desc ? "desc" : "asc" : void 0, U = g(() => ({
37
+ ...z.query,
38
+ limit: j,
39
+ pagination_token: M,
40
+ status__in: u(D) ?? z.query.status__in,
41
+ has_scheduled_payment: c(D),
42
+ counterpart_name__icontains: I || void 0,
43
+ sort: V,
44
+ order: H
45
45
  }), [
46
- V.query,
46
+ z.query,
47
+ j,
47
48
  M,
48
- P,
49
- O,
50
- R,
51
- U,
52
- W
53
- ]), { organizationId: K } = e(), q = JSON.stringify([K, G]), J = r({
54
- ...G,
55
- enabled: x
56
- }), [Y, X] = v(q);
57
- g(() => {
58
- J.isFetching || X(q);
59
- }, [J.isFetching, q]);
60
- let Z = J.data?.data.length === 0, Q = i({ enabled: x && Z }), re = !Z || (Q.data?.count ?? 1) > 0, ie = _(() => (J.data?.data ?? []).map((e) => {
49
+ D,
50
+ I,
51
+ V,
52
+ H
53
+ ]), { organizationId: W } = e(), G = JSON.stringify([W, U]), K = r({
54
+ ...U,
55
+ enabled: b,
56
+ pollWhileOcrProcessing: !0
57
+ }), [q, J] = _(G);
58
+ h(() => {
59
+ K.isFetching || J(G);
60
+ }, [K.isFetching, G]);
61
+ let Y = K.data?.data.length, X = Y === 0, Z = i({ enabled: b && X }), ae = !X || (Z.data?.count ?? 1) > 0, Q = g(() => (K.data?.data ?? []).filter((e) => e.ocr_status !== "processing").map((e) => {
61
62
  let r = te({
62
63
  apiStatus: e.status,
63
64
  dueDate: e.due_date,
64
65
  scheduledPaymentDate: e.scheduled_payment_date
65
- }), i = e.amount_due ?? e.total_amount, s = e.status === "partially_paid" || e.status === "paid", c = (t) => t == null ? "" : n(t / 100, { currencyCode: e.currency ?? "USD" });
66
+ }), i = e.amount_due ?? e.total_amount, o = e.status === "partially_paid" || e.status === "paid", s = (t) => t == null ? "" : n(t / 100, { currencyCode: e.currency ?? "USD" });
66
67
  return {
67
68
  rowKey: e.id,
68
- vendorLabel: a(e),
69
+ vendorLabel: ne(e),
69
70
  issueDateLabel: t(e.issued_at),
70
71
  dueDateLabel: t(e.due_date),
71
72
  dueDateTone: r.isOverdue ? "danger" : "default",
72
73
  scheduledDateLabel: t(e.scheduled_payment_date),
73
- scheduledDateIsGap: O === o.Scheduled,
74
+ scheduledDateIsGap: D === a.Scheduled,
74
75
  paidDateLabel: t(e.paid_at?.slice(0, 10)),
75
- amountDueLabel: c(i),
76
- amountPaidLabel: s ? c(e.amount_paid) : "",
77
- amountPaidIsGap: O === o.Paid,
78
- amountScheduledLabel: c(e.amount_to_pay ?? i),
79
- totalAmountLabel: c(e.total_amount),
80
- attachment: e.file_id ? { label: D } : void 0,
76
+ amountDueLabel: s(i),
77
+ amountPaidLabel: o ? s(e.amount_paid) : "",
78
+ amountPaidIsGap: D === a.Paid,
79
+ amountScheduledLabel: s(e.amount_to_pay ?? i),
80
+ totalAmountLabel: s(e.total_amount),
81
+ attachment: e.file_id ? { label: E } : void 0,
81
82
  status: r.status,
82
83
  statusTone: r.tone,
83
84
  addedOnLabel: t(e.created_at?.slice(0, 10)),
84
85
  ...ee(e) ? {
85
86
  rowTone: "warning",
86
- rowNote: E
87
+ rowNote: T
87
88
  } : {},
88
- onOpen: () => T(e.id, ne(e.status))
89
+ onOpen: () => w(e.id, re(e.status))
89
90
  };
90
91
  }), [
91
- J.data?.data,
92
- E,
93
- D,
92
+ K.data?.data,
94
93
  T,
95
- O
96
- ]), ae = h((e) => {
94
+ E,
95
+ w,
96
+ D
97
+ ]), oe = m((e) => {
97
98
  let t = e;
98
- k(t), j((e) => {
99
+ O(t), A((e) => {
99
100
  let n = e[0]?.id;
100
- return n ? c(t).some((e) => f(e) === n) ? e : b : e;
101
- }), B();
102
- }, [B]), oe = h((e) => {
103
- j((t) => typeof e == "function" ? e(t) : e), B();
104
- }, [B]), $ = h((e) => {
105
- N(e), B();
106
- }, [B]), se = h(() => F(J.data?.next_pagination_token ?? void 0), [J.data?.next_pagination_token]), ce = h(() => F(J.data?.prev_pagination_token ?? void 0), [J.data?.prev_pagination_token]), le = h(() => {
107
- J.refetch();
108
- }, [J.refetch]);
101
+ return n ? s(t).some((e) => d(e) === n) ? e : y : e;
102
+ }), R();
103
+ }, [R]), se = m((e) => {
104
+ A((t) => typeof e == "function" ? e(t) : e), R();
105
+ }, [R]), ce = m((e) => {
106
+ ie(e), R();
107
+ }, [R]), le = m(() => N(K.data?.next_pagination_token ?? void 0), [K.data?.next_pagination_token]), $ = m(() => N(K.data?.prev_pagination_token ?? void 0), [K.data?.prev_pagination_token]), ue = m(() => {
108
+ K.refetch();
109
+ }, [K.refetch]);
109
110
  return {
110
- rows: ie,
111
- isLoading: J.isLoading || q !== Y || Z && Q.isLoading,
112
- isError: J.isError,
113
- onRetry: le,
114
- selectedFilterTabId: O,
115
- onFilterTabChange: ae,
116
- searchValue: I,
117
- onSearchChange: L,
118
- hasAnyBills: re,
119
- isSearchActive: R.length > 0 || V.isFilterActive,
120
- filterBarProps: V.filterBarProps,
121
- visibleColumns: c(O),
122
- showAddPanelWhenEmpty: u(O),
123
- sorting: A,
124
- onSortingChange: oe,
125
- pageSize: M,
126
- onPageSizeChange: $,
127
- hasNextPage: !!J.data?.next_pagination_token,
128
- hasPrevPage: !!J.data?.prev_pagination_token,
129
- onNextPage: se,
130
- onPrevPage: ce
111
+ rows: Q,
112
+ isLoading: K.isLoading || G !== q || X && Z.isLoading || (Y ?? 0) > 0 && Q.length === 0,
113
+ isError: K.isError,
114
+ onRetry: ue,
115
+ selectedFilterTabId: D,
116
+ onFilterTabChange: oe,
117
+ searchValue: P,
118
+ onSearchChange: F,
119
+ hasAnyBills: ae,
120
+ isSearchActive: I.length > 0 || z.isFilterActive,
121
+ filterBarProps: z.filterBarProps,
122
+ visibleColumns: s(D),
123
+ showAddPanelWhenEmpty: l(D),
124
+ sorting: k,
125
+ onSortingChange: se,
126
+ pageSize: j,
127
+ onPageSizeChange: ce,
128
+ hasNextPage: !!K.data?.next_pagination_token,
129
+ hasPrevPage: !!K.data?.prev_pagination_token,
130
+ onNextPage: le,
131
+ onPrevPage: $
131
132
  };
132
133
  }
133
134
  //#endregion
134
- export { x as useBillsTable };
135
+ export { b as useBillsTable };
@@ -1,5 +1,5 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
2
- var e = "@tesouro/embedded-components-react", t = "0.5.63", n = "34ab770a11f7fab14c9dfc21d23b7685134bb2b4", r = Object.freeze({
2
+ var e = "@tesouro/embedded-components-react", t = "0.5.67", n = "7426395559729900fa647ef8cfc5ad4c4048564b", r = Object.freeze({
3
3
  library_name: e,
4
4
  library_version: t,
5
5
  library_sha: n
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tesouro/embedded-components-react",
3
- "version": "0.5.63",
3
+ "version": "0.5.67",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "packageDepSync": {