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
destroy(): voidAlias for remove(). Cleans up the badge, styles, and theme observer.
Use this in cleanup callbacks (e.g. React useEffect cleanup).
Returns: void
inject
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>
// Inject the powered-by badge after the page has loaded
const lynkow = createClient({ siteId: '...' })
await lynkow.branding.inject()isVisible
isVisible(): booleanChecks whether the branding badge is currently present in the DOM.
Returns: boolean
remove
remove(): voidRemoves the branding badge and its associated styles from the DOM, and stops the theme observer. No-op on server or if the badge is not currently injected.
Returns: void