Can we mock localStorage usage in chat widget 2.0 widgets-core.min.js?

We use the genesys chat widget 2.0 in an android app with webview, and the version used doesnt support localstorage so the chat widget doesn't work.

There is afaik only one function that uses localstorage in https://apps.mypurecloud.de/widgets/9.0/plugins/widgets-core.min.js

function d(e) {
    var t = null
        , n = "_genesys.widgets.inFocus"
        , o = y.data("pageHidden")
        , r = y.data("pageFocus")
        , i = y.data("ID")
        , a = localStorage.getItem(n) || "";
    void 0 !== document.hidden ? t = document.hidden : void 0 !== document.msHidden ? t = document.msHidden : void 0 !== document.webkitHidden && (t = document.webkitHidden),
        t != o && y.data("pageHidden", t),
        e && ("focus" != e.type && "mousedown" != e.type && "keydown" != e.type || i == a ? "storage" == e.type && e.key == n && e.newValue && e.newValue != i && (y.publish("blur"),
            y.data("pageFocus", !1)) : (y.publish("focus"),
                y.data("pageFocus", !0),
                localStorage.setItem(n, ""),
                localStorage.setItem(n, y.data("ID")))),
        document.hasFocus() && !r ? (y.publish("focus"),
            y.data("pageFocus", !0),
            localStorage.setItem(n, ""),
            localStorage.setItem(n, y.data("ID"))) : document.hasFocus() || (y.publish("blur"),
                y.data("pageFocus", !1));
}

It is hard to understand minified code. Is it possible to mock localStorage without affecting the functionality of the chat widget?

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.