chore: sync test → main (subscribe checkout via recoup-api)#1731
chore: sync test → main (subscribe checkout via recoup-api)#1731sweetmantech merged 3 commits intomainfrom
Conversation
* chore(chat): migrate YouTube connector to Composio
- Add youtube to allowedArtistConnectors so the YouTube card appears in
the artist settings Connectors tab alongside TikTok/Instagram
- Rewrite useYoutubeChannel to call POST /api/connectors/actions with
YOUTUBE_GET_CHANNEL_STATISTICS; consume the raw Google channels.list
response (snippet/statistics/thumbnails) directly, no remapping
- Rewrite useYoutubeStatus to derive connection state from the Composio
connectors list instead of the legacy channel-info endpoint
- Rewrite ConnectYouTubeButton + YoutubeLogoutButton to use the Composio
authorize/disconnect flow already used by TikTok/Instagram
- Drop legacy chat-side OAuth surface: /api/youtube/*,
/api/auth/callback/google, lib/youtube OAuth/token helpers,
lib/supabase/youtube_tokens, types/youtube.ts, useYouTubeLoginSuccess,
the four LLM-tool result components for login/channels/playlist/thumb
(those tools now come from Composio's YouTube toolkit)
Keeps the get_youtube_revenue MCP tool dispatch in ToolComponents and the
matching VercelChat result components — Composio has no YouTube
Analytics action, so revenue stays custom on the api side.
* fix(chat): request snippet+statistics from YOUTUBE_GET_CHANNEL_STATISTICS
Composio's action defaults the `part` parameter to "statistics" only,
so the response had `snippet: null` and the UI rendered without title
or thumbnail. Pass `part: "snippet,statistics"` so the channel name,
description, and thumbnail come back too.
* chore(chat): remove unused ChatInputYoutubeButton + popover
Both components were orphaned — ChatInputYoutubeButton had zero callers,
which made ChatInputYoutubeButtonPopover and its StatCard / PopoverContent
unreachable too. Drop them entirely.
* fix(chat): unwrap Composio envelope in executeConnectorActionApi
api now passes Composio's ToolExecuteResponse through unchanged
({successful, data, error}). Consumer adapter unwraps once so all
chat-side callers get the underlying provider payload directly
(e.g. youtube.channels.list with `items`); upstream failures throw.
* fix(chat): address AI review feedback on youtube migration
- Share connector refresh across useConnectors instances so logout updates
sibling status (P1: useYoutubeStatus stale after disconnect)
- Disable disconnect button while in-flight to prevent duplicate requests
- Add aria-label to icon-only disconnect button
- Add aria-label to ConnectYouTubeButton for dense (icon-only) mode
- Propagate connector errors from useYoutubeStatus instead of hard-coded null
- Use semantic <span> for static section caption in ChannelInfo
- Provide fallback message in YouTubeRevenueResult when error text missing
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* refactor(chat): simplify executeConnectorActionApi envelope handling
The api endpoint always returns Composio's ToolExecuteResponse envelope
(`{ successful, data, error }`) — every Composio Vercel-AI-SDK tool returns
that shape. Drop the defensive non-envelope branch and read the typed shape
directly, removing the `as unknown` casts and inline type guards.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* refactor(chat): React Query for useConnectors + extract fetchYoutubeChannel
- useConnectors now uses React Query so all instances share one cache;
disconnect/authorize invalidate the connectors key and sibling instances
re-render automatically. Drops the module-level Set<()=>void> broadcast.
- Extract fetchYoutubeChannel + types to lib/youtube/fetchYoutubeChannel.ts,
matching the fetchConnectorsApi / authorizeConnectorApi pattern. The hook
is now ~20 lines and just wires React Query to the helper.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* chore(chat): drop redundant queryFn return-type annotation
fetchConnectorsApi already returns Promise<ConnectorInfo[]>, so TS infers
the queryFn type correctly without the explicit annotation.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(chat): restore authorize catch to honor Promise<string | null> contract
Dropped during the React Query refactor — without the catch, an API failure
rejects the promise instead of returning null, which the only caller
(ConnectYouTubeButton) doesn't handle.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(chat): gate useYoutubeChannel on Privy authenticated flag
Matches the codebase convention (useTaskRunStatus, useCatalogs, useArtistPosts,
etc.) — without it, the query runs and immediately throws "Not authenticated"
when the user isn't signed in.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* refactor(chat): use shared useConnectorHandlers in YouTube buttons
Address sweetman's DRY review feedback on PR #1719: both ConnectYouTubeButton
and YoutubeLogoutButton open-coded the connect/disconnect state machine that
useConnectorHandlers (and ConnectorCard) already provide. Add an optional
onDisconnectSuccess callback to the hook so the logout button can still
invalidate the youtube-channel-info query after a successful disconnect.
* fix(chat): display "YouTube" as one word in connectors UI
Why: the formatConnectorName fallback regex inserts a space before
each capital, turning the API's "YouTube" into "You Tube". Add
youtube to the explicit display-name map alongside the other
multi-cap brands.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(chat): add YouTube connector description
Without an explicit metadata entry, the YouTube card showed the
generic "Connect to enable this connector" placeholder. Match the
TikTok/Instagram pattern.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: Sweets Sweetman <sweetmantech@gmail.com>
…on creation to use access tokens. Update subscription handling in the useSubscribeClick hook to ensure proper authentication flow. (#1728)
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded
To continue reviewing without waiting, purchase usage credits in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Test plan
Summary by cubic
Syncs test with main by moving subscription checkout to
recoup-apiwith authenticated client requests and removing legacy Stripe session code. Checkout sessions now use/api/subscriptions/sessionswith a Privy access token.app/api/stripe/session/createandlib/stripe/createSession.lib/stripe/createClientCheckoutSessionto call${getClientApiBaseUrl()}/api/subscriptions/sessionswithAuthorization: Bearer <token>, validateurl, and open withnoopener,noreferrer.hooks/useSubscribeClickto use@privy-io/react-authforgetAccessToken; awaits checkout; keeps portal flow for already-subscribed users.Written for commit 798cea0. Summary will update on new commits.