@unproducts/nuxt-posthog 2.0.3 → 2.0.4

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.d.mts CHANGED
@@ -9,7 +9,7 @@ interface ModuleOptions {
9
9
  * @type string
10
10
  * @docs https://posthog.com/docs/api
11
11
  */
12
- publicKey: string;
12
+ key: string;
13
13
  /**
14
14
  * The PostHog API host
15
15
  * @default process.env.POSTHOG_API_HOST
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-posthog",
3
3
  "configKey": "posthog",
4
- "version": "2.0.3",
4
+ "version": "2.0.4",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.1"
package/dist/module.mjs CHANGED
@@ -7,7 +7,7 @@ const module$1 = defineNuxtModule({
7
7
  configKey: "posthog"
8
8
  },
9
9
  defaults: {
10
- publicKey: process.env.POSTHOG_API_KEY,
10
+ key: process.env.POSTHOG_API_KEY,
11
11
  host: process.env.POSTHOG_API_HOST,
12
12
  capturePageViews: true,
13
13
  capturePageLeaves: true,
@@ -18,13 +18,13 @@ const module$1 = defineNuxtModule({
18
18
  },
19
19
  setup(options, nuxt) {
20
20
  const { resolve } = createResolver(import.meta.url);
21
- if (!options.publicKey || !options.host) {
21
+ if (!options.key || !options.host) {
22
22
  options.disabled = true;
23
23
  } else if (!options.disabled) {
24
24
  nuxt.options.runtimeConfig.public.posthog = defu(
25
25
  nuxt.options.runtimeConfig.public.posthog,
26
26
  {
27
- publicKey: options.publicKey,
27
+ key: options.key,
28
28
  host: options.host,
29
29
  capturePageViews: options.capturePageViews,
30
30
  capturePageLeaves: options.capturePageLeaves,
@@ -32,7 +32,7 @@ export default defineNuxtPlugin({
32
32
  clientOptions.ui_host = `https://${region}.posthog.com`;
33
33
  clientOptions.api_host = `${window.location.origin}/ingest/ph`;
34
34
  }
35
- const posthogClient = posthog.init(config.publicKey, clientOptions);
35
+ const posthogClient = posthog.init(config.key, clientOptions);
36
36
  const identity = useCookie("ph-identify");
37
37
  identity.value = posthog.get_distinct_id();
38
38
  if (config.capturePageViews) {
@@ -12,7 +12,7 @@ export default defineNuxtPlugin({
12
12
  }
13
13
  };
14
14
  const PostHog = (await import("posthog-node")).PostHog;
15
- const posthog = new PostHog(config.publicKey, { host: config.host });
15
+ const posthog = new PostHog(config.key, { host: config.host });
16
16
  await posthog.reloadFeatureFlags();
17
17
  const identity = useCookie("ph-identify", { default: () => "" });
18
18
  const { featureFlags, featureFlagPayloads } = await posthog.getAllFlagsAndPayloads(identity.value);
@@ -7,7 +7,7 @@ declare module '@nuxt/schema' {
7
7
  interface PublicRuntimeConfig {
8
8
  posthog?: Pick<
9
9
  ModuleOptions,
10
- 'publicKey' | 'host' | 'capturePageViews' | 'capturePageLeaves' | 'clientOptions' | 'proxy'
10
+ 'key' | 'host' | 'capturePageViews' | 'capturePageLeaves' | 'clientOptions' | 'proxy'
11
11
  >;
12
12
  }
13
13
  }
@@ -6,7 +6,7 @@ export const usePostHog = async () => {
6
6
  if (!config || !runtimeConfig.server) return;
7
7
  if (!posthog) {
8
8
  const PostHog = (await import("posthog-node")).PostHog;
9
- posthog = new PostHog(config.publicKey, { host: config.host });
9
+ posthog = new PostHog(config.key, { host: config.host });
10
10
  }
11
11
  return posthog;
12
12
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unproducts/nuxt-posthog",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "description": "PostHog module for nuxt",
5
5
  "publishConfig": {
6
6
  "access": "public"