@cloudcare/browser-core 2.0.4 → 2.0.6
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/browser/addEventListener.js +57 -0
- package/cjs/browser/fetchObservable.js +4 -5
- package/cjs/browser/pageExitObservable.js +4 -2
- package/cjs/browser/runOnReadyState.js +21 -0
- package/cjs/browser/xhrObservable.js +7 -5
- package/cjs/configuration/configuration.js +5 -3
- package/cjs/console/consoleObservable.js +3 -1
- package/cjs/dataMap.js +1 -0
- package/cjs/helper/byteUtils.js +26 -0
- package/cjs/helper/contextHistory.js +4 -2
- package/cjs/helper/createEventRateLimiter.js +3 -1
- package/cjs/helper/errorTools.js +4 -2
- package/cjs/helper/instrumentMethod.js +2 -4
- package/cjs/helper/serialisation/contextManager.js +84 -0
- package/cjs/helper/serialisation/heavyCustomerDataWarning.js +34 -0
- package/cjs/helper/serialisation/jsonStringify.js +57 -0
- package/cjs/helper/serialisation/rowData.js +50 -0
- package/cjs/helper/timer.js +29 -0
- package/cjs/helper/tools.js +10 -331
- package/cjs/index.js +117 -0
- package/cjs/init.js +6 -6
- package/cjs/report/reportObservable.js +4 -2
- package/cjs/session/sessionCookieStore.js +3 -1
- package/cjs/session/sessionManagement.js +10 -5
- package/cjs/session/sessionStore.js +10 -4
- package/cjs/transport/batch.js +40 -91
- package/cjs/transport/flushController.js +121 -0
- package/cjs/transport/httpRequest.js +6 -2
- package/cjs/transport/index.js +9 -1
- package/cjs/transport/sendWithRetryStrategy.js +8 -4
- package/cjs/transport/startBatchWithReplica.js +10 -2
- package/cjs/user/index.js +18 -0
- package/cjs/user/user.js +42 -0
- package/esm/browser/addEventListener.js +46 -0
- package/esm/browser/fetchObservable.js +4 -3
- package/esm/browser/pageExitObservable.js +2 -1
- package/esm/browser/runOnReadyState.js +12 -0
- package/esm/browser/xhrObservable.js +6 -5
- package/esm/configuration/configuration.js +2 -1
- package/esm/console/consoleObservable.js +2 -1
- package/esm/dataMap.js +1 -0
- package/esm/helper/byteUtils.js +16 -0
- package/esm/helper/contextHistory.js +1 -0
- package/esm/helper/createEventRateLimiter.js +1 -0
- package/esm/helper/errorTools.js +2 -1
- package/esm/helper/instrumentMethod.js +1 -3
- package/esm/helper/serialisation/contextManager.js +70 -0
- package/esm/helper/serialisation/heavyCustomerDataWarning.js +20 -0
- package/esm/helper/serialisation/jsonStringify.js +46 -0
- package/esm/helper/serialisation/rowData.js +33 -0
- package/esm/helper/timer.js +14 -0
- package/esm/helper/tools.js +1 -292
- package/esm/index.js +10 -1
- package/esm/init.js +6 -6
- package/esm/report/reportObservable.js +3 -2
- package/esm/session/sessionCookieStore.js +1 -0
- package/esm/session/sessionManagement.js +5 -2
- package/esm/session/sessionStore.js +7 -2
- package/esm/transport/batch.js +31 -85
- package/esm/transport/flushController.js +114 -0
- package/esm/transport/httpRequest.js +5 -2
- package/esm/transport/index.js +2 -1
- package/esm/transport/sendWithRetryStrategy.js +3 -1
- package/esm/transport/startBatchWithReplica.js +9 -2
- package/esm/user/index.js +1 -0
- package/esm/user/user.js +32 -0
- package/package.json +22 -22
- package/src/browser/addEventListener.js +50 -0
- package/src/browser/fetchObservable.js +5 -5
- package/src/browser/pageExitObservable.js +4 -5
- package/src/browser/runOnReadyState.js +16 -0
- package/src/browser/xhrObservable.js +57 -32
- package/src/configuration/configuration.js +1 -1
- package/src/console/consoleObservable.js +22 -12
- package/src/dataMap.js +1 -0
- package/src/helper/byteUtils.js +17 -0
- package/src/helper/contextHistory.js +1 -1
- package/src/helper/createEventRateLimiter.js +7 -9
- package/src/helper/errorTools.js +2 -1
- package/src/helper/instrumentMethod.js +1 -2
- package/src/helper/serialisation/contextManager.js +79 -0
- package/src/helper/serialisation/heavyCustomerDataWarning.js +28 -0
- package/src/helper/serialisation/jsonStringify.js +47 -0
- package/src/helper/serialisation/rowData.js +41 -0
- package/src/helper/timer.js +21 -0
- package/src/helper/tools.js +2 -301
- package/src/index.js +11 -0
- package/src/init.js +6 -6
- package/src/report/reportObservable.js +40 -25
- package/src/session/sessionCookieStore.js +24 -14
- package/src/session/sessionManagement.js +34 -17
- package/src/session/sessionStore.js +7 -2
- package/src/transport/batch.js +39 -91
- package/src/transport/flushController.js +115 -0
- package/src/transport/httpRequest.js +13 -6
- package/src/transport/index.js +1 -0
- package/src/transport/sendWithRetryStrategy.js +3 -7
- package/src/transport/startBatchWithReplica.js +11 -7
- package/src/user/index.js +1 -0
- package/src/user/user.js +31 -0
package/cjs/helper/tools.js
CHANGED
|
@@ -3,22 +3,17 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.ONE_YEAR = exports.ONE_SECOND = exports.ONE_MINUTE = exports.
|
|
6
|
+
exports.ONE_YEAR = exports.ONE_SECOND = exports.ONE_MINUTE = exports.ONE_HOUR = exports.ONE_DAY = void 0;
|
|
7
7
|
exports.UUID = UUID;
|
|
8
8
|
exports._URL = void 0;
|
|
9
9
|
exports.addDuration = addDuration;
|
|
10
|
-
exports.
|
|
11
|
-
exports.addEventListener = addEventListener;
|
|
12
|
-
exports.addEventListeners = addEventListeners;
|
|
13
|
-
exports.ajax = exports.addSinglePageEvent = exports.addHashEvent = void 0;
|
|
10
|
+
exports.ajax = void 0;
|
|
14
11
|
exports.arrayFrom = arrayFrom;
|
|
15
12
|
exports.assign = assign;
|
|
16
13
|
exports.base64Encode = exports.autoExeQueue = void 0;
|
|
17
14
|
exports.clocksNow = clocksNow;
|
|
18
15
|
exports.clocksOrigin = clocksOrigin;
|
|
19
|
-
exports.coverExtend = exports.cookie = void 0;
|
|
20
|
-
exports.createContextManager = createContextManager;
|
|
21
|
-
exports.cssEscape = void 0;
|
|
16
|
+
exports.cssEscape = exports.coverExtend = exports.cookie = void 0;
|
|
22
17
|
exports.currentDrift = currentDrift;
|
|
23
18
|
exports.dateNow = dateNow;
|
|
24
19
|
exports.decodeURIComponent = void 0;
|
|
@@ -29,10 +24,6 @@ exports.elapsed = elapsed;
|
|
|
29
24
|
exports.elementMatches = elementMatches;
|
|
30
25
|
exports.encodeDates = void 0;
|
|
31
26
|
exports.endsWith = endsWith;
|
|
32
|
-
exports.escapeFieldValueStr = escapeFieldValueStr;
|
|
33
|
-
exports.escapeJsonValue = escapeJsonValue;
|
|
34
|
-
exports.escapeRowData = escapeRowData;
|
|
35
|
-
exports.escapeRowField = escapeRowField;
|
|
36
27
|
exports.filter = exports.extend2Lev = exports.extend = exports.every = void 0;
|
|
37
28
|
exports.find = find;
|
|
38
29
|
exports.findByPath = findByPath;
|
|
@@ -60,9 +51,7 @@ exports.isJSONString = void 0;
|
|
|
60
51
|
exports.isNullUndefinedDefaultValue = isNullUndefinedDefaultValue;
|
|
61
52
|
exports.isObject = exports.isNumber = void 0;
|
|
62
53
|
exports.isPercentage = isPercentage;
|
|
63
|
-
exports.isUndefined = exports.isSupportCors = exports.isString = void 0;
|
|
64
|
-
exports.jsonStringify = jsonStringify;
|
|
65
|
-
exports.localStorage = exports.loadScript = exports.keys = void 0;
|
|
54
|
+
exports.localStorage = exports.loadScript = exports.keys = exports.isUndefined = exports.isSupportCors = exports.isString = void 0;
|
|
66
55
|
exports.looksLikeRelativeTime = looksLikeRelativeTime;
|
|
67
56
|
exports.map = void 0;
|
|
68
57
|
exports.mapValues = mapValues;
|
|
@@ -81,7 +70,6 @@ exports.relativeToClocks = relativeToClocks;
|
|
|
81
70
|
exports.replaceNumberCharByPath = replaceNumberCharByPath;
|
|
82
71
|
exports.requestIdleCallback = requestIdleCallback;
|
|
83
72
|
exports.round = round;
|
|
84
|
-
exports.runOnReadyState = runOnReadyState;
|
|
85
73
|
exports.safeJSONParse = void 0;
|
|
86
74
|
exports.safeTruncate = safeTruncate;
|
|
87
75
|
exports.sessionStorage = exports.searchObjString = exports.searchObjDate = exports.searchConfigData = void 0;
|
|
@@ -100,7 +88,7 @@ exports.xhr = void 0;
|
|
|
100
88
|
|
|
101
89
|
var _enums = require("./enums");
|
|
102
90
|
|
|
103
|
-
var
|
|
91
|
+
var _timer = require("./timer");
|
|
104
92
|
|
|
105
93
|
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
106
94
|
|
|
@@ -624,7 +612,7 @@ var throttle = function throttle(fn, wait, options) {
|
|
|
624
612
|
}
|
|
625
613
|
|
|
626
614
|
inWaitPeriod = true;
|
|
627
|
-
pendingTimeoutId = setTimeout(function () {
|
|
615
|
+
pendingTimeoutId = (0, _timer.setTimeout)(function () {
|
|
628
616
|
if (needTrailingExecution && pendingExecutionWithParameters) {
|
|
629
617
|
fn.apply(context, pendingExecutionWithParameters);
|
|
630
618
|
}
|
|
@@ -634,7 +622,7 @@ var throttle = function throttle(fn, wait, options) {
|
|
|
634
622
|
}, wait);
|
|
635
623
|
},
|
|
636
624
|
cancel: function cancel() {
|
|
637
|
-
clearTimeout(pendingTimeoutId);
|
|
625
|
+
(0, _timer.clearTimeout)(pendingTimeoutId);
|
|
638
626
|
inWaitPeriod = false;
|
|
639
627
|
pendingExecutionWithParameters = undefined;
|
|
640
628
|
}
|
|
@@ -1003,129 +991,6 @@ function elementMatches(element, selector) {
|
|
|
1003
991
|
return false;
|
|
1004
992
|
}
|
|
1005
993
|
|
|
1006
|
-
var addEvent = function addEvent() {
|
|
1007
|
-
function fixEvent(event) {
|
|
1008
|
-
if (event) {
|
|
1009
|
-
event.preventDefault = fixEvent.preventDefault;
|
|
1010
|
-
event.stopPropagation = fixEvent.stopPropagation;
|
|
1011
|
-
event._getPath = fixEvent._getPath;
|
|
1012
|
-
}
|
|
1013
|
-
|
|
1014
|
-
return event;
|
|
1015
|
-
}
|
|
1016
|
-
|
|
1017
|
-
fixEvent._getPath = function () {
|
|
1018
|
-
var ev = this;
|
|
1019
|
-
|
|
1020
|
-
var polyfill = function polyfill() {
|
|
1021
|
-
try {
|
|
1022
|
-
var element = ev.target;
|
|
1023
|
-
var pathArr = [element];
|
|
1024
|
-
|
|
1025
|
-
if (element === null || element.parentElement === null) {
|
|
1026
|
-
return [];
|
|
1027
|
-
}
|
|
1028
|
-
|
|
1029
|
-
while (element.parentElement !== null) {
|
|
1030
|
-
element = element.parentElement;
|
|
1031
|
-
pathArr.unshift(element);
|
|
1032
|
-
}
|
|
1033
|
-
|
|
1034
|
-
return pathArr;
|
|
1035
|
-
} catch (error) {
|
|
1036
|
-
return [];
|
|
1037
|
-
}
|
|
1038
|
-
};
|
|
1039
|
-
|
|
1040
|
-
return this.path || this.composedPath() && this.composedPath() || polyfill();
|
|
1041
|
-
};
|
|
1042
|
-
|
|
1043
|
-
fixEvent.preventDefault = function () {
|
|
1044
|
-
this.returnValue = false;
|
|
1045
|
-
};
|
|
1046
|
-
|
|
1047
|
-
fixEvent.stopPropagation = function () {
|
|
1048
|
-
this.cancelBubble = true;
|
|
1049
|
-
};
|
|
1050
|
-
|
|
1051
|
-
var register_event = function register_event(element, type, handle) {
|
|
1052
|
-
if (element && element.addEventListener) {
|
|
1053
|
-
element.addEventListener(type, function (e) {
|
|
1054
|
-
e._getPath = fixEvent._getPath;
|
|
1055
|
-
handler.call(this, e);
|
|
1056
|
-
}, false);
|
|
1057
|
-
} else {
|
|
1058
|
-
var ontype = 'on' + type;
|
|
1059
|
-
var old_handler = element[ontype];
|
|
1060
|
-
element[ontype] = makeHandler(element, handler, old_handler);
|
|
1061
|
-
}
|
|
1062
|
-
};
|
|
1063
|
-
|
|
1064
|
-
function makeHandler(element, new_handler, old_handlers) {
|
|
1065
|
-
var handler = function handler(event) {
|
|
1066
|
-
event = event || fixEvent(window.event);
|
|
1067
|
-
|
|
1068
|
-
if (!event) {
|
|
1069
|
-
return undefined;
|
|
1070
|
-
}
|
|
1071
|
-
|
|
1072
|
-
event.target = event.srcElement;
|
|
1073
|
-
var ret = true;
|
|
1074
|
-
var old_result, new_result;
|
|
1075
|
-
|
|
1076
|
-
if (typeof old_handlers === 'function') {
|
|
1077
|
-
old_result = old_handlers(event);
|
|
1078
|
-
}
|
|
1079
|
-
|
|
1080
|
-
new_result = new_handler.call(element, event);
|
|
1081
|
-
|
|
1082
|
-
if (false === old_result || false === new_result) {
|
|
1083
|
-
ret = false;
|
|
1084
|
-
}
|
|
1085
|
-
|
|
1086
|
-
return ret;
|
|
1087
|
-
};
|
|
1088
|
-
|
|
1089
|
-
return handler;
|
|
1090
|
-
}
|
|
1091
|
-
|
|
1092
|
-
register_event.apply(null, arguments);
|
|
1093
|
-
};
|
|
1094
|
-
|
|
1095
|
-
exports.addEvent = addEvent;
|
|
1096
|
-
|
|
1097
|
-
var addHashEvent = function addHashEvent(callback) {
|
|
1098
|
-
var hashEvent = 'pushState' in window.history ? 'popstate' : 'hashchange';
|
|
1099
|
-
addEvent(window, hashEvent, callback);
|
|
1100
|
-
};
|
|
1101
|
-
|
|
1102
|
-
exports.addHashEvent = addHashEvent;
|
|
1103
|
-
|
|
1104
|
-
var addSinglePageEvent = function addSinglePageEvent(callback) {
|
|
1105
|
-
var current_url = location.href;
|
|
1106
|
-
var historyPushState = window.history.pushState;
|
|
1107
|
-
var historyReplaceState = window.history.replaceState;
|
|
1108
|
-
|
|
1109
|
-
window.history.pushState = function () {
|
|
1110
|
-
historyPushState.apply(window.history, arguments);
|
|
1111
|
-
callback(current_url);
|
|
1112
|
-
current_url = location.href;
|
|
1113
|
-
};
|
|
1114
|
-
|
|
1115
|
-
window.history.replaceState = function () {
|
|
1116
|
-
historyReplaceState.apply(window.history, arguments);
|
|
1117
|
-
callback(current_url);
|
|
1118
|
-
current_url = location.href;
|
|
1119
|
-
};
|
|
1120
|
-
|
|
1121
|
-
var singlePageEvent = historyPushState ? 'popstate' : 'hashchange';
|
|
1122
|
-
addEvent(window, singlePageEvent, function () {
|
|
1123
|
-
callback(current_url);
|
|
1124
|
-
current_url = location.href;
|
|
1125
|
-
});
|
|
1126
|
-
};
|
|
1127
|
-
|
|
1128
|
-
exports.addSinglePageEvent = addSinglePageEvent;
|
|
1129
994
|
var cookie = {
|
|
1130
995
|
get: function get(name) {
|
|
1131
996
|
var nameEQ = name + '=';
|
|
@@ -1320,13 +1185,13 @@ var ajax = function ajax(para) {
|
|
|
1320
1185
|
if (_typeof(g) === 'object' && 'timeout' in g) {
|
|
1321
1186
|
g.timeout = para.timeout;
|
|
1322
1187
|
} else {
|
|
1323
|
-
setTimeout(function () {
|
|
1188
|
+
(0, _timer.setTimeout)(function () {
|
|
1324
1189
|
g.abort();
|
|
1325
1190
|
}, para.timeout + 500);
|
|
1326
1191
|
}
|
|
1327
1192
|
} catch (e) {
|
|
1328
1193
|
try {
|
|
1329
|
-
setTimeout(function () {
|
|
1194
|
+
(0, _timer.setTimeout)(function () {
|
|
1330
1195
|
g.abort();
|
|
1331
1196
|
}, para.timeout + 500);
|
|
1332
1197
|
} catch (e2) {}
|
|
@@ -1830,55 +1695,6 @@ var typeDecide = function typeDecide(o, type) {
|
|
|
1830
1695
|
|
|
1831
1696
|
exports.typeDecide = typeDecide;
|
|
1832
1697
|
|
|
1833
|
-
function jsonStringify(value, replacer, space) {
|
|
1834
|
-
if (value === null || value === undefined) {
|
|
1835
|
-
return JSON.stringify(value);
|
|
1836
|
-
}
|
|
1837
|
-
|
|
1838
|
-
var originalToJSON = [false, undefined];
|
|
1839
|
-
|
|
1840
|
-
if (hasToJSON(value)) {
|
|
1841
|
-
// We need to add a flag and not rely on the truthiness of value.toJSON
|
|
1842
|
-
// because it can be set but undefined and that's actually significant.
|
|
1843
|
-
originalToJSON = [true, value.toJSON];
|
|
1844
|
-
delete value.toJSON;
|
|
1845
|
-
}
|
|
1846
|
-
|
|
1847
|
-
var originalProtoToJSON = [false, undefined];
|
|
1848
|
-
var prototype;
|
|
1849
|
-
|
|
1850
|
-
if (_typeof(value) === 'object') {
|
|
1851
|
-
prototype = Object.getPrototypeOf(value);
|
|
1852
|
-
|
|
1853
|
-
if (hasToJSON(prototype)) {
|
|
1854
|
-
originalProtoToJSON = [true, prototype.toJSON];
|
|
1855
|
-
delete prototype.toJSON;
|
|
1856
|
-
}
|
|
1857
|
-
}
|
|
1858
|
-
|
|
1859
|
-
var result;
|
|
1860
|
-
|
|
1861
|
-
try {
|
|
1862
|
-
result = JSON.stringify(value, undefined, space);
|
|
1863
|
-
} catch (e) {
|
|
1864
|
-
result = '<error: unable to serialize object>';
|
|
1865
|
-
} finally {
|
|
1866
|
-
if (originalToJSON[0]) {
|
|
1867
|
-
value.toJSON = originalToJSON[1];
|
|
1868
|
-
}
|
|
1869
|
-
|
|
1870
|
-
if (originalProtoToJSON[0]) {
|
|
1871
|
-
prototype.toJSON = originalProtoToJSON[1];
|
|
1872
|
-
}
|
|
1873
|
-
}
|
|
1874
|
-
|
|
1875
|
-
return result;
|
|
1876
|
-
}
|
|
1877
|
-
|
|
1878
|
-
function hasToJSON(value) {
|
|
1879
|
-
return _typeof(value) === 'object' && value !== null && value.hasOwnProperty('toJSON');
|
|
1880
|
-
}
|
|
1881
|
-
|
|
1882
1698
|
function noop() {}
|
|
1883
1699
|
|
|
1884
1700
|
var ONE_SECOND = 1000;
|
|
@@ -1890,16 +1706,12 @@ exports.ONE_HOUR = ONE_HOUR;
|
|
|
1890
1706
|
var ONE_DAY = 24 * ONE_HOUR;
|
|
1891
1707
|
exports.ONE_DAY = ONE_DAY;
|
|
1892
1708
|
var ONE_YEAR = 365 * ONE_DAY;
|
|
1893
|
-
exports.ONE_YEAR = ONE_YEAR;
|
|
1894
|
-
var ONE_KIBI_BYTE = 1024;
|
|
1895
|
-
exports.ONE_KIBI_BYTE = ONE_KIBI_BYTE;
|
|
1896
|
-
var ONE_MEBI_BYTE = 1024 * ONE_KIBI_BYTE;
|
|
1897
1709
|
/**
|
|
1898
1710
|
* Return true if the draw is successful
|
|
1899
1711
|
* @param threshold between 0 and 100
|
|
1900
1712
|
*/
|
|
1901
1713
|
|
|
1902
|
-
exports.
|
|
1714
|
+
exports.ONE_YEAR = ONE_YEAR;
|
|
1903
1715
|
|
|
1904
1716
|
function performDraw(threshold) {
|
|
1905
1717
|
return threshold !== 0 && Math.random() * 100 <= threshold;
|
|
@@ -2063,98 +1875,11 @@ function safeTruncate(candidate, length) {
|
|
|
2063
1875
|
return candidate.slice(0, length);
|
|
2064
1876
|
}
|
|
2065
1877
|
|
|
2066
|
-
function addEventListener(eventTarget, event, listener, options) {
|
|
2067
|
-
return addEventListeners(eventTarget, [event], listener, options);
|
|
2068
|
-
}
|
|
2069
|
-
/**
|
|
2070
|
-
* Add event listeners to an event emitter object (Window, Element, mock object...). This provides
|
|
2071
|
-
* a few conveniences compared to using `element.addEventListener` directly:
|
|
2072
|
-
*
|
|
2073
|
-
* * supports IE11 by:
|
|
2074
|
-
* * using an option object only if needed
|
|
2075
|
-
* * emulating the `once` option
|
|
2076
|
-
*
|
|
2077
|
-
* * wraps the listener with a `monitor` function
|
|
2078
|
-
*
|
|
2079
|
-
* * returns a `stop` function to remove the listener
|
|
2080
|
-
*
|
|
2081
|
-
* * with `once: true`, the listener will be called at most once, even if different events are
|
|
2082
|
-
* listened
|
|
2083
|
-
*/
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
function addEventListeners(eventTarget, events, listener, options) {
|
|
2087
|
-
var wrappedListener = options && options.once ? function (event) {
|
|
2088
|
-
stop();
|
|
2089
|
-
listener(event);
|
|
2090
|
-
} : listener;
|
|
2091
|
-
options = options && options.passive ? {
|
|
2092
|
-
capture: options.capture,
|
|
2093
|
-
passive: options.passive
|
|
2094
|
-
} : options && options.capture;
|
|
2095
|
-
var add = (0, _getZoneJsOriginalValue.getZoneJsOriginalValue)(eventTarget, 'addEventListener');
|
|
2096
|
-
each(events, function (event) {
|
|
2097
|
-
add.call(eventTarget, event, wrappedListener, options);
|
|
2098
|
-
});
|
|
2099
|
-
|
|
2100
|
-
var stop = function stop() {
|
|
2101
|
-
var remove = (0, _getZoneJsOriginalValue.getZoneJsOriginalValue)(eventTarget, 'removeEventListener');
|
|
2102
|
-
each(events, function (event) {
|
|
2103
|
-
remove.call(eventTarget, event, wrappedListener, options);
|
|
2104
|
-
});
|
|
2105
|
-
};
|
|
2106
|
-
|
|
2107
|
-
return {
|
|
2108
|
-
stop: stop
|
|
2109
|
-
};
|
|
2110
|
-
}
|
|
2111
|
-
|
|
2112
1878
|
function includes(candidate, search) {
|
|
2113
1879
|
// tslint:disable-next-line: no-unsafe-any
|
|
2114
1880
|
return candidate.indexOf(search) !== -1;
|
|
2115
1881
|
}
|
|
2116
1882
|
|
|
2117
|
-
function createContextManager() {
|
|
2118
|
-
var context = {};
|
|
2119
|
-
return {
|
|
2120
|
-
get: function get() {
|
|
2121
|
-
return context;
|
|
2122
|
-
},
|
|
2123
|
-
add: function add(key, value) {
|
|
2124
|
-
if (isString(key)) {
|
|
2125
|
-
context[key] = value;
|
|
2126
|
-
} else {
|
|
2127
|
-
console.error('key 需要传递字符串类型');
|
|
2128
|
-
}
|
|
2129
|
-
},
|
|
2130
|
-
remove: function remove(key) {
|
|
2131
|
-
delete context[key];
|
|
2132
|
-
},
|
|
2133
|
-
set: function set(newContext) {
|
|
2134
|
-
if (isObject(newContext)) {
|
|
2135
|
-
context = newContext;
|
|
2136
|
-
} else {
|
|
2137
|
-
console.error('content 需要传递对象类型数据');
|
|
2138
|
-
}
|
|
2139
|
-
},
|
|
2140
|
-
getContext: function getContext() {
|
|
2141
|
-
return deepClone(context);
|
|
2142
|
-
},
|
|
2143
|
-
setContext: function setContext(newContext) {
|
|
2144
|
-
context = deepClone(newContext);
|
|
2145
|
-
},
|
|
2146
|
-
setContextProperty: function setContextProperty(key, property) {
|
|
2147
|
-
context[key] = deepClone(property);
|
|
2148
|
-
},
|
|
2149
|
-
removeContextProperty: function removeContextProperty(key) {
|
|
2150
|
-
delete context[key];
|
|
2151
|
-
},
|
|
2152
|
-
clearContext: function clearContext() {
|
|
2153
|
-
context = {};
|
|
2154
|
-
}
|
|
2155
|
-
};
|
|
2156
|
-
}
|
|
2157
|
-
|
|
2158
1883
|
function find(array, predicate) {
|
|
2159
1884
|
for (var i = 0; i < array.length; i += 1) {
|
|
2160
1885
|
var item = array[i];
|
|
@@ -2257,41 +1982,6 @@ function toSnakeCase(word) {
|
|
|
2257
1982
|
}).replace(/-/g, '_');
|
|
2258
1983
|
}
|
|
2259
1984
|
|
|
2260
|
-
function escapeRowData(str) {
|
|
2261
|
-
if (_typeof(str) === 'object' && str) {
|
|
2262
|
-
str = jsonStringify(str);
|
|
2263
|
-
} else if (!isString(str)) {
|
|
2264
|
-
return str;
|
|
2265
|
-
}
|
|
2266
|
-
|
|
2267
|
-
var reg = /[\s=,"]/g;
|
|
2268
|
-
return String(str).replace(reg, function (word) {
|
|
2269
|
-
return '\\' + word;
|
|
2270
|
-
});
|
|
2271
|
-
}
|
|
2272
|
-
|
|
2273
|
-
function escapeJsonValue(value) {
|
|
2274
|
-
if (isString(value)) {
|
|
2275
|
-
return value;
|
|
2276
|
-
} else {
|
|
2277
|
-
return jsonStringify(value);
|
|
2278
|
-
}
|
|
2279
|
-
}
|
|
2280
|
-
|
|
2281
|
-
function escapeFieldValueStr(str) {
|
|
2282
|
-
return '"' + str.replace(/\\/g, '\\\\').replace(/[\\]*"/g, '"').replace(/"/g, '\\"') + '"';
|
|
2283
|
-
}
|
|
2284
|
-
|
|
2285
|
-
function escapeRowField(value) {
|
|
2286
|
-
if (_typeof(value) === 'object' && value) {
|
|
2287
|
-
return escapeFieldValueStr(jsonStringify(value));
|
|
2288
|
-
} else if (isString(value)) {
|
|
2289
|
-
return escapeFieldValueStr(value);
|
|
2290
|
-
} else {
|
|
2291
|
-
return value;
|
|
2292
|
-
}
|
|
2293
|
-
}
|
|
2294
|
-
|
|
2295
1985
|
function isNullUndefinedDefaultValue(data, defaultValue) {
|
|
2296
1986
|
if (data !== null && data !== void 0) {
|
|
2297
1987
|
return data;
|
|
@@ -2300,17 +1990,6 @@ function isNullUndefinedDefaultValue(data, defaultValue) {
|
|
|
2300
1990
|
}
|
|
2301
1991
|
}
|
|
2302
1992
|
|
|
2303
|
-
function runOnReadyState(expectedReadyState, callback) {
|
|
2304
|
-
if (document.readyState === expectedReadyState || document.readyState === 'complete') {
|
|
2305
|
-
callback();
|
|
2306
|
-
} else {
|
|
2307
|
-
var eventName = expectedReadyState === 'complete' ? _enums.DOM_EVENT.LOAD : _enums.DOM_EVENT.DOM_CONTENT_LOADED;
|
|
2308
|
-
addEventListener(window, eventName, callback, {
|
|
2309
|
-
once: true
|
|
2310
|
-
});
|
|
2311
|
-
}
|
|
2312
|
-
}
|
|
2313
|
-
|
|
2314
1993
|
function requestIdleCallback(callback, opts) {
|
|
2315
1994
|
// Use 'requestIdleCallback' when available: it will throttle the mutation processing if the
|
|
2316
1995
|
// browser is busy rendering frames (ex: when frames are below 60fps). When not available, the
|
package/cjs/index.js
CHANGED
|
@@ -82,6 +82,19 @@ Object.keys(_errorTools).forEach(function (key) {
|
|
|
82
82
|
});
|
|
83
83
|
});
|
|
84
84
|
|
|
85
|
+
var _byteUtils = require("./helper/byteUtils");
|
|
86
|
+
|
|
87
|
+
Object.keys(_byteUtils).forEach(function (key) {
|
|
88
|
+
if (key === "default" || key === "__esModule") return;
|
|
89
|
+
if (key in exports && exports[key] === _byteUtils[key]) return;
|
|
90
|
+
Object.defineProperty(exports, key, {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: function get() {
|
|
93
|
+
return _byteUtils[key];
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
|
|
85
98
|
var _trackRuntimeError = require("./error/trackRuntimeError");
|
|
86
99
|
|
|
87
100
|
Object.keys(_trackRuntimeError).forEach(function (key) {
|
|
@@ -251,6 +264,19 @@ Object.keys(_getZoneJsOriginalValue).forEach(function (key) {
|
|
|
251
264
|
});
|
|
252
265
|
});
|
|
253
266
|
|
|
267
|
+
var _timer = require("./helper/timer");
|
|
268
|
+
|
|
269
|
+
Object.keys(_timer).forEach(function (key) {
|
|
270
|
+
if (key === "default" || key === "__esModule") return;
|
|
271
|
+
if (key in exports && exports[key] === _timer[key]) return;
|
|
272
|
+
Object.defineProperty(exports, key, {
|
|
273
|
+
enumerable: true,
|
|
274
|
+
get: function get() {
|
|
275
|
+
return _timer[key];
|
|
276
|
+
}
|
|
277
|
+
});
|
|
278
|
+
});
|
|
279
|
+
|
|
254
280
|
var _readBytesFromStream = require("./helper/readBytesFromStream");
|
|
255
281
|
|
|
256
282
|
Object.keys(_readBytesFromStream).forEach(function (key) {
|
|
@@ -368,6 +394,32 @@ Object.keys(_htmlDomUtils).forEach(function (key) {
|
|
|
368
394
|
});
|
|
369
395
|
});
|
|
370
396
|
|
|
397
|
+
var _addEventListener = require("./browser/addEventListener");
|
|
398
|
+
|
|
399
|
+
Object.keys(_addEventListener).forEach(function (key) {
|
|
400
|
+
if (key === "default" || key === "__esModule") return;
|
|
401
|
+
if (key in exports && exports[key] === _addEventListener[key]) return;
|
|
402
|
+
Object.defineProperty(exports, key, {
|
|
403
|
+
enumerable: true,
|
|
404
|
+
get: function get() {
|
|
405
|
+
return _addEventListener[key];
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
var _runOnReadyState = require("./browser/runOnReadyState");
|
|
411
|
+
|
|
412
|
+
Object.keys(_runOnReadyState).forEach(function (key) {
|
|
413
|
+
if (key === "default" || key === "__esModule") return;
|
|
414
|
+
if (key in exports && exports[key] === _runOnReadyState[key]) return;
|
|
415
|
+
Object.defineProperty(exports, key, {
|
|
416
|
+
enumerable: true,
|
|
417
|
+
get: function get() {
|
|
418
|
+
return _runOnReadyState[key];
|
|
419
|
+
}
|
|
420
|
+
});
|
|
421
|
+
});
|
|
422
|
+
|
|
371
423
|
var _dataMap = require("./dataMap");
|
|
372
424
|
|
|
373
425
|
Object.keys(_dataMap).forEach(function (key) {
|
|
@@ -470,4 +522,69 @@ Object.keys(_syntheticsWorkerValues).forEach(function (key) {
|
|
|
470
522
|
return _syntheticsWorkerValues[key];
|
|
471
523
|
}
|
|
472
524
|
});
|
|
525
|
+
});
|
|
526
|
+
|
|
527
|
+
var _contextManager = require("./helper/serialisation/contextManager");
|
|
528
|
+
|
|
529
|
+
Object.keys(_contextManager).forEach(function (key) {
|
|
530
|
+
if (key === "default" || key === "__esModule") return;
|
|
531
|
+
if (key in exports && exports[key] === _contextManager[key]) return;
|
|
532
|
+
Object.defineProperty(exports, key, {
|
|
533
|
+
enumerable: true,
|
|
534
|
+
get: function get() {
|
|
535
|
+
return _contextManager[key];
|
|
536
|
+
}
|
|
537
|
+
});
|
|
538
|
+
});
|
|
539
|
+
|
|
540
|
+
var _heavyCustomerDataWarning = require("./helper/serialisation/heavyCustomerDataWarning");
|
|
541
|
+
|
|
542
|
+
Object.keys(_heavyCustomerDataWarning).forEach(function (key) {
|
|
543
|
+
if (key === "default" || key === "__esModule") return;
|
|
544
|
+
if (key in exports && exports[key] === _heavyCustomerDataWarning[key]) return;
|
|
545
|
+
Object.defineProperty(exports, key, {
|
|
546
|
+
enumerable: true,
|
|
547
|
+
get: function get() {
|
|
548
|
+
return _heavyCustomerDataWarning[key];
|
|
549
|
+
}
|
|
550
|
+
});
|
|
551
|
+
});
|
|
552
|
+
|
|
553
|
+
var _jsonStringify = require("./helper/serialisation/jsonStringify");
|
|
554
|
+
|
|
555
|
+
Object.keys(_jsonStringify).forEach(function (key) {
|
|
556
|
+
if (key === "default" || key === "__esModule") return;
|
|
557
|
+
if (key in exports && exports[key] === _jsonStringify[key]) return;
|
|
558
|
+
Object.defineProperty(exports, key, {
|
|
559
|
+
enumerable: true,
|
|
560
|
+
get: function get() {
|
|
561
|
+
return _jsonStringify[key];
|
|
562
|
+
}
|
|
563
|
+
});
|
|
564
|
+
});
|
|
565
|
+
|
|
566
|
+
var _rowData = require("./helper/serialisation/rowData");
|
|
567
|
+
|
|
568
|
+
Object.keys(_rowData).forEach(function (key) {
|
|
569
|
+
if (key === "default" || key === "__esModule") return;
|
|
570
|
+
if (key in exports && exports[key] === _rowData[key]) return;
|
|
571
|
+
Object.defineProperty(exports, key, {
|
|
572
|
+
enumerable: true,
|
|
573
|
+
get: function get() {
|
|
574
|
+
return _rowData[key];
|
|
575
|
+
}
|
|
576
|
+
});
|
|
577
|
+
});
|
|
578
|
+
|
|
579
|
+
var _user = require("./user");
|
|
580
|
+
|
|
581
|
+
Object.keys(_user).forEach(function (key) {
|
|
582
|
+
if (key === "default" || key === "__esModule") return;
|
|
583
|
+
if (key in exports && exports[key] === _user[key]) return;
|
|
584
|
+
Object.defineProperty(exports, key, {
|
|
585
|
+
enumerable: true,
|
|
586
|
+
get: function get() {
|
|
587
|
+
return _user[key];
|
|
588
|
+
}
|
|
589
|
+
});
|
|
473
590
|
});
|
package/cjs/init.js
CHANGED
|
@@ -28,13 +28,13 @@ function makePublicApi(stub) {
|
|
|
28
28
|
}
|
|
29
29
|
}); // Add an "hidden" property to set debug mode. We define it that way to hide it
|
|
30
30
|
// as much as possible but of course it's not a real protection.
|
|
31
|
+
// Object.defineProperty(publicApi, '_setDebug', {
|
|
32
|
+
// get: function () {
|
|
33
|
+
// return setDebugMode
|
|
34
|
+
// },
|
|
35
|
+
// enumerable: false
|
|
36
|
+
// })
|
|
31
37
|
|
|
32
|
-
Object.defineProperty(publicApi, '_setDebug', {
|
|
33
|
-
get: function get() {
|
|
34
|
-
return setDebugMode;
|
|
35
|
-
},
|
|
36
|
-
enumerable: false
|
|
37
|
-
});
|
|
38
38
|
return publicApi;
|
|
39
39
|
}
|
|
40
40
|
|
|
@@ -12,6 +12,8 @@ var _observable = require("../helper/observable");
|
|
|
12
12
|
|
|
13
13
|
var _tools = require("../helper/tools");
|
|
14
14
|
|
|
15
|
+
var _addEventListener2 = require("../browser/addEventListener");
|
|
16
|
+
|
|
15
17
|
var _enums = require("../helper/enums");
|
|
16
18
|
|
|
17
19
|
var RawReportType = {
|
|
@@ -69,7 +71,7 @@ function createCspViolationReportObservable() {
|
|
|
69
71
|
observable.notify(buildRawReportFromCspViolation(event));
|
|
70
72
|
};
|
|
71
73
|
|
|
72
|
-
var _addEventListener = (0,
|
|
74
|
+
var _addEventListener = (0, _addEventListener2.addEventListener)(document, _enums.DOM_EVENT.SECURITY_POLICY_VIOLATION, handleCspViolation);
|
|
73
75
|
|
|
74
76
|
return _addEventListener.stop;
|
|
75
77
|
});
|
|
@@ -89,7 +91,7 @@ function buildRawReportFromReport(report) {
|
|
|
89
91
|
|
|
90
92
|
function buildRawReportFromCspViolation(event) {
|
|
91
93
|
var type = RawReportType.cspViolation;
|
|
92
|
-
var message = '
|
|
94
|
+
var message = "'" + event.blockedURI + "' blocked by '" + event.effectiveDirective + "' directive";
|
|
93
95
|
return {
|
|
94
96
|
type: RawReportType.cspViolation,
|
|
95
97
|
subtype: event.effectiveDirective,
|
|
@@ -15,6 +15,8 @@ var _tools = require("../helper/tools");
|
|
|
15
15
|
|
|
16
16
|
var _sessionConstants = require("./sessionConstants");
|
|
17
17
|
|
|
18
|
+
var _timer = require("../helper/timer");
|
|
19
|
+
|
|
18
20
|
var SESSION_ENTRY_REGEXP = /^([a-z]+)=([a-z0-9-]+)$/;
|
|
19
21
|
var SESSION_ENTRY_SEPARATOR = '&';
|
|
20
22
|
var SESSION_COOKIE_NAME = '_dataflux_s'; // arbitrary values
|
|
@@ -122,7 +124,7 @@ function isCookieLockEnabled() {
|
|
|
122
124
|
}
|
|
123
125
|
|
|
124
126
|
function retryLater(operations, currentNumberOfRetries) {
|
|
125
|
-
setTimeout(function () {
|
|
127
|
+
(0, _timer.setTimeout)(function () {
|
|
126
128
|
withCookieLockAccess(operations, currentNumberOfRetries + 1);
|
|
127
129
|
}, LOCK_RETRY_DELAY);
|
|
128
130
|
}
|