@nextjscms/plugin-google-analytics 2.1.30 → 2.1.32

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 (36) hide show
  1. package/dist/client/components/BounceRate.d.ts +5 -0
  2. package/dist/client/components/BounceRate.d.ts.map +1 -0
  3. package/dist/client/components/BounceRate.js +55 -0
  4. package/dist/client/components/LivePageViews.d.ts +2 -0
  5. package/dist/client/components/LivePageViews.d.ts.map +1 -0
  6. package/dist/client/components/LivePageViews.js +21 -0
  7. package/dist/client/components/LiveUsersCount.d.ts +2 -0
  8. package/dist/client/components/LiveUsersCount.d.ts.map +1 -0
  9. package/dist/client/components/LiveUsersCount.js +22 -0
  10. package/dist/client/components/MonthlyPageViews.d.ts +5 -0
  11. package/dist/client/components/MonthlyPageViews.d.ts.map +1 -0
  12. package/dist/client/components/MonthlyPageViews.js +24 -0
  13. package/dist/client/components/TopCountries.d.ts +5 -0
  14. package/dist/client/components/TopCountries.d.ts.map +1 -0
  15. package/dist/client/components/TopCountries.js +26 -0
  16. package/dist/client/components/TopDevices.d.ts +5 -0
  17. package/dist/client/components/TopDevices.d.ts.map +1 -0
  18. package/dist/client/components/TopDevices.js +26 -0
  19. package/dist/client/components/TopMediums.d.ts +5 -0
  20. package/dist/client/components/TopMediums.d.ts.map +1 -0
  21. package/dist/client/components/TopMediums.js +38 -0
  22. package/dist/client/components/TopSources.d.ts +5 -0
  23. package/dist/client/components/TopSources.d.ts.map +1 -0
  24. package/dist/client/components/TopSources.js +26 -0
  25. package/dist/client/components/TotalPageViews.d.ts +5 -0
  26. package/dist/client/components/TotalPageViews.d.ts.map +1 -0
  27. package/dist/client/components/TotalPageViews.js +24 -0
  28. package/dist/client/components/TotalSessions.d.ts +5 -0
  29. package/dist/client/components/TotalSessions.d.ts.map +1 -0
  30. package/dist/client/components/TotalSessions.js +24 -0
  31. package/dist/client/components/TotalUniqueUsers.d.ts +5 -0
  32. package/dist/client/components/TotalUniqueUsers.d.ts.map +1 -0
  33. package/dist/client/components/TotalUniqueUsers.js +24 -0
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/router.d.ts.map +1 -1
  36. package/package.json +2 -2
@@ -0,0 +1,5 @@
1
+ export declare const BounceRate: ({ fromDate, toDate }: {
2
+ fromDate: Date | string | null;
3
+ toDate: Date | string | null;
4
+ }) => import("react/jsx-runtime").JSX.Element;
5
+ //# sourceMappingURL=BounceRate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BounceRate.d.ts","sourceRoot":"","sources":["../../../src/client/components/BounceRate.tsx"],"names":[],"mappings":"AAUA,eAAO,MAAM,UAAU,GAAI,sBAAsB;IAAE,QAAQ,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAA;CAAE,4CA2DhH,CAAA"}
@@ -0,0 +1,55 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useI18n } from 'nextjs-cms/translations/client';
3
+ import { formatNumber } from 'nextjs-cms/utils';
4
+ import PieChartBox from '@/components/PieChartBox';
5
+ import { useEffect } from 'react';
6
+ import { useQuery } from '@tanstack/react-query';
7
+ import { getAnalytics } from '@/lib/apiHelpers';
8
+ import { useAxiosPrivate } from 'nextjs-cms/api/client';
9
+ import { useTheme } from 'next-themes';
10
+ export const BounceRate = ({ fromDate, toDate }) => {
11
+ const t = useI18n();
12
+ const axiosPrivate = useAxiosPrivate();
13
+ let controller = new AbortController();
14
+ const { theme } = useTheme();
15
+ const { isLoading, isError, data, error } = useQuery({
16
+ queryKey: ['analyticsPage', 'statistics', fromDate, toDate],
17
+ queryFn: () => {
18
+ // Abort the previous request
19
+ controller.abort();
20
+ // Create a new AbortController for the new request
21
+ controller = new AbortController();
22
+ return getAnalytics({
23
+ requestType: 'statistics',
24
+ axiosPrivate,
25
+ controller,
26
+ fromDate,
27
+ toDate,
28
+ });
29
+ },
30
+ });
31
+ const bounceRateData = [
32
+ {
33
+ name: t('totalDiskSpace'),
34
+ value: 100 - parseInt(data?.bounceRate),
35
+ fill: 'transparent',
36
+ },
37
+ {
38
+ name: t('usedDiskSpace'),
39
+ value: parseInt(data?.bounceRate),
40
+ fill: theme === 'dark' ? '#adfa1d' : '#E1315B',
41
+ },
42
+ ];
43
+ useEffect(() => {
44
+ return () => {
45
+ controller.abort();
46
+ };
47
+ }, []);
48
+ return (_jsx(PieChartBox, { height: 250, legend: false, chartData: bounceRateData, isLoading: isLoading, chartBoxTitles: {
49
+ mainTitle: t('bounceRate'),
50
+ totalUnitSubtitle: {
51
+ key: t('sessionsPerUser'),
52
+ value: formatNumber(data?.sessionsPerUser),
53
+ },
54
+ } }));
55
+ };
@@ -0,0 +1,2 @@
1
+ export declare const LivePageViews: () => import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=LivePageViews.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LivePageViews.d.ts","sourceRoot":"","sources":["../../../src/client/components/LivePageViews.tsx"],"names":[],"mappings":"AAQA,eAAO,MAAM,aAAa,+CA8CzB,CAAA"}
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useI18n } from 'nextjs-cms/translations/client';
3
+ import { Table, TableBody, TableCaption, TableCell, TableHead, TableHeader, TableRow } from '@/components/ui/table';
4
+ import ContainerBox from '@/components/ContainerBox';
5
+ import { useAxiosPrivate } from 'nextjs-cms/api/client';
6
+ import { useQuery } from '@tanstack/react-query';
7
+ import { getAnalytics } from '@/lib/apiHelpers';
8
+ export const LivePageViews = () => {
9
+ const t = useI18n();
10
+ const axiosPrivate = useAxiosPrivate();
11
+ const controller = new AbortController();
12
+ const { isLoading, isError, data, error } = useQuery({
13
+ queryKey: ['analyticsPage', 'livePageViews'],
14
+ queryFn: () => getAnalytics({
15
+ requestType: 'livePageViews',
16
+ axiosPrivate,
17
+ controller,
18
+ }),
19
+ });
20
+ return (_jsx(ContainerBox, { title: t('liveUsersAreViewing'), children: _jsxs(Table, { children: [_jsx(TableCaption, { children: t('liveUsersSubtitle') }), _jsx(TableHeader, { children: _jsxs(TableRow, { children: [_jsx(TableHead, { children: t('country') }), _jsx(TableHead, { children: t('device') }), _jsx(TableHead, { children: t('page') })] }) }), _jsx(TableBody, { children: data?.livePageViews?.locations?.length > 0 ? (data.livePageViews.locations.map((location, index) => (_jsxs(TableRow, { children: [_jsx(TableCell, { children: location.country }), _jsx(TableCell, { children: location.device }), _jsx(TableCell, { children: location.page })] }, index)))) : (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: 3, className: 'text-center', children: t('noLiveUsers') }) })) })] }) }));
21
+ };
@@ -0,0 +1,2 @@
1
+ export declare const LiveUsersCount: () => import("react/jsx-runtime").JSX.Element;
2
+ //# sourceMappingURL=LiveUsersCount.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LiveUsersCount.d.ts","sourceRoot":"","sources":["../../../src/client/components/LiveUsersCount.tsx"],"names":[],"mappings":"AASA,eAAO,MAAM,cAAc,+CAuB1B,CAAA"}
@@ -0,0 +1,22 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useI18n } from 'nextjs-cms/translations/client';
3
+ import { formatNumber } from 'nextjs-cms/utils';
4
+ import ContainerBox from '@/components/ContainerBox';
5
+ import { useAxiosPrivate } from 'nextjs-cms/api/client';
6
+ import { useQuery } from '@tanstack/react-query';
7
+ import { getAnalytics } from '@/lib/apiHelpers';
8
+ import LoadingSpinners from '@/components/LoadingSpinners';
9
+ export const LiveUsersCount = () => {
10
+ const t = useI18n();
11
+ const axiosPrivate = useAxiosPrivate();
12
+ const controller = new AbortController();
13
+ const { isLoading, isError, data, error } = useQuery({
14
+ queryKey: ['analyticsPage', 'liveUsersCount'],
15
+ queryFn: () => getAnalytics({
16
+ requestType: 'liveUsersCount',
17
+ axiosPrivate,
18
+ controller,
19
+ }),
20
+ });
21
+ return (_jsx(ContainerBox, { title: t('liveUsers'), children: isLoading ? (_jsx(LoadingSpinners, { single: true })) : (_jsx("div", { className: 'text-4xl', children: formatNumber(data?.liveUsers?.count) })) }));
22
+ };
@@ -0,0 +1,5 @@
1
+ export declare const MonthlyPageViews: ({ fromDate, toDate, }: {
2
+ fromDate: Date | string | null;
3
+ toDate: Date | string | null;
4
+ }) => import("react/jsx-runtime").JSX.Element;
5
+ //# sourceMappingURL=MonthlyPageViews.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MonthlyPageViews.d.ts","sourceRoot":"","sources":["../../../src/client/components/MonthlyPageViews.tsx"],"names":[],"mappings":"AAQA,eAAO,MAAM,gBAAgB,GAAI,uBAG9B;IACC,QAAQ,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAA;IAC9B,MAAM,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAA;CAC/B,4CA2BA,CAAA"}
@@ -0,0 +1,24 @@
1
+ import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useI18n } from 'nextjs-cms/translations/client';
3
+ import BarChartBox from '@/components/BarChartBox';
4
+ import { useTheme } from 'next-themes';
5
+ import { useQuery } from '@tanstack/react-query';
6
+ import { getAnalytics } from '@/lib/apiHelpers';
7
+ import { useAxiosPrivate } from 'nextjs-cms/api/client';
8
+ export const MonthlyPageViews = ({ fromDate, toDate, }) => {
9
+ const t = useI18n();
10
+ const axiosPrivate = useAxiosPrivate();
11
+ const controller = new AbortController();
12
+ const { theme } = useTheme();
13
+ const { isLoading, isError, data, error } = useQuery({
14
+ queryKey: ['analyticsPage', 'monthlyPageViews', fromDate, toDate],
15
+ queryFn: () => getAnalytics({
16
+ requestType: 'monthlyPageViews',
17
+ axiosPrivate,
18
+ controller,
19
+ fromDate,
20
+ toDate,
21
+ }),
22
+ });
23
+ return (_jsx(_Fragment, { children: _jsx(BarChartBox, { isLoading: isLoading, chartData: data?.monthlyPageViews, title: t('monthlyPageViews'), fill: theme === 'dark' ? '#adfa1d' : '#ff6688' }) }));
24
+ };
@@ -0,0 +1,5 @@
1
+ export declare const TopCountries: ({ fromDate, toDate, }: {
2
+ fromDate: Date | string | null;
3
+ toDate: Date | string | null;
4
+ }) => import("react/jsx-runtime").JSX.Element;
5
+ //# sourceMappingURL=TopCountries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TopCountries.d.ts","sourceRoot":"","sources":["../../../src/client/components/TopCountries.tsx"],"names":[],"mappings":"AAWA,eAAO,MAAM,YAAY,GAAI,uBAG1B;IACC,QAAQ,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAA;IAC9B,MAAM,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAA;CAC/B,4CAkCA,CAAA"}
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useI18n } from 'nextjs-cms/translations/client';
3
+ import { Badge } from '@/components/ui/badge';
4
+ import { formatNumber } from 'nextjs-cms/utils';
5
+ import ContainerBox from '@/components/ContainerBox';
6
+ import { useAxiosPrivate } from 'nextjs-cms/api/client';
7
+ import { useQuery } from '@tanstack/react-query';
8
+ import { getAnalytics } from '@/lib/apiHelpers';
9
+ import LoadingSpinners from '@/components/LoadingSpinners';
10
+ export const TopCountries = ({ fromDate, toDate, }) => {
11
+ const t = useI18n();
12
+ const axiosPrivate = useAxiosPrivate();
13
+ const controller = new AbortController();
14
+ const { isLoading, isError, data, error } = useQuery({
15
+ queryKey: ['analyticsPage', 'topCountries', fromDate, toDate],
16
+ queryFn: () => getAnalytics({
17
+ requestType: 'topCountries',
18
+ axiosPrivate,
19
+ controller,
20
+ fromDate,
21
+ toDate,
22
+ }),
23
+ });
24
+ return (_jsx(ContainerBox, { title: t('countries'), children: _jsxs("div", { className: 'w-full mb-6', children: [_jsx("h1", { className: 'font-bold border-b pb-1 my-1', children: t('topCountries') }), isLoading && _jsx(LoadingSpinners, { single: true }), data?.topCountries?.length > 0 &&
25
+ data.topCountries.map((country, index) => (_jsxs("div", { className: 'w-full text-sm flex justify-between', children: [_jsxs("span", { className: 'font-bold text-foreground', children: [country.name, ":"] }), _jsx(Badge, { variant: 'outline', className: 'ms-2', children: formatNumber(country.value) })] }, `${index}-${country.name}`)))] }) }));
26
+ };
@@ -0,0 +1,5 @@
1
+ export declare const TopDevices: ({ fromDate, toDate }: {
2
+ fromDate: Date | string | null;
3
+ toDate: Date | string | null;
4
+ }) => import("react/jsx-runtime").JSX.Element;
5
+ //# sourceMappingURL=TopDevices.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TopDevices.d.ts","sourceRoot":"","sources":["../../../src/client/components/TopDevices.tsx"],"names":[],"mappings":"AAWA,eAAO,MAAM,UAAU,GAAI,sBAAsB;IAAE,QAAQ,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAA;CAAE,4CAkChH,CAAA"}
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useI18n } from 'nextjs-cms/translations/client';
3
+ import { Badge } from '@/components/ui/badge';
4
+ import { formatNumber } from 'nextjs-cms/utils';
5
+ import ContainerBox from '@/components/ContainerBox';
6
+ import { useAxiosPrivate } from 'nextjs-cms/api/client';
7
+ import { useQuery } from '@tanstack/react-query';
8
+ import { getAnalytics } from '@/lib/apiHelpers';
9
+ import LoadingSpinners from '@/components/LoadingSpinners';
10
+ export const TopDevices = ({ fromDate, toDate }) => {
11
+ const t = useI18n();
12
+ const axiosPrivate = useAxiosPrivate();
13
+ const controller = new AbortController();
14
+ const { isLoading, isError, data, error } = useQuery({
15
+ queryKey: ['analyticsPage', 'topDevices', fromDate, toDate],
16
+ queryFn: () => getAnalytics({
17
+ requestType: 'topDevices',
18
+ axiosPrivate,
19
+ controller,
20
+ fromDate,
21
+ toDate,
22
+ }),
23
+ });
24
+ return (_jsx(ContainerBox, { title: t('devices'), children: _jsxs("div", { className: 'w-full', children: [_jsx("h1", { className: 'font-bold border-b pb-1 my-1', children: t('topDevices') }), isLoading && _jsx(LoadingSpinners, { single: true }), data?.topDevices?.length > 0 &&
25
+ data.topDevices.map((device, index) => (_jsxs("div", { className: 'w-full text-sm flex justify-between', children: [_jsxs("span", { className: 'font-bold text-foreground', children: [device.name, ":"] }), _jsx(Badge, { variant: 'outline', className: 'ms-2', children: formatNumber(device.value) })] }, `${index}-${device.name}`)))] }) }));
26
+ };
@@ -0,0 +1,5 @@
1
+ export declare const TopMediums: ({ fromDate, toDate }: {
2
+ fromDate: Date | string | null;
3
+ toDate: Date | string | null;
4
+ }) => import("react/jsx-runtime").JSX.Element;
5
+ //# sourceMappingURL=TopMediums.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TopMediums.d.ts","sourceRoot":"","sources":["../../../src/client/components/TopMediums.tsx"],"names":[],"mappings":"AAWA,eAAO,MAAM,UAAU,GAAI,sBAAsB;IAAE,QAAQ,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAA;CAAE,4CA8ChH,CAAA"}
@@ -0,0 +1,38 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useI18n } from 'nextjs-cms/translations/client';
3
+ import { Badge } from '@/components/ui/badge';
4
+ import { formatNumber } from 'nextjs-cms/utils';
5
+ import ContainerBox from '@/components/ContainerBox';
6
+ import { useEffect } from 'react';
7
+ import { useAxiosPrivate } from 'nextjs-cms/api/client';
8
+ import { useQuery } from '@tanstack/react-query';
9
+ import { getAnalytics } from '@/lib/apiHelpers';
10
+ import LoadingSpinners from '@/components/LoadingSpinners';
11
+ export const TopMediums = ({ fromDate, toDate }) => {
12
+ const t = useI18n();
13
+ const axiosPrivate = useAxiosPrivate();
14
+ let controller = new AbortController();
15
+ const { isLoading, isError, data, error } = useQuery({
16
+ queryKey: ['analyticsPage', 'topMediums', fromDate, toDate],
17
+ queryFn: () => {
18
+ // Abort the previous request
19
+ controller.abort();
20
+ // Create a new AbortController for the new request
21
+ controller = new AbortController();
22
+ return getAnalytics({
23
+ requestType: 'topMediums',
24
+ axiosPrivate,
25
+ controller,
26
+ fromDate,
27
+ toDate,
28
+ });
29
+ },
30
+ });
31
+ useEffect(() => {
32
+ return () => {
33
+ controller.abort();
34
+ };
35
+ }, []);
36
+ return (_jsx(ContainerBox, { title: t('mediums'), children: _jsxs("div", { className: 'w-full mb-6', children: [_jsx("h1", { className: 'font-bold border-b pb-1 my-1', children: t('topMediums') }), isLoading && _jsx(LoadingSpinners, { single: true }), data?.topMediums?.length > 0 &&
37
+ data.topMediums.map((medium, index) => (_jsxs("div", { className: 'w-full text-sm flex justify-between', children: [_jsxs("span", { className: 'font-bold text-foreground', children: [medium.name, ":"] }), _jsx(Badge, { variant: 'outline', className: 'ms-2', children: formatNumber(medium.value) })] }, `${index}-${medium.name}`)))] }) }));
38
+ };
@@ -0,0 +1,5 @@
1
+ export declare const TopSources: ({ fromDate, toDate }: {
2
+ fromDate: Date | string | null;
3
+ toDate: Date | string | null;
4
+ }) => import("react/jsx-runtime").JSX.Element;
5
+ //# sourceMappingURL=TopSources.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TopSources.d.ts","sourceRoot":"","sources":["../../../src/client/components/TopSources.tsx"],"names":[],"mappings":"AAWA,eAAO,MAAM,UAAU,GAAI,sBAAsB;IAAE,QAAQ,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAA;CAAE,4CAiChH,CAAA"}
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useI18n } from 'nextjs-cms/translations/client';
3
+ import { Badge } from '@/components/ui/badge';
4
+ import { formatNumber } from 'nextjs-cms/utils';
5
+ import ContainerBox from '@/components/ContainerBox';
6
+ import { useAxiosPrivate } from 'nextjs-cms/api/client';
7
+ import { useQuery } from '@tanstack/react-query';
8
+ import { getAnalytics } from '@/lib/apiHelpers';
9
+ import LoadingSpinners from '@/components/LoadingSpinners';
10
+ export const TopSources = ({ fromDate, toDate }) => {
11
+ const t = useI18n();
12
+ const axiosPrivate = useAxiosPrivate();
13
+ const controller = new AbortController();
14
+ const { isLoading, isError, data, error } = useQuery({
15
+ queryKey: ['analyticsPage', 'topSources', fromDate, toDate],
16
+ queryFn: () => getAnalytics({
17
+ requestType: 'topSources',
18
+ axiosPrivate,
19
+ controller,
20
+ fromDate,
21
+ toDate,
22
+ }),
23
+ });
24
+ return (_jsx(ContainerBox, { title: t('sources'), children: _jsxs("div", { className: 'w-full mb-6', children: [_jsx("h1", { className: 'font-bold border-b pb-1 my-1', children: t('topSources') }), isLoading && _jsx(LoadingSpinners, { single: true }), data?.topSources?.length > 0 &&
25
+ data.topSources.map((source, index) => (_jsxs("div", { className: 'w-full text-sm flex justify-between', children: [_jsxs("span", { className: 'font-bold text-foreground', children: [source.name, ":"] }), _jsx(Badge, { variant: 'outline', className: 'ms-2', children: formatNumber(source.value) })] }, `${index}-${source.name}`)))] }) }));
26
+ };
@@ -0,0 +1,5 @@
1
+ export declare const TotalPageViews: ({ fromDate, toDate, }: {
2
+ fromDate: Date | string | null;
3
+ toDate: Date | string | null;
4
+ }) => import("react/jsx-runtime").JSX.Element;
5
+ //# sourceMappingURL=TotalPageViews.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TotalPageViews.d.ts","sourceRoot":"","sources":["../../../src/client/components/TotalPageViews.tsx"],"names":[],"mappings":"AASA,eAAO,MAAM,cAAc,GAAI,uBAG5B;IACC,QAAQ,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAA;IAC9B,MAAM,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAA;CAC/B,4CAyBA,CAAA"}
@@ -0,0 +1,24 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useI18n } from 'nextjs-cms/translations/client';
3
+ import { formatNumber } from 'nextjs-cms/utils';
4
+ import ContainerBox from '@/components/ContainerBox';
5
+ import { useAxiosPrivate } from 'nextjs-cms/api/client';
6
+ import { useQuery } from '@tanstack/react-query';
7
+ import { getAnalytics } from '@/lib/apiHelpers';
8
+ import LoadingSpinners from '@/components/LoadingSpinners';
9
+ export const TotalPageViews = ({ fromDate, toDate, }) => {
10
+ const t = useI18n();
11
+ const axiosPrivate = useAxiosPrivate();
12
+ const controller = new AbortController();
13
+ const { isLoading, isError, data, error } = useQuery({
14
+ queryKey: ['analyticsPage', 'statistics', fromDate, toDate],
15
+ queryFn: () => getAnalytics({
16
+ requestType: 'statistics',
17
+ axiosPrivate,
18
+ controller,
19
+ fromDate,
20
+ toDate,
21
+ }),
22
+ });
23
+ return (_jsx(ContainerBox, { title: t('totalPageViews'), children: isLoading ? (_jsx(LoadingSpinners, { single: true })) : (_jsx("div", { className: 'text-4xl', children: formatNumber(data?.totalPageViews) })) }));
24
+ };
@@ -0,0 +1,5 @@
1
+ export declare const TotalSessions: ({ fromDate, toDate, }: {
2
+ fromDate: Date | string | null;
3
+ toDate: Date | string | null;
4
+ }) => import("react/jsx-runtime").JSX.Element;
5
+ //# sourceMappingURL=TotalSessions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TotalSessions.d.ts","sourceRoot":"","sources":["../../../src/client/components/TotalSessions.tsx"],"names":[],"mappings":"AASA,eAAO,MAAM,aAAa,GAAI,uBAG3B;IACC,QAAQ,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAA;IAC9B,MAAM,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAA;CAC/B,4CAyBA,CAAA"}
@@ -0,0 +1,24 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useI18n } from 'nextjs-cms/translations/client';
3
+ import { formatNumber } from 'nextjs-cms/utils';
4
+ import ContainerBox from '@/components/ContainerBox';
5
+ import { useAxiosPrivate } from 'nextjs-cms/api/client';
6
+ import { useQuery } from '@tanstack/react-query';
7
+ import { getAnalytics } from '@/lib/apiHelpers';
8
+ import LoadingSpinners from '@/components/LoadingSpinners';
9
+ export const TotalSessions = ({ fromDate, toDate, }) => {
10
+ const t = useI18n();
11
+ const axiosPrivate = useAxiosPrivate();
12
+ const controller = new AbortController();
13
+ const { isLoading, isError, data, error } = useQuery({
14
+ queryKey: ['analyticsPage', 'statistics', fromDate, toDate],
15
+ queryFn: () => getAnalytics({
16
+ requestType: 'statistics',
17
+ axiosPrivate,
18
+ controller,
19
+ fromDate,
20
+ toDate,
21
+ }),
22
+ });
23
+ return (_jsx(ContainerBox, { title: t('totalSessions'), children: isLoading ? (_jsx(LoadingSpinners, { single: true })) : (_jsx("div", { className: 'text-4xl', children: formatNumber(data?.totalSessions) })) }));
24
+ };
@@ -0,0 +1,5 @@
1
+ export declare const TotalUniqueUsers: ({ fromDate, toDate, }: {
2
+ fromDate: Date | string | null;
3
+ toDate: Date | string | null;
4
+ }) => import("react/jsx-runtime").JSX.Element;
5
+ //# sourceMappingURL=TotalUniqueUsers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TotalUniqueUsers.d.ts","sourceRoot":"","sources":["../../../src/client/components/TotalUniqueUsers.tsx"],"names":[],"mappings":"AASA,eAAO,MAAM,gBAAgB,GAAI,uBAG9B;IACC,QAAQ,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAA;IAC9B,MAAM,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAA;CAC/B,4CAyBA,CAAA"}
@@ -0,0 +1,24 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useI18n } from 'nextjs-cms/translations/client';
3
+ import { formatNumber } from 'nextjs-cms/utils';
4
+ import ContainerBox from '@/components/ContainerBox';
5
+ import { useAxiosPrivate } from 'nextjs-cms/api/client';
6
+ import { useQuery } from '@tanstack/react-query';
7
+ import { getAnalytics } from '@/lib/apiHelpers';
8
+ import LoadingSpinners from '@/components/LoadingSpinners';
9
+ export const TotalUniqueUsers = ({ fromDate, toDate, }) => {
10
+ const t = useI18n();
11
+ const axiosPrivate = useAxiosPrivate();
12
+ const controller = new AbortController();
13
+ const { isLoading, isError, data, error } = useQuery({
14
+ queryKey: ['analyticsPage', 'statistics', fromDate, toDate],
15
+ queryFn: () => getAnalytics({
16
+ requestType: 'statistics',
17
+ axiosPrivate,
18
+ controller,
19
+ fromDate,
20
+ toDate,
21
+ }),
22
+ });
23
+ return (_jsx(ContainerBox, { title: t('totalUniqueUsers'), children: isLoading ? (_jsx(LoadingSpinners, { single: true })) : (_jsx("div", { className: 'text-4xl', children: formatNumber(data?.totalUniqueUsers) })) }));
24
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAEnD,OAAO,EAAE,qBAAqB,EAAE,CAAA;AAEhC,wBAAsB,YAAY;;;;;;;;;;;;;;;oBAQw0D,CAAC;qBAA2B,CAAC;;;;;;;;;;;;;;;;;;;;;GADt4D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAEnD,OAAO,EAAE,qBAAqB,EAAE,CAAA;AAEhC,wBAAsB,YAAY;;;;;;;;;;;;;;;oBAQ4zD,CAAC;qBAA2B,CAAC;;;;;;;;;;;;;;;;;;;;;GAD13D"}
@@ -1 +1 @@
1
- {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;gBAKiuD,CAAC;iBAA2B,CAAC;;;;;;;;;;;;GAD9xD,CAAA"}
1
+ {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;gBAKstD,CAAC;iBAA2B,CAAC;;;;;;;;;;;;GADnxD,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextjscms/plugin-google-analytics",
3
- "version": "2.1.30",
3
+ "version": "2.1.32",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -25,7 +25,7 @@
25
25
  "peerDependencies": {
26
26
  "react": "19.2.3",
27
27
  "react-dom": "19.2.3",
28
- "nextjs-cms": "0.9.30"
28
+ "nextjs-cms": "0.9.32"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/react": "^19.2.7",