@activescott/analytics 0.3.1 → 0.3.2

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.
@@ -1 +1 @@
1
- {"version":3,"file":"post-hog-lazy-provider.d.ts","sourceRoot":"","sources":["../src/post-hog-lazy-provider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAQ/C,MAAM,WAAW,wBAAwB;IACvC;;;;;OAKG;IACH,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAA;IAChC,IAAI,CAAC,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAA;CACpE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,OAAO,EACP,MAAM,EACN,OAAO,EACP,IAAI,GACL,EAAE,wBAAwB,sCAS1B"}
1
+ {"version":3,"file":"post-hog-lazy-provider.d.ts","sourceRoot":"","sources":["../src/post-hog-lazy-provider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAQ/C,MAAM,WAAW,wBAAwB;IACvC;;;;;OAKG;IACH,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAA;IAChC,IAAI,CAAC,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,CAAA;CACpE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,OAAO,EACP,MAAM,EACN,OAAO,EACP,IAAI,GACL,EAAE,wBAAwB,sCAmB1B"}
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Suspense, lazy } from "react";
2
+ import { Suspense, lazy, useEffect, useState } from "react";
3
3
  const PostHogInit = lazy(() => import("./post-hog-init.js").then((module) => ({
4
4
  default: module.PostHogInit,
5
5
  })));
@@ -15,7 +15,17 @@ const PostHogInit = lazy(() => import("./post-hog-init.js").then((module) => ({
15
15
  * needed.
16
16
  */
17
17
  export function LazyPostHogProvider({ enabled, apiKey, options, user, }) {
18
- if (!enabled || !apiKey) {
18
+ // Client-only: the initialized tree pulls in posthog-js, whose react entry
19
+ // point Node's ESM resolver refuses (UMD-only subpath) and which assumes
20
+ // browser globals. Rendering it during SSR throws inside the Suspense
21
+ // boundary — the shell still streams, but the response status flips to 500
22
+ // with no log. Gating on mount keeps SSR output identical (null either
23
+ // way), so hydration stays clean.
24
+ const [mounted, setMounted] = useState(false);
25
+ useEffect(() => {
26
+ setMounted(true);
27
+ }, []);
28
+ if (!enabled || !apiKey || !mounted) {
19
29
  return null;
20
30
  }
21
31
  return (_jsx(Suspense, { fallback: null, children: _jsx(PostHogInit, { apiKey: apiKey, options: options, user: user }) }));
@@ -1 +1 @@
1
- {"version":3,"file":"post-hog-lazy-provider.js","sourceRoot":"","sources":["../src/post-hog-lazy-provider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,OAAO,CAAA;AAGtC,MAAM,WAAW,GAAG,IAAI,CAAC,GAAG,EAAE,CAC5B,MAAM,CAAC,oBAAoB,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC7C,OAAO,EAAE,MAAM,CAAC,WAAW;CAC5B,CAAC,CAAC,CACJ,CAAA;AAeD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,mBAAmB,CAAC,EAClC,OAAO,EACP,MAAM,EACN,OAAO,EACP,IAAI,GACqB;IACzB,I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EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,GAAI,GACpD,CACZ,CAAA;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@activescott/analytics",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "PostHog analytics integration for React Router apps — provider, SPA pageview tracking, user identification, and reverse proxy helper",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",