astro-tractstack 2.0.0-rc.30 → 2.0.0-rc.31

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "astro-tractstack",
3
- "version": "2.0.0-rc.30",
3
+ "version": "2.0.0-rc.31",
4
4
  "description": "Astro integration for TractStack - redeeming the web from boring experiences",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -45,11 +45,13 @@ interface ContentMapItem {
45
45
  interface EpinetDurationSelectorProps {
46
46
  fullContentMap?: ContentMapItem[];
47
47
  isLoading?: boolean;
48
+ hourlyNodeActivity?: any;
48
49
  }
49
50
 
50
51
  const EpinetDurationSelector = ({
51
52
  fullContentMap,
52
53
  isLoading,
54
+ hourlyNodeActivity,
53
55
  }: EpinetDurationSelectorProps = {}) => {
54
56
  const [startDate, setStartDate] = useState<Date | null>(null);
55
57
  const [endDate, setEndDate] = useState<Date | null>(null);
@@ -191,16 +193,6 @@ const EpinetDurationSelector = ({
191
193
  }
192
194
 
193
195
  const nowUTC = new Date();
194
- const maxPastTime = new Date(
195
- nowUTC.getTime() - MAX_ANALYTICS_HOURS * 60 * 60 * 1000
196
- );
197
-
198
- if (startUTCTime < maxPastTime) {
199
- setErrorMessage(
200
- `Start time cannot be more than ${MAX_ANALYTICS_HOURS} hours in the past.`
201
- );
202
- return;
203
- }
204
196
 
205
197
  if (endUTCTime > nowUTC) {
206
198
  setErrorMessage('End time cannot be in the future.');
@@ -933,6 +925,7 @@ const EpinetDurationSelector = ({
933
925
  <EpinetTableView
934
926
  fullContentMap={fullContentMap || []}
935
927
  isLoading={isLoading}
928
+ hourlyNodeActivity={hourlyNodeActivity}
936
929
  />
937
930
  )}
938
931
  </div>
@@ -53,13 +53,17 @@ interface ContentMapItem {
53
53
  type: string;
54
54
  }
55
55
 
56
+ interface Props {
57
+ fullContentMap: ContentMapItem[];
58
+ isLoading?: boolean;
59
+ hourlyNodeActivity?: any;
60
+ }
61
+
56
62
  const EpinetTableView = ({
57
63
  fullContentMap,
58
64
  isLoading = false,
59
- }: {
60
- fullContentMap: ContentMapItem[];
61
- isLoading?: boolean;
62
- }) => {
65
+ hourlyNodeActivity,
66
+ }: Props) => {
63
67
  const $epinetCustomFilters = useStore(epinetCustomFilters);
64
68
  const [currentDay, setCurrentDay] = useState<string | null>(null);
65
69
  const [availableDays, setAvailableDays] = useState<string[]>([]);
@@ -174,7 +178,7 @@ const EpinetTableView = ({
174
178
  };
175
179
 
176
180
  useEffect(() => {
177
- const hourlyActivity = $epinetCustomFilters.hourlyNodeActivity || {};
181
+ const hourlyActivity = hourlyNodeActivity || {};
178
182
  const hourKeys = Object.keys(hourlyActivity);
179
183
 
180
184
  if (hourKeys.length === 0) {
@@ -192,7 +196,7 @@ const EpinetTableView = ({
192
196
  setAvailableDays(days);
193
197
  setCurrentDay(days[0] || null);
194
198
  setCurrentDayIndex(0);
195
- }, [$epinetCustomFilters.hourlyNodeActivity]);
199
+ }, [hourlyNodeActivity]);
196
200
 
197
201
  const navigateDay = (direction: 'prev' | 'next') => {
198
202
  const newIndex =
@@ -213,7 +217,7 @@ const EpinetTableView = ({
213
217
  if (!currentDay)
214
218
  return { data: [], dailyTotal: 0, dailyVisitors: 0, maxHourlyTotal: 0 };
215
219
 
216
- const hourlyActivity = $epinetCustomFilters.hourlyNodeActivity || {};
220
+ const hourlyActivity = hourlyNodeActivity || {};
217
221
  const result: HourData[] = [];
218
222
  let emptyRangeStart: number | null = null;
219
223
  let dailyTotal = 0;
@@ -1,4 +1,4 @@
1
- import { useState, useCallback, useMemo, Component } from 'react';
1
+ import { useState, useEffect, useCallback, useMemo, Component } from 'react';
2
2
  import type { ReactNode } from 'react';
3
3
  import { useStore } from '@nanostores/react';
4
4
  import { epinetCustomFilters } from '@/stores/analytics';
@@ -439,6 +439,7 @@ export default function StoryKeepDashboard_Analytics({
439
439
  isLoading={
440
440
  analytics.isLoading || analytics.status === 'loading'
441
441
  }
442
+ hourlyNodeActivity={analytics.hourlyNodeActivity}
442
443
  />
443
444
  </div>
444
445
  </ErrorBoundary>
@@ -453,6 +454,7 @@ export default function StoryKeepDashboard_Analytics({
453
454
  isLoading={
454
455
  analytics.isLoading || analytics.status === 'loading'
455
456
  }
457
+ hourlyNodeActivity={analytics.hourlyNodeActivity}
456
458
  />
457
459
  </>
458
460
  )
@@ -465,6 +467,7 @@ export default function StoryKeepDashboard_Analytics({
465
467
  <EpinetDurationSelector
466
468
  fullContentMap={fullContentMap}
467
469
  isLoading={analytics.isLoading || analytics.status === 'loading'}
470
+ hourlyNodeActivity={analytics.hourlyNodeActivity}
468
471
  />
469
472
  </>
470
473
  )}
@@ -301,8 +301,6 @@ class AnalyticsService {
301
301
  selectedUserId: null,
302
302
  startTimeUTC: oneWeekAgoUTC.toISOString(),
303
303
  endTimeUTC: nowUTC.toISOString(),
304
- userCounts: [],
305
- hourlyNodeActivity: {},
306
304
  });
307
305
  }
308
306