@posthog/nuxt 1.1.5 → 1.2.1
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.json +1 -1
- package/dist/runtime/vue-plugin.js +25 -22
- package/package.json +3 -3
package/dist/module.json
CHANGED
|
@@ -1,29 +1,32 @@
|
|
|
1
1
|
import { defineNuxtPlugin, useRuntimeConfig } from "#app";
|
|
2
2
|
import posthog from "posthog-js";
|
|
3
|
-
export default defineNuxtPlugin(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
posthog.debug(true);
|
|
16
|
-
}
|
|
17
|
-
if (autocaptureEnabled(posthogClientConfig)) {
|
|
18
|
-
nuxtApp.hook("vue:error", (error, info) => {
|
|
19
|
-
posthog.captureException(error, { info });
|
|
3
|
+
export default defineNuxtPlugin({
|
|
4
|
+
name: "posthog-client",
|
|
5
|
+
setup(nuxtApp) {
|
|
6
|
+
const runtimeConfig = useRuntimeConfig();
|
|
7
|
+
const posthogCommon = runtimeConfig.public.posthog;
|
|
8
|
+
const posthogClientConfig = runtimeConfig.public.posthogClientConfig;
|
|
9
|
+
if (!window || posthog.__loaded) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
posthog.init(posthogCommon.publicKey, {
|
|
13
|
+
api_host: posthogCommon.host,
|
|
14
|
+
...posthogClientConfig
|
|
20
15
|
});
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
if (posthogCommon.debug) {
|
|
17
|
+
posthog.debug(true);
|
|
18
|
+
}
|
|
19
|
+
if (autocaptureEnabled(posthogClientConfig)) {
|
|
20
|
+
nuxtApp.hook("vue:error", (error, info) => {
|
|
21
|
+
posthog.captureException(error, { info });
|
|
22
|
+
});
|
|
25
23
|
}
|
|
26
|
-
|
|
24
|
+
return {
|
|
25
|
+
provide: {
|
|
26
|
+
posthog: () => posthog
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
27
30
|
});
|
|
28
31
|
function autocaptureEnabled(config) {
|
|
29
32
|
if (!config) return false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@posthog/nuxt",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Nuxt module for Posthog 🦔",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@posthog/cli": "~0.5.9",
|
|
24
24
|
"@nuxt/kit": ">=3.7.0",
|
|
25
|
-
"posthog-node": "5.11.2",
|
|
26
25
|
"@posthog/core": "1.5.2",
|
|
27
|
-
"posthog-js": "1.
|
|
26
|
+
"posthog-js": "1.294.0",
|
|
27
|
+
"posthog-node": "5.11.2"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/node": "^20.0.0",
|