Draft
Conversation
Adds a Region Select (US / EU) to the mobile login screen and routes OAuth redirects, API calls, and deep links to the correct regional host (app.cal.com + api.cal.com vs app.cal.eu + api.cal.eu) based on the user's selection. The extension's host_permissions and background API_BASE_URL are also region-aware; the selected region is synced from the iframe alongside OAuth tokens so validateTokens + all background API calls hit the correct regional endpoint. Co-Authored-By: peer@cal.com <peer@cal.com>
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Enables
cal.eualongsidecal.comacross the companion mobile app and browser extension. Users pick a data region on the login screen; from that point onward the app uses region-scoped OAuth, API, and deep-link hosts.Mobile app
apps/mobile/utils/region.ts— persistsus/euingeneralStorage, exposes synchronousgetRegion(), asyncsetRegion()/preloadRegion(), asubscribeRegion()listener, and helpersgetCalAppUrl()/getCalApiUrl()/getCalWebUrl()plus aCAL_APP_HOSTNAMESset for host checks.LoginScreen.tsx— adds a "Data region" dropdown (United States / European Union), preloads the region on mount, subscribes to changes, and makes the "Sign up" link region-aware.AuthContext.tsx— preloads the region on app startup and recreates the OAuth service whenever the region changes so subsequent authorization flows target the correctcal.{com|eu}.oauthService.ts—calcomBaseUrlnow comes fromgetCalAppUrl(region). Each browser's OAuth config (iOS WebAuth, Firefox, Safari, Edge) reads region-scoped env vars (..._EUvariants) with fallback to the US values.services/calcom/request.ts— replaces the hardcodedAPI_BASE_URLwithgetApiBaseUrl()so every authenticated API call routes toapi.cal.comorapi.cal.eu.app.cal.comandapp.cal.euhosts and build URLs fromgetCalAppUrl().Extension
wxt.config.ts— addshttps://app.cal.eu/*andhttps://api.cal.eu/*tohost_permissionsand plumbs EU OAuth env vars (base + Firefox/Safari/Edge variants) into the Vite define so the mobile code running in the iframe can read them.entrypoints/content.ts+entrypoints/background/index.ts— the iframe forwards the selected region alongside OAuth tokens on sync; the background persists it in extension storage and derives itsAPI_BASE_URLper-request sovalidateTokens,fetchEventTypes,getBookingStatus, andmarkAttendeeNoShowall hit the correct regional API. Clearing tokens also clears the stored region.New env vars (unset = fall back to the US values):
EXPO_PUBLIC_CALCOM_OAUTH_CLIENT_ID_EUEXPO_PUBLIC_CALCOM_OAUTH_REDIRECT_URI_EU..._FIREFOX_EU,..._SAFARI_EU,..._EDGE_EUvariantsReview & Testing Checklist for Human
EXPO_PUBLIC_CALCOM_OAUTH_*_EUenv vars in the deployment / extension build pipeline before shipping; without them EU users silently fall back to the US client IDs and the redirect toapp.cal.euwill fail.app.cal.com, tokens are minted againstapi.cal.com, and post-login API calls go toapi.cal.com.app.cal.eu, tokens are minted againstapi.cal.eu, and post-login API calls go toapi.cal.eu(check Network tab / extension service worker logs).validateTokenssucceeds on app resume (would fail silently if it still hitapi.cal.com) and thatfetch-event-types/getBookingStatusreturn EU data.openInAppBrowserdeep links point at the correct host for the selected region.Notes
cal.com/help/...andcal.com/roadmapmarketing URLs are intentionally left on.com(not region-scoped content).app.cal.cominlocationHelpers.ts,defaultLocations.ts, andgetAppIconUrl.tsare also left alone — they're public static assets and not part of the auth/API surface. Happy to make them region-aware in a follow-up if the EU CDN serves the same paths.Link to Devin session: https://app.devin.ai/sessions/ed4320aeeb174166b9bd2c995f9ec364
Requested by: @PeerRich