@faststats/nuxt 0.5.0 → 0.7.0
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/module.mjs +2 -3
- package/package.json +2 -2
- package/runtime/faststats.client.ts +1 -9
package/dist/module.mjs
CHANGED
|
@@ -3,7 +3,7 @@ import { addPlugin, addTypeTemplate, createResolver, defineNuxtModule, useLogger
|
|
|
3
3
|
import { defu } from "defu";
|
|
4
4
|
//#region src/module.ts
|
|
5
5
|
const SDK_NAME = "@faststats/nuxt";
|
|
6
|
-
const SDK_VERSION = "0.
|
|
6
|
+
const SDK_VERSION = "0.7.0";
|
|
7
7
|
var module_default = defineNuxtModule({
|
|
8
8
|
meta: {
|
|
9
9
|
name: "@faststats/nuxt",
|
|
@@ -12,8 +12,7 @@ var module_default = defineNuxtModule({
|
|
|
12
12
|
defaults: {
|
|
13
13
|
baseUrl: "https://metrics.faststats.dev",
|
|
14
14
|
debug: false,
|
|
15
|
-
autoTrack: true
|
|
16
|
-
errorTracking: { enabled: true }
|
|
15
|
+
autoTrack: true
|
|
17
16
|
},
|
|
18
17
|
setup(options, nuxt) {
|
|
19
18
|
const logger = useLogger("faststats");
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"type": "git",
|
|
5
5
|
"url": "https://github.com/faststats-dev/faststats-javascript.git"
|
|
6
6
|
},
|
|
7
|
-
"version": "0.
|
|
7
|
+
"version": "0.7.0",
|
|
8
8
|
"type": "module",
|
|
9
9
|
"main": "./dist/module.mjs",
|
|
10
10
|
"types": "./dist/module.d.mts",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"nuxt": "^3.12.0 || ^4.0.0"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@faststats/web": "^0.
|
|
34
|
+
"@faststats/web": "^0.7.0",
|
|
35
35
|
"@nuxt/kit": "^4.4.0",
|
|
36
36
|
"defu": "^6.1.4"
|
|
37
37
|
},
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
getInstance,
|
|
3
2
|
reportError,
|
|
4
3
|
WebAnalytics,
|
|
5
4
|
type WebAnalyticsOptions,
|
|
6
5
|
} from "@faststats/web";
|
|
7
6
|
import { defineNuxtPlugin, useRuntimeConfig } from "nuxt/app";
|
|
8
7
|
|
|
9
|
-
type FaststatsWindow = Window & {
|
|
10
|
-
__faststats?: { getInstance: typeof getInstance };
|
|
11
|
-
};
|
|
12
|
-
|
|
13
8
|
function normalizeVueError(error: unknown, info?: string): Error {
|
|
14
9
|
if (error instanceof Error) return error;
|
|
15
10
|
const message = typeof error === "string" ? error : String(error);
|
|
@@ -18,13 +13,10 @@ function normalizeVueError(error: unknown, info?: string): Error {
|
|
|
18
13
|
|
|
19
14
|
export default defineNuxtPlugin((nuxtApp) => {
|
|
20
15
|
const runtime = useRuntimeConfig().public.faststats;
|
|
16
|
+
if (!runtime?.siteKey) return;
|
|
21
17
|
|
|
22
18
|
new WebAnalytics(runtime as WebAnalyticsOptions);
|
|
23
19
|
|
|
24
|
-
if (typeof window !== "undefined") {
|
|
25
|
-
(window as FaststatsWindow).__faststats = { getInstance };
|
|
26
|
-
}
|
|
27
|
-
|
|
28
20
|
const previousErrorHandler = nuxtApp.vueApp.config.errorHandler;
|
|
29
21
|
nuxtApp.vueApp.config.errorHandler = (error, instance, info) => {
|
|
30
22
|
reportError(normalizeVueError(error, info));
|