@m13v/seo-components 0.26.0 → 0.27.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/package.json
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { NextRequest } from "next/server";
|
|
2
|
-
import { PostHog } from "posthog-node";
|
|
3
2
|
|
|
4
3
|
export interface BookCallRedirectConfig {
|
|
5
4
|
/** Site slug. Must match the value the POST handler encoded into the link. */
|
|
@@ -46,12 +45,15 @@ export function createBookCallRedirectHandler(config: BookCallRedirectConfig) {
|
|
|
46
45
|
if (validEmail && siteMatches) {
|
|
47
46
|
const posthogKey = process.env[posthogKeyEnv];
|
|
48
47
|
if (posthogKey) {
|
|
49
|
-
const ph = new PostHog(posthogKey, {
|
|
50
|
-
host: process.env[posthogHostEnv] || "https://us.i.posthog.com",
|
|
51
|
-
flushAt: 1,
|
|
52
|
-
flushInterval: 0,
|
|
53
|
-
});
|
|
54
48
|
try {
|
|
49
|
+
// Lazy import so sites that never use this handler don't have to
|
|
50
|
+
// install posthog-node to satisfy Next.js static analysis.
|
|
51
|
+
const { PostHog } = await import("posthog-node");
|
|
52
|
+
const ph = new PostHog(posthogKey, {
|
|
53
|
+
host: process.env[posthogHostEnv] || "https://us.i.posthog.com",
|
|
54
|
+
flushAt: 1,
|
|
55
|
+
flushInterval: 0,
|
|
56
|
+
});
|
|
55
57
|
ph.capture({
|
|
56
58
|
distinctId: email,
|
|
57
59
|
event: "book_call_email_link_clicked",
|