feat: formbricks v5 changes#50
Conversation
WalkthroughThe PR migrates the Formbricks JavaScript SDK from using 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ 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
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add 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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (5)
packages/js/README.mdpackages/js/src/index.test.tspackages/js/src/lib/load-formbricks.test.tspackages/js/src/lib/load-formbricks.tspackages/js/src/types/formbricks.ts
|



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