Skip to content

Commit 7eedfa4

Browse files
committed
fix: address code review feedback for subscription-client branch
1 parent 16702f8 commit 7eedfa4

File tree

4 files changed

+4
-25
lines changed

4 files changed

+4
-25
lines changed

cli/src/components/chat-input-bar.tsx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { FeedbackContainer } from './feedback-container'
66
import { InputModeBanner } from './input-mode-banner'
77
import { MultilineInput, type MultilineInputHandle } from './multiline-input'
88
import { OutOfCreditsBanner } from './out-of-credits-banner'
9-
import { SubscriptionLimitBanner } from './subscription-limit-banner'
109
import { PublishContainer } from './publish-container'
1110
import { SuggestionMenu, type SuggestionItem } from './suggestion-menu'
1211
import { useAskUserBridge } from '../hooks/use-ask-user-bridge'
@@ -191,11 +190,6 @@ export const ChatInputBar = ({
191190
return <OutOfCreditsBanner />
192191
}
193192

194-
// Subscription limit mode: replace entire input with subscription limit banner
195-
if (inputMode === 'subscriptionLimit') {
196-
return <SubscriptionLimitBanner />
197-
}
198-
199193
// Handle input changes with special mode entry detection
200194
const handleInputChange = (value: InputValue) => {
201195
// Detect entering bash mode: user typed exactly '!' when in default mode

cli/src/hooks/use-update-preference.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
setActivityQueryData,
77
} from './use-activity-query'
88
import { subscriptionQueryKeys } from './use-subscription-query'
9+
import { showClipboardMessage } from '../utils/clipboard'
910
import { getApiClient } from '../utils/codebuff-api'
1011
import { logger } from '../utils/logger'
1112

@@ -55,6 +56,7 @@ export function useUpdatePreference() {
5556
setActivityQueryData(queryKey, previousData)
5657
}
5758
logger.error({ err }, 'Failed to update preference')
59+
showClipboardMessage('Failed to update preference', { durationMs: 3000 })
5860
} finally {
5961
setIsPending(false)
6062
}

packages/billing/src/subscription-webhooks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ export async function handleSubscriptionScheduleCreatedOrUpdated(params: {
447447
const scheduledPriceId = nextPhase?.items?.[0]?.price
448448
const priceId = typeof scheduledPriceId === 'string'
449449
? scheduledPriceId
450-
: scheduledPriceId?.toString()
450+
: scheduledPriceId?.id
451451

452452
if (!priceId) {
453453
logger.warn(

web/src/app/api/user/subscription/route.ts

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import {
66
import { SUBSCRIPTION_DISPLAY_NAME } from '@codebuff/common/constants/subscription-plans'
77
import db from '@codebuff/internal/db'
88
import * as schema from '@codebuff/internal/db/schema'
9-
import { env } from '@codebuff/internal/env'
10-
import { stripeServer } from '@codebuff/internal/util/stripe'
119
import { eq } from 'drizzle-orm'
1210
import { NextResponse } from 'next/server'
1311
import { getServerSession } from 'next-auth'
@@ -44,23 +42,9 @@ export async function GET() {
4442
return NextResponse.json(response)
4543
}
4644

47-
const stripeCustomerId = session.user.stripe_customer_id
48-
49-
const [rateLimit, limits, billingPortalUrl] = await Promise.all([
45+
const [rateLimit, limits] = await Promise.all([
5046
checkRateLimit({ userId, subscription, logger }),
5147
getSubscriptionLimits({ userId, logger, tier: subscription.tier }),
52-
stripeCustomerId
53-
? stripeServer.billingPortal.sessions
54-
.create({
55-
customer: stripeCustomerId,
56-
return_url: `${env.NEXT_PUBLIC_CODEBUFF_APP_URL}/profile`,
57-
})
58-
.then((portalSession) => portalSession.url)
59-
.catch((error) => {
60-
logger.warn({ userId, error }, 'Failed to create billing portal session')
61-
return undefined
62-
})
63-
: Promise.resolve(undefined),
6448
])
6549

6650
const response: ActiveSubscriptionResponse = {
@@ -87,7 +71,6 @@ export async function GET() {
8771
weeklyPercentUsed: rateLimit.weeklyPercentUsed,
8872
},
8973
limits,
90-
billingPortalUrl,
9174
fallbackToALaCarte,
9275
}
9376
return NextResponse.json(response)

0 commit comments

Comments
 (0)