feat(surveys): replace Formbricks with self-rendered PostHog API surveys
Formbricks CE turned out to gate person-based targeting (setUserId/attributes → 403 enterprise) — the exact flexibility surveys need. PostHog already holds the person properties, so surveys move back there in API mode: posthog-js evaluates eligibility (event triggers, targeting flags like subscription_status=active, wait periods, per-distinct_id dedup) via getActiveMatchingSurveys, and we render the popover ourselves — zero PostHog branding, sase.tr dark-theme styling. - lib/surveys.ts: display manager + capture payload builders that mirror posthog-js's own "survey shown/dismissed/sent" shapes exactly ($survey_response_<qid>, $set $survey_dismissed/<id>[/iter], seenSurvey_*, lastSeenSurveyDate) so the PostHog Surveys results UI works unchanged - components/survey-popover.tsx: single_choice (+Diğer), open text, rating/NPS - posthog.ts: capture/pageview/identify now schedule survey checks; register deploy_env (dev.sase.tr ships the key now → staging traffic is filterable) - remove @formbricks/js, its CSP entries and build args Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { InAppEscape } from "@/components/in-app-escape";
|
||||
import { SurveyPopover } from "@/components/survey-popover";
|
||||
import { useAuth } from "@/hooks/use-auth";
|
||||
import { api } from "@/lib/api-client";
|
||||
import { resetChatwootUser, setChatwootUser } from "@/lib/chatwoot";
|
||||
@@ -156,6 +157,7 @@ function RootComponent() {
|
||||
</a>
|
||||
<InAppEscape />
|
||||
<Outlet />
|
||||
<SurveyPopover />
|
||||
<Toaster position="top-center" />
|
||||
</>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user