Skip to content

feat: dedicated support self-serve #7381

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 21, 2025

Conversation

arcoraven
Copy link
Contributor

@arcoraven arcoraven commented Jun 19, 2025

[Dashboard] Feature: Add Dedicated Support Channel for Teams

Screenshots

Already set up
image.png

Not on Scale/Pro plan

image.png

Eligible to select a support channel
image.png

Notes for the reviewer

This PR adds the ability for teams on Pro or Scale plans to create dedicated support channels via Slack or Telegram. The feature includes:

  • New server action to create dedicated support channels
  • New settings card component for team settings page
  • Integration with the team's billing plan to enable/disable the feature
  • UI to display existing support channel or create a new one

How to test

  • Visit a team's settings page
  • Verify that the dedicated support card appears
  • Confirm that only Pro/Scale plans can create support channels
  • Test the creation flow and error handling

PR-Codex overview

This PR introduces a new TeamDedicatedSupportCard component to the TeamGeneralSettingsPageUI, enabling team owners to create dedicated support channels (Slack or Telegram) for their teams. It also adds server-side functionality to handle the support channel creation.

Detailed summary

  • Added TeamDedicatedSupportCard to TeamGeneralSettingsPageUI.
  • Implemented createDedicatedSupportChannel function in dedicated-support.ts for creating support channels.
  • Integrated mutation handling and toast notifications in TeamDedicatedSupportCard.
  • Included UI for selecting channel type and displaying existing channels.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Summary by CodeRabbit

  • New Features
    • Added a dedicated support channel setup card to the team settings page, allowing eligible teams to request a Slack or Telegram support channel.
    • Users on supported billing plans can select and create a dedicated support channel, receiving confirmation and instructions via email.
    • Teams without access are prompted to upgrade their plan to enable this feature.
    • Team owners are required to update generic team names before requesting a dedicated support channel.
    • Non-owner users see a message restricting access to request a dedicated support channel.

Copy link

changeset-bot bot commented Jun 19, 2025

⚠️ No Changeset found

Latest commit: 5cd8ab0

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

💥 An error occurred when fetching the changed packages and changesets in this PR
Some errors occurred when validating the changesets config:
The package or glob expression "thirdweb-login" is specified in the `ignore` option but it is not found in the project. You may have misspelled the package name or provided an invalid glob expression. Note that glob expressions must be defined according to https://www.npmjs.com/package/micromatch.

Copy link

vercel bot commented Jun 19, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
thirdweb-www ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 21, 2025 1:45am
5 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs-v2 ⬜️ Skipped (Inspect) Jun 21, 2025 1:45am
login ⬜️ Skipped (Inspect) Jun 21, 2025 1:45am
nebula ⬜️ Skipped (Inspect) Jun 21, 2025 1:45am
thirdweb_playground ⬜️ Skipped (Inspect) Jun 21, 2025 1:45am
wallet-ui ⬜️ Skipped (Inspect) Jun 21, 2025 1:45am

Copy link
Contributor

coderabbitai bot commented Jun 19, 2025

Walkthrough

A new feature for managing dedicated support channels (Slack or Telegram) for teams is introduced. This includes a server-side API to create support channels, a React component to display and configure the channel based on billing plan and ownership, and integration of this component into the team settings UI.

Changes

File(s) Change Summary
apps/dashboard/src/@/api/dedicated-support.ts Added createDedicatedSupportChannel async function to create a support channel for a team via external API with authentication.
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/_components/settings-cards/dedicated-support.tsx Introduced TeamDedicatedSupportCard React component for configuring and displaying a team's support channel, with billing and ownership checks.
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/general/TeamGeneralSettingsPageUI.tsx Imported and rendered TeamDedicatedSupportCard within the team settings page, passing relevant team and ownership props.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant TeamGeneralSettingsPageUI
    participant TeamDedicatedSupportCard
    participant API as createDedicatedSupportChannel

    User->>TeamGeneralSettingsPageUI: Opens team settings
    TeamGeneralSettingsPageUI->>TeamDedicatedSupportCard: Renders with team and ownership props
    User->>TeamDedicatedSupportCard: Selects channel type and clicks Save
    TeamDedicatedSupportCard->>API: Calls createDedicatedSupportChannel(teamIdOrSlug, channelType)
    API-->>TeamDedicatedSupportCard: Returns success or error
    TeamDedicatedSupportCard-->>User: Shows success or error toast
Loading

Possibly related PRs

  • thirdweb-dev/js#7382: Adds a dedicatedSupportChannel field to the TeamResponse type, which is likely used by or complements the dedicated support channel creation and UI integration in this PR.

📜 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 c220e3d and 63a5da8.

📒 Files selected for processing (3)
  • apps/dashboard/src/@/api/dedicated-support.ts (1 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/_components/settings-cards/dedicated-support.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/general/TeamGeneralSettingsPageUI.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • apps/dashboard/src/@/api/dedicated-support.ts
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/general/TeamGeneralSettingsPageUI.tsx
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/_components/settings-cards/dedicated-support.tsx
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: Unit Tests
  • GitHub Check: E2E Tests (pnpm, esbuild)
  • GitHub Check: E2E Tests (pnpm, vite)
  • GitHub Check: Size
  • GitHub Check: E2E Tests (pnpm, webpack)
  • GitHub Check: Lint Packages
  • GitHub Check: Build Packages
  • GitHub Check: Analyze (javascript)
✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added Dashboard Involves changes to the Dashboard. packages labels Jun 19, 2025
Copy link
Contributor Author


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge-queue - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@arcoraven arcoraven marked this pull request as ready for review June 19, 2025 13:12
@arcoraven arcoraven requested review from a team as code owners June 19, 2025 13:12
Copy link

codecov bot commented Jun 19, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 52.06%. Comparing base (eeb672d) to head (63a5da8).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7381   +/-   ##
=======================================
  Coverage   52.06%   52.06%           
=======================================
  Files         945      945           
  Lines       63565    63565           
  Branches     4208     4208           
=======================================
  Hits        33098    33098           
  Misses      30361    30361           
  Partials      106      106           
Flag Coverage Δ
packages 52.06% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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: 0

🧹 Nitpick comments (4)
apps/dashboard/src/@/api/dedicated-support.ts (2)

7-14: Add input validation for the teamIdOrSlug parameter.

Consider adding basic validation to ensure the teamIdOrSlug parameter is not empty or contains invalid characters that could cause issues with the API endpoint construction.

export async function createDedicatedSupportChannel(
  teamIdOrSlug: string,
  channelType: "slack" | "telegram",
): Promise<{ error: string | null }> {
+  if (!teamIdOrSlug?.trim()) {
+    return { error: "Team ID or slug is required" };
+  }
  const token = await getAuthToken();

36-36: Consider removing unnecessary response body cancellation.

The res.body?.cancel() call appears unnecessary since the response body is not being consumed in the success case. The response will be garbage collected naturally.

-  res.body?.cancel();
   return { error: null };
apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/_components/settings-cards/dedicated-support.tsx (2)

5-5: Remove unused import.

The import {} from "@/components/ui/alert" is not used in the component and should be removed.

-import {} from "@/components/ui/alert";

66-86: Consider adding validation for channel data consistency.

The component assumes that if channelType exists, channelName will also exist. Consider adding validation to handle cases where only one property is present.

-  if (channelType && channelName) {
+  if (channelType && channelName) {
     return (
       <SettingsCard
         header={{
           title: "Dedicated Support",
           description:
             "Get a dedicated support channel with the thirdweb team.",
         }}
         errorText={undefined}
         noPermissionText={undefined}
         bottomText={undefined}
       >
         <div className="md:w-[450px]">
           <p className="text-muted-foreground text-sm">
             Your dedicated support channel: <strong>{channelName}</strong> on{" "}
             {CHANNEL_TYPES.find((c) => c.value === channelType)?.name}
           </p>
         </div>
       </SettingsCard>
     );
+  }
+
+  // Handle inconsistent state where only one property exists
+  if (channelType || channelName) {
+    console.warn("Inconsistent dedicated support channel data:", { channelType, channelName });
   }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5492331 and b41e8c9.

📒 Files selected for processing (5)
  • apps/dashboard/src/@/api/dedicated-support.ts (1 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/_components/settings-cards/dedicated-support.tsx (1 hunks)
  • apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/general/TeamGeneralSettingsPageUI.tsx (2 hunks)
  • apps/dashboard/src/stories/stubs.ts (1 hunks)
  • packages/service-utils/src/core/api.ts (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
apps/dashboard/src/@/api/dedicated-support.ts (2)
apps/dashboard/src/app/(app)/api/lib/getAuthToken.ts (1)
  • getAuthToken (6-14)
apps/dashboard/src/@/constants/public-envs.ts (1)
  • NEXT_PUBLIC_THIRDWEB_API_HOST (18-19)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (6)
packages/service-utils/src/core/api.ts (1)

150-154: LGTM! Well-structured type definition.

The new dedicatedSupportChannel property is properly typed with appropriate constraints for the channel types and follows the existing code patterns.

apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/general/TeamGeneralSettingsPageUI.tsx (2)

20-20: LGTM! Clean import addition.

The import follows the existing import patterns and is properly organized.


61-66: LGTM! Well-integrated component usage.

The component is properly positioned in the settings layout and receives all necessary props with appropriate optional chaining for the channel properties.

apps/dashboard/src/stories/stubs.ts (1)

113-113: LGTM! Consistent stub data addition.

The new property is properly initialized to null, matching the type definition and providing a sensible default for testing scenarios.

apps/dashboard/src/app/(app)/team/[team_slug]/(team)/~/settings/_components/settings-cards/dedicated-support.tsx (2)

40-40: LGTM! Proper feature gating logic.

The billing plan check correctly restricts the feature to "scale" and "pro" plans as intended.


42-63: LGTM! Well-implemented mutation with proper error handling.

The mutation setup includes appropriate success and error handling with user-friendly toast notifications.

Copy link
Contributor

github-actions bot commented Jun 19, 2025

size-limit report 📦

Path Size Loading time (3g) Running time (snapdragon) Total time
thirdweb (esm) 62.56 KB (0%) 1.3 s (0%) 2.7 s (+5.23% 🔺) 3.9 s
thirdweb (cjs) 350.74 KB (0%) 7.1 s (0%) 18 s (-5.18% 🔽) 25.1 s
thirdweb (minimal + tree-shaking) 5.72 KB (0%) 115 ms (0%) 185 ms (+40.97% 🔺) 299 ms
thirdweb/chains (tree-shaking) 530 B (0%) 11 ms (0%) 126 ms (+180.83% 🔺) 136 ms
thirdweb/react (minimal + tree-shaking) 19.61 KB (0%) 393 ms (0%) 288 ms (-6% 🔽) 680 ms

@vercel vercel bot temporarily deployed to Preview – wallet-ui June 21, 2025 00:56 Inactive
@vercel vercel bot temporarily deployed to Preview – nebula June 21, 2025 00:56 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 June 21, 2025 00:56 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground June 21, 2025 00:56 Inactive
@jnsdls jnsdls force-pushed the ph/06-19-feat_dedicated_support_self-serve branch from 9fe8022 to e54673f Compare June 21, 2025 00:59
@vercel vercel bot temporarily deployed to Preview – wallet-ui June 21, 2025 00:59 Inactive
@vercel vercel bot temporarily deployed to Preview – nebula June 21, 2025 00:59 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground June 21, 2025 00:59 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 June 21, 2025 00:59 Inactive
@jnsdls jnsdls force-pushed the ph/06-19-feat_dedicated_support_self-serve branch from e54673f to c220e3d Compare June 21, 2025 01:01
@vercel vercel bot temporarily deployed to Preview – docs-v2 June 21, 2025 01:01 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui June 21, 2025 01:01 Inactive
@vercel vercel bot temporarily deployed to Preview – nebula June 21, 2025 01:01 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground June 21, 2025 01:01 Inactive
@jnsdls jnsdls force-pushed the ph/06-19-feat_dedicated_support_self-serve branch from c220e3d to 5cd8ab0 Compare June 21, 2025 01:05
@vercel vercel bot temporarily deployed to Preview – docs-v2 June 21, 2025 01:05 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui June 21, 2025 01:05 Inactive
@vercel vercel bot temporarily deployed to Preview – nebula June 21, 2025 01:05 Inactive
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground June 21, 2025 01:05 Inactive
@jnsdls jnsdls force-pushed the ph/06-19-feat_dedicated_support_self-serve branch from 5cd8ab0 to 63a5da8 Compare June 21, 2025 01:38
@vercel vercel bot temporarily deployed to Preview – thirdweb_playground June 21, 2025 01:38 Inactive
@vercel vercel bot temporarily deployed to Preview – nebula June 21, 2025 01:38 Inactive
@vercel vercel bot temporarily deployed to Preview – wallet-ui June 21, 2025 01:38 Inactive
@vercel vercel bot temporarily deployed to Preview – docs-v2 June 21, 2025 01:38 Inactive
@arcoraven arcoraven merged commit ff6e245 into main Jun 21, 2025
25 checks passed
@arcoraven arcoraven deleted the ph/06-19-feat_dedicated_support_self-serve branch June 21, 2025 02:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Dashboard Involves changes to the Dashboard. packages
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants