@tesouro/embedded-components-react 0.2.266 → 0.2.269

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 (97) hide show
  1. package/README.md +15 -12
  2. package/dist/experimental/WidgetSuite.d.ts +25 -1
  3. package/dist/experimental/index.d.ts +25 -1
  4. package/dist/index.css +45 -9
  5. package/dist/index.d.ts +46 -22
  6. package/dist/index.js +1 -1
  7. package/dist/lib/AcceptDisclosuresWidget.d.ts +25 -1
  8. package/dist/lib/BalancesWidget.d.ts +24 -0
  9. package/dist/lib/BankAccountOnboardingWidget.d.ts +25 -1
  10. package/dist/lib/BankAccountsWidget.d.ts +25 -1
  11. package/dist/lib/BillPayWidget.d.ts +24 -0
  12. package/dist/lib/BillPayWidget.js +1 -1
  13. package/dist/lib/CardDetailsWidget.d.ts +25 -1
  14. package/dist/lib/CardsWidget.d.ts +25 -1
  15. package/dist/lib/ChartOfAccountsWidget.d.ts +25 -1
  16. package/dist/lib/CounterpartsWidget.d.ts +25 -1
  17. package/dist/lib/CreateCardWidget.d.ts +25 -1
  18. package/dist/lib/ExpenseApprovalPoliciesWidget.d.ts +25 -1
  19. package/dist/lib/ExpenseManagementWidget.d.ts +25 -1
  20. package/dist/lib/ExpenseRequirementsWidget.d.ts +25 -1
  21. package/dist/lib/HelpWidget.d.ts +25 -1
  22. package/dist/lib/InsightsWidget.d.ts +24 -0
  23. package/dist/lib/InvoicingWidget.d.ts +25 -1
  24. package/dist/lib/LinkedAccountsWidget.d.ts +25 -1
  25. package/dist/lib/ProductsWidget.d.ts +25 -1
  26. package/dist/lib/ProfileWidget.d.ts +25 -1
  27. package/dist/lib/ReceiptMatchWidget.d.ts +25 -1
  28. package/dist/lib/ReceivablesWidget.d.ts +25 -1
  29. package/dist/lib/SettingsWidget.d.ts +25 -1
  30. package/dist/lib/TagsWidget.d.ts +25 -1
  31. package/dist/lib/TeamWidget.d.ts +25 -1
  32. package/dist/lib/TransfersWidget.d.ts +24 -0
  33. package/dist/lib/WidgetProvider.d.ts +25 -1
  34. package/dist/lib/WidgetProviderPublic.d.ts +24 -0
  35. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/index4.js +9 -8
  36. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/index17.js +122 -121
  37. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/index8.js +9 -8
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +6 -6
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +99 -7
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js +7 -97
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +99 -4
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js +4 -4
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +2 -41
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +44 -1
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js +1 -50
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js +48 -6
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js +9 -5
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +8 -91
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index2.js +6 -2
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +7 -3
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +100 -6
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +3 -9
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +6 -83
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +9 -3
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +83 -6
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +2 -111
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +8 -1
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +104 -16
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +1 -0
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +25 -0
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +37 -27
  62. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +15 -116
  63. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +126 -31
  64. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +32 -69
  65. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index12.js +0 -3
  66. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index13.js +34 -69
  67. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index15.js +4 -0
  68. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index16.js +261 -181
  69. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index28.js +32 -33
  70. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index7.js +2 -2
  71. package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/index6.js +9 -8
  72. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/index8.js +9 -8
  73. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/index8.js +9 -8
  74. package/dist/libs/tesouro-embedded-components-react/create-card-widget/feature/dist/index7.js +94 -93
  75. package/dist/libs/tesouro-embedded-components-react/expense-approval-policies-widget/feature/dist/lib/ExpenseApprovalPoliciesWidgetFeature.js +7 -6
  76. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index3.js +9 -8
  77. package/dist/libs/tesouro-embedded-components-react/expense-receipt-match-widget/feature/dist/lib/ReceiptMatchWidget.js +12 -11
  78. package/dist/libs/tesouro-embedded-components-react/expense-requirements-widget/feature/dist/lib/ExpenseRequirementsWidget.js +7 -6
  79. package/dist/libs/tesouro-embedded-components-react/gl-code-table-widget/feature/dist/index8.js +9 -8
  80. package/dist/libs/tesouro-embedded-components-react/help-widget/feature/dist/index3.js +9 -8
  81. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index12.js +9 -8
  82. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index3.js +10 -9
  83. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/index9.js +9 -8
  84. package/dist/libs/tesouro-embedded-components-react/products-widget/feature/dist/index8.js +9 -8
  85. package/dist/libs/tesouro-embedded-components-react/profile-widget/feature/dist/index4.js +9 -8
  86. package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/index6.js +10 -9
  87. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +22 -21
  88. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/widgetGatewayHosts.js +14 -0
  89. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/RootWidgetProvider.js +76 -67
  90. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/WidgetProvider/WidgetProvider.js +107 -101
  91. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  92. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/client.js +12 -4
  93. package/dist/libs/tesouro-embedded-components-react/tags-widget/feature/dist/index11.js +9 -8
  94. package/dist/libs/tesouro-embedded-components-react/team-widget/feature/dist/index17.js +106 -105
  95. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index5.js +1 -1
  96. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index6.js +9 -8
  97. package/package.json +1 -1
@@ -1,4 +1,99 @@
1
- import "./index2.js";
2
- import "./index7.js";
3
- import "./index9.js";
4
- import "./index11.js";
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { useLedgerAccountsQuery as e } from "../../../shared/data-access/dist/lib/reference-data/useLedgerAccountsQuery.js";
6
+ import "../../../shared/data-access/dist/index.js";
7
+ import { BILL_CREATE_SCREEN_LABELS_EN as t } from "./index2.js";
8
+ import { useAllPayableLineItemsQuery as n } from "../../data-access/dist/index6.js";
9
+ import { usePayableQuery as r } from "../../data-access/dist/index10.js";
10
+ import "../../data-access/dist/index.js";
11
+ import { useBillCreateController as i } from "./index8.js";
12
+ import { useBillForm as a } from "./index10.js";
13
+ import { BillCreateScreen as o } from "../../ui/dist/index28.js";
14
+ import { ExtractionNotice as s } from "../../ui/dist/index45.js";
15
+ import "../../ui/dist/index.js";
16
+ import { SourceDocumentContainer as c } from "./index3.js";
17
+ import { useVendorSectionProps as l } from "./index5.js";
18
+ import { billCreateTestIds as u } from "./index11.js";
19
+ import { useCallback as d, useEffect as f, useMemo as p, useState as m } from "react";
20
+ import { jsx as h } from "react/jsx-runtime";
21
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js
22
+ function g({ open: g, onOpenChange: _, payableId: v, copy: y }) {
23
+ let b = {
24
+ ...t,
25
+ ...y
26
+ }, [x, S] = m(), [C, w] = m(!1), [T, E] = m(!1), [D, O] = m(), k = v ?? D, A = r(k, { pollWhileOcrProcessing: !0 }), j = n(k), M = e(), N = A.data, P = a({
27
+ payable: N,
28
+ lineItems: j.lineItems
29
+ }), F = N?.counterpart_id;
30
+ f(() => {
31
+ C || F && (S(F), w(!0));
32
+ }, [C, F]);
33
+ let I = d((e) => {
34
+ w(!0), S(e);
35
+ }, []), L = i({
36
+ payableId: v,
37
+ form: P,
38
+ counterpartId: x,
39
+ onPayableCreated: O,
40
+ onSaved: O,
41
+ onDraftSaved: () => _(!1),
42
+ onFinalized: () => _(!1)
43
+ }), R = p(() => (M.data?.data ?? []).map((e) => ({
44
+ value: e.id,
45
+ label: [e.nominal_code, e.name].filter(Boolean).join(" — ")
46
+ })), [M.data]), z = N?.source_of_payable_data === "ocr", B = N?.counterpart_raw_data?.name, V = () => {
47
+ P.isDirty && !window.confirm(b.discardConfirm) || _(!1);
48
+ }, H = l({
49
+ payableId: k,
50
+ counterpartId: x,
51
+ payableCounterpartId: F,
52
+ onCounterpartChange: I
53
+ });
54
+ return /* @__PURE__ */ h(o, {
55
+ open: g,
56
+ onOpenChange: (e) => e ? _(!0) : V(),
57
+ title: z && B ? b.extractedTitle(B) : b.newTitle,
58
+ notice: z && !T ? /* @__PURE__ */ h(s, { onDismiss: () => E(!0) }) : void 0,
59
+ vendor: {
60
+ ...H,
61
+ testId: u.vendorSection
62
+ },
63
+ values: P.values,
64
+ errors: P.errors,
65
+ onChange: P.onChange,
66
+ lineItems: {
67
+ items: P.lineItemRows,
68
+ glCodeOptions: R,
69
+ discount: P.discount,
70
+ onDiscountChange: P.onDiscountChange,
71
+ tax: P.tax,
72
+ onTaxChange: P.onTaxChange,
73
+ total: P.total,
74
+ onTotalChange: P.onTotalChange,
75
+ onAddLineItem: P.onAddLineItem,
76
+ errors: P.lineItemErrors,
77
+ testId: u.lineItems
78
+ },
79
+ documentPanel: /* @__PURE__ */ h(c, {
80
+ payableId: k,
81
+ isDocumentPending: !!k && !N?.file && (A.isLoading || N?.ocr_status === "processing"),
82
+ file: N?.file ? {
83
+ id: N.file.id,
84
+ name: N.file.name,
85
+ url: N.file.url,
86
+ mimetype: N.file.mimetype
87
+ } : void 0
88
+ }),
89
+ isLineItemsLoading: j.isResolving,
90
+ isSavingDraft: L.isSavingDraft,
91
+ isFinalizing: L.isFinalizing,
92
+ onCancel: V,
93
+ onSaveDraft: L.saveDraft,
94
+ onFinalize: L.finalize,
95
+ testId: u.dialog
96
+ });
97
+ }
98
+ //#endregion
99
+ export { g as BillCreateDialog, g as default };
@@ -1,4 +1,4 @@
1
- //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js
2
- var e = { Mounted: "bill_pay_widget.mounted" }, t = "bill_pay_widget";
3
- //#endregion
4
- export { e as BillPayWidgetAnalyticsEvent, t as WIDGET_NAME };
1
+ import "./index2.js";
2
+ import "./index8.js";
3
+ import "./index10.js";
4
+ import "./index12.js";
@@ -1,43 +1,4 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { useAnalyticsTrack as e } from "../../../shared/feature/dist/lib/analytics/hooks.js";
6
- import "../../../shared/feature/dist/index.js";
7
- import { BillPayWidgetAnalyticsEvent as t, WIDGET_NAME as n } from "./index13.js";
8
- import { Payables as r } from "../../../monite-sdk/dist/index431.js";
9
- import "../../../monite-sdk/dist/index.js";
10
- import { MoniteRegionProvider as i } from "../../../shared/monite-wrapper/feature/dist/lib/MoniteRegionProvider.js";
11
- import "../../../shared/monite-wrapper/feature/dist/index.js";
12
- import { useEffect as a } from "react";
13
- import { jsx as o } from "react/jsx-runtime";
14
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js
15
- var s = (e) => e;
16
- function c(n) {
17
- let i = e();
18
- return a(() => {
19
- i(t.Mounted);
20
- }, [i]), /* @__PURE__ */ o(r, { ...n });
21
- }
22
- function l({ baseUrl: e, widgetToken: t, organizationId: r, configClient: a, linkComponent: l, implementation: u, uiFramework: d, errorFallback: f, onError: p, finopsThemeColors: m, analytics: h, pageTitleComponent: g = s, ..._ }) {
23
- return /* @__PURE__ */ o(i, {
24
- widgetName: n,
25
- baseUrl: e,
26
- widgetToken: t,
27
- organizationId: r,
28
- configClient: a,
29
- linkComponent: l,
30
- implementation: u,
31
- uiFramework: d,
32
- errorFallback: f,
33
- onError: p,
34
- finopsThemeColors: m,
35
- analytics: h,
36
- children: /* @__PURE__ */ o(c, {
37
- ..._,
38
- pageTitleComponent: g
39
- })
40
- });
41
- }
2
+ var e = { Mounted: "bill_pay_widget.mounted" }, t = "bill_pay_widget";
42
3
  //#endregion
43
- export { l as BillPayWidgetMonite, l as default };
4
+ export { e as BillPayWidgetAnalyticsEvent, t as WIDGET_NAME };
@@ -1 +1,44 @@
1
- import "./index14.js";
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { useAnalyticsTrack as e } from "../../../shared/feature/dist/lib/analytics/hooks.js";
6
+ import "../../../shared/feature/dist/index.js";
7
+ import { BillPayWidgetAnalyticsEvent as t, WIDGET_NAME as n } from "./index14.js";
8
+ import { Payables as r } from "../../../monite-sdk/dist/index431.js";
9
+ import "../../../monite-sdk/dist/index.js";
10
+ import { MoniteRegionProvider as i } from "../../../shared/monite-wrapper/feature/dist/lib/MoniteRegionProvider.js";
11
+ import "../../../shared/monite-wrapper/feature/dist/index.js";
12
+ import { useEffect as a } from "react";
13
+ import { jsx as o } from "react/jsx-runtime";
14
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js
15
+ var s = (e) => e;
16
+ function c(n) {
17
+ let i = e();
18
+ return a(() => {
19
+ i(t.Mounted);
20
+ }, [i]), /* @__PURE__ */ o(r, { ...n });
21
+ }
22
+ function l({ baseUrl: e, widgetToken: t, organizationId: r, configClient: a, gatewayRouting: l, linkComponent: u, implementation: d, uiFramework: f, errorFallback: p, onError: m, finopsThemeColors: h, analytics: g, pageTitleComponent: _ = s, ...v }) {
23
+ return /* @__PURE__ */ o(i, {
24
+ widgetName: n,
25
+ baseUrl: e,
26
+ widgetToken: t,
27
+ organizationId: r,
28
+ configClient: a,
29
+ gatewayRouting: l,
30
+ linkComponent: u,
31
+ implementation: d,
32
+ uiFramework: f,
33
+ errorFallback: p,
34
+ onError: m,
35
+ finopsThemeColors: h,
36
+ analytics: g,
37
+ children: /* @__PURE__ */ o(c, {
38
+ ...v,
39
+ pageTitleComponent: _
40
+ })
41
+ });
42
+ }
43
+ //#endregion
44
+ export { l as BillPayWidgetMonite, l as default };
@@ -1,50 +1 @@
1
- //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index16.js
2
- var e = /* @__PURE__ */ new Set([
3
- "new",
4
- "approve_in_progress",
5
- "waiting_to_be_paid",
6
- "partially_paid"
7
- ]);
8
- function t(e, t) {
9
- let n = /* @__PURE__ */ new Date(`${e.slice(0, 10)}T00:00:00Z`), r = Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate());
10
- return n.getTime() < r;
11
- }
12
- function n(n, r, i = /* @__PURE__ */ new Date()) {
13
- if (e.has(n) && r && t(r, i)) return {
14
- status: "overdue",
15
- tone: "danger"
16
- };
17
- switch (n) {
18
- case "draft": return {
19
- status: "draft",
20
- tone: "neutral"
21
- };
22
- case "new":
23
- case "approve_in_progress": return {
24
- status: "pending_approval",
25
- tone: "warning"
26
- };
27
- case "waiting_to_be_paid": return {
28
- status: "ready_to_pay",
29
- tone: "info"
30
- };
31
- case "partially_paid": return {
32
- status: "partially_paid",
33
- tone: "success"
34
- };
35
- case "paid": return {
36
- status: "paid",
37
- tone: "success"
38
- };
39
- case "canceled": return {
40
- status: "canceled",
41
- tone: "neutral"
42
- };
43
- case "rejected": return {
44
- status: "rejected",
45
- tone: "danger"
46
- };
47
- }
48
- }
49
- //#endregion
50
- export { n as derivePayableStatus };
1
+ import "./index15.js";
@@ -1,8 +1,50 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index17.js
2
- var e = {
3
- emptyHeading: "Add your first bill",
4
- nonEmptyHeading: "Add a bill",
5
- createButton: "Add bill"
6
- };
2
+ var e = /* @__PURE__ */ new Set([
3
+ "new",
4
+ "approve_in_progress",
5
+ "waiting_to_be_paid",
6
+ "partially_paid"
7
+ ]);
8
+ function t(e, t) {
9
+ let n = /* @__PURE__ */ new Date(`${e.slice(0, 10)}T00:00:00Z`), r = Date.UTC(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate());
10
+ return n.getTime() < r;
11
+ }
12
+ function n(n, r, i = /* @__PURE__ */ new Date()) {
13
+ if (e.has(n) && r && t(r, i)) return {
14
+ status: "overdue",
15
+ tone: "danger"
16
+ };
17
+ switch (n) {
18
+ case "draft": return {
19
+ status: "draft",
20
+ tone: "neutral"
21
+ };
22
+ case "new":
23
+ case "approve_in_progress": return {
24
+ status: "pending_approval",
25
+ tone: "warning"
26
+ };
27
+ case "waiting_to_be_paid": return {
28
+ status: "ready_to_pay",
29
+ tone: "info"
30
+ };
31
+ case "partially_paid": return {
32
+ status: "partially_paid",
33
+ tone: "success"
34
+ };
35
+ case "paid": return {
36
+ status: "paid",
37
+ tone: "success"
38
+ };
39
+ case "canceled": return {
40
+ status: "canceled",
41
+ tone: "neutral"
42
+ };
43
+ case "rejected": return {
44
+ status: "rejected",
45
+ tone: "danger"
46
+ };
47
+ }
48
+ }
7
49
  //#endregion
8
- export { e as BILLS_TAB_LABELS_EN };
50
+ export { n as derivePayableStatus };
@@ -1,7 +1,11 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index18.js
2
- var e = {
3
- root: "bill-pay-bills-tab",
4
- uploadTray: "bill-pay-upload-tray"
5
- };
2
+ async function e(e) {
3
+ if (!e.trim()) return !1;
4
+ try {
5
+ return await navigator.clipboard.writeText(e), !0;
6
+ } catch {
7
+ return !1;
8
+ }
9
+ }
6
10
  //#endregion
7
- export { e as billsTabTestIds };
11
+ export { e as copyTextToClipboard };
@@ -1,93 +1,10 @@
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 { formatCalendarDate as n } from "../../../shared/util/dist/lib/formatCalendarDate.js";
9
- import { formatMoneyExact as r } from "../../../shared/util/dist/lib/formatMoneyExact.js";
10
- import { useWidgetConfig as i } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
11
- import "../../../shared/feature/dist/index.js";
12
- import { usePayablesQuery as a } from "../../data-access/dist/index10.js";
13
- import "../../data-access/dist/index.js";
14
- import { AddBillDialog as o } from "../../ui/dist/index10.js";
15
- import { BillsScreen as s } from "../../ui/dist/index38.js";
16
- import "../../ui/dist/index.js";
17
- import { BillCreateDialog as c } from "./index11.js";
18
- import "./index12.js";
19
- import { derivePayableStatus as l } from "./index16.js";
20
- import { BILLS_TAB_LABELS_EN as u } from "./index17.js";
21
- import { billsTabTestIds as d } from "./index18.js";
22
- import { useEffect as f, useState as p } from "react";
23
- import { jsx as m, jsxs as h } from "react/jsx-runtime";
24
1
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js
25
- var g = 10;
26
- function _({ labels: _, onEnqueueFiles: v, openPayableId: y, onOpenPayableHandled: b }) {
27
- let x = {
28
- ...u,
29
- ..._
30
- }, [S, C] = p(!1), [w, T] = p(), [E, D] = p(!1), [O, k] = p([]), [A, j] = p(g), [M, N] = p(), { initResponse: P } = i(), F = e(P?.scopes, [t.PayableReadOrg]), I = e(P?.scopes, [t.PayableWriteOrg]), L = !P || F, R = !P || I, z = a({
31
- limit: A,
32
- pagination_token: M,
33
- enabled: L
34
- }), B = (z.data?.data ?? []).map((e) => {
35
- let t = l(e.status, e.due_date);
36
- return {
37
- vendorLabel: e.counterpart_raw_data?.name ?? "",
38
- dueDateLabel: n(e.due_date),
39
- amountLabel: r((e.total_amount ?? 0) / 100, { currencyCode: e.currency ?? "USD" }),
40
- status: t.status,
41
- statusTone: t.tone,
42
- onOpen: () => {
43
- T(e.id), D(!0);
44
- }
45
- };
46
- }), V = () => {
47
- C(!1), T(void 0), D(!0);
48
- }, H = (e) => {
49
- C(!1), v?.(e);
50
- };
51
- return f(() => {
52
- y && (T(y), D(!0), b?.());
53
- }, [b, y]), /* @__PURE__ */ h("div", {
54
- "data-testid": d.root,
55
- children: [
56
- /* @__PURE__ */ m(s, {
57
- rows: B,
58
- isLoading: z.isLoading || !P,
59
- isError: z.isError,
60
- onRetry: () => z.refetch(),
61
- sorting: O,
62
- onSortingChange: k,
63
- pageSize: A,
64
- onPageSizeChange: j,
65
- hasNextPage: !!z.data?.next_pagination_token,
66
- hasPrevPage: !!z.data?.prev_pagination_token,
67
- onNextPage: () => N(z.data?.next_pagination_token),
68
- onPrevPage: () => N(z.data?.prev_pagination_token),
69
- onCreateClick: R ? () => C(!0) : void 0,
70
- onEnterManually: R ? V : void 0,
71
- onFilesSelected: R ? H : void 0,
72
- labels: {
73
- createButton: x.createButton,
74
- addBill: { heading: x.emptyHeading }
75
- }
76
- }),
77
- R ? /* @__PURE__ */ m(o, {
78
- open: S,
79
- onOpenChange: C,
80
- onFilesSelected: H,
81
- onEnterManually: V,
82
- labels: { heading: B.length ? x.nonEmptyHeading : x.emptyHeading }
83
- }) : null,
84
- E ? /* @__PURE__ */ m(c, {
85
- open: E,
86
- onOpenChange: D,
87
- payableId: w
88
- }) : null
89
- ]
90
- });
91
- }
2
+ var e = {
3
+ emptyHeading: "Add your first bill",
4
+ nonEmptyHeading: "Add a bill",
5
+ createButton: "Add bill",
6
+ emailCopiedToast: "Email address copied to clipboard",
7
+ emailCopyFailedToast: "Could not copy the email address"
8
+ };
92
9
  //#endregion
93
- export { _ as BillsTab, _ as default };
10
+ export { e as BILLS_TAB_LABELS_EN };
@@ -6,7 +6,11 @@ var e = {
6
6
  saveFailed: "We could not save this bill. Try again.",
7
7
  finalizeFailed: "We could not submit this bill. Try again.",
8
8
  draftSaved: "Bill saved as a draft.",
9
- billFinalized: "Bill submitted for approval."
9
+ billFinalized: "Bill submitted for approval.",
10
+ unreadableMoney: "Enter a number, like 285.00.",
11
+ unusableQuantity: "Enter a quantity greater than 0.",
12
+ lineItemsNeedAttention: "Check the highlighted line items before saving.",
13
+ totalsNeedAttention: "Enter discount, tax, and total as numbers, like 285.00."
10
14
  }, t = {
11
15
  achMethod: "via ACH bank transfer",
12
16
  noMethod: "No payment method on file",
@@ -19,7 +23,7 @@ var e = {
19
23
  attachFailed: "We could not attach that file. Try again.",
20
24
  saveBeforeAttaching: "Save this bill before attaching a document."
21
25
  }, r = {
22
- newTitle: "Add bill",
26
+ newTitle: "New bill",
23
27
  extractedTitle: (e) => `Bill from ${e}`,
24
28
  discardConfirm: "Discard your changes to this bill?"
25
29
  }, i = {
@@ -1,3 +1,7 @@
1
- import "./index17.js";
2
- import "./index18.js";
3
- import "./index19.js";
1
+ //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js
2
+ var e = {
3
+ root: "bill-pay-bills-tab",
4
+ uploadTray: "bill-pay-upload-tray"
5
+ };
6
+ //#endregion
7
+ export { e as billsTabTestIds };
@@ -1,8 +1,102 @@
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 { formatCalendarDate as r } from "../../../shared/util/dist/lib/formatCalendarDate.js";
11
+ import { formatMoneyExact as i } from "../../../shared/util/dist/lib/formatMoneyExact.js";
12
+ import { useWidgetConfig as a } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
13
+ import "../../../shared/feature/dist/index.js";
14
+ import { usePayablesQuery as o } from "../../data-access/dist/index10.js";
15
+ import "../../data-access/dist/index.js";
16
+ import { AddBillDialog as s } from "../../ui/dist/index10.js";
17
+ import { BillsScreen as c } from "../../ui/dist/index38.js";
18
+ import "../../ui/dist/index.js";
19
+ import { BillCreateDialog as l } from "./index12.js";
20
+ import "./index13.js";
21
+ import { derivePayableStatus as u } from "./index17.js";
22
+ import { BILLS_TAB_LABELS_EN as d } from "./index19.js";
23
+ import { billsTabTestIds as f } from "./index20.js";
24
+ import { copyTextToClipboard as p } from "./index18.js";
25
+ import { useEffect as m, useState as h } from "react";
26
+ import { jsx as g, jsxs as _ } from "react/jsx-runtime";
1
27
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js
2
- var e = (e) => [
3
- "bill-pay",
4
- "upload-queue",
5
- e ?? ""
6
- ];
28
+ var v = 10, y = "bills@business-banking.app";
29
+ function b({ labels: b, onEnqueueFiles: x, openPayableId: S, onOpenPayableHandled: C }) {
30
+ let w = {
31
+ ...d,
32
+ ...b
33
+ }, [T, E] = h(!1), [D, O] = h(), [k, A] = h(!1), [j, M] = h([]), [N, P] = h(v), [F, I] = h(), { initResponse: L } = a(), R = t(L?.scopes, [n.PayableReadOrg]), z = t(L?.scopes, [n.PayableWriteOrg]), B = !L || R, V = !L || z, H = o({
34
+ limit: N,
35
+ pagination_token: F,
36
+ enabled: B
37
+ }), U = (H.data?.data ?? []).map((e) => {
38
+ let t = u(e.status, e.due_date);
39
+ return {
40
+ vendorLabel: e.counterpart_raw_data?.name ?? "",
41
+ dueDateLabel: r(e.due_date),
42
+ amountLabel: i((e.total_amount ?? 0) / 100, { currencyCode: e.currency ?? "USD" }),
43
+ status: t.status,
44
+ statusTone: t.tone,
45
+ onOpen: () => {
46
+ O(e.id), A(!0);
47
+ }
48
+ };
49
+ }), W = () => {
50
+ E(!1), O(void 0), A(!0);
51
+ }, G = (e) => {
52
+ E(!1), x?.(e);
53
+ }, K = async () => {
54
+ await p(y) ? e.success(w.emailCopiedToast) : e.error(w.emailCopyFailedToast);
55
+ };
56
+ return m(() => {
57
+ S && (O(S), A(!0), C?.());
58
+ }, [C, S]), /* @__PURE__ */ _("div", {
59
+ "data-testid": f.root,
60
+ children: [
61
+ /* @__PURE__ */ g(c, {
62
+ rows: U,
63
+ isLoading: H.isLoading || !L,
64
+ isError: H.isError,
65
+ onRetry: () => H.refetch(),
66
+ sorting: j,
67
+ onSortingChange: M,
68
+ pageSize: N,
69
+ onPageSizeChange: P,
70
+ hasNextPage: !!H.data?.next_pagination_token,
71
+ hasPrevPage: !!H.data?.prev_pagination_token,
72
+ onNextPage: () => I(H.data?.next_pagination_token),
73
+ onPrevPage: () => I(H.data?.prev_pagination_token),
74
+ onCreateClick: V ? () => E(!0) : void 0,
75
+ onEnterManually: V ? W : void 0,
76
+ onFilesSelected: V ? G : void 0,
77
+ emailAddress: y,
78
+ onCopyEmail: K,
79
+ labels: {
80
+ createButton: w.createButton,
81
+ addBill: { heading: w.emptyHeading }
82
+ }
83
+ }),
84
+ V ? /* @__PURE__ */ g(s, {
85
+ open: T,
86
+ onOpenChange: E,
87
+ onFilesSelected: G,
88
+ onEnterManually: W,
89
+ emailAddress: y,
90
+ onCopyEmail: K,
91
+ labels: { heading: U.length ? w.nonEmptyHeading : w.emptyHeading }
92
+ }) : null,
93
+ k ? /* @__PURE__ */ g(l, {
94
+ open: k,
95
+ onOpenChange: A,
96
+ payableId: D
97
+ }) : null
98
+ ]
99
+ });
100
+ }
7
101
  //#endregion
8
- export { e as billPayUploadQueueKey };
102
+ export { b as BillsTab, b as default };
@@ -1,9 +1,3 @@
1
- //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js
2
- var e = {
3
- uploadingSummary: (e) => `Uploading and scanning ${e} ${e === 1 ? "file" : "files"}`,
4
- completeSummary: (e) => `${e} ${e === 1 ? "upload" : "uploads"} complete`,
5
- readyCaption: (e) => `${e} new ${e === 1 ? "bill" : "bills"} ready`,
6
- failedCaption: (e) => `${e} failed to upload`
7
- };
8
- //#endregion
9
- export { e as BILL_UPLOAD_QUEUE_LABELS_EN };
1
+ import "./index19.js";
2
+ import "./index20.js";
3
+ import "./index21.js";