learning_ai_notes/web/src/lib/broadcast-client.ts
Saravana Achu Mac 02bcb0d122 feat: integrate feedback, broadcast, survey, offline-queue clients + settings page + devops
Phase 4: Add @bytelyst/feedback-client, broadcast-client, survey-client, offline-queue
wrappers. Revamp settings page with profile, password change, feedback form.
Add BroadcastBanner and SurveyBanner to app layout. Wire offline queue flush on boot.

Phase 5: Fix .env.example branding (NoteLett), update docker-compose with all env vars,
enable GitHub Actions CI workflow with lint steps.

Made-with: Cursor
2026-03-29 20:57:27 -07:00

25 lines
771 B
TypeScript

"use client";
import { createBroadcastClient, type BroadcastClient } from "@bytelyst/broadcast-client";
import { PLATFORM_SERVICE_URL, PRODUCT_ID } from "@/lib/product-config";
function getAccessToken(): string {
if (typeof window === "undefined") return "";
return localStorage.getItem(`${PRODUCT_ID}_access_token`) ?? "";
}
let _client: BroadcastClient | null = null;
export function getBroadcastClient(): BroadcastClient {
if (!_client) {
_client = createBroadcastClient({
baseUrl: PLATFORM_SERVICE_URL,
productId: PRODUCT_ID,
getAuthToken: getAccessToken,
platform: "web",
appVersion: "0.1.0",
osVersion: typeof navigator !== "undefined" ? navigator.userAgent.slice(0, 40) : "unknown",
});
}
return _client;
}