Skip to content

fix(companion): persist region in extension and fix iOS delete account link#82

Draft
PeerRich wants to merge 1 commit intomainfrom
devin/1776885735-eu-region-followup-fixes
Draft

fix(companion): persist region in extension and fix iOS delete account link#82
PeerRich wants to merge 1 commit intomainfrom
devin/1776885735-eu-region-followup-fixes

Conversation

@PeerRich
Copy link
Copy Markdown
Member

Summary

Follow-up fixes for two Devin Review findings on #80:

  • Extension now persists the region. The companion iframe already forwards the selected region alongside OAuth tokens, but the sync-oauth-tokens handler in apps/extension/entrypoints/background/index.ts was reading the tokens and ignoring message.region. As a result, cal_region was never written to storage.local, so getStoredRegion() always returned "us" and every extension API call (validateTokens, fetchEventTypes, getBookingStatus, markAttendeeNoShow) hit api.cal.com regardless of the user's selection. The handler now writes cal_region before validating tokens, so EU tokens are validated against api.cal.eu.
  • iOS "Delete Account" link is now region-aware. The Android / web (tabs)/(more)/index.tsx was updated to use getCalAppUrl(), but (tabs)/(more)/index.ios.tsx still hard-coded https://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

  • With an EU session active on the extension, confirm validateTokens succeeds after token sync and subsequent API calls (fetch-event-types, getBookingStatus) hit api.cal.eu (check the background service-worker logs / Network tab).
  • Switch region after logout, re-login, and confirm cal_region in chrome.storage.local reflects the new region.
  • On iOS, tap the "Delete Account" row in the More tab while on the EU region and confirm the in-app browser opens app.cal.eu/settings/my-account/profile.

Notes

  • No new env vars, no schema changes, no API surface changes.
  • Lint + typecheck pass locally (bun run typecheck, bun run lint:all).

Link to Devin session: https://app.devin.ai/sessions/ed4320aeeb174166b9bd2c995f9ec364
Requested by: @PeerRich

…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>
@devin-ai-integration
Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant