@tesouro/embedded-components-react 0.9.59 → 0.10.0

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 (41) hide show
  1. package/README.md +0 -13
  2. package/dist/{lib/AccountsQuickViewWidget.d.ts → experimental/QuickViewWidget.d.ts} +112 -15
  3. package/dist/experimental/QuickViewWidget.js +4 -0
  4. package/dist/experimental/index.d.ts +150 -3
  5. package/dist/experimental/index.js +4 -2
  6. package/dist/index.d.ts +3 -53
  7. package/dist/index.js +7 -9
  8. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/accounts/data-access/dist/index2.js +20 -0
  9. package/dist/libs/tesouro-embedded-components-react/{accounts-quick-view-widget → quick-view-widget/accounts}/feature/dist/lib/AccountsQuickViewWidget/AccountsQuickViewWidgetFeature.js +15 -15
  10. package/dist/libs/tesouro-embedded-components-react/{accounts-quick-view-widget → quick-view-widget/accounts}/feature/dist/lib/AccountsQuickViewWidget/labels.js +1 -1
  11. package/dist/libs/tesouro-embedded-components-react/{accounts-quick-view-widget → quick-view-widget/accounts}/feature/dist/lib/AccountsQuickViewWidget/testIds.js +1 -1
  12. package/dist/libs/tesouro-embedded-components-react/{accounts-quick-view-widget → quick-view-widget/accounts}/feature/dist/lib/accountsBalanceSummary/summarizeAccountBalances.js +3 -3
  13. package/dist/libs/tesouro-embedded-components-react/{accounts-quick-view-widget → quick-view-widget/accounts}/feature/dist/lib/accountsBalanceSummary/useAccountsBalanceSummary.js +1 -1
  14. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/accounts/feature/dist/lib/analytics/events.js +4 -0
  15. package/dist/libs/tesouro-embedded-components-react/{accounts-quick-view-widget → quick-view-widget/accounts}/ui/dist/index2.js +1 -1
  16. package/dist/libs/tesouro-embedded-components-react/{accounts-quick-view-widget → quick-view-widget/accounts}/ui/dist/index3.js +3 -3
  17. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/feature/dist/index.js +3 -0
  18. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/feature/dist/lib/QuickViewWidget/QuickViewWidget.js +56 -0
  19. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/feature/dist/lib/QuickViewWidget/labels.js +10 -0
  20. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/invoices/data-access/dist/index.js +1 -0
  21. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/invoices/data-access/dist/index2.js +118 -0
  22. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/invoices/feature/dist/index.js +3 -0
  23. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/invoices/feature/dist/lib/InvoicesQuickViewWidget/InvoicesQuickViewWidgetFeature.js +106 -0
  24. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/invoices/feature/dist/lib/InvoicesQuickViewWidget/labels.js +16 -0
  25. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/invoices/feature/dist/lib/InvoicesQuickViewWidget/summarizeOpenInvoices.js +19 -0
  26. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/invoices/feature/dist/lib/InvoicesQuickViewWidget/testIds.js +7 -0
  27. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/invoices/feature/dist/lib/InvoicesQuickViewWidget/useOpenInvoicesSummary.js +25 -0
  28. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/invoices/feature/dist/lib/analytics/events.js +4 -0
  29. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/invoices/ui/dist/index.js +3 -0
  30. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/invoices/ui/dist/index2.js +8 -0
  31. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/invoices/ui/dist/index3.js +32 -0
  32. package/dist/libs/tesouro-embedded-components-react/quick-view-widget/shared/util/dist/lib/widgetName.js +3 -0
  33. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  34. package/dist/libs/tesouro-embedded-components-react/shared/quick-view/ui/dist/index3.js +38 -37
  35. package/package.json +1 -1
  36. package/dist/lib/AccountsQuickViewWidget.js +0 -4
  37. package/dist/libs/tesouro-embedded-components-react/accounts-quick-view-widget/data-access/dist/index2.js +0 -20
  38. package/dist/libs/tesouro-embedded-components-react/accounts-quick-view-widget/feature/dist/lib/analytics/events.js +0 -3
  39. /package/dist/libs/tesouro-embedded-components-react/{accounts-quick-view-widget → quick-view-widget/accounts}/data-access/dist/index.js +0 -0
  40. /package/dist/libs/tesouro-embedded-components-react/{accounts-quick-view-widget → quick-view-widget/accounts}/feature/dist/index.js +0 -0
  41. /package/dist/libs/tesouro-embedded-components-react/{accounts-quick-view-widget → quick-view-widget/accounts}/ui/dist/index.js +0 -0
@@ -0,0 +1,56 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { AccountsQuickViewWidget as e } from "../../../../accounts/feature/dist/lib/AccountsQuickViewWidget/AccountsQuickViewWidgetFeature.js";
6
+ import "../../../../accounts/feature/dist/index.js";
7
+ import { InvoicesQuickViewWidget as t } from "../../../../invoices/feature/dist/lib/InvoicesQuickViewWidget/InvoicesQuickViewWidgetFeature.js";
8
+ import "../../../../invoices/feature/dist/index.js";
9
+ import { useEffect as n } from "react";
10
+ import { jsx as r } from "react/jsx-runtime";
11
+ // ../../libs/tesouro-embedded-components-react/quick-view-widget/feature/dist/lib/QuickViewWidget/QuickViewWidget.js
12
+ var i = {
13
+ Accounts: "accounts",
14
+ Invoices: "invoices"
15
+ }, a = {
16
+ accounts: ["onViewAccountsClick"],
17
+ invoices: ["onViewInvoicesClick", "onCreateInvoiceClick"]
18
+ }, o = [
19
+ "onViewAccountsClick",
20
+ "onViewInvoicesClick",
21
+ "onCreateInvoiceClick"
22
+ ];
23
+ function s(e) {
24
+ return Object.values(i).includes(e);
25
+ }
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]);
31
+ }
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
44
+ });
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
52
+ });
53
+ default: return null;
54
+ }
55
+ }
56
+ export { a as QUICK_VIEW_CLICK_HANDLERS, i as QuickViewType, l as QuickViewWidget };
@@ -0,0 +1,10 @@
1
+ import { ACCOUNTS_QUICK_VIEW_WIDGET_LABELS_EN as e } from "../../../../accounts/feature/dist/lib/AccountsQuickViewWidget/labels.js";
2
+ import "../../../../accounts/feature/dist/index.js";
3
+ import { INVOICES_QUICK_VIEW_WIDGET_LABELS_EN as t } from "../../../../invoices/feature/dist/lib/InvoicesQuickViewWidget/labels.js";
4
+ import "../../../../invoices/feature/dist/index.js";
5
+ // ../../libs/tesouro-embedded-components-react/quick-view-widget/feature/dist/lib/QuickViewWidget/labels.js
6
+ var n = {
7
+ accounts: e,
8
+ invoices: t
9
+ };
10
+ export { n as QUICK_VIEW_WIDGET_LABELS_EN };
@@ -0,0 +1 @@
1
+ export { OPEN_STATUSES, useOpenInvoicesAnalytics } from "./index2.js";
@@ -0,0 +1,118 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { getAnalyticsReceivablesOptions 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 { useEffect as i, useReducer as a } from "react";
11
+ import { useQueries as o } from "@tanstack/react-query";
12
+ // ../../libs/tesouro-embedded-components-react/quick-view-widget/invoices/data-access/dist/index2.js
13
+ var s = [
14
+ "issued",
15
+ "partially_paid",
16
+ "overdue"
17
+ ], c = ["issued", "partially_paid"];
18
+ function l(e = /* @__PURE__ */ new Date()) {
19
+ let t = (e) => String(e).padStart(2, "0");
20
+ return `${e.getFullYear()}-${t(e.getMonth() + 1)}-${t(e.getDate())}`;
21
+ }
22
+ var u = 1e3;
23
+ function d(e = /* @__PURE__ */ new Date()) {
24
+ return new Date(e.getFullYear(), e.getMonth(), e.getDate() + 1).getTime() - e.getTime() + u;
25
+ }
26
+ function f() {
27
+ let e = l(), [t, n] = a((e) => e + 1, 0);
28
+ return i(() => {
29
+ let e = setTimeout(n, d());
30
+ return () => clearTimeout(e);
31
+ }, [e, t]), e;
32
+ }
33
+ var p = {
34
+ dimension: "currency",
35
+ metric: "amount_due",
36
+ aggregation_function: "summary"
37
+ }, m = {
38
+ dimension: "currency",
39
+ metric: "id",
40
+ aggregation_function: "count"
41
+ };
42
+ function h(e) {
43
+ let t = {
44
+ type: "invoice",
45
+ status__in: [...s]
46
+ }, n = {
47
+ type: "invoice",
48
+ status: "overdue"
49
+ }, r = {
50
+ type: "invoice",
51
+ status__in: [...c],
52
+ due_date__lt: e
53
+ };
54
+ return {
55
+ countByStatus: {
56
+ type: "invoice",
57
+ dimension: "status",
58
+ metric: "id",
59
+ aggregation_function: "count"
60
+ },
61
+ openAmountByCurrency: {
62
+ ...t,
63
+ ...p
64
+ },
65
+ openCountByCurrency: {
66
+ ...t,
67
+ ...m
68
+ },
69
+ overdueStatusAmountByCurrency: {
70
+ ...n,
71
+ ...p
72
+ },
73
+ overdueStatusCountByCurrency: {
74
+ ...n,
75
+ ...m
76
+ },
77
+ pastDueAmountByCurrency: {
78
+ ...r,
79
+ ...p
80
+ },
81
+ pastDueCountByCurrency: {
82
+ ...r,
83
+ ...m
84
+ }
85
+ };
86
+ }
87
+ var g = {
88
+ staleTime: 6e4,
89
+ refetchOnWindowFocus: !0
90
+ }, _ = Object.keys(h(""));
91
+ function v(e) {
92
+ return {
93
+ data: e.every((e) => e.data !== void 0) ? Object.fromEntries(_.map((t, n) => [t, e[n].data])) : void 0,
94
+ isLoading: e.some((e) => e.isLoading),
95
+ isFetching: e.some((e) => e.isFetching),
96
+ isError: e.some((e) => e.isError),
97
+ refetch: () => Promise.all(e.map((e) => e.refetch()))
98
+ };
99
+ }
100
+ function y({ enabled: i = !0 } = {}) {
101
+ let { client: a, organizationId: s, widgetToken: c, authEpoch: l, organizationStatus: u } = n(), d = h(f());
102
+ return o({
103
+ queries: _.map((n) => ({
104
+ ...t(e({
105
+ client: a,
106
+ headers: r(s),
107
+ query: d[n]
108
+ }), {
109
+ authEpoch: l,
110
+ organizationStatus: u
111
+ }),
112
+ ...g,
113
+ enabled: !!(s && c) && i
114
+ })),
115
+ combine: v
116
+ });
117
+ }
118
+ export { s as OPEN_STATUSES, h as openInvoicesAnalyticsQueries, f as useLocalToday, y as useOpenInvoicesAnalytics };
@@ -0,0 +1,3 @@
1
+ import { INVOICES_QUICK_VIEW_WIDGET_LABELS_EN as e } from "./lib/InvoicesQuickViewWidget/labels.js";
2
+ import { InvoicesQuickViewWidget as t } from "./lib/InvoicesQuickViewWidget/InvoicesQuickViewWidgetFeature.js";
3
+ export { e as INVOICES_QUICK_VIEW_WIDGET_LABELS_EN, t as InvoicesQuickViewWidget };
@@ -0,0 +1,106 @@
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 { InvoicesQuickViewTile as f } from "../../../../ui/dist/index3.js";
17
+ import "../../../../ui/dist/index.js";
18
+ import { INVOICES_QUICK_VIEW_WIDGET_LABELS_EN as p } from "./labels.js";
19
+ import { InvoicesQuickViewWidgetAnalyticsEvent as m, WIDGET_NAME as h } from "../analytics/events.js";
20
+ import { invoicesQuickViewWidgetTestIds as g } from "./testIds.js";
21
+ import "./summarizeOpenInvoices.js";
22
+ import { useOpenInvoicesSummary as _ } from "./useOpenInvoicesSummary.js";
23
+ import { useCallback as v, useEffect as y } from "react";
24
+ import { jsx as b } from "react/jsx-runtime";
25
+ // ../../libs/tesouro-embedded-components-react/quick-view-widget/invoices/feature/dist/lib/InvoicesQuickViewWidget/InvoicesQuickViewWidgetFeature.js
26
+ var x = (n) => t(e({
27
+ value: n,
28
+ currencyCode: "USD"
29
+ }), {
30
+ currencyCode: "USD",
31
+ includeSpaceAfterCurrencySymbol: !1
32
+ });
33
+ function S(e, t, n) {
34
+ let r = (e, t = "viewInvoices") => ({
35
+ subtext: e,
36
+ description: e,
37
+ subtextTone: "muted",
38
+ callToAction: t
39
+ });
40
+ if (!e.hasSentInvoices) return r(t.noInvoicesYet, n ? "sendFirstInvoice" : "viewInvoices");
41
+ if (!e.hasOpenInvoices) return r(t.noOpenInvoices);
42
+ if (e.openCount === 0) return r(t.noOpenInvoicesInCurrency("USD"));
43
+ if (e.overdueCount > 0) {
44
+ let n = x(e.overdueAmountDue);
45
+ return {
46
+ subtext: t.overdueSummary(n, e.overdueCount),
47
+ description: t.overdueDescription(n, e.overdueCount),
48
+ subtextTone: "destructive",
49
+ callToAction: "viewInvoices"
50
+ };
51
+ }
52
+ return r(t.openInvoiceCount(e.openCount));
53
+ }
54
+ function C({ labels: e, onViewInvoicesClick: t, onCreateInvoiceClick: s, className: h, style: C }) {
55
+ let w = {
56
+ ...p,
57
+ ...e
58
+ }, T = o();
59
+ y(() => {
60
+ T(m.Mounted);
61
+ }, [T]);
62
+ let { initResponse: E } = l(), D = d(), O = u(), k = c(), { organizationId: A, organizationStatus: j } = i(), M = r(j), N = E?.scopes?.includes(a.InvoiceReadOrg) ?? !1, P = E?.scopes?.includes(a.InvoiceWriteOrg) ?? !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(() => {
63
+ k(), N && A && R();
64
+ }, [
65
+ k,
66
+ R,
67
+ N,
68
+ A
69
+ ]);
70
+ if (E && (!N || j === n.None)) return null;
71
+ let H = F ? x(F.openAmountDue) : "", U = F ? S(F, w, P) : void 0, W = U?.callToAction === "sendFirstInvoice" ? s : t;
72
+ return /* @__PURE__ */ b(f, {
73
+ value: H,
74
+ subtext: U?.subtext,
75
+ subtextTone: U?.subtextTone,
76
+ linkText: w[U?.callToAction ?? "viewInvoices"],
77
+ onClick: W,
78
+ ariaLabel: U ? w.accessibleName({
79
+ title: w.title,
80
+ value: H,
81
+ detail: U.description,
82
+ action: w[U.callToAction]
83
+ }) : void 0,
84
+ isLoading: z,
85
+ isError: B,
86
+ onRetry: B ? V : void 0,
87
+ labels: w,
88
+ testIds: g,
89
+ className: h,
90
+ style: C
91
+ });
92
+ }
93
+ function w({ labels: e, onViewInvoicesClick: t, onCreateInvoiceClick: n, className: r, style: i, ...a }) {
94
+ return /* @__PURE__ */ b(s, {
95
+ ...a,
96
+ widgetName: h,
97
+ children: /* @__PURE__ */ b(C, {
98
+ labels: e,
99
+ onViewInvoicesClick: t,
100
+ onCreateInvoiceClick: n,
101
+ className: r,
102
+ style: i
103
+ })
104
+ });
105
+ }
106
+ export { w as InvoicesQuickViewWidget, C as InvoicesQuickViewWidgetWithContext };
@@ -0,0 +1,16 @@
1
+ import { INVOICES_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/invoices/feature/dist/lib/InvoicesQuickViewWidget/labels.js
4
+ var t = (e, t = "") => `${e.toLocaleString("en-US")} ${t}${e === 1 ? "invoice" : "invoices"}`, n = {
5
+ ...e,
6
+ viewInvoices: "View invoices",
7
+ sendFirstInvoice: "Send your first invoice",
8
+ noInvoicesYet: "No invoices yet",
9
+ noOpenInvoices: "No open invoices",
10
+ noOpenInvoicesInCurrency: (e) => `No open ${e} invoices`,
11
+ openInvoiceCount: (e) => t(e, "open "),
12
+ overdueSummary: (e, n) => `${e} overdue · ${t(n)}`,
13
+ overdueDescription: (e, n) => `${e} overdue across ${t(n)}`,
14
+ accessibleName: ({ title: e, value: t, detail: n, action: r }) => `${e}, ${t}, ${n}. ${r}.`
15
+ };
16
+ export { n as INVOICES_QUICK_VIEW_WIDGET_LABELS_EN };
@@ -0,0 +1,19 @@
1
+ import { OPEN_STATUSES as e } from "../../../../data-access/dist/index2.js";
2
+ import "../../../../data-access/dist/index.js";
3
+ // ../../libs/tesouro-embedded-components-react/quick-view-widget/invoices/feature/dist/lib/InvoicesQuickViewWidget/summarizeOpenInvoices.js
4
+ var t = /* @__PURE__ */ new Set([
5
+ "draft",
6
+ "recurring",
7
+ "failed"
8
+ ]), n = new Set(e), r = (e, t = () => !0) => e.data.filter((e) => t(e.dimension_value ?? "")).reduce((e, t) => e + t.metric_value, 0), i = (e) => e.toUpperCase() === "USD";
9
+ function a(e) {
10
+ return {
11
+ hasSentInvoices: r(e.countByStatus, (e) => !t.has(e)) > 0,
12
+ hasOpenInvoices: r(e.countByStatus, (e) => n.has(e)) > 0,
13
+ openCount: r(e.openCountByCurrency, i),
14
+ openAmountDue: r(e.openAmountByCurrency, i),
15
+ overdueCount: r(e.overdueStatusCountByCurrency, i) + r(e.pastDueCountByCurrency, i),
16
+ overdueAmountDue: r(e.overdueStatusAmountByCurrency, i) + r(e.pastDueAmountByCurrency, i)
17
+ };
18
+ }
19
+ export { a as summarizeOpenInvoices };
@@ -0,0 +1,7 @@
1
+ // ../../libs/tesouro-embedded-components-react/quick-view-widget/invoices/feature/dist/lib/InvoicesQuickViewWidget/testIds.js
2
+ var e = {
3
+ tile: "invoices-quick-view-widget-tile",
4
+ skeleton: "invoices-quick-view-widget-skeleton",
5
+ error: "invoices-quick-view-widget-error"
6
+ };
7
+ export { e as invoicesQuickViewWidgetTestIds };
@@ -0,0 +1,25 @@
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 { useOpenInvoicesAnalytics as t } from "../../../../data-access/dist/index2.js";
8
+ import "../../../../data-access/dist/index.js";
9
+ import { summarizeOpenInvoices as n } from "./summarizeOpenInvoices.js";
10
+ import { useMemo as r, useState as i } from "react";
11
+ // ../../libs/tesouro-embedded-components-react/quick-view-widget/invoices/feature/dist/lib/InvoicesQuickViewWidget/useOpenInvoicesSummary.js
12
+ var a = (e, t) => Object.keys(e).every((n) => e[n] === t[n]);
13
+ function o({ enabled: o } = {}) {
14
+ let s = t({ enabled: o }), { organizationId: c, authEpoch: l } = e(), u = r(() => s.data && n(s.data), [s.data]), [d, f] = i(), p = d !== void 0 && d.organizationId === c && d.authEpoch === l, m = u !== void 0 && (!s.isFetching && !s.isError || !p), h = p ? d.summary : u;
15
+ return m && !(p && a(d.summary, u)) && (f({
16
+ organizationId: c,
17
+ authEpoch: l,
18
+ summary: u
19
+ }), h = u), {
20
+ ...s,
21
+ data: h,
22
+ isLoading: s.isLoading && !h
23
+ };
24
+ }
25
+ export { o as useOpenInvoicesSummary };
@@ -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/invoices/feature/dist/lib/analytics/events.js
3
+ var t = `${e}.invoices_quick_view_widget`, n = { Mounted: `${t}.mounted` };
4
+ export { n as InvoicesQuickViewWidgetAnalyticsEvent, t as WIDGET_NAME };
@@ -0,0 +1,3 @@
1
+ import { INVOICES_QUICK_VIEW_TILE_LABELS_EN as e } from "./index2.js";
2
+ import { InvoicesQuickViewTile as t } from "./index3.js";
3
+ export { e as INVOICES_QUICK_VIEW_TILE_LABELS_EN, t as InvoicesQuickViewTile };
@@ -0,0 +1,8 @@
1
+ // ../../libs/tesouro-embedded-components-react/quick-view-widget/invoices/ui/dist/index2.js
2
+ var e = {
3
+ title: "Open invoices",
4
+ loadingLabel: "Loading invoices",
5
+ loadErrorTitle: "Couldn't load invoices",
6
+ loadErrorRetry: "Retry"
7
+ };
8
+ export { e as INVOICES_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 { INVOICES_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/invoices/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 InvoicesQuickViewTile };
@@ -0,0 +1,3 @@
1
+ // ../../libs/tesouro-embedded-components-react/quick-view-widget/shared/util/dist/lib/widgetName.js
2
+ var e = "quick_view_widget";
3
+ export { e as QUICK_VIEW_WIDGET_NAME };
@@ -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.9.59", n = "0ac8a1cbc8225efce2d9b14ff1577e94396bbda1", r = Object.freeze({
2
+ var e = "@tesouro/embedded-components-react", t = "0.10.0", n = "ce9c904f2a76c3538c8564674b39b8294404f0f2", r = Object.freeze({
3
3
  library_name: e,
4
4
  library_version: t,
5
5
  library_sha: n
@@ -6,11 +6,11 @@ import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
6
6
  import { ChevronRight as c } from "lucide-react";
7
7
  // ../../libs/tesouro-embedded-components-react/shared/quick-view/ui/dist/index3.js
8
8
  var l = "ttw:flex ttw:w-[320px] ttw:max-w-full ttw:flex-col ttw:gap-1 ttw:rounded-xl ttw:border ttw:border-border ttw:bg-card ttw:p-4 ttw:text-left ttw:text-card-foreground";
9
- function u({ title: u, value: d, subtext: f, linkText: p, onClick: m, isLoading: h = !1, isError: g = !1, onRetry: _, labels: v, testIds: y, className: b, style: x }) {
10
- let S = {
9
+ function u({ title: u, value: d, subtext: f, subtextTone: p = "muted", linkText: m, onClick: h, ariaLabel: g, isLoading: _ = !1, isError: v = !1, onRetry: y, labels: b, testIds: x, className: S, style: C }) {
10
+ let w = {
11
11
  ...i,
12
- ...v
13
- }, C = !!m && !h && !g, w = /* @__PURE__ */ s("span", {
12
+ ...b
13
+ }, T = !!h && !_ && !v, E = /* @__PURE__ */ s("span", {
14
14
  className: "ttw:flex ttw:items-center ttw:justify-between ttw:gap-2",
15
15
  children: [/* @__PURE__ */ o(t, {
16
16
  component: "span",
@@ -18,26 +18,26 @@ function u({ title: u, value: d, subtext: f, linkText: p, onClick: m, isLoading:
18
18
  color: "muted",
19
19
  className: "ttw:font-semibold",
20
20
  children: u
21
- }), C ? /* @__PURE__ */ o(c, {
21
+ }), T ? /* @__PURE__ */ o(c, {
22
22
  className: "ttw:size-4 ttw:shrink-0 ttw:text-muted-foreground",
23
23
  "aria-hidden": !0
24
24
  }) : null]
25
25
  });
26
- if (h) return /* @__PURE__ */ s("div", {
27
- className: n(l, b),
28
- style: x,
29
- "data-testid": y?.tile,
30
- children: [w, /* @__PURE__ */ s("div", {
26
+ if (_) return /* @__PURE__ */ s("div", {
27
+ className: n(l, S),
28
+ style: C,
29
+ "data-testid": x?.tile,
30
+ children: [E, /* @__PURE__ */ s("div", {
31
31
  role: "status",
32
32
  "aria-busy": !0,
33
33
  className: "ttw:flex ttw:flex-col ttw:gap-2",
34
34
  children: [
35
35
  /* @__PURE__ */ o("span", {
36
36
  className: "ttw:sr-only",
37
- children: S.loadingLabel
37
+ children: w.loadingLabel
38
38
  }),
39
39
  /* @__PURE__ */ o(e, {
40
- "data-testid": y?.skeleton,
40
+ "data-testid": x?.skeleton,
41
41
  height: 36,
42
42
  width: "60%",
43
43
  className: "ttw:rounded-md"
@@ -50,20 +50,20 @@ function u({ title: u, value: d, subtext: f, linkText: p, onClick: m, isLoading:
50
50
  ]
51
51
  })]
52
52
  });
53
- if (g) return /* @__PURE__ */ s("div", {
54
- className: n(l, b),
55
- style: x,
56
- "data-testid": y?.tile,
57
- children: [w, /* @__PURE__ */ o(r, {
58
- title: S.loadErrorTitle,
59
- retryLabel: S.loadErrorRetry,
60
- onRetry: _,
53
+ if (v) return /* @__PURE__ */ s("div", {
54
+ className: n(l, S),
55
+ style: C,
56
+ "data-testid": x?.tile,
57
+ children: [E, /* @__PURE__ */ o(r, {
58
+ title: w.loadErrorTitle,
59
+ retryLabel: w.loadErrorRetry,
60
+ onRetry: y,
61
61
  className: "ttw:px-0 ttw:py-4",
62
- testId: y?.error
62
+ testId: x?.error
63
63
  })]
64
64
  });
65
- let T = /* @__PURE__ */ s(a, { children: [
66
- w,
65
+ let D = /* @__PURE__ */ s(a, { children: [
66
+ E,
67
67
  /* @__PURE__ */ o(t, {
68
68
  component: "span",
69
69
  variant: "h6",
@@ -73,27 +73,28 @@ function u({ title: u, value: d, subtext: f, linkText: p, onClick: m, isLoading:
73
73
  f ? /* @__PURE__ */ o(t, {
74
74
  component: "span",
75
75
  variant: "body2",
76
- color: "muted",
77
- className: "ttw:block",
76
+ color: p,
77
+ className: n("ttw:block", p === "destructive" && "ttw:font-medium"),
78
78
  children: f
79
79
  }) : null,
80
- C ? /* @__PURE__ */ o("span", {
80
+ T && m ? /* @__PURE__ */ o("span", {
81
81
  className: "ttw:mt-3 ttw:text-sm ttw:font-medium ttw:text-primary ttw:group-hover:underline",
82
- children: p
82
+ children: m
83
83
  }) : null
84
84
  ] });
85
- return C ? /* @__PURE__ */ o("button", {
85
+ return T ? /* @__PURE__ */ o("button", {
86
86
  type: "button",
87
- onClick: m,
88
- "data-testid": y?.tile,
89
- style: x,
90
- className: n(l, "ttw:group ttw:cursor-pointer ttw:transition-colors ttw:hover:bg-accent/40 ttw:focus-visible:outline-none ttw:focus-visible:ring-2 ttw:focus-visible:ring-ring ttw:focus-visible:ring-offset-2", b),
91
- children: T
87
+ onClick: h,
88
+ "aria-label": g,
89
+ "data-testid": x?.tile,
90
+ style: C,
91
+ className: n(l, "ttw:group ttw:cursor-pointer ttw:transition-colors ttw:hover:bg-accent/40 ttw:focus-visible:outline-none ttw:focus-visible:ring-2 ttw:focus-visible:ring-ring ttw:focus-visible:ring-offset-2", S),
92
+ children: D
92
93
  }) : /* @__PURE__ */ o("div", {
93
- className: n(l, b),
94
- style: x,
95
- "data-testid": y?.tile,
96
- children: T
94
+ className: n(l, S),
95
+ style: C,
96
+ "data-testid": x?.tile,
97
+ children: D
97
98
  });
98
99
  }
99
100
  export { u as QuickViewTile };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tesouro/embedded-components-react",
3
- "version": "0.9.59",
3
+ "version": "0.10.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -1,4 +0,0 @@
1
- import { ACCOUNTS_QUICK_VIEW_WIDGET_LABELS_EN as e } from "../libs/tesouro-embedded-components-react/accounts-quick-view-widget/feature/dist/lib/AccountsQuickViewWidget/labels.js";
2
- import { AccountsQuickViewWidget as t } from "../libs/tesouro-embedded-components-react/accounts-quick-view-widget/feature/dist/lib/AccountsQuickViewWidget/AccountsQuickViewWidgetFeature.js";
3
- import "../libs/tesouro-embedded-components-react/accounts-quick-view-widget/feature/dist/index.js";
4
- export { e as ACCOUNTS_QUICK_VIEW_WIDGET_LABELS_EN, t as AccountsQuickViewWidget };
@@ -1,20 +0,0 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { isAllPagesResolving as e } from "../../../shared/data-access/dist/lib/allPages.js";
6
- import { useAllBankAccountsQuery as t } from "../../../shared/data-access/dist/lib/bank-account/useAllBankAccountsQuery.js";
7
- import "../../../shared/data-access/dist/index.js";
8
- // ../../libs/tesouro-embedded-components-react/accounts-quick-view-widget/data-access/dist/index2.js
9
- function n({ enabled: n } = {}) {
10
- let r = t({ enabled: n }), { data: i, isLoading: a, isError: o, isPlaceholderData: s, refetch: c } = r;
11
- return {
12
- accounts: i?.data,
13
- isLoading: a,
14
- isError: o,
15
- isPlaceholderData: s,
16
- isResolving: e(r),
17
- refetch: c
18
- };
19
- }
20
- export { n as useQuickViewBankAccountsQuery };
@@ -1,3 +0,0 @@
1
- // ../../libs/tesouro-embedded-components-react/accounts-quick-view-widget/feature/dist/lib/analytics/events.js
2
- var e = { Mounted: "accounts_quick_view_widget.mounted" }, t = "accounts_quick_view_widget";
3
- export { e as AccountsQuickViewWidgetAnalyticsEvent, t as WIDGET_NAME };