* feat: add usernameInOrg field to webhook organizer payload for organization users
- Add usernameInOrg field to CalendarEventBuilder organizer interface
- Update handleNewBooking to pass organizerOrganizationProfile.username as usernameInOrg
- Include usernameInOrg in webhook payload generation (sendPayload.ts)
- Add webhook form variable for usernameInOrg with translation
- Update Person type to include usernameInOrg field
- Add test case for organization user webhook verification
- Maintain backward compatibility by keeping existing username field unchanged
Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
* feat: add usernameInOrg to additional webhook sending locations
- Update handleCancelBooking.ts to include usernameInOrg in organizer payload
- Update confirm.handler.ts to include usernameInOrg for booking confirmations
- Update getBooking.ts to include usernameInOrg in payment-related webhooks
- Maintain backward compatibility with existing username field
- All webhook sending locations now include organization profile username
Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
* fixes
* Add subteam event test for usernameInOrg
* fix eslitn issues
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Added packages/features/auth/lib/next-auth-options.ts to CODEOWNERS for the Foundation team to ensure proper review and oversight of authentication configuration changes.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-authored-by: Claude <noreply@anthropic.com>
* wip
* WIP
* restore event
* testing without instrument client
* Add conditional for botID init
* Bump BotID version + pass in header
* botID yarn lock changes
* feat: Add feature flag checks + tidy up into service
* rely on env var also
* use eventType repo instead of passing in prisma
* remove slug from audit
* rename botId feature to botid
* add unit tests for bot service
* lint fixes
* Create getContactOrLeadFromEmail method
* Use getContactOrLeadFromEmail in getContacts
* Move normal getContact query
* fix: correct return type in getContactOrLeadFromEmail and add search mock
- Fix getContactOrLeadFromEmail to return single ContactRecord instead of array
- Add conn.search() implementation to salesforceMock for integration tests
- Ensure id field is always string with proper fallbacks for AccountId and Id
- Fix Owner.Email to use undefined instead of null in mock
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
* test: add comprehensive tests for getContactOrLeadFromEmail method
- Add 6 new unit tests covering all key scenarios
- Test contact lookup, lead fallback, and preference logic
- Test both roundRobinSkipFallbackToLeadOwner and createEventOnLeadCheckForContact code paths
- Add search mock support to mockConnection in beforeEach
- All 34 tests passing, type-check clean
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
* Implement change to error from #24090
* Address feedback
* Type fix
* test: update SOQL query expectations to include Account.OwnerId
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2025-10-03 14:53:00 -04:00
Alex van AndelGitHubDevin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* fix: Convert BillingPlan enum to const object to prevent webpack tree-shaking
TypeScript enums compile to IIFEs which can be incorrectly tree-shaken by webpack
when 'sideEffects: false' is set in package.json. Converting to a const object
with 'as const' avoids the IIFE pattern while maintaining full type safety.
This fixes the 'TRPCError: BillingPlan is not defined' error that occurred in
the hasTeamPlan tRPC handler.
Follows the existing CHECKOUT_SESSION_TYPES pattern in the same file.
Co-Authored-By: alex@cal.com <me@alexvanandel.com>
* fix: Re-export BillingPlan from billing-plans to prevent tree-shaking
The issue was a module initialization order problem. When BillingPlan was
imported from constants.ts into billing-plans.ts and used inside the
BillingPlanService class, webpack's tree-shaker (with sideEffects: false)
couldn't properly track the value dependency across the package boundary.
By re-exporting BillingPlan from the same module that exports
BillingPlanService, we ensure the constant is bundled together with the
class that uses it, preventing tree-shaking.
Co-Authored-By: alex@cal.com <me@alexvanandel.com>
* revert: Restore BillingPlan enum format in constants.ts
The const object conversion didn't fix the tree-shaking issue. The real
fix is re-exporting BillingPlan from billing-plans.ts to ensure it's
part of the same module as BillingPlanService.
Co-Authored-By: alex@cal.com <me@alexvanandel.com>
* fix: Add BillingPlan as private static member to prevent tree-shaking
By making BillingPlan a private static member of BillingPlanService, webpack
now sees it as part of the class definition rather than just used inside
methods. This creates a strong reference that prevents webpack's tree-shaker
from removing the enum initialization IIFE when 'sideEffects: false' is set.
With the previous approach where BillingPlan was only imported and used inside
methods, webpack's static analysis couldn't properly track the enum usage
across package boundaries (@calcom/features -> @calcom/trpc), causing it to
incorrectly determine the enum initialization was unused code.
Fixes the TRPCError: BillingPlan is not defined runtime error.
Thread: https://calendso.slack.com/archives/C08LT9BLEET/p1759420015428149
Co-Authored-By: alex@cal.com <me@alexvanandel.com>
* fix: Clean up BillingPlan references and add explanatory comment
- Remove unnecessary re-export statement
- Use direct BillingPlan references instead of BillingPlanService.BillingPlan
- Add detailed comment explaining webpack tree-shaking workaround
- Keep import from constants.ts and private static member for webpack reference
Co-Authored-By: alex@cal.com <me@alexvanandel.com>
* fix: Remove Slack reference from comment and restore static usage
- Remove Slack URL from explanatory comment
- Restore BillingPlanService.BillingPlan usage throughout class methods
- This static member usage is essential for webpack to track the enum reference
Co-Authored-By: alex@cal.com <me@alexvanandel.com>
* Fix BillingPlan issue by finding root cause
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* Controller Layer updates.
* adding email filtering and pagination to team memberships endpoint..
* Minor enhancements.
* Improve addressed.
* refactor: update team memberships input to handle comma-separated emails
- Replace array format with comma-separated string handling
- Add proper email validation with BadRequestException
- Remove ArrayMaxSize constraint for better flexibility
- Update API documentation and examples
- Align with codebase patterns from get-managed-users.input.ts
* Morgan suggestions addressed.
* More improvements......
- Add private_key, encrypted_credentials, tenant_id, client_email, serviceAccountKey to SENSITIVE_FIELDS array
- Add comprehensive test cases for delegation credential sensitive fields
- Prevents logging of sensitive delegation credential data including private keys
Fixes security issue where delegation credential sensitive fields were not being redacted from logs
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: morgan@cal.com <morgan@cal.com>
Co-authored-by: Morgan <33722304+ThyMinimalDev@users.noreply.github.com>
* fix: aalow team with slug for diff cases
* addressed review
* fix type error
* update test
* addressed review
* fix test
* Update team.ts
---------
Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com>
Co-authored-by: Alex van Andel <me@alexvanandel.com>
* chore: CSRF protect forgot-password functionality
* feat: implement conditional sameSite cookie setting for CSRF tokens
- Use WEBAPP_URL to determine secure cookie settings
- Set sameSite to 'none' for HTTPS environments to support cross-origin scenarios
- Fall back to 'lax' for HTTP development environments
- Follows patterns from PRs #23439 and #23556
Co-Authored-By: alex@cal.com <me@alexvanandel.com>
* update
* change
* NIT
* minor
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: unknown <adhabal2002@gmail.com>
Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com>
* feat: add host validation for team event types
* refactor: remove hosts validator in favor of documentation-based validation approach
* fix: remove HostsOrAssignAllValidator from event type update inputs
* docs: improve clarity of hosts and assignAllTeamMembers field descriptions in event type inputs
* feat(api-keys): add confirmation dialog for API key deletion
* fix: changed text color to subtle
---------
Co-authored-by: Kartik Saini <41051387+kart1ka@users.noreply.github.com>
* fis: pass the missing `platformClientId` to `handleNewBooking` in api/v2
* Update formatCalendarEvent.ts
* only add the externald in case of same calendar, otherwise add if from the .ics file sent in email
* Revert "fis: pass the missing `platformClientId` to `handleNewBooking` in api/v2"
This reverts commit 030ac0f0981c1135d4973fbdafa62d58e8985831.
* fix: alow the host change logic to run for collective envets as well
* fix: run the changedOrganizer logic for both collective and round-robin events
* Update handleNewBooking.ts
* fix: failing unit test
---------
Co-authored-by: Lauris Skraucis <lauris.skraucis@gmail.com>
* feat: auto-accept team invitations for existing users
- Change email button text from 'View Invitation' to 'Accept Invite'
- Implement auto-accept flow when clicking email CTA
- Update TeamService.inviteMemberByToken to support auto-acceptance
- Add new autoAcceptInvite tRPC endpoint for handling auto-acceptance
- Update invitation link generation to include autoAccept parameter
- Handle both team and organization invitation scenarios
- Maintain payment/billing flow integration with TeamBilling.updateQuantity
- Preserve backward compatibility with existing manual flow
- Update all locale files with new 'Accept Invite' button text
Co-Authored-By: anik@cal.com <adhabal2002@gmail.com>
* revert: locale changes except English
- Keep only English 'Accept Invite' translation
- Revert all other locale files to original 'View Invitation' translations
- Maintain core auto-accept invitation functionality
Co-Authored-By: anik@cal.com <adhabal2002@gmail.com>
* simplify: remove autoAccept parameter and make auto-acceptance default
- Remove autoAccept parameter from TeamService.inviteMemberByToken
- Always auto-accept invitations for existing users clicking email links
- Remove autoAccept logic from teams server-page.tsx
- Remove autoAccept=true from invitation URLs
- Delete autoAcceptInvite handler and schema files
- Remove autoAcceptInvite endpoint from tRPC router
- Simplify invitation flow to match new user pattern
Co-Authored-By: anik@cal.com <adhabal2002@gmail.com>
* test: update teamService test to expect auto-accepted memberships
- Change expectation from accepted: false to accepted: true
- Update test description to reflect auto-accept behavior
- Fix TypeScript type casting to use Pick<TeamRepository, 'deleteById'>
- Aligns with new default auto-acceptance for team invitations
Co-Authored-By: anik@cal.com <adhabal2002@gmail.com>
* update
* Update utils.ts
* fix type error
* delete token
* add prisma transaction
* update
* update param
* test: fix mock objects in teamService tests with realistic data
- Fix duplicate property assignments in mock user objects
- Use proper email format (user@example.com) for email fields
- Use proper username format (testuser) for username fields
- Fix logic error in acceptInvitationByToken (|| to &&)
- Add autoAccept parameter to resendInvitation.handler.ts
- All 16 tests passing with proper TypeScript types
Co-Authored-By: anik@cal.com <adhabal2002@gmail.com>
* test: add e2e tests for team invitation auto-accept flow
- Add test for existing user auto-accepting team invitation via email link
- Add test for error handling when wrong user tries to use invitation link
- Verify proper user identity validation and database state changes
- Follow existing e2e test patterns with browser context isolation
- Fix ESLint warnings: replace conditional with assertion and remove unused browser parameter
Co-Authored-By: anik@cal.com <adhabal2002@gmail.com>
* fix
* fix
* fix: update team owner creation in e2e tests to include proper names
- Fix email subject mismatch in auto-accept invitation tests
- Team owners now created with explicit names instead of undefined
- Matches pattern used in other working team invitation tests
Co-Authored-By: anik@cal.com <adhabal2002@gmail.com>
* fix: update organization invitation test helper to match new auto-accept link format
- Change expectExistingUserToBeInvitedToOrganization to look for 'teams?token' instead of 'settings/team'
- Fixes 'Invite link not found' error in organization booking e2e test
- Aligns with auto-accept invitation URL changes that use /teams?token= format
- Fix eslint disable comment for playwright rule
Co-Authored-By: anik@cal.com <adhabal2002@gmail.com>
* address coderrabit review
* fix failing test
* addressed review
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>