@kameleoon/javascript-sdk
Version:
Kameleoon JavaScript SDK
60 lines (59 loc) • 2.48 kB
TypeScript
import { InternalsType as CoreInternalsType, IExternalEventSource, IExternalRequester, IExternalStorage, SDKConfigurationType, IExternalLogger } from '@kameleoon/javascript-sdk-core/browser';
import { IPlatformAnalyzer } from 'src/utils';
/**
* @param {IExternalStorage | undefined} storage - external storage implementation
* @param {IExternalEventSource | undefined} eventSource - external event source implementation
* @param {IExternalVisitorCodeManager | undefined} visitorCodeManager - external visitor code manager implementation
* @param {IExternalRequester | undefined} requester - external requester implementation
* @param {IExternalLogger | undefined} logger - external logger implementation
* */
export type ExternalsType = {
storage?: IExternalStorage;
requester?: IExternalRequester;
eventSource?: IExternalEventSource;
visitorCodeManager?: IExternalVisitorCodeManager;
logger?: IExternalLogger;
};
/**
* @param {IPlatformAnalyzer | undefined} platformAnalyzer - external platform analyzer implementation
*/
export type InternalsType = CoreInternalsType & {
platformAnalyzer?: IPlatformAnalyzer;
};
/**
* @param {string} siteCode - client's siteCode defined on Kameleoon platform
* @param {Partial<SDKConfigurationType> | undefined} configuration - client's configuration
* @param {ExternalsType | undefined} externals - external dependencies
* @param {InternalsType | undefined} _internals - internal dependencies used by consumer packages (React/React Native SDK)
* @param {boolean | undefined} stubMode - When set to true, the client will operate in stub mode and perform no operations. In this mode, all method calls become no-ops, ensuring that no external actions or side effects occur.
* */
export type SDKParameters = {
siteCode: string;
configuration?: Partial<SDKConfigurationType>;
externals?: ExternalsType;
_internals?: InternalsType;
stubMode?: boolean;
};
export type SetDataParametersType = {
visitorCode: string;
key: string;
domain?: string;
maxAge: number;
path: string;
};
export interface IExternalVisitorCodeManager {
getData: (key: string) => string | null;
setData: (params: SetDataParametersType) => void;
}
export type EngineConsentDataType = {
value?: {
AB_TESTING?: boolean;
};
};
export type GetResultCookieParametersType = {
visitorCode: string;
domain?: string;
key: string;
maxAge: number;
path: string;
};