# Phase 8 — Power Features
## Weeks 15–17

---

## STEP 8.1 — RSS Feed Auto-Poster

**Route:** `GET /settings/rss-feeds` → Livewire: `Settings\RssFeeds`

UI: List of RSS feeds with platform assignment, keyword filter, delay setting, auto/review toggle.

### `app/Services/RSS\RssPollerService.php`
```php
public function pollFeed(RssFeed $feed): array
// Use SimplePie or Guzzle to fetch + parse feed
// Return new items since last_polled_at

public function processItem(array $item, RssFeed $feed): void
// 1. Check keyword filter — skip if item doesn't match
// 2. Call CaptionGeneratorService with article title + excerpt
// 3. Create Content + Post
// 4. Status: needs_review or scheduled based on feed.auto_post
```

Command: `rss:poll-feeds` (runs hourly)

---

## STEP 8.2 — Bulk Scheduling via CSV

**Route:** `GET /bulk-schedule` → Livewire: `BulkSchedule\BulkScheduler`

1. "Download Template" button → returns pre-built CSV with headers
2. FilePond upload for CSV file
3. Parse with `maatwebsite/excel`
4. Validate each row (platform valid, date parseable, caption not empty)
5. Show preview table with row validation status (green tick or red error)
6. "Import N posts" confirmation button
7. Progress bar during import (Livewire polling)

CSV columns: `date, time, timezone, platform, caption, media_filename, hashtags, status`

---

## STEP 8.3 — Social Listening

**Route:** `GET /listening` → Livewire: `Listening\SocialListening`

UI: Hootsuite Streams-style column layout
- Each monitoring keyword = one draggable column
- Each column shows matching public posts (polled from Twitter + Reddit APIs)
- Add new keyword → creates new column
- Pin/unpin columns

### `app/Services\ListeningService.php`
```php
public function pollKeyword(MonitoringKeyword $keyword): array
// Twitter: GET /2/tweets/search/recent?query={keyword}
// Reddit: GET https://www.reddit.com/search.json?q={keyword}
// Store results, de-duplicate, cache in Redis for 15 minutes
```

---

## STEP 8.4 — Link in Bio Manager

**Route:** `GET /link-in-bio` → Livewire: `LinkBio\LinkInBioManager`

1. Build `/bio/{username}` public page (no auth required)
2. Sortable.js for drag-to-reorder links
3. Customisation: bg color picker, button style, logo upload
4. Click tracking: `GET /bio/{username}/click/{linkId}` → increment click count → redirect

QR code: Use `bacon/bacon-qr-code` to generate QR for the bio page URL.

---

## STEP 8.5 — A/B Post Testing

**Route:** `GET /ab-tests` → Livewire: `ABTesting\ABTests`

1. Create A/B test: pick 2 posts (or create directly), set end date
2. System records engagement for both posts separately
3. After end date: `ab:evaluate` command runs, sends both posts' analytics to Gemini for analysis
4. Gemini response: winner, reasoning, recommendations
5. "Save Winner Style as Template" button

---

## STEP 8.6 — Notifications Center

**Route:** `GET /notifications` → Livewire: `Notifications\NotificationCenter`

UI: Full notification feed (like Hootsuite notification panel)
- Bell icon in top nav with unread badge
- Dropdown preview (top 5)
- Full page: paginated list with read/unread + clear all

Notification types with distinct icons:
- ✅ Post published successfully
- ❌ Post failed (with error)
- ⚠️ Token expiring in N days
- 🤖 AI auto-distribution generated new posts (needs review)
- 📊 Weekly analytics summary ready
- 💬 New inbox message
- ⏰ Upcoming post reminder (30 min before)

---

## STEP 8.7 — Settings Pages

`GET /settings` → tabbed settings page:

1. **Profile** — name, email, password, timezone
2. **Two-Factor Auth** — enable/disable 2FA, show QR
3. **Social Accounts** — same as the connect accounts page (link)
4. **Brand Kit** — (link to /settings/brand-kit)
5. **Notifications** — toggle each notification type, weekly report email toggle
6. **RSS Feeds** — (link)
7. **Auto-Reply Rules** — keyword → template rules
8. **API Usage** — current day's AI API usage stats (Redis)
9. **Danger Zone** — delete all drafts, clear media library

---

## COMPLETION CHECKLIST
- [ ] RSS feed poller command working
- [ ] RSS feed settings UI + auto/review toggle
- [ ] Bulk CSV upload + validation table + import
- [ ] Social listening column UI (Twitter + Reddit)
- [ ] Link in Bio public page + click tracking
- [ ] Link in Bio QR code generation
- [ ] A/B test creation + evaluation command
- [ ] A/B test results with AI analysis
- [ ] Notification center (bell dropdown + full page)
- [ ] All notification types working
- [ ] All settings pages complete
- [ ] API usage stats page

When done: update to `complete`, commit `feat(phase8): complete all power features — SocialForge v1.0 complete`, stop.
