Reads the public site configuration (name, domain, locales, branding, analytics consent mode), available as lynkow.site. The client does not cache it: use fetchOptions for your framework's cache.

Access via: lynkow.site

Methods

2 methods

clearCache

TypeScript
clearCache(): void

Clears the cache entries of this service. getConfig() writes none, so this does nothing for a client that never cached a site configuration.

Returns: void

TypeScript
lynkow.site.clearCache()

getConfig

TypeScript
getConfig(options?: BaseRequestOptions): Promise<SiteConfig>

Fetches the site's identity, locale settings, branding options and analytics consent mode. Not cached by the client, so a plan or branding change shows on the next call. Throws LynkowError NOT_FOUND for an unknown site, FORBIDDEN for an inactive site or a request origin that does not match the site's domain, and PAYMENT_REQUIRED when the subscription no longer covers public delivery.

Parameter

Type

Description

options

BaseRequestOptions

Request options. fetchOptions carries framework cache directives, such as { next: { revalidate: 3600 } }.

Returns: Promise<SiteConfig>

TypeScript
const config = await lynkow.site.getConfig()
console.log(config.enabledLocales)        // ['en', 'fr', 'de']
console.log(config.i18n.detection.enabled) // true
console.log(config.analytics.consentMode)  // 'opt-in'