@posthog/nuxt 1.1.5 → 1.2.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.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.7.0"
6
6
  },
7
- "version": "1.1.5",
7
+ "version": "1.2.0",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "unknown"
@@ -1,29 +1,32 @@
1
1
  import { defineNuxtPlugin, useRuntimeConfig } from "#app";
2
2
  import posthog from "posthog-js";
3
- export default defineNuxtPlugin((nuxtApp) => {
4
- const runtimeConfig = useRuntimeConfig();
5
- const posthogCommon = runtimeConfig.public.posthog;
6
- const posthogClientConfig = runtimeConfig.public.posthogClientConfig;
7
- if (!window || posthog.__loaded) {
8
- return;
9
- }
10
- posthog.init(posthogCommon.publicKey, {
11
- api_host: posthogCommon.host,
12
- ...posthogClientConfig
13
- });
14
- if (posthogCommon.debug) {
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
- return {
23
- provide: {
24
- posthog: () => posthog
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.5",
3
+ "version": "1.2.0",
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-js": "1.293.0",
25
26
  "posthog-node": "5.11.2",
26
- "@posthog/core": "1.5.2",
27
- "posthog-js": "1.292.0"
27
+ "@posthog/core": "1.5.2"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/node": "^20.0.0",