@tesouro/embedded-components-react 0.3.37 → 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.
Files changed (21) hide show
  1. package/dist/index.d.ts +16 -0
  2. package/dist/lib/CardDetailsWidget.d.ts +16 -0
  3. package/dist/lib/CardsWidget.d.ts +16 -0
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index11.js +59 -48
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index4.js +2 -2
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index5.js +163 -51
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index6.js +39 -20
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +5 -0
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +1 -0
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index55.js +1 -0
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index66.js +1 -0
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index67.js +156 -138
  13. package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index3.js +19 -8
  14. package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index4.js +31 -15
  15. package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index5.js +12 -1
  16. package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index6.js +3 -0
  17. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/CardDetailsPanel.js +151 -124
  18. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/labels.js +3 -0
  19. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +23 -23
  20. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  21. package/package.json +1 -1
@@ -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 { getPayablesId as i, getPaymentRecords as a } from "../../../shared/data-access/dist/lib/rest/sdk.gen.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";
4
4
  import "../../../shared/data-access/dist/index.js";
5
- import { isLiveScheduledPaymentRecord as o } from "./index3.js";
6
- import { approvalRequestsInvalidationKey as s, payableHistoryInvalidationKey as c, payableInvalidationKey as l, payableLineItemsInvalidationKey as u, payablePaymentRecordsInvalidationKey as d, payablesAnalyticsInvalidationKey as f, payablesInvalidationKey as p } from "./index4.js";
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 m({ client: e, organizationId: n, payableId: r, includeLineItems: i, includeApprovalRequests: a }) {
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
- }, m = r ? {
12
+ }, s = r ? {
13
13
  ...o,
14
14
  payableId: r
15
- } : void 0, h = [
16
- p(o),
17
- f(o),
18
- ...a ? [s(o)] : [],
19
- ...m ? [
20
- l(m),
21
- c(m),
22
- d(m)
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
- ...m && i ? [u(m)] : []
24
+ ...s && i ? [m(s)] : []
25
25
  ];
26
- await Promise.all(h.map((e) => t(e)));
26
+ await Promise.all(c.map((e) => t(e)));
27
27
  }
28
- async function h({ client: r, organizationId: i, payableId: a }) {
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(p(o)), t(f(o))]), !a) return;
33
+ if (await Promise.all([t(_(o)), t(g(o))]), !a) return;
34
34
  let s = {
35
35
  ...o,
36
36
  payableId: a
37
- }, d = [
38
- l(s),
39
- c(s),
40
- u(s)
37
+ }, c = [
38
+ p(s),
39
+ f(s),
40
+ m(s)
41
41
  ];
42
- await Promise.all(d.map((t) => e(t))), d.forEach((e) => n(e));
42
+ await Promise.all(c.map((t) => e(t))), c.forEach((e) => n(e));
43
43
  }
44
- var g = 500;
45
- async function _({ client: e, organizationId: n, payableId: r }) {
46
- await t(s({
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 new Promise((e) => {
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 v = 2e4, y = 1e3, b = 100;
58
- async function x({ client: e, organizationId: t, payableId: n }) {
59
- let r = Date.now() + v, i = !1;
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, y);
62
- }), i = await S({
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 m({
179
+ return await v({
68
180
  client: e,
69
181
  organizationId: t,
70
182
  payableId: n
71
183
  }), i;
72
184
  }
73
- async function S({ client: e, organizationId: t, payableId: n }) {
74
- let i = /* @__PURE__ */ new Set(), s;
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: c } = await a({
189
+ let { data: o } = await s({
78
190
  client: e,
79
191
  headers: r(t),
80
192
  query: {
81
- limit: b,
193
+ limit: V,
82
194
  object_id__in: [n],
83
195
  order: "desc",
84
196
  sort: "paid_at",
85
197
  is_external: !1,
86
- ...s ? { pagination_token: s } : {}
198
+ ...a ? { pagination_token: a } : {}
87
199
  }
88
200
  });
89
- if ((c?.data ?? []).some(o)) return !0;
90
- let l = c?.next_pagination_token ?? void 0;
91
- s = l && !i.has(l) ? (i.add(l), l) : void 0;
92
- } while (s);
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 C({ client: e, organizationId: t, payableId: n }) {
99
- let a = Date.now() + v, o = !1;
100
- for (; !o && Date.now() < a;) {
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, y);
214
+ setTimeout(e, x);
103
215
  });
104
216
  try {
105
- let { data: a } = await i({
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 = !a?.scheduled_payment_date && await S({
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 m({
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 { _ as invalidateApprovalDecisionQueries, h as invalidateDeletedPayableQueries, m as invalidatePayableQueries, C as reconcileCancelledPaymentQueries, x as reconcileScheduledPaymentQueries };
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 };
@@ -8,28 +8,45 @@ import { postApprovalRequestsIdApprove as n, postApprovalRequestsIdReject as r }
8
8
  import { getApprovalRequestsOptions as i } from "../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
9
9
  import { withAuthEpoch as a } from "../../../shared/data-access/dist/lib/withAuthEpoch.js";
10
10
  import "../../../shared/data-access/dist/index.js";
11
- import { invalidateApprovalDecisionQueries as o } from "./index5.js";
12
- import { useMutation as s, useQuery as c } from "@tanstack/react-query";
11
+ import { NEWEST_REQUEST_FIRST as o, PAYABLE_OBJECT_TYPE as s } from "./index4.js";
12
+ import { beginApprovalRequestWatch as c, invalidateApprovalDecisionQueries as l, reconcileApprovalDecisionQueries as u } from "./index5.js";
13
+ import { useMutation as d, useQuery as f } from "@tanstack/react-query";
13
14
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index6.js
14
- var l = "payable", u = "desc";
15
- function d(n, { enabled: r } = {}) {
16
- let { client: o, organizationId: s, widgetToken: d, authEpoch: f } = e(), p = !!(s && d && n) && r !== !1, m = i({
17
- client: o,
18
- headers: t(s),
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({
17
+ client: c,
18
+ headers: t(l),
19
19
  query: {
20
20
  object_id: n ?? "",
21
- object_type: l,
22
- order: u
21
+ object_type: s,
22
+ order: o
23
23
  }
24
24
  });
25
- return c({
26
- ...a(m, f),
25
+ return f({
26
+ ...a(m, d),
27
27
  enabled: p
28
28
  });
29
29
  }
30
- function f() {
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() {
31
48
  let { client: r, organizationId: i } = e();
32
- return s({
49
+ return d({
33
50
  mutationFn: async ({ path: e }) => {
34
51
  let { data: a } = await n({
35
52
  client: r,
@@ -40,17 +57,18 @@ function f() {
40
57
  return a;
41
58
  },
42
59
  onSuccess: async (e) => {
43
- await o({
60
+ await m({
44
61
  client: r,
45
62
  organizationId: i,
46
- payableId: e?.object_id
63
+ payableId: e?.object_id,
64
+ requestStatus: e?.status
47
65
  });
48
66
  }
49
67
  });
50
68
  }
51
- function p() {
69
+ function g() {
52
70
  let { client: n, organizationId: i } = e();
53
- return s({
71
+ return d({
54
72
  mutationFn: async ({ path: e, body: a }) => {
55
73
  let { data: o } = await r({
56
74
  client: n,
@@ -62,13 +80,14 @@ function p() {
62
80
  return o;
63
81
  },
64
82
  onSuccess: async (e) => {
65
- await o({
83
+ await m({
66
84
  client: n,
67
85
  organizationId: i,
68
- payableId: e?.object_id
86
+ payableId: e?.object_id,
87
+ requestStatus: e?.status
69
88
  });
70
89
  }
71
90
  });
72
91
  }
73
92
  //#endregion
74
- export { f as useApprovePayableApprovalRequestMutation, d as usePayableApprovalRequestsQuery, p as useRejectPayableApprovalRequestMutation };
93
+ export { h as useApprovePayableApprovalRequestMutation, p as usePayableApprovalRequestsQuery, g as useRejectPayableApprovalRequestMutation };
@@ -42,6 +42,7 @@ var a = t.Pending, o = [
42
42
  ], s = {
43
43
  [t.Drafts]: [
44
44
  e.Vendor,
45
+ e.Attachment,
45
46
  e.IssueDate,
46
47
  e.DueDate,
47
48
  e.Status,
@@ -51,6 +52,7 @@ var a = t.Pending, o = [
51
52
  ],
52
53
  [t.Pending]: [
53
54
  e.Vendor,
55
+ e.Attachment,
54
56
  e.IssueDate,
55
57
  e.DueDate,
56
58
  e.Status,
@@ -60,6 +62,7 @@ var a = t.Pending, o = [
60
62
  ],
61
63
  [t.Scheduled]: [
62
64
  e.Vendor,
65
+ e.Attachment,
63
66
  e.IssueDate,
64
67
  e.DueDate,
65
68
  e.ScheduledDate,
@@ -70,6 +73,7 @@ var a = t.Pending, o = [
70
73
  ],
71
74
  [t.Paid]: [
72
75
  e.Vendor,
76
+ e.Attachment,
73
77
  e.IssueDate,
74
78
  e.DueDate,
75
79
  e.PaidDate,
@@ -80,6 +84,7 @@ var a = t.Pending, o = [
80
84
  ],
81
85
  [t.All]: [
82
86
  e.Vendor,
87
+ e.Attachment,
83
88
  e.IssueDate,
84
89
  e.DueDate,
85
90
  e.ScheduledDate,
@@ -7,6 +7,7 @@ var t = {
7
7
  detailsSheet: "bill-pay-details-sheet"
8
8
  }, n = {
9
9
  [e.Vendor]: "bill-pay-bills-cell-vendor",
10
+ [e.Attachment]: "bill-pay-bills-cell-attachment",
10
11
  [e.IssueDate]: "bill-pay-bills-cell-issue-date",
11
12
  [e.DueDate]: "bill-pay-bills-cell-due-date",
12
13
  [e.ScheduledDate]: "bill-pay-bills-cell-scheduled-date",
@@ -48,6 +48,7 @@ var o = {
48
48
  }, l = {
49
49
  createButton: "Add bill",
50
50
  columnVendor: "Vendor",
51
+ columnAttachment: "Attachment",
51
52
  columnIssueDate: "Issue date",
52
53
  columnDueDate: "Due date",
53
54
  columnScheduledDate: "Scheduled date",
@@ -1,6 +1,7 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index66.js
2
2
  var e = {
3
3
  Vendor: "vendor",
4
+ Attachment: "attachment",
4
5
  IssueDate: "issueDate",
5
6
  DueDate: "dueDate",
6
7
  ScheduledDate: "scheduledDate",