fix gsc onboarding nudge state (#240)

This commit is contained in:
Ben Senescu 2026-06-04 23:25:01 -04:00 committed by GitHub
parent 96f365a473
commit 8ea55a3e77
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 4 deletions

View File

@ -48,6 +48,10 @@ export function GscReEngagementModal({
},
});
// Legacy users — those who finished onboarding before it included the Search
// Console step — have no gscNudgeDismissedAt set, so they're the only ones who
// see this. Anyone who completes current onboarding gets it stamped (they
// already saw that step), and dismissing/connecting clears it too.
const eligible =
hosted &&
!suppressed &&

View File

@ -24,9 +24,9 @@ export const userOnboardingAnswers = sqliteTable(
foundVia: text("found_via"),
mcpSetupIntent: text("mcp_setup_intent"),
completedAt: text("completed_at"),
// Set when the user dismisses (or acts on) the one-time "connect Search
// Console" nudge shown to people who finished onboarding before the GSC
// step existed. Null = never shown/dismissed.
// Set when the user resolves the Search Console ask, either in current
// onboarding or via the one-time re-engagement nudge for legacy users.
// Null = not yet shown/resolved.
gscNudgeDismissedAt: text("gsc_nudge_dismissed_at"),
createdAt: text("created_at")
.notNull()

View File

@ -82,7 +82,12 @@ export const saveOnboardingAnswers = createServerFn({ method: "POST" })
...(data.mcpSetupIntent !== undefined
? { mcpSetupIntent: data.mcpSetupIntent }
: {}),
...(completedAt !== undefined ? { completedAt } : {}),
// Completing onboarding means the user passed the Search Console step, so
// resolve the GSC prompt — the legacy re-engagement nudge must not fire
// for anyone who already saw that step.
...(completedAt !== undefined
? { completedAt, gscNudgeDismissedAt: completedAt }
: {}),
updatedAt: now,
};
@ -97,6 +102,7 @@ export const saveOnboardingAnswers = createServerFn({ method: "POST" })
foundVia: data.foundVia,
mcpSetupIntent: data.mcpSetupIntent,
completedAt,
gscNudgeDismissedAt: completedAt,
updatedAt: now,
})
.onConflictDoUpdate({