UNPKG

@braze/web-sdk

Version:

Braze SDK for web sites and other JS platforms.

43 lines (42 loc) 1.19 kB
import ne, { STORAGE_KEYS as s } from "./storage-manager.js"; import { logger as N } from "../../shared-lib/index.js"; const Bt = { Ja: function (e, o = !1) { let t = !1; try { if (localStorage && localStorage.getItem) try { localStorage.setItem(s.gt.ac, "true"), localStorage.getItem(s.gt.ac) && (localStorage.removeItem(s.gt.ac), (t = !0)); } catch (e) { if ( !( e instanceof Error && ("QuotaExceededError" === e.name || "NS_ERROR_DOM_QUOTA_REACHED" === e.name) && localStorage.length > 0 ) ) throw e; t = !0; } } catch (e) { N.info("Local Storage not supported!"); } const r = Bt.nc(), a = new ne.cc(e, r && !o, t); let n; return (n = t ? new ne.lc(e) : new ne.gc()), new ne(a, n); }, nc: function () { return ( navigator.cookieEnabled || ("cookie" in document && (document.cookie.length > 0 || (document.cookie = "test").indexOf.call(document.cookie, "test") > -1)) ); }, }; export default Bt;