@tesouro/embedded-components-react 0.3.44 → 0.3.47

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 (63) hide show
  1. package/dist/index.css +10 -0
  2. package/dist/index.js +1 -1
  3. package/dist/lib/BillPayWidget.js +1 -1
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +9 -9
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +42 -39
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +4 -41
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +40 -55
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +56 -5
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +5 -73
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +72 -48
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +47 -91
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +91 -33
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +33 -160
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +163 -75
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +75 -21
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +23 -210
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +198 -202
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +197 -88
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +105 -13
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +12 -46
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +47 -30
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +26 -182
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +187 -31
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +32 -98
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +102 -16
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +16 -301
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +322 -4
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +4 -33
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +31 -83
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +77 -159
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +167 -3
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +3 -4
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +2 -44
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +46 -1
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +1 -8
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +6 -9
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +9 -92
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +94 -3
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +3 -9
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +7 -20
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +14 -51
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +59 -3
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +3 -128
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +125 -8
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +8 -43
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +41 -18
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +20 -28
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +27 -82
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +83 -47
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +47 -250
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +240 -101
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +107 -204
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js +211 -3
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +4 -8
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +6 -113
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js +115 -1
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +0 -24
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js +25 -0
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index44.js +28 -27
  60. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  61. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index8.js +1 -1
  62. package/dist/packages/shared-ui-shadcn/dist/index.js +113 -113
  63. package/package.json +1 -1
@@ -2,211 +2,114 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
- import { hasAnyScope as t } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
7
- import { Scope as n } from "../../../shared/data-access/dist/lib/scopes.js";
8
- import "../../../shared/data-access/dist/index.js";
9
- import "../../../shared/ui/dist/index.js";
10
- import { useWidgetConfig as r, useWidgetInitStaleForToken as ee } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
11
- import "../../../shared/feature/dist/index.js";
12
- import { AddBillDialog as te } from "../../ui/dist/index10.js";
13
- import { BillsScreen as ne } from "../../ui/dist/index67.js";
14
- import "../../ui/dist/index.js";
15
- import { BillCreateDialog as i } from "./index44.js";
16
- import "./index45.js";
17
- import { BillDetailsContainer as a } from "./index48.js";
18
- import "./index49.js";
19
- import "./index55.js";
20
- import "./index56.js";
21
- import { DuplicateBillsContainer as o } from "./index59.js";
22
- import "./index60.js";
23
- import { BILL_QUEUE_ORDER as s, BillQueue as c } from "./index61.js";
24
- import { BILLS_TAB_LABELS_EN as l } from "./index63.js";
25
- import { useBillsTable as u } from "./index69.js";
26
- import { copyTextToClipboard as re } from "./index62.js";
27
- import { billsTabTestIds as d, billsTableCellTestIds as ie } from "./index64.js";
28
- import { useCallback as f, useEffect as p, useMemo as m, useState as h } from "react";
29
- import { jsx as g, jsxs as _ } from "react/jsx-runtime";
30
- import { CalendarClockIcon as v, CheckIcon as y, FilePenIcon as b, ListIcon as x, LoaderCircleIcon as S } from "lucide-react";
5
+ import { formatCalendarDate as e } from "../../../shared/util/dist/lib/formatCalendarDate.js";
6
+ import { formatMoneyExact as t } from "../../../shared/util/dist/lib/formatMoneyExact.js";
7
+ import { resolveVendorName as n } from "./index7.js";
8
+ import { usePayablesQuery as r, usePayablesTotalCountQuery as i } from "../../data-access/dist/index14.js";
9
+ import "../../data-access/dist/index.js";
10
+ import { derivePayableStatus as a } from "./index26.js";
11
+ import { isEditablePayableStatus as o } from "./index24.js";
12
+ import { BillQueue as s, DEFAULT_BILL_QUEUE as c, billQueueColumns as l, billQueueHasScheduledPayment as u, billQueueOffersAddPanel as d, billQueueStatuses as f, billSortColumnId as p, billSortField as m } from "./index62.js";
13
+ import { useBillsFilters as h } from "./index69.js";
14
+ import { useCallback as g, useEffect as _, useMemo as v, useState as y } from "react";
31
15
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js
32
- var C = "bills@business-banking.app", w = {
33
- [c.Drafts]: /* @__PURE__ */ g(b, {
34
- className: "ttw:size-4",
35
- "aria-hidden": !0
36
- }),
37
- [c.Pending]: /* @__PURE__ */ g(S, {
38
- className: "ttw:size-4",
39
- "aria-hidden": !0
40
- }),
41
- [c.Scheduled]: /* @__PURE__ */ g(v, {
42
- className: "ttw:size-4",
43
- "aria-hidden": !0
44
- }),
45
- [c.Paid]: /* @__PURE__ */ g(y, {
46
- className: "ttw:size-4",
47
- "aria-hidden": !0
48
- }),
49
- [c.All]: /* @__PURE__ */ g(x, {
50
- className: "ttw:size-4",
51
- "aria-hidden": !0
52
- })
53
- };
54
- function T({ labels: c, onEnqueueFiles: v, openPayableId: y, onOpenPayableHandled: b, poweredByBankName: x, duplicateBills: S }) {
55
- let T = m(() => ({
56
- ...l,
57
- ...c,
58
- queues: {
59
- ...l.queues,
60
- ...c?.queues
61
- },
62
- filters: {
63
- ...l.filters,
64
- ...c?.filters,
65
- presets: {
66
- ...l.filters.presets,
67
- ...c?.filters?.presets
68
- },
69
- statuses: {
70
- ...l.filters.statuses,
71
- ...c?.filters?.statuses
72
- },
73
- dateFieldNames: {
74
- ...l.filters.dateFieldNames,
75
- ...c?.filters?.dateFieldNames
76
- }
77
- },
78
- filterBar: {
79
- ...l.filterBar,
80
- ...c?.filterBar
81
- },
82
- queueEmptyStates: s.reduce((e, t) => ({
83
- ...e,
84
- [t]: {
85
- ...l.queueEmptyStates[t],
86
- ...c?.queueEmptyStates?.[t]
87
- }
88
- }), {})
89
- }), [c]), [ae, E] = h(!1), [D, O] = h(), [k, A] = h(!1), [j, M] = h(), [N, P] = h(!1), [F, I] = h(!1), [L, R] = h(!1), { initResponse: z } = r(), B = ee(), V = t(z?.scopes, [n.PayableReadOrg]), H = t(z?.scopes, [n.PayableWriteOrg]), U = !z || V, W = !z || H, G = f((e, t) => {
90
- if (t && W) {
91
- O(e), A(!0);
92
- return;
93
- }
94
- M(e), P(!0);
95
- }, [W]), K = m(() => (S ?? []).filter((e) => e.isPossibleDuplicate).map((e) => e.id), [S]), q = t(z?.scopes, [n.CounterpartReadOrg]), J = u({
96
- enabled: U,
97
- canReadVendors: q,
98
- isVendorFilterPaused: B,
99
- filterLabels: T.filters,
100
- onOpenBill: G,
101
- duplicateBillIds: K,
102
- duplicateBadgeLabel: T.duplicateBadge,
103
- attachmentLabel: T.attachmentIndicator
104
- }), Y = (e) => !!(e && K.includes(e)), X = K.length, oe = X === 0 ? void 0 : X === 1 ? T.duplicateWarningOne : T.duplicateWarningMany(X), se = m(() => s.map((e) => ({
105
- id: e,
106
- label: T.queues[e],
107
- icon: w[e]
108
- })), [T.queues]), ce = (e) => {
109
- R(!1), M(e), P(!0);
110
- }, le = () => {
111
- P(!1), I(!0);
112
- }, ue = () => {
113
- I(!1), P(!0);
114
- }, de = m(() => ({
115
- createButton: T.createButton,
116
- addBill: { heading: T.nonEmptyHeading }
117
- }), [T.createButton, T.nonEmptyHeading]), fe = m(() => ({
118
- ...J.filterBarProps,
119
- labels: T.filterBar
120
- }), [J.filterBarProps, T.filterBar]), Z = () => {
121
- E(!1), O(void 0), A(!0);
122
- }, Q = (e) => {
123
- E(!1), v?.(e);
124
- }, $ = async () => {
125
- await re(C) ? e.success(T.emailCopiedToast) : e.error(T.emailCopyFailedToast);
16
+ var b = 10, x = [{
17
+ id: "addedOnLabel",
18
+ desc: !0
19
+ }];
20
+ function S({ enabled: S = !0, canReadVendors: C = !0, isVendorFilterPaused: w = !1, filterLabels: T, onOpenBill: E, duplicateBillIds: D, duplicateBadgeLabel: O, attachmentLabel: k }) {
21
+ let [A, j] = y(c), [M, N] = y(x), [P, F] = y(b), [I, L] = y(), [R, z] = y(""), [B, V] = y(""), H = g(() => L(void 0), []);
22
+ _(() => {
23
+ let e = setTimeout(() => {
24
+ V(R), H();
25
+ }, 300);
26
+ return () => clearTimeout(e);
27
+ }, [R, H]);
28
+ let U = h({
29
+ offersStatusFilter: A === s.All,
30
+ offersVendorFilter: C,
31
+ isVendorFilterPaused: w,
32
+ labels: T,
33
+ onFiltersChange: H
34
+ }), W = M[0], G = m(W?.id), K = r({
35
+ ...U.query,
36
+ limit: P,
37
+ pagination_token: I,
38
+ status__in: f(A) ?? U.query.status__in,
39
+ has_scheduled_payment: u(A),
40
+ counterpart_name__icontains: B || void 0,
41
+ sort: G,
42
+ order: G ? W?.desc ? "desc" : "asc" : void 0,
43
+ enabled: S
44
+ }), q = K.data?.data.length === 0, J = i({ enabled: S && q }), Y = !q || (J.data?.count ?? 1) > 0, X = v(() => new Set(D), [D]), Z = v(() => (K.data?.data ?? []).map((r) => {
45
+ let i = a({
46
+ apiStatus: r.status,
47
+ dueDate: r.due_date,
48
+ scheduledPaymentDate: r.scheduled_payment_date
49
+ }), s = r.amount_due ?? r.total_amount, c = (e) => e == null ? "" : t(e / 100, { currencyCode: r.currency ?? "USD" });
50
+ return {
51
+ vendorLabel: n(r),
52
+ issueDateLabel: e(r.issued_at),
53
+ dueDateLabel: e(r.due_date),
54
+ dueDateTone: i.isOverdue ? "danger" : "default",
55
+ scheduledDateLabel: e(r.scheduled_payment_date),
56
+ paidDateLabel: e(r.paid_at?.slice(0, 10)),
57
+ amountDueLabel: c(s),
58
+ amountPaidLabel: c(r.amount_paid),
59
+ amountScheduledLabel: c(r.amount_to_pay ?? s),
60
+ totalAmountLabel: c(r.total_amount),
61
+ attachment: r.file_id ? { label: k } : void 0,
62
+ status: i.status,
63
+ statusTone: i.tone,
64
+ addedOnLabel: e(r.created_at?.slice(0, 10)),
65
+ duplicateBadge: X.has(r.id) ? {
66
+ label: O,
67
+ tone: "warning"
68
+ } : void 0,
69
+ onOpen: () => E(r.id, o(r.status))
70
+ };
71
+ }), [
72
+ K.data?.data,
73
+ X,
74
+ O,
75
+ k,
76
+ E
77
+ ]), Q = g((e) => {
78
+ let t = e;
79
+ j(t), N((e) => {
80
+ let n = e[0]?.id;
81
+ return n ? l(t).some((e) => p(e) === n) ? e : x : e;
82
+ }), H();
83
+ }, [H]), $ = g((e) => {
84
+ N((t) => typeof e == "function" ? e(t) : e), H();
85
+ }, [H]), ee = g((e) => {
86
+ F(e), H();
87
+ }, [H]), te = g(() => L(K.data?.next_pagination_token ?? void 0), [K.data?.next_pagination_token]), ne = g(() => L(K.data?.prev_pagination_token ?? void 0), [K.data?.prev_pagination_token]), re = g(() => {
88
+ K.refetch();
89
+ }, [K.refetch]);
90
+ return {
91
+ rows: Z,
92
+ isLoading: K.isFetching || q && J.isLoading,
93
+ isError: K.isError,
94
+ onRetry: re,
95
+ selectedFilterTabId: A,
96
+ onFilterTabChange: Q,
97
+ searchValue: R,
98
+ onSearchChange: z,
99
+ hasAnyBills: Y,
100
+ isSearchActive: B.length > 0 || U.isFilterActive,
101
+ filterBarProps: U.filterBarProps,
102
+ visibleColumns: l(A),
103
+ showAddPanelWhenEmpty: d(A),
104
+ sorting: M,
105
+ onSortingChange: $,
106
+ pageSize: P,
107
+ onPageSizeChange: ee,
108
+ hasNextPage: !!K.data?.next_pagination_token,
109
+ hasPrevPage: !!K.data?.prev_pagination_token,
110
+ onNextPage: te,
111
+ onPrevPage: ne
126
112
  };
127
- return p(() => {
128
- y && (O(y), A(!0), b?.());
129
- }, [b, y]), /* @__PURE__ */ _("div", {
130
- "data-testid": d.root,
131
- children: [
132
- /* @__PURE__ */ g(ne, {
133
- rows: J.rows,
134
- isLoading: J.isLoading || !z,
135
- isError: J.isError,
136
- onRetry: J.onRetry,
137
- sorting: J.sorting,
138
- onSortingChange: J.onSortingChange,
139
- pageSize: J.pageSize,
140
- onPageSizeChange: J.onPageSizeChange,
141
- hasNextPage: J.hasNextPage,
142
- hasPrevPage: J.hasPrevPage,
143
- onNextPage: J.onNextPage,
144
- onPrevPage: J.onPrevPage,
145
- filterTabs: se,
146
- selectedFilterTabId: J.selectedFilterTabId,
147
- onFilterTabChange: J.onFilterTabChange,
148
- searchValue: J.searchValue,
149
- onSearchChange: J.onSearchChange,
150
- filters: fe,
151
- visibleColumns: J.visibleColumns,
152
- cellTestIds: ie,
153
- isSearchActive: J.isSearchActive,
154
- showAddPanelWhenEmpty: J.showAddPanelWhenEmpty,
155
- emptyState: T.queueEmptyStates[J.selectedFilterTabId],
156
- onCreateClick: W ? () => E(!0) : void 0,
157
- onEnterManually: W ? Z : void 0,
158
- onFilesSelected: W ? Q : void 0,
159
- maxFiles: 10,
160
- emailAddress: C,
161
- onCopyEmail: $,
162
- duplicateWarning: oe,
163
- onReviewDuplicates: () => R(!0),
164
- labels: de
165
- }),
166
- L ? /* @__PURE__ */ g(o, {
167
- open: L,
168
- onOpenChange: R,
169
- bills: S,
170
- canManageDuplicates: W,
171
- onOpenBill: ce
172
- }) : null,
173
- W ? /* @__PURE__ */ g(te, {
174
- open: ae,
175
- onOpenChange: E,
176
- onFilesSelected: Q,
177
- maxFiles: 10,
178
- onEnterManually: Z,
179
- emailAddress: C,
180
- onCopyEmail: $,
181
- labels: { heading: J.hasAnyBills ? T.nonEmptyHeading : T.emptyHeading }
182
- }) : null,
183
- k ? /* @__PURE__ */ g(i, {
184
- open: k,
185
- onOpenChange: A,
186
- payableId: D,
187
- isPossibleDuplicate: Y(D)
188
- }) : null,
189
- N ? /* @__PURE__ */ g(a, {
190
- open: N,
191
- onOpenChange: P,
192
- payableId: j,
193
- onClose: () => P(!1),
194
- onExpand: le,
195
- isPossibleDuplicate: Y(j),
196
- testId: d.detailsSheet,
197
- poweredByBankName: x
198
- }) : null,
199
- F ? /* @__PURE__ */ g(i, {
200
- open: F,
201
- onOpenChange: I,
202
- payableId: j,
203
- readOnly: !0,
204
- onCollapse: ue,
205
- poweredByBankName: x,
206
- isPossibleDuplicate: Y(j)
207
- }) : null
208
- ]
209
- });
210
113
  }
211
114
  //#endregion
212
- export { T as BillsTab, T as default };
115
+ export { S as useBillsTable };
@@ -1,4 +1,212 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
+ import { hasAnyScope as t } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
7
+ import { Scope as n } from "../../../shared/data-access/dist/lib/scopes.js";
8
+ import "../../../shared/data-access/dist/index.js";
9
+ import "../../../shared/ui/dist/index.js";
10
+ import { useWidgetConfig as r, useWidgetInitStaleForToken as ee } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
11
+ import "../../../shared/feature/dist/index.js";
12
+ import { AddBillDialog as te } from "../../ui/dist/index10.js";
13
+ import { BillsScreen as ne } from "../../ui/dist/index67.js";
14
+ import "../../ui/dist/index.js";
15
+ import { BillCreateDialog as i } from "./index45.js";
16
+ import "./index46.js";
17
+ import { BillDetailsContainer as a } from "./index49.js";
18
+ import "./index50.js";
19
+ import "./index56.js";
20
+ import "./index57.js";
21
+ import { DuplicateBillsContainer as o } from "./index60.js";
1
22
  import "./index61.js";
2
- import "./index63.js";
3
- import "./index69.js";
4
- import "./index70.js";
23
+ import { BILL_QUEUE_ORDER as s, BillQueue as c } from "./index62.js";
24
+ import { BILLS_TAB_LABELS_EN as l } from "./index64.js";
25
+ import { useBillsTable as u } from "./index70.js";
26
+ import { copyTextToClipboard as re } from "./index63.js";
27
+ import { billsTabTestIds as d, billsTableCellTestIds as ie } from "./index65.js";
28
+ import { useCallback as f, useEffect as p, useMemo as m, useState as h } from "react";
29
+ import { jsx as g, jsxs as _ } from "react/jsx-runtime";
30
+ import { CalendarClockIcon as v, CheckIcon as y, FilePenIcon as b, ListIcon as x, LoaderCircleIcon as S } from "lucide-react";
31
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js
32
+ var C = "bills@business-banking.app", w = {
33
+ [c.Drafts]: /* @__PURE__ */ g(b, {
34
+ className: "ttw:size-4",
35
+ "aria-hidden": !0
36
+ }),
37
+ [c.Pending]: /* @__PURE__ */ g(S, {
38
+ className: "ttw:size-4",
39
+ "aria-hidden": !0
40
+ }),
41
+ [c.Scheduled]: /* @__PURE__ */ g(v, {
42
+ className: "ttw:size-4",
43
+ "aria-hidden": !0
44
+ }),
45
+ [c.Paid]: /* @__PURE__ */ g(y, {
46
+ className: "ttw:size-4",
47
+ "aria-hidden": !0
48
+ }),
49
+ [c.All]: /* @__PURE__ */ g(x, {
50
+ className: "ttw:size-4",
51
+ "aria-hidden": !0
52
+ })
53
+ };
54
+ function T({ labels: c, onEnqueueFiles: v, openPayableId: y, onOpenPayableHandled: b, poweredByBankName: x, duplicateBills: S }) {
55
+ let T = m(() => ({
56
+ ...l,
57
+ ...c,
58
+ queues: {
59
+ ...l.queues,
60
+ ...c?.queues
61
+ },
62
+ filters: {
63
+ ...l.filters,
64
+ ...c?.filters,
65
+ presets: {
66
+ ...l.filters.presets,
67
+ ...c?.filters?.presets
68
+ },
69
+ statuses: {
70
+ ...l.filters.statuses,
71
+ ...c?.filters?.statuses
72
+ },
73
+ dateFieldNames: {
74
+ ...l.filters.dateFieldNames,
75
+ ...c?.filters?.dateFieldNames
76
+ }
77
+ },
78
+ filterBar: {
79
+ ...l.filterBar,
80
+ ...c?.filterBar
81
+ },
82
+ queueEmptyStates: s.reduce((e, t) => ({
83
+ ...e,
84
+ [t]: {
85
+ ...l.queueEmptyStates[t],
86
+ ...c?.queueEmptyStates?.[t]
87
+ }
88
+ }), {})
89
+ }), [c]), [ae, E] = h(!1), [D, O] = h(), [k, A] = h(!1), [j, M] = h(), [N, P] = h(!1), [F, I] = h(!1), [L, R] = h(!1), { initResponse: z } = r(), B = ee(), V = t(z?.scopes, [n.PayableReadOrg]), H = t(z?.scopes, [n.PayableWriteOrg]), U = !z || V, W = !z || H, G = f((e, t) => {
90
+ if (t && W) {
91
+ O(e), A(!0);
92
+ return;
93
+ }
94
+ M(e), P(!0);
95
+ }, [W]), K = m(() => (S ?? []).filter((e) => e.isPossibleDuplicate).map((e) => e.id), [S]), q = t(z?.scopes, [n.CounterpartReadOrg]), J = u({
96
+ enabled: U,
97
+ canReadVendors: q,
98
+ isVendorFilterPaused: B,
99
+ filterLabels: T.filters,
100
+ onOpenBill: G,
101
+ duplicateBillIds: K,
102
+ duplicateBadgeLabel: T.duplicateBadge,
103
+ attachmentLabel: T.attachmentIndicator
104
+ }), Y = (e) => !!(e && K.includes(e)), X = K.length, oe = X === 0 ? void 0 : X === 1 ? T.duplicateWarningOne : T.duplicateWarningMany(X), se = m(() => s.map((e) => ({
105
+ id: e,
106
+ label: T.queues[e],
107
+ icon: w[e]
108
+ })), [T.queues]), ce = (e) => {
109
+ R(!1), M(e), P(!0);
110
+ }, le = () => {
111
+ P(!1), I(!0);
112
+ }, ue = () => {
113
+ I(!1), P(!0);
114
+ }, de = m(() => ({
115
+ createButton: T.createButton,
116
+ addBill: { heading: T.nonEmptyHeading }
117
+ }), [T.createButton, T.nonEmptyHeading]), fe = m(() => ({
118
+ ...J.filterBarProps,
119
+ labels: T.filterBar
120
+ }), [J.filterBarProps, T.filterBar]), Z = () => {
121
+ E(!1), O(void 0), A(!0);
122
+ }, Q = (e) => {
123
+ E(!1), v?.(e);
124
+ }, $ = async () => {
125
+ await re(C) ? e.success(T.emailCopiedToast) : e.error(T.emailCopyFailedToast);
126
+ };
127
+ return p(() => {
128
+ y && (O(y), A(!0), b?.());
129
+ }, [b, y]), /* @__PURE__ */ _("div", {
130
+ "data-testid": d.root,
131
+ children: [
132
+ /* @__PURE__ */ g(ne, {
133
+ rows: J.rows,
134
+ isLoading: J.isLoading || !z,
135
+ isError: J.isError,
136
+ onRetry: J.onRetry,
137
+ sorting: J.sorting,
138
+ onSortingChange: J.onSortingChange,
139
+ pageSize: J.pageSize,
140
+ onPageSizeChange: J.onPageSizeChange,
141
+ hasNextPage: J.hasNextPage,
142
+ hasPrevPage: J.hasPrevPage,
143
+ onNextPage: J.onNextPage,
144
+ onPrevPage: J.onPrevPage,
145
+ filterTabs: se,
146
+ selectedFilterTabId: J.selectedFilterTabId,
147
+ onFilterTabChange: J.onFilterTabChange,
148
+ searchValue: J.searchValue,
149
+ onSearchChange: J.onSearchChange,
150
+ filters: fe,
151
+ visibleColumns: J.visibleColumns,
152
+ cellTestIds: ie,
153
+ isSearchActive: J.isSearchActive,
154
+ showAddPanelWhenEmpty: J.showAddPanelWhenEmpty,
155
+ emptyState: T.queueEmptyStates[J.selectedFilterTabId],
156
+ onCreateClick: W ? () => E(!0) : void 0,
157
+ onEnterManually: W ? Z : void 0,
158
+ onFilesSelected: W ? Q : void 0,
159
+ maxFiles: 10,
160
+ emailAddress: C,
161
+ onCopyEmail: $,
162
+ duplicateWarning: oe,
163
+ onReviewDuplicates: () => R(!0),
164
+ labels: de
165
+ }),
166
+ L ? /* @__PURE__ */ g(o, {
167
+ open: L,
168
+ onOpenChange: R,
169
+ bills: S,
170
+ canManageDuplicates: W,
171
+ onOpenBill: ce
172
+ }) : null,
173
+ W ? /* @__PURE__ */ g(te, {
174
+ open: ae,
175
+ onOpenChange: E,
176
+ onFilesSelected: Q,
177
+ maxFiles: 10,
178
+ onEnterManually: Z,
179
+ emailAddress: C,
180
+ onCopyEmail: $,
181
+ labels: { heading: J.hasAnyBills ? T.nonEmptyHeading : T.emptyHeading }
182
+ }) : null,
183
+ k ? /* @__PURE__ */ g(i, {
184
+ open: k,
185
+ onOpenChange: A,
186
+ payableId: D,
187
+ isPossibleDuplicate: Y(D)
188
+ }) : null,
189
+ N ? /* @__PURE__ */ g(a, {
190
+ open: N,
191
+ onOpenChange: P,
192
+ payableId: j,
193
+ onClose: () => P(!1),
194
+ onExpand: le,
195
+ isPossibleDuplicate: Y(j),
196
+ testId: d.detailsSheet,
197
+ poweredByBankName: x
198
+ }) : null,
199
+ F ? /* @__PURE__ */ g(i, {
200
+ open: F,
201
+ onOpenChange: I,
202
+ payableId: j,
203
+ readOnly: !0,
204
+ onCollapse: ue,
205
+ poweredByBankName: x,
206
+ isPossibleDuplicate: Y(j)
207
+ }) : null
208
+ ]
209
+ });
210
+ }
211
+ //#endregion
212
+ export { T as BillsTab, T as default };
@@ -1,8 +1,4 @@
1
- //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js
2
- var e = {
3
- bills: "Bills",
4
- vendors: "Vendors",
5
- settings: "Settings"
6
- };
7
- //#endregion
8
- export { e as DEFAULT_TABS_LABELS };
1
+ import "./index62.js";
2
+ import "./index64.js";
3
+ import "./index70.js";
4
+ import "./index71.js";
@@ -1,115 +1,8 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { hasAnyScope as e } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
6
- import { Scope as t } from "../../../shared/data-access/dist/lib/scopes.js";
7
- import "../../../shared/data-access/dist/index.js";
8
- import { EmbeddedToaster as n } from "../../../shared/ui/dist/lib/EmbeddedToaster.js";
9
- import "../../../shared/ui/dist/index.js";
10
- import { useAnalyticsTrack as r } from "../../../shared/feature/dist/lib/analytics/hooks.js";
11
- import { WidgetProvider as i } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
12
- import { useWidgetConfig as a } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
13
- import "../../../shared/feature/dist/index.js";
14
- import { BillPayWidgetUi as o } from "../../ui/dist/index47.js";
15
- import { BillUploadStatusTray as s } from "../../ui/dist/index70.js";
16
- import "../../ui/dist/index.js";
17
- import { ApprovalPoliciesSettings as c } from "../../../shared/approval-policy/feature/dist/lib/ApprovalPoliciesSettings.js";
18
- import "../../../shared/approval-policy/feature/dist/index.js";
19
- import { useBillUploadQueue as l } from "./index55.js";
20
- import "./index56.js";
21
- import { billsTabTestIds as u } from "./index64.js";
22
- import { BillsTab as d } from "./index70.js";
23
- import "./index71.js";
24
- import { BillPayWidgetAnalyticsEvent as f, WIDGET_NAME as p } from "./index50.js";
25
- import { DEFAULT_TABS_LABELS as m } from "./index72.js";
26
- import { CounterpartsWidget as h } from "../../../counterparts-widget/feature/dist/index8.js";
27
- import "../../../counterparts-widget/feature/dist/index.js";
28
- import { useCallback as g, useEffect as _, useState as v } from "react";
29
- import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
30
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js
31
- var S = {
32
- Bills: "bills",
33
- Vendors: "vendors",
34
- Settings: "settings"
35
- }, C = [
36
- S.Bills,
37
- S.Vendors,
38
- S.Settings
39
- ];
40
- function w({ labels: i, tabsLabels: p, approvalPolicyLabels: w, approvalPolicyComponentLabels: T, vendorLabels: E, poweredByBankName: D }) {
41
- let O = r();
42
- _(() => {
43
- O(f.Mounted);
44
- }, [O]);
45
- let k = {
46
- ...m,
47
- ...p
48
- }, { initResponse: A } = a(), j = e(A?.scopes, [t.ApprovalPolicyWriteOrg]), M = !A || j, [N, P] = v(S.Bills), [F, I] = v(), L = g((e) => {
49
- P(S.Bills), I(e);
50
- }, []), R = l({ onOpenBill: L }), z = [{
51
- id: S.Bills,
52
- label: k.bills,
53
- content: /* @__PURE__ */ b(d, {
54
- onEnqueueFiles: R.enqueue,
55
- openPayableId: F,
56
- onOpenPayableHandled: () => I(void 0),
57
- poweredByBankName: D
58
- })
59
- }, {
60
- id: S.Vendors,
61
- label: k.vendors,
62
- content: /* @__PURE__ */ b(h, {
63
- ...E,
64
- counterpartType: "vendor",
65
- onViewAllDocuments: () => P(S.Bills)
66
- })
67
- }];
68
- M && z.push({
69
- id: S.Settings,
70
- label: k.settings,
71
- content: /* @__PURE__ */ b(c, {
72
- labels: w,
73
- componentLabels: T
74
- })
75
- });
76
- let B = z.some((e) => e.id === N) ? N : C.find((e) => z.some((t) => t.id === e)) ?? z[0]?.id ?? "";
77
- return /* @__PURE__ */ x(y, { children: [
78
- /* @__PURE__ */ b(n, {}),
79
- /* @__PURE__ */ b(o, {
80
- labels: i,
81
- tabs: z,
82
- selectedTabId: B,
83
- onTabChange: P
84
- }),
85
- R.isVisible ? /* @__PURE__ */ b(s, {
86
- sections: R.sections,
87
- summaryLabel: R.summaryLabel,
88
- collapsed: R.collapsed,
89
- onToggleCollapsed: R.onToggleCollapsed,
90
- onClose: R.onClose,
91
- testId: u.uploadTray
92
- }) : null
93
- ] });
94
- }
95
- function T({ baseUrl: e, widgetToken: t, organizationId: n, configClient: r, gatewayRouting: a, linkComponent: o, implementation: s, uiFramework: c, errorFallback: l, onError: u, analytics: d, disclosuresAcceptance: f, providerLabels: m, ...h }) {
96
- return /* @__PURE__ */ b(i, {
97
- widgetName: p,
98
- baseUrl: e,
99
- widgetToken: t,
100
- organizationId: n,
101
- configClient: r,
102
- gatewayRouting: a,
103
- linkComponent: o,
104
- implementation: s,
105
- uiFramework: c,
106
- errorFallback: l,
107
- onError: u,
108
- analytics: d,
109
- disclosuresAcceptance: f,
110
- providerLabels: m,
111
- children: /* @__PURE__ */ b(w, { ...h })
112
- });
113
- }
2
+ var e = {
3
+ bills: "Bills",
4
+ vendors: "Vendors",
5
+ settings: "Settings"
6
+ };
114
7
  //#endregion
115
- export { T as BillPayWidgetNative, T as default };
8
+ export { e as DEFAULT_TABS_LABELS };