Skip to content
Shell
6.8 KB
Raw Blame

Monetization Implementation Plan

Overview

Implement 3-phase monetization: affiliate sidebar widget, contextual trade prompts, and freemium soft gates.


Phase 1: Sidebar Affiliate Widget

New Component

File: /web/src/components/ui/affiliate-widget.tsx

┌─────────────┐
│ 🦙 Trade    │
│ with Alpaca │
│             │
│ Commission- │
│ free stocks │
│             │
│ [Start →]   │
│   Sponsored │
└─────────────┘

Integration Point

File: /web/src/components/layout/LeftSidebar.tsx

  • Add <AffiliateWidget /> above <SidebarUpgradeBanner /> (around line 443)
  • Only show when sidebar is expanded
  • Respect user dismissal (localStorage flag)

Features

  • Alpaca logo + "Trade with Alpaca" header
  • "Commission-free stocks & ETFs" subtitle
  • "Open Account" CTA with referral link
  • "Sponsored" label for transparency
  • Dismissible with X button (remembers preference)
  • Collapsed state shows just icon

Phase 2: Contextual Trade Prompts

New Component

File: /web/src/components/chat/ContextualPromptCard.tsx

Styled card that appears after AI responses mentioning tradeable symbols.

┌─────────────────────────────────────────┐
│ 📈 Ready to trade NVDA?                 │
│                                         │
│ Execute your thesis with Alpaca         │
│ [Paper Trade] [Open Account →]          │
└─────────────────────────────────────────┘

Integration Points

  1. Extend Message Type File: /web/src/lib/stores/chat-store.ts

    type ContextualPrompt = {
      id: string;
      type: 'affiliate' | 'upgrade';
      symbol?: string;
      title: string;
      description: string;
    };
    
    type Message = {
      // existing...
      contextualPrompts?: ContextualPrompt[];
    };
    
  2. Add to MessageBubble File: /web/src/components/chat/MessageBubble.tsx

    • After line 224 (after toolInvocations), render contextual prompts
    • Follow same pattern as ToolUseCard
  3. Symbol Detection File: /web/src/components/chat/ConversationView.tsx

    • After AI response completes, check if response mentions stock symbols
    • Use regex: /\b[A-Z]{1,5}\b/ cross-referenced with known tickers
    • Add contextual prompt to message if trade-relevant advice detected

Trigger Conditions

  • AI mentions specific stock ticker
  • Message contains trade advice keywords: "buy", "sell", "position", "entry"
  • User is on free tier OR hasn't linked brokerage
  • Max 1 prompt per message, 3 per conversation

Phase 3: Freemium Soft Gates

Leverage Existing Components

  • SidebarUpgradeBanner - already exists
  • PaywallModal - already exists
  • UpgradeBanner - already exists with variants

New: Feature-Specific Upgrade Prompts

File: /web/src/components/ui/feature-gate.tsx

Wrapper component for gating features:

<FeatureGate feature="emotionalFirewall" tier="elite">
  <EmotionalFirewallInsights />
</FeatureGate>

Shows locked state with upgrade CTA if user lacks access.

Integration Points

  1. Emotional Firewall Weekly Insights File: /web/src/components/emotional-firewall/ (new section)

    • Free: Basic alerts only
    • Pro: Unlock "Weekly Insights" panel with patterns, triggers, win rate by mood
  2. Chat Usage Limit File: /web/src/components/chat/ChatInput.tsx

    • Show usage counter: "12/20 messages today"
    • Soft gate at limit with upgrade prompt (not hard block)
  3. Thesis Builder Limit File: /web/src/app/thesis/page.tsx or thesis components

    • Free: 5 active theses
    • Show count + upgrade when at limit
  4. Journal Export

    • Free: View only
    • Pro: Export button visible, clicks trigger upgrade prompt if free

UI Patterns

Soft Lock (show preview + upgrade)

┌─────────────────────────────────────┐
│ 🔒 WEEKLY INSIGHTS (Pro)            │
│                                     │
│ Your patterns this week:            │
│ • Best hours: ██████░░░░ [blur]     │
│ • Triggers: ████████░░ [blur]       │
│                                     │
│ [Unlock for $12/mo]                 │
└─────────────────────────────────────┘

Usage Counter

┌─────────────────────────────────────┐
│ 💬 12/20 messages today             │
│ ████████████░░░░░░░░                │
│ Pro: Unlimited + faster responses   │
└─────────────────────────────────────┘

Files to Create/Modify

New Files

File Purpose
/web/src/components/ui/affiliate-widget.tsx Sidebar Alpaca widget
/web/src/components/chat/ContextualPromptCard.tsx Post-message trade prompt
/web/src/components/ui/feature-gate.tsx Wrapper for gated features
/web/src/lib/affiliate-config.ts Referral URLs, tracking params

Modified Files

File Change
/web/src/components/layout/LeftSidebar.tsx Add AffiliateWidget
/web/src/components/chat/MessageBubble.tsx Render contextual prompts
/web/src/components/chat/ConversationView.tsx Symbol detection logic
/web/src/lib/stores/chat-store.ts Extend Message type
/web/src/components/chat/ChatInput.tsx Add usage counter

Implementation Order

  1. Phase 1 (~30 min)

    • Create affiliate-widget.tsx
    • Create affiliate-config.ts with Alpaca referral URL
    • Integrate into LeftSidebar
  2. Phase 2 (~45 min)

    • Create ContextualPromptCard.tsx
    • Extend Message type
    • Add to MessageBubble
    • Add symbol detection in ConversationView
  3. Phase 3 (~45 min)

    • Create feature-gate.tsx wrapper
    • Add usage counter to ChatInput
    • Add soft gate to Emotional Firewall insights area

Affiliate Configuration

// /web/src/lib/affiliate-config.ts
export const AFFILIATES = {
  alpaca: {
    name: 'Alpaca',
    referralUrl: 'https://alpaca.markets/?ref=deepstack',
    logo: '/logos/alpaca.svg',
    tagline: 'Commission-free stocks & ETFs',
    cta: 'Open Account',
  },
};

Success Metrics

  • Affiliate: Click-through rate on widget + contextual prompts
  • Freemium: Upgrade conversion rate from soft gates
  • Retention: Do gates cause churn or drive upgrades?