feat: landing page CRO revision, demo page, auto-trial, multi-catalog messaging
- Rewrite landing page copy with Jobs-to-be-Done and loss framing - Add VIN live preview via backend pl24+emex decode chain - Add comparison table (mobile-responsive), stats, pricing teaser, referral banner - Replace testimonials with aggregate social proof stats - Create demo page with 3-step VIN decode flow for unregistered users - Add public /vehicles/preview/:vin endpoint (no auth required) - Auto-create 7-day trial subscription on user registration - Highlight multi-catalog cross-querying advantage in OEM feature and comparison - Update register page with trial messaging and VIN param support Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { betterAuth } from "better-auth";
|
||||
import { drizzleAdapter } from "better-auth/adapters/drizzle";
|
||||
import { drizzle } from "drizzle-orm/postgres-js";
|
||||
import { eq, asc } from "drizzle-orm";
|
||||
import postgres from "postgres";
|
||||
import * as schema from "../database/schema/core";
|
||||
|
||||
@@ -56,6 +57,40 @@ export function createAuth(databaseUrl: string, secret: string, baseUrl: string)
|
||||
},
|
||||
},
|
||||
},
|
||||
databaseHooks: {
|
||||
user: {
|
||||
create: {
|
||||
after: async (user) => {
|
||||
try {
|
||||
// Find the lowest-tier plan for trial
|
||||
const [plan] = await db
|
||||
.select()
|
||||
.from(schema.plans)
|
||||
.where(eq(schema.plans.isActive, true))
|
||||
.orderBy(asc(schema.plans.priceMonthly))
|
||||
.limit(1);
|
||||
|
||||
if (!plan) return;
|
||||
|
||||
const now = new Date();
|
||||
const endDate = new Date(now);
|
||||
endDate.setDate(endDate.getDate() + 7);
|
||||
|
||||
await db.insert(schema.userSubscriptions).values({
|
||||
userId: user.id,
|
||||
planId: plan.id,
|
||||
status: "trial",
|
||||
billingPeriod: "monthly",
|
||||
startDate: now,
|
||||
endDate,
|
||||
});
|
||||
} catch (err) {
|
||||
console.error("Failed to create trial subscription:", err);
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
trustedOrigins: [
|
||||
...(process.env.CORS_ORIGIN || "http://localhost:3000").split(","),
|
||||
"http://localhost:4000",
|
||||
|
||||
Reference in New Issue
Block a user