All files / src main.js

100% Statements 11/11
100% Branches 7/7
100% Functions 1/1
100% Lines 10/10

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67                      5x                               93x   92x       92x                   92x   92x   92x         92x         92x             5x    
import { BrowserClient, Hub } from "@sentry/browser";
import Cms from './cms/cms.js';
import Tracking from './tracking/tracking';
import Menu from './menu/menu';
import Search from './search/search';
import Merchandising from './merchandising/merchandising';
import passthroughTranslator from '../src/utils/passthroughTranslator';
import en from './lang/en';
 
import cssUrl from './css/vybe.scss';
 
let defaultOptions = {
    'sessionId': 12345,
    'customerId': 67890,
    'merchantId': 24680,
    'revisionId': 13579
};
 
class Vybe {
    
    constructor({ 
        token = null, 
        siteName = null,
        language = null,
        getTranslation = passthroughTranslator
    } = {}){
        
        if (!token) throw new Error("token must be set");
 
        const client = new BrowserClient({
            dsn: 'https://385e2ce369bc44b7b0c06e827d0af6d3@sentry.io/1438976',
        });
 
        const instanceOptions = {
            ...defaultOptions,
            token,
            siteName,
            language,
            getTranslation,
            languageKeys: en,
            sentry: new Hub(client)
        }
 
        this.Tracking = new Tracking(instanceOptions);
 
        this.Search = new Search(instanceOptions);
 
        this.Menu = new Menu({
            ...instanceOptions,
            _tracking: this.Tracking
        });
 
        this.Cms = new Cms({
            ...instanceOptions,
            _tracking: this.Tracking
        });
 
        this.Merchandising = new Merchandising({
            ...instanceOptions,
            _tracking: this.Tracking
        });
    }
};
 
Vybe.prototype.version = '0.0.1';
 
export default Vybe;