/** * URLManager handles URL query parameter parsing and deep linking functionality * Follows event-driven architecture with no global state */ export class URLManager { constructor(eventBus) { this.eventBus = eventBus; } /** * Parse eventId from URL query parameters * @returns eventId string or null if not found */ parseEventIdFromURL() { try { const urlParams = new URLSearchParams(window.location.search); const eventId = urlParams.get('eventId'); if (eventId && eventId.trim() !== '') { return eventId.trim(); } return null; } catch (error) { console.warn('URLManager: Failed to parse URL parameters:', error); return null; } } /** * Get all query parameters as an object * @returns object with all query parameters */ getAllQueryParams() { try { const urlParams = new URLSearchParams(window.location.search); const params = {}; for (const [key, value] of urlParams.entries()) { params[key] = value; } return params; } catch (error) { console.warn('URLManager: Failed to parse URL parameters:', error); return {}; } } /** * Update URL without page reload (for future use) * @param params object with parameters to update */ updateURL(params) { try { const url = new URL(window.location.href); // Update or remove parameters Object.entries(params).forEach(([key, value]) => { if (value === null) { url.searchParams.delete(key); } else { url.searchParams.set(key, value); } }); // Update URL without page reload window.history.replaceState({}, '', url.toString()); } catch (error) { console.warn('URLManager: Failed to update URL:', error); } } /** * Check if current URL has any query parameters * @returns true if URL has query parameters */ hasQueryParams() { return window.location.search.length > 0; } } //# sourceMappingURL=URLManager.js.map