// ── Platform Telemetry Client ───────────────────────────────── // Thin wrapper over ByteLystPlatformSDK's BLTelemetryClient. // Keeps existing call-site API (CMTelemetryService.shared.trackEvent/trackTimer/trackScreen). // Privacy: no PII, only action names + timing metrics. import Foundation import ByteLystPlatformSDK @MainActor final class CMTelemetryService { static let shared = CMTelemetryService() private let telemetry: BLTelemetryClient private init() { let config = BLPlatformConfig.fromInfoPlist( productId: "chronomind", defaultBaseURL: "https://api.chronomind.app", bundleId: "com.saravana.chronomind", appGroupId: "group.com.chronomind.shared" ) let client = BLPlatformClient(config: config) telemetry = BLTelemetryClient(config: config, client: client) } // MARK: - Public API func start() { telemetry.start() } func stop() { telemetry.stop() } func trackEvent( _ eventType: String, module: String, name: String, feature: String? = nil, message: String? = nil, tags: [String: String]? = nil, metrics: [String: Double]? = nil ) { telemetry.trackEvent(eventType, module: module, name: name, feature: feature, message: message, tags: tags, metrics: metrics) } func trackTimer(_ name: String, tags: [String: String]? = nil, metrics: [String: Double]? = nil) { trackEvent("info", module: "timers", name: name, tags: tags, metrics: metrics) } func trackScreen(_ screen: String) { telemetry.trackScreen(screen) } func flush() { telemetry.flush() } }