* Update an existing imported session with new data from share * @param {string} shareId - Share ID * @param {Object} encryptedData - Already fetched encrypted data from org
(shareId, encryptedData)
| 2430 | let needsClean = false; |
| 2431 | if (source === 'path') { |
| 2432 | url.pathname = this.appRouteRoot; |
| 2433 | needsClean = true; |
| 2434 | } |
| 2435 | if (url.searchParams.has('tickets')) { |
| 2436 | url.searchParams.delete('tickets'); |
| 2437 | needsClean = true; |
| 2438 | } |
| 2439 | |
| 2440 | if (needsClean) { |
| 2441 | const nextUrl = url.toString(); |
| 2442 | if (nextUrl !== window.location.href) { |
| 2443 | window.history.replaceState({}, '', nextUrl); |
| 2444 | } |
| 2445 | } |
| 2446 | } |
| 2447 | |
| 2448 | /** |
| 2449 | * Apply any pending ticket code after UI is ready. |
| 2450 | */ |
| 2451 | handlePendingTicketCode() { |
| 2452 | if (!this.pendingTicketCode || !this.rightPanel) return; |
| 2453 | |
| 2454 | const { code, autoRedeem, source } = this.pendingTicketCode; |
| 2455 | this.pendingTicketCode = null; |
| 2456 | |
| 2457 | if (!code) return; |
| 2458 | this.ingestTicketCode(code, { autoRedeem: !!autoRedeem, source }); |
| 2459 | } |
| 2460 | |
| 2461 | /** |
| 2462 | * Check URL for session parameter (?s=sessionId) |
| 2463 | * - First checks if it's a local session by ID |
| 2464 | * - Then checks if it's a local session by shareId (owned shares) |
| 2465 | * - Then checks if it's a local session by importedFrom (imported shares) |
| 2466 | * - If not found locally, tries to fetch as shared session from org |
| 2467 | */ |
| 2468 | async checkForUrlSession() { |
| 2469 | const params = new URLSearchParams(window.location.search); |
| 2470 | const sessionId = params.get('s'); |
| 2471 | |
| 2472 | if (!sessionId) { |
| 2473 | // No URL params - update URL to reflect current session (if any) |
| 2474 | if (this.state.currentSessionId) { |
| 2475 | this.updateUrlWithSession(this.state.currentSessionId); |
| 2476 | } |
| 2477 | return; |
| 2478 | } |
| 2479 | |
| 2480 | // Normalize input ID for comparison (handles dashes, case variations) |
| 2481 | const normalizedInput = this.normalizeId(sessionId); |
| 2482 | |
| 2483 | // Check if it's a local session by ID |
| 2484 | let localSessionById = this.state.sessions.find(s => this.normalizeId(s.id) === normalizedInput); |
| 2485 | if (!localSessionById) { |
| 2486 | const directSession = await chatDB.getSession(sessionId); |
| 2487 | if (directSession && this.normalizeId(directSession.id) === normalizedInput) { |
| 2488 | localSessionById = directSession; |
| 2489 | this.insertSessionIntoList(directSession); |
no test coverage detected