<commit_before>import $ from 'jquery';
import {TrackingEventHandler, TrackEventType, TrackingData} from './tracking';
import usersessioncookiepersister from './usersessioncookiepersister';
import {UserAgentInfo} from './useragentinfo';

export interface UserSessionPersister {
    loadUserSession(): string | null;
    saveUserSession(userSession: string, daysToLive: number): void;
}

export interface ConditionFunction {
    (userAgentInfo: UserAgentInfo): boolean;
}

export interface SplitTestConfig {
    cookieName: string;
    globalCondition: ConditionFunction;
    sessionPersister: UserSessionPersister;
    tracking: TrackingEventHandler;
    uiCondition: ConditionFunction;
    userSessionDaysToLive: number;
}

const defaultTrackingEventHandler: TrackingEventHandler = (() => {
    function log(event: TrackEventType, trackingData: TrackingData) {
        console.log('Split testing event: ' + event, trackingData);
    }

    return {
        track: log,
        trackLink(elements: Element | JQuery, event: TrackEventType, trackingData: TrackingData) {
            $(elements).on('click', () => {
                log(event, trackingData);
            });
        }
    };
})();

const config: SplitTestConfig = {
    cookieName: 'trustpilotABTest',
    globalCondition: () => true,
    sessionPersister: usersessioncookiepersister,
    tracking: defaultTrackingEventHandler,
    userSessionDaysToLive: 3,
    uiCondition: () => false,
};

export default config;
<commit_msg>Change the default cookie name<commit_after>import $ from 'jquery';
import {TrackingEventHandler, TrackEventType, TrackingData} from './tracking';
import usersessioncookiepersister from './usersessioncookiepersister';
import {UserAgentInfo} from './useragentinfo';

export interface UserSessionPersister {
    loadUserSession(): string | null;
    saveUserSession(userSession: string, daysToLive: number): void;
}

export interface ConditionFunction {
    (userAgentInfo: UserAgentInfo): boolean;
}

export interface SplitTestConfig {
    cookieName: string;
    globalCondition: ConditionFunction;
    sessionPersister: UserSessionPersister;
    tracking: TrackingEventHandler;
    uiCondition: ConditionFunction;
    userSessionDaysToLive: number;
}

const defaultTrackingEventHandler: TrackingEventHandler = (() => {
    function log(event: TrackEventType, trackingData: TrackingData) {
        console.log('Split testing event: ' + event, trackingData);
    }

    return {
        track: log,
        trackLink(elements: Element | JQuery, event: TrackEventType, trackingData: TrackingData) {
            $(elements).on('click', () => {
                log(event, trackingData);
            });
        }
    };
})();

const config: SplitTestConfig = {
    cookieName: 'skiftABTest',
    globalCondition: () => true,
    sessionPersister: usersessioncookiepersister,
    tracking: defaultTrackingEventHandler,
    userSessionDaysToLive: 3,
    uiCondition: () => false
};

export default config;

{'fraction_non_alphanumeric': 0.10337905654064905, 'fraction_numerical': 0.0006691201070592171, 'mean_word_length': 4.128644939965695, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4959167', 'n_tokens_mistral': 799, 'n_tokens_neox': 790, 'n_words': 190}