UNPKG

@braze/web-sdk

Version:

Braze SDK for web sites and other JS platforms.

48 lines (47 loc) 1.27 kB
import ne, { STORAGE_KEYS as s } from "./storage-manager.js"; import { logger as b } from "../../shared-lib/index.js"; const Zt = { rl: function (o, t = !1, e) { const r = Zt.oc(), a = Zt.sl(), n = new ne.tc(o, r && !t, a, e); let c; return (c = a ? new ne.ec(o) : new ne.rc()), new ne(n, c); }, oc: function () { return ( navigator.cookieEnabled || ("cookie" in document && (document.cookie.length > 0 || (document.cookie = "test").indexOf.call(document.cookie, "test") > -1)) ); }, sl: function () { let o = !1; try { if (localStorage && localStorage.getItem) try { localStorage.setItem(s.It.ac, "true"), localStorage.getItem(s.It.ac) ? (localStorage.removeItem(s.It.ac), (o = !0)) : (o = !1); } catch (t) { if ( !( t instanceof Error && ("QuotaExceededError" === t.name || "NS_ERROR_DOM_QUOTA_REACHED" === t.name) && localStorage.length > 0 ) ) throw t; o = !0; } } catch (o) { b.info("Local Storage not supported!"); } return o; }, }; export default Zt;