@byline/host-tanstack-start 5.1.3 → 5.1.4

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.
@@ -1,7 +1,7 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { createFileRoute, notFound } from "@tanstack/react-router";
3
- import { AnalyticsDashboard } from "@byline/admin/analytics/components/dashboard";
4
- import { isAnalyticsDashboardPeriod } from "@byline/analytics/config";
3
+ import { ANALYTICS_PREVIEW_ROWS, AnalyticsDashboard } from "@byline/admin/analytics/components/dashboard";
4
+ import { ANALYTICS_MAX_TOP_LIMIT, isAnalyticsDashboardPeriod } from "@byline/analytics/config";
5
5
  import { useTranslation } from "@byline/i18n/react";
6
6
  import { z } from "zod";
7
7
  import { BreadcrumbsClient } from "../admin-shell/chrome/breadcrumbs/breadcrumbs-client.js";
@@ -36,20 +36,20 @@ function createAdminAnalyticsRoute(path) {
36
36
  data: {
37
37
  ...range,
38
38
  kind: 'page',
39
- limit: 20
39
+ limit: ANALYTICS_PREVIEW_ROWS
40
40
  }
41
41
  }),
42
42
  getAnalyticsTop({
43
43
  data: {
44
44
  ...range,
45
45
  kind: 'download',
46
- limit: 20
46
+ limit: ANALYTICS_PREVIEW_ROWS
47
47
  }
48
48
  }),
49
49
  getAnalyticsReferrers({
50
50
  data: {
51
51
  ...range,
52
- limit: 20
52
+ limit: ANALYTICS_PREVIEW_ROWS
53
53
  }
54
54
  }),
55
55
  getAnalyticsCountries({
@@ -90,6 +90,18 @@ function createAdminAnalyticsRoute(path) {
90
90
  /*#__PURE__*/ jsx(AnalyticsDashboard, {
91
91
  data: data,
92
92
  period: period,
93
+ loadFullList: (kind)=>'referrers' === kind ? getAnalyticsReferrers({
94
+ data: {
95
+ ...data.range,
96
+ limit: ANALYTICS_MAX_TOP_LIMIT
97
+ }
98
+ }) : getAnalyticsTop({
99
+ data: {
100
+ ...data.range,
101
+ kind: 'pages' === kind ? 'page' : 'download',
102
+ limit: ANALYTICS_MAX_TOP_LIMIT
103
+ }
104
+ }),
93
105
  onPeriodChange: (nextPeriod)=>{
94
106
  navigate({
95
107
  to: getAdminRoutePath('analytics'),
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "private": false,
4
4
  "type": "module",
5
5
  "license": "MPL-2.0",
6
- "version": "5.1.3",
6
+ "version": "5.1.4",
7
7
  "engines": {
8
8
  "node": ">=20.9.0"
9
9
  },
@@ -125,15 +125,15 @@
125
125
  "react-json-view-lite": "^2.5.0",
126
126
  "react-swipeable": "^7.0.2",
127
127
  "zod": "^4.5.4",
128
- "@byline/admin": "5.1.3",
129
- "@byline/analytics": "5.1.3",
130
- "@byline/auth": "5.1.3",
131
- "@byline/ui": "5.1.3",
132
- "@byline/ai": "5.1.3",
133
- "@byline/client": "5.1.3",
134
- "@byline/i18n": "5.1.3",
135
- "@byline/core": "5.1.3",
136
- "@byline/analytics-agent": "5.1.3"
128
+ "@byline/analytics": "5.1.4",
129
+ "@byline/admin": "5.1.4",
130
+ "@byline/auth": "5.1.4",
131
+ "@byline/ai": "5.1.4",
132
+ "@byline/client": "5.1.4",
133
+ "@byline/core": "5.1.4",
134
+ "@byline/i18n": "5.1.4",
135
+ "@byline/analytics-agent": "5.1.4",
136
+ "@byline/ui": "5.1.4"
137
137
  },
138
138
  "peerDependencies": {
139
139
  "@tanstack/react-router": "^1.167.0",
@@ -9,8 +9,11 @@
9
9
  import { createFileRoute, notFound } from '@tanstack/react-router'
10
10
 
11
11
  import type { AnalyticsDashboardData, AnalyticsDashboardPeriod } from '@byline/admin/analytics'
12
- import { AnalyticsDashboard } from '@byline/admin/analytics/components/dashboard'
13
- import { isAnalyticsDashboardPeriod } from '@byline/analytics/config'
12
+ import {
13
+ ANALYTICS_PREVIEW_ROWS,
14
+ AnalyticsDashboard,
15
+ } from '@byline/admin/analytics/components/dashboard'
16
+ import { ANALYTICS_MAX_TOP_LIMIT, isAnalyticsDashboardPeriod } from '@byline/analytics/config'
14
17
  import { useTranslation } from '@byline/i18n/react'
15
18
  import { z } from 'zod'
16
19
 
@@ -55,9 +58,11 @@ export function createAdminAnalyticsRoute(path: string) {
55
58
  const range = buildAnalyticsDashboardRange(deps.period, new Date(), coverage.summaryFrom)
56
59
  const [summary, pages, downloads, referrers, countries] = await Promise.all([
57
60
  getAnalyticsSummary({ data: range }),
58
- getAnalyticsTop({ data: { ...range, kind: 'page', limit: 20 } }),
59
- getAnalyticsTop({ data: { ...range, kind: 'download', limit: 20 } }),
60
- getAnalyticsReferrers({ data: { ...range, limit: 20 } }),
61
+ // Fetch exactly the preview depth each card shows; the full list is
62
+ // fetched on demand through `loadFullList` below.
63
+ getAnalyticsTop({ data: { ...range, kind: 'page', limit: ANALYTICS_PREVIEW_ROWS } }),
64
+ getAnalyticsTop({ data: { ...range, kind: 'download', limit: ANALYTICS_PREVIEW_ROWS } }),
65
+ getAnalyticsReferrers({ data: { ...range, limit: ANALYTICS_PREVIEW_ROWS } }),
61
66
  getAnalyticsCountries({ data: range }),
62
67
  ])
63
68
 
@@ -93,6 +98,19 @@ export function createAdminAnalyticsRoute(path: string) {
93
98
  <AnalyticsDashboard
94
99
  data={data}
95
100
  period={period}
101
+ loadFullList={(kind) =>
102
+ kind === 'referrers'
103
+ ? getAnalyticsReferrers({
104
+ data: { ...data.range, limit: ANALYTICS_MAX_TOP_LIMIT },
105
+ })
106
+ : getAnalyticsTop({
107
+ data: {
108
+ ...data.range,
109
+ kind: kind === 'pages' ? 'page' : 'download',
110
+ limit: ANALYTICS_MAX_TOP_LIMIT,
111
+ },
112
+ })
113
+ }
96
114
  onPeriodChange={(nextPeriod) => {
97
115
  navigate({
98
116
  to: getAdminRoutePath('analytics'),