@startsimpli/analytics 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/package.json +5 -3
  2. package/src/telemetry.ts +4 -3
package/package.json CHANGED
@@ -1,10 +1,12 @@
1
1
  {
2
2
  "name": "@startsimpli/analytics",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Shared analytics and telemetry package for StartSimpli Next.js apps",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
7
- "files": ["src"],
7
+ "files": [
8
+ "src"
9
+ ],
8
10
  "publishConfig": {
9
11
  "access": "public"
10
12
  },
@@ -20,7 +22,7 @@
20
22
  },
21
23
  "peerDependencies": {
22
24
  "react": "^18.0.0 || ^19.0.0",
23
- "next": "^14.0.0 || ^15.0.0"
25
+ "next": "^14.0.0 || ^15.0.0 || ^16.0.0"
24
26
  },
25
27
  "peerDependenciesMeta": {
26
28
  "posthog-js": {
package/src/telemetry.ts CHANGED
@@ -85,9 +85,10 @@ export class TelemetryService {
85
85
  if (config?.posthog?.enabled !== false && posthogKey) {
86
86
  this.posthog = new PostHogProvider(posthogKey, posthogHost, debug)
87
87
  this.posthog.initialize()
88
- if (this.posthog.initialized) {
89
- this.providers.push(this.posthog)
90
- }
88
+ // PostHog loads asynchronously — always register the provider.
89
+ // The provider's isReady() check handles the async window internally
90
+ // and silently drops the few events that fire before the script loads.
91
+ this.providers.push(this.posthog)
91
92
  }
92
93
 
93
94
  this.initialized = true