@cloudcare/browser-core 3.2.41 → 3.2.44
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/helper/boundedBuffer.js +1 -1
- package/cjs/helper/boundedBuffer.js.map +1 -1
- package/cjs/helper/display.js +2 -1
- package/cjs/helper/display.js.map +1 -1
- package/cjs/helper/enums.js +3 -1
- package/cjs/helper/enums.js.map +1 -1
- package/cjs/session/sessionStoreOperations.js.map +1 -1
- package/cjs/transport/eventBridge.js +9 -5
- package/cjs/transport/eventBridge.js.map +1 -1
- package/esm/helper/boundedBuffer.js +1 -1
- package/esm/helper/boundedBuffer.js.map +1 -1
- package/esm/helper/display.js +2 -1
- package/esm/helper/display.js.map +1 -1
- package/esm/helper/enums.js +3 -1
- package/esm/helper/enums.js.map +1 -1
- package/esm/session/sessionStoreOperations.js.map +1 -1
- package/esm/transport/eventBridge.js +9 -5
- package/esm/transport/eventBridge.js.map +1 -1
- package/package.json +2 -2
- package/src/helper/boundedBuffer.js +1 -1
- package/src/helper/display.js +2 -1
- package/src/helper/enums.js +3 -1
- package/src/session/sessionStoreOperations.js +1 -0
- package/src/transport/eventBridge.js +7 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boundedBuffer.js","names":["_tools","require","BUFFER_LIMIT","createBoundedBuffer","buffer","add","callback","length","push","splice","remove","removeItem","drain","arg","forEach"],"sources":["../../src/helper/boundedBuffer.js"],"sourcesContent":["import { removeItem } from './tools'\nvar BUFFER_LIMIT = 500\nexport function createBoundedBuffer() {\n var buffer = []\n\n var add = function (callback) {\n var length = buffer.push(callback)\n if (length > BUFFER_LIMIT) {\n buffer.splice(0, 1)\n }\n }\n\n var remove = function (callback) {\n removeItem(buffer, callback)\n }\n\n const drain = function (arg) {\n buffer.forEach(function (callback) {\n callback(arg)\n })\n buffer.length = 0\n }\n\n return {\n add: add,\n remove:
|
|
1
|
+
{"version":3,"file":"boundedBuffer.js","names":["_tools","require","BUFFER_LIMIT","createBoundedBuffer","buffer","add","callback","length","push","splice","remove","removeItem","drain","arg","forEach"],"sources":["../../src/helper/boundedBuffer.js"],"sourcesContent":["import { removeItem } from './tools'\nvar BUFFER_LIMIT = 500\nexport function createBoundedBuffer() {\n var buffer = []\n\n var add = function (callback) {\n var length = buffer.push(callback)\n if (length > BUFFER_LIMIT) {\n buffer.splice(0, 1)\n }\n }\n\n var remove = function (callback) {\n removeItem(buffer, callback)\n }\n\n const drain = function (arg) {\n buffer.forEach(function (callback) {\n callback(arg)\n })\n buffer.length = 0\n }\n\n return {\n add: add,\n remove: remove,\n drain: drain\n }\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAIC,YAAY,GAAG,GAAG;AACf,SAASC,mBAAmBA,CAAA,EAAG;EACpC,IAAIC,MAAM,GAAG,EAAE;EAEf,IAAIC,GAAG,GAAG,SAANA,GAAGA,CAAaC,QAAQ,EAAE;IAC5B,IAAIC,MAAM,GAAGH,MAAM,CAACI,IAAI,CAACF,QAAQ,CAAC;IAClC,IAAIC,MAAM,GAAGL,YAAY,EAAE;MACzBE,MAAM,CAACK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;IACrB;EACF,CAAC;EAED,IAAIC,MAAM,GAAG,SAATA,MAAMA,CAAaJ,QAAQ,EAAE;IAC/B,IAAAK,iBAAU,EAACP,MAAM,EAAEE,QAAQ,CAAC;EAC9B,CAAC;EAED,IAAMM,KAAK,GAAG,SAARA,KAAKA,CAAaC,GAAG,EAAE;IAC3BT,MAAM,CAACU,OAAO,CAAC,UAAUR,QAAQ,EAAE;MACjCA,QAAQ,CAACO,GAAG,CAAC;IACf,CAAC,CAAC;IACFT,MAAM,CAACG,MAAM,GAAG,CAAC;EACnB,CAAC;EAED,OAAO;IACLF,GAAG,EAAEA,GAAG;IACRK,MAAM,EAAEA,MAAM;IACdE,KAAK,EAAEA;EACT,CAAC;AACH","ignoreList":[]}
|
package/cjs/helper/display.js
CHANGED
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.originalConsoleMethods = exports.globalConsole = exports.display = exports.ConsoleApiName = void 0;
|
|
7
|
+
var _tools = require("./tools");
|
|
7
8
|
var ConsoleApiName = exports.ConsoleApiName = {
|
|
8
9
|
log: 'log',
|
|
9
10
|
debug: 'debug',
|
|
@@ -14,7 +15,7 @@ var ConsoleApiName = exports.ConsoleApiName = {
|
|
|
14
15
|
var globalConsole = exports.globalConsole = console;
|
|
15
16
|
var originalConsoleMethods = exports.originalConsoleMethods = {};
|
|
16
17
|
Object.keys(ConsoleApiName).forEach(function (name) {
|
|
17
|
-
originalConsoleMethods[name] = globalConsole[name];
|
|
18
|
+
originalConsoleMethods[name] = globalConsole[name] || _tools.noop;
|
|
18
19
|
});
|
|
19
20
|
var PREFIX = 'GUANCE Browser SDK:';
|
|
20
21
|
var display = exports.display = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"display.js","names":["ConsoleApiName","exports","log","debug","info","warn","error","globalConsole","console","originalConsoleMethods","Object","keys","forEach","name","PREFIX","display","bind"],"sources":["../../src/helper/display.js"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"display.js","names":["_tools","require","ConsoleApiName","exports","log","debug","info","warn","error","globalConsole","console","originalConsoleMethods","Object","keys","forEach","name","noop","PREFIX","display","bind"],"sources":["../../src/helper/display.js"],"sourcesContent":["import { noop } from './tools'\nexport var ConsoleApiName = {\n log: 'log',\n debug: 'debug',\n info: 'info',\n warn: 'warn',\n error: 'error'\n}\nexport var globalConsole = console\n\nexport var originalConsoleMethods = {}\nObject.keys(ConsoleApiName).forEach(function (name) {\n originalConsoleMethods[name] = globalConsole[name] || noop\n})\n\nvar PREFIX = 'GUANCE Browser SDK:'\n\nexport var display = {\n debug: originalConsoleMethods.debug.bind(globalConsole, PREFIX),\n log: originalConsoleMethods.log.bind(globalConsole, PREFIX),\n info: originalConsoleMethods.info.bind(globalConsole, PREFIX),\n warn: originalConsoleMethods.warn.bind(globalConsole, PREFIX),\n error: originalConsoleMethods.error.bind(globalConsole, PREFIX)\n}\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACO,IAAIC,cAAc,GAAAC,OAAA,CAAAD,cAAA,GAAG;EAC1BE,GAAG,EAAE,KAAK;EACVC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,MAAM;EACZC,IAAI,EAAE,MAAM;EACZC,KAAK,EAAE;AACT,CAAC;AACM,IAAIC,aAAa,GAAAN,OAAA,CAAAM,aAAA,GAAGC,OAAO;AAE3B,IAAIC,sBAAsB,GAAAR,OAAA,CAAAQ,sBAAA,GAAG,CAAC,CAAC;AACtCC,MAAM,CAACC,IAAI,CAACX,cAAc,CAAC,CAACY,OAAO,CAAC,UAAUC,IAAI,EAAE;EAClDJ,sBAAsB,CAACI,IAAI,CAAC,GAAGN,aAAa,CAACM,IAAI,CAAC,IAAIC,WAAI;AAC5D,CAAC,CAAC;AAEF,IAAIC,MAAM,GAAG,qBAAqB;AAE3B,IAAIC,OAAO,GAAAf,OAAA,CAAAe,OAAA,GAAG;EACnBb,KAAK,EAAEM,sBAAsB,CAACN,KAAK,CAACc,IAAI,CAACV,aAAa,EAAEQ,MAAM,CAAC;EAC/Db,GAAG,EAAEO,sBAAsB,CAACP,GAAG,CAACe,IAAI,CAACV,aAAa,EAAEQ,MAAM,CAAC;EAC3DX,IAAI,EAAEK,sBAAsB,CAACL,IAAI,CAACa,IAAI,CAACV,aAAa,EAAEQ,MAAM,CAAC;EAC7DV,IAAI,EAAEI,sBAAsB,CAACJ,IAAI,CAACY,IAAI,CAACV,aAAa,EAAEQ,MAAM,CAAC;EAC7DT,KAAK,EAAEG,sBAAsB,CAACH,KAAK,CAACW,IAAI,CAACV,aAAa,EAAEQ,MAAM;AAChE,CAAC","ignoreList":[]}
|
package/cjs/helper/enums.js
CHANGED
|
@@ -16,6 +16,7 @@ var DOM_EVENT = exports.DOM_EVENT = {
|
|
|
16
16
|
TOUCH_END: 'touchend',
|
|
17
17
|
TOUCH_MOVE: 'touchmove',
|
|
18
18
|
VISIBILITY_CHANGE: 'visibilitychange',
|
|
19
|
+
PRERENDERING_CHANGE: 'prerenderingchange',
|
|
19
20
|
PAGE_SHOW: 'pageshow',
|
|
20
21
|
FREEZE: 'freeze',
|
|
21
22
|
RESUME: 'resume',
|
|
@@ -50,7 +51,8 @@ var ResourceType = exports.ResourceType = {
|
|
|
50
51
|
IMAGE: 'image',
|
|
51
52
|
FONT: 'font',
|
|
52
53
|
MEDIA: 'media',
|
|
53
|
-
OTHER: 'other'
|
|
54
|
+
OTHER: 'other',
|
|
55
|
+
CUSTOM: 'custom'
|
|
54
56
|
};
|
|
55
57
|
var ActionType = exports.ActionType = {
|
|
56
58
|
CLICK: 'click',
|
package/cjs/helper/enums.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enums.js","names":["DOM_EVENT","exports","BEFORE_UNLOAD","CLICK","DBL_CLICK","KEY_DOWN","LOAD","POP_STATE","SCROLL","TOUCH_START","TOUCH_END","TOUCH_MOVE","VISIBILITY_CHANGE","PAGE_SHOW","FREEZE","RESUME","DOM_CONTENT_LOADED","POINTER_DOWN","POINTER_UP","POINTER_CANCEL","HASH_CHANGE","PAGE_HIDE","MOUSE_DOWN","MOUSE_UP","MOUSE_MOVE","FOCUS","BLUR","CONTEXT_MENU","RESIZE","CHANGE","INPUT","PLAY","PAUSE","SECURITY_POLICY_VIOLATION","SELECTION_CHANGE","STORAGE","ResourceType","DOCUMENT","XHR","BEACON","FETCH","CSS","JS","IMAGE","FONT","MEDIA","OTHER","
|
|
1
|
+
{"version":3,"file":"enums.js","names":["DOM_EVENT","exports","BEFORE_UNLOAD","CLICK","DBL_CLICK","KEY_DOWN","LOAD","POP_STATE","SCROLL","TOUCH_START","TOUCH_END","TOUCH_MOVE","VISIBILITY_CHANGE","PRERENDERING_CHANGE","PAGE_SHOW","FREEZE","RESUME","DOM_CONTENT_LOADED","POINTER_DOWN","POINTER_UP","POINTER_CANCEL","HASH_CHANGE","PAGE_HIDE","MOUSE_DOWN","MOUSE_UP","MOUSE_MOVE","FOCUS","BLUR","CONTEXT_MENU","RESIZE","CHANGE","INPUT","PLAY","PAUSE","SECURITY_POLICY_VIOLATION","SELECTION_CHANGE","STORAGE","ResourceType","DOCUMENT","XHR","BEACON","FETCH","CSS","JS","IMAGE","FONT","MEDIA","OTHER","CUSTOM","ActionType","FrustrationType","RAGE_CLICK","ERROR_CLICK","DEAD_CLICK","RumEventType","ACTION","ERROR","LONG_TASK","VIEW","RESOURCE","LOGGER","RumLongTaskEntryType","LONG_ANIMATION_FRAME","ViewLoadingType","INITIAL_LOAD","ROUTE_CHANGE","RequestType","TraceType","DDTRACE","ZIPKIN_MULTI_HEADER","ZIPKIN_SINGLE_HEADER","W3C_TRACEPARENT","W3C_TRACEPARENT_64","SKYWALKING_V3","JAEGER","ErrorHandling","HANDLED","UNHANDLED","NonErrorPrefix","UNCAUGHT","PROVIDED"],"sources":["../../src/helper/enums.js"],"sourcesContent":["export var DOM_EVENT = {\n BEFORE_UNLOAD: 'beforeunload',\n CLICK: 'click',\n DBL_CLICK: 'dblclick',\n KEY_DOWN: 'keydown',\n LOAD: 'load',\n POP_STATE: 'popstate',\n SCROLL: 'scroll',\n TOUCH_START: 'touchstart',\n TOUCH_END: 'touchend',\n TOUCH_MOVE: 'touchmove',\n VISIBILITY_CHANGE: 'visibilitychange',\n PRERENDERING_CHANGE: 'prerenderingchange',\n PAGE_SHOW: 'pageshow',\n FREEZE: 'freeze',\n RESUME: 'resume',\n DOM_CONTENT_LOADED: 'DOMContentLoaded',\n POINTER_DOWN: 'pointerdown',\n POINTER_UP: 'pointerup',\n POINTER_CANCEL: 'pointercancel',\n HASH_CHANGE: 'hashchange',\n PAGE_HIDE: 'pagehide',\n MOUSE_DOWN: 'mousedown',\n MOUSE_UP: 'mouseup',\n MOUSE_MOVE: 'mousemove',\n FOCUS: 'focus',\n BLUR: 'blur',\n CONTEXT_MENU: 'contextmenu',\n RESIZE: 'resize',\n CHANGE: 'change',\n INPUT: 'input',\n PLAY: 'play',\n PAUSE: 'pause',\n SECURITY_POLICY_VIOLATION: 'securitypolicyviolation',\n SELECTION_CHANGE: 'selectionchange',\n STORAGE: 'storage'\n}\nexport var ResourceType = {\n DOCUMENT: 'document',\n XHR: 'xhr',\n BEACON: 'beacon',\n FETCH: 'fetch',\n CSS: 'css',\n JS: 'js',\n IMAGE: 'image',\n FONT: 'font',\n MEDIA: 'media',\n OTHER: 'other',\n CUSTOM: 'custom'\n}\n\nexport var ActionType = {\n CLICK: 'click',\n CUSTOM: 'custom'\n}\nexport var FrustrationType = {\n RAGE_CLICK: 'rage_click',\n ERROR_CLICK: 'error_click',\n DEAD_CLICK: 'dead_click'\n}\nexport var RumEventType = {\n ACTION: 'action',\n ERROR: 'error',\n LONG_TASK: 'long_task',\n VIEW: 'view',\n RESOURCE: 'resource',\n LOGGER: 'logger'\n}\nexport var RumLongTaskEntryType = {\n LONG_TASK: 'long-task',\n LONG_ANIMATION_FRAME: 'long-animation-frame'\n}\nexport var ViewLoadingType = {\n INITIAL_LOAD: 'initial_load',\n ROUTE_CHANGE: 'route_change'\n}\nexport var RequestType = {\n FETCH: ResourceType.FETCH,\n XHR: ResourceType.XHR\n}\n\nexport var TraceType = {\n DDTRACE: 'ddtrace',\n ZIPKIN_MULTI_HEADER: 'zipkin',\n ZIPKIN_SINGLE_HEADER: 'zipkin_single_header',\n W3C_TRACEPARENT: 'w3c_traceparent',\n W3C_TRACEPARENT_64: 'w3c_traceparent_64bit',\n SKYWALKING_V3: 'skywalking_v3',\n JAEGER: 'jaeger'\n}\nexport var ErrorHandling = {\n HANDLED: 'handled',\n UNHANDLED: 'unhandled'\n}\nexport var NonErrorPrefix = {\n UNCAUGHT: 'Uncaught',\n PROVIDED: 'Provided'\n}\n"],"mappings":";;;;;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AAS,EAAE;AACb,CAAC;AACM,IAAIC,cAAc,GAAA7E,OAAA,CAAA6E,cAAA,GAAG;EAC1BC,QAAQ,EAAE,UAAU;EACpBC,QAAQ,EAAE;AACZ,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessionStoreOperations.js","names":["_timer","require","_tools","_sessionState","_telemetry","_excluded","_slicedToArray","r","e","_arrayWithHoles","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","TypeError","a","_arrayLikeToArray","t","toString","call","slice","constructor","name","Array","from","test","length","n","l","Symbol","iterator","i","u","f","o","next","Object","done","push","value","isArray","_objectWithoutProperties","_objectWithoutPropertiesLoose","getOwnPropertySymbols","indexOf","propertyIsEnumerable","hasOwnProperty","LOCK_RETRY_DELAY","exports","LOCK_MAX_TRIES","LOCK_EXPIRATION_DELAY","ONE_SECOND","LOCK_SEPARATOR","bufferedOperations","ongoingOperations","processSessionStoreOperations","operations","sessionStoreStrategy","numberOfRetries","arguments","undefined","isLockEnabled","persistSession","expireSession","persistWithLock","session","assign","lock","currentLock","retrieveStore","_sessionStoreStrategy","retrieveSession","isLockExpired","addTelemetryDebug","currentStore","retryLater","createLock","processedSession","process","isSessionInExpiredState","expandSessionState","after","sessionStore","currentNumberOfRetries","setTimeout","nextOperations","shift","UUID","timeStampNow","_lock$split","split","_lock$split2","timeStamp","elapsed","Number"],"sources":["../../src/session/sessionStoreOperations.js"],"sourcesContent":["import { setTimeout } from '../helper/timer'\nimport {\n UUID,\n assign,\n ONE_SECOND,\n timeStampNow,\n elapsed\n} from '../helper/tools'\nimport { expandSessionState, isSessionInExpiredState } from './sessionState'\nimport { addTelemetryDebug } from '../telemetry/telemetry'\nexport const LOCK_RETRY_DELAY = 10\nexport const LOCK_MAX_TRIES = 100\n\n// Locks should be hold for a few milliseconds top, just the time it takes to read and write a\n// cookie. Using one second should be enough in most situations.\nexport const LOCK_EXPIRATION_DELAY = ONE_SECOND\nconst LOCK_SEPARATOR = '--'\nconst bufferedOperations = []\nlet ongoingOperations\n\nexport function processSessionStoreOperations(\n operations,\n sessionStoreStrategy,\n numberOfRetries = 0\n) {\n const { isLockEnabled, persistSession, expireSession } = sessionStoreStrategy\n const persistWithLock = function (session) {\n return persistSession(assign({}, session, { lock: currentLock }))\n }\n const retrieveStore = function () {\n const { lock, ...session } = sessionStoreStrategy.retrieveSession()\n\n return {\n session,\n lock: lock && !isLockExpired(lock) ? lock : undefined\n }\n }\n\n if (!ongoingOperations) {\n ongoingOperations = operations\n }\n if (operations !== ongoingOperations) {\n bufferedOperations.push(operations)\n return\n }\n if (isLockEnabled && numberOfRetries >= LOCK_MAX_TRIES) {\n addTelemetryDebug('Aborted session operation after max lock retries', {\n currentStore: retrieveStore()\n })\n next(sessionStoreStrategy)\n return\n }\n let currentLock\n let currentStore = retrieveStore()\n if (isLockEnabled) {\n // if someone has lock, retry later\n if (currentStore.lock) {\n retryLater(operations, sessionStoreStrategy, numberOfRetries)\n return\n }\n // acquire lock\n currentLock = createLock()\n persistWithLock(currentStore.session)\n // if lock is not acquired, retry later\n currentStore = retrieveStore()\n if (currentStore.lock !== currentLock) {\n retryLater(operations, sessionStoreStrategy, numberOfRetries)\n return\n }\n }\n let processedSession = operations.process(currentStore.session)\n if (isLockEnabled) {\n // if lock corrupted after process, retry later\n currentStore = retrieveStore()\n if (currentStore.lock !== currentLock) {\n retryLater(operations, sessionStoreStrategy, numberOfRetries)\n return\n }\n }\n if (processedSession) {\n if (isSessionInExpiredState(processedSession)) {\n expireSession()\n } else {\n expandSessionState(processedSession)\n isLockEnabled\n ? persistWithLock(processedSession)\n : persistSession(processedSession)\n }\n }\n if (isLockEnabled) {\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 && isSessionInExpiredState(processedSession))) {\n // if lock corrupted after persist, retry later\n currentStore = retrieveStore()\n if (currentStore.lock !== currentLock) {\n retryLater(operations, sessionStoreStrategy, numberOfRetries)\n return\n }\n persistSession(currentStore.session)\n processedSession = currentStore.session\n }\n }\n // call after even if session is not persisted in order to perform operations on\n // up-to-date session state value => the value could have been modified by another tab\n if (operations.after) {\n operations.after(processedSession || currentStore.session)\n }\n next(sessionStoreStrategy)\n}\n\nfunction retryLater(operations, sessionStore, currentNumberOfRetries) {\n setTimeout(function () {\n processSessionStoreOperations(\n operations,\n sessionStore,\n currentNumberOfRetries + 1\n )\n }, LOCK_RETRY_DELAY)\n}\n\nfunction next(sessionStore) {\n ongoingOperations = undefined\n const nextOperations = bufferedOperations.shift()\n if (nextOperations) {\n processSessionStoreOperations(nextOperations, sessionStore)\n }\n}\n\nexport function createLock() {\n return UUID() + LOCK_SEPARATOR + timeStampNow()\n}\n\nfunction isLockExpired(lock) {\n const [, timeStamp] = lock.split(LOCK_SEPARATOR)\n return (\n !timeStamp ||\n elapsed(Number(timeStamp), timeStampNow()) > LOCK_EXPIRATION_DELAY\n )\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAOA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAA0D,IAAAI,SAAA;AAAA,SAAAC,eAAAC,CAAA,EAAAC,CAAA,WAAAC,eAAA,CAAAF,CAAA,KAAAG,qBAAA,CAAAH,CAAA,EAAAC,CAAA,KAAAG,2BAAA,CAAAJ,CAAA,EAAAC,CAAA,KAAAI,gBAAA;AAAA,SAAAA,iBAAA,cAAAC,SAAA;AAAA,SAAAF,4BAAAJ,CAAA,EAAAO,CAAA,QAAAP,CAAA,2BAAAA,CAAA,SAAAQ,iBAAA,CAAAR,CAAA,EAAAO,CAAA,OAAAE,CAAA,MAAAC,QAAA,CAAAC,IAAA,CAAAX,CAAA,EAAAY,KAAA,6BAAAH,CAAA,IAAAT,CAAA,CAAAa,WAAA,KAAAJ,CAAA,GAAAT,CAAA,CAAAa,WAAA,CAA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,CAACT,OAAO,CAAC;MACpCY,gBAAgB,GAAGH,YAAY,CAACT,OAAO;IACzC;EACF;EACA;EACA;EACA,IAAIT,UAAU,CAACyB,KAAK,EAAE;IACpBzB,UAAU,CAACyB,KAAK,CAACJ,gBAAgB,IAAIH,YAAY,CAACT,OAAO,CAAC;EAC5D;EACA9B,IAAI,CAACsB,oBAAoB,CAAC;AAC5B;AAEA,SAASkB,UAAUA,CAACnB,UAAU,EAAE0B,YAAY,EAAEC,sBAAsB,EAAE;EACpE,IAAAC,iBAAU,EAAC,YAAY;IACrB7B,6BAA6B,CAC3BC,UAAU,EACV0B,YAAY,EACZC,sBAAsB,GAAG,CAC3B,CAAC;EACH,CAAC,EAAEpC,gBAAgB,CAAC;AACtB;AAEA,SAASZ,IAAIA,CAAC+C,YAAY,EAAE;EAC1B5B,iBAAiB,GAAGM,SAAS;EAC7B,IAAMyB,cAAc,GAAGhC,kBAAkB,CAACiC,KAAK,CAAC,CAAC;EACjD,IAAID,cAAc,EAAE;IAClB9B,6BAA6B,CAAC8B,cAAc,EAAEH,YAAY,CAAC;EAC7D;AACF;AAEO,SAASN,UAAUA,CAAA,EAAG;EAC3B,OAAO,IAAAW,WAAI,EAAC,CAAC,GAAGnC,cAAc,GAAG,IAAAoC,mBAAY,EAAC,CAAC;AACjD;AAEA,SAAShB,aAAaA,CAACL,IAAI,EAAE;EAC3B,IAAAsB,WAAA,GAAsBtB,IAAI,CAACuB,KAAK,CAACtC,cAAc,CAAC;IAAAuC,YAAA,GAAApF,cAAA,CAAAkF,WAAA;IAAvCG,SAAS,GAAAD,YAAA;EAClB,OACE,CAACC,SAAS,IACV,IAAAC,cAAO,EAACC,MAAM,CAACF,SAAS,CAAC,EAAE,IAAAJ,mBAAY,EAAC,CAAC,CAAC,GAAGtC,qBAAqB;AAEtE","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"sessionStoreOperations.js","names":["_timer","require","_tools","_sessionState","_telemetry","_excluded","_slicedToArray","r","e","_arrayWithHoles","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","TypeError","a","_arrayLikeToArray","t","toString","call","slice","constructor","name","Array","from","test","length","n","l","Symbol","iterator","i","u","f","o","next","Object","done","push","value","isArray","_objectWithoutProperties","_objectWithoutPropertiesLoose","getOwnPropertySymbols","indexOf","propertyIsEnumerable","hasOwnProperty","LOCK_RETRY_DELAY","exports","LOCK_MAX_TRIES","LOCK_EXPIRATION_DELAY","ONE_SECOND","LOCK_SEPARATOR","bufferedOperations","ongoingOperations","processSessionStoreOperations","operations","sessionStoreStrategy","numberOfRetries","arguments","undefined","isLockEnabled","persistSession","expireSession","persistWithLock","session","assign","lock","currentLock","retrieveStore","_sessionStoreStrategy","retrieveSession","isLockExpired","addTelemetryDebug","currentStore","retryLater","createLock","processedSession","process","isSessionInExpiredState","expandSessionState","after","sessionStore","currentNumberOfRetries","setTimeout","nextOperations","shift","UUID","timeStampNow","_lock$split","split","_lock$split2","timeStamp","elapsed","Number"],"sources":["../../src/session/sessionStoreOperations.js"],"sourcesContent":["import { setTimeout } from '../helper/timer'\nimport {\n UUID,\n assign,\n ONE_SECOND,\n timeStampNow,\n elapsed\n} from '../helper/tools'\nimport { expandSessionState, isSessionInExpiredState } from './sessionState'\nimport { addTelemetryDebug } from '../telemetry/telemetry'\nexport const LOCK_RETRY_DELAY = 10\nexport const LOCK_MAX_TRIES = 100\n\n// Locks should be hold for a few milliseconds top, just the time it takes to read and write a\n// cookie. Using one second should be enough in most situations.\nexport const LOCK_EXPIRATION_DELAY = ONE_SECOND\nconst LOCK_SEPARATOR = '--'\nconst bufferedOperations = []\nlet ongoingOperations\n\nexport function processSessionStoreOperations(\n operations,\n sessionStoreStrategy,\n numberOfRetries = 0\n) {\n const { isLockEnabled, persistSession, expireSession } = sessionStoreStrategy\n const persistWithLock = function (session) {\n return persistSession(assign({}, session, { lock: currentLock }))\n }\n const retrieveStore = function () {\n const { lock, ...session } = sessionStoreStrategy.retrieveSession()\n\n return {\n session,\n lock: lock && !isLockExpired(lock) ? lock : undefined\n }\n }\n\n if (!ongoingOperations) {\n ongoingOperations = operations\n }\n if (operations !== ongoingOperations) {\n bufferedOperations.push(operations)\n return\n }\n if (isLockEnabled && numberOfRetries >= LOCK_MAX_TRIES) {\n addTelemetryDebug('Aborted session operation after max lock retries', {\n currentStore: retrieveStore()\n })\n next(sessionStoreStrategy)\n return\n }\n let currentLock\n let currentStore = retrieveStore()\n if (isLockEnabled) {\n // if someone has lock, retry later\n if (currentStore.lock) {\n retryLater(operations, sessionStoreStrategy, numberOfRetries)\n return\n }\n // acquire lock\n currentLock = createLock()\n persistWithLock(currentStore.session)\n // if lock is not acquired, retry later\n currentStore = retrieveStore()\n if (currentStore.lock !== currentLock) {\n retryLater(operations, sessionStoreStrategy, numberOfRetries)\n return\n }\n }\n let processedSession = operations.process(currentStore.session)\n if (isLockEnabled) {\n // if lock corrupted after process, retry later\n currentStore = retrieveStore()\n if (currentStore.lock !== currentLock) {\n retryLater(operations, sessionStoreStrategy, numberOfRetries)\n return\n }\n }\n\n if (processedSession) {\n if (isSessionInExpiredState(processedSession)) {\n expireSession()\n } else {\n expandSessionState(processedSession)\n isLockEnabled\n ? persistWithLock(processedSession)\n : persistSession(processedSession)\n }\n }\n if (isLockEnabled) {\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 && isSessionInExpiredState(processedSession))) {\n // if lock corrupted after persist, retry later\n currentStore = retrieveStore()\n if (currentStore.lock !== currentLock) {\n retryLater(operations, sessionStoreStrategy, numberOfRetries)\n return\n }\n persistSession(currentStore.session)\n processedSession = currentStore.session\n }\n }\n // call after even if session is not persisted in order to perform operations on\n // up-to-date session state value => the value could have been modified by another tab\n if (operations.after) {\n operations.after(processedSession || currentStore.session)\n }\n next(sessionStoreStrategy)\n}\n\nfunction retryLater(operations, sessionStore, currentNumberOfRetries) {\n setTimeout(function () {\n processSessionStoreOperations(\n operations,\n sessionStore,\n currentNumberOfRetries + 1\n )\n }, LOCK_RETRY_DELAY)\n}\n\nfunction next(sessionStore) {\n ongoingOperations = undefined\n const nextOperations = bufferedOperations.shift()\n if (nextOperations) {\n processSessionStoreOperations(nextOperations, sessionStore)\n }\n}\n\nexport function createLock() {\n return UUID() + LOCK_SEPARATOR + timeStampNow()\n}\n\nfunction isLockExpired(lock) {\n const [, timeStamp] = lock.split(LOCK_SEPARATOR)\n return (\n !timeStamp ||\n elapsed(Number(timeStamp), timeStampNow()) > LOCK_EXPIRATION_DELAY\n )\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,MAAA,GAAAD,OAAA;AAOA,IAAAE,aAAA,GAAAF,OAAA;AACA,IAAAG,UAAA,GAAAH,OAAA;AAA0D,IAAAI,SAAA;AAAA,SAAAC,eAAAC,CAAA,EAAAC,CAAA,WAAAC,eAAA,CAAAF,CAAA,KAAAG,qBAAA,CAAAH,CAAA,EAAAC,CAAA,KAAAG,2BAAA,CAAAJ,CAAA,EAAAC,CAAA,KAAAI,gBAAA;AAAA,SAAAA,iBAAA,cAAAC,SAAA;AAAA,SAAAF,4BAAAJ,CAAA,EAAAO,CAAA,QAAAP,CAAA,2BAAAA,CAAA,SAAAQ,iBAAA,CAAAR,CAAA,EAAAO,CAAA,OAAAE,CAAA,MAAAC,QAAA,CAAAC,IAAA,CAAAX,CAAA,EAAAY,KAAA,6BAAAH,CAAA,IAAAT,CAAA,CAAAa,WAAA,KAAAJ,CAAA,GAAAT,CAAA,CAAAa,WAAA,CAAAC,IAAA,aAAAL,CAAA,cAAAA,CAAA,GAAAM,KAAA,CAAAC,IAAA,CAAAhB,CAAA,oBAAAS,CAAA,+CAAAQ,IAAA,CAAAR,CAAA,IAAAD,iBAAA,CAAAR,CAAA,EAAAO,CAAA;AAAA,SAAAC,kBAAAR,CAAA,EAAAO,CAAA,aAAAA,CAAA,IAAAA,CAAA,GAAAP,CAAA,CAAAkB,MAAA,MAAAX,C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AACnB,UAAU,EAAE0B,YAAY,EAAEC,sBAAsB,EAAE;EACpE,IAAAC,iBAAU,EAAC,YAAY;IACrB7B,6BAA6B,CAC3BC,UAAU,EACV0B,YAAY,EACZC,sBAAsB,GAAG,CAC3B,CAAC;EACH,CAAC,EAAEpC,gBAAgB,CAAC;AACtB;AAEA,SAASZ,IAAIA,CAAC+C,YAAY,EAAE;EAC1B5B,iBAAiB,GAAGM,SAAS;EAC7B,IAAMyB,cAAc,GAAGhC,kBAAkB,CAACiC,KAAK,CAAC,CAAC;EACjD,IAAID,cAAc,EAAE;IAClB9B,6BAA6B,CAAC8B,cAAc,EAAEH,YAAY,CAAC;EAC7D;AACF;AAEO,SAASN,UAAUA,CAAA,EAAG;EAC3B,OAAO,IAAAW,WAAI,EAAC,CAAC,GAAGnC,cAAc,GAAG,IAAAoC,mBAAY,EAAC,CAAC;AACjD;AAEA,SAAShB,aAAaA,CAACL,IAAI,EAAE;EAC3B,IAAAsB,WAAA,GAAsBtB,IAAI,CAACuB,KAAK,CAACtC,cAAc,CAAC;IAAAuC,YAAA,GAAApF,cAAA,CAAAkF,WAAA;IAAvCG,SAAS,GAAAD,YAAA;EAClB,OACE,CAACC,SAAS,IACV,IAAAC,cAAO,EAACC,MAAM,CAACF,SAAS,CAAC,EAAE,IAAAJ,mBAAY,EAAC,CAAC,CAAC,GAAGtC,qBAAqB;AAEtE","ignoreList":[]}
|
|
@@ -30,11 +30,15 @@ function getEventBridge() {
|
|
|
30
30
|
var view = viewId ? {
|
|
31
31
|
id: viewId
|
|
32
32
|
} : undefined;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
33
|
+
try {
|
|
34
|
+
eventBridgeGlobal.sendEvent(JSON.stringify({
|
|
35
|
+
name: eventType,
|
|
36
|
+
data: event,
|
|
37
|
+
view: view
|
|
38
|
+
}));
|
|
39
|
+
} catch (e) {
|
|
40
|
+
// unload postmessage error
|
|
41
|
+
}
|
|
38
42
|
}
|
|
39
43
|
};
|
|
40
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eventBridge.js","names":["_init","require","getEventBridgeGlobal","getGlobalObject","FTWebViewJavascriptBridge","getEventBridge","eventBridgeGlobal","getCapabilities","JSON","parse","getPrivacyLevel","getAllowedWebViewHosts","send","eventType","event","viewId","view","id","undefined","sendEvent","stringify","name","data","BridgeCapability","exports","RECORDS","bridgeSupports","capability","bridge","includes","canUseEventBridge","_getGlobalObject$loca","currentHost","arguments","length","location","hostname","some","allowedHost","endsWith","concat"],"sources":["../../src/transport/eventBridge.js"],"sourcesContent":["import { getGlobalObject } from '../init'\n\nfunction getEventBridgeGlobal() {\n return getGlobalObject().FTWebViewJavascriptBridge\n}\nexport function getEventBridge() {\n var eventBridgeGlobal = getEventBridgeGlobal()\n\n if (!eventBridgeGlobal) {\n return\n }\n\n return {\n getCapabilities() {\n return JSON.parse(\n (eventBridgeGlobal.getCapabilities &&\n eventBridgeGlobal.getCapabilities()) ||\n '[]'\n )\n },\n getPrivacyLevel() {\n return (\n eventBridgeGlobal.getPrivacyLevel && eventBridgeGlobal.getPrivacyLevel()\n )\n },\n getAllowedWebViewHosts() {\n return JSON.parse(\n (eventBridgeGlobal.getAllowedWebViewHosts &&\n eventBridgeGlobal.getAllowedWebViewHosts()) ||\n '[]'\n )\n },\n send(eventType, event, viewId) {\n const view = viewId ? { id: viewId } : undefined\n eventBridgeGlobal.sendEvent(\n
|
|
1
|
+
{"version":3,"file":"eventBridge.js","names":["_init","require","getEventBridgeGlobal","getGlobalObject","FTWebViewJavascriptBridge","getEventBridge","eventBridgeGlobal","getCapabilities","JSON","parse","getPrivacyLevel","getAllowedWebViewHosts","send","eventType","event","viewId","view","id","undefined","sendEvent","stringify","name","data","e","BridgeCapability","exports","RECORDS","bridgeSupports","capability","bridge","includes","canUseEventBridge","_getGlobalObject$loca","currentHost","arguments","length","location","hostname","some","allowedHost","endsWith","concat"],"sources":["../../src/transport/eventBridge.js"],"sourcesContent":["import { getGlobalObject } from '../init'\n\nfunction getEventBridgeGlobal() {\n return getGlobalObject().FTWebViewJavascriptBridge\n}\nexport function getEventBridge() {\n var eventBridgeGlobal = getEventBridgeGlobal()\n\n if (!eventBridgeGlobal) {\n return\n }\n\n return {\n getCapabilities() {\n return JSON.parse(\n (eventBridgeGlobal.getCapabilities &&\n eventBridgeGlobal.getCapabilities()) ||\n '[]'\n )\n },\n getPrivacyLevel() {\n return (\n eventBridgeGlobal.getPrivacyLevel && eventBridgeGlobal.getPrivacyLevel()\n )\n },\n getAllowedWebViewHosts() {\n return JSON.parse(\n (eventBridgeGlobal.getAllowedWebViewHosts &&\n eventBridgeGlobal.getAllowedWebViewHosts()) ||\n '[]'\n )\n },\n send(eventType, event, viewId) {\n const view = viewId ? { id: viewId } : undefined\n try {\n eventBridgeGlobal.sendEvent(\n JSON.stringify({ name: eventType, data: event, view })\n )\n } catch (e) {\n // unload postmessage error\n }\n }\n }\n}\nexport const BridgeCapability = {\n RECORDS: 'records'\n}\nexport function bridgeSupports(capability) {\n const bridge = getEventBridge()\n\n return !!bridge && bridge.getCapabilities().includes(capability)\n}\nexport function canUseEventBridge(\n currentHost = getGlobalObject().location?.hostname\n) {\n const eventBridgeGlobal = getEventBridgeGlobal()\n if (\n eventBridgeGlobal &&\n eventBridgeGlobal.getAllowedWebViewHosts === undefined\n ) {\n return true\n }\n if (\n eventBridgeGlobal &&\n eventBridgeGlobal.getAllowedWebViewHosts &&\n (eventBridgeGlobal.getAllowedWebViewHosts() === null ||\n eventBridgeGlobal.getAllowedWebViewHosts() === undefined)\n ) {\n return true\n }\n var bridge = getEventBridge()\n return (\n !!bridge &&\n bridge\n .getAllowedWebViewHosts()\n .some(\n (allowedHost) =>\n currentHost === allowedHost || currentHost.endsWith(`.${allowedHost}`)\n )\n )\n}\n"],"mappings":";;;;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AAEA,SAASC,oBAAoBA,CAAA,EAAG;EAC9B,OAA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,CAACwB,MAAM,IAAIA,MAAM,CAACtB,eAAe,CAAC,CAAC,CAACuB,QAAQ,CAACF,UAAU,CAAC;AAClE;AACO,SAASG,iBAAiBA,CAAA,EAE/B;EAAA,IAAAC,qBAAA;EAAA,IADAC,WAAW,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAhB,SAAA,GAAAgB,SAAA,OAAAF,qBAAA,GAAG,IAAA7B,qBAAe,EAAC,CAAC,CAACiC,QAAQ,cAAAJ,qBAAA,uBAA1BA,qBAAA,CAA4BK,QAAQ;EAElD,IAAM/B,iBAAiB,GAAGJ,oBAAoB,CAAC,CAAC;EAChD,IACEI,iBAAiB,IACjBA,iBAAiB,CAACK,sBAAsB,KAAKO,SAAS,EACtD;IACA,OAAO,IAAI;EACb;EACA,IACEZ,iBAAiB,IACjBA,iBAAiB,CAACK,sBAAsB,KACvCL,iBAAiB,CAACK,sBAAsB,CAAC,CAAC,KAAK,IAAI,IAClDL,iBAAiB,CAACK,sBAAsB,CAAC,CAAC,KAAKO,SAAS,CAAC,EAC3D;IACA,OAAO,IAAI;EACb;EACA,IAAIW,MAAM,GAAGxB,cAAc,CAAC,CAAC;EAC7B,OACE,CAAC,CAACwB,MAAM,IACRA,MAAM,CACHlB,sBAAsB,CAAC,CAAC,CACxB2B,IAAI,CACH,UAACC,WAAW;IAAA,OACVN,WAAW,KAAKM,WAAW,IAAIN,WAAW,CAACO,QAAQ,KAAAC,MAAA,CAAKF,WAAW,CAAE,CAAC;EAAA,CAC1E,CAAC;AAEP","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boundedBuffer.js","names":["removeItem","BUFFER_LIMIT","createBoundedBuffer","buffer","add","callback","length","push","splice","remove","drain","arg","forEach"],"sources":["../../src/helper/boundedBuffer.js"],"sourcesContent":["import { removeItem } from './tools'\nvar BUFFER_LIMIT = 500\nexport function createBoundedBuffer() {\n var buffer = []\n\n var add = function (callback) {\n var length = buffer.push(callback)\n if (length > BUFFER_LIMIT) {\n buffer.splice(0, 1)\n }\n }\n\n var remove = function (callback) {\n removeItem(buffer, callback)\n }\n\n const drain = function (arg) {\n buffer.forEach(function (callback) {\n callback(arg)\n })\n buffer.length = 0\n }\n\n return {\n add: add,\n remove:
|
|
1
|
+
{"version":3,"file":"boundedBuffer.js","names":["removeItem","BUFFER_LIMIT","createBoundedBuffer","buffer","add","callback","length","push","splice","remove","drain","arg","forEach"],"sources":["../../src/helper/boundedBuffer.js"],"sourcesContent":["import { removeItem } from './tools'\nvar BUFFER_LIMIT = 500\nexport function createBoundedBuffer() {\n var buffer = []\n\n var add = function (callback) {\n var length = buffer.push(callback)\n if (length > BUFFER_LIMIT) {\n buffer.splice(0, 1)\n }\n }\n\n var remove = function (callback) {\n removeItem(buffer, callback)\n }\n\n const drain = function (arg) {\n buffer.forEach(function (callback) {\n callback(arg)\n })\n buffer.length = 0\n }\n\n return {\n add: add,\n remove: remove,\n drain: drain\n }\n}\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,SAAS;AACpC,IAAIC,YAAY,GAAG,GAAG;AACtB,OAAO,SAASC,mBAAmBA,CAAA,EAAG;EACpC,IAAIC,MAAM,GAAG,EAAE;EAEf,IAAIC,GAAG,GAAG,SAANA,GAAGA,CAAaC,QAAQ,EAAE;IAC5B,IAAIC,MAAM,GAAGH,MAAM,CAACI,IAAI,CAACF,QAAQ,CAAC;IAClC,IAAIC,MAAM,GAAGL,YAAY,EAAE;MACzBE,MAAM,CAACK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC;IACrB;EACF,CAAC;EAED,IAAIC,MAAM,GAAG,SAATA,MAAMA,CAAaJ,QAAQ,EAAE;IAC/BL,UAAU,CAACG,MAAM,EAAEE,QAAQ,CAAC;EAC9B,CAAC;EAED,IAAMK,KAAK,GAAG,SAARA,KAAKA,CAAaC,GAAG,EAAE;IAC3BR,MAAM,CAACS,OAAO,CAAC,UAAUP,QAAQ,EAAE;MACjCA,QAAQ,CAACM,GAAG,CAAC;IACf,CAAC,CAAC;IACFR,MAAM,CAACG,MAAM,GAAG,CAAC;EACnB,CAAC;EAED,OAAO;IACLF,GAAG,EAAEA,GAAG;IACRK,MAAM,EAAEA,MAAM;IACdC,KAAK,EAAEA;EACT,CAAC;AACH","ignoreList":[]}
|
package/esm/helper/display.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { noop } from './tools';
|
|
1
2
|
export var ConsoleApiName = {
|
|
2
3
|
log: 'log',
|
|
3
4
|
debug: 'debug',
|
|
@@ -8,7 +9,7 @@ export var ConsoleApiName = {
|
|
|
8
9
|
export var globalConsole = console;
|
|
9
10
|
export var originalConsoleMethods = {};
|
|
10
11
|
Object.keys(ConsoleApiName).forEach(function (name) {
|
|
11
|
-
originalConsoleMethods[name] = globalConsole[name];
|
|
12
|
+
originalConsoleMethods[name] = globalConsole[name] || noop;
|
|
12
13
|
});
|
|
13
14
|
var PREFIX = 'GUANCE Browser SDK:';
|
|
14
15
|
export var display = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"display.js","names":["ConsoleApiName","log","debug","info","warn","error","globalConsole","console","originalConsoleMethods","Object","keys","forEach","name","PREFIX","display","bind"],"sources":["../../src/helper/display.js"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"display.js","names":["noop","ConsoleApiName","log","debug","info","warn","error","globalConsole","console","originalConsoleMethods","Object","keys","forEach","name","PREFIX","display","bind"],"sources":["../../src/helper/display.js"],"sourcesContent":["import { noop } from './tools'\nexport var ConsoleApiName = {\n log: 'log',\n debug: 'debug',\n info: 'info',\n warn: 'warn',\n error: 'error'\n}\nexport var globalConsole = console\n\nexport var originalConsoleMethods = {}\nObject.keys(ConsoleApiName).forEach(function (name) {\n originalConsoleMethods[name] = globalConsole[name] || noop\n})\n\nvar PREFIX = 'GUANCE Browser SDK:'\n\nexport var display = {\n debug: originalConsoleMethods.debug.bind(globalConsole, PREFIX),\n log: originalConsoleMethods.log.bind(globalConsole, PREFIX),\n info: originalConsoleMethods.info.bind(globalConsole, PREFIX),\n warn: originalConsoleMethods.warn.bind(globalConsole, PREFIX),\n error: originalConsoleMethods.error.bind(globalConsole, PREFIX)\n}\n"],"mappings":"AAAA,SAASA,IAAI,QAAQ,SAAS;AAC9B,OAAO,IAAIC,cAAc,GAAG;EAC1BC,GAAG,EAAE,KAAK;EACVC,KAAK,EAAE,OAAO;EACdC,IAAI,EAAE,MAAM;EACZC,IAAI,EAAE,MAAM;EACZC,KAAK,EAAE;AACT,CAAC;AACD,OAAO,IAAIC,aAAa,GAAGC,OAAO;AAElC,OAAO,IAAIC,sBAAsB,GAAG,CAAC,CAAC;AACtCC,MAAM,CAACC,IAAI,CAACV,cAAc,CAAC,CAACW,OAAO,CAAC,UAAUC,IAAI,EAAE;EAClDJ,sBAAsB,CAACI,IAAI,CAAC,GAAGN,aAAa,CAACM,IAAI,CAAC,IAAIb,IAAI;AAC5D,CAAC,CAAC;AAEF,IAAIc,MAAM,GAAG,qBAAqB;AAElC,OAAO,IAAIC,OAAO,GAAG;EACnBZ,KAAK,EAAEM,sBAAsB,CAACN,KAAK,CAACa,IAAI,CAACT,aAAa,EAAEO,MAAM,CAAC;EAC/DZ,GAAG,EAAEO,sBAAsB,CAACP,GAAG,CAACc,IAAI,CAACT,aAAa,EAAEO,MAAM,CAAC;EAC3DV,IAAI,EAAEK,sBAAsB,CAACL,IAAI,CAACY,IAAI,CAACT,aAAa,EAAEO,MAAM,CAAC;EAC7DT,IAAI,EAAEI,sBAAsB,CAACJ,IAAI,CAACW,IAAI,CAACT,aAAa,EAAEO,MAAM,CAAC;EAC7DR,KAAK,EAAEG,sBAAsB,CAACH,KAAK,CAACU,IAAI,CAACT,aAAa,EAAEO,MAAM;AAChE,CAAC","ignoreList":[]}
|
package/esm/helper/enums.js
CHANGED
|
@@ -10,6 +10,7 @@ export var DOM_EVENT = {
|
|
|
10
10
|
TOUCH_END: 'touchend',
|
|
11
11
|
TOUCH_MOVE: 'touchmove',
|
|
12
12
|
VISIBILITY_CHANGE: 'visibilitychange',
|
|
13
|
+
PRERENDERING_CHANGE: 'prerenderingchange',
|
|
13
14
|
PAGE_SHOW: 'pageshow',
|
|
14
15
|
FREEZE: 'freeze',
|
|
15
16
|
RESUME: 'resume',
|
|
@@ -44,7 +45,8 @@ export var ResourceType = {
|
|
|
44
45
|
IMAGE: 'image',
|
|
45
46
|
FONT: 'font',
|
|
46
47
|
MEDIA: 'media',
|
|
47
|
-
OTHER: 'other'
|
|
48
|
+
OTHER: 'other',
|
|
49
|
+
CUSTOM: 'custom'
|
|
48
50
|
};
|
|
49
51
|
export var ActionType = {
|
|
50
52
|
CLICK: 'click',
|
package/esm/helper/enums.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enums.js","names":["DOM_EVENT","BEFORE_UNLOAD","CLICK","DBL_CLICK","KEY_DOWN","LOAD","POP_STATE","SCROLL","TOUCH_START","TOUCH_END","TOUCH_MOVE","VISIBILITY_CHANGE","PAGE_SHOW","FREEZE","RESUME","DOM_CONTENT_LOADED","POINTER_DOWN","POINTER_UP","POINTER_CANCEL","HASH_CHANGE","PAGE_HIDE","MOUSE_DOWN","MOUSE_UP","MOUSE_MOVE","FOCUS","BLUR","CONTEXT_MENU","RESIZE","CHANGE","INPUT","PLAY","PAUSE","SECURITY_POLICY_VIOLATION","SELECTION_CHANGE","STORAGE","ResourceType","DOCUMENT","XHR","BEACON","FETCH","CSS","JS","IMAGE","FONT","MEDIA","OTHER","
|
|
1
|
+
{"version":3,"file":"enums.js","names":["DOM_EVENT","BEFORE_UNLOAD","CLICK","DBL_CLICK","KEY_DOWN","LOAD","POP_STATE","SCROLL","TOUCH_START","TOUCH_END","TOUCH_MOVE","VISIBILITY_CHANGE","PRERENDERING_CHANGE","PAGE_SHOW","FREEZE","RESUME","DOM_CONTENT_LOADED","POINTER_DOWN","POINTER_UP","POINTER_CANCEL","HASH_CHANGE","PAGE_HIDE","MOUSE_DOWN","MOUSE_UP","MOUSE_MOVE","FOCUS","BLUR","CONTEXT_MENU","RESIZE","CHANGE","INPUT","PLAY","PAUSE","SECURITY_POLICY_VIOLATION","SELECTION_CHANGE","STORAGE","ResourceType","DOCUMENT","XHR","BEACON","FETCH","CSS","JS","IMAGE","FONT","MEDIA","OTHER","CUSTOM","ActionType","FrustrationType","RAGE_CLICK","ERROR_CLICK","DEAD_CLICK","RumEventType","ACTION","ERROR","LONG_TASK","VIEW","RESOURCE","LOGGER","RumLongTaskEntryType","LONG_ANIMATION_FRAME","ViewLoadingType","INITIAL_LOAD","ROUTE_CHANGE","RequestType","TraceType","DDTRACE","ZIPKIN_MULTI_HEADER","ZIPKIN_SINGLE_HEADER","W3C_TRACEPARENT","W3C_TRACEPARENT_64","SKYWALKING_V3","JAEGER","ErrorHandling","HANDLED","UNHANDLED","NonErrorPrefix","UNCAUGHT","PROVIDED"],"sources":["../../src/helper/enums.js"],"sourcesContent":["export var DOM_EVENT = {\n BEFORE_UNLOAD: 'beforeunload',\n CLICK: 'click',\n DBL_CLICK: 'dblclick',\n KEY_DOWN: 'keydown',\n LOAD: 'load',\n POP_STATE: 'popstate',\n SCROLL: 'scroll',\n TOUCH_START: 'touchstart',\n TOUCH_END: 'touchend',\n TOUCH_MOVE: 'touchmove',\n VISIBILITY_CHANGE: 'visibilitychange',\n PRERENDERING_CHANGE: 'prerenderingchange',\n PAGE_SHOW: 'pageshow',\n FREEZE: 'freeze',\n RESUME: 'resume',\n DOM_CONTENT_LOADED: 'DOMContentLoaded',\n POINTER_DOWN: 'pointerdown',\n POINTER_UP: 'pointerup',\n POINTER_CANCEL: 'pointercancel',\n HASH_CHANGE: 'hashchange',\n PAGE_HIDE: 'pagehide',\n MOUSE_DOWN: 'mousedown',\n MOUSE_UP: 'mouseup',\n MOUSE_MOVE: 'mousemove',\n FOCUS: 'focus',\n BLUR: 'blur',\n CONTEXT_MENU: 'contextmenu',\n RESIZE: 'resize',\n CHANGE: 'change',\n INPUT: 'input',\n PLAY: 'play',\n PAUSE: 'pause',\n SECURITY_POLICY_VIOLATION: 'securitypolicyviolation',\n SELECTION_CHANGE: 'selectionchange',\n STORAGE: 'storage'\n}\nexport var ResourceType = {\n DOCUMENT: 'document',\n XHR: 'xhr',\n BEACON: 'beacon',\n FETCH: 'fetch',\n CSS: 'css',\n JS: 'js',\n IMAGE: 'image',\n FONT: 'font',\n MEDIA: 'media',\n OTHER: 'other',\n CUSTOM: 'custom'\n}\n\nexport var ActionType = {\n CLICK: 'click',\n CUSTOM: 'custom'\n}\nexport var FrustrationType = {\n RAGE_CLICK: 'rage_click',\n ERROR_CLICK: 'error_click',\n DEAD_CLICK: 'dead_click'\n}\nexport var RumEventType = {\n ACTION: 'action',\n ERROR: 'error',\n LONG_TASK: 'long_task',\n VIEW: 'view',\n RESOURCE: 'resource',\n LOGGER: 'logger'\n}\nexport var RumLongTaskEntryType = {\n LONG_TASK: 'long-task',\n LONG_ANIMATION_FRAME: 'long-animation-frame'\n}\nexport var ViewLoadingType = {\n INITIAL_LOAD: 'initial_load',\n ROUTE_CHANGE: 'route_change'\n}\nexport var RequestType = {\n FETCH: ResourceType.FETCH,\n XHR: ResourceType.XHR\n}\n\nexport var TraceType = {\n DDTRACE: 'ddtrace',\n ZIPKIN_MULTI_HEADER: 'zipkin',\n ZIPKIN_SINGLE_HEADER: 'zipkin_single_header',\n W3C_TRACEPARENT: 'w3c_traceparent',\n W3C_TRACEPARENT_64: 'w3c_traceparent_64bit',\n SKYWALKING_V3: 'skywalking_v3',\n JAEGER: 'jaeger'\n}\nexport var ErrorHandling = {\n HANDLED: 'handled',\n UNHANDLED: 'unhandled'\n}\nexport var NonErrorPrefix = {\n UNCAUGHT: 'Uncaught',\n PROVIDED: 'Provided'\n}\n"],"mappings":"AAAA,OAAO,IAAIA,SAAS,GAAG;EACrBC,aAAa,EAAE,cAAc;EAC7BC,KAAK,EAAE,OAAO;EACdC,SAAS,EAAE,UAAU;EACrBC,QAAQ,EAAE,SAAS;EACnBC,I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C3BC,UAAU,EAAE,YAAY;EACxBC,WAAW,EAAE,aAAa;EAC1BC,UAAU,EAAE;AACd,CAAC;AACD,OAAO,IAAIC,YAAY,GAAG;EACxBC,MAAM,EAAE,QAAQ;EAChBC,KAAK,EAAE,OAAO;EACdC,SAAS,EAAE,WAAW;EACtBC,IAAI,EAAE,MAAM;EACZC,QAAQ,EAAE,UAAU;EACpBC,MAAM,EAAE;AACV,CAAC;AACD,OAAO,IAAIC,oBAAoB,GAAG;EAChCJ,SAAS,EAAE,WAAW;EACtBK,oBAAoB,EAAE;AACxB,CAAC;AACD,OAAO,IAAIC,eAAe,GAAG;EAC3BC,YAAY,EAAE,cAAc;EAC5BC,YAAY,EAAE;AAChB,CAAC;AACD,OAAO,IAAIC,WAAW,GAAG;EACvBzB,KAAK,EAAEJ,YAAY,CAACI,KAAK;EACzBF,GAAG,EAAEF,YAAY,CAACE;AACpB,CAAC;AAED,OAAO,IAAI4B,SAAS,GAAG;EACrBC,OAAO,EAAE,SAAS;EAClBC,mBAAmB,EAAE,QAAQ;EAC7BC,oBAAoB,EAAE,sBAAsB;EAC5CC,eAAe,EAAE,iBAAiB;EAClCC,kBAAkB,EAAE,uBAAuB;EAC3CC,aAAa,EAAE,eAAe;EAC9BC,MAAM,EAAE;AACV,CAAC;AACD,OAAO,IAAIC,aAAa,GAAG;EACzBC,OAAO,EAAE,SAAS;EAClBC,SAAS,EAAE;AACb,CAAC;AACD,OAAO,IAAIC,cAAc,GAAG;EAC1BC,QAAQ,EAAE,UAAU;EACpBC,QAAQ,EAAE;AACZ,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessionStoreOperations.js","names":["setTimeout","UUID","assign","ONE_SECOND","timeStampNow","elapsed","expandSessionState","isSessionInExpiredState","addTelemetryDebug","LOCK_RETRY_DELAY","LOCK_MAX_TRIES","LOCK_EXPIRATION_DELAY","LOCK_SEPARATOR","bufferedOperations","ongoingOperations","processSessionStoreOperations","operations","sessionStoreStrategy","numberOfRetries","arguments","length","undefined","isLockEnabled","persistSession","expireSession","persistWithLock","session","lock","currentLock","retrieveStore","_sessionStoreStrategy","retrieveSession","_objectWithoutProperties","_excluded","isLockExpired","push","currentStore","next","retryLater","createLock","processedSession","process","after","sessionStore","currentNumberOfRetries","nextOperations","shift","_lock$split","split","_lock$split2","_slicedToArray","timeStamp","Number"],"sources":["../../src/session/sessionStoreOperations.js"],"sourcesContent":["import { setTimeout } from '../helper/timer'\nimport {\n UUID,\n assign,\n ONE_SECOND,\n timeStampNow,\n elapsed\n} from '../helper/tools'\nimport { expandSessionState, isSessionInExpiredState } from './sessionState'\nimport { addTelemetryDebug } from '../telemetry/telemetry'\nexport const LOCK_RETRY_DELAY = 10\nexport const LOCK_MAX_TRIES = 100\n\n// Locks should be hold for a few milliseconds top, just the time it takes to read and write a\n// cookie. Using one second should be enough in most situations.\nexport const LOCK_EXPIRATION_DELAY = ONE_SECOND\nconst LOCK_SEPARATOR = '--'\nconst bufferedOperations = []\nlet ongoingOperations\n\nexport function processSessionStoreOperations(\n operations,\n sessionStoreStrategy,\n numberOfRetries = 0\n) {\n const { isLockEnabled, persistSession, expireSession } = sessionStoreStrategy\n const persistWithLock = function (session) {\n return persistSession(assign({}, session, { lock: currentLock }))\n }\n const retrieveStore = function () {\n const { lock, ...session } = sessionStoreStrategy.retrieveSession()\n\n return {\n session,\n lock: lock && !isLockExpired(lock) ? lock : undefined\n }\n }\n\n if (!ongoingOperations) {\n ongoingOperations = operations\n }\n if (operations !== ongoingOperations) {\n bufferedOperations.push(operations)\n return\n }\n if (isLockEnabled && numberOfRetries >= LOCK_MAX_TRIES) {\n addTelemetryDebug('Aborted session operation after max lock retries', {\n currentStore: retrieveStore()\n })\n next(sessionStoreStrategy)\n return\n }\n let currentLock\n let currentStore = retrieveStore()\n if (isLockEnabled) {\n // if someone has lock, retry later\n if (currentStore.lock) {\n retryLater(operations, sessionStoreStrategy, numberOfRetries)\n return\n }\n // acquire lock\n currentLock = createLock()\n persistWithLock(currentStore.session)\n // if lock is not acquired, retry later\n currentStore = retrieveStore()\n if (currentStore.lock !== currentLock) {\n retryLater(operations, sessionStoreStrategy, numberOfRetries)\n return\n }\n }\n let processedSession = operations.process(currentStore.session)\n if (isLockEnabled) {\n // if lock corrupted after process, retry later\n currentStore = retrieveStore()\n if (currentStore.lock !== currentLock) {\n retryLater(operations, sessionStoreStrategy, numberOfRetries)\n return\n }\n }\n if (processedSession) {\n if (isSessionInExpiredState(processedSession)) {\n expireSession()\n } else {\n expandSessionState(processedSession)\n isLockEnabled\n ? persistWithLock(processedSession)\n : persistSession(processedSession)\n }\n }\n if (isLockEnabled) {\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 && isSessionInExpiredState(processedSession))) {\n // if lock corrupted after persist, retry later\n currentStore = retrieveStore()\n if (currentStore.lock !== currentLock) {\n retryLater(operations, sessionStoreStrategy, numberOfRetries)\n return\n }\n persistSession(currentStore.session)\n processedSession = currentStore.session\n }\n }\n // call after even if session is not persisted in order to perform operations on\n // up-to-date session state value => the value could have been modified by another tab\n if (operations.after) {\n operations.after(processedSession || currentStore.session)\n }\n next(sessionStoreStrategy)\n}\n\nfunction retryLater(operations, sessionStore, currentNumberOfRetries) {\n setTimeout(function () {\n processSessionStoreOperations(\n operations,\n sessionStore,\n currentNumberOfRetries + 1\n )\n }, LOCK_RETRY_DELAY)\n}\n\nfunction next(sessionStore) {\n ongoingOperations = undefined\n const nextOperations = bufferedOperations.shift()\n if (nextOperations) {\n processSessionStoreOperations(nextOperations, sessionStore)\n }\n}\n\nexport function createLock() {\n return UUID() + LOCK_SEPARATOR + timeStampNow()\n}\n\nfunction isLockExpired(lock) {\n const [, timeStamp] = lock.split(LOCK_SEPARATOR)\n return (\n !timeStamp ||\n elapsed(Number(timeStamp), timeStampNow()) > LOCK_EXPIRATION_DELAY\n )\n}\n"],"mappings":";;;;;;;;;AAAA,SA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N;IAC9C,CAAC;EACH,CAAC;EAED,IAAI,CAACP,iBAAiB,EAAE;IACtBA,iBAAiB,GAAGE,UAAU;EAChC;EACA,IAAIA,UAAU,KAAKF,iBAAiB,EAAE;IACpCD,kBAAkB,CAACsB,IAAI,CAACnB,UAAU,CAAC;IACnC;EACF;EACA,IAAIM,aAAa,IAAIJ,eAAe,IAAIR,cAAc,EAAE;IACtDF,iBAAiB,CAAC,kDAAkD,EAAE;MACpE4B,YAAY,EAAEP,aAAa,CAAC;IAC9B,CAAC,CAAC;IACFQ,IAAI,CAACpB,oBAAoB,CAAC;IAC1B;EACF;EACA,IAAIW,WAAW;EACf,IAAIQ,YAAY,GAAGP,aAAa,CAAC,CAAC;EAClC,IAAIP,aAAa,EAAE;IACjB;IACA,IAAIc,YAAY,CAACT,IAAI,EAAE;MACrBW,UAAU,CAACtB,UAAU,EAAEC,oBAAoB,EAAEC,eAAe,CAAC;MAC7D;IACF;IACA;IACAU,WAAW,GAAGW,UAAU,CAAC,CAAC;IAC1Bd,eAAe,CAACW,YAAY,CAACV,OAAO,CAAC;IACrC;IACAU,YAAY,GAAGP,aAAa,CAAC,CAAC;IAC9B,IAAIO,YAAY,CAACT,IAAI,KAAKC,WAAW,EAAE;MACrCU,UAAU,CAACtB,UAAU,EAAEC,oBAAoB,EAAEC,eAAe,CAAC;MAC7D;IACF;EACF;EACA,IAAIsB,gBAAgB,GAAGxB,UAAU,CAACyB,OAAO,CAACL,YAAY,CAACV,OAAO,CAAC;EAC/D,IAAIJ,aAAa,EAAE;IACjB;IACAc,YAAY,GAAGP,aAAa,CAAC,CAAC;IAC9B,IAAIO,YAAY,CAACT,IAAI,KAAKC,WAAW,EAAE;MACrCU,UAAU,CAACtB,UAAU,EAAEC,oBAAoB,EAAEC,eAAe,CAAC;MAC7D;IACF;EACF;
|
|
1
|
+
{"version":3,"file":"sessionStoreOperations.js","names":["setTimeout","UUID","assign","ONE_SECOND","timeStampNow","elapsed","expandSessionState","isSessionInExpiredState","addTelemetryDebug","LOCK_RETRY_DELAY","LOCK_MAX_TRIES","LOCK_EXPIRATION_DELAY","LOCK_SEPARATOR","bufferedOperations","ongoingOperations","processSessionStoreOperations","operations","sessionStoreStrategy","numberOfRetries","arguments","length","undefined","isLockEnabled","persistSession","expireSession","persistWithLock","session","lock","currentLock","retrieveStore","_sessionStoreStrategy","retrieveSession","_objectWithoutProperties","_excluded","isLockExpired","push","currentStore","next","retryLater","createLock","processedSession","process","after","sessionStore","currentNumberOfRetries","nextOperations","shift","_lock$split","split","_lock$split2","_slicedToArray","timeStamp","Number"],"sources":["../../src/session/sessionStoreOperations.js"],"sourcesContent":["import { setTimeout } from '../helper/timer'\nimport {\n UUID,\n assign,\n ONE_SECOND,\n timeStampNow,\n elapsed\n} from '../helper/tools'\nimport { expandSessionState, isSessionInExpiredState } from './sessionState'\nimport { addTelemetryDebug } from '../telemetry/telemetry'\nexport const LOCK_RETRY_DELAY = 10\nexport const LOCK_MAX_TRIES = 100\n\n// Locks should be hold for a few milliseconds top, just the time it takes to read and write a\n// cookie. Using one second should be enough in most situations.\nexport const LOCK_EXPIRATION_DELAY = ONE_SECOND\nconst LOCK_SEPARATOR = '--'\nconst bufferedOperations = []\nlet ongoingOperations\n\nexport function processSessionStoreOperations(\n operations,\n sessionStoreStrategy,\n numberOfRetries = 0\n) {\n const { isLockEnabled, persistSession, expireSession } = sessionStoreStrategy\n const persistWithLock = function (session) {\n return persistSession(assign({}, session, { lock: currentLock }))\n }\n const retrieveStore = function () {\n const { lock, ...session } = sessionStoreStrategy.retrieveSession()\n\n return {\n session,\n lock: lock && !isLockExpired(lock) ? lock : undefined\n }\n }\n\n if (!ongoingOperations) {\n ongoingOperations = operations\n }\n if (operations !== ongoingOperations) {\n bufferedOperations.push(operations)\n return\n }\n if (isLockEnabled && numberOfRetries >= LOCK_MAX_TRIES) {\n addTelemetryDebug('Aborted session operation after max lock retries', {\n currentStore: retrieveStore()\n })\n next(sessionStoreStrategy)\n return\n }\n let currentLock\n let currentStore = retrieveStore()\n if (isLockEnabled) {\n // if someone has lock, retry later\n if (currentStore.lock) {\n retryLater(operations, sessionStoreStrategy, numberOfRetries)\n return\n }\n // acquire lock\n currentLock = createLock()\n persistWithLock(currentStore.session)\n // if lock is not acquired, retry later\n currentStore = retrieveStore()\n if (currentStore.lock !== currentLock) {\n retryLater(operations, sessionStoreStrategy, numberOfRetries)\n return\n }\n }\n let processedSession = operations.process(currentStore.session)\n if (isLockEnabled) {\n // if lock corrupted after process, retry later\n currentStore = retrieveStore()\n if (currentStore.lock !== currentLock) {\n retryLater(operations, sessionStoreStrategy, numberOfRetries)\n return\n }\n }\n\n if (processedSession) {\n if (isSessionInExpiredState(processedSession)) {\n expireSession()\n } else {\n expandSessionState(processedSession)\n isLockEnabled\n ? persistWithLock(processedSession)\n : persistSession(processedSession)\n }\n }\n if (isLockEnabled) {\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 && isSessionInExpiredState(processedSession))) {\n // if lock corrupted after persist, retry later\n currentStore = retrieveStore()\n if (currentStore.lock !== currentLock) {\n retryLater(operations, sessionStoreStrategy, numberOfRetries)\n return\n }\n persistSession(currentStore.session)\n processedSession = currentStore.session\n }\n }\n // call after even if session is not persisted in order to perform operations on\n // up-to-date session state value => the value could have been modified by another tab\n if (operations.after) {\n operations.after(processedSession || currentStore.session)\n }\n next(sessionStoreStrategy)\n}\n\nfunction retryLater(operations, sessionStore, currentNumberOfRetries) {\n setTimeout(function () {\n processSessionStoreOperations(\n operations,\n sessionStore,\n currentNumberOfRetries + 1\n )\n }, LOCK_RETRY_DELAY)\n}\n\nfunction next(sessionStore) {\n ongoingOperations = undefined\n const nextOperations = bufferedOperations.shift()\n if (nextOperations) {\n processSessionStoreOperations(nextOperations, sessionStore)\n }\n}\n\nexport function createLock() {\n return UUID() + LOCK_SEPARATOR + timeStampNow()\n}\n\nfunction isLockExpired(lock) {\n const [, timeStamp] = lock.split(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Y,CAAC;EAC7D;AACF;AAEA,OAAO,SAASJ,UAAUA,CAAA,EAAG;EAC3B,OAAOtC,IAAI,CAAC,CAAC,GAAGW,cAAc,GAAGR,YAAY,CAAC,CAAC;AACjD;AAEA,SAAS8B,aAAaA,CAACP,IAAI,EAAE;EAC3B,IAAAoB,WAAA,GAAsBpB,IAAI,CAACqB,KAAK,CAACpC,cAAc,CAAC;IAAAqC,YAAA,GAAAC,cAAA,CAAAH,WAAA;IAAvCI,SAAS,GAAAF,YAAA;EAClB,OACE,CAACE,SAAS,IACV9C,OAAO,CAAC+C,MAAM,CAACD,SAAS,CAAC,EAAE/C,YAAY,CAAC,CAAC,CAAC,GAAGO,qBAAqB;AAEtE","ignoreList":[]}
|
|
@@ -21,11 +21,15 @@ export function getEventBridge() {
|
|
|
21
21
|
var view = viewId ? {
|
|
22
22
|
id: viewId
|
|
23
23
|
} : undefined;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
try {
|
|
25
|
+
eventBridgeGlobal.sendEvent(JSON.stringify({
|
|
26
|
+
name: eventType,
|
|
27
|
+
data: event,
|
|
28
|
+
view: view
|
|
29
|
+
}));
|
|
30
|
+
} catch (e) {
|
|
31
|
+
// unload postmessage error
|
|
32
|
+
}
|
|
29
33
|
}
|
|
30
34
|
};
|
|
31
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eventBridge.js","names":["getGlobalObject","getEventBridgeGlobal","FTWebViewJavascriptBridge","getEventBridge","eventBridgeGlobal","getCapabilities","JSON","parse","getPrivacyLevel","getAllowedWebViewHosts","send","eventType","event","viewId","view","id","undefined","sendEvent","stringify","name","data","BridgeCapability","RECORDS","bridgeSupports","capability","bridge","includes","canUseEventBridge","_getGlobalObject$loca","currentHost","arguments","length","location","hostname","some","allowedHost","endsWith","concat"],"sources":["../../src/transport/eventBridge.js"],"sourcesContent":["import { getGlobalObject } from '../init'\n\nfunction getEventBridgeGlobal() {\n return getGlobalObject().FTWebViewJavascriptBridge\n}\nexport function getEventBridge() {\n var eventBridgeGlobal = getEventBridgeGlobal()\n\n if (!eventBridgeGlobal) {\n return\n }\n\n return {\n getCapabilities() {\n return JSON.parse(\n (eventBridgeGlobal.getCapabilities &&\n eventBridgeGlobal.getCapabilities()) ||\n '[]'\n )\n },\n getPrivacyLevel() {\n return (\n eventBridgeGlobal.getPrivacyLevel && eventBridgeGlobal.getPrivacyLevel()\n )\n },\n getAllowedWebViewHosts() {\n return JSON.parse(\n (eventBridgeGlobal.getAllowedWebViewHosts &&\n eventBridgeGlobal.getAllowedWebViewHosts()) ||\n '[]'\n )\n },\n send(eventType, event, viewId) {\n const view = viewId ? { id: viewId } : undefined\n eventBridgeGlobal.sendEvent(\n
|
|
1
|
+
{"version":3,"file":"eventBridge.js","names":["getGlobalObject","getEventBridgeGlobal","FTWebViewJavascriptBridge","getEventBridge","eventBridgeGlobal","getCapabilities","JSON","parse","getPrivacyLevel","getAllowedWebViewHosts","send","eventType","event","viewId","view","id","undefined","sendEvent","stringify","name","data","e","BridgeCapability","RECORDS","bridgeSupports","capability","bridge","includes","canUseEventBridge","_getGlobalObject$loca","currentHost","arguments","length","location","hostname","some","allowedHost","endsWith","concat"],"sources":["../../src/transport/eventBridge.js"],"sourcesContent":["import { getGlobalObject } from '../init'\n\nfunction getEventBridgeGlobal() {\n return getGlobalObject().FTWebViewJavascriptBridge\n}\nexport function getEventBridge() {\n var eventBridgeGlobal = getEventBridgeGlobal()\n\n if (!eventBridgeGlobal) {\n return\n }\n\n return {\n getCapabilities() {\n return JSON.parse(\n (eventBridgeGlobal.getCapabilities &&\n eventBridgeGlobal.getCapabilities()) ||\n '[]'\n )\n },\n getPrivacyLevel() {\n return (\n eventBridgeGlobal.getPrivacyLevel && eventBridgeGlobal.getPrivacyLevel()\n )\n },\n getAllowedWebViewHosts() {\n return JSON.parse(\n (eventBridgeGlobal.getAllowedWebViewHosts &&\n eventBridgeGlobal.getAllowedWebViewHosts()) ||\n '[]'\n )\n },\n send(eventType, event, viewId) {\n const view = viewId ? { id: viewId } : undefined\n try {\n eventBridgeGlobal.sendEvent(\n JSON.stringify({ name: eventType, data: event, view })\n )\n } catch (e) {\n // unload postmessage error\n }\n }\n }\n}\nexport const BridgeCapability = {\n RECORDS: 'records'\n}\nexport function bridgeSupports(capability) {\n const bridge = getEventBridge()\n\n return !!bridge && bridge.getCapabilities().includes(capability)\n}\nexport function canUseEventBridge(\n currentHost = getGlobalObject().location?.hostname\n) {\n const eventBridgeGlobal = getEventBridgeGlobal()\n if (\n eventBridgeGlobal &&\n eventBridgeGlobal.getAllowedWebViewHosts === undefined\n ) {\n return true\n }\n if (\n eventBridgeGlobal &&\n eventBridgeGlobal.getAllowedWebViewHosts &&\n (eventBridgeGlobal.getAllowedWebViewHosts() === null ||\n eventBridgeGlobal.getAllowedWebViewHosts() === undefined)\n ) {\n return true\n }\n var bridge = getEventBridge()\n return (\n !!bridge &&\n bridge\n .getAllowedWebViewHosts()\n .some(\n (allowedHost) =>\n currentHost === allowedHost || currentHost.endsWith(`.${allowedHost}`)\n )\n )\n}\n"],"mappings":"AAAA,SAASA,eAAe,QAAQ,SAAS;AAEzC,SAASC,oBAAoBA,CAAA,EAAG;EAC9B,OAAOD,eAAe,CAAC,CAAC,CAACE,yBAAyB;AACpD;AACA,OAAO,SAASC,cAAcA,CAAA,EAAG;EAC/B,IAAIC,iBAAiB,GAAGH,oBAAoB,CAAC,CAAC;EAE9C,IAAI,CAACG,iBAAiB,EAAE;IACtB;EACF;EAEA,OAAO;IACLC,eAAe,WAAfA,eAAeA,CAAA,EAAG;MAChB,OAAOC,IAAI,CAACC,KAAK,CACdH,iBAAiB,CAACC,eAAe,IAChCD,iBAAiB,CAACC,eAAe,CAAC,CAAC,IACnC,IACJ,CAAC;IACH,CAAC;IACDG,eAAe,WAAfA,eAAeA,CAAA,EAAG;MAChB,OACEJ,iBAAiB,CAACI,eAAe,IAAIJ,iBAAiB,CAACI,e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OAAO,IAAI;EACb;EACA,IACEZ,iBAAiB,IACjBA,iBAAiB,CAACK,sBAAsB,KACvCL,iBAAiB,CAACK,sBAAsB,CAAC,CAAC,KAAK,IAAI,IAClDL,iBAAiB,CAACK,sBAAsB,CAAC,CAAC,KAAKO,SAAS,CAAC,EAC3D;IACA,OAAO,IAAI;EACb;EACA,IAAIU,MAAM,GAAGvB,cAAc,CAAC,CAAC;EAC7B,OACE,CAAC,CAACuB,MAAM,IACRA,MAAM,CACHjB,sBAAsB,CAAC,CAAC,CACxB0B,IAAI,CACH,UAACC,WAAW;IAAA,OACVN,WAAW,KAAKM,WAAW,IAAIN,WAAW,CAACO,QAAQ,KAAAC,MAAA,CAAKF,WAAW,CAAE,CAAC;EAAA,CAC1E,CAAC;AAEP","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudcare/browser-core",
|
|
3
|
-
"version": "3.2.
|
|
3
|
+
"version": "3.2.44",
|
|
4
4
|
"main": "cjs/index.js",
|
|
5
5
|
"module": "esm/index.js",
|
|
6
6
|
"types": "types/index.d.ts",
|
|
@@ -21,5 +21,5 @@
|
|
|
21
21
|
},
|
|
22
22
|
"author": "dataflux",
|
|
23
23
|
"license": "MIT",
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "1a9f4789e908edc5e58e68f2ee18eacd522cc33a"
|
|
25
25
|
}
|
package/src/helper/display.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { noop } from './tools'
|
|
1
2
|
export var ConsoleApiName = {
|
|
2
3
|
log: 'log',
|
|
3
4
|
debug: 'debug',
|
|
@@ -9,7 +10,7 @@ export var globalConsole = console
|
|
|
9
10
|
|
|
10
11
|
export var originalConsoleMethods = {}
|
|
11
12
|
Object.keys(ConsoleApiName).forEach(function (name) {
|
|
12
|
-
originalConsoleMethods[name] = globalConsole[name]
|
|
13
|
+
originalConsoleMethods[name] = globalConsole[name] || noop
|
|
13
14
|
})
|
|
14
15
|
|
|
15
16
|
var PREFIX = 'GUANCE Browser SDK:'
|
package/src/helper/enums.js
CHANGED
|
@@ -10,6 +10,7 @@ export var DOM_EVENT = {
|
|
|
10
10
|
TOUCH_END: 'touchend',
|
|
11
11
|
TOUCH_MOVE: 'touchmove',
|
|
12
12
|
VISIBILITY_CHANGE: 'visibilitychange',
|
|
13
|
+
PRERENDERING_CHANGE: 'prerenderingchange',
|
|
13
14
|
PAGE_SHOW: 'pageshow',
|
|
14
15
|
FREEZE: 'freeze',
|
|
15
16
|
RESUME: 'resume',
|
|
@@ -44,7 +45,8 @@ export var ResourceType = {
|
|
|
44
45
|
IMAGE: 'image',
|
|
45
46
|
FONT: 'font',
|
|
46
47
|
MEDIA: 'media',
|
|
47
|
-
OTHER: 'other'
|
|
48
|
+
OTHER: 'other',
|
|
49
|
+
CUSTOM: 'custom'
|
|
48
50
|
}
|
|
49
51
|
|
|
50
52
|
export var ActionType = {
|
|
@@ -32,9 +32,13 @@ export function getEventBridge() {
|
|
|
32
32
|
},
|
|
33
33
|
send(eventType, event, viewId) {
|
|
34
34
|
const view = viewId ? { id: viewId } : undefined
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
try {
|
|
36
|
+
eventBridgeGlobal.sendEvent(
|
|
37
|
+
JSON.stringify({ name: eventType, data: event, view })
|
|
38
|
+
)
|
|
39
|
+
} catch (e) {
|
|
40
|
+
// unload postmessage error
|
|
41
|
+
}
|
|
38
42
|
}
|
|
39
43
|
}
|
|
40
44
|
}
|