@cloudcare/browser-core 3.2.19 → 3.2.24
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 +4 -2
- package/cjs/browser/addEventListener.js.map +1 -1
- package/cjs/browser/asyncClocks.js +68 -0
- package/cjs/browser/asyncClocks.js.map +1 -0
- package/cjs/browser/pageExitObservable.js +1 -2
- package/cjs/browser/pageExitObservable.js.map +1 -1
- package/cjs/configuration/configuration.js +1 -2
- package/cjs/configuration/configuration.js.map +1 -1
- package/cjs/configuration/remoteConfiguration.js +214 -0
- package/cjs/configuration/remoteConfiguration.js.map +1 -0
- package/cjs/configuration/transportConfiguration.js +1 -0
- package/cjs/configuration/transportConfiguration.js.map +1 -1
- package/cjs/dataMap.js +4 -7
- package/cjs/dataMap.js.map +1 -1
- package/cjs/helper/byteUtils.js +2 -4
- package/cjs/helper/byteUtils.js.map +1 -1
- package/cjs/helper/createEventRateLimiter.js.map +1 -1
- package/cjs/helper/deviceInfo.js +11 -7
- package/cjs/helper/deviceInfo.js.map +1 -1
- package/cjs/helper/display.js +4 -8
- package/cjs/helper/display.js.map +1 -1
- package/cjs/helper/encoder.js.map +1 -1
- package/cjs/helper/enums.js +11 -22
- package/cjs/helper/enums.js.map +1 -1
- package/cjs/helper/errorTools.js +2 -4
- package/cjs/helper/errorTools.js.map +1 -1
- package/cjs/helper/eventEmitter.js +1 -2
- package/cjs/helper/eventEmitter.js.map +1 -1
- package/cjs/helper/getZoneJsOriginalValue.js +2 -1
- package/cjs/helper/getZoneJsOriginalValue.js.map +1 -1
- package/cjs/helper/instrumentMethod.js.map +1 -1
- package/cjs/helper/lifeCycle.js +1 -2
- package/cjs/helper/lifeCycle.js.map +1 -1
- package/cjs/helper/limitModification.js +7 -7
- package/cjs/helper/limitModification.js.map +1 -1
- package/cjs/helper/mobileUtil.js +5 -10
- package/cjs/helper/mobileUtil.js.map +1 -1
- package/cjs/helper/observable.js +1 -2
- package/cjs/helper/observable.js.map +1 -1
- package/cjs/helper/requestIdleCallback.js +1 -2
- package/cjs/helper/requestIdleCallback.js.map +1 -1
- package/cjs/helper/sanitize.js +1 -1
- package/cjs/helper/sanitize.js.map +1 -1
- package/cjs/helper/serialisation/const.js +1 -2
- package/cjs/helper/serialisation/const.js.map +1 -1
- package/cjs/helper/serialisation/contextManager.js +15 -15
- package/cjs/helper/serialisation/contextManager.js.map +1 -1
- package/cjs/helper/serialisation/customerDataTracker.js +4 -8
- package/cjs/helper/serialisation/customerDataTracker.js.map +1 -1
- package/cjs/helper/serialisation/jsonStringify.js +1 -1
- package/cjs/helper/serialisation/jsonStringify.js.map +1 -1
- package/cjs/helper/serialisation/rowData.js +1 -1
- package/cjs/helper/serialisation/rowData.js.map +1 -1
- package/cjs/helper/taskQueue.js +1 -2
- package/cjs/helper/taskQueue.js.map +1 -1
- package/cjs/helper/tools.js +74 -145
- package/cjs/helper/tools.js.map +1 -1
- package/cjs/helper/valueHistory.js +20 -8
- package/cjs/helper/valueHistory.js.map +1 -1
- package/cjs/index.js +12 -0
- package/cjs/index.js.map +1 -1
- package/cjs/init.js +1 -1
- package/cjs/init.js.map +1 -1
- package/cjs/report/reportObservable.js +1 -2
- package/cjs/report/reportObservable.js.map +1 -1
- package/cjs/session/sessionConstants.js +3 -6
- package/cjs/session/sessionConstants.js.map +1 -1
- package/cjs/session/sessionInCookie.js.map +1 -1
- package/cjs/session/sessionManagement.js +1 -2
- package/cjs/session/sessionManagement.js.map +1 -1
- package/cjs/session/sessionState.js +6 -7
- package/cjs/session/sessionState.js.map +1 -1
- package/cjs/session/sessionStore.js +2 -3
- package/cjs/session/sessionStore.js.map +1 -1
- package/cjs/session/sessionStoreOperations.js +6 -8
- package/cjs/session/sessionStoreOperations.js.map +1 -1
- package/cjs/synthetics/syntheticsWorkerValues.js +3 -6
- package/cjs/synthetics/syntheticsWorkerValues.js.map +1 -1
- package/cjs/telemetry/telemetry.js +1 -2
- package/cjs/telemetry/telemetry.js.map +1 -1
- package/cjs/telemetry/types.js +2 -4
- package/cjs/telemetry/types.js.map +1 -1
- package/cjs/tracekit/computeStackTrace.js +2 -4
- package/cjs/tracekit/computeStackTrace.js.map +1 -1
- package/cjs/tracekit/tracekit.js.map +1 -1
- package/cjs/transport/batch.js +1 -3
- package/cjs/transport/batch.js.map +1 -1
- package/cjs/transport/eventBridge.js +36 -3
- package/cjs/transport/eventBridge.js.map +1 -1
- package/cjs/transport/flushController.js.map +1 -1
- package/cjs/transport/httpRequest.js.map +1 -1
- package/cjs/transport/index.js +12 -0
- package/cjs/transport/index.js.map +1 -1
- package/cjs/transport/sendWithRetryStrategy.js +5 -10
- package/cjs/transport/sendWithRetryStrategy.js.map +1 -1
- package/cjs/transport/startBatchWithReplica.js.map +1 -1
- package/esm/browser/addEventListener.js +4 -2
- package/esm/browser/addEventListener.js.map +1 -1
- package/esm/browser/asyncClocks.js +60 -0
- package/esm/browser/asyncClocks.js.map +1 -0
- package/esm/configuration/remoteConfiguration.js +205 -0
- package/esm/configuration/remoteConfiguration.js.map +1 -0
- package/esm/configuration/transportConfiguration.js +1 -1
- package/esm/configuration/transportConfiguration.js.map +1 -1
- package/esm/dataMap.js +1 -1
- package/esm/dataMap.js.map +1 -1
- package/esm/helper/createEventRateLimiter.js.map +1 -1
- package/esm/helper/deviceInfo.js +10 -5
- package/esm/helper/deviceInfo.js.map +1 -1
- package/esm/helper/encoder.js.map +1 -1
- package/esm/helper/eventEmitter.js.map +1 -1
- package/esm/helper/getZoneJsOriginalValue.js +2 -1
- package/esm/helper/getZoneJsOriginalValue.js.map +1 -1
- package/esm/helper/instrumentMethod.js.map +1 -1
- package/esm/helper/lifeCycle.js.map +1 -1
- package/esm/helper/limitModification.js +7 -7
- package/esm/helper/mobileUtil.js.map +1 -1
- package/esm/helper/observable.js.map +1 -1
- package/esm/helper/requestIdleCallback.js.map +1 -1
- package/esm/helper/sanitize.js +1 -1
- package/esm/helper/serialisation/contextManager.js +15 -15
- package/esm/helper/serialisation/contextManager.js.map +1 -1
- package/esm/helper/serialisation/customerDataTracker.js.map +1 -1
- package/esm/helper/serialisation/jsonStringify.js +1 -1
- package/esm/helper/serialisation/rowData.js +1 -1
- package/esm/helper/taskQueue.js.map +1 -1
- package/esm/helper/tools.js +10 -8
- package/esm/helper/tools.js.map +1 -1
- package/esm/helper/valueHistory.js +19 -6
- package/esm/helper/valueHistory.js.map +1 -1
- package/esm/index.js +1 -0
- package/esm/index.js.map +1 -1
- package/esm/init.js +1 -1
- package/esm/init.js.map +1 -1
- package/esm/session/sessionInCookie.js.map +1 -1
- package/esm/session/sessionManagement.js.map +1 -1
- package/esm/session/sessionState.js +5 -5
- package/esm/session/sessionStore.js +1 -1
- package/esm/session/sessionStore.js.map +1 -1
- package/esm/session/sessionStoreOperations.js +4 -4
- package/esm/session/sessionStoreOperations.js.map +1 -1
- package/esm/telemetry/telemetry.js.map +1 -1
- package/esm/tracekit/computeStackTrace.js +2 -4
- package/esm/tracekit/computeStackTrace.js.map +1 -1
- package/esm/tracekit/tracekit.js.map +1 -1
- package/esm/transport/batch.js +0 -1
- package/esm/transport/batch.js.map +1 -1
- package/esm/transport/eventBridge.js +34 -3
- package/esm/transport/eventBridge.js.map +1 -1
- package/esm/transport/flushController.js.map +1 -1
- package/esm/transport/httpRequest.js.map +1 -1
- package/esm/transport/index.js +1 -1
- package/esm/transport/index.js.map +1 -1
- package/esm/transport/sendWithRetryStrategy.js.map +1 -1
- package/esm/transport/startBatchWithReplica.js.map +1 -1
- package/package.json +24 -24
- package/src/browser/addEventListener.js +7 -2
- package/src/browser/asyncClocks.js +69 -0
- package/src/configuration/remoteConfiguration.js +213 -0
- package/src/configuration/transportConfiguration.js +1 -1
- package/src/dataMap.js +1 -0
- package/src/helper/deviceInfo.js +6 -1
- package/src/helper/getZoneJsOriginalValue.js +2 -1
- package/src/helper/valueHistory.js +18 -6
- package/src/index.js +1 -0
- package/src/session/sessionStore.js +1 -1
- package/src/session/sessionStoreOperations.js +4 -16
- package/src/tracekit/computeStackTrace.js +2 -1
- package/src/transport/eventBridge.js +56 -4
- package/src/transport/index.js +6 -1
- package/types/index.d.ts +8 -0
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
function _typeof(
|
|
2
|
-
function _slicedToArray(
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
3
3
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
-
function _unsupportedIterableToArray(
|
|
5
|
-
function _arrayLikeToArray(
|
|
6
|
-
function _iterableToArrayLimit(
|
|
7
|
-
function _arrayWithHoles(
|
|
8
|
-
function ownKeys(
|
|
9
|
-
function _objectSpread(
|
|
10
|
-
function _defineProperty(
|
|
11
|
-
function _toPropertyKey(
|
|
12
|
-
function _toPrimitive(
|
|
4
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
5
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
6
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
7
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
8
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
9
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
10
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
11
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
12
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
13
13
|
import { deepClone, getType } from '../tools';
|
|
14
14
|
import { sanitize } from '../sanitize';
|
|
15
15
|
import { Observable } from '../observable';
|
|
@@ -49,7 +49,7 @@ export function createContextManager() {
|
|
|
49
49
|
setContext: function setContext(newContext) {
|
|
50
50
|
if (getType(newContext) === 'object') {
|
|
51
51
|
context = sanitize(ensureProperties(newContext, propertiesConfig, name));
|
|
52
|
-
customerDataTracker === null || customerDataTracker === void 0
|
|
52
|
+
customerDataTracker === null || customerDataTracker === void 0 || customerDataTracker.updateCustomerData(context);
|
|
53
53
|
} else {
|
|
54
54
|
contextManager.clearContext();
|
|
55
55
|
}
|
|
@@ -57,18 +57,18 @@ export function createContextManager() {
|
|
|
57
57
|
},
|
|
58
58
|
setContextProperty: function setContextProperty(key, property) {
|
|
59
59
|
context[key] = sanitize(ensureProperties(_defineProperty({}, key, property), propertiesConfig, name)[key]);
|
|
60
|
-
customerDataTracker === null || customerDataTracker === void 0
|
|
60
|
+
customerDataTracker === null || customerDataTracker === void 0 || customerDataTracker.updateCustomerData(context);
|
|
61
61
|
changeObservable.notify();
|
|
62
62
|
},
|
|
63
63
|
removeContextProperty: function removeContextProperty(key) {
|
|
64
64
|
delete context[key];
|
|
65
|
-
customerDataTracker === null || customerDataTracker === void 0
|
|
65
|
+
customerDataTracker === null || customerDataTracker === void 0 || customerDataTracker.updateCustomerData(context);
|
|
66
66
|
ensureProperties(context, propertiesConfig, name);
|
|
67
67
|
changeObservable.notify();
|
|
68
68
|
},
|
|
69
69
|
clearContext: function clearContext() {
|
|
70
70
|
context = {};
|
|
71
|
-
customerDataTracker === null || customerDataTracker === void 0
|
|
71
|
+
customerDataTracker === null || customerDataTracker === void 0 || customerDataTracker.resetCustomerData();
|
|
72
72
|
changeObservable.notify();
|
|
73
73
|
},
|
|
74
74
|
changeObservable: changeObservable
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contextManager.js","names":["deepClone","getType","sanitize","Observable","display","ensureProperties","context","propertiesConfig","name","newContext","_objectSpread","_i","_Object$entries","Object","entries","length","_Object$entries$_i","_slicedToArray","key","_Object$entries$_i$","required","type","String","warn","concat","createContextManager","arguments","undefined","_ref","customerDataTracker","_ref$propertiesConfig","changeObservable","contextManager","getContext","setContext","updateCustomerData","clearContext","notify","setContextProperty","property","_defineProperty","removeContextProperty","resetCustomerData"],"sources":["../../../src/helper/serialisation/contextManager.js"],"sourcesContent":["import { deepClone, getType } from '../tools'\nimport { sanitize } from '../sanitize'\nimport { Observable } from '../observable'\nimport { display } from '../display'\n\nfunction ensureProperties(context, propertiesConfig, name) {\n const newContext = { ...context }\n\n for (const [key, { required, type }] of Object.entries(propertiesConfig)) {\n /**\n * Ensure specified properties are strings as defined here:\n */\n if (type === 'string' && key in newContext) {\n newContext[key] = String(newContext[key])\n }\n\n if (required && !(key in context)) {\n display.warn(\n `The property ${key} of ${name} context is required; context will not be sent to the intake.`\n )\n }\n }\n\n return newContext\n}\n\nexport function createContextManager(\n name = '',\n { customerDataTracker, propertiesConfig = {} } = {}\n) {\n let context = {}\n const changeObservable = new Observable()\n\n const contextManager = {\n getContext: () => deepClone(context),\n\n setContext: (newContext) => {\n if (getType(newContext) === 'object') {\n context = sanitize(ensureProperties(newContext, propertiesConfig, name))\n customerDataTracker?.updateCustomerData(context)\n } else {\n contextManager.clearContext()\n }\n changeObservable.notify()\n },\n\n setContextProperty: (key, property) => {\n context[key] = sanitize(\n ensureProperties({ [key]: property }, propertiesConfig, name)[key]\n )\n customerDataTracker?.updateCustomerData(context)\n changeObservable.notify()\n },\n\n removeContextProperty: (key) => {\n delete context[key]\n customerDataTracker?.updateCustomerData(context)\n ensureProperties(context, propertiesConfig, name)\n changeObservable.notify()\n },\n\n clearContext: () => {\n context = {}\n customerDataTracker?.resetCustomerData()\n changeObservable.notify()\n },\n\n changeObservable\n }\n return contextManager\n}\n"],"mappings":";;;;;;;;;;;;AAAA,SAASA,SAAS,EAAEC,OAAO,QAAQ,UAAU;AAC7C,SAASC,QAAQ,QAAQ,aAAa;AACtC,SAASC,UAAU,QAAQ,eAAe;AAC1C,SAASC,OAAO,QAAQ,YAAY;AAEpC,SAASC,gBAAgBA,CAACC,OAAO,EAAEC,gBAAgB,EAAEC,IAAI,EAAE;EACzD,IAAM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AAC,CAAC;EAEzC,IAAM6B,cAAc,GAAG;IACrBC,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"contextManager.js","names":["deepClone","getType","sanitize","Observable","display","ensureProperties","context","propertiesConfig","name","newContext","_objectSpread","_i","_Object$entries","Object","entries","length","_Object$entries$_i","_slicedToArray","key","_Object$entries$_i$","required","type","String","warn","concat","createContextManager","arguments","undefined","_ref","customerDataTracker","_ref$propertiesConfig","changeObservable","contextManager","getContext","setContext","updateCustomerData","clearContext","notify","setContextProperty","property","_defineProperty","removeContextProperty","resetCustomerData"],"sources":["../../../src/helper/serialisation/contextManager.js"],"sourcesContent":["import { deepClone, getType } from '../tools'\nimport { sanitize } from '../sanitize'\nimport { Observable } from '../observable'\nimport { display } from '../display'\n\nfunction ensureProperties(context, propertiesConfig, name) {\n const newContext = { ...context }\n\n for (const [key, { required, type }] of Object.entries(propertiesConfig)) {\n /**\n * Ensure specified properties are strings as defined here:\n */\n if (type === 'string' && key in newContext) {\n newContext[key] = String(newContext[key])\n }\n\n if (required && !(key in context)) {\n display.warn(\n `The property ${key} of ${name} context is required; context will not be sent to the intake.`\n )\n }\n }\n\n return newContext\n}\n\nexport function createContextManager(\n name = '',\n { customerDataTracker, propertiesConfig = {} } = {}\n) {\n let context = {}\n const changeObservable = new Observable()\n\n const contextManager = {\n getContext: () => deepClone(context),\n\n setContext: (newContext) => {\n if (getType(newContext) === 'object') {\n context = sanitize(ensureProperties(newContext, propertiesConfig, name))\n customerDataTracker?.updateCustomerData(context)\n } else {\n contextManager.clearContext()\n }\n changeObservable.notify()\n },\n\n setContextProperty: (key, property) => {\n context[key] = sanitize(\n ensureProperties({ [key]: property }, propertiesConfig, name)[key]\n )\n customerDataTracker?.updateCustomerData(context)\n changeObservable.notify()\n },\n\n removeContextProperty: (key) => {\n delete context[key]\n customerDataTracker?.updateCustomerData(context)\n ensureProperties(context, propertiesConfig, name)\n changeObservable.notify()\n },\n\n clearContext: () => {\n context = {}\n customerDataTracker?.resetCust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,SAAvBA,qBAAqBA,CAAGvB,GAAG,EAAK;MAC9B,OAAOZ,OAAO,CAACY,GAAG,CAAC;MACnBW,mBAAmB,aAAnBA,mBAAmB,eAAnBA,mBAAmB,CAAEM,kBAAkB,CAAC7B,OAAO,CAAC;MAChDD,gBAAgB,CAACC,OAAO,EAAEC,gBAAgB,EAAEC,IAAI,CAAC;MACjDuB,gBAAgB,CAACM,MAAM,CAAC,CAAC;IAC3B,CAAC;IAEDD,YAAY,EAAE,SAAdA,YAAYA,CAAA,EAAQ;MAClB9B,OAAO,GAAG,CAAC,CAAC;MACZuB,mBAAmB,aAAnBA,mBAAmB,eAAnBA,mBAAmB,CAAEa,iBAAiB,CAAC,CAAC;MACxCX,gBAAgB,CAACM,MAAM,CAAC,CAAC;IAC3B,CAAC;IAEDN,gBAAgB,EAAhBA;EACF,CAAC;EACD,OAAOC,cAAc;AACvB","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customerDataTracker.js","names":["ONE_KIBI_BYTE","computeBytesCount","throttle","isEmptyObject","jsonStringify","display","CUSTOMER_DATA_BYTES_LIMIT","CUSTOMER_COMPRESSED_DATA_BYTES_LIMIT","BYTES_COMPUTATION_THROTTLING_DELAY","CustomerDataCompressionStatus","Unknown","Enabled","Disabled","createCustomerDataTrackerManager","compressionStatus","arguments","length","undefined","customerDataTrackers","Map","alreadyWarned","checkCustomerDataLimit","initialBytesCount","bytesCountLimit","bytesCount","forEach","tracker","getBytesCount","displayCustomerDataLimitReachedWarning","createDetachedTracker","createCustomerDataTracker","getOrCreateTracker","type","has","set","get","setCompressionStatus","newCompressionStatus","getCompressionStatus","stop","clear","bytesCountCache","_throttle","context","computeBytesCountThrottled","throttled","cancelComputeBytesCount","cancel","resetBytesCount","updateCustomerData","resetCustomerData","warn","concat"],"sources":["../../../src/helper/serialisation/customerDataTracker.js"],"sourcesContent":["import { ONE_KIBI_BYTE, computeBytesCount } from '../byteUtils'\nimport { throttle, isEmptyObject } from '../tools'\nimport { jsonStringify } from './jsonStringify'\nimport { display } from '../display'\n\n// RUM and logs batch bytes limit is 16KB\n// ensure that we leave room for other event attributes and maintain a decent amount of event per batch\n// (3KB (customer data) + 1KB (other attributes)) * 4 (events per batch) = 16KB\nexport const CUSTOMER_DATA_BYTES_LIMIT = 3 * ONE_KIBI_BYTE\n\n// We observed that the compression ratio is around 8 in general, but we also want to keep a margin\n// because some data might not be compressed (ex: last view update on page exit). We chose 16KiB\n// because it is also the limit of the 'batchBytesCount' that we use for RUM and Logs data, but this\n// is a bit arbitrary.\nexport const CUSTOMER_COMPRESSED_DATA_BYTES_LIMIT = 16 * ONE_KIBI_BYTE\n\nexport const BYTES_COMPUTATION_THROTTLING_DELAY = 200\n\nexport const CustomerDataCompressionStatus = {\n Unknown: 0,\n Enabled: 1,\n Disabled: 2\n}\n\nexport function createCustomerDataTrackerManager(\n compressionStatus = CustomerDataCompressionStatus.Disabled\n) {\n const customerDataTrackers = new Map()\n\n let alreadyWarned = false\n function checkCustomerDataLimit(initialBytesCount = 0) {\n if (\n alreadyWarned ||\n compressionStatus === CustomerDataCompressionStatus.Unknown\n ) {\n return\n }\n\n const bytesCountLimit =\n compressionStatus === CustomerDataCompressionStatus.Disabled\n ? CUSTOMER_DATA_BYTES_LIMIT\n : CUSTOMER_COMPRESSED_DATA_BYTES_LIMIT\n\n let bytesCount = initialBytesCount\n customerDataTrackers.forEach((tracker) => {\n bytesCount += tracker.getBytesCount()\n })\n\n if (bytesCount > bytesCountLimit) {\n displayCustomerDataLimitReachedWarning(bytesCountLimit)\n alreadyWarned = true\n }\n }\n\n return {\n /**\n * Creates a detached tracker. The manager will not store a reference to that tracker, and the\n * bytes count will be counted independently from other detached trackers.\n *\n * This is particularly useful when we don't know when the tracker will be unused, so we don't\n * leak memory (ex: when used in Logger instances).\n */\n createDetachedTracker: () => {\n const tracker = createCustomerDataTracker(() =>\n checkCustomerDataLimit(tracker.getBytesCount())\n )\n return tracker\n },\n\n /**\n * Creates a tracker if it doesn't exist, and returns it.\n */\n getOrCreateTracker: (type) => {\n if (!customerDataTrackers.has(type)) {\n customerDataTrackers.set(\n type,\n createCustomerDataTracker(checkCustomerDataLimit)\n )\n }\n return customerDataTrackers.get(type)\n },\n\n setCompressionStatus: (newCompressionStatus) => {\n if (compressionStatus === CustomerDataCompressionStatus.Unknown) {\n compressionStatus = newCompressionStatus\n checkCustomerDataLimit()\n }\n },\n\n getCompressionStatus: () => compressionStatus,\n\n stop: () => {\n customerDataTrackers.forEach((tracker) => tracker.stop())\n customerDataTrackers.clear()\n }\n }\n}\n\nexport function createCustomerDataTracker(checkCustomerDataLimit) {\n let bytesCountCache = 0\n\n // Throttle the bytes computation to minimize the impact on performance.\n // Especially useful if the user call context APIs synchronously multiple times in a row\n const {\n throttled: computeBytesCountThrottled,\n cancel: cancelComputeBytesCount\n } = throttle((context) => {\n bytesCountCache = computeBytesCount(jsonStringify(context))\n checkCustomerDataLimit()\n }, BYTES_COMPUTATION_THROTTLING_DELAY)\n\n const resetBytesCount = () => {\n cancelComputeBytesCount()\n bytesCountCache = 0\n }\n\n return {\n updateCustomerData: (context) => {\n if (isEmptyObject(context)) {\n resetBytesCount()\n } else {\n computeBytesCountThrottled(context)\n }\n },\n resetCustomerData: resetBytesCount,\n getBytesCount: () => bytesCountCache,\n stop: () => {\n cancelComputeBytesCount()\n }\n }\n}\n\nfunction displayCustomerDataLimitReachedWarning(bytesCountLimit) {\n display.warn(\n `Customer data exceeds the recommended ${\n bytesCountLimit / ONE_KIBI_BYTE\n }KiB threshold.`\n )\n}\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,iBAAiB,QAAQ,cAAc;AAC/D,SAASC,QAAQ,EAAEC,aAAa,QAAQ,UAAU;AAClD,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,OAAO,QAAQ,YAAY;;AAEpC;AACA;AACA;AACA,OAAO,IAAMC,yBAAyB,GAAG,CAAC,GAAGN,aAAa;;AAE1D;AACA;AACA;AACA;AACA,OAAO,IAAMO,oCAAoC,GAAG,EAAE,GAAGP,aAAa;AAEtE,OAAO,IAAMQ,kCAAkC,GAAG,GAAG;AAErD,OAAO,IAAMC,6BAA6B,GAAG;EAC3CC,OAAO,EAAE,CAAC;EACVC,OAAO,EAAE,CAAC;EACVC,QAAQ,EAAE;AACZ,CAAC;AAED,OAAO,SAASC,gCAAgCA,CAAA,EAE9C;EAAA,IADAC,iBAAiB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGN,6BAA6B,CAACG,QAAQ;EAE1D,IAAMM,oBAAoB,GAAG,IAAIC,GAAG,CAAC,CAAC;EAEtC,IAAIC,aAAa,GAAG,KAAK;EACzB,SAASC,sBAAsBA,CAAA,EAAwB;IAAA,IAAvBC,iBAAiB,GAAAP,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;IACnD,IACEK,aAAa,IACbN,iBAAiB,KAAKL,6BAA6B,CAACC,OAAO,EAC3D;MACA;IACF;IAEA,IAAMa,eAAe,GACnBT,iBAAiB,KAAKL,6BAA6B,CAACG,QAAQ,GACxDN,yBAAyB,GACzBC,oCAAoC;IAE1C,IAAIiB,UAAU,GAAGF,iBAAiB;IAClCJ,oBAAoB,CAACO,OAAO,CAAC,UAACC,OAAO,EAAK;MACxCF,UAAU,IAAIE,OAAO,CAACC,aAAa,CAAC,CAAC;IACvC,CAAC,CAAC;IAEF,IAAIH,UAAU,GAAGD,eAAe,EAAE;MAChCK,sCAAsC,CAACL,eAAe,CAAC;MACvDH,aAAa,GAAG,IAAI;IACtB;EACF;EAEA,OAAO;IACL;AACJ;AACA;AACA;AACA;AACA;AACA;IACIS,qBAAqB,EAAE,
|
|
1
|
+
{"version":3,"file":"customerDataTracker.js","names":["ONE_KIBI_BYTE","computeBytesCount","throttle","isEmptyObject","jsonStringify","display","CUSTOMER_DATA_BYTES_LIMIT","CUSTOMER_COMPRESSED_DATA_BYTES_LIMIT","BYTES_COMPUTATION_THROTTLING_DELAY","CustomerDataCompressionStatus","Unknown","Enabled","Disabled","createCustomerDataTrackerManager","compressionStatus","arguments","length","undefined","customerDataTrackers","Map","alreadyWarned","checkCustomerDataLimit","initialBytesCount","bytesCountLimit","bytesCount","forEach","tracker","getBytesCount","displayCustomerDataLimitReachedWarning","createDetachedTracker","createCustomerDataTracker","getOrCreateTracker","type","has","set","get","setCompressionStatus","newCompressionStatus","getCompressionStatus","stop","clear","bytesCountCache","_throttle","context","computeBytesCountThrottled","throttled","cancelComputeBytesCount","cancel","resetBytesCount","updateCustomerData","resetCustomerData","warn","concat"],"sources":["../../../src/helper/serialisation/customerDataTracker.js"],"sourcesContent":["import { ONE_KIBI_BYTE, computeBytesCount } from '../byteUtils'\nimport { throttle, isEmptyObject } from '../tools'\nimport { jsonStringify } from './jsonStringify'\nimport { display } from '../display'\n\n// RUM and logs batch bytes limit is 16KB\n// ensure that we leave room for other event attributes and maintain a decent amount of event per batch\n// (3KB (customer data) + 1KB (other attributes)) * 4 (events per batch) = 16KB\nexport const CUSTOMER_DATA_BYTES_LIMIT = 3 * ONE_KIBI_BYTE\n\n// We observed that the compression ratio is around 8 in general, but we also want to keep a margin\n// because some data might not be compressed (ex: last view update on page exit). We chose 16KiB\n// because it is also the limit of the 'batchBytesCount' that we use for RUM and Logs data, but this\n// is a bit arbitrary.\nexport const CUSTOMER_COMPRESSED_DATA_BYTES_LIMIT = 16 * ONE_KIBI_BYTE\n\nexport const BYTES_COMPUTATION_THROTTLING_DELAY = 200\n\nexport const CustomerDataCompressionStatus = {\n Unknown: 0,\n Enabled: 1,\n Disabled: 2\n}\n\nexport function createCustomerDataTrackerManager(\n compressionStatus = CustomerDataCompressionStatus.Disabled\n) {\n const customerDataTrackers = new Map()\n\n let alreadyWarned = false\n function checkCustomerDataLimit(initialBytesCount = 0) {\n if (\n alreadyWarned ||\n compressionStatus === CustomerDataCompressionStatus.Unknown\n ) {\n return\n }\n\n const bytesCountLimit =\n compressionStatus === CustomerDataCompressionStatus.Disabled\n ? CUSTOMER_DATA_BYTES_LIMIT\n : CUSTOMER_COMPRESSED_DATA_BYTES_LIMIT\n\n let bytesCount = initialBytesCount\n customerDataTrackers.forEach((tracker) => {\n bytesCount += tracker.getBytesCount()\n })\n\n if (bytesCount > bytesCountLimit) {\n displayCustomerDataLimitReachedWarning(bytesCountLimit)\n alreadyWarned = true\n }\n }\n\n return {\n /**\n * Creates a detached tracker. The manager will not store a reference to that tracker, and the\n * bytes count will be counted independently from other detached trackers.\n *\n * This is particularly useful when we don't know when the tracker will be unused, so we don't\n * leak memory (ex: when used in Logger instances).\n */\n createDetachedTracker: () => {\n const tracker = createCustomerDataTracker(() =>\n checkCustomerDataLimit(tracker.getBytesCount())\n )\n return tracker\n },\n\n /**\n * Creates a tracker if it doesn't exist, and returns it.\n */\n getOrCreateTracker: (type) => {\n if (!customerDataTrackers.has(type)) {\n customerDataTrackers.set(\n type,\n createCustomerDataTracker(checkCustomerDataLimit)\n )\n }\n return customerDataTrackers.get(type)\n },\n\n setCompressionStatus: (newCompressionStatus) => {\n if (compressionStatus === CustomerDataCompressionStatus.Unknown) {\n compressionStatus = newCompressionStatus\n checkCustomerDataLimit()\n }\n },\n\n getCompressionStatus: () => compressionStatus,\n\n stop: () => {\n customerDataTrackers.forEach((tracker) => tracker.stop())\n customerDataTrackers.clear()\n }\n }\n}\n\nexport function createCustomerDataTracker(checkCustomerDataLimit) {\n let bytesCountCache = 0\n\n // Throttle the bytes computation to minimize the impact on performance.\n // Especially useful if the user call context APIs synchronously multiple times in a row\n const {\n throttled: computeBytesCountThrottled,\n cancel: cancelComputeBytesCount\n } = throttle((context) => {\n bytesCountCache = computeBytesCount(jsonStringify(context))\n checkCustomerDataLimit()\n }, BYTES_COMPUTATION_THROTTLING_DELAY)\n\n const resetBytesCount = () => {\n cancelComputeBytesCount()\n bytesCountCache = 0\n }\n\n return {\n updateCustomerData: (context) => {\n if (isEmptyObject(context)) {\n resetBytesCount()\n } else {\n computeBytesCountThrottled(context)\n }\n },\n resetCustomerData: resetBytesCount,\n getBytesCount: () => bytesCountCache,\n stop: () => {\n cancelComputeBytesCount()\n }\n }\n}\n\nfunction displayCustomerDataLimitReachedWarning(bytesCountLimit) {\n display.warn(\n `Customer data exceeds the recommended ${\n bytesCountLimit / ONE_KIBI_BYTE\n }KiB threshold.`\n )\n}\n"],"mappings":"AAAA,SAASA,aAAa,EAAEC,iBAAiB,QAAQ,cAAc;AAC/D,SAASC,QAAQ,EAAEC,aAAa,QAAQ,UAAU;AAClD,SAASC,aAAa,QAAQ,iBAAiB;AAC/C,SAASC,OAAO,QAAQ,YAAY;;AAEpC;AACA;AACA;AACA,OAAO,IAAMC,yBAAyB,GAAG,CAAC,GAAGN,aAAa;;AAE1D;AACA;AACA;AACA;AACA,OAAO,IAAMO,oCAAoC,GAAG,EAAE,GAAGP,aAAa;AAEtE,OAAO,IAAMQ,kCAAkC,GAAG,GAAG;AAErD,OAAO,IAAMC,6BAA6B,GAAG;EAC3CC,OAAO,EAAE,CAAC;EACVC,OAAO,EAAE,CAAC;EACVC,QAAQ,EAAE;AACZ,CAAC;AAED,OAAO,SAASC,gCAAgCA,CAAA,EAE9C;EAAA,IADAC,iBAAiB,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAGN,6BAA6B,CAACG,QAAQ;EAE1D,IAAMM,oBAAoB,GAAG,IAAIC,GAAG,CAAC,CAAC;EAEtC,IAAIC,aAAa,GAAG,KAAK;EACzB,SAASC,sBAAsBA,CAAA,EAAwB;IAAA,IAAvBC,iBAAiB,GAAAP,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC;IACnD,IACEK,aAAa,IACbN,iBAAiB,KAAKL,6BAA6B,CAACC,OAAO,EAC3D;MACA;IACF;IAEA,IAAMa,eAAe,GACnBT,iBAAiB,KAAKL,6BAA6B,C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eof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
2
|
import { noop } from '../tools';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function _typeof(
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
2
|
import { jsonStringify } from './jsonStringify';
|
|
3
3
|
import { isString, isNumber } from '../tools';
|
|
4
4
|
export function escapeRowData(str) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taskQueue.js","names":["ONE_SECOND","requestIdleCallback","IDLE_CALLBACK_TIMEOUT","MAX_EXECUTION_TIME_ON_TIMEOUT","createTaskQueue","pendingTasks","run","deadline","executionTimeRemaining","didTimeout","start","performance","now","timeRemaining","bind","length","shift","scheduleNextRun","timeout","push","task"],"sources":["../../src/helper/taskQueue.js"],"sourcesContent":["import { ONE_SECOND } from './tools'\nimport { requestIdleCallback } from './requestIdleCallback'\n\n/**\n * Maximum delay before starting to execute tasks in the queue. We don't want to wait too long\n * before running tasks, as it might hurt reliability (ex: if the user navigates away, we might lose\n * the opportunity to send some data). We also don't want to run tasks too often, as it might hurt\n * performance.\n */\nconst IDLE_CALLBACK_TIMEOUT = ONE_SECOND\n\n/**\n * Maximum amount of time allocated to running tasks when a timeout (`IDLE_CALLBACK_TIMEOUT`) is\n * reached. We should not run tasks for too long as it will hurt performance, but we should still\n * run some tasks to avoid postponing them forever.\n *\n * Rational: Running tasks for 30ms every second (IDLE_CALLBACK_TIMEOUT) should be acceptable.\n */\nexport const MAX_EXECUTION_TIME_ON_TIMEOUT = 30\n\nexport function createTaskQueue() {\n const pendingTasks = []\n\n function run(deadline) {\n let executionTimeRemaining\n if (deadline.didTimeout) {\n const start = performance.now()\n executionTimeRemaining = function () {\n return MAX_EXECUTION_TIME_ON_TIMEOUT - (performance.now() - start)\n }\n } else {\n executionTimeRemaining = deadline.timeRemaining.bind(deadline)\n }\n\n while (executionTimeRemaining() > 0 && pendingTasks.length) {\n pendingTasks.shift()()\n }\n\n if (pendingTasks.length) {\n scheduleNextRun()\n }\n }\n\n function scheduleNextRun() {\n requestIdleCallback(run, { timeout: IDLE_CALLBACK_TIMEOUT })\n }\n\n return {\n push: function (task) {\n if (pendingTasks.push(task) === 1) {\n scheduleNextRun()\n }\n }\n }\n}\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,SAAS;AACpC,SAASC,mBAAmB,QAAQ,uBAAuB;;AAE3D;AACA;AACA;AACA;AACA;AACA;AACA,IAAMC,qBAAqB,GAAGF,UAAU;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMG,6BAA6B,GAAG,EAAE;AAE/C,OAAO,SAASC,eAAeA,CAAA,EAAG;EAChC,IAAMC,YAAY,GAAG,EAAE;EAEvB,SAASC,GAAGA,CAACC,QAAQ,EAAE;IACrB,IAAIC,sBAAsB;IAC1B,IAAID,QAAQ,CAACE,UAAU,EAAE;MACvB,IAAMC,KAAK,GAAGC,WAAW,CAACC,GAAG,CAAC,CAAC;MAC/BJ,sBAAsB,GAAG,
|
|
1
|
+
{"version":3,"file":"taskQueue.js","names":["ONE_SECOND","requestIdleCallback","IDLE_CALLBACK_TIMEOUT","MAX_EXECUTION_TIME_ON_TIMEOUT","createTaskQueue","pendingTasks","run","deadline","executionTimeRemaining","didTimeout","start","performance","now","timeRemaining","bind","length","shift","scheduleNextRun","timeout","push","task"],"sources":["../../src/helper/taskQueue.js"],"sourcesContent":["import { ONE_SECOND } from './tools'\nimport { requestIdleCallback } from './requestIdleCallback'\n\n/**\n * Maximum delay before starting to execute tasks in the queue. We don't want to wait too long\n * before running tasks, as it might hurt reliability (ex: if the user navigates away, we might lose\n * the opportunity to send some data). We also don't want to run tasks too often, as it might hurt\n * performance.\n */\nconst IDLE_CALLBACK_TIMEOUT = ONE_SECOND\n\n/**\n * Maximum amount of time allocated to running tasks when a timeout (`IDLE_CALLBACK_TIMEOUT`) is\n * reached. We should not run tasks for too long as it will hurt performance, but we should still\n * run some tasks to avoid postponing them forever.\n *\n * Rational: Running tasks for 30ms every second (IDLE_CALLBACK_TIMEOUT) should be acceptable.\n */\nexport const MAX_EXECUTION_TIME_ON_TIMEOUT = 30\n\nexport function createTaskQueue() {\n const pendingTasks = []\n\n function run(deadline) {\n let executionTimeRemaining\n if (deadline.didTimeout) {\n const start = performance.now()\n executionTimeRemaining = function () {\n return MAX_EXECUTION_TIME_ON_TIMEOUT - (performance.now() - start)\n }\n } else {\n executionTimeRemaining = deadline.timeRemaining.bind(deadline)\n }\n\n while (executionTimeRemaining() > 0 && pendingTasks.length) {\n pendingTasks.shift()()\n }\n\n if (pendingTasks.length) {\n scheduleNextRun()\n }\n }\n\n function scheduleNextRun() {\n requestIdleCallback(run, { timeout: IDLE_CALLBACK_TIMEOUT })\n }\n\n return {\n push: function (task) {\n if (pendingTasks.push(task) === 1) {\n scheduleNextRun()\n }\n }\n }\n}\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,SAAS;AACpC,SAASC,mBAAmB,QAAQ,uBAAuB;;AAE3D;AACA;AACA;AACA;AACA;AACA;AACA,IAAMC,qBAAqB,GAAGF,UAAU;;AAExC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,IAAMG,6BAA6B,GAAG,EAAE;AAE/C,OAAO,SAASC,eAAeA,CAAA,EAAG;EAChC,IAAMC,YAAY,GAAG,EAAE;EAEvB,SAASC,GAAGA,CAACC,QAAQ,EAAE;IACrB,IAAIC,sBAAsB;IAC1B,IAAID,QAAQ,CAACE,UAAU,EAAE;MACvB,IAAMC,KAAK,GAAGC,WAAW,CAACC,GAAG,CAAC,CAAC;MAC/BJ,sBAAsB,GAAG,SAAzBA,sBAAsBA,CAAA,EAAe;QACnC,OAAOL,6BAA6B,IAAIQ,WAAW,CAACC,GAAG,CAAC,CAAC,GAAGF,KAAK,CAAC;MACpE,CAAC;IACH,CAAC,MAAM;MACLF,sBAAsB,GAAGD,QAAQ,CAACM,aAAa,CAACC,IAAI,CAACP,QAAQ,CAAC;IAChE;IAEA,OAAOC,sBAAsB,CAAC,CAAC,GAAG,CAAC,IAAIH,YAAY,CAACU,MAAM,EAAE;MAC1DV,YAAY,CAACW,KAAK,CAAC,CAAC,CAAC,CAAC;IACxB;IAEA,IAAIX,YAAY,CAACU,MAAM,EAAE;MACvBE,eAAe,CAAC,CAAC;IACnB;EACF;EAEA,SAASA,eAAeA,CAAA,EAAG;IACzBhB,mBAAmB,CAACK,GAAG,EAAE;MAAEY,OAAO,EAAEhB;IAAsB,CAAC,CAAC;EAC9D;EAEA,OAAO;IACLiB,IAAI,EAAE,SAANA,IAAIA,CAAYC,IAAI,EAAE;MACpB,IAAIf,YAAY,CAACc,IAAI,CAACC,IAAI,CAAC,KAAK,CAAC,EAAE;QACjCH,eAAe,CAAC,CAAC;MACnB;IACF;EACF,CAAC;AACH","ignoreList":[]}
|
package/esm/helper/tools.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function _typeof(
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
2
|
import { display } from './display';
|
|
3
3
|
import { setTimeout, clearTimeout } from './timer';
|
|
4
4
|
var ArrayProto = Array.prototype;
|
|
@@ -319,16 +319,17 @@ export var safeJSONParse = function safeJSONParse(str) {
|
|
|
319
319
|
}
|
|
320
320
|
return val;
|
|
321
321
|
};
|
|
322
|
-
|
|
322
|
+
var _encodeDates = function encodeDates(obj) {
|
|
323
323
|
each(obj, function (v, k) {
|
|
324
324
|
if (isDate(v)) {
|
|
325
325
|
obj[k] = formatDate(v);
|
|
326
326
|
} else if (isObject(v)) {
|
|
327
|
-
obj[k] =
|
|
327
|
+
obj[k] = _encodeDates(v);
|
|
328
328
|
}
|
|
329
329
|
});
|
|
330
330
|
return obj;
|
|
331
331
|
};
|
|
332
|
+
export { _encodeDates as encodeDates };
|
|
332
333
|
export var mediaQueriesSupported = function mediaQueriesSupported() {
|
|
333
334
|
return typeof window.matchMedia !== 'undefined' || typeof window.msMatchMedia !== 'undefined';
|
|
334
335
|
};
|
|
@@ -406,11 +407,11 @@ export var formatDate = function formatDate(d) {
|
|
|
406
407
|
}
|
|
407
408
|
return d.getFullYear() + '-' + pad(d.getMonth() + 1) + '-' + pad(d.getDate()) + ' ' + pad(d.getHours()) + ':' + pad(d.getMinutes()) + ':' + pad(d.getSeconds()) + '.' + pad(d.getMilliseconds());
|
|
408
409
|
};
|
|
409
|
-
|
|
410
|
+
var _searchObjDate = function searchObjDate(o) {
|
|
410
411
|
if (isObject(o)) {
|
|
411
412
|
each(o, function (a, b) {
|
|
412
413
|
if (isObject(a)) {
|
|
413
|
-
|
|
414
|
+
_searchObjDate(o[b]);
|
|
414
415
|
} else {
|
|
415
416
|
if (isDate(a)) {
|
|
416
417
|
o[b] = formatDate(a);
|
|
@@ -419,6 +420,7 @@ export var searchObjDate = function searchObjDate(o) {
|
|
|
419
420
|
});
|
|
420
421
|
}
|
|
421
422
|
};
|
|
423
|
+
export { _searchObjDate as searchObjDate };
|
|
422
424
|
export var formatJsonString = function formatJsonString(obj) {
|
|
423
425
|
try {
|
|
424
426
|
return JSON.stringify(obj, null, ' ');
|
|
@@ -434,11 +436,11 @@ export var formatJsonString = function formatJsonString(obj) {
|
|
|
434
436
|
// return str
|
|
435
437
|
// }
|
|
436
438
|
// }
|
|
437
|
-
|
|
439
|
+
var _searchObjString = function searchObjString(o) {
|
|
438
440
|
if (isObject(o)) {
|
|
439
441
|
each(o, function (a, b) {
|
|
440
442
|
if (isObject(a)) {
|
|
441
|
-
|
|
443
|
+
_searchObjString(o[b]);
|
|
442
444
|
} else {
|
|
443
445
|
if (isString(a)) {
|
|
444
446
|
o[b] = formatString(a);
|
|
@@ -447,6 +449,7 @@ export var searchObjString = function searchObjString(o) {
|
|
|
447
449
|
});
|
|
448
450
|
}
|
|
449
451
|
};
|
|
452
|
+
export { _searchObjString as searchObjString };
|
|
450
453
|
export var unique = function unique(ar) {
|
|
451
454
|
var temp,
|
|
452
455
|
n = [],
|
|
@@ -644,7 +647,6 @@ export var urlParse = function urlParse(para) {
|
|
|
644
647
|
// this._values['Origin'] =
|
|
645
648
|
// this._values['Protocol'] + '://' + this._values['Hostname']
|
|
646
649
|
};
|
|
647
|
-
|
|
648
650
|
return new URLParser(para);
|
|
649
651
|
};
|
|
650
652
|
export function elementMatches(element, selector) {
|