@burdenoff/microfe-headshotmarketing 2026.1102.1 → 2026.1107.2

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 (121) hide show
  1. package/dist/generated/wspace-operations.d.ts +575 -0
  2. package/dist/generated/wspace-operations.d.ts.map +1 -1
  3. package/dist/generated/wspace-operations.js +606 -345
  4. package/dist/generated/wspace-operations.js.map +1 -1
  5. package/dist/generated/wspace-types.d.ts +10195 -158
  6. package/dist/generated/wspace-types.d.ts.map +1 -1
  7. package/dist/generated/wspace-types.js +10 -6
  8. package/dist/generated/wspace-types.js.map +1 -1
  9. package/dist/headshotmarketing/hooks/useToast.js +25 -0
  10. package/dist/headshotmarketing/hooks/useToast.js.map +1 -0
  11. package/dist/headshotmarketing/pages/HomeMonthlyGoals.d.ts +9 -0
  12. package/dist/headshotmarketing/pages/HomeMonthlyGoals.d.ts.map +1 -0
  13. package/dist/headshotmarketing/pages/HomeMonthlyGoals.js +266 -0
  14. package/dist/headshotmarketing/pages/HomeMonthlyGoals.js.map +1 -0
  15. package/dist/headshotmarketing/pages/HomePage.d.ts.map +1 -1
  16. package/dist/headshotmarketing/pages/HomePage.js +299 -298
  17. package/dist/headshotmarketing/pages/HomePage.js.map +1 -1
  18. package/dist/headshotmarketing/pages/analytics/AnalyticsPage.d.ts.map +1 -1
  19. package/dist/headshotmarketing/pages/analytics/AnalyticsPage.js +171 -465
  20. package/dist/headshotmarketing/pages/analytics/AnalyticsPage.js.map +1 -1
  21. package/dist/headshotmarketing/pages/analytics/ReportsPage.d.ts.map +1 -1
  22. package/dist/headshotmarketing/pages/analytics/ReportsPage.js +541 -550
  23. package/dist/headshotmarketing/pages/analytics/ReportsPage.js.map +1 -1
  24. package/dist/headshotmarketing/pages/analytics/analyticsView.d.ts +153 -0
  25. package/dist/headshotmarketing/pages/analytics/analyticsView.d.ts.map +1 -0
  26. package/dist/headshotmarketing/pages/analytics/analyticsView.js +371 -0
  27. package/dist/headshotmarketing/pages/analytics/analyticsView.js.map +1 -0
  28. package/dist/headshotmarketing/pages/analytics/analyticsWidgets.d.ts +83 -0
  29. package/dist/headshotmarketing/pages/analytics/analyticsWidgets.d.ts.map +1 -0
  30. package/dist/headshotmarketing/pages/analytics/analyticsWidgets.js +592 -0
  31. package/dist/headshotmarketing/pages/analytics/analyticsWidgets.js.map +1 -0
  32. package/dist/headshotmarketing/pages/analytics/reportDraft.d.ts +40 -0
  33. package/dist/headshotmarketing/pages/analytics/reportDraft.d.ts.map +1 -0
  34. package/dist/headshotmarketing/pages/analytics/reportDraft.js +66 -0
  35. package/dist/headshotmarketing/pages/analytics/reportDraft.js.map +1 -0
  36. package/dist/headshotmarketing/pages/analytics/useAnalyticsData.d.ts +23 -0
  37. package/dist/headshotmarketing/pages/analytics/useAnalyticsData.d.ts.map +1 -0
  38. package/dist/headshotmarketing/pages/analytics/useAnalyticsData.js +68 -0
  39. package/dist/headshotmarketing/pages/analytics/useAnalyticsData.js.map +1 -0
  40. package/dist/headshotmarketing/utils/analyticsMapper.js +3 -42
  41. package/dist/headshotmarketing/utils/analyticsMapper.js.map +1 -1
  42. package/dist/headshotmarketing/utils/dashboardHome.d.ts +91 -0
  43. package/dist/headshotmarketing/utils/dashboardHome.d.ts.map +1 -0
  44. package/dist/headshotmarketing/utils/dashboardHome.js +94 -0
  45. package/dist/headshotmarketing/utils/dashboardHome.js.map +1 -0
  46. package/dist/node_modules/recharts/es6/util/ActiveShapeUtils.js +1 -1
  47. package/package.json +1 -1
  48. package/dist/node_modules/lodash/_arrayEach.js +0 -14
  49. package/dist/node_modules/lodash/_arrayEach.js.map +0 -1
  50. package/dist/node_modules/lodash/_assignValue.js +0 -17
  51. package/dist/node_modules/lodash/_assignValue.js.map +0 -1
  52. package/dist/node_modules/lodash/_baseAssign.js +0 -16
  53. package/dist/node_modules/lodash/_baseAssign.js.map +0 -1
  54. package/dist/node_modules/lodash/_baseAssignIn.js +0 -16
  55. package/dist/node_modules/lodash/_baseAssignIn.js.map +0 -1
  56. package/dist/node_modules/lodash/_baseClone.js +0 -64
  57. package/dist/node_modules/lodash/_baseClone.js.map +0 -1
  58. package/dist/node_modules/lodash/_baseCreate.js +0 -21
  59. package/dist/node_modules/lodash/_baseCreate.js.map +0 -1
  60. package/dist/node_modules/lodash/_baseIsMap.js +0 -16
  61. package/dist/node_modules/lodash/_baseIsMap.js.map +0 -1
  62. package/dist/node_modules/lodash/_baseIsSet.js +0 -16
  63. package/dist/node_modules/lodash/_baseIsSet.js.map +0 -1
  64. package/dist/node_modules/lodash/_baseKeysIn.js +0 -20
  65. package/dist/node_modules/lodash/_baseKeysIn.js.map +0 -1
  66. package/dist/node_modules/lodash/_baseUnset.js +0 -26
  67. package/dist/node_modules/lodash/_baseUnset.js.map +0 -1
  68. package/dist/node_modules/lodash/_cloneArrayBuffer.js +0 -16
  69. package/dist/node_modules/lodash/_cloneArrayBuffer.js.map +0 -1
  70. package/dist/node_modules/lodash/_cloneBuffer.js +0 -17
  71. package/dist/node_modules/lodash/_cloneBuffer.js.map +0 -1
  72. package/dist/node_modules/lodash/_cloneDataView.js +0 -16
  73. package/dist/node_modules/lodash/_cloneDataView.js.map +0 -1
  74. package/dist/node_modules/lodash/_cloneRegExp.js +0 -15
  75. package/dist/node_modules/lodash/_cloneRegExp.js.map +0 -1
  76. package/dist/node_modules/lodash/_cloneSymbol.js +0 -15
  77. package/dist/node_modules/lodash/_cloneSymbol.js.map +0 -1
  78. package/dist/node_modules/lodash/_cloneTypedArray.js +0 -16
  79. package/dist/node_modules/lodash/_cloneTypedArray.js.map +0 -1
  80. package/dist/node_modules/lodash/_copyArray.js +0 -15
  81. package/dist/node_modules/lodash/_copyArray.js.map +0 -1
  82. package/dist/node_modules/lodash/_copyObject.js +0 -22
  83. package/dist/node_modules/lodash/_copyObject.js.map +0 -1
  84. package/dist/node_modules/lodash/_copySymbols.js +0 -16
  85. package/dist/node_modules/lodash/_copySymbols.js.map +0 -1
  86. package/dist/node_modules/lodash/_copySymbolsIn.js +0 -16
  87. package/dist/node_modules/lodash/_copySymbolsIn.js.map +0 -1
  88. package/dist/node_modules/lodash/_customOmitClone.js +0 -15
  89. package/dist/node_modules/lodash/_customOmitClone.js.map +0 -1
  90. package/dist/node_modules/lodash/_flatRest.js +0 -17
  91. package/dist/node_modules/lodash/_flatRest.js.map +0 -1
  92. package/dist/node_modules/lodash/_getAllKeysIn.js +0 -17
  93. package/dist/node_modules/lodash/_getAllKeysIn.js.map +0 -1
  94. package/dist/node_modules/lodash/_getSymbolsIn.js +0 -18
  95. package/dist/node_modules/lodash/_getSymbolsIn.js.map +0 -1
  96. package/dist/node_modules/lodash/_initCloneArray.js +0 -15
  97. package/dist/node_modules/lodash/_initCloneArray.js.map +0 -1
  98. package/dist/node_modules/lodash/_initCloneByTag.js +0 -40
  99. package/dist/node_modules/lodash/_initCloneByTag.js.map +0 -1
  100. package/dist/node_modules/lodash/_initCloneObject.js +0 -17
  101. package/dist/node_modules/lodash/_initCloneObject.js.map +0 -1
  102. package/dist/node_modules/lodash/_nativeKeysIn.js +0 -15
  103. package/dist/node_modules/lodash/_nativeKeysIn.js.map +0 -1
  104. package/dist/node_modules/lodash/_parent.js +0 -16
  105. package/dist/node_modules/lodash/_parent.js.map +0 -1
  106. package/dist/node_modules/lodash/flatten.js +0 -15
  107. package/dist/node_modules/lodash/flatten.js.map +0 -1
  108. package/dist/node_modules/lodash/isMap.js +0 -14
  109. package/dist/node_modules/lodash/isMap.js.map +0 -1
  110. package/dist/node_modules/lodash/isSet.js +0 -14
  111. package/dist/node_modules/lodash/isSet.js.map +0 -1
  112. package/dist/node_modules/lodash/keysIn.js +0 -17
  113. package/dist/node_modules/lodash/keysIn.js.map +0 -1
  114. package/dist/node_modules/lodash/omit.js +0 -28
  115. package/dist/node_modules/lodash/omit.js.map +0 -1
  116. package/dist/node_modules/recharts/es6/chart/FunnelChart.js +0 -15
  117. package/dist/node_modules/recharts/es6/chart/FunnelChart.js.map +0 -1
  118. package/dist/node_modules/recharts/es6/numberAxis/Funnel.js +0 -370
  119. package/dist/node_modules/recharts/es6/numberAxis/Funnel.js.map +0 -1
  120. package/dist/node_modules/recharts/es6/util/FunnelUtils.js +0 -81
  121. package/dist/node_modules/recharts/es6/util/FunnelUtils.js.map +0 -1
@@ -1,583 +1,574 @@
1
- import { useHeadshotMarketing as e } from "../../context/HeadshotMarketingContext.js";
2
- import { Legend as t } from "../../../node_modules/recharts/es6/component/Legend.js";
3
- import { Tooltip as n } from "../../../node_modules/recharts/es6/component/Tooltip.js";
4
- import { ResponsiveContainer as r } from "../../../node_modules/recharts/es6/component/ResponsiveContainer.js";
5
- import { Bar as i } from "../../../node_modules/recharts/es6/cartesian/Bar.js";
6
- import { CartesianGrid as a } from "../../../node_modules/recharts/es6/cartesian/CartesianGrid.js";
7
- import { Area as o } from "../../../node_modules/recharts/es6/cartesian/Area.js";
8
- import { XAxis as s } from "../../../node_modules/recharts/es6/cartesian/XAxis.js";
9
- import { YAxis as c } from "../../../node_modules/recharts/es6/cartesian/YAxis.js";
10
- import { BarChart as ee } from "../../../node_modules/recharts/es6/chart/BarChart.js";
11
- import { AreaChart as l } from "../../../node_modules/recharts/es6/chart/AreaChart.js";
12
- import { Funnel as u } from "../../../node_modules/recharts/es6/numberAxis/Funnel.js";
13
- import { FunnelChart as d } from "../../../node_modules/recharts/es6/chart/FunnelChart.js";
14
- import { exportRowsToCsv as f, formatCurrency as p, formatNumber as m, formatPercentage as h } from "../../utils/helpers.js";
15
- import { toCampaignModel as g } from "../../utils/campaignMapper.js";
16
- import { toAdCampaignModel as _ } from "../../utils/adsMapper.js";
17
- import { toCampaignTimeSeries as v, toChannelPerformance as y, toFunnelStages as b } from "../../utils/analyticsMapper.js";
18
- import { PageLayout as te } from "../../components/PageLayout.js";
19
- import { StatCard as x } from "../../components/StatCard.js";
20
- import { DataTable as S } from "../../components/DataTable.js";
21
- import { StatusBadge as ne } from "../../components/StatusBadge.js";
22
- import { ChartCard as C } from "../../components/ChartCard.js";
23
- import { QueryStateBoundary as re } from "../../components/QueryStateBoundary.js";
1
+ import { useHeadshotmarketingCreateSavedReportMutation as e, useHeadshotmarketingDeleteSavedReportMutation as t, useHeadshotmarketingSavedReportQuery as n, useHeadshotmarketingSavedReportsQuery as r, useHeadshotmarketingUpdateSavedReportMutation as i } from "../../../generated/wspace-operations.js";
2
+ import { useHeadshotMarketing as a } from "../../context/HeadshotMarketingContext.js";
3
+ import { cn as o, exportRowsToCsv as s } from "../../utils/helpers.js";
4
+ import { PageLayout as c } from "../../components/PageLayout.js";
5
+ import { Modal as l } from "../../components/Modal.js";
6
+ import { ConfirmDeleteDialog as u } from "../../components/ConfirmDeleteDialog.js";
7
+ import { ToastContainer as d } from "../../components/Toast.js";
8
+ import { QueryStateBoundary as ee } from "../../components/QueryStateBoundary.js";
24
9
  import "../../components/index.js";
25
- import { useHeadshotmarketingBootstrap as ie } from "../../hooks/useHeadshotmarketingBootstrap.js";
26
- import { ArrowUpRight as ae, BarChart3 as w, DollarSign as T, Download as E, FileDown as oe, Filter as se, Percent as ce, Share2 as le, Target as D, TrendingUp as O, Users as ue } from "lucide-react";
27
- import { jsx as k, jsxs as A } from "react/jsx-runtime";
28
- import { EmphasisPanel as j, GradientText as de, PagePurpose as fe } from "@burdenoff/fe-libs/ui";
10
+ import { analyticsCsvRows as te, dateRangeLabel as f, formatWindow as ne, resolveDateWindow as re } from "./analyticsView.js";
11
+ import { AnalyticsSourceNotice as ie, DateRangeControl as p, ReportWidgetView as ae, WIDGET_META as m } from "./analyticsWidgets.js";
12
+ import { useAnalyticsData as oe } from "./useAnalyticsData.js";
13
+ import { useToast as se } from "../../hooks/useToast.js";
14
+ import { EXECUTIVE_SUMMARY as h, WIDGET_ORDER as g, draftFrom as _, reportShareUrl as ce, toReportInput as le, toggleWidget as ue, validateDraft as de } from "./reportDraft.js";
15
+ import { useMemo as fe, useState as v } from "react";
16
+ import { ArrowUpRight as pe, BarChart3 as y, DollarSign as b, Download as me, FileDown as he, FileText as ge, Pencil as _e, Plus as x, Share2 as S, Target as C, Trash2 as ve, TrendingUp as w, Users as T } from "lucide-react";
17
+ import { useSearchParams as ye } from "react-router";
18
+ import { Fragment as E, jsx as D, jsxs as O } from "react/jsx-runtime";
19
+ import { EmphasisPanel as k, GradientText as be, PagePurpose as xe } from "@burdenoff/fe-libs/ui";
29
20
  //#region src/headshotmarketing/pages/analytics/ReportsPage.tsx
30
- var M = [
31
- "var(--color-chart-1)",
32
- "var(--color-chart-2)",
33
- "var(--color-chart-3)",
34
- "var(--color-chart-4)",
35
- "var(--color-chart-5)",
36
- "var(--color-chart-6)"
37
- ], N = {
38
- background: "var(--color-bg-surface)",
39
- border: "1px solid var(--color-border-seam)",
40
- borderRadius: "0.5rem",
41
- boxShadow: "var(--shadow-pop)",
42
- color: "var(--color-text-primary)",
43
- fontSize: "0.75rem"
44
- }, P = { color: "var(--color-text-secondary)" }, F = { color: "var(--color-text-primary)" }, I = (e) => e.length === 0 ? e : e.charAt(0).toUpperCase() + e.slice(1), L = ({ icon: e, message: t, height: n }) => /* @__PURE__ */ A("div", {
45
- className: "flex flex-col items-center justify-center gap-2 text-center",
46
- style: { height: n },
47
- children: [/* @__PURE__ */ k("span", {
48
- className: "text-text-secondary/70",
49
- children: e
50
- }), /* @__PURE__ */ k("p", {
51
- className: "text-xs text-text-secondary",
52
- children: t
53
- })]
54
- }), R = () => {
55
- let { navigate: R, basePath: z } = e(), { data: B, loading: V, error: pe, refetch: me } = ie(), H = (B?.headshotmarketingCampaigns.items ?? []).map((e) => g(e)), U = y(H, (B?.headshotmarketingAdCampaigns.items ?? []).map((e) => _(e))), W = U.reduce((e, t) => e + t.revenue, 0), G = U.reduce((e, t) => e + t.cost, 0), K = U.reduce((e, t) => e + t.conversions, 0), q = U.reduce((e, t) => e + t.impressions, 0), J = U.reduce((e, t) => e + t.clicks, 0), he = G > 0 ? W / G : 0, ge = q > 0 ? J / q * 100 : 0, Y = v(H), X = b(q, J, K), _e = X[0]?.value ?? 0, ve = X.map((e) => ({
56
- stage: e.stage,
57
- value: e.value,
58
- fill: e.color
59
- })), ye = U.slice(0, 6).map((e) => ({
60
- channel: I(e.channel),
61
- revenue: e.revenue,
62
- cost: e.cost
63
- })), Z = !!B, be = Y.length > 0, xe = U.length > 0, Se = _e > 0, Q = U.length > 0, Ce = H.length > 0, we = Y.length > 1 ? `${Y[0].date} – ${Y[Y.length - 1].date}` : "Live marketing performance", $ = () => {
64
- f("channel-performance", [
65
- "Channel",
66
- "Revenue",
67
- "Cost",
68
- "Conversions",
69
- "ROAS",
70
- "CTR",
71
- "Impressions",
72
- "Clicks"
73
- ], U.map((e) => [
74
- e.channel,
75
- e.revenue,
76
- e.cost,
77
- e.conversions,
78
- `${e.roas.toFixed(2)}x`,
79
- `${e.ctr.toFixed(2)}%`,
80
- e.impressions,
81
- e.clicks
82
- ]));
83
- }, Te = () => {
84
- f("campaign-performance", [
85
- "Campaign",
86
- "Type",
87
- "Status",
88
- "Revenue",
89
- "Cost",
90
- "Conversions",
91
- "ROAS"
92
- ], H.map((e) => [
93
- e.name,
94
- e.type,
95
- e.status,
96
- e.metrics.revenue,
97
- e.metrics.cost,
98
- e.metrics.conversions,
99
- `${e.metrics.roas.toFixed(2)}x`
100
- ]));
101
- }, Ee = () => {
102
- let e = document.title;
103
- document.title = `Headshot Marketing Report — ${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}`, window.print(), document.title = e;
104
- }, De = [
105
- {
106
- key: "channel",
107
- header: "Channel",
108
- sortable: !0,
109
- render: (e) => /* @__PURE__ */ A("div", {
110
- className: "flex items-center gap-2",
111
- children: [/* @__PURE__ */ k("div", {
112
- className: "h-3 w-3 rounded-full",
113
- style: { backgroundColor: e.color }
114
- }), /* @__PURE__ */ k("span", {
115
- className: "font-medium text-text-primary capitalize",
116
- children: e.channel
117
- })]
21
+ var A = ["HeadshotmarketingSavedReports", "HeadshotmarketingSavedReport"], j = 100, M = "inline-flex min-h-[40px] items-center gap-2 rounded-md border border-border-seam bg-bg-surface px-3 py-2 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken disabled:cursor-not-allowed disabled:opacity-60";
22
+ function Se(e) {
23
+ return {
24
+ name: e.name,
25
+ description: e.description ?? null,
26
+ widgets: e.widgets,
27
+ dateRange: e.dateRange,
28
+ customStartDate: e.customStartDate ?? null,
29
+ customEndDate: e.customEndDate ?? null
30
+ };
31
+ }
32
+ var N = (e) => e instanceof Error ? e.message : "Something went wrong.", Ce = ({ open: e, title: t, submitLabel: n, draft: r, onChange: i, errors: a, serverError: s, saving: c, onClose: u, onSubmit: d }) => /* @__PURE__ */ D(l, {
33
+ open: e,
34
+ onClose: u,
35
+ title: t,
36
+ description: "Choose what the report shows and the period it covers.",
37
+ size: "lg",
38
+ footer: /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D("button", {
39
+ type: "button",
40
+ onClick: u,
41
+ disabled: c,
42
+ className: M,
43
+ children: "Cancel"
44
+ }), /* @__PURE__ */ D("button", {
45
+ type: "button",
46
+ onClick: d,
47
+ disabled: c,
48
+ className: "inline-flex min-h-[40px] items-center gap-2 rounded-md bg-action-primary-bg px-4 py-2 text-sm font-medium text-action-primary-text transition-colors hover:bg-action-primary-bg/90 disabled:cursor-not-allowed disabled:opacity-60",
49
+ children: c ? "Saving…" : n
50
+ })] }),
51
+ children: /* @__PURE__ */ O("div", {
52
+ className: "space-y-5",
53
+ children: [
54
+ /* @__PURE__ */ O("div", { children: [
55
+ /* @__PURE__ */ D("label", {
56
+ htmlFor: "hm-report-name",
57
+ className: "mb-1 block text-sm font-medium text-text-primary",
58
+ children: "Name"
59
+ }),
60
+ /* @__PURE__ */ D("input", {
61
+ id: "hm-report-name",
62
+ value: r.name,
63
+ onChange: (e) => i({
64
+ ...r,
65
+ name: e.target.value
66
+ }),
67
+ "aria-invalid": !!a.name,
68
+ className: o("min-h-[44px] w-full rounded-md border bg-bg-surface px-3 py-2 text-sm text-text-primary", a.name ? "border-status-error-border" : "border-border-seam"),
69
+ placeholder: "e.g. Weekly Executive Summary"
70
+ }),
71
+ a.name && /* @__PURE__ */ D("p", {
72
+ className: "mt-1 text-xs text-status-error-text",
73
+ children: a.name
74
+ })
75
+ ] }),
76
+ /* @__PURE__ */ O("div", { children: [
77
+ /* @__PURE__ */ O("label", {
78
+ htmlFor: "hm-report-description",
79
+ className: "mb-1 block text-sm font-medium text-text-primary",
80
+ children: ["Description ", /* @__PURE__ */ D("span", {
81
+ className: "text-text-secondary",
82
+ children: "(optional)"
83
+ })]
84
+ }),
85
+ /* @__PURE__ */ D("textarea", {
86
+ id: "hm-report-description",
87
+ value: r.description,
88
+ onChange: (e) => i({
89
+ ...r,
90
+ description: e.target.value
91
+ }),
92
+ rows: 2,
93
+ "aria-invalid": !!a.description,
94
+ className: o("w-full rounded-md border bg-bg-surface px-3 py-2 text-sm text-text-primary", a.description ? "border-status-error-border" : "border-border-seam")
95
+ }),
96
+ a.description && /* @__PURE__ */ D("p", {
97
+ className: "mt-1 text-xs text-status-error-text",
98
+ children: a.description
99
+ })
100
+ ] }),
101
+ /* @__PURE__ */ O("div", { children: [
102
+ /* @__PURE__ */ D("p", {
103
+ className: "mb-1 text-sm font-medium text-text-primary",
104
+ children: "Period"
105
+ }),
106
+ /* @__PURE__ */ D(p, {
107
+ idPrefix: "hm-report-editor",
108
+ value: {
109
+ preset: r.dateRange,
110
+ customStart: r.customStart,
111
+ customEnd: r.customEnd
112
+ },
113
+ onChange: (e) => i({
114
+ ...r,
115
+ dateRange: e.preset,
116
+ customStart: e.customStart,
117
+ customEnd: e.customEnd
118
+ }),
119
+ invalid: !!a.dateRange
120
+ }),
121
+ a.dateRange && /* @__PURE__ */ D("p", {
122
+ className: "mt-1 text-xs text-status-error-text",
123
+ children: a.dateRange
124
+ })
125
+ ] }),
126
+ /* @__PURE__ */ O("fieldset", { children: [
127
+ /* @__PURE__ */ D("legend", {
128
+ className: "mb-2 text-sm font-medium text-text-primary",
129
+ children: "Widgets"
130
+ }),
131
+ /* @__PURE__ */ D("div", {
132
+ className: "grid grid-cols-1 gap-2 sm:grid-cols-2",
133
+ children: g.map((e) => {
134
+ let t = m[e], n = r.widgets.includes(e);
135
+ return /* @__PURE__ */ O("label", {
136
+ className: o("flex cursor-pointer items-start gap-3 rounded-lg border p-3 transition-colors", n ? "border-action-primary-bg bg-bg-sunken/40" : "border-border-seam hover:bg-bg-sunken/30"),
137
+ children: [/* @__PURE__ */ D("input", {
138
+ type: "checkbox",
139
+ checked: n,
140
+ onChange: () => i({
141
+ ...r,
142
+ widgets: ue(r.widgets, e)
143
+ }),
144
+ className: "mt-0.5 h-4 w-4"
145
+ }), /* @__PURE__ */ O("span", {
146
+ className: "min-w-0",
147
+ children: [/* @__PURE__ */ O("span", {
148
+ className: "flex items-center gap-1.5 text-sm font-medium text-text-primary",
149
+ children: [t.icon, t.label]
150
+ }), /* @__PURE__ */ D("span", {
151
+ className: "mt-0.5 block text-xs text-text-secondary",
152
+ children: t.description
153
+ })]
154
+ })]
155
+ }, e);
156
+ })
157
+ }),
158
+ a.widgets && /* @__PURE__ */ D("p", {
159
+ className: "mt-1 text-xs text-status-error-text",
160
+ children: a.widgets
161
+ })
162
+ ] }),
163
+ s && /* @__PURE__ */ D("p", {
164
+ role: "alert",
165
+ className: "rounded-lg border border-status-error-border px-4 py-3 text-sm text-status-error-text",
166
+ children: s
118
167
  })
119
- },
120
- {
121
- key: "revenue",
122
- header: "Revenue",
123
- sortable: !0,
124
- render: (e) => p(e.revenue)
125
- },
126
- {
127
- key: "cost",
128
- header: "Cost",
129
- sortable: !0,
130
- render: (e) => p(e.cost)
131
- },
132
- {
133
- key: "conversions",
134
- header: "Conversions",
135
- sortable: !0,
136
- render: (e) => m(e.conversions)
137
- },
138
- {
139
- key: "roas",
140
- header: "ROAS",
141
- sortable: !0,
142
- render: (e) => `${e.roas.toFixed(1)}x`
143
- },
144
- {
145
- key: "ctr",
146
- header: "CTR",
147
- sortable: !0,
148
- render: (e) => h(e.ctr)
168
+ ]
169
+ })
170
+ }), we = [
171
+ {
172
+ id: "campaigns",
173
+ name: "Campaign performance",
174
+ description: "Revenue, conversions and ROAS by campaign.",
175
+ icon: /* @__PURE__ */ D(C, { className: "h-5 w-5" }),
176
+ segment: "/analytics/campaigns"
177
+ },
178
+ {
179
+ id: "channels",
180
+ name: "Channel analytics",
181
+ description: "Revenue, ROAS and attribution by channel.",
182
+ icon: /* @__PURE__ */ D(y, { className: "h-5 w-5" }),
183
+ segment: "/analytics"
184
+ },
185
+ {
186
+ id: "ads",
187
+ name: "Ad performance",
188
+ description: "Paid spend, CPC and ROAS by platform.",
189
+ icon: /* @__PURE__ */ D(w, { className: "h-5 w-5" }),
190
+ segment: "/analytics/ads"
191
+ },
192
+ {
193
+ id: "social",
194
+ name: "Social digest",
195
+ description: "Reach, engagement and top posts by platform.",
196
+ icon: /* @__PURE__ */ D(S, { className: "h-5 w-5" }),
197
+ segment: "/analytics/social"
198
+ },
199
+ {
200
+ id: "attribution",
201
+ name: "Attribution",
202
+ description: "Which touches earned your won revenue.",
203
+ icon: /* @__PURE__ */ D(T, { className: "h-5 w-5" }),
204
+ segment: "/analytics/attribution"
205
+ },
206
+ {
207
+ id: "pipeline",
208
+ name: "Lead pipeline",
209
+ description: "Deals and value across your CRM pipeline.",
210
+ icon: /* @__PURE__ */ D(b, { className: "h-5 w-5" }),
211
+ segment: "/crm/pipeline"
212
+ }
213
+ ], P = () => {
214
+ let { navigate: l, basePath: p } = a(), [g, ue] = ye(), y = g.get("report"), { toasts: b, toast: C, dismiss: w } = se(), [T] = v(() => /* @__PURE__ */ new Date()), P = r({
215
+ variables: { pagination: { limit: j } },
216
+ fetchPolicy: "cache-and-network"
217
+ }), [Te, F] = v(!1), I = P.data?.headshotmarketingSavedReports.items ?? [], L = P.data?.headshotmarketingSavedReports.total, Ee = P.data?.headshotmarketingSavedReports.hasMore ?? !1, R = I.find((e) => e.id === y) ?? null, De = !P.loading && P.data !== void 0, z = y !== null && R === null && De, B = n({
218
+ variables: { id: y ?? "" },
219
+ skip: !z,
220
+ fetchPolicy: "cache-and-network"
221
+ }), V = R ?? (z ? B.data?.headshotmarketingSavedReport ?? null : null), Oe = z && V === null && !B.loading && (B.data !== void 0 || B.error !== void 0), H = V ? Se(V) : h, U = fe(() => re(H.dateRange, T, H.customStartDate, H.customEndDate), [
222
+ H.dateRange,
223
+ H.customStartDate,
224
+ H.customEndDate,
225
+ T
226
+ ]), W = U ? ne(U) : "—", G = oe(U, 10), [K, q] = v(null), [ke, J] = v(!1), [Ae, Y] = v(null), [je, X] = v(!1), [Me, Z] = v(null), [Ne, Pe] = e({
227
+ refetchQueries: A,
228
+ awaitRefetchQueries: !0
229
+ }), [Fe, Ie] = i({
230
+ refetchQueries: A,
231
+ awaitRefetchQueries: !0
232
+ }), [Le, Re] = t({
233
+ refetchQueries: A,
234
+ awaitRefetchQueries: !0
235
+ }), ze = async () => {
236
+ F(!0);
237
+ try {
238
+ await P.fetchMore({
239
+ variables: { pagination: {
240
+ limit: j,
241
+ offset: I.length
242
+ } },
243
+ updateQuery: (e, { fetchMoreResult: t }) => {
244
+ let n = new Set(e.headshotmarketingSavedReports.items.map((e) => e.id));
245
+ return {
246
+ ...t,
247
+ headshotmarketingSavedReports: {
248
+ ...t.headshotmarketingSavedReports,
249
+ items: [...e.headshotmarketingSavedReports.items, ...t.headshotmarketingSavedReports.items.filter((e) => !n.has(e.id))]
250
+ }
251
+ };
252
+ }
253
+ });
254
+ } catch (e) {
255
+ C({
256
+ title: "More reports could not be loaded",
257
+ description: N(e),
258
+ variant: "error"
259
+ });
260
+ } finally {
261
+ F(!1);
149
262
  }
150
- ], Oe = [
151
- {
152
- key: "name",
153
- header: "Campaign",
154
- sortable: !0,
155
- render: (e) => /* @__PURE__ */ k("span", {
156
- className: "font-medium text-text-primary",
157
- children: e.name
158
- })
159
- },
160
- {
161
- key: "status",
162
- header: "Status",
163
- render: (e) => /* @__PURE__ */ k(ne, { status: e.status })
164
- },
165
- {
166
- key: "revenue",
167
- header: "Revenue",
168
- sortable: !0,
169
- render: (e) => p(e.metrics.revenue)
170
- },
171
- {
172
- key: "conversions",
173
- header: "Conversions",
174
- sortable: !0,
175
- render: (e) => m(e.metrics.conversions)
176
- },
177
- {
178
- key: "roas",
179
- header: "ROAS",
180
- sortable: !0,
181
- render: (e) => `${e.metrics.roas.toFixed(1)}x`
263
+ }, Q = (e) => {
264
+ let t = new URLSearchParams(g);
265
+ e ? t.set("report", e) : t.delete("report"), ue(t);
266
+ }, $ = (e, t) => {
267
+ J(!1), Y(null), q({
268
+ reportId: e,
269
+ draft: t
270
+ });
271
+ }, Be = K ? de(K.draft, T) : {}, Ve = async () => {
272
+ if (!K || (J(!0), Object.keys(Be).length > 0)) return;
273
+ Y(null);
274
+ let e = le(K.draft);
275
+ try {
276
+ if (K.reportId) await Fe({ variables: {
277
+ id: K.reportId,
278
+ input: e
279
+ } }), C({
280
+ title: "Report updated",
281
+ variant: "success"
282
+ });
283
+ else {
284
+ let t = (await Ne({ variables: { input: e } })).data?.headshotmarketingCreateSavedReport.id;
285
+ C({
286
+ title: "Report saved",
287
+ variant: "success"
288
+ }), t && Q(t);
289
+ }
290
+ q(null);
291
+ } catch (e) {
292
+ Y(N(e));
293
+ }
294
+ }, He = async () => {
295
+ if (V) {
296
+ Z(null);
297
+ try {
298
+ await Le({ variables: { id: V.id } }), X(!1), Q(null), C({
299
+ title: "Report deleted",
300
+ variant: "success"
301
+ });
302
+ } catch (e) {
303
+ Z(N(e));
304
+ }
182
305
  }
183
- ], ke = [
184
- {
185
- id: "campaigns",
186
- name: "Campaign performance",
187
- description: "Revenue, conversions and ROAS by campaign.",
188
- icon: /* @__PURE__ */ k(D, { className: "h-5 w-5" }),
189
- segment: "/analytics/campaigns"
190
- },
191
- {
192
- id: "channels",
193
- name: "Channel breakdown",
194
- description: "Where revenue and spend land across channels.",
195
- icon: /* @__PURE__ */ k(w, { className: "h-5 w-5" }),
196
- segment: "/analytics"
197
- },
198
- {
199
- id: "ads",
200
- name: "Ad performance",
201
- description: "Paid spend, CPC and ROAS by platform.",
202
- icon: /* @__PURE__ */ k(O, { className: "h-5 w-5" }),
203
- segment: "/analytics/ads"
204
- },
205
- {
206
- id: "social",
207
- name: "Social digest",
208
- description: "Reach, engagement and top posts by platform.",
209
- icon: /* @__PURE__ */ k(le, { className: "h-5 w-5" }),
210
- segment: "/analytics/social"
211
- },
212
- {
213
- id: "audience",
214
- name: "Audience insights",
215
- description: "Geography and device breakdown for your traffic.",
216
- icon: /* @__PURE__ */ k(ue, { className: "h-5 w-5" }),
217
- segment: "/analytics"
218
- },
219
- {
220
- id: "pipeline",
221
- name: "Lead pipeline",
222
- description: "Deals and value across your CRM pipeline.",
223
- icon: /* @__PURE__ */ k(T, { className: "h-5 w-5" }),
224
- segment: "/crm/pipeline"
306
+ }, Ue = async () => {
307
+ if (!V) return;
308
+ let e = ce(globalThis.location.href, V.id);
309
+ try {
310
+ await navigator.clipboard.writeText(e), C({
311
+ title: "Link copied",
312
+ description: "Anyone in this workspace with access to reports can open it.",
313
+ variant: "success"
314
+ });
315
+ } catch {
316
+ C({
317
+ title: "Copy this link to share the report",
318
+ description: e
319
+ });
225
320
  }
226
- ];
227
- return /* @__PURE__ */ A(te, {
228
- title: "Reports & Exports",
229
- description: "Live marketing performance you can read, export or share",
321
+ }, We = () => {
322
+ let { headers: e, rows: t } = te({
323
+ title: H.name,
324
+ windowLabel: W,
325
+ view: G.view,
326
+ attribution: G.attribution
327
+ });
328
+ s(H.name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "report", e, t);
329
+ }, Ge = () => {
330
+ let e = document.title;
331
+ document.title = `${H.name} — ${W}`, globalThis.print(), document.title = e;
332
+ }, Ke = Pe.loading || Ie.loading;
333
+ return /* @__PURE__ */ O(c, {
334
+ title: "Reports",
335
+ description: "Saved reports you can open, share and export",
336
+ actions: /* @__PURE__ */ O("button", {
337
+ type: "button",
338
+ onClick: () => $(null, _(h, T, "New report")),
339
+ className: "inline-flex min-h-[44px] items-center gap-2 rounded-md bg-action-primary-bg px-4 py-2.5 text-sm font-medium text-action-primary-text transition-colors hover:bg-action-primary-bg/90",
340
+ children: [/* @__PURE__ */ D(x, { className: "h-4 w-4" }), "New Report"]
341
+ }),
230
342
  children: [
231
- /* @__PURE__ */ k(fe, { children: "Turn your marketing data into something you can share. This page composes a live executive summary from the same channel and campaign performance that powers analytics — read it as KPIs, trend, comparison and funnel visualizations, export any table to CSV, save the whole report to PDF, or jump into the full interactive view." }),
232
- /* @__PURE__ */ A(re, {
233
- loading: V,
234
- error: pe,
235
- onRetry: me,
236
- hasData: Z,
237
- children: [
238
- /* @__PURE__ */ A(j, { children: [/* @__PURE__ */ A("div", {
239
- className: "flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",
240
- children: [/* @__PURE__ */ A("div", { children: [
241
- /* @__PURE__ */ A("span", {
242
- className: "inline-flex items-center gap-1.5 rounded-full border border-border-seam bg-bg-surface/60 px-2.5 py-0.5 text-xs font-medium text-text-secondary",
243
- children: [/* @__PURE__ */ A("span", {
244
- className: "relative flex h-2 w-2",
245
- children: [/* @__PURE__ */ k("span", { className: "absolute inline-flex h-full w-full animate-ping rounded-full bg-status-success-text opacity-60" }), /* @__PURE__ */ k("span", { className: "relative inline-flex h-2 w-2 rounded-full bg-status-success-text" })]
246
- }), "Live report"]
247
- }),
248
- /* @__PURE__ */ k("h2", {
249
- className: "mt-2 text-xl font-bold tracking-tight",
250
- children: /* @__PURE__ */ k(de, { children: "Executive Summary" })
251
- }),
252
- /* @__PURE__ */ k("p", {
253
- className: "text-sm text-text-secondary mt-0.5",
254
- children: we
255
- })
256
- ] }), /* @__PURE__ */ A("div", {
257
- className: "flex flex-wrap items-center gap-2",
258
- children: [/* @__PURE__ */ A("button", {
343
+ /* @__PURE__ */ D(xe, { children: "Save the views your team reads every week. A report keeps its widgets and period — for example the last 30 days — and always shows the latest numbers for that period. Share a link with your workspace, export it to CSV or save it as a PDF." }),
344
+ /* @__PURE__ */ O("div", {
345
+ className: "grid grid-cols-1 gap-6 lg:grid-cols-[300px_minmax(0,1fr)]",
346
+ children: [/* @__PURE__ */ O("aside", {
347
+ "aria-label": "Reports",
348
+ className: "h-fit rounded-lg border border-border-seam bg-gloss-card p-3 shadow-pop",
349
+ children: [
350
+ /* @__PURE__ */ D("h2", {
351
+ className: "px-2 pb-2 pt-1 text-sm font-semibold text-text-secondary",
352
+ children: "Reports"
353
+ }),
354
+ /* @__PURE__ */ O("ul", {
355
+ className: "space-y-1",
356
+ children: [/* @__PURE__ */ D("li", { children: /* @__PURE__ */ O("button", {
259
357
  type: "button",
260
- onClick: $,
261
- disabled: !Q,
262
- title: Q ? "Download channel performance as a CSV file" : "No performance data to export yet",
263
- className: "inline-flex min-h-[44px] items-center gap-2 rounded-md border border-border-seam bg-bg-surface px-4 py-2.5 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken disabled:cursor-not-allowed disabled:opacity-60",
264
- children: [/* @__PURE__ */ k(E, { className: "h-4 w-4" }), "Export CSV"]
265
- }), /* @__PURE__ */ A("button", {
358
+ onClick: () => Q(null),
359
+ "aria-current": V === null ? "true" : void 0,
360
+ className: o("w-full rounded-md px-3 py-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]", V === null ? "bg-bg-sunken" : "hover:bg-bg-sunken/50"),
361
+ children: [/* @__PURE__ */ D("span", {
362
+ className: "block text-sm font-medium text-text-primary",
363
+ children: h.name
364
+ }), /* @__PURE__ */ O("span", {
365
+ className: "mt-1 inline-flex items-center gap-2 text-xs text-text-secondary",
366
+ children: [/* @__PURE__ */ D("span", {
367
+ className: "rounded bg-action-primary-bg px-1.5 py-0.5 text-action-primary-text",
368
+ children: "Built-in"
369
+ }), f(h.dateRange)]
370
+ })]
371
+ }) }), I.map((e) => /* @__PURE__ */ D("li", { children: /* @__PURE__ */ O("button", {
266
372
  type: "button",
267
- onClick: Ee,
268
- disabled: !Z,
269
- title: Z ? "Save this report as a PDF (opens your browser's print dialog)" : "No report to export yet",
270
- className: "inline-flex min-h-[44px] items-center gap-2 rounded-md bg-action-primary-bg px-4 py-2.5 text-sm font-medium text-action-primary-text transition-colors hover:bg-action-primary-bg/90 disabled:cursor-not-allowed disabled:opacity-60",
271
- children: [/* @__PURE__ */ k(oe, { className: "h-4 w-4" }), "Export PDF"]
272
- })]
273
- })]
274
- }), /* @__PURE__ */ A("div", {
275
- className: "mt-6 grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-5",
276
- children: [
277
- /* @__PURE__ */ k(x, {
278
- title: "Total Revenue",
279
- value: p(W),
280
- icon: /* @__PURE__ */ k(T, { className: "h-4 w-4" }),
281
- featured: !0
282
- }),
283
- /* @__PURE__ */ k(x, {
284
- title: "Total Cost",
285
- value: p(G),
286
- icon: /* @__PURE__ */ k(w, { className: "h-4 w-4" })
287
- }),
288
- /* @__PURE__ */ k(x, {
289
- title: "Conversions",
290
- value: m(K),
291
- icon: /* @__PURE__ */ k(D, { className: "h-4 w-4" })
292
- }),
293
- /* @__PURE__ */ k(x, {
294
- title: "Avg ROAS",
295
- value: `${he.toFixed(1)}x`,
296
- icon: /* @__PURE__ */ k(O, { className: "h-4 w-4" })
297
- }),
298
- /* @__PURE__ */ k(x, {
299
- title: "Avg CTR",
300
- value: h(ge),
301
- icon: /* @__PURE__ */ k(ce, { className: "h-4 w-4" })
302
- })
303
- ]
304
- })] }),
305
- /* @__PURE__ */ A("div", {
306
- className: "grid grid-cols-1 gap-6 lg:grid-cols-2",
307
- children: [/* @__PURE__ */ k(C, {
308
- title: "Performance Trend",
309
- subtitle: "Revenue and cost over time",
310
- children: be ? /* @__PURE__ */ k(r, {
311
- width: "100%",
312
- height: 260,
313
- children: /* @__PURE__ */ A(l, {
314
- data: Y,
315
- children: [
316
- /* @__PURE__ */ A("defs", { children: [/* @__PURE__ */ A("linearGradient", {
317
- id: "hmk-report-revenue",
318
- x1: "0",
319
- y1: "0",
320
- x2: "0",
321
- y2: "1",
322
- children: [/* @__PURE__ */ k("stop", {
323
- offset: "5%",
324
- stopColor: M[0],
325
- stopOpacity: .35
326
- }), /* @__PURE__ */ k("stop", {
327
- offset: "95%",
328
- stopColor: M[0],
329
- stopOpacity: 0
330
- })]
331
- }), /* @__PURE__ */ A("linearGradient", {
332
- id: "hmk-report-cost",
333
- x1: "0",
334
- y1: "0",
335
- x2: "0",
336
- y2: "1",
337
- children: [/* @__PURE__ */ k("stop", {
338
- offset: "5%",
339
- stopColor: M[3],
340
- stopOpacity: .3
341
- }), /* @__PURE__ */ k("stop", {
342
- offset: "95%",
343
- stopColor: M[3],
344
- stopOpacity: 0
345
- })]
346
- })] }),
347
- /* @__PURE__ */ k(a, {
348
- strokeDasharray: "3 3",
349
- className: "stroke-border"
350
- }),
351
- /* @__PURE__ */ k(s, {
352
- dataKey: "date",
353
- tick: { fontSize: 12 },
354
- className: "text-text-secondary"
355
- }),
356
- /* @__PURE__ */ k(c, {
357
- tick: { fontSize: 12 },
358
- tickFormatter: (e) => m(e),
359
- className: "text-text-secondary"
360
- }),
361
- /* @__PURE__ */ k(n, {
362
- contentStyle: N,
363
- labelStyle: P,
364
- itemStyle: F,
365
- formatter: (e) => p(e)
366
- }),
367
- /* @__PURE__ */ k(t, { wrapperStyle: { fontSize: 12 } }),
368
- /* @__PURE__ */ k(o, {
369
- type: "monotone",
370
- dataKey: "revenue",
371
- name: "Revenue",
372
- stroke: M[0],
373
- strokeWidth: 2,
374
- fill: "url(#hmk-report-revenue)"
375
- }),
376
- /* @__PURE__ */ k(o, {
377
- type: "monotone",
378
- dataKey: "cost",
379
- name: "Cost",
380
- stroke: M[3],
381
- strokeWidth: 2,
382
- fill: "url(#hmk-report-cost)"
383
- })
384
- ]
385
- })
386
- }) : /* @__PURE__ */ k(L, {
387
- icon: /* @__PURE__ */ k(O, { className: "h-8 w-8" }),
388
- message: "No trend yet — launch a campaign to start tracking performance over time.",
389
- height: 260
390
- })
391
- }), /* @__PURE__ */ k(C, {
392
- title: "Channel Comparison",
393
- subtitle: "Revenue vs cost by channel",
394
- children: xe ? /* @__PURE__ */ k(r, {
395
- width: "100%",
396
- height: 260,
397
- children: /* @__PURE__ */ A(ee, {
398
- data: ye,
399
- barGap: 6,
373
+ onClick: () => Q(e.id),
374
+ "aria-current": V?.id === e.id ? "true" : void 0,
375
+ className: o("w-full rounded-md px-3 py-2.5 text-left transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]", V?.id === e.id ? "bg-bg-sunken" : "hover:bg-bg-sunken/50"),
376
+ children: [/* @__PURE__ */ D("span", {
377
+ className: "block truncate text-sm font-medium text-text-primary",
378
+ children: e.name
379
+ }), /* @__PURE__ */ O("span", {
380
+ className: "mt-1 inline-flex flex-wrap items-center gap-2 text-xs text-text-secondary",
400
381
  children: [
401
- /* @__PURE__ */ k(a, {
402
- strokeDasharray: "3 3",
403
- className: "stroke-border"
404
- }),
405
- /* @__PURE__ */ k(s, {
406
- dataKey: "channel",
407
- tick: { fontSize: 12 },
408
- className: "text-text-secondary"
409
- }),
410
- /* @__PURE__ */ k(c, {
411
- tick: { fontSize: 12 },
412
- tickFormatter: (e) => m(e),
413
- className: "text-text-secondary"
382
+ /* @__PURE__ */ D("span", {
383
+ className: "rounded border border-border-seam px-1.5 py-0.5",
384
+ children: f(e.dateRange)
414
385
  }),
415
- /* @__PURE__ */ k(n, {
416
- cursor: {
417
- fill: "var(--color-bg-sunken)",
418
- opacity: .4
419
- },
420
- contentStyle: N,
421
- labelStyle: P,
422
- itemStyle: F,
423
- formatter: (e) => p(e)
424
- }),
425
- /* @__PURE__ */ k(t, { wrapperStyle: { fontSize: 12 } }),
426
- /* @__PURE__ */ k(i, {
427
- dataKey: "revenue",
428
- name: "Revenue",
429
- fill: M[0],
430
- radius: [
431
- 4,
432
- 4,
433
- 0,
434
- 0
435
- ]
436
- }),
437
- /* @__PURE__ */ k(i, {
438
- dataKey: "cost",
439
- name: "Cost",
440
- fill: M[3],
441
- radius: [
442
- 4,
443
- 4,
444
- 0,
445
- 0
446
- ]
386
+ "Updated",
387
+ " ",
388
+ new Date(e.updatedAt).toLocaleDateString("en-US", {
389
+ month: "short",
390
+ day: "numeric"
447
391
  })
448
392
  ]
449
- })
450
- }) : /* @__PURE__ */ k(L, {
451
- icon: /* @__PURE__ */ k(w, { className: "h-8 w-8" }),
452
- message: "No channel data yet — revenue and spend appear here once campaigns run.",
453
- height: 260
454
- })
455
- })]
456
- }),
457
- /* @__PURE__ */ A("div", {
458
- className: "grid grid-cols-1 gap-6 lg:grid-cols-3",
459
- children: [/* @__PURE__ */ k(C, {
460
- title: "Conversion Funnel",
461
- subtitle: "Impressions → conversions",
462
- className: "lg:col-span-1",
463
- children: Se ? /* @__PURE__ */ A("div", {
464
- className: "space-y-4",
465
- children: [/* @__PURE__ */ k(r, {
466
- width: "100%",
467
- height: 180,
468
- children: /* @__PURE__ */ A(d, { children: [/* @__PURE__ */ k(n, {
469
- contentStyle: N,
470
- labelStyle: P,
471
- itemStyle: F,
472
- formatter: (e) => m(e)
473
- }), /* @__PURE__ */ k(u, {
474
- dataKey: "value",
475
- nameKey: "stage",
476
- data: ve,
477
- isAnimationActive: !0
478
- })] })
479
- }), /* @__PURE__ */ k("div", {
480
- className: "space-y-2",
481
- children: X.map((e, t) => /* @__PURE__ */ A("div", {
482
- className: "flex items-center justify-between gap-3 text-sm",
483
- children: [/* @__PURE__ */ A("div", {
484
- className: "flex items-center gap-2 min-w-0",
485
- children: [/* @__PURE__ */ k("span", {
486
- className: "h-2.5 w-2.5 shrink-0 rounded-full",
487
- style: { backgroundColor: e.color }
488
- }), /* @__PURE__ */ k("span", {
489
- className: "truncate text-text-secondary",
490
- children: e.stage
491
- })]
492
- }), /* @__PURE__ */ A("div", {
493
- className: "flex items-center gap-2 shrink-0",
494
- children: [/* @__PURE__ */ k("span", {
495
- className: "font-medium tabular-nums text-text-primary",
496
- children: m(e.value)
497
- }), t > 0 && /* @__PURE__ */ k("span", {
498
- className: "w-14 text-right text-xs tabular-nums text-text-secondary",
499
- children: h(e.conversionRate)
500
- })]
501
- })]
502
- }, e.stage))
503
393
  })]
504
- }) : /* @__PURE__ */ k(L, {
505
- icon: /* @__PURE__ */ k(se, { className: "h-8 w-8" }),
506
- message: "No funnel yet — impressions, clicks and conversions build this once data lands.",
507
- height: 180
508
- })
509
- }), /* @__PURE__ */ k(C, {
510
- title: "Channel Performance",
511
- subtitle: "Revenue and ROAS across every channel",
512
- className: "lg:col-span-2",
513
- children: /* @__PURE__ */ k(S, {
514
- data: U,
515
- columns: De,
516
- searchable: !0,
517
- searchPlaceholder: "Search channels...",
518
- emptyMessage: "No channel data yet",
519
- emptyDescription: "Launch a campaign to start collecting channel performance.",
520
- actions: /* @__PURE__ */ A("button", {
394
+ }) }, e.id))]
395
+ }),
396
+ Ee && /* @__PURE__ */ O("button", {
397
+ type: "button",
398
+ onClick: () => void ze(),
399
+ disabled: Te,
400
+ className: "mt-2 w-full rounded-md px-3 py-2 text-left text-xs font-medium text-text-secondary transition-colors hover:bg-bg-sunken/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)] disabled:opacity-50",
401
+ children: ["Show more reports", L === void 0 ? "" : ` (${I.length} of ${L})`]
402
+ }),
403
+ P.error && /* @__PURE__ */ O("p", {
404
+ className: "px-2 pt-2 text-xs text-status-error-text",
405
+ children: ["Saved reports could not be loaded: ", P.error.message]
406
+ }),
407
+ !P.error && P.data && I.length === 0 && /* @__PURE__ */ D("p", {
408
+ className: "px-2 pt-2 text-xs text-text-secondary",
409
+ children: "No saved reports yet. Use New Report, or save the Executive Summary as your own."
410
+ })
411
+ ]
412
+ }), /* @__PURE__ */ O("section", {
413
+ "aria-label": "Report",
414
+ className: "min-w-0 space-y-6",
415
+ children: [
416
+ Oe && /* @__PURE__ */ D("p", {
417
+ role: "status",
418
+ className: "rounded-lg border border-border-seam px-4 py-3 text-sm text-text-secondary",
419
+ children: "That report no longer exists or is not in this workspace. Showing the Executive Summary instead."
420
+ }),
421
+ /* @__PURE__ */ D(k, { children: /* @__PURE__ */ O("div", {
422
+ className: "flex flex-col gap-4 xl:flex-row xl:items-start xl:justify-between",
423
+ children: [/* @__PURE__ */ O("div", {
424
+ className: "min-w-0",
425
+ children: [
426
+ /* @__PURE__ */ D("h2", {
427
+ className: "text-xl font-bold tracking-tight",
428
+ children: /* @__PURE__ */ D(be, { children: H.name })
429
+ }),
430
+ /* @__PURE__ */ O("p", {
431
+ className: "mt-0.5 text-sm text-text-secondary",
432
+ children: [f(H.dateRange), U ? ` · ${W}` : ""]
433
+ }),
434
+ H.description && /* @__PURE__ */ D("p", {
435
+ className: "mt-1 text-sm text-text-secondary",
436
+ children: H.description
437
+ })
438
+ ]
439
+ }), /* @__PURE__ */ O("div", {
440
+ className: "flex flex-wrap items-center gap-2",
441
+ children: [
442
+ V ? /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ O("button", {
443
+ type: "button",
444
+ onClick: () => $(V.id, _(H, T)),
445
+ className: M,
446
+ children: [/* @__PURE__ */ D(_e, { className: "h-4 w-4" }), "Edit"]
447
+ }), /* @__PURE__ */ O("button", {
448
+ type: "button",
449
+ onClick: () => void Ue(),
450
+ className: M,
451
+ children: [/* @__PURE__ */ D(S, { className: "h-4 w-4" }), "Share"]
452
+ })] }) : /* @__PURE__ */ O("button", {
453
+ type: "button",
454
+ onClick: () => $(null, _(h, T, `${h.name} (copy)`)),
455
+ className: M,
456
+ children: [/* @__PURE__ */ D(ge, { className: "h-4 w-4" }), "Save as report"]
457
+ }),
458
+ /* @__PURE__ */ O("button", {
459
+ type: "button",
460
+ onClick: We,
461
+ disabled: !G.hasData,
462
+ className: M,
463
+ children: [/* @__PURE__ */ D(me, { className: "h-4 w-4" }), "Export CSV"]
464
+ }),
465
+ /* @__PURE__ */ O("button", {
466
+ type: "button",
467
+ onClick: Ge,
468
+ disabled: !G.hasData,
469
+ title: "Save this report as a PDF (opens your browser's print dialog)",
470
+ className: M,
471
+ children: [/* @__PURE__ */ D(he, { className: "h-4 w-4" }), "Export PDF"]
472
+ }),
473
+ V && /* @__PURE__ */ D("button", {
474
+ type: "button",
475
+ onClick: () => {
476
+ Z(null), X(!0);
477
+ },
478
+ "aria-label": "Delete report",
479
+ className: o(M, "text-status-error-text"),
480
+ children: /* @__PURE__ */ D(ve, { className: "h-4 w-4" })
481
+ })
482
+ ]
483
+ })]
484
+ }) }),
485
+ /* @__PURE__ */ O(ee, {
486
+ loading: G.loading,
487
+ error: G.error,
488
+ onRetry: G.refetch,
489
+ hasData: G.hasData,
490
+ children: [/* @__PURE__ */ D(ie, {
491
+ source: G.view.source,
492
+ windowLabel: W
493
+ }), /* @__PURE__ */ O("div", {
494
+ className: "grid grid-cols-1 gap-6 xl:grid-cols-2",
495
+ children: [H.widgets.map((e) => /* @__PURE__ */ D("div", {
496
+ className: o(m[e].wide && "xl:col-span-2"),
497
+ children: /* @__PURE__ */ D(ae, {
498
+ widget: e,
499
+ view: G.view,
500
+ attribution: G.attribution,
501
+ attributionLoading: G.attributionLoading,
502
+ attributionError: G.attributionError,
503
+ onOpenCampaign: (e) => l(p + "/campaigns/" + e)
504
+ })
505
+ }, e)), /* @__PURE__ */ O("button", {
521
506
  type: "button",
522
- onClick: $,
523
- disabled: !Q,
524
- className: "inline-flex min-h-[44px] items-center gap-2 rounded-md border border-border-seam bg-bg-surface px-3 py-2 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken disabled:cursor-not-allowed disabled:opacity-60",
525
- children: [/* @__PURE__ */ k(E, { className: "h-4 w-4" }), "Export"]
526
- })
527
- })
528
- })]
529
- }),
530
- /* @__PURE__ */ k(C, {
531
- title: "Campaign Performance",
532
- subtitle: "All campaigns ranked by revenue",
533
- children: /* @__PURE__ */ k(S, {
534
- data: H,
535
- columns: Oe,
536
- searchable: !0,
537
- searchPlaceholder: "Search campaigns...",
538
- pageSize: 8,
539
- onRowClick: (e) => R(z + "/campaigns/" + e.id),
540
- emptyMessage: "No campaigns yet",
541
- emptyDescription: "Create your first campaign to see it here.",
542
- actions: /* @__PURE__ */ A("button", {
543
- type: "button",
544
- onClick: Te,
545
- disabled: !Ce,
546
- className: "inline-flex min-h-[44px] items-center gap-2 rounded-md border border-border-seam bg-bg-surface px-3 py-2 text-sm font-medium text-text-primary transition-colors hover:bg-bg-sunken disabled:cursor-not-allowed disabled:opacity-60",
547
- children: [/* @__PURE__ */ k(E, { className: "h-4 w-4" }), "Export"]
548
- })
507
+ onClick: () => V ? $(V.id, _(H, T)) : $(null, _(h, T, `${h.name} (copy)`)),
508
+ className: "flex min-h-[160px] flex-col items-center justify-center gap-2 rounded-lg border-2 border-dashed border-border-seam text-sm font-medium text-text-secondary transition-colors hover:bg-bg-sunken/40 hover:text-text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)] print:hidden",
509
+ children: [/* @__PURE__ */ D(x, { className: "h-6 w-6" }), "Add widget"]
510
+ })]
511
+ })]
549
512
  })
550
- })
551
- ]
513
+ ]
514
+ })]
552
515
  }),
553
- /* @__PURE__ */ A(j, { children: [/* @__PURE__ */ k("h3", {
554
- className: "text-sm font-semibold text-text-primary mb-4",
555
- children: "Open a live report"
556
- }), /* @__PURE__ */ k("div", {
516
+ /* @__PURE__ */ O(k, { children: [/* @__PURE__ */ D("h3", {
517
+ className: "mb-4 text-sm font-semibold text-text-primary",
518
+ children: "Open a live view"
519
+ }), /* @__PURE__ */ D("div", {
557
520
  className: "grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-3",
558
- children: ke.map((e) => /* @__PURE__ */ A("button", {
521
+ children: we.map((e) => /* @__PURE__ */ O("button", {
559
522
  type: "button",
560
- onClick: () => R(z + e.segment),
561
- className: "group flex items-start gap-3 rounded-lg border border-border-seam bg-gloss-card shadow-pop p-4 text-left transition-colors hover:bg-bg-sunken/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
562
- children: [/* @__PURE__ */ k("span", {
523
+ onClick: () => l(p + e.segment),
524
+ className: "group flex items-start gap-3 rounded-lg border border-border-seam bg-gloss-card p-4 text-left shadow-pop transition-colors hover:bg-bg-sunken/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]",
525
+ children: [/* @__PURE__ */ D("span", {
563
526
  className: "text-text-secondary transition-colors group-hover:text-action-primary-bg",
564
527
  children: e.icon
565
- }), /* @__PURE__ */ A("div", {
528
+ }), /* @__PURE__ */ O("div", {
566
529
  className: "min-w-0 flex-1",
567
- children: [/* @__PURE__ */ A("p", {
530
+ children: [/* @__PURE__ */ O("p", {
568
531
  className: "flex items-center gap-1 text-sm font-medium text-text-primary",
569
- children: [e.name, /* @__PURE__ */ k(ae, { className: "h-3.5 w-3.5 shrink-0 text-text-secondary opacity-0 transition-opacity group-hover:opacity-100" })]
570
- }), /* @__PURE__ */ k("p", {
571
- className: "text-xs text-text-secondary mt-0.5",
532
+ children: [e.name, /* @__PURE__ */ D(pe, { className: "h-3.5 w-3.5 shrink-0 text-text-secondary opacity-0 transition-opacity group-hover:opacity-100" })]
533
+ }), /* @__PURE__ */ D("p", {
534
+ className: "mt-0.5 text-xs text-text-secondary",
572
535
  children: e.description
573
536
  })]
574
537
  })]
575
538
  }, e.id))
576
- })] })
539
+ })] }),
540
+ K && /* @__PURE__ */ D(Ce, {
541
+ open: !0,
542
+ title: K.reportId ? "Edit report" : "New report",
543
+ submitLabel: K.reportId ? "Save changes" : "Save report",
544
+ draft: K.draft,
545
+ onChange: (e) => q({
546
+ ...K,
547
+ draft: e
548
+ }),
549
+ errors: ke ? Be : {},
550
+ serverError: Ae,
551
+ saving: Ke,
552
+ onClose: () => q(null),
553
+ onSubmit: () => void Ve()
554
+ }),
555
+ /* @__PURE__ */ D(u, {
556
+ open: je,
557
+ onClose: () => X(!1),
558
+ title: "Delete report",
559
+ message: `Delete "${H.name}"? Everyone in the workspace loses this saved report. The underlying analytics are not affected.`,
560
+ deleting: Re.loading,
561
+ error: Me,
562
+ onConfirm: () => void He()
563
+ }),
564
+ /* @__PURE__ */ D(d, { toasts: b.map((e) => ({
565
+ ...e,
566
+ onDismiss: w
567
+ })) })
577
568
  ]
578
569
  });
579
570
  };
580
571
  //#endregion
581
- export { R as ReportsPage };
572
+ export { P as ReportsPage };
582
573
 
583
574
  //# sourceMappingURL=ReportsPage.js.map