""" Builds URLs for the two "jump out to somewhere else" actions: viewing a ticket directly in JIRA, and looking up a shipping address on Google Maps (matching the existing manual workflow of pasting an address into Google when investigating a validation issue). Deliberately just URL-building, no browser-launching here - that stays in the UI layer (main_window.py / order_detail_dialog.py) via webbrowser.open(), so this module has no GUI dependency and is easy to test in isolation. """ from __future__ import annotations from urllib.parse import quote from app import config def jira_ticket_url(ticket_number: str | None) -> str | None: if not ticket_number: return None jira_url = config.get("JIRA_URL", "").strip() if not jira_url: return None return f"{jira_url.rstrip('/')}/browse/{ticket_number}" def google_maps_search_url(shipping_info: dict | None) -> str | None: info = shipping_info or {} parts = [ info.get("address1", ""), info.get("address2", ""), info.get("city", ""), info.get("state", ""), info.get("zip", ""), ] address = " ".join(p for p in parts if p).strip() if not address: return None return f"https://www.google.com/maps/search/?api=1&query={quote(address)}"