Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

analytics-id

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

analytics-id - npm Package Compare versions

Comparing version 1.3.0 to 1.3.1

2

lib/analytics-id.es.js

@@ -1,2 +0,2 @@

for(var e=function(e){var o=e.debug;return function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(o){var r=e[0],i=e.slice(1);console.log.apply(console,["analyticsId."+r].concat(i))}}},o=[],t=0;t<=15;t++)o.push(t.toString(16));function r(){for(var e="",t=1;t<=36;t++)e+=9===t||14===t||19===t||24===t?"-":15===t?4:20===t?o[4*Math.random()|8]:o[15*Math.random()|0];return e}var i={segment:{mutate:!0,persist:!0,key:"ajs_user_id",stores:["cookie","localStorage"],generateId:function(e){var o=e.prefix;return void 0===o&&(o="ajs"),[o,r()].join("-")}}};var a={get:function(e){void 0===e&&(e={});var o=e.key;return function(e){void 0===e&&(e="");var o=e.split("; "),t={};if(0===o.length||1===o.length&&""===o[0])return t;for(var r=0;r<o.length;r++){var i=o[r].split("=");t[i[0]]=decodeURIComponent(i[1])}return t}(e.cookie)[o]},set:function(e){void 0===e&&(e={});var o=e.key,t=e.id,r=e.mutate,i=e.domain,a=e.cookie,n=!1;try{a=document.cookie,n=!0}catch(e){a=""}return n&&function(e){var o,t=e.name,r=e.value,i=e.expires,a=e.domain,n=e.path,c=e.secure;o=void 0!==r&&"object"==typeof r?JSON.stringify(r):encodeURIComponent(r),document.cookie=t+"="+o+(i?"; expires="+new Date(i).toUTCString():"")+"; path="+(n||"/")+(a?"; domain="+a:"")+(c?"; secure":"")}({name:o,value:t,path:"/",domain:i}),r||(a=""+a),[a,o+"="+encodeURIComponent(t)].filter(Boolean).join("; ")}};var n={get:function(e){void 0===e&&(e={});var o=e.key,t=e.localStorage;return void 0===t&&(t={}),t.getItem?t.getItem(o):t[o]},set:function(e){void 0===e&&(e={});var o=e.key,t=e.id,r=e.localStorage;void 0===r&&(r={});var i=e.mutate?r:Object.assign({},r);return i.setItem?i.setItem(o,t):i[o]=t,i}},c={cookie:a.get,localStorage:n.get},s={cookie:a.set,localStorage:n.set};function d(o){void 0===o&&(o={});var t=o.id,r=o.debug,a=o.preset;void 0===a&&(a="segment");var n=o.cookie,c=o.localStorage,d=o.domain,u=o.prefix,g=e({debug:r});i[a]||(a="segment");var v,l=Object.assign({},Object.assign({},i[a],o)),f=l.key,m=l.stores,k=l.mutate;if(g(t?'set: using {id: "'+t+'"}':'set: created new id {id: "'+(t=(0,l.generateId)({prefix:u}))+'"}'),!c)try{c=window.localStorage}catch(e){}try{(v=function(o){void 0===o&&(o={});for(var t=o.key,r=o.id,i=o.stores,a=o.mutate,n=o.cookie,c=o.localStorage,d=o.domain,u={},g=e({debug:o.debug}),v=0,l=i;v<l.length;v+=1){var f=l[v];try{var m=s[f],k=m({key:t,id:r,mutate:a,cookie:n,localStorage:c,domain:d});k?(g("set."+f+': success {id: "'+r+'"}'),u[f]=k):g("set."+f+': fail {id: "'+r+'"}')}catch(e){g("set."+f+': fail {id: "'+r+'"}'),console.error(e)}}return u}({debug:r,key:f,id:t,stores:m,mutate:k,cookie:n,localStorage:c,domain:d})).status="success"}catch(e){g("set: error",e),v={status:"error",error:e}}return v}function u(o){void 0===o&&(o={});var t=o.debug,r=o.preset;void 0===r&&(r="segment");var a=o.env;void 0===a&&(a="");var n=o.cookie,s=o.localStorage,u=o.prefix,g=e({debug:t});i[r]||(r="segment");var v=i[r],l=v.generateId,f=v.key,m=v.stores,k=v.persist;if(function(e){void 0===e&&(e={});return"browser"===e.env||"undefined"!=typeof window}({env:a})){if(!s)try{s=window.localStorage}catch(e){}if(!n)try{n=document.cookie}catch(e){}var p=function(o){for(var t=o.stores,r=o.key,i=o.cookie,a=o.localStorage,n=e({debug:o.debug}),s=0,d=t;s<d.length;s+=1){var u=d[s],g=c[u],v=g({key:r,cookie:i,localStorage:a});if(v)return n('get.browser: hit {store: "'+u+'", key: "'+r+'"}'),v;n('get.browser: miss {store: "'+u+'", key: "'+r+'"}')}return""}({debug:t,stores:m,key:f,cookie:n,localStorage:s});if(p)return g('get: found browser id {id: "'+p+'"}'),p}var y=l({prefix:u});return k&&(g('get: persisting new id {id: "'+y+'"}'),d({debug:t,key:f,id:y,cookie:o.cookie,localStorage:o.localStorage})),y}function g(e){return void 0===e?r():"string"==typeof e||"number"==typeof e?d({id:e}):"object"==typeof e?void 0!==e.id||void 0!==e.prefix?d(e):u(e):u()}var v=u,l=d;g.get=u,g.set=d;export default g;export{v as get,l as set};
for(var e=function(e){var t=e.debug;return function(){for(var e=[],o=arguments.length;o--;)e[o]=arguments[o];if(t){var r=e[0],i=e.slice(1);console.log.apply(console,["analyticsId."+r].concat(i))}}},t=[],o=0;o<=15;o++)t.push(o.toString(16));function r(){for(var e="",o=1;o<=36;o++)e+=9===o||14===o||19===o||24===o?"-":15===o?4:20===o?t[4*Math.random()|8]:t[15*Math.random()|0];return e}var i={segment:{mutate:!0,persist:!0,key:"ajs_user_id",stores:["cookie","localStorage"],generateId:function(e){var t=e.prefix;return void 0===t&&(t="ajs"),[t,r()].join("-")}}};var a={get:function(e){void 0===e&&(e={});var t=e.key;return function(e){void 0===e&&(e="");var t=e.split("; "),o={};if(0===t.length||1===t.length&&""===t[0])return o;for(var r=0;r<t.length;r++){var i=t[r].split("=");o[i[0]]=decodeURIComponent(i[1])}return o}(e.cookie)[t]},set:function(e){void 0===e&&(e={});var t=e.key,o=e.id,r=e.mutate,i=e.domain,a=e.cookie,n=!1;try{a=document.cookie,n=!0}catch(e){a=""}return n&&function(e){var t,o=e.name,r=e.value,i=e.expires,a=e.domain,n=e.path,c=e.secure;t=void 0!==r&&"object"==typeof r?JSON.stringify(r):encodeURIComponent(r),document.cookie=o+"="+t+(i?"; expires="+new Date(i).toUTCString():"")+"; path="+(n||"/")+(a?"; domain="+a:"")+(c?"; secure":"")}({name:t,value:o,path:"/",domain:i}),r||(a=""+a),[a,t+"="+encodeURIComponent(o)].filter(Boolean).join("; ")}};var n={get:function(e){void 0===e&&(e={});var t=e.key,o=e.localStorage;return void 0===o&&(o={}),o.getItem?o.getItem(t):o[t]},set:function(e){void 0===e&&(e={});var t=e.key,o=e.id,r=e.localStorage;void 0===r&&(r={});var i=e.mutate?r:Object.assign({},r);return i.setItem?i.setItem(t,o):i[t]=o,i}},c={cookie:a.get,localStorage:n.get},s={cookie:a.set,localStorage:n.set};function d(t){void 0===t&&(t={});var o=t.id,r=t.debug,a=t.preset;void 0===a&&(a="segment");var n=t.cookie,c=t.localStorage,d=t.domain,u=t.prefix,g=e({debug:r});i[a]||(a="segment");var v,l=Object.assign({},Object.assign({},i[a],t)),f=l.key,m=l.stores,k=l.mutate;if(g(o?'set: using {id: "'+o+'"}':'set: created new id {id: "'+(o=(0,l.generateId)({prefix:u}))+'"}'),!c)try{c=window.localStorage}catch(e){}try{(v=function(t){void 0===t&&(t={});for(var o=t.key,r=t.id,i=t.stores,a=t.mutate,n=t.cookie,c=t.localStorage,d=t.domain,u={},g=e({debug:t.debug}),v=0,l=i;v<l.length;v+=1){var f=l[v];try{var m=s[f],k=m({key:o,id:r,mutate:a,cookie:n,localStorage:c,domain:d});k?(g("set."+f+': success {id: "'+r+'"}'),u[f]=k):g("set."+f+': fail {id: "'+r+'"}')}catch(e){g("set."+f+': fail {id: "'+r+'"}'),console.error(e)}}return u}({debug:r,key:f,id:o,stores:m,mutate:k,cookie:n,localStorage:c,domain:d})).status="success"}catch(e){g("set: error",e),v={status:"error",error:e}}return v}function u(t){void 0===t&&(t={});var o=t.debug,r=t.preset;void 0===r&&(r="segment");var a=t.env;void 0===a&&(a="");var n=t.cookie,s=t.localStorage,u=t.prefix,g=e({debug:o});i[r]||(r="segment");var v=Object.assign({},Object.assign({},i[r],t)),l=v.generateId,f=v.key,m=v.stores,k=v.persist;if(function(e){void 0===e&&(e={});return"browser"===e.env||"undefined"!=typeof window}({env:a})){if(!s)try{s=window.localStorage}catch(e){}if(!n)try{n=document.cookie}catch(e){}var p=function(t){for(var o=t.stores,r=t.key,i=t.cookie,a=t.localStorage,n=e({debug:t.debug}),s=0,d=o;s<d.length;s+=1){var u=d[s],g=c[u],v=g({key:r,cookie:i,localStorage:a});if(v)return n('get.browser: hit {store: "'+u+'", key: "'+r+'"}'),v;n('get.browser: miss {store: "'+u+'", key: "'+r+'"}')}return""}({debug:o,stores:m,key:f,cookie:n,localStorage:s});if(p)return g('get: found browser id {id: "'+p+'"}'),p}var y=l({prefix:u});return k&&(g('get: persisting new id {id: "'+y+'"}'),d({debug:o,key:f,id:y,cookie:t.cookie,localStorage:t.localStorage})),y}function g(e){return void 0===e?r():"string"==typeof e||"number"==typeof e?d({id:e}):"object"==typeof e?void 0!==e.id||void 0!==e.prefix?d(e):u(e):u()}var v=u,l=d;g.get=u,g.set=d;export default g;export{v as get,l as set};
//# sourceMappingURL=analytics-id.es.js.map

@@ -1,2 +0,2 @@

for(var e=function(e){var o=e.debug;return function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(o){var r=e[0],i=e.slice(1);console.log.apply(console,["analyticsId."+r].concat(i))}}},o=[],t=0;t<=15;t++)o.push(t.toString(16));function r(){for(var e="",t=1;t<=36;t++)e+=9===t||14===t||19===t||24===t?"-":15===t?4:20===t?o[4*Math.random()|8]:o[15*Math.random()|0];return e}var i={segment:{mutate:!0,persist:!0,key:"ajs_user_id",stores:["cookie","localStorage"],generateId:function(e){var o=e.prefix;return void 0===o&&(o="ajs"),[o,r()].join("-")}}};var a={get:function(e){void 0===e&&(e={});var o=e.key;return function(e){void 0===e&&(e="");var o=e.split("; "),t={};if(0===o.length||1===o.length&&""===o[0])return t;for(var r=0;r<o.length;r++){var i=o[r].split("=");t[i[0]]=decodeURIComponent(i[1])}return t}(e.cookie)[o]},set:function(e){void 0===e&&(e={});var o=e.key,t=e.id,r=e.mutate,i=e.domain,a=e.cookie,n=!1;try{a=document.cookie,n=!0}catch(e){a=""}return n&&function(e){var o,t=e.name,r=e.value,i=e.expires,a=e.domain,n=e.path,c=e.secure;o=void 0!==r&&"object"==typeof r?JSON.stringify(r):encodeURIComponent(r),document.cookie=t+"="+o+(i?"; expires="+new Date(i).toUTCString():"")+"; path="+(n||"/")+(a?"; domain="+a:"")+(c?"; secure":"")}({name:o,value:t,path:"/",domain:i}),r||(a=""+a),[a,o+"="+encodeURIComponent(t)].filter(Boolean).join("; ")}};var n={get:function(e){void 0===e&&(e={});var o=e.key,t=e.localStorage;return void 0===t&&(t={}),t.getItem?t.getItem(o):t[o]},set:function(e){void 0===e&&(e={});var o=e.key,t=e.id,r=e.localStorage;void 0===r&&(r={});var i=e.mutate?r:Object.assign({},r);return i.setItem?i.setItem(o,t):i[o]=t,i}},c={cookie:a.get,localStorage:n.get},s={cookie:a.set,localStorage:n.set};function d(o){void 0===o&&(o={});var t=o.id,r=o.debug,a=o.preset;void 0===a&&(a="segment");var n=o.cookie,c=o.localStorage,d=o.domain,u=o.prefix,g=e({debug:r});i[a]||(a="segment");var l,v=Object.assign({},Object.assign({},i[a],o)),f=v.key,m=v.stores,k=v.mutate;if(g(t?'set: using {id: "'+t+'"}':'set: created new id {id: "'+(t=(0,v.generateId)({prefix:u}))+'"}'),!c)try{c=window.localStorage}catch(e){}try{(l=function(o){void 0===o&&(o={});for(var t=o.key,r=o.id,i=o.stores,a=o.mutate,n=o.cookie,c=o.localStorage,d=o.domain,u={},g=e({debug:o.debug}),l=0,v=i;l<v.length;l+=1){var f=v[l];try{var m=s[f],k=m({key:t,id:r,mutate:a,cookie:n,localStorage:c,domain:d});k?(g("set."+f+': success {id: "'+r+'"}'),u[f]=k):g("set."+f+': fail {id: "'+r+'"}')}catch(e){g("set."+f+': fail {id: "'+r+'"}'),console.error(e)}}return u}({debug:r,key:f,id:t,stores:m,mutate:k,cookie:n,localStorage:c,domain:d})).status="success"}catch(e){g("set: error",e),l={status:"error",error:e}}return l}function u(o){void 0===o&&(o={});var t=o.debug,r=o.preset;void 0===r&&(r="segment");var a=o.env;void 0===a&&(a="");var n=o.cookie,s=o.localStorage,u=o.prefix,g=e({debug:t});i[r]||(r="segment");var l=i[r],v=l.generateId,f=l.key,m=l.stores,k=l.persist;if(function(e){void 0===e&&(e={});return"browser"===e.env||"undefined"!=typeof window}({env:a})){if(!s)try{s=window.localStorage}catch(e){}if(!n)try{n=document.cookie}catch(e){}var p=function(o){for(var t=o.stores,r=o.key,i=o.cookie,a=o.localStorage,n=e({debug:o.debug}),s=0,d=t;s<d.length;s+=1){var u=d[s],g=c[u],l=g({key:r,cookie:i,localStorage:a});if(l)return n('get.browser: hit {store: "'+u+'", key: "'+r+'"}'),l;n('get.browser: miss {store: "'+u+'", key: "'+r+'"}')}return""}({debug:t,stores:m,key:f,cookie:n,localStorage:s});if(p)return g('get: found browser id {id: "'+p+'"}'),p}var y=v({prefix:u});return k&&(g('get: persisting new id {id: "'+y+'"}'),d({debug:t,key:f,id:y,cookie:o.cookie,localStorage:o.localStorage})),y}function g(e){return void 0===e?r():"string"==typeof e||"number"==typeof e?d({id:e}):"object"==typeof e?void 0!==e.id||void 0!==e.prefix?d(e):u(e):u()}g.get=u,g.set=d,module.exports=g;
for(var e=function(e){var o=e.debug;return function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(o){var r=e[0],i=e.slice(1);console.log.apply(console,["analyticsId."+r].concat(i))}}},o=[],t=0;t<=15;t++)o.push(t.toString(16));function r(){for(var e="",t=1;t<=36;t++)e+=9===t||14===t||19===t||24===t?"-":15===t?4:20===t?o[4*Math.random()|8]:o[15*Math.random()|0];return e}var i={segment:{mutate:!0,persist:!0,key:"ajs_user_id",stores:["cookie","localStorage"],generateId:function(e){var o=e.prefix;return void 0===o&&(o="ajs"),[o,r()].join("-")}}};var a={get:function(e){void 0===e&&(e={});var o=e.key;return function(e){void 0===e&&(e="");var o=e.split("; "),t={};if(0===o.length||1===o.length&&""===o[0])return t;for(var r=0;r<o.length;r++){var i=o[r].split("=");t[i[0]]=decodeURIComponent(i[1])}return t}(e.cookie)[o]},set:function(e){void 0===e&&(e={});var o=e.key,t=e.id,r=e.mutate,i=e.domain,a=e.cookie,n=!1;try{a=document.cookie,n=!0}catch(e){a=""}return n&&function(e){var o,t=e.name,r=e.value,i=e.expires,a=e.domain,n=e.path,c=e.secure;o=void 0!==r&&"object"==typeof r?JSON.stringify(r):encodeURIComponent(r),document.cookie=t+"="+o+(i?"; expires="+new Date(i).toUTCString():"")+"; path="+(n||"/")+(a?"; domain="+a:"")+(c?"; secure":"")}({name:o,value:t,path:"/",domain:i}),r||(a=""+a),[a,o+"="+encodeURIComponent(t)].filter(Boolean).join("; ")}};var n={get:function(e){void 0===e&&(e={});var o=e.key,t=e.localStorage;return void 0===t&&(t={}),t.getItem?t.getItem(o):t[o]},set:function(e){void 0===e&&(e={});var o=e.key,t=e.id,r=e.localStorage;void 0===r&&(r={});var i=e.mutate?r:Object.assign({},r);return i.setItem?i.setItem(o,t):i[o]=t,i}},c={cookie:a.get,localStorage:n.get},s={cookie:a.set,localStorage:n.set};function d(o){void 0===o&&(o={});var t=o.id,r=o.debug,a=o.preset;void 0===a&&(a="segment");var n=o.cookie,c=o.localStorage,d=o.domain,u=o.prefix,g=e({debug:r});i[a]||(a="segment");var l,v=Object.assign({},Object.assign({},i[a],o)),f=v.key,m=v.stores,k=v.mutate;if(g(t?'set: using {id: "'+t+'"}':'set: created new id {id: "'+(t=(0,v.generateId)({prefix:u}))+'"}'),!c)try{c=window.localStorage}catch(e){}try{(l=function(o){void 0===o&&(o={});for(var t=o.key,r=o.id,i=o.stores,a=o.mutate,n=o.cookie,c=o.localStorage,d=o.domain,u={},g=e({debug:o.debug}),l=0,v=i;l<v.length;l+=1){var f=v[l];try{var m=s[f],k=m({key:t,id:r,mutate:a,cookie:n,localStorage:c,domain:d});k?(g("set."+f+': success {id: "'+r+'"}'),u[f]=k):g("set."+f+': fail {id: "'+r+'"}')}catch(e){g("set."+f+': fail {id: "'+r+'"}'),console.error(e)}}return u}({debug:r,key:f,id:t,stores:m,mutate:k,cookie:n,localStorage:c,domain:d})).status="success"}catch(e){g("set: error",e),l={status:"error",error:e}}return l}function u(o){void 0===o&&(o={});var t=o.debug,r=o.preset;void 0===r&&(r="segment");var a=o.env;void 0===a&&(a="");var n=o.cookie,s=o.localStorage,u=o.prefix,g=e({debug:t});i[r]||(r="segment");var l=Object.assign({},Object.assign({},i[r],o)),v=l.generateId,f=l.key,m=l.stores,k=l.persist;if(function(e){void 0===e&&(e={});return"browser"===e.env||"undefined"!=typeof window}({env:a})){if(!s)try{s=window.localStorage}catch(e){}if(!n)try{n=document.cookie}catch(e){}var p=function(o){for(var t=o.stores,r=o.key,i=o.cookie,a=o.localStorage,n=e({debug:o.debug}),s=0,d=t;s<d.length;s+=1){var u=d[s],g=c[u],l=g({key:r,cookie:i,localStorage:a});if(l)return n('get.browser: hit {store: "'+u+'", key: "'+r+'"}'),l;n('get.browser: miss {store: "'+u+'", key: "'+r+'"}')}return""}({debug:t,stores:m,key:f,cookie:n,localStorage:s});if(p)return g('get: found browser id {id: "'+p+'"}'),p}var y=v({prefix:u});return k&&(g('get: persisting new id {id: "'+y+'"}'),d({debug:t,key:f,id:y,cookie:o.cookie,localStorage:o.localStorage})),y}function g(e){return void 0===e?r():"string"==typeof e||"number"==typeof e?d({id:e}):"object"==typeof e?void 0!==e.id||void 0!==e.prefix?d(e):u(e):u()}g.get=u,g.set=d,module.exports=g;
//# sourceMappingURL=analytics-id.js.map

@@ -1,2 +0,2 @@

!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o():"function"==typeof define&&define.amd?define(o):e.analyticsId=o()}(this,function(){for(var e=function(e){var o=e.debug;return function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(o){var r=e[0],i=e.slice(1);console.log.apply(console,["analyticsId."+r].concat(i))}}},o=[],t=0;t<=15;t++)o.push(t.toString(16));function r(){for(var e="",t=1;t<=36;t++)e+=9===t||14===t||19===t||24===t?"-":15===t?4:20===t?o[4*Math.random()|8]:o[15*Math.random()|0];return e}var i={segment:{mutate:!0,persist:!0,key:"ajs_user_id",stores:["cookie","localStorage"],generateId:function(e){var o=e.prefix;return void 0===o&&(o="ajs"),[o,r()].join("-")}}};var n={get:function(e){void 0===e&&(e={});var o=e.key;return function(e){void 0===e&&(e="");var o=e.split("; "),t={};if(0===o.length||1===o.length&&""===o[0])return t;for(var r=0;r<o.length;r++){var i=o[r].split("=");t[i[0]]=decodeURIComponent(i[1])}return t}(e.cookie)[o]},set:function(e){void 0===e&&(e={});var o=e.key,t=e.id,r=e.mutate,i=e.domain,n=e.cookie,a=!1;try{n=document.cookie,a=!0}catch(e){n=""}return a&&function(e){var o,t=e.name,r=e.value,i=e.expires,n=e.domain,a=e.path,c=e.secure;o=void 0!==r&&"object"==typeof r?JSON.stringify(r):encodeURIComponent(r),document.cookie=t+"="+o+(i?"; expires="+new Date(i).toUTCString():"")+"; path="+(a||"/")+(n?"; domain="+n:"")+(c?"; secure":"")}({name:o,value:t,path:"/",domain:i}),r||(n=""+n),[n,o+"="+encodeURIComponent(t)].filter(Boolean).join("; ")}};var a={get:function(e){void 0===e&&(e={});var o=e.key,t=e.localStorage;return void 0===t&&(t={}),t.getItem?t.getItem(o):t[o]},set:function(e){void 0===e&&(e={});var o=e.key,t=e.id,r=e.localStorage;void 0===r&&(r={});var i=e.mutate?r:Object.assign({},r);return i.setItem?i.setItem(o,t):i[o]=t,i}},c={cookie:n.get,localStorage:a.get},d={cookie:n.set,localStorage:a.set};function s(o){void 0===o&&(o={});var t=o.id,r=o.debug,n=o.preset;void 0===n&&(n="segment");var a=o.cookie,c=o.localStorage,s=o.domain,u=o.prefix,g=e({debug:r});i[n]||(n="segment");var l,f=Object.assign({},Object.assign({},i[n],o)),v=f.key,m=f.stores,k=f.mutate;if(g(t?'set: using {id: "'+t+'"}':'set: created new id {id: "'+(t=(0,f.generateId)({prefix:u}))+'"}'),!c)try{c=window.localStorage}catch(e){}try{(l=function(o){void 0===o&&(o={});for(var t=o.key,r=o.id,i=o.stores,n=o.mutate,a=o.cookie,c=o.localStorage,s=o.domain,u={},g=e({debug:o.debug}),l=0,f=i;l<f.length;l+=1){var v=f[l];try{var m=d[v],k=m({key:t,id:r,mutate:n,cookie:a,localStorage:c,domain:s});k?(g("set."+v+': success {id: "'+r+'"}'),u[v]=k):g("set."+v+': fail {id: "'+r+'"}')}catch(e){g("set."+v+': fail {id: "'+r+'"}'),console.error(e)}}return u}({debug:r,key:v,id:t,stores:m,mutate:k,cookie:a,localStorage:c,domain:s})).status="success"}catch(e){g("set: error",e),l={status:"error",error:e}}return l}function u(o){void 0===o&&(o={});var t=o.debug,r=o.preset;void 0===r&&(r="segment");var n=o.env;void 0===n&&(n="");var a=o.cookie,d=o.localStorage,u=o.prefix,g=e({debug:t});i[r]||(r="segment");var l=i[r],f=l.generateId,v=l.key,m=l.stores,k=l.persist;if(function(e){void 0===e&&(e={});return"browser"===e.env||"undefined"!=typeof window}({env:n})){if(!d)try{d=window.localStorage}catch(e){}if(!a)try{a=document.cookie}catch(e){}var p=function(o){for(var t=o.stores,r=o.key,i=o.cookie,n=o.localStorage,a=e({debug:o.debug}),d=0,s=t;d<s.length;d+=1){var u=s[d],g=c[u],l=g({key:r,cookie:i,localStorage:n});if(l)return a('get.browser: hit {store: "'+u+'", key: "'+r+'"}'),l;a('get.browser: miss {store: "'+u+'", key: "'+r+'"}')}return""}({debug:t,stores:m,key:v,cookie:a,localStorage:d});if(p)return g('get: found browser id {id: "'+p+'"}'),p}var y=f({prefix:u});return k&&(g('get: persisting new id {id: "'+y+'"}'),s({debug:t,key:v,id:y,cookie:o.cookie,localStorage:o.localStorage})),y}function g(e){return void 0===e?r():"string"==typeof e||"number"==typeof e?s({id:e}):"object"==typeof e?void 0!==e.id||void 0!==e.prefix?s(e):u(e):u()}return g.get=u,g.set=s,g});
!function(e,o){"object"==typeof exports&&"undefined"!=typeof module?module.exports=o():"function"==typeof define&&define.amd?define(o):e.analyticsId=o()}(this,function(){for(var e=function(e){var o=e.debug;return function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];if(o){var r=e[0],i=e.slice(1);console.log.apply(console,["analyticsId."+r].concat(i))}}},o=[],t=0;t<=15;t++)o.push(t.toString(16));function r(){for(var e="",t=1;t<=36;t++)e+=9===t||14===t||19===t||24===t?"-":15===t?4:20===t?o[4*Math.random()|8]:o[15*Math.random()|0];return e}var i={segment:{mutate:!0,persist:!0,key:"ajs_user_id",stores:["cookie","localStorage"],generateId:function(e){var o=e.prefix;return void 0===o&&(o="ajs"),[o,r()].join("-")}}};var n={get:function(e){void 0===e&&(e={});var o=e.key;return function(e){void 0===e&&(e="");var o=e.split("; "),t={};if(0===o.length||1===o.length&&""===o[0])return t;for(var r=0;r<o.length;r++){var i=o[r].split("=");t[i[0]]=decodeURIComponent(i[1])}return t}(e.cookie)[o]},set:function(e){void 0===e&&(e={});var o=e.key,t=e.id,r=e.mutate,i=e.domain,n=e.cookie,a=!1;try{n=document.cookie,a=!0}catch(e){n=""}return a&&function(e){var o,t=e.name,r=e.value,i=e.expires,n=e.domain,a=e.path,c=e.secure;o=void 0!==r&&"object"==typeof r?JSON.stringify(r):encodeURIComponent(r),document.cookie=t+"="+o+(i?"; expires="+new Date(i).toUTCString():"")+"; path="+(a||"/")+(n?"; domain="+n:"")+(c?"; secure":"")}({name:o,value:t,path:"/",domain:i}),r||(n=""+n),[n,o+"="+encodeURIComponent(t)].filter(Boolean).join("; ")}};var a={get:function(e){void 0===e&&(e={});var o=e.key,t=e.localStorage;return void 0===t&&(t={}),t.getItem?t.getItem(o):t[o]},set:function(e){void 0===e&&(e={});var o=e.key,t=e.id,r=e.localStorage;void 0===r&&(r={});var i=e.mutate?r:Object.assign({},r);return i.setItem?i.setItem(o,t):i[o]=t,i}},c={cookie:n.get,localStorage:a.get},s={cookie:n.set,localStorage:a.set};function d(o){void 0===o&&(o={});var t=o.id,r=o.debug,n=o.preset;void 0===n&&(n="segment");var a=o.cookie,c=o.localStorage,d=o.domain,u=o.prefix,g=e({debug:r});i[n]||(n="segment");var l,f=Object.assign({},Object.assign({},i[n],o)),v=f.key,m=f.stores,k=f.mutate;if(g(t?'set: using {id: "'+t+'"}':'set: created new id {id: "'+(t=(0,f.generateId)({prefix:u}))+'"}'),!c)try{c=window.localStorage}catch(e){}try{(l=function(o){void 0===o&&(o={});for(var t=o.key,r=o.id,i=o.stores,n=o.mutate,a=o.cookie,c=o.localStorage,d=o.domain,u={},g=e({debug:o.debug}),l=0,f=i;l<f.length;l+=1){var v=f[l];try{var m=s[v],k=m({key:t,id:r,mutate:n,cookie:a,localStorage:c,domain:d});k?(g("set."+v+': success {id: "'+r+'"}'),u[v]=k):g("set."+v+': fail {id: "'+r+'"}')}catch(e){g("set."+v+': fail {id: "'+r+'"}'),console.error(e)}}return u}({debug:r,key:v,id:t,stores:m,mutate:k,cookie:a,localStorage:c,domain:d})).status="success"}catch(e){g("set: error",e),l={status:"error",error:e}}return l}function u(o){void 0===o&&(o={});var t=o.debug,r=o.preset;void 0===r&&(r="segment");var n=o.env;void 0===n&&(n="");var a=o.cookie,s=o.localStorage,u=o.prefix,g=e({debug:t});i[r]||(r="segment");var l=Object.assign({},Object.assign({},i[r],o)),f=l.generateId,v=l.key,m=l.stores,k=l.persist;if(function(e){void 0===e&&(e={});return"browser"===e.env||"undefined"!=typeof window}({env:n})){if(!s)try{s=window.localStorage}catch(e){}if(!a)try{a=document.cookie}catch(e){}var p=function(o){for(var t=o.stores,r=o.key,i=o.cookie,n=o.localStorage,a=e({debug:o.debug}),s=0,d=t;s<d.length;s+=1){var u=d[s],g=c[u],l=g({key:r,cookie:i,localStorage:n});if(l)return a('get.browser: hit {store: "'+u+'", key: "'+r+'"}'),l;a('get.browser: miss {store: "'+u+'", key: "'+r+'"}')}return""}({debug:t,stores:m,key:v,cookie:a,localStorage:s});if(p)return g('get: found browser id {id: "'+p+'"}'),p}var y=f({prefix:u});return k&&(g('get: persisting new id {id: "'+y+'"}'),d({debug:t,key:v,id:y,cookie:o.cookie,localStorage:o.localStorage})),y}function g(e){return void 0===e?r():"string"==typeof e||"number"==typeof e?d({id:e}):"object"==typeof e?void 0!==e.id||void 0!==e.prefix?d(e):u(e):u()}return g.get=u,g.set=d,g});
//# sourceMappingURL=analytics-id.umd.js.map
{
"name": "analytics-id",
"version": "1.3.0",
"version": "1.3.1",
"description": "get and set analytics ids on the server and in the browser",

@@ -5,0 +5,0 @@ "main": "lib/analytics-id.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc