// global namespace for the project
var B2C = {}

function getBaseUrl() {
    let baseUrl = '',
        pathName = window.location.pathname,
        pathNameArray = pathName.split('/')

    if (pathNameArray[2] === 'trunk') {
        baseUrl = `${pathNameArray[0]}/${pathNameArray[1]}/${pathNameArray[2]}`
    } else if (pathNameArray[2] === 'branches' || pathNameArray[2] === 'tags') {
        baseUrl = `${pathNameArray[0]}/${pathNameArray[1]}/${
            pathNameArray[2]
        }/${pathNameArray[3]}`
    } else {
        baseUrl = window.location.origin
    }

    return baseUrl
}
