Skip to content

feat: formbricks v5 changes#50

Merged
pandeymangg merged 5 commits into
mainfrom
epic/v5
May 19, 2026
Merged

feat: formbricks v5 changes#50
pandeymangg merged 5 commits into
mainfrom
epic/v5

Conversation

@pandeymangg
Copy link
Copy Markdown
Contributor

adds the required changes for supporting formbricks v5 in the js sdk

@pandeymangg pandeymangg requested a review from Dhruwang May 19, 2026 11:31
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 19, 2026

Review Change Stack

Walkthrough

The PR migrates the Formbricks JavaScript SDK from using environmentId to workspaceId as the primary setup configuration parameter. A new TSetupConfig type is introduced with optional workspaceId, optional deprecated environmentId, and required appUrl. The validation logic was rewritten to accept either parameter, emitting a deprecation warning when only environmentId is provided. Comprehensive tests verify workspaceId-based setup, deprecation warnings, and backward compatibility with both parameters. Documentation is updated to reflect the new configuration approach.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title "feat: formbricks v5 changes" is vague and overly generic, failing to clearly summarize the main change (adding workspaceId support and deprecating environmentId). Consider a more specific title like "feat: add workspaceId support and deprecate environmentId" to clearly convey the primary API change.
✅ Passed checks (4 passed)
Check name Status Explanation
Description check ✅ Passed The description is related to the changeset as it mentions supporting formbricks v5 in the js sdk, which aligns with the workspace support changes present in the pull request.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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
Copy Markdown

@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

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/js/src/types/formbricks.ts`:
- Around line 68-75: TSetupConfig currently allows both IDs to be omitted;
change it to a discriminated union so TypeScript enforces that at least one ID
is present: replace the single TSetupConfig type with a union such as {
workspaceId: string; environmentId?: string; appUrl: string } | { environmentId:
string; workspaceId?: string; appUrl: string } in
packages/js/src/types/formbricks.ts, keeping the appUrl field and the deprecated
comment on environmentId for backward compatibility, and ensure this matches the
runtime check in load-formbricks.ts that rejects configs missing both IDs.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: a9f4965f-7679-4dd7-99f8-f7fd4cb0ecd3

📥 Commits

Reviewing files that changed from the base of the PR and between ec4b03c and a20645a.

📒 Files selected for processing (5)
  • packages/js/README.md
  • packages/js/src/index.test.ts
  • packages/js/src/lib/load-formbricks.test.ts
  • packages/js/src/lib/load-formbricks.ts
  • packages/js/src/types/formbricks.ts

Comment thread packages/js/src/types/formbricks.ts Outdated
@sonarqubecloud
Copy link
Copy Markdown

@pandeymangg pandeymangg added this pull request to the merge queue May 19, 2026
Merged via the queue into main with commit 99a490e May 19, 2026
10 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.

2 participants