Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@steven-tey
Copy link
Collaborator

@steven-tey steven-tey commented Nov 10, 2025

Summary by CodeRabbit

  • New Features

    • Email Campaigns is available to Advanced and Enterprise plans; Campaigns appears in the sidebar with a "New" badge.
    • Added an Email Campaigns upsell page showing example campaigns and an Upgrade CTA for users without access.
    • Added a dedicated Email Campaigns page wrapper component for consistent page layout.
  • Chores

    • Simplified access checks to rely on plan tier eligibility across campaign flows and UI.
  • UI

    • Messaging upsell text updated with a subtler message and Learn more link; Discounts entry no longer conditionally shown.

@vercel
Copy link
Contributor

vercel bot commented Nov 10, 2025

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

Project Deployment Preview Updated (UTC)
dub Ready Ready Preview Nov 10, 2025 10:32pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 10, 2025

Walkthrough

Removed the "emailCampaigns" feature flag across API routes, types, edge-config defaults, client layouts, and sidebar navigation; gating now relies on plan capability (requiredPlan: ["advanced","enterprise"]) where present.

Changes

Cohort / File(s) Summary
Campaign API routes
apps/web/app/(ee)/api/campaigns/route.ts, apps/web/app/(ee)/api/campaigns/[campaignId]/route.ts, apps/web/app/(ee)/api/campaigns/[campaignId]/duplicate/route.ts, apps/web/app/(ee)/api/campaigns/[campaignId]/summary/route.ts, apps/web/app/(ee)/api/campaigns/[campaignId]/events/route.ts, apps/web/app/(ee)/api/campaigns/[campaignId]/events/count/route.ts
Removed featureFlag: "emailCampaigns" from withWorkspace option objects for GET/POST/PATCH/DELETE handlers; requiredPlan restrictions remain.
Client layout & upsell
apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/campaigns/layout.tsx, apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/campaigns/campaigns-upsell.tsx, apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/campaigns/campaigns-page-content.tsx, apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/campaigns/page.tsx
Replaced flag-based redirect with plan-capability check; added CampaignsUpsell and CampaignsPageContent components; ProgramCampaignsPage now uses CampaignsPageContent.
Sidebar / Navigation UI
apps/web/ui/layout/sidebar/app-sidebar-nav.tsx
Removed emailCampaignsEnabled usage and conditional rendering tied to it; Email Campaigns entry is now rendered unconditionally (with New badge); SidebarNavData type updated.
Types & edge-config
apps/web/lib/types.ts, apps/web/lib/edge-config/get-feature-flags.ts
Removed "emailCampaigns" from BetaFeatures union; removed emailCampaigns default from edge-config fallback initialization.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Client
  participant Layout
  participant Sidebar
  participant API
  participant Auth as withWorkspace

  rect "#F3FCFF" 
    Client->>Layout: Request campaigns page
    Layout->>Auth: withWorkspace(requiredPlan)
    Auth-->>Layout: allow / deny (based on plan)
    alt allowed
      Layout->>Sidebar: render navigation (Email Campaigns visible)
      Client->>API: call campaigns endpoints
      API->>Auth: withWorkspace(requiredPlan)
      Auth-->>API: allow / deny
      API-->>Client: 200 / resource
    else denied
      Layout-->>Client: render CampaignsUpsell
    end
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Review focus:
    • Confirm no remaining runtime references to emailCampaigns / emailCampaignsEnabled.
    • Verify edge-config fallback behavior and any consumers of BetaFeatures union.
    • Validate sidebar consumers and navigation telemetry/analytics that referenced the removed field.

Possibly related PRs

Suggested reviewers

  • devkiran

Poem

🐰
I nibbled a flag beside the stream,
Pushed it off-stage for a brighter dream,
Plans now choose where campaigns may play,
No tiny toggles hopping in the way.
A carrot cheer for the cleaner day! 🥕✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and accurately describes the main change: removing the emailCampaigns feature flag across multiple API routes, configuration files, and UI components.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch remove-campaigns-flag

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 379caa2 and 84d5e13.

📒 Files selected for processing (4)
  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/campaigns/campaigns-page-content.tsx (1 hunks)
  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/campaigns/campaigns-upsell.tsx (1 hunks)
  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/campaigns/page.tsx (1 hunks)
  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/messages/messages-upsell.tsx (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-10-15T01:05:43.266Z
Learnt from: steven-tey
Repo: dubinc/dub PR: 2958
File: apps/web/app/app.dub.co/(dashboard)/[slug]/settings/members/page-client.tsx:432-457
Timestamp: 2025-10-15T01:05:43.266Z
Learning: In apps/web/app/app.dub.co/(dashboard)/[slug]/settings/members/page-client.tsx, defer refactoring the custom MenuItem component (lines 432-457) to use the shared dub/ui MenuItem component to a future PR, as requested by steven-tey.

Applied to files:

  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/campaigns/campaigns-page-content.tsx
  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/campaigns/campaigns-upsell.tsx
  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/messages/messages-upsell.tsx
  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/campaigns/page.tsx
📚 Learning: 2025-09-17T17:44:03.965Z
Learnt from: TWilson023
Repo: dubinc/dub PR: 2857
File: apps/web/lib/actions/partners/update-program.ts:96-0
Timestamp: 2025-09-17T17:44:03.965Z
Learning: In apps/web/lib/actions/partners/update-program.ts, the team prefers to keep the messagingEnabledAt update logic simple by allowing client-provided timestamps rather than implementing server-controlled timestamp logic to avoid added complexity.

Applied to files:

  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/messages/messages-upsell.tsx
🧬 Code graph analysis (3)
apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/campaigns/campaigns-page-content.tsx (1)
apps/web/ui/layout/page-content/index.tsx (1)
  • PageContent (10-39)
apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/campaigns/campaigns-upsell.tsx (3)
apps/web/ui/partners/partners-upgrade-modal.tsx (1)
  • usePartnersUpgradeModal (285-304)
apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/campaigns/campaigns-page-content.tsx (1)
  • CampaignsPageContent (4-21)
apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/campaigns/campaign-type-icon.tsx (1)
  • CampaignTypeIcon (4-24)
apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/campaigns/page.tsx (1)
apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/campaigns/campaigns-page-content.tsx (1)
  • CampaignsPageContent (4-21)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (4)
apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/messages/messages-upsell.tsx (1)

47-60: LGTM! Clean upsell content update.

The updated structure improves the user experience by:

  • Providing clearer, more concise copy about plan availability
  • Adding a "Learn more" link for users who want additional details
  • Properly securing the external link with rel="noopener noreferrer"
  • Maintaining consistency with the titleInfo URL

The styling and accessibility are appropriate, and the changes align well with the PR's objective of simplifying feature access messaging.

apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/campaigns/campaigns-upsell.tsx (1)

1-104: LGTM! Well-implemented upsell component.

The component is well-structured with proper TypeScript typing, accessibility considerations (aria-hidden for decorative content), and security attributes on external links (rel="noopener noreferrer"). The integration with the partners upgrade modal and the use of example campaigns data creates an effective upsell experience.

apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/campaigns/campaigns-page-content.tsx (1)

1-21: LGTM! Clean abstraction that centralizes page structure.

The wrapper component effectively reduces duplication by providing fixed title and titleInfo while properly forwarding the controls prop and children. The use of Pick<ComponentProps<typeof PageContent>, "controls"> ensures type safety while maintaining a focused component API.

apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/campaigns/page.tsx (1)

3-16: LGTM! Clean refactor using the new wrapper component.

The changes properly utilize the CampaignsPageContent wrapper, removing duplicate title and titleInfo props while maintaining the same functionality. This improves code maintainability by centralizing the page structure.


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.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9119ba9 and 319b52a.

📒 Files selected for processing (10)
  • apps/web/app/(ee)/api/campaigns/[campaignId]/duplicate/route.ts (0 hunks)
  • apps/web/app/(ee)/api/campaigns/[campaignId]/events/count/route.ts (0 hunks)
  • apps/web/app/(ee)/api/campaigns/[campaignId]/events/route.ts (0 hunks)
  • apps/web/app/(ee)/api/campaigns/[campaignId]/route.ts (0 hunks)
  • apps/web/app/(ee)/api/campaigns/[campaignId]/summary/route.ts (0 hunks)
  • apps/web/app/(ee)/api/campaigns/route.ts (0 hunks)
  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/campaigns/layout.tsx (0 hunks)
  • apps/web/lib/edge-config/get-feature-flags.ts (0 hunks)
  • apps/web/lib/types.ts (1 hunks)
  • apps/web/ui/layout/sidebar/app-sidebar-nav.tsx (3 hunks)
💤 Files with no reviewable changes (8)
  • apps/web/app/(ee)/api/campaigns/[campaignId]/route.ts
  • apps/web/app/(ee)/api/campaigns/[campaignId]/duplicate/route.ts
  • apps/web/app/(ee)/api/campaigns/route.ts
  • apps/web/app/(ee)/api/campaigns/[campaignId]/events/count/route.ts
  • apps/web/app/(ee)/api/campaigns/[campaignId]/summary/route.ts
  • apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/campaigns/layout.tsx
  • apps/web/app/(ee)/api/campaigns/[campaignId]/events/route.ts
  • apps/web/lib/edge-config/get-feature-flags.ts
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: 2025-10-15T01:05:43.266Z
Learnt from: steven-tey
Repo: dubinc/dub PR: 2958
File: apps/web/app/app.dub.co/(dashboard)/[slug]/settings/members/page-client.tsx:432-457
Timestamp: 2025-10-15T01:05:43.266Z
Learning: In apps/web/app/app.dub.co/(dashboard)/[slug]/settings/members/page-client.tsx, defer refactoring the custom MenuItem component (lines 432-457) to use the shared dub/ui MenuItem component to a future PR, as requested by steven-tey.

Applied to files:

  • apps/web/ui/layout/sidebar/app-sidebar-nav.tsx
📚 Learning: 2025-05-29T04:45:18.504Z
Learnt from: devkiran
Repo: dubinc/dub PR: 2448
File: packages/email/src/templates/partner-program-summary.tsx:0-0
Timestamp: 2025-05-29T04:45:18.504Z
Learning: In the PartnerProgramSummary email template (packages/email/src/templates/partner-program-summary.tsx), the stat titles are hardcoded constants ("Clicks", "Leads", "Sales", "Earnings") that will always match the ICONS object keys after toLowerCase() conversion, so icon lookup failures are not possible.

Applied to files:

  • apps/web/ui/layout/sidebar/app-sidebar-nav.tsx
🧬 Code graph analysis (1)
apps/web/ui/layout/sidebar/app-sidebar-nav.tsx (1)
apps/web/lib/swr/use-workspace.ts (1)
  • useWorkspace (6-46)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (3)
apps/web/lib/types.ts (1)

199-199: Type change correctly removes emailCampaigns from BetaFeatures union.

Comprehensive verification confirms all references to the emailCampaigns flag have been successfully removed from the codebase, including source code, configuration files, migrations, and documentation. The type change at line 199 is clean and complete.

apps/web/ui/layout/sidebar/app-sidebar-nav.tsx (2)

261-261: LGTM!

The "New" badge appropriately highlights the Partner Network feature to users.


473-473: LGTM!

Correctly removes the emailCampaignsEnabled field from the destructuring, consistent with the feature flag removal and the useWorkspace hook implementation.

@steven-tey steven-tey merged commit 8ad6a24 into main Nov 10, 2025
7 checks passed
@steven-tey steven-tey deleted the remove-campaigns-flag branch November 10, 2025 23:17
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