Service for displaying the "Powered by Lynkow" branding badge.

Accessible via lynkow.branding. This is a browser-only service -- all methods are no-ops on the server. The badge HTML and CSS are fetched from the API (cached for 30 minutes, LONG TTL) so they can be updated server-side without SDK changes. The badge automatically adapts to the site's light/dark theme via a MutationObserver.

The badge is shown for sites on the free plan (siteConfig.showBranding === true). It fails silently if the fetch fails (the badge is not critical).

Access via: lynkow.branding

Methods

4 methods

destroy

TypeScript
destroy(): void

Alias for remove. Cleans up the badge, styles, and theme observer. Matches the destroy() naming used on other lifecycle services so cleanup code can stay uniform.

Returns: void

TypeScript
useEffect(() => {
  return () => lynkow.branding.destroy()
}, [])

inject

TypeScript
inject(): Promise<void>

Fetches the badge HTML/CSS from the API and injects it into the page DOM. The badge is appended to document.body and styled according to the site's current theme (light/dark). A theme observer is set up to update the badge if the site theme changes dynamically. Idempotent -- calling multiple times has no effect if the badge is already injected. Fails silently on fetch errors. No-op on server.

Returns: Promise<void>

TypeScript
// Inject the powered-by badge after the page has loaded
const lynkow = createClient({ siteId: '...' })
await lynkow.branding.inject()

isVisible

TypeScript
isVisible(): boolean

Check whether the branding badge is currently mounted in the DOM. Useful for conditional logic (e.g. show a custom "Powered by" only when the badge is not already rendered).

Returns: boolean

TypeScript
if (!lynkow.branding.isVisible()) {
  // Render our own attribution
}

remove

TypeScript
remove(): void

Remove the branding badge and its associated <style> block from the DOM and stop the theme observer. No-op on server or if the badge is not currently injected.

Returns: void

TypeScript
lynkow.branding.remove()