Skip to content

chore: sync test → main (subscribe checkout via recoup-api)#1731

Merged
sweetmantech merged 3 commits intomainfrom
test
May 6, 2026
Merged

chore: sync test → main (subscribe checkout via recoup-api)#1731
sweetmantech merged 3 commits intomainfrom
test

Conversation

@sweetmantech
Copy link
Copy Markdown
Collaborator

@sweetmantech sweetmantech commented May 6, 2026

Summary

Test plan


Summary by cubic

Syncs test with main by moving subscription checkout to recoup-api with authenticated client requests and removing legacy Stripe session code. Checkout sessions now use /api/subscriptions/sessions with a Privy access token.

  • Refactors
    • Removed app/api/stripe/session/create and lib/stripe/createSession.
    • Updated lib/stripe/createClientCheckoutSession to call ${getClientApiBaseUrl()}/api/subscriptions/sessions with Authorization: Bearer <token>, validate url, and open with noopener,noreferrer.
    • Updated hooks/useSubscribeClick to use @privy-io/react-auth for getAccessToken; awaits checkout; keeps portal flow for already-subscribed users.

Written for commit 798cea0. Summary will update on new commits.

arpitgupta1214 and others added 3 commits May 1, 2026 14:58
* 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)
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented May 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
chat Building Building Preview May 6, 2026 1:35pm

Request Review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 6, 2026

Warning

Rate limit exceeded

@sweetmantech has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 30 minutes and 16 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4fd40c83-58f4-446f-bc04-79b9fcb04e90

📥 Commits

Reviewing files that changed from the base of the PR and between ea08fab and 798cea0.

📒 Files selected for processing (4)
  • app/api/stripe/session/create/route.ts
  • hooks/useSubscribeClick.ts
  • lib/stripe/createClientCheckoutSession.ts
  • lib/stripe/createSession.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sweetmantech sweetmantech merged commit 910250e into main May 6, 2026
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants