@nextjscms/plugin-google-analytics 2.1.28 → 2.1.30
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/dist/define.d.ts +11 -0
- package/dist/define.d.ts.map +1 -0
- package/dist/define.js +13 -0
- package/dist/index.d.ts +2 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -13
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +3 -2
- package/package.json +2 -2
- package/dist/client/components/BounceRate.d.ts +0 -5
- package/dist/client/components/BounceRate.d.ts.map +0 -1
- package/dist/client/components/BounceRate.js +0 -55
- package/dist/client/components/LivePageViews.d.ts +0 -2
- package/dist/client/components/LivePageViews.d.ts.map +0 -1
- package/dist/client/components/LivePageViews.js +0 -21
- package/dist/client/components/LiveUsersCount.d.ts +0 -2
- package/dist/client/components/LiveUsersCount.d.ts.map +0 -1
- package/dist/client/components/LiveUsersCount.js +0 -22
- package/dist/client/components/MonthlyPageViews.d.ts +0 -5
- package/dist/client/components/MonthlyPageViews.d.ts.map +0 -1
- package/dist/client/components/MonthlyPageViews.js +0 -24
- package/dist/client/components/TopCountries.d.ts +0 -5
- package/dist/client/components/TopCountries.d.ts.map +0 -1
- package/dist/client/components/TopCountries.js +0 -26
- package/dist/client/components/TopDevices.d.ts +0 -5
- package/dist/client/components/TopDevices.d.ts.map +0 -1
- package/dist/client/components/TopDevices.js +0 -26
- package/dist/client/components/TopMediums.d.ts +0 -5
- package/dist/client/components/TopMediums.d.ts.map +0 -1
- package/dist/client/components/TopMediums.js +0 -38
- package/dist/client/components/TopSources.d.ts +0 -5
- package/dist/client/components/TopSources.d.ts.map +0 -1
- package/dist/client/components/TopSources.js +0 -26
- package/dist/client/components/TotalPageViews.d.ts +0 -5
- package/dist/client/components/TotalPageViews.d.ts.map +0 -1
- package/dist/client/components/TotalPageViews.js +0 -24
- package/dist/client/components/TotalSessions.d.ts +0 -5
- package/dist/client/components/TotalSessions.d.ts.map +0 -1
- package/dist/client/components/TotalSessions.js +0 -24
- package/dist/client/components/TotalUniqueUsers.d.ts +0 -5
- package/dist/client/components/TotalUniqueUsers.d.ts.map +0 -1
- package/dist/client/components/TotalUniqueUsers.js +0 -24
package/dist/define.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const googleAnalyticsPlugin: {
|
|
2
|
+
readonly package: "@nextjscms/plugin-google-analytics";
|
|
3
|
+
readonly title: "Google Analytics";
|
|
4
|
+
readonly routes: readonly [{
|
|
5
|
+
readonly path: "/google-analytics";
|
|
6
|
+
readonly title: "Google Analytics";
|
|
7
|
+
readonly icon: "chart-line";
|
|
8
|
+
readonly prefetch: "googleAnalytics.test";
|
|
9
|
+
}];
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=define.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define.d.ts","sourceRoot":"","sources":["../src/define.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,qBAAqB;;;;;;;;;CAWhC,CAAA"}
|
package/dist/define.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { definePlugin } from 'nextjs-cms/plugins/define';
|
|
2
|
+
export const googleAnalyticsPlugin = definePlugin({
|
|
3
|
+
package: '@nextjscms/plugin-google-analytics',
|
|
4
|
+
title: 'Google Analytics',
|
|
5
|
+
routes: [
|
|
6
|
+
{
|
|
7
|
+
path: '/google-analytics',
|
|
8
|
+
title: 'Google Analytics',
|
|
9
|
+
icon: 'chart-line',
|
|
10
|
+
prefetch: 'googleAnalytics.test',
|
|
11
|
+
},
|
|
12
|
+
],
|
|
13
|
+
});
|
package/dist/index.d.ts
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
readonly title: "Google Analytics";
|
|
4
|
-
readonly routes: readonly [{
|
|
5
|
-
readonly path: "/google-analytics";
|
|
6
|
-
readonly title: "Google Analytics";
|
|
7
|
-
readonly icon: "chart-line";
|
|
8
|
-
readonly prefetch: "googleAnalytics.test";
|
|
9
|
-
}];
|
|
10
|
-
};
|
|
1
|
+
import { googleAnalyticsPlugin } from './define.js';
|
|
2
|
+
export { googleAnalyticsPlugin };
|
|
11
3
|
export declare function createPlugin(): Promise<{
|
|
12
4
|
router: import("@trpc/server").TRPCBuiltRouter<{
|
|
13
5
|
ctx: {
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
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"}
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
3
|
-
package: '@nextjscms/plugin-google-analytics',
|
|
4
|
-
title: 'Google Analytics',
|
|
5
|
-
routes: [
|
|
6
|
-
{
|
|
7
|
-
path: '/google-analytics',
|
|
8
|
-
title: 'Google Analytics',
|
|
9
|
-
icon: 'chart-line',
|
|
10
|
-
prefetch: 'googleAnalytics.test',
|
|
11
|
-
},
|
|
12
|
-
],
|
|
13
|
-
});
|
|
1
|
+
import { googleAnalyticsPlugin } from './define.js';
|
|
2
|
+
export { googleAnalyticsPlugin };
|
|
14
3
|
export async function createPlugin() {
|
|
15
4
|
const { googleAnalyticsRouter } = await import('./router.js');
|
|
16
5
|
return {
|
package/dist/router.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;gBAKiuD,CAAC;iBAA2B,CAAC;;;;;;;;;;;;GAD9xD,CAAA"}
|
package/dist/router.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { pluginProcedure, router } from 'nextjs-cms/api/plugin';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { derivePluginName } from 'nextjs-cms/plugins/derive';
|
|
3
|
+
import { googleAnalyticsPlugin } from './define.js';
|
|
4
|
+
const PLUGIN_NAME = derivePluginName(googleAnalyticsPlugin.package);
|
|
4
5
|
export const googleAnalyticsRouter = router({
|
|
5
6
|
test: pluginProcedure(PLUGIN_NAME).query(async ({ ctx }) => {
|
|
6
7
|
return true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextjscms/plugin-google-analytics",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.30",
|
|
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.
|
|
28
|
+
"nextjs-cms": "0.9.30"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/react": "^19.2.7",
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,55 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LivePageViews.d.ts","sourceRoot":"","sources":["../../../src/client/components/LivePageViews.tsx"],"names":[],"mappings":"AAQA,eAAO,MAAM,aAAa,+CA8CzB,CAAA"}
|
|
@@ -1,21 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LiveUsersCount.d.ts","sourceRoot":"","sources":["../../../src/client/components/LiveUsersCount.tsx"],"names":[],"mappings":"AASA,eAAO,MAAM,cAAc,+CAuB1B,CAAA"}
|
|
@@ -1,22 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,24 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,26 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,26 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,38 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,26 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,24 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,24 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
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"}
|
|
@@ -1,24 +0,0 @@
|
|
|
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
|
-
};
|