* fix: dont pick date value from url, use selectedDate value from booker store instead
* fix: replace month count logic with usePrefectch hook
* intialise booker layout as week view
* fix: provide meetingStartTime for test preview to prevent RR timestamp error
When Round Robin timestamp basis is set to START_TIME, the system requires
a meeting start time to calculate the interval for load balancing. Test
Preview doesn't have a real meeting time since it's just simulating the
routing logic.
This fix provides the current time (new Date()) as the meetingStartTime
when calling getOrderedListOfLuckyUsers in test preview mode. This allows
the Round Robin calculation to proceed using the current interval for
realistic ordering while still being in preview mode.
Fixes the 'Meeting start time is required' error that occurs when users
click Test Preview on routing forms with Round Robin timestamp basis set
to START_TIME.
Co-Authored-By: hariom@cal.com <hariombalhara@gmail.com>
* add comment
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
- Update ImpersonatingBanner to use orgAwareUsername field from session
- Falls back to regular username for non-organization users
- Uses existing session data without additional queries
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Anik Dhabal Babu <81948346+anikdhabal@users.noreply.github.com>
2025-10-08 11:31:59 +00:00
Peer RichelsenGitHubpeer@cal.com <peer@cal.com>Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* Init billing tables
* Create `IBillingRepository` types
* Create billing repositories
* Create billingRepositoryFactory
* Eslint fix - remove unused organizationOnboarding
* internal-team-billing create saveTeamBilling method using repositories
* On new teams write to team billing table
* On new org write to org billing table
* Change fields to organizationId
* Add todo comment
* Revert "Change fields to organizationId"
This reverts commit bbb2e5dfa6b4c20a8a395f5730848a492cd70d68.
* test: add comprehensive tests for team billing tables
- Fix credit-service.test.ts Prisma mock to export prisma object
- Replace any types with proper TypeScript types in credit-service.test.ts
- Add unit tests for PrismaTeamBillingRepository covering record creation, enum casting, and error handling
- Add unit tests for PrismaOrganizationBillingRepository with same coverage
- Add unit tests for BillingRepositoryFactory to verify correct repository selection
- Add unit tests for InternalTeamBilling.saveTeamBilling() method testing delegation to correct repositories
- All 53 tests pass with TZ=UTC yarn test
- Type checking passes with yarn type-check:ci --force
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
* refactor: update saveTeamBilling tests to mock repository interface
- Replace prismaMock usage with BillingRepositoryFactory mock
- Mock IBillingRepository interface instead of Prisma directly
- Follow repository mocking pattern from handleResponse.test.ts
- All tests passing (53 total)
Co-Authored-By: joe@cal.com <j.auyeung419@gmail.com>
* Remove log statement
* Remove repository tests
* Address feedback
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
* Fix padding in UpgradeTip component
Adjusted padding in UpgradeTip component.
* Adjust bottom positioning of main navigation component
* Adjust bottom positioning for main navigation
* 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......