@nextjscms/plugin-google-analytics 2.1.22 → 2.1.23
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/client/AnalyticsPage.js +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -3
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +4 -2
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +1 -9
- package/package.json +2 -2
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { usePluginTRPC } from 'nextjs-cms/plugins/client';
|
|
4
4
|
import { useI18n } from 'nextjs-cms/translations/client';
|
|
5
5
|
export const GoogleAnalyticsPage = ({ title }) => {
|
|
6
6
|
const t = useI18n();
|
|
7
|
-
const trpc =
|
|
7
|
+
const trpc = usePluginTRPC();
|
|
8
8
|
const query = trpc?.googleAnalytics?.test.useQuery;
|
|
9
9
|
const { data, isLoading, isError, error } = query ? query() : { isLoading: true, isError: true, error: null };
|
|
10
10
|
if (!query) {
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,wBAAgB,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,wBAAgB,YAAY,6DAa3B"}
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
import { definePlugin } from 'nextjs-cms/plugins/
|
|
1
|
+
import { definePlugin } from 'nextjs-cms/plugins/define';
|
|
2
2
|
import { googleAnalyticsRouter } from './router.js';
|
|
3
3
|
export function createPlugin() {
|
|
4
4
|
return definePlugin({
|
|
5
5
|
title: 'Google Analytics',
|
|
6
|
-
name: 'plugin_google_analytics',
|
|
7
|
-
registryName: 'google-analytics',
|
|
8
6
|
router: googleAnalyticsRouter,
|
|
9
7
|
routes: [
|
|
10
8
|
{
|
|
11
9
|
path: '/google-analytics',
|
|
12
10
|
title: 'Google Analytics',
|
|
13
11
|
icon: 'chart-line',
|
|
12
|
+
prefetch: 'googleAnalytics.test',
|
|
14
13
|
},
|
|
15
14
|
],
|
|
16
15
|
});
|
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":"AAKA,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;gBAKuxD,CAAC;iBAA2B,CAAC;;;;;;;;;;;;GADp1D,CAAA"}
|
package/dist/router.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { pluginProcedure, router } from 'nextjs-cms/api/
|
|
1
|
+
import { pluginProcedure, router } from 'nextjs-cms/api/plugin';
|
|
2
|
+
import { extractPluginName } from 'nextjs-cms/plugins/derive';
|
|
3
|
+
const PLUGIN_NAME = extractPluginName(import.meta.url);
|
|
2
4
|
export const googleAnalyticsRouter = router({
|
|
3
|
-
test: pluginProcedure(
|
|
5
|
+
test: pluginProcedure(PLUGIN_NAME).query(async ({ ctx }) => {
|
|
4
6
|
return true;
|
|
5
7
|
}),
|
|
6
8
|
});
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.tsx"],"names":[],"mappings":"AAMA,wBAA8B,qBAAqB,qDAWlD"}
|
package/dist/server.js
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { api, HydrateClient } from 'nextjs-cms/api/trpc/server';
|
|
3
2
|
import { GoogleAnalyticsPage } from './client/AnalyticsPage.js';
|
|
4
3
|
import { findPluginRouteByPath } from 'nextjs-cms/plugins/server';
|
|
5
4
|
import { resolveMultilingualString, resolveLanguage } from 'nextjs-cms/translations';
|
|
6
5
|
import { getCMSConfig } from 'nextjs-cms/core';
|
|
7
6
|
import auth from 'nextjs-cms/auth';
|
|
8
7
|
export default async function GoogleAnalyticsServer() {
|
|
9
|
-
const helpers = api;
|
|
10
|
-
const prefetch = helpers.googleAnalytics?.test?.prefetch;
|
|
11
|
-
if (!prefetch) {
|
|
12
|
-
throw new Error('[google-analytics] Missing googleAnalytics.test prefetch helper.');
|
|
13
|
-
}
|
|
14
|
-
await prefetch();
|
|
15
|
-
// Resolve the plugin route title
|
|
16
8
|
const [route, session, config] = await Promise.all([
|
|
17
9
|
findPluginRouteByPath('/google-analytics'),
|
|
18
10
|
auth(),
|
|
@@ -21,5 +13,5 @@ export default async function GoogleAnalyticsServer() {
|
|
|
21
13
|
const { supportedLanguages, fallbackLanguage } = config.i18n;
|
|
22
14
|
const language = resolveLanguage(session?.user?.language, supportedLanguages, fallbackLanguage);
|
|
23
15
|
const resolvedTitle = route ? resolveMultilingualString(route.title, language, fallbackLanguage) : '';
|
|
24
|
-
return
|
|
16
|
+
return _jsx(GoogleAnalyticsPage, { title: resolvedTitle });
|
|
25
17
|
}
|
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.23",
|
|
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.23"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/react": "^19.2.7",
|