@analytics/session-utils
Advanced tools
Comparing version 0.1.11 to 0.1.12
@@ -6,2 +6,10 @@ # Change Log | ||
## [0.1.12](https://github.com/DavidWells/analytics/tree/master/packages/analytics-util-session/compare/@analytics/session-utils@0.1.11...@analytics/session-utils@0.1.12) (2021-10-24) | ||
**Note:** Version bump only for package @analytics/session-utils | ||
## [0.1.11](https://github.com/DavidWells/analytics/tree/master/packages/analytics-util-session/compare/@analytics/session-utils@0.1.10...@analytics/session-utils@0.1.11) (2021-10-17) | ||
@@ -8,0 +16,0 @@ |
@@ -1,2 +0,2 @@ | ||
var utilSessions=function(e,n){function t(){for(var e="",n=0,t=4294967295*Math.random()|0;n++<36;){var o="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"[n-1],i=15&t;e+="-"==o||"4"==o?o:("x"==o?i:3&i|8).toString(16),t=n%8==0?4294967295*Math.random()|0:t>>4}return e}var o="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||void 0,i="undefined";function r(e){return o[e]}function s(e,n){return o[e]=n,n}var a=function(){if(typeof a!==i)return a;try{d("__x","__x"),a=-1!==document.cookie.indexOf("__x"),c("__x")}catch(e){a=!1}return a}(),u=d,x=d;function c(e){return a?d(e,"",-1):function(e){s(e)}(e)}function d(e,n,t,o,u,x){if(typeof window!==i){var c=arguments.length>1;return a||(c?s(e,n):r(e)),c?document.cookie=e+"="+encodeURIComponent(n)+(t?"; expires="+new Date(+new Date+1e3*t).toUTCString()+(o?"; path="+o:"")+(u?"; domain="+u:"")+(x?"; secure":""):""):decodeURIComponent((("; "+document.cookie).split("; "+e+"=")[1]||"").split(";")[0])}}var f="__",l="session",g="page",v=["id","createdAt","created"];function p(e){var n=e?new Date(e):new Date;return[n.toISOString(),n.getTime()]}function S(){var e=p(),n=e[0],o=e[1];return{id:t(),created:o,createdAt:n}}function b(e,t){for(var o={session:[n.getSessionItem,n.setSessionItem],page:[r,s]}[e],i=o[0],a=o[1],u=S(),x=!1,c={},d=0;d<v.length;d++){var g=v[d],p=f+e+f+l+f+g,b=i(p);x=t||!b;var _=b&&!t?b:a(p,u[g]),w="created"!==g?_:Number(_);c[g]=w}return m(c,x)}function m(e,n){var t=Date.now();return e.elapsed=t-e.created,e.expires&&(e.remaining=Math.abs(e.expires-t)),e.isNew=n,e}function _(e,n){void 0===e&&(e=30);var t=u("__session"),o=t?JSON.parse(t):w(e);return n?o:m(o,!t)}function w(e,n,t){void 0===e&&(e=30);var o=t?_(e,!0):S(),i=60*e,r=o.created;if(t){var s=p(),a=s[0],u=s[1];o.modified=u,o.modifiedAt=a,r=u}var c=p(r+1e3*i),d=c[0];return o.expires=c[1],o.expiresAt=d,n&&(o=Object.assign(o,n)),x("__session",JSON.stringify(o),i),m(o,!t)}var h=b.bind(null,l),y=b.bind(null,l,!0),D=b.bind(null,g),I=b.bind(null,g,!0);return e.extendSession=function(e,n){return void 0===e&&(e=30),w(e||1,n,!0)},e.getPageSession=D,e.getSession=_,e.getTabSession=h,e.removeSession=function(){return c("__session")},e.sessionData=S,e.setPageSession=I,e.setSession=w,e.setTabSession=y,e}({},sessionStorageUtils); | ||
var utilSessions=function(e){function n(){for(var e="",n=0,t=4294967295*Math.random()|0;n++<36;){var r="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"[n-1],o=15&t;e+="-"==r||"4"==r?r:("x"==r?o:3&o|8).toString(16),t=n%8==0?4294967295*Math.random()|0:t>>4}return e}var t="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||void 0,r="undefined";function o(e){return t[e]}function i(e,n){return t[e]=n,n}var s=function(){if(typeof s!==r)return s;s=!0;try{sessionStorage.setItem(r,r),sessionStorage.removeItem(r)}catch(e){s=!1}return s}();function a(e){return s?sessionStorage.getItem(e)||void 0:o(e)}function u(e,n){return s?sessionStorage.setItem(e,n):i(e,n)}var c=function(){if(typeof c!==r)return c;try{l("__x","__x"),c=-1!==document.cookie.indexOf("__x"),d("__x")}catch(e){c=!1}return c}(),x=l,f=l;function d(e){return c?l(e,"",-1):function(e){i(e)}(e)}function l(e,n,t,s,a,u){if(typeof window!==r){var x=arguments.length>1;return c||(x?i(e,n):o(e)),x?document.cookie=e+"="+encodeURIComponent(n)+(t?"; expires="+new Date(+new Date+1e3*t).toUTCString()+(s?"; path="+s:"")+(a?"; domain="+a:"")+(u?"; secure":""):""):decodeURIComponent((("; "+document.cookie).split("; "+e+"=")[1]||"").split(";")[0])}}var g="__",v="session",m="page",p=["id","createdAt","created"];function S(e){var n=e?new Date(e):new Date;return[n.toISOString(),n.getTime()]}function b(){var e=S(),t=e[0],r=e[1];return{id:n(),created:r,createdAt:t}}function _(e,n){for(var t={session:[a,u],page:[o,i]}[e],r=t[0],s=t[1],c=b(),x=!1,f={},d=0;d<p.length;d++){var l=p[d],m=g+e+g+v+g+l,S=r(m);x=n||!S;var _=S&&!n?S:s(m,c[l]),h="created"!==l?_:Number(_);f[l]=h}return y(f,x)}function y(e,n){var t=Date.now();return e.elapsed=t-e.created,e.expires&&(e.remaining=Math.abs(e.expires-t)),e.isNew=n,e}function h(e,n){void 0===e&&(e=30);var t=x("__session"),r=t?JSON.parse(t):w(e);return n?r:y(r,!t)}function w(e,n,t){void 0===e&&(e=30);var r=t?h(e,!0):b(),o=60*e,i=r.created;if(t){var s=S(),a=s[0],u=s[1];r.modified=u,r.modifiedAt=a,i=u}var c=S(i+1e3*o),x=c[0];return r.expires=c[1],r.expiresAt=x,n&&(r=Object.assign(r,n)),f("__session",JSON.stringify(r),o),y(r,!t)}var I=_.bind(null,v),D=_.bind(null,v,!0),O=_.bind(null,m),A=_.bind(null,m,!0);return e.extendSession=function(e,n){return void 0===e&&(e=30),w(e||1,n,!0)},e.getPageSession=O,e.getSession=h,e.getTabSession=I,e.removeSession=function(){return d("__session")},e.sessionData=b,e.setPageSession=A,e.setSession=w,e.setTabSession=D,e}({}); | ||
//# sourceMappingURL=session-utils.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("@analytics/session-storage-utils")):"function"==typeof define&&define.amd?define(["exports","@analytics/session-storage-utils"],n):n((e||self).utilSessions={},e.sessionStorageUtils)}(this,function(e,n){function t(){for(var e="",n=0,t=4294967295*Math.random()|0;n++<36;){var o="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"[n-1],i=15&t;e+="-"==o||"4"==o?o:("x"==o?i:3&i|8).toString(16),t=n%8==0?4294967295*Math.random()|0:t>>4}return e}var o="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||void 0,i="undefined";function s(e){return o[e]}function r(e,n){return o[e]=n,n}var a=function(){if(typeof a!==i)return a;try{x("__x","__x"),a=-1!==document.cookie.indexOf("__x"),d("__x")}catch(e){a=!1}return a}(),u=x,f=x;function d(e){return a?x(e,"",-1):function(e){r(e)}(e)}function x(e,n,t,o,u,f){if(typeof window!==i){var d=arguments.length>1;return a||(d?r(e,n):s(e)),d?document.cookie=e+"="+encodeURIComponent(n)+(t?"; expires="+new Date(+new Date+1e3*t).toUTCString()+(o?"; path="+o:"")+(u?"; domain="+u:"")+(f?"; secure":""):""):decodeURIComponent((("; "+document.cookie).split("; "+e+"=")[1]||"").split(";")[0])}}var c="__",l="session",g="page",p=["id","createdAt","created"];function v(e){var n=e?new Date(e):new Date;return[n.toISOString(),n.getTime()]}function b(){var e=v(),n=e[0],o=e[1];return{id:t(),created:o,createdAt:n}}function m(e,t){for(var o={session:[n.getSessionItem,n.setSessionItem],page:[s,r]}[e],i=o[0],a=o[1],u=b(),f=!1,d={},x=0;x<p.length;x++){var g=p[x],v=c+e+c+l+c+g,m=i(v);f=t||!m;var _=m&&!t?m:a(v,u[g]),y="created"!==g?_:Number(_);d[g]=y}return S(d,f)}function S(e,n){var t=Date.now();return e.elapsed=t-e.created,e.expires&&(e.remaining=Math.abs(e.expires-t)),e.isNew=n,e}function _(e,n){void 0===e&&(e=30);var t=u("__session"),o=t?JSON.parse(t):y(e);return n?o:S(o,!t)}function y(e,n,t){void 0===e&&(e=30);var o=t?_(e,!0):b(),i=60*e,s=o.created;if(t){var r=v(),a=r[0],u=r[1];o.modified=u,o.modifiedAt=a,s=u}var d=v(s+1e3*i),x=d[0];return o.expires=d[1],o.expiresAt=x,n&&(o=Object.assign(o,n)),f("__session",JSON.stringify(o),i),S(o,!t)}var h=m.bind(null,l),w=m.bind(null,l,!0),D=m.bind(null,g),T=m.bind(null,g,!0);e.extendSession=function(e,n){return void 0===e&&(e=30),y(e||1,n,!0)},e.getPageSession=D,e.getSession=_,e.getTabSession=h,e.removeSession=function(){return d("__session")},e.sessionData=b,e.setPageSession=T,e.setSession=y,e.setTabSession=w}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n((e||self).utilSessions={})}(this,function(e){function n(){for(var e="",n=0,t=4294967295*Math.random()|0;n++<36;){var o="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"[n-1],i=15&t;e+="-"==o||"4"==o?o:("x"==o?i:3&i|8).toString(16),t=n%8==0?4294967295*Math.random()|0:t>>4}return e}var t="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||void 0,o="undefined";function i(e){return t[e]}function r(e,n){return t[e]=n,n}var s=function(){if(typeof s!==o)return s;s=!0;try{sessionStorage.setItem(o,o),sessionStorage.removeItem(o)}catch(e){s=!1}return s}();function a(e){return s?sessionStorage.getItem(e)||void 0:i(e)}function u(e,n){return s?sessionStorage.setItem(e,n):r(e,n)}var f=function(){if(typeof f!==o)return f;try{l("__x","__x"),f=-1!==document.cookie.indexOf("__x"),x("__x")}catch(e){f=!1}return f}(),d=l,c=l;function x(e){return f?l(e,"",-1):function(e){r(e)}(e)}function l(e,n,t,s,a,u){if(typeof window!==o){var d=arguments.length>1;return f||(d?r(e,n):i(e)),d?document.cookie=e+"="+encodeURIComponent(n)+(t?"; expires="+new Date(+new Date+1e3*t).toUTCString()+(s?"; path="+s:"")+(a?"; domain="+a:"")+(u?"; secure":""):""):decodeURIComponent((("; "+document.cookie).split("; "+e+"=")[1]||"").split(";")[0])}}var g="__",p="session",v="page",m=["id","createdAt","created"];function b(e){var n=e?new Date(e):new Date;return[n.toISOString(),n.getTime()]}function S(){var e=b(),t=e[0],o=e[1];return{id:n(),created:o,createdAt:t}}function _(e,n){for(var t={session:[a,u],page:[i,r]}[e],o=t[0],s=t[1],f=S(),d=!1,c={},x=0;x<m.length;x++){var l=m[x],v=g+e+g+p+g+l,b=o(v);d=n||!b;var _=b&&!n?b:s(v,f[l]),h="created"!==l?_:Number(_);c[l]=h}return y(c,d)}function y(e,n){var t=Date.now();return e.elapsed=t-e.created,e.expires&&(e.remaining=Math.abs(e.expires-t)),e.isNew=n,e}function h(e,n){void 0===e&&(e=30);var t=d("__session"),o=t?JSON.parse(t):w(e);return n?o:y(o,!t)}function w(e,n,t){void 0===e&&(e=30);var o=t?h(e,!0):S(),i=60*e,r=o.created;if(t){var s=b(),a=s[0],u=s[1];o.modified=u,o.modifiedAt=a,r=u}var f=b(r+1e3*i),d=f[0];return o.expires=f[1],o.expiresAt=d,n&&(o=Object.assign(o,n)),c("__session",JSON.stringify(o),i),y(o,!t)}var I=_.bind(null,p),D=_.bind(null,p,!0),T=_.bind(null,v),O=_.bind(null,v,!0);e.extendSession=function(e,n){return void 0===e&&(e=30),w(e||1,n,!0)},e.getPageSession=T,e.getSession=h,e.getTabSession=I,e.removeSession=function(){return x("__session")},e.sessionData=S,e.setPageSession=O,e.setSession=w,e.setTabSession=D}); | ||
//# sourceMappingURL=session-utils.umd.js.map |
{ | ||
"name": "@analytics/session-utils", | ||
"version": "0.1.11", | ||
"version": "0.1.12", | ||
"description": "Tiny session utility library", | ||
@@ -56,5 +56,5 @@ "author": "David Wells", | ||
"@analytics/session-storage-utils": "^0.0.2", | ||
"analytics-utils": "^1.0.4" | ||
"analytics-utils": "^1.0.5" | ||
}, | ||
"gitHead": "3f0e5884ba0e491e999bc00bf0ebc9f94e6a94a9" | ||
"gitHead": "22ac7f7b874ec96a434880456b405188a9e31c99" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
358722
6523
4
Updatedanalytics-utils@^1.0.5