setCookieData = (props) => {
    let newData = props.value,
        mode = props.mode,
        set = false,
        cookieData;

    const state = globalObj._state;

    /**
     * If mode is 'update':
     * add/update only the specified props.
     */
    if (mode === 'update') {
        state._cookieData = cookieData = getCookie('data');
        const sameType = typeof cookieData === typeof newData;

        if (sameType && typeof cookieData === 'object') {
            !cookieData && (cookieData = {});

            for (let prop in newData) {
                if (cookieData[prop] !== newData[prop]) {
                    cookieData[prop] = newData[prop];
                    set = true;
                }
            }
        } else if ((sameType || !cookieData) && cookieData !== newData) {
            cookieData = newData;
            set = true;
        }
    } else {
        cookieData = newData;
        set = true;
    }

    if (set) {
        state._cookieData = cookieData;
        state._savedCookieContent.data = cookieData;
        setCookie(true);
    }

    return set;
}
Save custom data inside cookie
@param {{
 value: any,
 mode: string
}} props
@returns {boolean}