diff --git a/docs/ACTIVITY-COMPLIANCE-CHECKLIST.md b/docs/ACTIVITY-COMPLIANCE-CHECKLIST.md new file mode 100644 index 00000000..4e3a719a --- /dev/null +++ b/docs/ACTIVITY-COMPLIANCE-CHECKLIST.md @@ -0,0 +1,230 @@ +# Discord Activity SPA Compliance Checklist + +This checklist ensures your Discord Activity meets Discord's Single-Page Application (SPA) requirements. + +## ✅ Code Compliance + +### Activity Component (code/client/pages/Activity.tsx) + +- [ ] **No React Router Navigation** + - [ ] No `useNavigate()` hook + - [ ] No `navigate()` calls + - [ ] No `` components + +- [ ] **No Internal Page Navigation** + - [ ] All internal navigation removed + - [ ] Routes like `/creators`, `/opportunities`, `/settings` don't exist in Activity + - [ ] If accessing main app features, use `window.open(url, "_blank")` + +- [ ] **Proper Error Handling** + - [ ] Graceful error state display + - [ ] Loading state handled properly + - [ ] "Not in Discord" state shows helpful message instead of crashing + +- [ ] **PostMessage Communication** + - [ ] Activity uses Discord SDK (DiscordActivityContext) + - [ ] SDK handles all Discord communication + - [ ] No direct iframe communication attempted + +### Manifest Configuration (code/public/discord-manifest.json) + +- [ ] **Discord Proxy Domain Only** + - [ ] `rpc_origins` contains ONLY: `"https://578971245454950421.discordsays.com"` + - [ ] No external domains listed + - [ ] No `aethex.dev` in rpc_origins + +- [ ] **Valid JSON Structure** + - [ ] `id` matches Discord app ID: `"578971245454950421"` + - [ ] `version` is set: `"1"` + - [ ] `name` describes the Activity + - [ ] `description` explains Activity purpose + +- [ ] **No External Interactions Configured** + - [ ] If `interactions` present, URL points to Discord proxy domain + - [ ] No external API endpoints in manifest + +### Context/SDK Setup (code/client/contexts/DiscordActivityContext.tsx) + +- [ ] **Proper SDK Initialization** + - [ ] SDK imported: `@discord/embedded-app-sdk` + - [ ] `DiscordSDK` instantiated with client ID + - [ ] `sdk.ready()` awaited before using SDK + - [ ] `sdk.authenticate()` called after ready + +- [ ] **Correct OAuth Flow** + - [ ] Uses `sdk.commands.authorize()` for OAuth + - [ ] Exchanges code for token via `/api/discord/activity-auth` + - [ ] Token used to authenticate with SDK + - [ ] User data fetched after authentication + +- [ ] **Proper Error Handling** + - [ ] Errors logged with `[Discord Activity]` prefix + - [ ] User-friendly error messages displayed + - [ ] No silent failures + - [ ] Console logs helpful for debugging + +## ✅ Navigation Compliance + +### Link Handling + +- [ ] **All External Links Use window.open()** + ```typescript + // ✅ CORRECT +