| 144 | } |
| 145 | |
| 146 | function detectDeviceFromUserAgent(userAgent: string): string | undefined { |
| 147 | const lowerUserAgent = userAgent.toLowerCase(); |
| 148 | |
| 149 | if (lowerUserAgent.includes("iphone")) return "iPhone"; |
| 150 | if (lowerUserAgent.includes("ipad")) return "iPad"; |
| 151 | if (lowerUserAgent.includes("android")) return "Android"; |
| 152 | if (lowerUserAgent.includes("mac os x") || lowerUserAgent.includes("macintosh")) return "Mac"; |
| 153 | if (lowerUserAgent.includes("windows")) return "Windows"; |
| 154 | if (lowerUserAgent.includes("linux")) return "Linux"; |
| 155 | |
| 156 | return undefined; |
| 157 | } |
| 158 | |
| 159 | function buildSessionLabel(userAgent: string | undefined): string { |
| 160 | const normalizedUserAgent = normalizeOptionalString(userAgent); |