fix(companion): persist region in extension and fix iOS delete account link#82
Draft
fix(companion): persist region in extension and fix iOS delete account link#82
Conversation
…t link Addresses two Devin Review findings on #80: - Extension background now persists the region received from the companion iframe (`cal_region` in `storage.local`) before validating tokens, so `getApiBaseUrl()` / `validateTokens` / `fetchEventTypes` etc. hit the correct regional endpoint for EU users instead of always defaulting to `api.cal.com`. - iOS More page "Delete Account" link now uses `getCalAppUrl()` to match the rest of the file and the Android/web counterpart. 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
Follow-up fixes for two Devin Review findings on #80:
sync-oauth-tokenshandler inapps/extension/entrypoints/background/index.tswas reading the tokens and ignoringmessage.region. As a result,cal_regionwas never written tostorage.local, sogetStoredRegion()always returned"us"and every extension API call (validateTokens,fetchEventTypes,getBookingStatus,markAttendeeNoShow) hitapi.cal.comregardless of the user's selection. The handler now writescal_regionbefore validating tokens, so EU tokens are validated againstapi.cal.eu.(tabs)/(more)/index.tsxwas updated to usegetCalAppUrl(), but(tabs)/(more)/index.ios.tsxstill hard-codedhttps://app.cal.com/settings/my-account/profile. Fixed to match.Both issues were real and user-visible for EU users; the first would have broken extension functionality silently on every EU session.
Review & Testing Checklist for Human
validateTokenssucceeds after token sync and subsequent API calls (fetch-event-types,getBookingStatus) hitapi.cal.eu(check the background service-worker logs / Network tab).cal_regioninchrome.storage.localreflects the new region.app.cal.eu/settings/my-account/profile.Notes
bun run typecheck,bun run lint:all).Link to Devin session: https://app.devin.ai/sessions/ed4320aeeb174166b9bd2c995f9ec364
Requested by: @PeerRich