@tesouro/embedded-components-react 0.5.45 → 0.5.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 (79) hide show
  1. package/README.md +7 -5
  2. package/dist/index.d.ts +54 -24
  3. package/dist/index.js +1 -1
  4. package/dist/lib/BankAccountOnboardingWidget.d.ts +15 -1
  5. package/dist/lib/BillPayWidget.d.ts +16 -1
  6. package/dist/lib/BillPayWidget.js +1 -1
  7. package/dist/lib/SettingsWidget.d.ts +1 -0
  8. package/dist/lib/WidgetSuite.d.ts +1 -0
  9. package/dist/lib/monite-sdk.d.ts +2 -0
  10. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/data-access/dist/index10.js +12 -8
  11. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index22.js +233 -211
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +8 -8
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +3 -3
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +7 -49
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +46 -36
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +34 -184
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +163 -75
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +75 -21
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +22 -93
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +88 -317
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +322 -12
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +12 -59
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +57 -50
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +52 -208
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +215 -35
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +35 -234
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +240 -21
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +21 -532
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +536 -4
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +4 -42
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +38 -230
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +234 -3
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +3 -4
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +2 -44
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +46 -1
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +1 -8
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +6 -11
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +11 -127
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js +129 -3
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +3 -127
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +124 -8
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js +8 -7
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +8 -46
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js +44 -18
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index77.js +20 -28
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index78.js +27 -82
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index79.js +83 -47
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index80.js +47 -250
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index81.js +241 -122
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index82.js +126 -206
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index83.js +219 -3
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index84.js +4 -8
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index85.js +5 -113
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index86.js +100 -1
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index87.js +0 -24
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index88.js +27 -0
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +28 -28
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index52.js +1 -1
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index53.js +2 -2
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index64.js +1 -0
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index82.js +163 -151
  62. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index6.js +77 -77
  63. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/ExpenseApprovalPoliciesWidget/lib/ExpenseApprovalsPage.js +17 -10
  64. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/ui/dist/lib/ExpenseApprovalPoliciesWidget/lib/labels.js +2 -1
  65. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index9.js +1 -1
  66. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index382.js +10 -4
  67. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index394.js +1 -1
  68. package/dist/libs/tesouro-embedded-components-react/monite-sdk/dist/index616.js +23 -23
  69. package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/index3.js +1 -0
  70. package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/index6.js +13 -4
  71. package/dist/libs/tesouro-embedded-components-react/settings-widget/help/ui/shadcn/dist/index3.js +27 -29
  72. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/ApprovalPoliciesSettings.js +29 -28
  73. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index11.js +13 -13
  74. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/index.js +4 -4
  75. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  76. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/user/useOrganizationUserNames.js +13 -1
  77. package/dist/libs/tesouro-embedded-components-react/shared/util/dist/lib/auditHistory/buildPayableAuditHistory.js +137 -0
  78. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index8.js +1 -1
  79. package/package.json +1 -1
@@ -2,213 +2,133 @@
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 ee, useWidgetInitStaleForToken as r } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
11
- import "../../../shared/feature/dist/index.js";
12
- import { useDuplicateBillsCount as i } from "./index10.js";
13
- import { AddBillDialog as a } from "../../ui/dist/index10.js";
14
- import { BillsScreen as o } from "../../ui/dist/index82.js";
15
- import "../../ui/dist/index.js";
16
- import { DuplicateBillsContainer as te } from "./index12.js";
17
- import "./index14.js";
18
- import { BillCreateDialog as s } from "./index60.js";
19
- import "./index61.js";
20
- import { BillDetailsContainer as ne } from "./index63.js";
21
- import "./index64.js";
22
- import "./index70.js";
23
- import "./index71.js";
24
- import { BILL_QUEUE_ORDER as c, BillQueue as l } from "./index72.js";
25
- import { BILLS_TAB_LABELS_EN as u } from "./index75.js";
26
- import { useBillsTable as d } from "./index81.js";
27
- import { copyTextToClipboard as f } from "./index73.js";
28
- import { resolveDuplicateWarning as p } from "./index74.js";
29
- import { billsTabTestIds as m, billsTableCellTestIds as re } from "./index76.js";
30
- import { useCallback as ie, useEffect as ae, useMemo as h, useState as g } from "react";
31
- import { jsx as _, jsxs as v } from "react/jsx-runtime";
32
- import { CalendarClockIcon as y, CheckIcon as b, FilePenIcon as x, ListIcon as S, LoaderCircleIcon as C } from "lucide-react";
5
+ import { useEmbedApi as e } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
6
+ import { formatCalendarDate as t } from "../../../shared/util/dist/lib/formatCalendarDate.js";
7
+ import { formatMoneyExact as n } from "../../../shared/util/dist/lib/formatMoneyExact.js";
8
+ import { hasSuspectedPayableDuplicate as ee } from "../../data-access/dist/index7.js";
9
+ import { usePayablesQuery as r, usePayablesTotalCountQuery as i } from "../../data-access/dist/index17.js";
10
+ import "../../data-access/dist/index.js";
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";
33
17
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index82.js
34
- var w = "bills@business-banking.app", T = {
35
- [l.Drafts]: /* @__PURE__ */ _(x, {
36
- className: "ttw:size-4",
37
- "aria-hidden": !0
38
- }),
39
- [l.Pending]: /* @__PURE__ */ _(C, {
40
- className: "ttw:size-4",
41
- "aria-hidden": !0
42
- }),
43
- [l.Scheduled]: /* @__PURE__ */ _(y, {
44
- className: "ttw:size-4",
45
- "aria-hidden": !0
46
- }),
47
- [l.Paid]: /* @__PURE__ */ _(b, {
48
- className: "ttw:size-4",
49
- "aria-hidden": !0
50
- }),
51
- [l.All]: /* @__PURE__ */ _(S, {
52
- className: "ttw:size-4",
53
- "aria-hidden": !0
54
- })
55
- };
56
- function E({ labels: l, onEnqueueFiles: y, openPayableId: b, onOpenPayableHandled: x, poweredByBankName: S }) {
57
- let C = h(() => ({
58
- ...u,
59
- ...l,
60
- queues: {
61
- ...u.queues,
62
- ...l?.queues
63
- },
64
- filters: {
65
- ...u.filters,
66
- ...l?.filters,
67
- presets: {
68
- ...u.filters.presets,
69
- ...l?.filters?.presets
70
- },
71
- statuses: {
72
- ...u.filters.statuses,
73
- ...l?.filters?.statuses
74
- },
75
- dateFieldNames: {
76
- ...u.filters.dateFieldNames,
77
- ...l?.filters?.dateFieldNames
78
- }
79
- },
80
- filterBar: {
81
- ...u.filterBar,
82
- ...l?.filterBar
83
- },
84
- queueEmptyStates: c.reduce((e, t) => ({
85
- ...e,
86
- [t]: {
87
- ...u.queueEmptyStates[t],
88
- ...l?.queueEmptyStates?.[t]
89
- }
90
- }), {})
91
- }), [l]), [E, D] = g(!1), [oe, O] = g(), [k, A] = g(!1), [j, M] = g(), [N, P] = g(!1), [F, I] = g(!1), [L, R] = g(!1), { initResponse: z } = ee(), B = r(), V = t(z?.scopes, [n.PayableReadOrg]), H = t(z?.scopes, [n.PayableWriteOrg]), U = !z || V, W = !z || H, G = ie((e, t) => {
92
- if (t && W) {
93
- O(e), A(!0);
94
- return;
95
- }
96
- M(e), P(!0);
97
- }, [W]), K = t(z?.scopes, [n.CounterpartReadOrg]), q = d({
98
- enabled: U,
99
- canReadVendors: K,
100
- isVendorFilterPaused: B,
101
- filterLabels: C.filters,
102
- onOpenBill: G,
103
- duplicateRowNote: C.duplicateRowNote,
104
- attachmentLabel: C.attachmentIndicator
105
- }), J = i({ enabled: U }), se = p(J, C), ce = h(() => c.map((e) => ({
106
- id: e,
107
- label: C.queues[e],
108
- icon: T[e]
109
- })), [C.queues]), le = (e) => {
110
- R(!1), M(e), P(!0);
111
- }, ue = () => {
112
- P(!1), I(!0);
113
- }, Y = () => {
114
- I(!1), P(!0);
115
- }, X = () => {
116
- P(!1), I(!1), O(j), A(!0);
117
- }, de = h(() => ({
118
- createButton: C.createButton,
119
- addBill: { heading: C.nonEmptyHeading }
120
- }), [C.createButton, C.nonEmptyHeading]), fe = h(() => ({
121
- ...q.filterBarProps,
122
- labels: C.filterBar
123
- }), [q.filterBarProps, C.filterBar]), Z = () => {
124
- D(!1), O(void 0), A(!0);
125
- }, Q = (e) => {
126
- D(!1), y?.(e);
127
- }, $ = async () => {
128
- await f(w) ? e.success(C.emailCopiedToast) : e.error(C.emailCopyFailedToast);
18
+ var y = 10, b = [{
19
+ id: "addedOnLabel",
20
+ desc: !0
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(() => {
25
+ let e = setTimeout(() => {
26
+ z(I), B();
27
+ }, 300);
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
45
+ }), [
46
+ V.query,
47
+ 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) => {
61
+ let r = te({
62
+ apiStatus: e.status,
63
+ dueDate: e.due_date,
64
+ 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
+ return {
67
+ rowKey: e.id,
68
+ vendorLabel: a(e),
69
+ issueDateLabel: t(e.issued_at),
70
+ dueDateLabel: t(e.due_date),
71
+ dueDateTone: r.isOverdue ? "danger" : "default",
72
+ scheduledDateLabel: t(e.scheduled_payment_date),
73
+ scheduledDateIsGap: O === o.Scheduled,
74
+ 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,
81
+ status: r.status,
82
+ statusTone: r.tone,
83
+ addedOnLabel: t(e.created_at?.slice(0, 10)),
84
+ ...ee(e) ? {
85
+ rowTone: "warning",
86
+ rowNote: E
87
+ } : {},
88
+ onOpen: () => T(e.id, ne(e.status))
89
+ };
90
+ }), [
91
+ J.data?.data,
92
+ E,
93
+ D,
94
+ T,
95
+ O
96
+ ]), ae = h((e) => {
97
+ let t = e;
98
+ k(t), j((e) => {
99
+ 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]);
109
+ 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
129
131
  };
130
- return ae(() => {
131
- b && (O(b), A(!0), x?.());
132
- }, [x, b]), /* @__PURE__ */ v("div", {
133
- "data-testid": m.root,
134
- children: [
135
- /* @__PURE__ */ _(o, {
136
- rows: q.rows,
137
- isLoading: q.isLoading || !z,
138
- isError: q.isError,
139
- onRetry: q.onRetry,
140
- sorting: q.sorting,
141
- onSortingChange: q.onSortingChange,
142
- pageSize: q.pageSize,
143
- onPageSizeChange: q.onPageSizeChange,
144
- hasNextPage: q.hasNextPage,
145
- hasPrevPage: q.hasPrevPage,
146
- onNextPage: q.onNextPage,
147
- onPrevPage: q.onPrevPage,
148
- filterTabs: ce,
149
- selectedFilterTabId: q.selectedFilterTabId,
150
- onFilterTabChange: q.onFilterTabChange,
151
- searchValue: q.searchValue,
152
- onSearchChange: q.onSearchChange,
153
- filters: fe,
154
- visibleColumns: q.visibleColumns,
155
- cellTestIds: re,
156
- isSearchActive: q.isSearchActive,
157
- showAddPanelWhenEmpty: q.showAddPanelWhenEmpty,
158
- emptyState: C.queueEmptyStates[q.selectedFilterTabId],
159
- onCreateClick: W ? () => D(!0) : void 0,
160
- onEnterManually: W ? Z : void 0,
161
- onFilesSelected: W ? Q : void 0,
162
- maxFiles: 10,
163
- emailAddress: w,
164
- onCopyEmail: $,
165
- duplicateWarning: se,
166
- onReviewDuplicates: J.isError ? void 0 : () => R(!0),
167
- labels: de
168
- }),
169
- L ? /* @__PURE__ */ _(te, {
170
- open: L,
171
- onOpenChange: R,
172
- enabled: U,
173
- canManageDuplicates: W,
174
- onOpenBill: le
175
- }) : null,
176
- W ? /* @__PURE__ */ _(a, {
177
- open: E,
178
- onOpenChange: D,
179
- onFilesSelected: Q,
180
- maxFiles: 10,
181
- onEnterManually: Z,
182
- emailAddress: w,
183
- onCopyEmail: $,
184
- labels: { heading: q.hasAnyBills ? C.nonEmptyHeading : C.emptyHeading }
185
- }) : null,
186
- k ? /* @__PURE__ */ _(s, {
187
- open: k,
188
- onOpenChange: A,
189
- payableId: oe
190
- }) : null,
191
- N ? /* @__PURE__ */ _(ne, {
192
- open: N,
193
- onOpenChange: P,
194
- payableId: j,
195
- onClose: () => P(!1),
196
- onExpand: ue,
197
- onEdit: X,
198
- testId: m.detailsSheet,
199
- poweredByBankName: S
200
- }) : null,
201
- F ? /* @__PURE__ */ _(s, {
202
- open: F,
203
- onOpenChange: I,
204
- payableId: j,
205
- readOnly: !0,
206
- onCollapse: Y,
207
- onEdit: X,
208
- poweredByBankName: S
209
- }) : null
210
- ]
211
- });
212
132
  }
213
133
  //#endregion
214
- export { E as BillsTab, E as default };
134
+ export { x as useBillsTable };
@@ -1,4 +1,220 @@
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 ee, useWidgetInitStaleForToken as r } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
11
+ import "../../../shared/feature/dist/index.js";
12
+ import { useDuplicateBillsCount as i } from "./index10.js";
13
+ import { AddBillDialog as a } from "../../ui/dist/index10.js";
14
+ import { BillsScreen as o } from "../../ui/dist/index82.js";
15
+ import "../../ui/dist/index.js";
16
+ import { DuplicateBillsContainer as te } from "./index12.js";
17
+ import "./index14.js";
18
+ import { BillCreateDialog as s } from "./index61.js";
19
+ import "./index62.js";
20
+ import { BillDetailsContainer as c } from "./index64.js";
21
+ import "./index65.js";
22
+ import "./index71.js";
1
23
  import "./index72.js";
2
- import "./index75.js";
3
- import "./index81.js";
4
- import "./index82.js";
24
+ import { BILL_QUEUE_ORDER as l, BillQueue as u } from "./index73.js";
25
+ import { BILLS_TAB_LABELS_EN as d } from "./index76.js";
26
+ import { useBillsTable as f } from "./index82.js";
27
+ import { copyTextToClipboard as p } from "./index74.js";
28
+ import { resolveDuplicateWarning as m } from "./index75.js";
29
+ import { billsTabTestIds as h, billsTableCellTestIds as ne } from "./index77.js";
30
+ import { useCallback as re, useEffect as ie, useMemo as g, useState as _ } from "react";
31
+ import { jsx as v, jsxs as y } from "react/jsx-runtime";
32
+ import { CalendarClockIcon as b, CheckIcon as x, FilePenIcon as S, ListIcon as C, LoaderCircleIcon as w } from "lucide-react";
33
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index83.js
34
+ var T = "bills@business-banking.app", E = {
35
+ [u.Drafts]: /* @__PURE__ */ v(S, {
36
+ className: "ttw:size-4",
37
+ "aria-hidden": !0
38
+ }),
39
+ [u.Pending]: /* @__PURE__ */ v(w, {
40
+ className: "ttw:size-4",
41
+ "aria-hidden": !0
42
+ }),
43
+ [u.Scheduled]: /* @__PURE__ */ v(b, {
44
+ className: "ttw:size-4",
45
+ "aria-hidden": !0
46
+ }),
47
+ [u.Paid]: /* @__PURE__ */ v(x, {
48
+ className: "ttw:size-4",
49
+ "aria-hidden": !0
50
+ }),
51
+ [u.All]: /* @__PURE__ */ v(C, {
52
+ className: "ttw:size-4",
53
+ "aria-hidden": !0
54
+ })
55
+ };
56
+ function D({ labels: u, onEnqueueFiles: b, openPayableId: x, onOpenPayableHandled: S, poweredByBankName: C, onSettingsClick: w }) {
57
+ let D = g(() => ({
58
+ ...d,
59
+ ...u,
60
+ queues: {
61
+ ...d.queues,
62
+ ...u?.queues
63
+ },
64
+ filters: {
65
+ ...d.filters,
66
+ ...u?.filters,
67
+ presets: {
68
+ ...d.filters.presets,
69
+ ...u?.filters?.presets
70
+ },
71
+ statuses: {
72
+ ...d.filters.statuses,
73
+ ...u?.filters?.statuses
74
+ },
75
+ dateFieldNames: {
76
+ ...d.filters.dateFieldNames,
77
+ ...u?.filters?.dateFieldNames
78
+ }
79
+ },
80
+ filterBar: {
81
+ ...d.filterBar,
82
+ ...u?.filterBar
83
+ },
84
+ queueEmptyStates: l.reduce((e, t) => ({
85
+ ...e,
86
+ [t]: {
87
+ ...d.queueEmptyStates[t],
88
+ ...u?.queueEmptyStates?.[t]
89
+ }
90
+ }), {})
91
+ }), [u]), [ae, O] = _(!1), [oe, k] = _(), [A, j] = _(!1), [M, N] = _(), [P, F] = _(!1), [I, L] = _(!1), [R, z] = _(!1), { initResponse: B } = ee(), V = r(), H = t(B?.scopes, [n.PayableReadOrg]), U = t(B?.scopes, [n.PayableWriteOrg]), W = !B || H, G = !B || U, K = re((e, t) => {
92
+ if (t && G) {
93
+ k(e), j(!0);
94
+ return;
95
+ }
96
+ N(e), F(!0);
97
+ }, [G]), se = t(B?.scopes, [n.CounterpartReadOrg]), q = f({
98
+ enabled: W,
99
+ canReadVendors: se,
100
+ isVendorFilterPaused: V,
101
+ filterLabels: D.filters,
102
+ onOpenBill: K,
103
+ duplicateRowNote: D.duplicateRowNote,
104
+ attachmentLabel: D.attachmentIndicator
105
+ }), J = i({ enabled: W }), ce = m(J, D), le = g(() => l.map((e) => ({
106
+ id: e,
107
+ label: D.queues[e],
108
+ icon: E[e]
109
+ })), [D.queues]), ue = (e) => {
110
+ z(!1), N(e), F(!0);
111
+ }, de = () => {
112
+ F(!1), L(!0);
113
+ }, fe = () => {
114
+ L(!1), F(!0);
115
+ }, Y = () => {
116
+ F(!1), L(!1), k(M), j(!0);
117
+ }, X = g(() => ({
118
+ createButton: D.createButton,
119
+ settingsButton: D.settingsButton,
120
+ addBill: { heading: D.nonEmptyHeading }
121
+ }), [
122
+ D.createButton,
123
+ D.settingsButton,
124
+ D.nonEmptyHeading
125
+ ]), pe = g(() => ({
126
+ ...q.filterBarProps,
127
+ labels: D.filterBar
128
+ }), [q.filterBarProps, D.filterBar]), Z = () => {
129
+ O(!1), k(void 0), j(!0);
130
+ }, Q = (e) => {
131
+ O(!1), b?.(e);
132
+ }, $ = async () => {
133
+ await p(T) ? e.success(D.emailCopiedToast) : e.error(D.emailCopyFailedToast);
134
+ };
135
+ return ie(() => {
136
+ x && (k(x), j(!0), S?.());
137
+ }, [S, x]), /* @__PURE__ */ y("div", {
138
+ "data-testid": h.root,
139
+ children: [
140
+ /* @__PURE__ */ v(o, {
141
+ rows: q.rows,
142
+ isLoading: q.isLoading || !B,
143
+ isError: q.isError,
144
+ onRetry: q.onRetry,
145
+ sorting: q.sorting,
146
+ onSortingChange: q.onSortingChange,
147
+ pageSize: q.pageSize,
148
+ onPageSizeChange: q.onPageSizeChange,
149
+ hasNextPage: q.hasNextPage,
150
+ hasPrevPage: q.hasPrevPage,
151
+ onNextPage: q.onNextPage,
152
+ onPrevPage: q.onPrevPage,
153
+ filterTabs: le,
154
+ selectedFilterTabId: q.selectedFilterTabId,
155
+ onFilterTabChange: q.onFilterTabChange,
156
+ searchValue: q.searchValue,
157
+ onSearchChange: q.onSearchChange,
158
+ filters: pe,
159
+ visibleColumns: q.visibleColumns,
160
+ cellTestIds: ne,
161
+ isSearchActive: q.isSearchActive,
162
+ showAddPanelWhenEmpty: q.showAddPanelWhenEmpty,
163
+ emptyState: D.queueEmptyStates[q.selectedFilterTabId],
164
+ onCreateClick: G ? () => O(!0) : void 0,
165
+ onSettingsClick: w,
166
+ onEnterManually: G ? Z : void 0,
167
+ onFilesSelected: G ? Q : void 0,
168
+ maxFiles: 10,
169
+ emailAddress: T,
170
+ onCopyEmail: $,
171
+ duplicateWarning: ce,
172
+ onReviewDuplicates: J.isError ? void 0 : () => z(!0),
173
+ labels: X
174
+ }),
175
+ R ? /* @__PURE__ */ v(te, {
176
+ open: R,
177
+ onOpenChange: z,
178
+ enabled: W,
179
+ canManageDuplicates: G,
180
+ onOpenBill: ue
181
+ }) : null,
182
+ G ? /* @__PURE__ */ v(a, {
183
+ open: ae,
184
+ onOpenChange: O,
185
+ onFilesSelected: Q,
186
+ maxFiles: 10,
187
+ onEnterManually: Z,
188
+ emailAddress: T,
189
+ onCopyEmail: $,
190
+ labels: { heading: q.hasAnyBills ? D.nonEmptyHeading : D.emptyHeading }
191
+ }) : null,
192
+ A ? /* @__PURE__ */ v(s, {
193
+ open: A,
194
+ onOpenChange: j,
195
+ payableId: oe
196
+ }) : null,
197
+ P ? /* @__PURE__ */ v(c, {
198
+ open: P,
199
+ onOpenChange: F,
200
+ payableId: M,
201
+ onClose: () => F(!1),
202
+ onExpand: de,
203
+ onEdit: Y,
204
+ testId: h.detailsSheet,
205
+ poweredByBankName: C
206
+ }) : null,
207
+ I ? /* @__PURE__ */ v(s, {
208
+ open: I,
209
+ onOpenChange: L,
210
+ payableId: M,
211
+ readOnly: !0,
212
+ onCollapse: fe,
213
+ onEdit: Y,
214
+ poweredByBankName: C
215
+ }) : null
216
+ ]
217
+ });
218
+ }
219
+ //#endregion
220
+ export { D as BillsTab, D as default };
@@ -1,8 +1,4 @@
1
- //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index84.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 "./index73.js";
2
+ import "./index76.js";
3
+ import "./index82.js";
4
+ import "./index83.js";