Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThe recent updates introduce two new premium tiers, Changes
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
Outside diff range and nitpick comments (3)
apps/web/app/(app)/admin/AdminUpgradeUserForm.tsx (2)
Line range hint
37-37: Consider removing the template literal in thetoastSuccesscall since there's no variable interpolation.- description: data.upgrade ? `Upgraded!` : `Downgraded!`, + description: data.upgrade ? "Upgraded!" : "Downgraded!",
Line range hint
39-39: Specify a more explicit type instead ofanyfor the error handling in the catch block to enhance type safety.- } catch (error: any) { + } catch (error: unknown) {apps/web/utils/actions/premium.ts (1)
Line range hint
242-248: ReplaceparseIntwithNumber.parseIntfor better clarity and consistency with modern JavaScript practices.- lemonSqueezySubscriptionId = parseInt(subscription.id); + lemonSqueezySubscriptionId = Number.parseInt(subscription.id); - lemonSqueezyOrderId = parseInt(attributes.order_id); + lemonSkeezyOrderId = Number.parseInt(attributes.order_id); - lemonSqueezyProductId = parseInt(attributes.product_id); + lemonSqueezyProductId = Number.parseInt(attributes.product_id); - lemonSqueezyVariantId = parseInt(attributes.variant_id); + lemonSqueezyVariantId = Number.parseInt(attributes.variant_id); - lemonSqueezySubscriptionItemId = attributes.first_subscription_item.id ? parseInt(attributes.first_subscription_item.id) : null; + lemonSqueezySubscriptionItemId = attributes.first_subscription_item.id ? Number.parseInt(attributes.first_subscription_item.id) : null;
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (14)
- apps/web/app/(app)/admin/AdminUpgradeUserForm.tsx (1 hunks)
- apps/web/app/(app)/admin/validation.tsx (1 hunks)
- apps/web/app/(app)/premium/Pricing.tsx (4 hunks)
- apps/web/app/(app)/premium/config.ts (7 hunks)
- apps/web/app/(app)/usage/usage.tsx (1 hunks)
- apps/web/app/api/user/me/route.ts (1 hunks)
- apps/web/components/PremiumAlert.tsx (1 hunks)
- apps/web/env.mjs (4 hunks)
- apps/web/prisma/migrations/20240528181840_premium_basic/migration.sql (1 hunks)
- apps/web/prisma/schema.prisma (2 hunks)
- apps/web/utils/actions/premium.ts (1 hunks)
- apps/web/utils/premium/index.ts (3 hunks)
- apps/web/utils/premium/server.ts (3 hunks)
- turbo.json (1 hunks)
Files skipped from review due to trivial changes (2)
- apps/web/prisma/migrations/20240528181840_premium_basic/migration.sql
- turbo.json
Additional Context Used
Biome (19)
apps/web/app/(app)/admin/AdminUpgradeUserForm.tsx (4)
37-37: Do not use template literals if interpolation and special-character handling are not needed.
37-37: Do not use template literals if interpolation and special-character handling are not needed.
39-39: Unexpected any. Specify a different type.
3-4: Some named imports are only used as types.
apps/web/app/(app)/premium/Pricing.tsx (4)
151-151: Forbidden non-null assertion.
211-211: Using the role attribute 'list' on the 'ul' element is redundant, because it is implied by the semantic 'ul' element.
289-290: Using the role attribute 'list' on the 'ul' element is redundant, because it is implied by the semantic 'ul' element.
340-341: Avoid using target="_blank" without rel="noreferrer".
apps/web/components/PremiumAlert.tsx (1)
7-8: All these imports are only used as types.
apps/web/utils/actions/premium.ts (8)
72-72: void is not valid as a constituent in a union type
243-243: Unexpected any. Specify a different type.
9-10: All these imports are only used as types.
242-242: Use Number.parseInt instead of the equivalent global.
244-244: Use Number.parseInt instead of the equivalent global.
245-245: Use Number.parseInt instead of the equivalent global.
246-246: Use Number.parseInt instead of the equivalent global.
248-248: Use Number.parseInt instead of the equivalent global.
apps/web/utils/premium/index.ts (1)
1-1: Some named imports are only used as types.
apps/web/utils/premium/server.ts (1)
44-53: This else clause can be omitted because previous branches break early.
Additional comments not posted (14)
apps/web/app/(app)/admin/validation.tsx (1)
15-16: The addition ofBASIC_MONTHLYandBASIC_ANNUALLYto the premium tier enum is correctly implemented.apps/web/app/api/user/me/route.ts (1)
26-26: The addition ofbulkUnsubscribeAccessto the user object retrieval is correctly implemented.apps/web/app/(app)/usage/usage.tsx (1)
29-29: The update to useNEXT_PUBLIC_FREE_UNSUBSCRIBE_CREDITSis correctly implemented and aligns with the changes in environment configuration.apps/web/utils/premium/index.ts (2)
45-54: The updated logic forhasUnsubscribeAccesscorrectly handles the new conditions for bulk unsubscribe access.
59-59: The updates tohasAiAccess,hasColdEmailAccess, and the tier ranking inisOnHigherTierare correctly implemented and align with the new premium tier structure.Also applies to: 71-71, 88-94
apps/web/components/PremiumAlert.tsx (1)
21-45: The restructuring of theusePremiumfunction and the addition of new conditions for premium access are correctly implemented and enhance the component's functionality.apps/web/utils/premium/server.ts (2)
114-137: The updates to thegetTierAccessfunction correctly define access levels for the new premium tiers.
81-81: The update to thecancelPremiumfunction to reset access levels upon cancellation is correctly implemented.apps/web/app/(app)/admin/AdminUpgradeUserForm.tsx (1)
93-100: The addition of BASIC_MONTHLY and BASIC_ANNUALLY options to the premium tier dropdown is correctly implemented.apps/web/app/(app)/premium/config.ts (1)
10-11: The configuration updates for BASIC_MONTHLY and BASIC_ANNUALLY tiers are correctly implemented, including pricing and additional email pricing.Also applies to: 20-21, 35-57
apps/web/env.mjs (1)
43-47: The environment variable configurations for BASIC_MONTHLY and BASIC_ANNUALLY are correctly implemented, including payment links and variant IDs.Also applies to: 71-71, 93-101, 138-139
apps/web/utils/actions/premium.ts (1)
54-54: The update to useNEXT_PUBLIC_FREE_UNSUBSCRIBE_CREDITSin thedecrementUnsubscribeCreditfunction is correctly implemented.apps/web/prisma/schema.prisma (1)
346-347: The updates to thePremiumTierenum to include BASIC_MONTHLY and BASIC_ANNUALLY are correctly implemented.apps/web/app/(app)/premium/Pricing.tsx (1)
135-135: The updates to the discount percentage display in thePricingcomponent are correctly implemented.Also applies to: 196-198
Summary by CodeRabbit
New Features
BASIC_MONTHLYandBASIC_ANNUALLYpremium tiers.bulkUnsubscribeAccessfeature to user premium settings.Enhancements
Bug Fixes
Refactor