fix gsc onboarding nudge state (#240)
This commit is contained in:
parent
96f365a473
commit
8ea55a3e77
@ -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 =
|
const eligible =
|
||||||
hosted &&
|
hosted &&
|
||||||
!suppressed &&
|
!suppressed &&
|
||||||
|
|||||||
@ -24,9 +24,9 @@ export const userOnboardingAnswers = sqliteTable(
|
|||||||
foundVia: text("found_via"),
|
foundVia: text("found_via"),
|
||||||
mcpSetupIntent: text("mcp_setup_intent"),
|
mcpSetupIntent: text("mcp_setup_intent"),
|
||||||
completedAt: text("completed_at"),
|
completedAt: text("completed_at"),
|
||||||
// Set when the user dismisses (or acts on) the one-time "connect Search
|
// Set when the user resolves the Search Console ask, either in current
|
||||||
// Console" nudge shown to people who finished onboarding before the GSC
|
// onboarding or via the one-time re-engagement nudge for legacy users.
|
||||||
// step existed. Null = never shown/dismissed.
|
// Null = not yet shown/resolved.
|
||||||
gscNudgeDismissedAt: text("gsc_nudge_dismissed_at"),
|
gscNudgeDismissedAt: text("gsc_nudge_dismissed_at"),
|
||||||
createdAt: text("created_at")
|
createdAt: text("created_at")
|
||||||
.notNull()
|
.notNull()
|
||||||
|
|||||||
@ -82,7 +82,12 @@ export const saveOnboardingAnswers = createServerFn({ method: "POST" })
|
|||||||
...(data.mcpSetupIntent !== undefined
|
...(data.mcpSetupIntent !== undefined
|
||||||
? { mcpSetupIntent: data.mcpSetupIntent }
|
? { 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,
|
updatedAt: now,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -97,6 +102,7 @@ export const saveOnboardingAnswers = createServerFn({ method: "POST" })
|
|||||||
foundVia: data.foundVia,
|
foundVia: data.foundVia,
|
||||||
mcpSetupIntent: data.mcpSetupIntent,
|
mcpSetupIntent: data.mcpSetupIntent,
|
||||||
completedAt,
|
completedAt,
|
||||||
|
gscNudgeDismissedAt: completedAt,
|
||||||
updatedAt: now,
|
updatedAt: now,
|
||||||
})
|
})
|
||||||
.onConflictDoUpdate({
|
.onConflictDoUpdate({
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user