@tesouro/embedded-components-react 0.10.13 → 0.10.15

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 (20) hide show
  1. package/dist/experimental/QuickViewWidget.d.ts +73 -2
  2. package/dist/experimental/index.d.ts +73 -2
  3. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/bills/data-access/dist/index.js +1 -0
  4. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/bills/data-access/dist/index2.js +84 -0
  5. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/bills/feature/dist/index.js +3 -0
  6. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/bills/feature/dist/lib/BillsQuickViewWidget/BillsQuickViewWidgetFeature.js +101 -0
  7. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/bills/feature/dist/lib/BillsQuickViewWidget/labels.js +19 -0
  8. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/bills/feature/dist/lib/BillsQuickViewWidget/summarizeOpenBills.js +13 -0
  9. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/bills/feature/dist/lib/BillsQuickViewWidget/testIds.js +7 -0
  10. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/bills/feature/dist/lib/BillsQuickViewWidget/useOpenBillsSummary.js +30 -0
  11. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/bills/feature/dist/lib/analytics/events.js +4 -0
  12. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/bills/ui/dist/index.js +3 -0
  13. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/bills/ui/dist/index2.js +8 -0
  14. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/bills/ui/dist/index3.js +32 -0
  15. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/feature/dist/lib/QuickViewWidget/QuickViewWidget.js +51 -35
  16. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/feature/dist/lib/QuickViewWidget/labels.js +6 -3
  17. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  18. package/dist/libs/tesouro-embedded-components-react/shared/quick-view/ui/dist/index3.js +1 -1
  19. package/dist/packages/shared-ui-shadcn/dist/index.js +2 -1
  20. package/package.json +1 -1
@@ -669,10 +669,64 @@ interface InvoicesQuickViewWidgetLabels extends InvoicesQuickViewTileLabels {
669
669
  }) => string;
670
670
  }
671
671
 
672
+ interface BillsQuickViewTileLabels {
673
+ /** Tile heading above the total. */
674
+ title: string;
675
+ /** Screen-reader only: names the wait while bills load. */
676
+ loadingLabel: string;
677
+ /** Shown when the bill summary request failed. */
678
+ loadErrorTitle: string;
679
+ /** Label for retry after a failed load. */
680
+ loadErrorRetry: string;
681
+ }
682
+
683
+ interface BillsQuickViewWidgetLabels extends BillsQuickViewTileLabels {
684
+ /**
685
+ * The tile heading as a screen reader hears it, at the start of the
686
+ * accessible name. Override it alongside `title`.
687
+ */
688
+ accessibleTitle: string;
689
+ /** Call to action that opens the bills list. */
690
+ viewBills: string;
691
+ /** Call to action when the org has no bills at all. */
692
+ addBill: string;
693
+ /** Line under the total when the org has no bills at all. */
694
+ noBillsYet: string;
695
+ /** Line under the total when no open bill is due in the window. */
696
+ nothingToPay: string;
697
+ /**
698
+ * Line under the total when bills are due in the window, but none in the
699
+ * currency the tile totals, e.g. "No USD bills due". `currency` is an ISO
700
+ * code.
701
+ */
702
+ noBillsDueInCurrency: (currency: string) => string;
703
+ /** Sub-line part: the open bills behind the total, e.g. "6 bills". */
704
+ billCount: (count: number) => string;
705
+ /** Sub-line part: bills past their due date, e.g. "1 overdue". */
706
+ overdueCount: (count: number) => string;
707
+ /** Sub-line part: bills waiting on an approver, e.g. "1 awaiting approval". */
708
+ awaitingApprovalCount: (count: number) => string;
709
+ /** Joins the sub-line parts, e.g. "1 overdue · 1 awaiting approval". */
710
+ joinSubtext: (parts: string[]) => string;
711
+ /** Joins the same parts as a screen reader hears them, without the dot. */
712
+ joinDescription: (parts: string[]) => string;
713
+ /**
714
+ * The tile's one-sentence accessible name, e.g. "Bills due in the next 30
715
+ * days, $9,615.00, 1 overdue, 1 awaiting approval. View bills."
716
+ */
717
+ accessibleName: (parts: {
718
+ title: string;
719
+ value: string;
720
+ detail: string;
721
+ action: string;
722
+ }) => string;
723
+ }
724
+
672
725
  /** Every tile's copy, keyed by `QuickViewWidget` `type`. */
673
726
  interface QuickViewWidgetLabels {
674
727
  accounts: AccountsQuickViewWidgetLabels;
675
728
  invoices: InvoicesQuickViewWidgetLabels;
729
+ bills: BillsQuickViewWidgetLabels;
676
730
  }
677
731
  /**
678
732
  * Overrides for `QuickViewWidget`'s `labels` prop. Each group is merged with
@@ -681,12 +735,14 @@ interface QuickViewWidgetLabels {
681
735
  interface QuickViewWidgetLabelOverrides {
682
736
  accounts?: Partial<AccountsQuickViewWidgetLabels>;
683
737
  invoices?: Partial<InvoicesQuickViewWidgetLabels>;
738
+ bills?: Partial<BillsQuickViewWidgetLabels>;
684
739
  }
685
740
  declare const QUICK_VIEW_WIDGET_LABELS_EN: QuickViewWidgetLabels;
686
741
 
687
742
  declare const QuickViewType: {
688
743
  readonly Accounts: "accounts";
689
744
  readonly Invoices: "invoices";
745
+ readonly Bills: "bills";
690
746
  };
691
747
  type QuickViewType = (typeof QuickViewType)[keyof typeof QuickViewType];
692
748
  interface QuickViewWidgetClickHandlers {
@@ -706,6 +762,17 @@ interface QuickViewWidgetClickHandlers {
706
762
  * tile reads "Send your first invoice". Without it that tile is static.
707
763
  */
708
764
  onCreateInvoiceClick?: () => void;
765
+ /**
766
+ * `type="bills"`: called when the tile is clicked. Wire it to the host's
767
+ * Bill Pay page. Without it the tile is static.
768
+ */
769
+ onViewBillsClick?: () => void;
770
+ /**
771
+ * `type="bills"`: called instead of `onViewBillsClick` while the org has no
772
+ * bills and the token holds `payable:write:org`, when the tile reads "Add a
773
+ * bill". Without it that tile is static.
774
+ */
775
+ onAddBillClick?: () => void;
709
776
  }
710
777
  /**
711
778
  * Which click handlers each tile calls. Every other handler is ignored for that
@@ -714,6 +781,7 @@ interface QuickViewWidgetClickHandlers {
714
781
  declare const QUICK_VIEW_CLICK_HANDLERS: {
715
782
  readonly accounts: readonly ["onViewAccountsClick"];
716
783
  readonly invoices: readonly ["onViewInvoicesClick", "onCreateInvoiceClick"];
784
+ readonly bills: readonly ["onViewBillsClick", "onAddBillClick"];
717
785
  };
718
786
  interface QuickViewWidgetProps extends WidgetProviderProps, QuickViewWidgetClickHandlers {
719
787
  /** Which summary the tile shows. */
@@ -738,10 +806,13 @@ interface QuickViewWidgetProps extends WidgetProviderProps, QuickViewWidgetClick
738
806
  * nothing without `bank_account:read:org` or for an org with no accounts.
739
807
  * - `invoices`: the total due on open invoices and how much is overdue.
740
808
  * Renders nothing without `invoice:read:org`.
809
+ * - `bills`: the total due on open bills due in the next 30 days, and how
810
+ * many are overdue or awaiting approval. Renders nothing without
811
+ * `payable:read:org`.
741
812
  *
742
813
  * Each type calls only its own click handlers; see `QUICK_VIEW_CLICK_HANDLERS`.
743
814
  */
744
- declare function QuickViewWidget({ type, labels, onViewAccountsClick, onViewInvoicesClick, onCreateInvoiceClick, className, style, ...widgetProviderProps }: QuickViewWidgetProps): React.JSX.Element | null;
815
+ declare function QuickViewWidget({ type, labels, onViewAccountsClick, onViewInvoicesClick, onCreateInvoiceClick, onViewBillsClick, onAddBillClick, className, style, ...widgetProviderProps }: QuickViewWidgetProps): React.JSX.Element | null;
745
816
 
746
817
  export { QUICK_VIEW_CLICK_HANDLERS, QUICK_VIEW_WIDGET_LABELS_EN, QuickViewType, QuickViewWidget };
747
- export type { AccountsQuickViewWidgetLabels, InvoicesQuickViewWidgetLabels, QuickViewWidgetClickHandlers, QuickViewWidgetLabelOverrides, QuickViewWidgetLabels, QuickViewWidgetProps };
818
+ export type { AccountsQuickViewWidgetLabels, BillsQuickViewWidgetLabels, InvoicesQuickViewWidgetLabels, QuickViewWidgetClickHandlers, QuickViewWidgetLabelOverrides, QuickViewWidgetLabels, QuickViewWidgetProps };
@@ -669,10 +669,64 @@ interface InvoicesQuickViewWidgetLabels extends InvoicesQuickViewTileLabels {
669
669
  }) => string;
670
670
  }
671
671
 
672
+ interface BillsQuickViewTileLabels {
673
+ /** Tile heading above the total. */
674
+ title: string;
675
+ /** Screen-reader only: names the wait while bills load. */
676
+ loadingLabel: string;
677
+ /** Shown when the bill summary request failed. */
678
+ loadErrorTitle: string;
679
+ /** Label for retry after a failed load. */
680
+ loadErrorRetry: string;
681
+ }
682
+
683
+ interface BillsQuickViewWidgetLabels extends BillsQuickViewTileLabels {
684
+ /**
685
+ * The tile heading as a screen reader hears it, at the start of the
686
+ * accessible name. Override it alongside `title`.
687
+ */
688
+ accessibleTitle: string;
689
+ /** Call to action that opens the bills list. */
690
+ viewBills: string;
691
+ /** Call to action when the org has no bills at all. */
692
+ addBill: string;
693
+ /** Line under the total when the org has no bills at all. */
694
+ noBillsYet: string;
695
+ /** Line under the total when no open bill is due in the window. */
696
+ nothingToPay: string;
697
+ /**
698
+ * Line under the total when bills are due in the window, but none in the
699
+ * currency the tile totals, e.g. "No USD bills due". `currency` is an ISO
700
+ * code.
701
+ */
702
+ noBillsDueInCurrency: (currency: string) => string;
703
+ /** Sub-line part: the open bills behind the total, e.g. "6 bills". */
704
+ billCount: (count: number) => string;
705
+ /** Sub-line part: bills past their due date, e.g. "1 overdue". */
706
+ overdueCount: (count: number) => string;
707
+ /** Sub-line part: bills waiting on an approver, e.g. "1 awaiting approval". */
708
+ awaitingApprovalCount: (count: number) => string;
709
+ /** Joins the sub-line parts, e.g. "1 overdue · 1 awaiting approval". */
710
+ joinSubtext: (parts: string[]) => string;
711
+ /** Joins the same parts as a screen reader hears them, without the dot. */
712
+ joinDescription: (parts: string[]) => string;
713
+ /**
714
+ * The tile's one-sentence accessible name, e.g. "Bills due in the next 30
715
+ * days, $9,615.00, 1 overdue, 1 awaiting approval. View bills."
716
+ */
717
+ accessibleName: (parts: {
718
+ title: string;
719
+ value: string;
720
+ detail: string;
721
+ action: string;
722
+ }) => string;
723
+ }
724
+
672
725
  /** Every tile's copy, keyed by `QuickViewWidget` `type`. */
673
726
  interface QuickViewWidgetLabels {
674
727
  accounts: AccountsQuickViewWidgetLabels;
675
728
  invoices: InvoicesQuickViewWidgetLabels;
729
+ bills: BillsQuickViewWidgetLabels;
676
730
  }
677
731
  /**
678
732
  * Overrides for `QuickViewWidget`'s `labels` prop. Each group is merged with
@@ -681,12 +735,14 @@ interface QuickViewWidgetLabels {
681
735
  interface QuickViewWidgetLabelOverrides {
682
736
  accounts?: Partial<AccountsQuickViewWidgetLabels>;
683
737
  invoices?: Partial<InvoicesQuickViewWidgetLabels>;
738
+ bills?: Partial<BillsQuickViewWidgetLabels>;
684
739
  }
685
740
  declare const QUICK_VIEW_WIDGET_LABELS_EN: QuickViewWidgetLabels;
686
741
 
687
742
  declare const QuickViewType: {
688
743
  readonly Accounts: "accounts";
689
744
  readonly Invoices: "invoices";
745
+ readonly Bills: "bills";
690
746
  };
691
747
  type QuickViewType = (typeof QuickViewType)[keyof typeof QuickViewType];
692
748
  interface QuickViewWidgetClickHandlers {
@@ -706,6 +762,17 @@ interface QuickViewWidgetClickHandlers {
706
762
  * tile reads "Send your first invoice". Without it that tile is static.
707
763
  */
708
764
  onCreateInvoiceClick?: () => void;
765
+ /**
766
+ * `type="bills"`: called when the tile is clicked. Wire it to the host's
767
+ * Bill Pay page. Without it the tile is static.
768
+ */
769
+ onViewBillsClick?: () => void;
770
+ /**
771
+ * `type="bills"`: called instead of `onViewBillsClick` while the org has no
772
+ * bills and the token holds `payable:write:org`, when the tile reads "Add a
773
+ * bill". Without it that tile is static.
774
+ */
775
+ onAddBillClick?: () => void;
709
776
  }
710
777
  /**
711
778
  * Which click handlers each tile calls. Every other handler is ignored for that
@@ -714,6 +781,7 @@ interface QuickViewWidgetClickHandlers {
714
781
  declare const QUICK_VIEW_CLICK_HANDLERS: {
715
782
  readonly accounts: readonly ["onViewAccountsClick"];
716
783
  readonly invoices: readonly ["onViewInvoicesClick", "onCreateInvoiceClick"];
784
+ readonly bills: readonly ["onViewBillsClick", "onAddBillClick"];
717
785
  };
718
786
  interface QuickViewWidgetProps extends WidgetProviderProps, QuickViewWidgetClickHandlers {
719
787
  /** Which summary the tile shows. */
@@ -738,10 +806,13 @@ interface QuickViewWidgetProps extends WidgetProviderProps, QuickViewWidgetClick
738
806
  * nothing without `bank_account:read:org` or for an org with no accounts.
739
807
  * - `invoices`: the total due on open invoices and how much is overdue.
740
808
  * Renders nothing without `invoice:read:org`.
809
+ * - `bills`: the total due on open bills due in the next 30 days, and how
810
+ * many are overdue or awaiting approval. Renders nothing without
811
+ * `payable:read:org`.
741
812
  *
742
813
  * Each type calls only its own click handlers; see `QUICK_VIEW_CLICK_HANDLERS`.
743
814
  */
744
- declare function QuickViewWidget({ type, labels, onViewAccountsClick, onViewInvoicesClick, onCreateInvoiceClick, className, style, ...widgetProviderProps }: QuickViewWidgetProps): React.JSX.Element | null;
815
+ declare function QuickViewWidget({ type, labels, onViewAccountsClick, onViewInvoicesClick, onCreateInvoiceClick, onViewBillsClick, onAddBillClick, className, style, ...widgetProviderProps }: QuickViewWidgetProps): React.JSX.Element | null;
745
816
 
746
817
  interface CheckAmountAndDetailScreenLabels {
747
818
  title: string;
@@ -854,4 +925,4 @@ interface RemoteCheckCaptureWidgetProps extends WidgetProviderProps {
854
925
  declare function RemoteCheckCaptureWidget({ baseUrl, widgetToken, organizationId, configClient, gatewayRouting, linkComponent, uiFramework, errorFallback, onError, analytics, disclosuresAcceptance, providerLabels, labels, onDepositComplete, }: RemoteCheckCaptureWidgetProps): React.JSX.Element;
855
926
 
856
927
  export { QUICK_VIEW_CLICK_HANDLERS, QUICK_VIEW_WIDGET_LABELS_EN, QuickViewType, QuickViewWidget, RemoteCheckCaptureWidget };
857
- export type { AccountsQuickViewWidgetLabels, InvoicesQuickViewWidgetLabels, QuickViewWidgetClickHandlers, QuickViewWidgetLabelOverrides, QuickViewWidgetLabels, QuickViewWidgetProps, RemoteCheckCaptureWidgetProps };
928
+ export type { AccountsQuickViewWidgetLabels, BillsQuickViewWidgetLabels, InvoicesQuickViewWidgetLabels, QuickViewWidgetClickHandlers, QuickViewWidgetLabelOverrides, QuickViewWidgetLabels, QuickViewWidgetProps, RemoteCheckCaptureWidgetProps };
@@ -0,0 +1 @@
1
+ export { useOpenBillsAnalytics } from "./index2.js";
@@ -0,0 +1,84 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { getAnalyticsPayablesOptions as e } from "../../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
6
+ import { withAuthEpoch as t } from "../../../../shared/data-access/dist/lib/withAuthEpoch.js";
7
+ import { useEmbedApi as n } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
8
+ import { organizationHeaders as r } from "../../../../shared/data-access/dist/lib/organizationHeaders.js";
9
+ import "../../../../shared/data-access/dist/index.js";
10
+ import { useQueries as i } from "@tanstack/react-query";
11
+ import { addDays as a, format as o, parseISO as s } from "date-fns";
12
+ // ../../libs/tesouro-embedded-components-react/quick-view-widget/bills/data-access/dist/index2.js
13
+ var c = [
14
+ "new",
15
+ "approve_in_progress",
16
+ "waiting_to_be_paid",
17
+ "partially_paid"
18
+ ], l = (e, t) => o(a(s(e), t), "yyyy-MM-dd");
19
+ function u(e) {
20
+ let t = {
21
+ status__in: [...c],
22
+ due_date__lte: e && l(e, 30)
23
+ }, n = {
24
+ ...t,
25
+ currency: "USD"
26
+ }, r = {
27
+ metric: "id",
28
+ aggregation_function: "count"
29
+ };
30
+ return {
31
+ allBillsCount: r,
32
+ openAmountDue: {
33
+ ...n,
34
+ metric: "amount_due",
35
+ aggregation_function: "summary"
36
+ },
37
+ openCountByStatus: {
38
+ ...n,
39
+ ...r,
40
+ dimension: "status"
41
+ },
42
+ overdueCount: {
43
+ ...n,
44
+ ...r,
45
+ due_date__lt: e
46
+ },
47
+ dueCountAnyCurrency: {
48
+ ...t,
49
+ ...r
50
+ }
51
+ };
52
+ }
53
+ var d = {
54
+ staleTime: 6e4,
55
+ refetchOnWindowFocus: !0
56
+ }, f = Object.keys(u(""));
57
+ function p(e) {
58
+ return {
59
+ data: e.every((e) => e.data !== void 0) ? Object.fromEntries(f.map((t, n) => [t, e[n].data])) : void 0,
60
+ isLoading: e.some((e) => e.isLoading),
61
+ isFetching: e.some((e) => e.isFetching),
62
+ isError: e.some((e) => e.isError),
63
+ refetch: () => Promise.all(e.map((e) => e.refetch()))
64
+ };
65
+ }
66
+ function m({ today: a, enabled: o = !0 }) {
67
+ let { client: s, organizationId: c, widgetToken: l, authEpoch: m, organizationStatus: h } = n(), g = u(a ?? "");
68
+ return i({
69
+ queries: f.map((n) => ({
70
+ ...t(e({
71
+ client: s,
72
+ headers: r(c),
73
+ query: g[n]
74
+ }), {
75
+ authEpoch: m,
76
+ organizationStatus: h
77
+ }),
78
+ ...d,
79
+ enabled: !!(c && l && a) && o
80
+ })),
81
+ combine: p
82
+ });
83
+ }
84
+ export { c as OPEN_BILL_STATUSES, u as openBillsAnalyticsQueries, m as useOpenBillsAnalytics };
@@ -0,0 +1,3 @@
1
+ import { BILLS_QUICK_VIEW_WIDGET_LABELS_EN as e } from "./lib/BillsQuickViewWidget/labels.js";
2
+ import { BillsQuickViewWidget as t } from "./lib/BillsQuickViewWidget/BillsQuickViewWidgetFeature.js";
3
+ export { e as BILLS_QUICK_VIEW_WIDGET_LABELS_EN, t as BillsQuickViewWidget };
@@ -0,0 +1,101 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { amountOutputToMajorUnits as e } from "../../../../../../shared/util/dist/lib/amountOutputToMajorUnits.js";
6
+ import { formatMoneyExact as t } from "../../../../../../shared/util/dist/lib/formatMoneyExact.js";
7
+ import "../../../../../../shared/util/dist/index.js";
8
+ import { OrganizationStatus as n, isOrganizationOnItsWay as r } from "../../../../../../shared/data-access/dist/lib/organizationStatus.js";
9
+ import { useEmbedApi as i } from "../../../../../../shared/data-access/dist/lib/EmbedApiContext.js";
10
+ import { Scope as a } from "../../../../../../shared/data-access/dist/lib/scopes.js";
11
+ import "../../../../../../shared/data-access/dist/index.js";
12
+ import { useAnalyticsTrack as o } from "../../../../../../shared/feature/dist/lib/analytics/hooks.js";
13
+ import { WidgetProvider as s } from "../../../../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
14
+ import { useRefetchWidget as c, useWidgetConfig as l, useWidgetError as u, useWidgetLoading as d } from "../../../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
15
+ import "../../../../../../shared/feature/dist/index.js";
16
+ import { BillsQuickViewTile as f } from "../../../../ui/dist/index3.js";
17
+ import "../../../../ui/dist/index.js";
18
+ import { BILLS_QUICK_VIEW_WIDGET_LABELS_EN as p } from "./labels.js";
19
+ import { BillsQuickViewWidgetAnalyticsEvent as m, WIDGET_NAME as h } from "../analytics/events.js";
20
+ import { billsQuickViewWidgetTestIds as g } from "./testIds.js";
21
+ import { useOpenBillsSummary as _ } from "./useOpenBillsSummary.js";
22
+ import { useCallback as v, useEffect as y } from "react";
23
+ import { jsx as b } from "react/jsx-runtime";
24
+ // ../../libs/tesouro-embedded-components-react/quick-view-widget/bills/feature/dist/lib/BillsQuickViewWidget/BillsQuickViewWidgetFeature.js
25
+ var x = (n) => t(e({
26
+ value: n,
27
+ currencyCode: "USD"
28
+ }), {
29
+ currencyCode: "USD",
30
+ includeSpaceAfterCurrencySymbol: !1
31
+ });
32
+ function S(e, t, n) {
33
+ let r = (e, t = "viewBills") => ({
34
+ subtext: e,
35
+ description: e,
36
+ subtextTone: "muted",
37
+ callToAction: t
38
+ });
39
+ if (!e.hasBills) return r(t.noBillsYet, n ? "addBill" : "viewBills");
40
+ if (e.openCount === 0) return r(e.hasDueBills ? t.noBillsDueInCurrency("USD") : t.nothingToPay);
41
+ let i = e.awaitingApprovalCount > 0 ? [t.awaitingApprovalCount(e.awaitingApprovalCount)] : [], a = e.overdueCount > 0 ? [t.overdueCount(e.overdueCount), ...i] : [t.billCount(e.openCount), ...i];
42
+ return {
43
+ subtext: t.joinSubtext(a),
44
+ description: t.joinDescription(a),
45
+ subtextTone: e.overdueCount > 0 ? "warning" : "muted",
46
+ callToAction: "viewBills"
47
+ };
48
+ }
49
+ function C({ labels: e, onViewBillsClick: t, onAddBillClick: s, className: h, style: C }) {
50
+ let w = {
51
+ ...p,
52
+ ...e
53
+ }, T = o();
54
+ y(() => {
55
+ T(m.Mounted);
56
+ }, [T]);
57
+ let { initResponse: E } = l(), D = d(), O = u(), k = c(), { organizationId: A, organizationStatus: j } = i(), M = r(j), N = E?.scopes?.includes(a.PayableReadOrg) ?? !1, P = E?.scopes?.includes(a.PayableWriteOrg) ?? !1, { data: F, isLoading: I, isError: L, refetch: R } = _({ enabled: N }), z = D && !E || M && F === void 0 || I, B = (!!O || L) && F === void 0, V = v(() => {
58
+ k(), N && A && R();
59
+ }, [
60
+ k,
61
+ R,
62
+ N,
63
+ A
64
+ ]);
65
+ if (E && (!N || j === n.None)) return null;
66
+ let H = F ? x(F.openAmountDue) : "", U = F ? S(F, w, P) : void 0, W = U?.callToAction === "addBill" ? s : t;
67
+ return /* @__PURE__ */ b(f, {
68
+ value: H,
69
+ subtext: U?.subtext,
70
+ subtextTone: U?.subtextTone,
71
+ linkText: w[U?.callToAction ?? "viewBills"],
72
+ onClick: W,
73
+ ariaLabel: U ? w.accessibleName({
74
+ title: w.accessibleTitle,
75
+ value: H,
76
+ detail: U.description,
77
+ action: w[U.callToAction]
78
+ }) : void 0,
79
+ isLoading: z,
80
+ isError: B,
81
+ onRetry: B ? V : void 0,
82
+ labels: w,
83
+ testIds: g,
84
+ className: h,
85
+ style: C
86
+ });
87
+ }
88
+ function w({ labels: e, onViewBillsClick: t, onAddBillClick: n, className: r, style: i, ...a }) {
89
+ return /* @__PURE__ */ b(s, {
90
+ ...a,
91
+ widgetName: h,
92
+ children: /* @__PURE__ */ b(C, {
93
+ labels: e,
94
+ onViewBillsClick: t,
95
+ onAddBillClick: n,
96
+ className: r,
97
+ style: i
98
+ })
99
+ });
100
+ }
101
+ export { w as BillsQuickViewWidget, C as BillsQuickViewWidgetWithContext };
@@ -0,0 +1,19 @@
1
+ import { BILLS_QUICK_VIEW_TILE_LABELS_EN as e } from "../../../../ui/dist/index2.js";
2
+ import "../../../../ui/dist/index.js";
3
+ // ../../libs/tesouro-embedded-components-react/quick-view-widget/bills/feature/dist/lib/BillsQuickViewWidget/labels.js
4
+ var t = (e) => e.toLocaleString("en-US"), n = {
5
+ ...e,
6
+ accessibleTitle: "Bills due in the next 30 days",
7
+ viewBills: "View bills",
8
+ addBill: "Add a bill",
9
+ noBillsYet: "No bills yet",
10
+ nothingToPay: "Nothing to pay",
11
+ noBillsDueInCurrency: (e) => `No ${e} bills due`,
12
+ billCount: (e) => `${t(e)} ${e === 1 ? "bill" : "bills"}`,
13
+ overdueCount: (e) => `${t(e)} overdue`,
14
+ awaitingApprovalCount: (e) => `${t(e)} awaiting approval`,
15
+ joinSubtext: (e) => e.join(" · "),
16
+ joinDescription: (e) => e.join(", "),
17
+ accessibleName: ({ title: e, value: t, detail: n, action: r }) => `${e}, ${t}, ${n}. ${r}.`
18
+ };
19
+ export { n as BILLS_QUICK_VIEW_WIDGET_LABELS_EN };
@@ -0,0 +1,13 @@
1
+ // ../../libs/tesouro-embedded-components-react/quick-view-widget/bills/feature/dist/lib/BillsQuickViewWidget/summarizeOpenBills.js
2
+ var e = (e, t = () => !0) => e.data.filter((e) => t(e.dimension_value ?? "")).reduce((e, t) => e + t.metric_value, 0);
3
+ function t(t) {
4
+ return {
5
+ hasBills: e(t.allBillsCount) > 0,
6
+ hasDueBills: e(t.dueCountAnyCurrency) > 0,
7
+ openCount: e(t.openCountByStatus),
8
+ openAmountDue: e(t.openAmountDue),
9
+ overdueCount: e(t.overdueCount),
10
+ awaitingApprovalCount: e(t.openCountByStatus, (e) => e === "approve_in_progress")
11
+ };
12
+ }
13
+ export { t as summarizeOpenBills };
@@ -0,0 +1,7 @@
1
+ // ../../libs/tesouro-embedded-components-react/quick-view-widget/bills/feature/dist/lib/BillsQuickViewWidget/testIds.js
2
+ var e = {
3
+ tile: "bills-quick-view-widget-tile",
4
+ skeleton: "bills-quick-view-widget-skeleton",
5
+ error: "bills-quick-view-widget-error"
6
+ };
7
+ export { e as billsQuickViewWidgetTestIds };
@@ -0,0 +1,30 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { useEmbedApi as e } from "../../../../../../shared/data-access/dist/lib/EmbedApiContext.js";
6
+ import "../../../../../../shared/data-access/dist/index.js";
7
+ import { useLocalCalendarDay as t } from "../../../../../../shared/feature/dist/lib/calendar/useLocalCalendarDay.js";
8
+ import "../../../../../../shared/feature/dist/index.js";
9
+ import { summarizeOpenBills as n } from "./summarizeOpenBills.js";
10
+ import { useOpenBillsAnalytics as r } from "../../../../data-access/dist/index2.js";
11
+ import "../../../../data-access/dist/index.js";
12
+ import { useMemo as i, useState as a } from "react";
13
+ // ../../libs/tesouro-embedded-components-react/quick-view-widget/bills/feature/dist/lib/BillsQuickViewWidget/useOpenBillsSummary.js
14
+ var o = (e, t) => Object.keys(e).every((n) => e[n] === t[n]);
15
+ function s({ enabled: s } = {}) {
16
+ let c = t(), l = r({
17
+ today: c,
18
+ enabled: s
19
+ }), { organizationId: u, authEpoch: d } = e(), f = i(() => l.data && n(l.data), [l.data]), [p, m] = a(), h = p !== void 0 && p.organizationId === u && p.authEpoch === d, g = f !== void 0 && (!l.isFetching && !l.isError || !h), _ = h ? p.summary : f;
20
+ return g && !(h && o(p.summary, f)) && (m({
21
+ organizationId: u,
22
+ authEpoch: d,
23
+ summary: f
24
+ }), _ = f), {
25
+ ...l,
26
+ data: _,
27
+ isLoading: (l.isLoading || c === void 0) && !_
28
+ };
29
+ }
30
+ export { s as useOpenBillsSummary };
@@ -0,0 +1,4 @@
1
+ import { QUICK_VIEW_WIDGET_NAME as e } from "../../../../../shared/util/dist/lib/widgetName.js";
2
+ // ../../libs/tesouro-embedded-components-react/quick-view-widget/bills/feature/dist/lib/analytics/events.js
3
+ var t = `${e}.bills_quick_view_widget`, n = { Mounted: `${t}.mounted` };
4
+ export { n as BillsQuickViewWidgetAnalyticsEvent, t as WIDGET_NAME };
@@ -0,0 +1,3 @@
1
+ import { BILLS_QUICK_VIEW_TILE_LABELS_EN as e } from "./index2.js";
2
+ import { BillsQuickViewTile as t } from "./index3.js";
3
+ export { e as BILLS_QUICK_VIEW_TILE_LABELS_EN, t as BillsQuickViewTile };
@@ -0,0 +1,8 @@
1
+ // ../../libs/tesouro-embedded-components-react/quick-view-widget/bills/ui/dist/index2.js
2
+ var e = {
3
+ title: "Bills due · next 30 days",
4
+ loadingLabel: "Loading bills",
5
+ loadErrorTitle: "Couldn't load bills",
6
+ loadErrorRetry: "Retry"
7
+ };
8
+ export { e as BILLS_QUICK_VIEW_TILE_LABELS_EN };
@@ -0,0 +1,32 @@
1
+ import { QuickViewTile as e } from "../../../../shared/quick-view/ui/dist/index3.js";
2
+ import "../../../../shared/quick-view/ui/dist/index.js";
3
+ import { BILLS_QUICK_VIEW_TILE_LABELS_EN as t } from "./index2.js";
4
+ import { jsx as n } from "react/jsx-runtime";
5
+ // ../../libs/tesouro-embedded-components-react/quick-view-widget/bills/ui/dist/index3.js
6
+ function r({ value: r, subtext: i, subtextTone: a, linkText: o, onClick: s, ariaLabel: c, isLoading: l, isError: u, onRetry: d, labels: f, testIds: p, className: m, style: h }) {
7
+ let g = {
8
+ ...t,
9
+ ...f
10
+ };
11
+ return /* @__PURE__ */ n(e, {
12
+ title: g.title,
13
+ value: r,
14
+ subtext: i,
15
+ subtextTone: a,
16
+ linkText: o,
17
+ onClick: s,
18
+ ariaLabel: c,
19
+ isLoading: l,
20
+ isError: u,
21
+ onRetry: d,
22
+ labels: {
23
+ loadingLabel: g.loadingLabel,
24
+ loadErrorTitle: g.loadErrorTitle,
25
+ loadErrorRetry: g.loadErrorRetry
26
+ },
27
+ testIds: p,
28
+ className: m,
29
+ style: h
30
+ });
31
+ }
32
+ export { r as BillsQuickViewTile };
@@ -6,51 +6,67 @@ import { AccountsQuickViewWidget as e } from "../../../../accounts/feature/dist/
6
6
  import "../../../../accounts/feature/dist/index.js";
7
7
  import { InvoicesQuickViewWidget as t } from "../../../../invoices/feature/dist/lib/InvoicesQuickViewWidget/InvoicesQuickViewWidgetFeature.js";
8
8
  import "../../../../invoices/feature/dist/index.js";
9
- import { useEffect as n } from "react";
10
- import { jsx as r } from "react/jsx-runtime";
9
+ import { BillsQuickViewWidget as n } from "../../../../bills/feature/dist/lib/BillsQuickViewWidget/BillsQuickViewWidgetFeature.js";
10
+ import "../../../../bills/feature/dist/index.js";
11
+ import { useEffect as r } from "react";
12
+ import { jsx as i } from "react/jsx-runtime";
11
13
  // ../../libs/tesouro-embedded-components-react/quick-view-widget/feature/dist/lib/QuickViewWidget/QuickViewWidget.js
12
- var i = {
14
+ var a = {
13
15
  Accounts: "accounts",
14
- Invoices: "invoices"
15
- }, a = {
16
+ Invoices: "invoices",
17
+ Bills: "bills"
18
+ }, o = {
16
19
  accounts: ["onViewAccountsClick"],
17
- invoices: ["onViewInvoicesClick", "onCreateInvoiceClick"]
18
- }, o = [
20
+ invoices: ["onViewInvoicesClick", "onCreateInvoiceClick"],
21
+ bills: ["onViewBillsClick", "onAddBillClick"]
22
+ }, s = [
19
23
  "onViewAccountsClick",
20
24
  "onViewInvoicesClick",
21
- "onCreateInvoiceClick"
25
+ "onCreateInvoiceClick",
26
+ "onViewBillsClick",
27
+ "onAddBillClick"
22
28
  ];
23
- function s(e) {
24
- return Object.values(i).includes(e);
29
+ function c(e) {
30
+ return Object.values(a).includes(e);
25
31
  }
26
- function c(e, t) {
27
- let r = s(e) ? a[e] : [], c = o.filter((e) => t[e] !== void 0 && !r.includes(e)).join(", ");
28
- n(() => {
29
- s(e) ? c && console.warn(`[tesouro-embedded] QuickViewWidget: ${c} ${c.includes(",") ? "do" : "does"} not apply to type="${e}" and will never be called. type="${e}" uses: ${a[e].join(", ")}.`) : console.warn(`[tesouro-embedded] QuickViewWidget: unknown type "${String(e)}". Expected one of: ${Object.values(i).join(", ")}. Rendering nothing.`);
30
- }, [e, c]);
32
+ function l(e, t) {
33
+ let n = c(e) ? o[e] : [], i = s.filter((e) => t[e] !== void 0 && !n.includes(e)).join(", ");
34
+ r(() => {
35
+ c(e) ? i && console.warn(`[tesouro-embedded] QuickViewWidget: ${i} ${i.includes(",") ? "do" : "does"} not apply to type="${e}" and will never be called. type="${e}" uses: ${o[e].join(", ")}.`) : console.warn(`[tesouro-embedded] QuickViewWidget: unknown type "${String(e)}". Expected one of: ${Object.values(a).join(", ")}. Rendering nothing.`);
36
+ }, [e, i]);
31
37
  }
32
- function l({ type: n, labels: a, onViewAccountsClick: o, onViewInvoicesClick: s, onCreateInvoiceClick: l, className: u, style: d, ...f }) {
33
- switch (c(n, {
34
- onViewAccountsClick: o,
35
- onViewInvoicesClick: s,
36
- onCreateInvoiceClick: l
37
- }), n) {
38
- case i.Accounts: return /* @__PURE__ */ r(e, {
39
- ...f,
40
- labels: a?.accounts,
41
- onViewAccountsClick: o,
42
- className: u,
43
- style: d
38
+ function u({ type: r, labels: o, onViewAccountsClick: s, onViewInvoicesClick: c, onCreateInvoiceClick: u, onViewBillsClick: d, onAddBillClick: f, className: p, style: m, ...h }) {
39
+ switch (l(r, {
40
+ onViewAccountsClick: s,
41
+ onViewInvoicesClick: c,
42
+ onCreateInvoiceClick: u,
43
+ onViewBillsClick: d,
44
+ onAddBillClick: f
45
+ }), r) {
46
+ case a.Accounts: return /* @__PURE__ */ i(e, {
47
+ ...h,
48
+ labels: o?.accounts,
49
+ onViewAccountsClick: s,
50
+ className: p,
51
+ style: m
44
52
  });
45
- case i.Invoices: return /* @__PURE__ */ r(t, {
46
- ...f,
47
- labels: a?.invoices,
48
- onViewInvoicesClick: s,
49
- onCreateInvoiceClick: l,
50
- className: u,
51
- style: d
53
+ case a.Invoices: return /* @__PURE__ */ i(t, {
54
+ ...h,
55
+ labels: o?.invoices,
56
+ onViewInvoicesClick: c,
57
+ onCreateInvoiceClick: u,
58
+ className: p,
59
+ style: m
60
+ });
61
+ case a.Bills: return /* @__PURE__ */ i(n, {
62
+ ...h,
63
+ labels: o?.bills,
64
+ onViewBillsClick: d,
65
+ onAddBillClick: f,
66
+ className: p,
67
+ style: m
52
68
  });
53
69
  default: return null;
54
70
  }
55
71
  }
56
- export { a as QUICK_VIEW_CLICK_HANDLERS, i as QuickViewType, l as QuickViewWidget };
72
+ export { o as QUICK_VIEW_CLICK_HANDLERS, a as QuickViewType, u as QuickViewWidget };
@@ -2,9 +2,12 @@ import { ACCOUNTS_QUICK_VIEW_WIDGET_LABELS_EN as e } from "../../../../accounts/
2
2
  import "../../../../accounts/feature/dist/index.js";
3
3
  import { INVOICES_QUICK_VIEW_WIDGET_LABELS_EN as t } from "../../../../invoices/feature/dist/lib/InvoicesQuickViewWidget/labels.js";
4
4
  import "../../../../invoices/feature/dist/index.js";
5
+ import { BILLS_QUICK_VIEW_WIDGET_LABELS_EN as n } from "../../../../bills/feature/dist/lib/BillsQuickViewWidget/labels.js";
6
+ import "../../../../bills/feature/dist/index.js";
5
7
  // ../../libs/tesouro-embedded-components-react/quick-view-widget/feature/dist/lib/QuickViewWidget/labels.js
6
- var n = {
8
+ var r = {
7
9
  accounts: e,
8
- invoices: t
10
+ invoices: t,
11
+ bills: n
9
12
  };
10
- export { n as QUICK_VIEW_WIDGET_LABELS_EN };
13
+ export { r as QUICK_VIEW_WIDGET_LABELS_EN };
@@ -1,5 +1,5 @@
1
1
  // ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
2
- var e = "@tesouro/embedded-components-react", t = "0.10.13", n = "d0d4e3e23ad80fd9d86742a98fc88994673ab707", r = Object.freeze({
2
+ var e = "@tesouro/embedded-components-react", t = "0.10.15", n = "a19816aae6c67c1ae01c867042643c02e0546f04", r = Object.freeze({
3
3
  library_name: e,
4
4
  library_version: t,
5
5
  library_sha: n
@@ -74,7 +74,7 @@ function u({ title: u, value: d, subtext: f, subtextTone: p = "muted", linkText:
74
74
  component: "span",
75
75
  variant: "body2",
76
76
  color: p,
77
- className: n("ttw:block", p === "destructive" && "ttw:font-medium"),
77
+ className: n("ttw:block", p !== "muted" && "ttw:font-medium"),
78
78
  children: f
79
79
  }) : null,
80
80
  T && m ? /* @__PURE__ */ o("span", {
@@ -12538,7 +12538,8 @@ var Kw = Gw({
12538
12538
  default: "ttw:text-foreground",
12539
12539
  muted: "ttw:text-muted-foreground",
12540
12540
  primary: "ttw:text-primary",
12541
- destructive: "ttw:text-destructive"
12541
+ destructive: "ttw:text-destructive",
12542
+ warning: "ttw:text-warning-foreground"
12542
12543
  }
12543
12544
  },
12544
12545
  defaultVariants: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tesouro/embedded-components-react",
3
- "version": "0.10.13",
3
+ "version": "0.10.15",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": [