Get device info for ads API
()
| 476 | |
| 477 | /** Get device info for ads API */ |
| 478 | function getDeviceInfo(): DeviceInfo { |
| 479 | // Map Node.js platform to Gravity API os values |
| 480 | const platformToOs: Record<string, 'macos' | 'windows' | 'linux'> = { |
| 481 | darwin: 'macos', |
| 482 | win32: 'windows', |
| 483 | linux: 'linux', |
| 484 | } |
| 485 | const os = platformToOs[process.platform] ?? 'linux' |
| 486 | |
| 487 | // Get IANA timezone (e.g., "America/New_York") |
| 488 | const timezone = Intl.DateTimeFormat().resolvedOptions().timeZone |
| 489 | |
| 490 | // Get locale (e.g., "en-US") |
| 491 | const locale = Intl.DateTimeFormat().resolvedOptions().locale |
| 492 | |
| 493 | return { os, timezone, locale } |
| 494 | } |
| 495 | |
| 496 | /** |
| 497 | * Useragent string passed to ad providers. Carbon (BuySellAds) requires a |