import { KameleoonCore } from '@kameleoon/javascript-sdk-core'; import { SDKParameters, GetVisitorCodeParametersType, SetLegalConsentParametersType, SetNextJSLegalConsentParametersType, GetNextJSVisitorCodeParametersType, GetCustomVisitorCodeParametersType, GetDenoVisitorCodeParametersType, SetDenoLegalConsentParametersType, SetCustomLegalConsentParametersType } from './types'; /** * @class * KameleoonClient - a class for creating kameleoon client instance * */ export declare class KameleoonClient extends KameleoonCore { private readonly domain?; private readonly internalVisitorCodeManager; private readonly externalVisitorCodeManager; constructor({ siteCode, credentials, configuration, compatibility, externals, }: SDKParameters); /** * @method initialize - an asynchronous method for KameleoonClient initialization by fetching Kameleoon SDK related data from server or by retrieving data from local source if data is up-to-date or update interval has not been reached * @returns {Promise} Promise resolved into boolean field indicating success or fail * @throws `KameleoonError` with one of the following `type` s: * * - `KameleoonException.StorageWrite` Couldn't update storage data * - `KameleoonException.StorageRead` - Couldn't read storage data * - `KameleoonException.ClientConfiguration` Couldn't retrieve client configuration from Kameleoon Api * - `KameleoonException.MaximumRetriesReached` Maximum retries reached, request failed */ initialize(): Promise; /** * @method getVisitorCode - obtains visitor code from the request headers cookie, if the visitor code doesn't yet exist generates a random visitor code (or uses a provided default) and sets a new visitor code to response headers cookie * @param {GetVisitorCodeParametersType} params - an object consisting of the following fields: `request`, `response` and `defaultVisitorCode` * @returns {string} result visitor code * @throws `KameleoonError` with one of the following `type` s: * * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty */ getVisitorCode({ request, response, defaultVisitorCode, }: GetVisitorCodeParametersType): string; /** * @method getVisitorCode - retrieves or generates a visitor code using cookies. * @param {GetDenoVisitorCodeParametersType} params - an object consisting of the following fields: `request`, `response` and `defaultVisitorCode` * @returns {string} result visitor code * @throws `KameleoonError` with one of the following `type` s: * * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty */ getVisitorCode({ request, response, defaultVisitorCode, }: GetDenoVisitorCodeParametersType): string; /** * @method getVisitorCode - retrieves or generates a visitor code using cookies. Optimized for Next.js, it works with the state of cookies from `cookies()` in server-side contexts like API Routes or GetServerSideProps * @param {GetNextJSVisitorCodeParametersType} params - an object consisting of the following fields: `cookies` and `defaultVisitorCode` * @returns {string} result visitor code * @throws `KameleoonError` with one of the following `type` s: * * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty */ getVisitorCode({ cookies, defaultVisitorCode, }: GetNextJSVisitorCodeParametersType): string; /** * @method getVisitorCode - retrieves or generates a visitor code using input and output parameters. It's useful for custom implementations where the visitor code is stored in a different way than cookies * @param {GetCustomVisitorCodeParametersType} params - an object consisting of the following fields: `input`, `output` and `defaultVisitorCode` * @returns {string} result visitor code * @throws `KameleoonError` with one of the following `type` s: * * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty */ getVisitorCode({ input, output, }: GetCustomVisitorCodeParametersType): string; /** * @method setLegalConsent - sets or updates the legal consent status for a visitor identified by their unique visitor code, affecting values in the response cookies based on the consent status * @param {SetLegalConsentParametersType} params - an object consisting of the following fields: `visitorCode`, `consent` and `response` * @returns {void} * @throws `KameleoonError` with one of the following `type` s: * * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty */ setLegalConsent({ visitorCode, consent, response, }: SetLegalConsentParametersType): void; /** * @method setLegalConsent - sets or updates the legal consent status for a visitor identified by their unique visitor code, affecting values in the response cookies based on the consent status * @param {SetDenoLegalConsentParametersType} params - an object consisting of the following fields: `visitorCode`, `consent` and `response` * @returns {void} * @throws `KameleoonError` with one of the following `type` s: * * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty */ setLegalConsent({ visitorCode, consent, response, }: SetDenoLegalConsentParametersType): void; /** * @method setLegalConsent - sets or updates the legal consent status for a visitor identified by their unique visitor code, affecting values in the response cookies based on the consent status * @param {SetNextJSLegalConsentParametersType} params - an object consisting of the following fields: `visitorCode`, `consent` and `cookies` * @returns {void} * @throws `KameleoonError` with one of the following `type` s: * * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty */ setLegalConsent({ visitorCode, consent, cookies, }: SetNextJSLegalConsentParametersType): void; /** * @method setLegalConsent - sets or updates the legal consent status for a visitor identified by their unique visitor code, affecting values in the output object based on the consent status * @param {SetCustomLegalConsentParametersType} params - an object consisting of the following fields: `visitorCode`, `consent` and `output` * @returns {void} * @throws `KameleoonError` with one of the following `type` s: * * - `KameleoonException.VisitorCodeMaxLength` - The visitor code length was exceeded * - `KameleoonException.VisitorCodeEmpty` The visitor code is empty */ setLegalConsent({ visitorCode, consent, output, }: SetCustomLegalConsentParametersType): void; /** * Triggers a data file revalidation only when the current configuration is stale. * * If the data file is still valid and the last update happened less than * `dataFileRefreshInterval` ago, the method returns `false` and no update request is made. * * If the data file is stale, the method waits for the revalidation request to finish * and returns `true` when the request was performed. Returning `true` means that the * check was executed, but the configuration itself may still remain unchanged, for * example when the server reports that the current data file is up to date. * * In a usual long-lived Node.js runtime, using this method is generally not * recommended, because the SDK already keeps the data file fresh automatically during * initialization and normal runtime execution. It can still be helpful in edge-style * environments such as Cloudflare Workers, where runtime behavior is more short-lived * and revalidation may need to be triggered explicitly. * * @returns {Promise} `true` if an update request was performed, `false` if * the current data file is still valid and no request was made. */ refreshDataFileIfStale(): Promise; }