revops + onboarding
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
'use client';
|
||||
|
||||
import React, { useState } from 'react';
|
||||
import { Sparkles, Brain, TrendingUp, MessageSquare, Palette, ArrowRight, Mail, CheckCircle2, Lock } from 'lucide-react';
|
||||
import Link from 'next/link';
|
||||
import { motion } from 'framer-motion';
|
||||
import React, { useState } from 'react';
|
||||
import { Sparkles, Brain, TrendingUp, MessageSquare, Palette, ArrowRight, Mail, CheckCircle2, Lock } from 'lucide-react';
|
||||
import Link from 'next/link';
|
||||
import { motion } from 'framer-motion';
|
||||
import { trackEvent } from '@/components/PostHogProvider';
|
||||
|
||||
const AIComingSoonBanner = () => {
|
||||
const [email, setEmail] = useState('');
|
||||
@@ -25,14 +26,21 @@ const AIComingSoonBanner = () => {
|
||||
body: JSON.stringify({ email }),
|
||||
});
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(data.error || 'Failed to subscribe');
|
||||
}
|
||||
|
||||
setSubmitted(true);
|
||||
setEmail('');
|
||||
const data = await response.json();
|
||||
|
||||
if (!response.ok) {
|
||||
const errorMessage = typeof data?.error === 'string'
|
||||
? data.error
|
||||
: data?.details?.[0]?.message || 'Failed to subscribe';
|
||||
throw new Error(errorMessage);
|
||||
}
|
||||
|
||||
trackEvent('newsletter_subscribed', {
|
||||
source: 'ai_coming_soon_banner',
|
||||
already_subscribed: Boolean(data.alreadySubscribed),
|
||||
});
|
||||
setSubmitted(true);
|
||||
setEmail('');
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : 'Something went wrong. Please try again.');
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user