@cloudcare/browser-core 3.1.6 → 3.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/session/sessionCookieStore.js +1 -0
- package/cjs/session/sessionCookieStore.js.map +1 -1
- package/cjs/session/sessionStore.js +1 -1
- package/cjs/session/sessionStore.js.map +1 -1
- package/esm/session/sessionCookieStore.js +1 -1
- package/esm/session/sessionCookieStore.js.map +1 -1
- package/esm/session/sessionStore.js +2 -2
- package/esm/session/sessionStore.js.map +1 -1
- package/package.json +2 -2
- package/src/session/sessionCookieStore.js +1 -1
- package/src/session/sessionStore.js +6 -2
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.SESSION_COOKIE_NAME = exports.MAX_NUMBER_OF_LOCK_RETRIES = exports.LOCK_RETRY_DELAY = void 0;
|
|
7
|
+
exports.clearSession = clearSession;
|
|
7
8
|
exports.persistSession = persistSession;
|
|
8
9
|
exports.retrieveSession = retrieveSession;
|
|
9
10
|
exports.toSessionString = toSessionString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessionCookieStore.js","names":["_cookie","require","_tools","_sessionConstants","_timer","SESSION_ENTRY_REGEXP","SESSION_ENTRY_SEPARATOR","SESSION_COOKIE_NAME","exports","LOCK_RETRY_DELAY","MAX_NUMBER_OF_LOCK_RETRIES","bufferedOperations","ongoingOperations","withCookieLockAccess","operations","numberOfRetries","push","next","currentLock","currentSession","retrieveSession","isCookieLockEnabled","lock","retryLater","UUID","setSession","options","processedSession","process","persistSession","isExpiredState","after","isChromium","currentNumberOfRetries","setTimeout","undefined","nextOperations","shift","session","clearSession","expire","String","dateNow","SESSION_EXPIRATION_DELAY","setCookie","toSessionString","map","objectEntries","item","join","sessionString","getCookie","isValidSessionString","each","split","entry","matches","exec","key","value","indexOf","test","isEmptyObject"],"sources":["../../src/session/sessionCookieStore.js"],"sourcesContent":["import { getCookie, setCookie } from '../browser/cookie'\nimport {\n isChromium,\n dateNow,\n isEmptyObject,\n UUID,\n objectEntries,\n map,\n each\n} from '../helper/tools'\nimport { SESSION_EXPIRATION_DELAY } from './sessionConstants'\nimport { setTimeout } from '../helper/timer'\nvar SESSION_ENTRY_REGEXP = /^([a-z]+)=([a-z0-9-]+)$/\nvar SESSION_ENTRY_SEPARATOR = '&'\n\nexport var SESSION_COOKIE_NAME = '_dataflux_s'\n\n// arbitrary values\nexport var LOCK_RETRY_DELAY = 10\nexport var MAX_NUMBER_OF_LOCK_RETRIES = 100\n\nvar bufferedOperations = []\nvar ongoingOperations\n\nexport function withCookieLockAccess(operations, numberOfRetries) {\n if (typeof numberOfRetries === 'undefined') {\n numberOfRetries = 0\n }\n if (!ongoingOperations) {\n ongoingOperations = operations\n }\n if (operations !== ongoingOperations) {\n bufferedOperations.push(operations)\n return\n }\n if (numberOfRetries >= MAX_NUMBER_OF_LOCK_RETRIES) {\n next()\n return\n }\n var currentLock\n var currentSession = retrieveSession()\n if (isCookieLockEnabled()) {\n // if someone has lock, retry later\n if (currentSession.lock) {\n retryLater(operations, numberOfRetries)\n return\n }\n // acquire lock\n currentLock = UUID()\n currentSession.lock = currentLock\n setSession(currentSession, operations.options)\n // if lock is not acquired, retry later\n currentSession = retrieveSession()\n if (currentSession.lock !== currentLock) {\n retryLater(operations, numberOfRetries)\n return\n }\n }\n var processedSession = operations.process(currentSession)\n if (isCookieLockEnabled()) {\n // if lock corrupted after process, retry later\n currentSession = retrieveSession()\n if (currentSession.lock !== currentLock) {\n retryLater(operations, numberOfRetries)\n return\n }\n }\n if (processedSession) {\n persistSession(processedSession, operations.options)\n }\n if (isCookieLockEnabled()) {\n // correctly handle lock around expiration would require to handle this case properly at several levels\n // since we don't have evidence of lock issues around expiration, let's just not do the corruption check for it\n if (!(processedSession && isExpiredState(processedSession))) {\n // if lock corrupted after persist, retry later\n currentSession = retrieveSession()\n if (currentSession.lock !== currentLock) {\n retryLater(operations, numberOfRetries)\n return\n }\n delete currentSession.lock\n setSession(currentSession, operations.options)\n processedSession = currentSession\n }\n }\n // call after even if session is not persisted in order to perform operations on\n // up-to-date cookie value, the value could have been modified by another tab\n if (operations.after) {\n operations.after(processedSession || currentSession)\n }\n next()\n}\n\n/**\n * Cookie lock strategy allows mitigating issues due to concurrent access to cookie.\n * This issue concerns only chromium browsers and enabling this on firefox increase cookie write failures.\n */\nfunction isCookieLockEnabled() {\n return isChromium()\n}\n\nfunction retryLater(operations, currentNumberOfRetries) {\n setTimeout(function () {\n withCookieLockAccess(operations, currentNumberOfRetries + 1)\n }, LOCK_RETRY_DELAY)\n}\n\nfunction next() {\n ongoingOperations = undefined\n var nextOperations = bufferedOperations.shift()\n if (nextOperations) {\n withCookieLockAccess(nextOperations)\n }\n}\n\nexport function persistSession(session, options) {\n if (isExpiredState(session)) {\n clearSession(options)\n return\n }\n session.expire = String(dateNow() + SESSION_EXPIRATION_DELAY)\n setSession(session, options)\n}\n\nfunction setSession(session, options) {\n setCookie(\n SESSION_COOKIE_NAME,\n toSessionString(session),\n SESSION_EXPIRATION_DELAY,\n options\n )\n}\n\nexport function toSessionString(session) {\n return map(objectEntries(session), function (item) {\n return item[0] + '=' + item[1]\n }).join(SESSION_ENTRY_SEPARATOR)\n}\n\nexport function retrieveSession() {\n var sessionString = getCookie(SESSION_COOKIE_NAME)\n var session = {}\n if (isValidSessionString(sessionString)) {\n each(sessionString.split(SESSION_ENTRY_SEPARATOR), function (entry) {\n var matches = SESSION_ENTRY_REGEXP.exec(entry)\n if (matches !== null) {\n var key = matches[1]\n var value = matches[2]\n session[key] = value\n }\n })\n }\n return session\n}\n\nfunction isValidSessionString(sessionString) {\n return (\n sessionString !== undefined &&\n (sessionString.indexOf(SESSION_ENTRY_SEPARATOR) !== -1 ||\n SESSION_ENTRY_REGEXP.test(sessionString))\n )\n}\n\nfunction isExpiredState(session) {\n return isEmptyObject(session)\n}\
|
|
1
|
+
{"version":3,"file":"sessionCookieStore.js","names":["_cookie","require","_tools","_sessionConstants","_timer","SESSION_ENTRY_REGEXP","SESSION_ENTRY_SEPARATOR","SESSION_COOKIE_NAME","exports","LOCK_RETRY_DELAY","MAX_NUMBER_OF_LOCK_RETRIES","bufferedOperations","ongoingOperations","withCookieLockAccess","operations","numberOfRetries","push","next","currentLock","currentSession","retrieveSession","isCookieLockEnabled","lock","retryLater","UUID","setSession","options","processedSession","process","persistSession","isExpiredState","after","isChromium","currentNumberOfRetries","setTimeout","undefined","nextOperations","shift","session","clearSession","expire","String","dateNow","SESSION_EXPIRATION_DELAY","setCookie","toSessionString","map","objectEntries","item","join","sessionString","getCookie","isValidSessionString","each","split","entry","matches","exec","key","value","indexOf","test","isEmptyObject"],"sources":["../../src/session/sessionCookieStore.js"],"sourcesContent":["import { getCookie, setCookie } from '../browser/cookie'\nimport {\n isChromium,\n dateNow,\n isEmptyObject,\n UUID,\n objectEntries,\n map,\n each\n} from '../helper/tools'\nimport { SESSION_EXPIRATION_DELAY } from './sessionConstants'\nimport { setTimeout } from '../helper/timer'\nvar SESSION_ENTRY_REGEXP = /^([a-z]+)=([a-z0-9-]+)$/\nvar SESSION_ENTRY_SEPARATOR = '&'\n\nexport var SESSION_COOKIE_NAME = '_dataflux_s'\n\n// arbitrary values\nexport var LOCK_RETRY_DELAY = 10\nexport var MAX_NUMBER_OF_LOCK_RETRIES = 100\n\nvar bufferedOperations = []\nvar ongoingOperations\n\nexport function withCookieLockAccess(operations, numberOfRetries) {\n if (typeof numberOfRetries === 'undefined') {\n numberOfRetries = 0\n }\n if (!ongoingOperations) {\n ongoingOperations = operations\n }\n if (operations !== ongoingOperations) {\n bufferedOperations.push(operations)\n return\n }\n if (numberOfRetries >= MAX_NUMBER_OF_LOCK_RETRIES) {\n next()\n return\n }\n var currentLock\n var currentSession = retrieveSession()\n if (isCookieLockEnabled()) {\n // if someone has lock, retry later\n if (currentSession.lock) {\n retryLater(operations, numberOfRetries)\n return\n }\n // acquire lock\n currentLock = UUID()\n currentSession.lock = currentLock\n setSession(currentSession, operations.options)\n // if lock is not acquired, retry later\n currentSession = retrieveSession()\n if (currentSession.lock !== currentLock) {\n retryLater(operations, numberOfRetries)\n return\n }\n }\n var processedSession = operations.process(currentSession)\n if (isCookieLockEnabled()) {\n // if lock corrupted after process, retry later\n currentSession = retrieveSession()\n if (currentSession.lock !== currentLock) {\n retryLater(operations, numberOfRetries)\n return\n }\n }\n if (processedSession) {\n persistSession(processedSession, operations.options)\n }\n if (isCookieLockEnabled()) {\n // correctly handle lock around expiration would require to handle this case properly at several levels\n // since we don't have evidence of lock issues around expiration, let's just not do the corruption check for it\n if (!(processedSession && isExpiredState(processedSession))) {\n // if lock corrupted after persist, retry later\n currentSession = retrieveSession()\n if (currentSession.lock !== currentLock) {\n retryLater(operations, numberOfRetries)\n return\n }\n delete currentSession.lock\n setSession(currentSession, operations.options)\n processedSession = currentSession\n }\n }\n // call after even if session is not persisted in order to perform operations on\n // up-to-date cookie value, the value could have been modified by another tab\n if (operations.after) {\n operations.after(processedSession || currentSession)\n }\n next()\n}\n\n/**\n * Cookie lock strategy allows mitigating issues due to concurrent access to cookie.\n * This issue concerns only chromium browsers and enabling this on firefox increase cookie write failures.\n */\nfunction isCookieLockEnabled() {\n return isChromium()\n}\n\nfunction retryLater(operations, currentNumberOfRetries) {\n setTimeout(function () {\n withCookieLockAccess(operations, currentNumberOfRetries + 1)\n }, LOCK_RETRY_DELAY)\n}\n\nfunction next() {\n ongoingOperations = undefined\n var nextOperations = bufferedOperations.shift()\n if (nextOperations) {\n withCookieLockAccess(nextOperations)\n }\n}\n\nexport function persistSession(session, options) {\n if (isExpiredState(session)) {\n clearSession(options)\n return\n }\n session.expire = String(dateNow() + SESSION_EXPIRATION_DELAY)\n setSession(session, options)\n}\n\nfunction setSession(session, options) {\n setCookie(\n SESSION_COOKIE_NAME,\n toSessionString(session),\n SESSION_EXPIRATION_DELAY,\n options\n )\n}\n\nexport function toSessionString(session) {\n return map(objectEntries(session), function (item) {\n return item[0] + '=' + item[1]\n }).join(SESSION_ENTRY_SEPARATOR)\n}\n\nexport function retrieveSession() {\n var sessionString = getCookie(SESSION_COOKIE_NAME)\n var session = {}\n if (isValidSessionString(sessionString)) {\n each(sessionString.split(SESSION_ENTRY_SEPARATOR), function (entry) {\n var matches = SESSION_ENTRY_REGEXP.exec(entry)\n if (matches !== null) {\n var key = matches[1]\n var value = matches[2]\n session[key] = value\n }\n })\n }\n return session\n}\n\nfunction isValidSessionString(sessionString) {\n return (\n sessionString !== undefined &&\n (sessionString.indexOf(SESSION_ENTRY_SEPARATOR) !== -1 ||\n SESSION_ENTRY_REGEXP.test(sessionString))\n )\n}\n\nfunction isExpiredState(session) {\n return isEmptyObject(session)\n}\nexport function clearSession(options) {\n setCookie(SESSION_COOKIE_NAME, '', 0, options)\n}\n"],"mappings":";;;;;;;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AASA,IAAAE,iBAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAII,oBAAoB,GAAG,yBAAyB;AACpD,IAAIC,uBAAuB,GAAG,GAAG;AAE1B,IAAIC,mBAAmB,GAAG,aAAa;;AAE9C;AAAAC,OAAA,CAAAD,mBAAA,GAAAA,mBAAA;AACO,IAAIE,gBAAgB,GAAG,EAAE;AAAAD,OAAA,CAAAC,gBAAA,GAAAA,gBAAA;AACzB,IAAIC,0BAA0B,GAAG,GAAG;AAAAF,OAAA,CAAAE,0BAAA,GAAAA,0BAAA;AAE3C,IAAIC,kBAAkB,GAAG,EAAE;AAC3B,IAAIC,iBAAiB;AAEd,SAASC,oBAAoBA,CAACC,UAAU,EAAEC,eAAe,EAAE;EAChE,IAAI,OAAOA,eAAe,KAAK,WAAW,EAAE;IAC1CA,eAAe,GAAG,CAAC;EACrB;EACA,IAAI,CAACH,iBAAiB,EAAE;IACtBA,iBAAiB,GAAGE,UAAU;EAChC;EACA,I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,mBAAmB,EAAE,EAAE,EAAE,CAAC,EAAEmB,OAAO,CAAC;AAChD"}
|
|
@@ -120,7 +120,7 @@ function startSessionStore(options, productKey, computeSessionState) {
|
|
|
120
120
|
renewObservable: renewObservable,
|
|
121
121
|
expireObservable: expireObservable,
|
|
122
122
|
expire: function expire() {
|
|
123
|
-
|
|
123
|
+
(0, _sessionCookieStore.clearSession)(options);
|
|
124
124
|
synchronizeSession({});
|
|
125
125
|
},
|
|
126
126
|
stop: function stop() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessionStore.js","names":["_cookie","require","_observable","_tools","_sessionConstants","_sessionCookieStore","_timer","startSessionStore","options","productKey","computeSessionState","renewObservable","Observable","expireObservable","watchSessionTimeoutId","setInterval","watchSession","COOKIE_ACCESS_DELAY","sessionCache","retrieveActiveSession","expandOrRenewSession","isTracked","withCookieLockAccess","process","cookieSession","synchronizedSession","synchronizeSession","expandOrRenewCookie","after","hasSessionInCache","renewSession","expandSession","undefined","isActiveSession","isSessionInCacheOutdated","expireSessionInCache","sessionState","trackingType","id","UUID","created","String","dateNow","notify","session","retrieveSession","Number","SESSION_TIME_OUT_DELAY","expire","throttle","throttled","getSession","
|
|
1
|
+
{"version":3,"file":"sessionStore.js","names":["_cookie","require","_observable","_tools","_sessionConstants","_sessionCookieStore","_timer","startSessionStore","options","productKey","computeSessionState","renewObservable","Observable","expireObservable","watchSessionTimeoutId","setInterval","watchSession","COOKIE_ACCESS_DELAY","sessionCache","retrieveActiveSession","expandOrRenewSession","isTracked","withCookieLockAccess","process","cookieSession","synchronizedSession","synchronizeSession","expandOrRenewCookie","after","hasSessionInCache","renewSession","expandSession","undefined","isActiveSession","isSessionInCacheOutdated","expireSessionInCache","sessionState","trackingType","id","UUID","created","String","dateNow","notify","session","retrieveSession","Number","SESSION_TIME_OUT_DELAY","expire","throttle","throttled","getSession","clearSession","stop","clearInterval"],"sources":["../../src/session/sessionStore.js"],"sourcesContent":["import { COOKIE_ACCESS_DELAY } from '../browser/cookie'\nimport { Observable } from '../helper/observable'\nimport { dateNow, UUID, throttle } from '../helper/tools'\nimport { SESSION_TIME_OUT_DELAY } from './sessionConstants'\nimport {\n retrieveSession,\n withCookieLockAccess,\n clearSession\n} from './sessionCookieStore'\nimport { clearInterval, setInterval } from '../helper/timer'\n\n/**\n * Different session concepts:\n * - tracked, the session has an id and is updated along the user navigation\n * - not tracked, the session does not have an id but it is updated along the user navigation\n * - inactive, no session in store or session expired, waiting for a renew session\n */\nexport function startSessionStore(options, productKey, computeSessionState) {\n var renewObservable = new Observable()\n var expireObservable = new Observable()\n\n var watchSessionTimeoutId = setInterval(watchSession, COOKIE_ACCESS_DELAY)\n var sessionCache = retrieveActiveSession()\n\n function expandOrRenewSession() {\n var isTracked\n withCookieLockAccess({\n options: options,\n process: function (cookieSession) {\n var synchronizedSession = synchronizeSession(cookieSession)\n isTracked = expandOrRenewCookie(synchronizedSession)\n return synchronizedSession\n },\n after: function (cookieSession) {\n if (isTracked && !hasSessionInCache()) {\n renewSession(cookieSession)\n }\n sessionCache = cookieSession\n }\n })\n }\n\n function expandSession() {\n withCookieLockAccess({\n options: options,\n process: function (cookieSession) {\n return hasSessionInCache()\n ? synchronizeSession(cookieSession)\n : undefined\n }\n })\n }\n\n /**\n * allows two behaviors:\n * - if the session is active, synchronize the session cache without updating the session cookie\n * - if the session is not active, clear the session cookie and expire the session cache\n */\n function watchSession() {\n withCookieLockAccess({\n options: options,\n process: function (cookieSession) {\n return !isActiveSession(cookieSession) ? {} : undefined\n },\n after: synchronizeSession\n })\n }\n\n function synchronizeSession(cookieSession) {\n if (!isActiveSession(cookieSession)) {\n cookieSession = {}\n }\n if (hasSessionInCache()) {\n if (isSessionInCacheOutdated(cookieSession)) {\n expireSessionInCache()\n } else {\n sessionCache = cookieSession\n }\n }\n return cookieSession\n }\n\n function expandOrRenewCookie(cookieSession) {\n var sessionState = computeSessionState(cookieSession[productKey])\n var trackingType = sessionState.trackingType\n var isTracked = sessionState.isTracked\n cookieSession[productKey] = trackingType\n if (isTracked && !cookieSession.id) {\n cookieSession.id = UUID()\n cookieSession.created = String(dateNow())\n }\n return isTracked\n }\n\n function hasSessionInCache() {\n return sessionCache[productKey] !== undefined\n }\n\n function isSessionInCacheOutdated(cookieSession) {\n return (\n sessionCache.id !== cookieSession.id ||\n sessionCache[productKey] !== cookieSession[productKey]\n )\n }\n\n function expireSessionInCache() {\n sessionCache = {}\n expireObservable.notify()\n }\n\n function renewSession(cookieSession) {\n sessionCache = cookieSession\n renewObservable.notify()\n }\n\n function retrieveActiveSession() {\n var session = retrieveSession()\n if (isActiveSession(session)) {\n return session\n }\n return {}\n }\n\n function isActiveSession(session) {\n // created and expire can be undefined for versions which was not storing them\n // these checks could be removed when older versions will not be available/live anymore\n return (\n (session.created === undefined ||\n dateNow() - Number(session.created) < SESSION_TIME_OUT_DELAY) &&\n (session.expire === undefined || dateNow() < Number(session.expire))\n )\n }\n\n return {\n expandOrRenewSession: throttle(expandOrRenewSession, COOKIE_ACCESS_DELAY)\n .throttled,\n expandSession: expandSession,\n getSession: function () {\n return sessionCache\n },\n renewObservable: renewObservable,\n expireObservable: expireObservable,\n expire: function () {\n clearSession(options)\n synchronizeSession({})\n },\n stop: function () {\n clearInterval(watchSessionTimeoutId)\n }\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,iBAAA,GAAAH,OAAA;AACA,IAAAI,mBAAA,GAAAJ,OAAA;AAKA,IAAAK,MAAA,GAAAL,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASM,iBAAiBA,CAACC,OAAO,EAAEC,UAAU,EAAEC,mBAAmB,EAAE;EAC1E,IAAIC,eAAe,GAAG,IAAIC,sBAAU,CAAC,CAAC;EACtC,IAAIC,gBAAgB,GAAG,IAAID,sBAAU,CAAC,CAAC;EAEvC,IAAIE,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AAIyB,OAAO,GAAG,IAAAC,mCAAe,EAAC,CAAC;IAC/B,IAAIZ,eAAe,CAACW,OAAO,CAAC,EAAE;MAC5B,OAAOA,OAAO;IAChB;IACA,OAAO,CAAC,CAAC;EACX;EAEA,SAASX,eAAeA,CAACW,OAAO,EAAE;IAChC;IACA;IACA,OACE,CAACA,OAAO,CAACJ,OAAO,KAAKR,SAAS,IAC5B,IAAAU,cAAO,EAAC,CAAC,GAAGI,MAAM,CAACF,OAAO,CAACJ,OAAO,CAAC,GAAGO,wCAAsB,MAC7DH,OAAO,CAACI,MAAM,KAAKhB,SAAS,IAAI,IAAAU,cAAO,EAAC,CAAC,GAAGI,MAAM,CAACF,OAAO,CAACI,MAAM,CAAC,CAAC;EAExE;EAEA,OAAO;IACL5B,oBAAoB,EAAE,IAAA6B,eAAQ,EAAC7B,oBAAoB,EAAEH,2BAAmB,CAAC,CACtEiC,SAAS;IACZnB,aAAa,EAAEA,aAAa;IAC5BoB,UAAU,EAAE,SAAAA,WAAA,EAAY;MACtB,OAAOjC,YAAY;IACrB,CAAC;IACDP,eAAe,EAAEA,eAAe;IAChCE,gBAAgB,EAAEA,gBAAgB;IAClCmC,MAAM,EAAE,SAAAA,OAAA,EAAY;MAClB,IAAAI,gCAAY,EAAC5C,OAAO,CAAC;MACrBkB,kBAAkB,CAAC,CAAC,CAAC,CAAC;IACxB,CAAC;IACD2B,IAAI,EAAE,SAAAA,KAAA,EAAY;MAChB,IAAAC,oBAAa,EAACxC,qBAAqB,CAAC;IACtC;EACF,CAAC;AACH"}
|
|
@@ -136,7 +136,7 @@ function isValidSessionString(sessionString) {
|
|
|
136
136
|
function isExpiredState(session) {
|
|
137
137
|
return isEmptyObject(session);
|
|
138
138
|
}
|
|
139
|
-
function clearSession(options) {
|
|
139
|
+
export function clearSession(options) {
|
|
140
140
|
setCookie(SESSION_COOKIE_NAME, '', 0, options);
|
|
141
141
|
}
|
|
142
142
|
//# sourceMappingURL=sessionCookieStore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessionCookieStore.js","names":["getCookie","setCookie","isChromium","dateNow","isEmptyObject","UUID","objectEntries","map","each","SESSION_EXPIRATION_DELAY","setTimeout","SESSION_ENTRY_REGEXP","SESSION_ENTRY_SEPARATOR","SESSION_COOKIE_NAME","LOCK_RETRY_DELAY","MAX_NUMBER_OF_LOCK_RETRIES","bufferedOperations","ongoingOperations","withCookieLockAccess","operations","numberOfRetries","push","next","currentLock","currentSession","retrieveSession","isCookieLockEnabled","lock","retryLater","setSession","options","processedSession","process","persistSession","isExpiredState","after","currentNumberOfRetries","undefined","nextOperations","shift","session","clearSession","expire","String","toSessionString","item","join","sessionString","isValidSessionString","split","entry","matches","exec","key","value","indexOf","test"],"sources":["../../src/session/sessionCookieStore.js"],"sourcesContent":["import { getCookie, setCookie } from '../browser/cookie'\nimport {\n isChromium,\n dateNow,\n isEmptyObject,\n UUID,\n objectEntries,\n map,\n each\n} from '../helper/tools'\nimport { SESSION_EXPIRATION_DELAY } from './sessionConstants'\nimport { setTimeout } from '../helper/timer'\nvar SESSION_ENTRY_REGEXP = /^([a-z]+)=([a-z0-9-]+)$/\nvar SESSION_ENTRY_SEPARATOR = '&'\n\nexport var SESSION_COOKIE_NAME = '_dataflux_s'\n\n// arbitrary values\nexport var LOCK_RETRY_DELAY = 10\nexport var MAX_NUMBER_OF_LOCK_RETRIES = 100\n\nvar bufferedOperations = []\nvar ongoingOperations\n\nexport function withCookieLockAccess(operations, numberOfRetries) {\n if (typeof numberOfRetries === 'undefined') {\n numberOfRetries = 0\n }\n if (!ongoingOperations) {\n ongoingOperations = operations\n }\n if (operations !== ongoingOperations) {\n bufferedOperations.push(operations)\n return\n }\n if (numberOfRetries >= MAX_NUMBER_OF_LOCK_RETRIES) {\n next()\n return\n }\n var currentLock\n var currentSession = retrieveSession()\n if (isCookieLockEnabled()) {\n // if someone has lock, retry later\n if (currentSession.lock) {\n retryLater(operations, numberOfRetries)\n return\n }\n // acquire lock\n currentLock = UUID()\n currentSession.lock = currentLock\n setSession(currentSession, operations.options)\n // if lock is not acquired, retry later\n currentSession = retrieveSession()\n if (currentSession.lock !== currentLock) {\n retryLater(operations, numberOfRetries)\n return\n }\n }\n var processedSession = operations.process(currentSession)\n if (isCookieLockEnabled()) {\n // if lock corrupted after process, retry later\n currentSession = retrieveSession()\n if (currentSession.lock !== currentLock) {\n retryLater(operations, numberOfRetries)\n return\n }\n }\n if (processedSession) {\n persistSession(processedSession, operations.options)\n }\n if (isCookieLockEnabled()) {\n // correctly handle lock around expiration would require to handle this case properly at several levels\n // since we don't have evidence of lock issues around expiration, let's just not do the corruption check for it\n if (!(processedSession && isExpiredState(processedSession))) {\n // if lock corrupted after persist, retry later\n currentSession = retrieveSession()\n if (currentSession.lock !== currentLock) {\n retryLater(operations, numberOfRetries)\n return\n }\n delete currentSession.lock\n setSession(currentSession, operations.options)\n processedSession = currentSession\n }\n }\n // call after even if session is not persisted in order to perform operations on\n // up-to-date cookie value, the value could have been modified by another tab\n if (operations.after) {\n operations.after(processedSession || currentSession)\n }\n next()\n}\n\n/**\n * Cookie lock strategy allows mitigating issues due to concurrent access to cookie.\n * This issue concerns only chromium browsers and enabling this on firefox increase cookie write failures.\n */\nfunction isCookieLockEnabled() {\n return isChromium()\n}\n\nfunction retryLater(operations, currentNumberOfRetries) {\n setTimeout(function () {\n withCookieLockAccess(operations, currentNumberOfRetries + 1)\n }, LOCK_RETRY_DELAY)\n}\n\nfunction next() {\n ongoingOperations = undefined\n var nextOperations = bufferedOperations.shift()\n if (nextOperations) {\n withCookieLockAccess(nextOperations)\n }\n}\n\nexport function persistSession(session, options) {\n if (isExpiredState(session)) {\n clearSession(options)\n return\n }\n session.expire = String(dateNow() + SESSION_EXPIRATION_DELAY)\n setSession(session, options)\n}\n\nfunction setSession(session, options) {\n setCookie(\n SESSION_COOKIE_NAME,\n toSessionString(session),\n SESSION_EXPIRATION_DELAY,\n options\n )\n}\n\nexport function toSessionString(session) {\n return map(objectEntries(session), function (item) {\n return item[0] + '=' + item[1]\n }).join(SESSION_ENTRY_SEPARATOR)\n}\n\nexport function retrieveSession() {\n var sessionString = getCookie(SESSION_COOKIE_NAME)\n var session = {}\n if (isValidSessionString(sessionString)) {\n each(sessionString.split(SESSION_ENTRY_SEPARATOR), function (entry) {\n var matches = SESSION_ENTRY_REGEXP.exec(entry)\n if (matches !== null) {\n var key = matches[1]\n var value = matches[2]\n session[key] = value\n }\n })\n }\n return session\n}\n\nfunction isValidSessionString(sessionString) {\n return (\n sessionString !== undefined &&\n (sessionString.indexOf(SESSION_ENTRY_SEPARATOR) !== -1 ||\n SESSION_ENTRY_REGEXP.test(sessionString))\n )\n}\n\nfunction isExpiredState(session) {\n return isEmptyObject(session)\n}\
|
|
1
|
+
{"version":3,"file":"sessionCookieStore.js","names":["getCookie","setCookie","isChromium","dateNow","isEmptyObject","UUID","objectEntries","map","each","SESSION_EXPIRATION_DELAY","setTimeout","SESSION_ENTRY_REGEXP","SESSION_ENTRY_SEPARATOR","SESSION_COOKIE_NAME","LOCK_RETRY_DELAY","MAX_NUMBER_OF_LOCK_RETRIES","bufferedOperations","ongoingOperations","withCookieLockAccess","operations","numberOfRetries","push","next","currentLock","currentSession","retrieveSession","isCookieLockEnabled","lock","retryLater","setSession","options","processedSession","process","persistSession","isExpiredState","after","currentNumberOfRetries","undefined","nextOperations","shift","session","clearSession","expire","String","toSessionString","item","join","sessionString","isValidSessionString","split","entry","matches","exec","key","value","indexOf","test"],"sources":["../../src/session/sessionCookieStore.js"],"sourcesContent":["import { getCookie, setCookie } from '../browser/cookie'\nimport {\n isChromium,\n dateNow,\n isEmptyObject,\n UUID,\n objectEntries,\n map,\n each\n} from '../helper/tools'\nimport { SESSION_EXPIRATION_DELAY } from './sessionConstants'\nimport { setTimeout } from '../helper/timer'\nvar SESSION_ENTRY_REGEXP = /^([a-z]+)=([a-z0-9-]+)$/\nvar SESSION_ENTRY_SEPARATOR = '&'\n\nexport var SESSION_COOKIE_NAME = '_dataflux_s'\n\n// arbitrary values\nexport var LOCK_RETRY_DELAY = 10\nexport var MAX_NUMBER_OF_LOCK_RETRIES = 100\n\nvar bufferedOperations = []\nvar ongoingOperations\n\nexport function withCookieLockAccess(operations, numberOfRetries) {\n if (typeof numberOfRetries === 'undefined') {\n numberOfRetries = 0\n }\n if (!ongoingOperations) {\n ongoingOperations = operations\n }\n if (operations !== ongoingOperations) {\n bufferedOperations.push(operations)\n return\n }\n if (numberOfRetries >= MAX_NUMBER_OF_LOCK_RETRIES) {\n next()\n return\n }\n var currentLock\n var currentSession = retrieveSession()\n if (isCookieLockEnabled()) {\n // if someone has lock, retry later\n if (currentSession.lock) {\n retryLater(operations, numberOfRetries)\n return\n }\n // acquire lock\n currentLock = UUID()\n currentSession.lock = currentLock\n setSession(currentSession, operations.options)\n // if lock is not acquired, retry later\n currentSession = retrieveSession()\n if (currentSession.lock !== currentLock) {\n retryLater(operations, numberOfRetries)\n return\n }\n }\n var processedSession = operations.process(currentSession)\n if (isCookieLockEnabled()) {\n // if lock corrupted after process, retry later\n currentSession = retrieveSession()\n if (currentSession.lock !== currentLock) {\n retryLater(operations, numberOfRetries)\n return\n }\n }\n if (processedSession) {\n persistSession(processedSession, operations.options)\n }\n if (isCookieLockEnabled()) {\n // correctly handle lock around expiration would require to handle this case properly at several levels\n // since we don't have evidence of lock issues around expiration, let's just not do the corruption check for it\n if (!(processedSession && isExpiredState(processedSession))) {\n // if lock corrupted after persist, retry later\n currentSession = retrieveSession()\n if (currentSession.lock !== currentLock) {\n retryLater(operations, numberOfRetries)\n return\n }\n delete currentSession.lock\n setSession(currentSession, operations.options)\n processedSession = currentSession\n }\n }\n // call after even if session is not persisted in order to perform operations on\n // up-to-date cookie value, the value could have been modified by another tab\n if (operations.after) {\n operations.after(processedSession || currentSession)\n }\n next()\n}\n\n/**\n * Cookie lock strategy allows mitigating issues due to concurrent access to cookie.\n * This issue concerns only chromium browsers and enabling this on firefox increase cookie write failures.\n */\nfunction isCookieLockEnabled() {\n return isChromium()\n}\n\nfunction retryLater(operations, currentNumberOfRetries) {\n setTimeout(function () {\n withCookieLockAccess(operations, currentNumberOfRetries + 1)\n }, LOCK_RETRY_DELAY)\n}\n\nfunction next() {\n ongoingOperations = undefined\n var nextOperations = bufferedOperations.shift()\n if (nextOperations) {\n withCookieLockAccess(nextOperations)\n }\n}\n\nexport function persistSession(session, options) {\n if (isExpiredState(session)) {\n clearSession(options)\n return\n }\n session.expire = String(dateNow() + SESSION_EXPIRATION_DELAY)\n setSession(session, options)\n}\n\nfunction setSession(session, options) {\n setCookie(\n SESSION_COOKIE_NAME,\n toSessionString(session),\n SESSION_EXPIRATION_DELAY,\n options\n )\n}\n\nexport function toSessionString(session) {\n return map(objectEntries(session), function (item) {\n return item[0] + '=' + item[1]\n }).join(SESSION_ENTRY_SEPARATOR)\n}\n\nexport function retrieveSession() {\n var sessionString = getCookie(SESSION_COOKIE_NAME)\n var session = {}\n if (isValidSessionString(sessionString)) {\n each(sessionString.split(SESSION_ENTRY_SEPARATOR), function (entry) {\n var matches = SESSION_ENTRY_REGEXP.exec(entry)\n if (matches !== null) {\n var key = matches[1]\n var value = matches[2]\n session[key] = value\n }\n })\n }\n return session\n}\n\nfunction isValidSessionString(sessionString) {\n return (\n sessionString !== undefined &&\n (sessionString.indexOf(SESSION_ENTRY_SEPARATOR) !== -1 ||\n SESSION_ENTRY_REGEXP.test(sessionString))\n )\n}\n\nfunction isExpiredState(session) {\n return isEmptyObject(session)\n}\nexport function clearSession(options) {\n setCookie(SESSION_COOKIE_NAME, '', 0, options)\n}\n"],"mappings":"AAAA,SAASA,SAAS,EAAEC,SAAS,QAAQ,mBAAmB;AACxD,SACEC,UAAU,EACVC,OAAO,EACPC,aAAa,EACbC,IAAI,EACJC,aAAa,EACbC,GAAG,EACHC,IAAI,QACC,iBAAiB;AACxB,SAASC,wBAAwB,QAAQ,oBAAoB;AAC7D,SAASC,UAAU,QAAQ,iBAAiB;AAC5C,IAAIC,oBAAoB,GAAG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AAC,CAAC;EACJ;EACA,OAAOd,OAAO;AAChB;AAEA,SAASQ,oBAAoBA,CAACD,aAAa,EAAE;EAC3C,OACEA,aAAa,KAAKV,SAAS,KAC1BU,aAAa,CAACQ,OAAO,CAAC3C,uBAAuB,CAAC,KAAK,CAAC,CAAC,IACpDD,oBAAoB,CAAC6C,IAAI,CAACT,aAAa,CAAC,CAAC;AAE/C;AAEA,SAASb,cAAcA,CAACM,OAAO,EAAE;EAC/B,OAAOpC,aAAa,CAACoC,OAAO,CAAC;AAC/B;AACA,OAAO,SAASC,YAAYA,CAACX,OAAO,EAAE;EACpC7B,SAAS,CAACY,mBAAmB,EAAE,EAAE,EAAE,CAAC,EAAEiB,OAAO,CAAC;AAChD"}
|
|
@@ -2,7 +2,7 @@ import { COOKIE_ACCESS_DELAY } from '../browser/cookie';
|
|
|
2
2
|
import { Observable } from '../helper/observable';
|
|
3
3
|
import { dateNow, UUID, throttle } from '../helper/tools';
|
|
4
4
|
import { SESSION_TIME_OUT_DELAY } from './sessionConstants';
|
|
5
|
-
import { retrieveSession, withCookieLockAccess } from './sessionCookieStore';
|
|
5
|
+
import { retrieveSession, withCookieLockAccess, clearSession } from './sessionCookieStore';
|
|
6
6
|
import { clearInterval, setInterval } from '../helper/timer';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -115,7 +115,7 @@ export function startSessionStore(options, productKey, computeSessionState) {
|
|
|
115
115
|
renewObservable: renewObservable,
|
|
116
116
|
expireObservable: expireObservable,
|
|
117
117
|
expire: function expire() {
|
|
118
|
-
|
|
118
|
+
clearSession(options);
|
|
119
119
|
synchronizeSession({});
|
|
120
120
|
},
|
|
121
121
|
stop: function stop() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessionStore.js","names":["COOKIE_ACCESS_DELAY","Observable","dateNow","UUID","throttle","SESSION_TIME_OUT_DELAY","retrieveSession","withCookieLockAccess","clearInterval","setInterval","startSessionStore","options","productKey","computeSessionState","renewObservable","expireObservable","watchSessionTimeoutId","watchSession","sessionCache","retrieveActiveSession","expandOrRenewSession","isTracked","process","cookieSession","synchronizedSession","synchronizeSession","expandOrRenewCookie","after","hasSessionInCache","renewSession","expandSession","undefined","isActiveSession","isSessionInCacheOutdated","expireSessionInCache","sessionState","trackingType","id","created","String","notify","session","Number","expire","throttled","getSession","
|
|
1
|
+
{"version":3,"file":"sessionStore.js","names":["COOKIE_ACCESS_DELAY","Observable","dateNow","UUID","throttle","SESSION_TIME_OUT_DELAY","retrieveSession","withCookieLockAccess","clearSession","clearInterval","setInterval","startSessionStore","options","productKey","computeSessionState","renewObservable","expireObservable","watchSessionTimeoutId","watchSession","sessionCache","retrieveActiveSession","expandOrRenewSession","isTracked","process","cookieSession","synchronizedSession","synchronizeSession","expandOrRenewCookie","after","hasSessionInCache","renewSession","expandSession","undefined","isActiveSession","isSessionInCacheOutdated","expireSessionInCache","sessionState","trackingType","id","created","String","notify","session","Number","expire","throttled","getSession","stop"],"sources":["../../src/session/sessionStore.js"],"sourcesContent":["import { COOKIE_ACCESS_DELAY } from '../browser/cookie'\nimport { Observable } from '../helper/observable'\nimport { dateNow, UUID, throttle } from '../helper/tools'\nimport { SESSION_TIME_OUT_DELAY } from './sessionConstants'\nimport {\n retrieveSession,\n withCookieLockAccess,\n clearSession\n} from './sessionCookieStore'\nimport { clearInterval, setInterval } from '../helper/timer'\n\n/**\n * Different session concepts:\n * - tracked, the session has an id and is updated along the user navigation\n * - not tracked, the session does not have an id but it is updated along the user navigation\n * - inactive, no session in store or session expired, waiting for a renew session\n */\nexport function startSessionStore(options, productKey, computeSessionState) {\n var renewObservable = new Observable()\n var expireObservable = new Observable()\n\n var watchSessionTimeoutId = setInterval(watchSession, COOKIE_ACCESS_DELAY)\n var sessionCache = retrieveActiveSession()\n\n function expandOrRenewSession() {\n var isTracked\n withCookieLockAccess({\n options: options,\n process: function (cookieSession) {\n var synchronizedSession = synchronizeSession(cookieSession)\n isTracked = expandOrRenewCookie(synchronizedSession)\n return synchronizedSession\n },\n after: function (cookieSession) {\n if (isTracked && !hasSessionInCache()) {\n renewSession(cookieSession)\n }\n sessionCache = cookieSession\n }\n })\n }\n\n function expandSession() {\n withCookieLockAccess({\n options: options,\n process: function (cookieSession) {\n return hasSessionInCache()\n ? synchronizeSession(cookieSession)\n : undefined\n }\n })\n }\n\n /**\n * allows two behaviors:\n * - if the session is active, synchronize the session cache without updating the session cookie\n * - if the session is not active, clear the session cookie and expire the session cache\n */\n function watchSession() {\n withCookieLockAccess({\n options: options,\n process: function (cookieSession) {\n return !isActiveSession(cookieSession) ? {} : undefined\n },\n after: synchronizeSession\n })\n }\n\n function synchronizeSession(cookieSession) {\n if (!isActiveSession(cookieSession)) {\n cookieSession = {}\n }\n if (hasSessionInCache()) {\n if (isSessionInCacheOutdated(cookieSession)) {\n expireSessionInCache()\n } else {\n sessionCache = cookieSession\n }\n }\n return cookieSession\n }\n\n function expandOrRenewCookie(cookieSession) {\n var sessionState = computeSessionState(cookieSession[productKey])\n var trackingType = sessionState.trackingType\n var isTracked = sessionState.isTracked\n cookieSession[productKey] = trackingType\n if (isTracked && !cookieSession.id) {\n cookieSession.id = UUID()\n cookieSession.created = String(dateNow())\n }\n return isTracked\n }\n\n function hasSessionInCache() {\n return sessionCache[productKey] !== undefined\n }\n\n function isSessionInCacheOutdated(cookieSession) {\n return (\n sessionCache.id !== cookieSession.id ||\n sessionCache[productKey] !== cookieSession[productKey]\n )\n }\n\n function expireSessionInCache() {\n sessionCache = {}\n expireObservable.notify()\n }\n\n function renewSession(cookieSession) {\n sessionCache = cookieSession\n renewObservable.notify()\n }\n\n function retrieveActiveSession() {\n var session = retrieveSession()\n if (isActiveSession(session)) {\n return session\n }\n return {}\n }\n\n function isActiveSession(session) {\n // created and expire can be undefined for versions which was not storing them\n // these checks could be removed when older versions will not be available/live anymore\n return (\n (session.created === undefined ||\n dateNow() - Number(session.created) < SESSION_TIME_OUT_DELAY) &&\n (session.expire === undefined || dateNow() < Number(session.expire))\n )\n }\n\n return {\n expandOrRenewSession: throttle(expandOrRenewSession, COOKIE_ACCESS_DELAY)\n .throttled,\n expandSession: expandSession,\n getSession: function () {\n return sessionCache\n },\n renewObservable: renewObservable,\n expireObservable: expireObservable,\n expire: function () {\n clearSession(options)\n synchronizeSession({})\n },\n stop: function () {\n clearInterval(watchSessionTimeoutId)\n }\n }\n}\n"],"mappings":"AAAA,SAASA,mBAAmB,QAAQ,mBAAmB;AACvD,SAASC,UAAU,QAAQ,sBAAsB;AACjD,SAASC,OAAO,EAAEC,IAAI,EAAEC,QAAQ,QAAQ,iBAAiB;AACzD,SAASC,sBAAsB,QAAQ,oBAAoB;AAC3D,SACEC,eAAe,EACfC,oBAAoB,EACpBC,YAAY,QACP,sBAAsB;AAC7B,SAASC,aAAa,EAAEC,WAAW,QAAQ,iBAAiB;;AAE5D;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,iBAAiBA,CAACC,OAAO,EAAEC,UAAU,EAAEC,mBAAmB,EAAE;EAC1E,IAAIC,eAAe,GAAG,IAAId,UAAU,CAAC,CAAC;EACtC,IAAIe,gBAAgB,GAAG,IAAIf,UAAU,CAAC,CAAC;EAEvC,IAAIgB,qBAAqB,GAAGP,WAAW,CAACQ,YAAY,EAAElB,mBAAmB,CAAC;EAC1E,IAAImB,YAAY,GAAGC,qBAAqB,CAAC,CAAC;EAE1C,SAASC,oBAAoBA,CAAA,EAAG;IAC9B,IAAIC,SAAS;IACbf,oBAAoB,CAAC;MACnBK,OAAO,EAAEA,OAAO;MAChBW,OAAO,EAAE,SAAAA,QAAUC,aAAa,EAAE;QAChC,IAAIC,mBAAmB,GAAGC,kBAAkB,CAACF,aAAa,CAAC;QAC3DF,SAAS,GAAGK,mBAAmB,CAACF,mBAAmB,CAAC;QACpD,OAAOA,mBAAmB;MAC5B,CAAC;MACDG,KAAK,EAAE,SAAAA,MAAUJ,aAAa,EAAE;QAC9B,IAAIF,SAAS,IAAI,CAACO,iBAAiB,CAAC,CAAC,EAAE;U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S;IACZd,aAAa,EAAEA,aAAa;IAC5Be,UAAU,EAAE,SAAAA,WAAA,EAAY;MACtB,OAAO3B,YAAY;IACrB,CAAC;IACDJ,eAAe,EAAEA,eAAe;IAChCC,gBAAgB,EAAEA,gBAAgB;IAClC4B,MAAM,EAAE,SAAAA,OAAA,EAAY;MAClBpC,YAAY,CAACI,OAAO,CAAC;MACrBc,kBAAkB,CAAC,CAAC,CAAC,CAAC;IACxB,CAAC;IACDqB,IAAI,EAAE,SAAAA,KAAA,EAAY;MAChBtC,aAAa,CAACQ,qBAAqB,CAAC;IACtC;EACF,CAAC;AACH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcare/browser-core",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.7",
|
|
4
4
|
"main": "cjs/index.js",
|
|
5
5
|
"module": "esm/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -20,5 +20,5 @@
|
|
|
20
20
|
"author": "dataflux",
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"description": "DataFlux RUM Web 端数据指标监控",
|
|
23
|
-
"gitHead": "
|
|
23
|
+
"gitHead": "4093a664f46522339538f008980660cdc772bd39"
|
|
24
24
|
}
|
|
@@ -164,6 +164,6 @@ function isValidSessionString(sessionString) {
|
|
|
164
164
|
function isExpiredState(session) {
|
|
165
165
|
return isEmptyObject(session)
|
|
166
166
|
}
|
|
167
|
-
function clearSession(options) {
|
|
167
|
+
export function clearSession(options) {
|
|
168
168
|
setCookie(SESSION_COOKIE_NAME, '', 0, options)
|
|
169
169
|
}
|
|
@@ -2,7 +2,11 @@ import { COOKIE_ACCESS_DELAY } from '../browser/cookie'
|
|
|
2
2
|
import { Observable } from '../helper/observable'
|
|
3
3
|
import { dateNow, UUID, throttle } from '../helper/tools'
|
|
4
4
|
import { SESSION_TIME_OUT_DELAY } from './sessionConstants'
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
retrieveSession,
|
|
7
|
+
withCookieLockAccess,
|
|
8
|
+
clearSession
|
|
9
|
+
} from './sessionCookieStore'
|
|
6
10
|
import { clearInterval, setInterval } from '../helper/timer'
|
|
7
11
|
|
|
8
12
|
/**
|
|
@@ -137,7 +141,7 @@ export function startSessionStore(options, productKey, computeSessionState) {
|
|
|
137
141
|
renewObservable: renewObservable,
|
|
138
142
|
expireObservable: expireObservable,
|
|
139
143
|
expire: function () {
|
|
140
|
-
|
|
144
|
+
clearSession(options)
|
|
141
145
|
synchronizeSession({})
|
|
142
146
|
},
|
|
143
147
|
stop: function () {
|