@microsoft/applicationinsights-common 2.8.0-beta.2203-04 → 2.8.0-beta.2203-07

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.
Files changed (116) hide show
  1. package/browser/applicationinsights-common.integrity.json +9 -9
  2. package/browser/applicationinsights-common.js +445 -23
  3. package/browser/applicationinsights-common.js.map +1 -1
  4. package/browser/applicationinsights-common.min.js +2 -2
  5. package/browser/applicationinsights-common.min.js.map +1 -1
  6. package/dist/applicationinsights-common.api.json +69 -10
  7. package/dist/applicationinsights-common.api.md +7 -4
  8. package/dist/applicationinsights-common.d.ts +16 -3
  9. package/dist/applicationinsights-common.js +445 -23
  10. package/dist/applicationinsights-common.js.map +1 -1
  11. package/dist/applicationinsights-common.min.js +2 -2
  12. package/dist/applicationinsights-common.min.js.map +1 -1
  13. package/dist/applicationinsights-common.rollup.d.ts +16 -3
  14. package/dist-esm/ConnectionStringParser.js +1 -1
  15. package/dist-esm/Constants.js +1 -1
  16. package/dist-esm/DomHelperFuncs.js +1 -1
  17. package/dist-esm/Enums.js +1 -1
  18. package/dist-esm/HelperFuncs.js +1 -1
  19. package/dist-esm/Interfaces/ConnectionString.js +1 -1
  20. package/dist-esm/Interfaces/Context/IApplication.js +1 -1
  21. package/dist-esm/Interfaces/Context/IDevice.js +1 -1
  22. package/dist-esm/Interfaces/Context/IInternal.js +1 -1
  23. package/dist-esm/Interfaces/Context/ILocation.js +1 -1
  24. package/dist-esm/Interfaces/Context/IOperatingSystem.js +1 -1
  25. package/dist-esm/Interfaces/Context/ISample.js +1 -1
  26. package/dist-esm/Interfaces/Context/ISession.js +1 -1
  27. package/dist-esm/Interfaces/Context/ITelemetryTrace.js +1 -1
  28. package/dist-esm/Interfaces/Context/IUser.js +1 -1
  29. package/dist-esm/Interfaces/Context/IWeb.js +1 -1
  30. package/dist-esm/Interfaces/Contracts/AvailabilityData.js +1 -1
  31. package/dist-esm/Interfaces/Contracts/ContextTagKeys.js +1 -1
  32. package/dist-esm/Interfaces/Contracts/DataPointType.js +1 -1
  33. package/dist-esm/Interfaces/Contracts/DependencyKind.js +1 -1
  34. package/dist-esm/Interfaces/Contracts/DependencySourceType.js +1 -1
  35. package/dist-esm/Interfaces/Contracts/Generated/AvailabilityData.js +1 -1
  36. package/dist-esm/Interfaces/Contracts/Generated/Base.js +1 -1
  37. package/dist-esm/Interfaces/Contracts/Generated/ContextTagKeys.js +1 -1
  38. package/dist-esm/Interfaces/Contracts/Generated/Data.js +1 -1
  39. package/dist-esm/Interfaces/Contracts/Generated/DataPoint.js +1 -1
  40. package/dist-esm/Interfaces/Contracts/Generated/DataPointType.js +1 -1
  41. package/dist-esm/Interfaces/Contracts/Generated/DependencyKind.js +1 -1
  42. package/dist-esm/Interfaces/Contracts/Generated/DependencySourceType.js +1 -1
  43. package/dist-esm/Interfaces/Contracts/Generated/Domain.js +1 -1
  44. package/dist-esm/Interfaces/Contracts/Generated/Envelope.js +1 -1
  45. package/dist-esm/Interfaces/Contracts/Generated/EventData.js +1 -1
  46. package/dist-esm/Interfaces/Contracts/Generated/ExceptionData.js +1 -1
  47. package/dist-esm/Interfaces/Contracts/Generated/ExceptionDetails.js +1 -1
  48. package/dist-esm/Interfaces/Contracts/Generated/MessageData.js +1 -1
  49. package/dist-esm/Interfaces/Contracts/Generated/MetricData.js +1 -1
  50. package/dist-esm/Interfaces/Contracts/Generated/PageViewData.js +1 -1
  51. package/dist-esm/Interfaces/Contracts/Generated/PageViewPerfData.js +1 -1
  52. package/dist-esm/Interfaces/Contracts/Generated/RemoteDependencyData.js +1 -1
  53. package/dist-esm/Interfaces/Contracts/Generated/RequestData.js +1 -1
  54. package/dist-esm/Interfaces/Contracts/Generated/SeverityLevel.js +1 -1
  55. package/dist-esm/Interfaces/Contracts/Generated/StackFrame.js +1 -1
  56. package/dist-esm/Interfaces/Contracts/IBase.js +1 -1
  57. package/dist-esm/Interfaces/Contracts/IData.js +1 -1
  58. package/dist-esm/Interfaces/Contracts/IDataPoint.js +1 -1
  59. package/dist-esm/Interfaces/Contracts/IDomain.js +1 -1
  60. package/dist-esm/Interfaces/Contracts/IEnvelope.js +1 -1
  61. package/dist-esm/Interfaces/Contracts/IEventData.js +1 -1
  62. package/dist-esm/Interfaces/Contracts/IExceptionData.js +1 -1
  63. package/dist-esm/Interfaces/Contracts/IExceptionDetails.js +1 -1
  64. package/dist-esm/Interfaces/Contracts/IMessageData.js +1 -1
  65. package/dist-esm/Interfaces/Contracts/IMetricData.js +1 -1
  66. package/dist-esm/Interfaces/Contracts/IPageViewData.js +1 -1
  67. package/dist-esm/Interfaces/Contracts/IPageViewPerfData.js +1 -1
  68. package/dist-esm/Interfaces/Contracts/IRemoteDependencyData.js +1 -1
  69. package/dist-esm/Interfaces/Contracts/IStackFrame.js +1 -1
  70. package/dist-esm/Interfaces/Contracts/RequestData.js +1 -1
  71. package/dist-esm/Interfaces/Contracts/SeverityLevel.js +1 -1
  72. package/dist-esm/Interfaces/IAppInsights.js +1 -1
  73. package/dist-esm/Interfaces/IChannelControlsAI.js +1 -1
  74. package/dist-esm/Interfaces/IConfig.js +1 -1
  75. package/dist-esm/Interfaces/ICorrelationConfig.js +1 -1
  76. package/dist-esm/Interfaces/IDependencyTelemetry.js +1 -1
  77. package/dist-esm/Interfaces/IEventTelemetry.js +1 -1
  78. package/dist-esm/Interfaces/IExceptionTelemetry.js +1 -1
  79. package/dist-esm/Interfaces/IMetricTelemetry.js +1 -1
  80. package/dist-esm/Interfaces/IPageViewPerformanceTelemetry.js +1 -1
  81. package/dist-esm/Interfaces/IPageViewTelemetry.js +1 -1
  82. package/dist-esm/Interfaces/IPartC.js +1 -1
  83. package/dist-esm/Interfaces/IPropertiesPlugin.js +1 -1
  84. package/dist-esm/Interfaces/IRequestContext.js +1 -1
  85. package/dist-esm/Interfaces/ITelemetryContext.js +1 -1
  86. package/dist-esm/Interfaces/ITraceTelemetry.js +1 -1
  87. package/dist-esm/Interfaces/PartAExtensions.js +1 -1
  88. package/dist-esm/Interfaces/Telemetry/IEnvelope.js +1 -1
  89. package/dist-esm/Interfaces/Telemetry/ISerializable.js +1 -1
  90. package/dist-esm/RequestResponseHeaders.js +1 -1
  91. package/dist-esm/StorageHelperFuncs.js +27 -12
  92. package/dist-esm/StorageHelperFuncs.js.map +1 -1
  93. package/dist-esm/Telemetry/Common/Base.js +1 -1
  94. package/dist-esm/Telemetry/Common/Data.js +1 -1
  95. package/dist-esm/Telemetry/Common/DataPoint.js +1 -1
  96. package/dist-esm/Telemetry/Common/DataSanitizer.js +8 -8
  97. package/dist-esm/Telemetry/Common/DataSanitizer.js.map +1 -1
  98. package/dist-esm/Telemetry/Common/Envelope.js +1 -1
  99. package/dist-esm/Telemetry/Event.js +1 -1
  100. package/dist-esm/Telemetry/Exception.js +1 -1
  101. package/dist-esm/Telemetry/Metric.js +1 -1
  102. package/dist-esm/Telemetry/PageView.js +1 -1
  103. package/dist-esm/Telemetry/PageViewPerformance.js +1 -1
  104. package/dist-esm/Telemetry/RemoteDependencyData.js +1 -1
  105. package/dist-esm/Telemetry/Trace.js +1 -1
  106. package/dist-esm/TelemetryItemCreator.js +1 -1
  107. package/dist-esm/UrlHelperFuncs.js +1 -1
  108. package/dist-esm/Util.js +1 -1
  109. package/dist-esm/applicationinsights-common.js +2 -2
  110. package/dist-esm/applicationinsights-common.js.map +1 -1
  111. package/package.json +2 -2
  112. package/src/StorageHelperFuncs.ts +28 -11
  113. package/src/Telemetry/Common/DataSanitizer.ts +8 -8
  114. package/src/applicationinsights-common.ts +1 -1
  115. package/types/StorageHelperFuncs.d.ts +14 -2
  116. package/types/applicationinsights-common.d.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Application Insights JavaScript SDK - Common, 2.8.0-beta.2203-04
2
+ * Application Insights JavaScript SDK - Common, 2.8.0-beta.2203-07
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  (function (global, factory) {
@@ -94,6 +94,247 @@
94
94
  d[strShimPrototype] = b === null ? objCreateFn(b) : (__[strShimPrototype] = b[strShimPrototype], new __());
95
95
  }
96
96
 
97
+ /*!
98
+ * Microsoft Dynamic Proto Utility, 1.1.4
99
+ * Copyright (c) Microsoft and contributors. All rights reserved.
100
+ */
101
+ var Constructor = 'constructor';
102
+ var Prototype = 'prototype';
103
+ var strFunction = 'function';
104
+ var DynInstFuncTable = '_dynInstFuncs';
105
+ var DynProxyTag = '_isDynProxy';
106
+ var DynClassName = '_dynClass';
107
+ var DynClassNamePrefix = '_dynCls$';
108
+ var DynInstChkTag = '_dynInstChk';
109
+ var DynAllowInstChkTag = DynInstChkTag;
110
+ var DynProtoDefaultOptions = '_dfOpts';
111
+ var UnknownValue = '_unknown_';
112
+ var str__Proto = "__proto__";
113
+ var strUseBaseInst = 'useBaseInst';
114
+ var strSetInstFuncs = 'setInstFuncs';
115
+ var Obj = Object;
116
+ var _objGetPrototypeOf = Obj["getPrototypeOf"];
117
+ var _dynamicNames = 0;
118
+ function _hasOwnProperty(obj, prop) {
119
+ return obj && Obj[Prototype].hasOwnProperty.call(obj, prop);
120
+ }
121
+ function _isObjectOrArrayPrototype(target) {
122
+ return target && (target === Obj[Prototype] || target === Array[Prototype]);
123
+ }
124
+ function _isObjectArrayOrFunctionPrototype(target) {
125
+ return _isObjectOrArrayPrototype(target) || target === Function[Prototype];
126
+ }
127
+ function _getObjProto(target) {
128
+ if (target) {
129
+ if (_objGetPrototypeOf) {
130
+ return _objGetPrototypeOf(target);
131
+ }
132
+ var newProto = target[str__Proto] || target[Prototype] || (target[Constructor] ? target[Constructor][Prototype] : null);
133
+ if (newProto) {
134
+ return newProto;
135
+ }
136
+ }
137
+ return null;
138
+ }
139
+ function _forEachProp(target, func) {
140
+ var props = [];
141
+ var getOwnProps = Obj["getOwnPropertyNames"];
142
+ if (getOwnProps) {
143
+ props = getOwnProps(target);
144
+ }
145
+ else {
146
+ for (var name_1 in target) {
147
+ if (typeof name_1 === "string" && _hasOwnProperty(target, name_1)) {
148
+ props.push(name_1);
149
+ }
150
+ }
151
+ }
152
+ if (props && props.length > 0) {
153
+ for (var lp = 0; lp < props.length; lp++) {
154
+ func(props[lp]);
155
+ }
156
+ }
157
+ }
158
+ function _isDynamicCandidate(target, funcName, skipOwn) {
159
+ return (funcName !== Constructor && typeof target[funcName] === strFunction && (skipOwn || _hasOwnProperty(target, funcName)));
160
+ }
161
+ function _throwTypeError(message) {
162
+ throw new TypeError("DynamicProto: " + message);
163
+ }
164
+ function _getInstanceFuncs(thisTarget) {
165
+ var instFuncs = {};
166
+ _forEachProp(thisTarget, function (name) {
167
+ if (!instFuncs[name] && _isDynamicCandidate(thisTarget, name, false)) {
168
+ instFuncs[name] = thisTarget[name];
169
+ }
170
+ });
171
+ return instFuncs;
172
+ }
173
+ function _hasVisited(values, value) {
174
+ for (var lp = values.length - 1; lp >= 0; lp--) {
175
+ if (values[lp] === value) {
176
+ return true;
177
+ }
178
+ }
179
+ return false;
180
+ }
181
+ function _getBaseFuncs(classProto, thisTarget, instFuncs, useBaseInst) {
182
+ function _instFuncProxy(target, funcHost, funcName) {
183
+ var theFunc = funcHost[funcName];
184
+ if (theFunc[DynProxyTag] && useBaseInst) {
185
+ var instFuncTable = target[DynInstFuncTable] || {};
186
+ if (instFuncTable[DynAllowInstChkTag] !== false) {
187
+ theFunc = (instFuncTable[funcHost[DynClassName]] || {})[funcName] || theFunc;
188
+ }
189
+ }
190
+ return function () {
191
+ return theFunc.apply(target, arguments);
192
+ };
193
+ }
194
+ var baseFuncs = {};
195
+ _forEachProp(instFuncs, function (name) {
196
+ baseFuncs[name] = _instFuncProxy(thisTarget, instFuncs, name);
197
+ });
198
+ var baseProto = _getObjProto(classProto);
199
+ var visited = [];
200
+ while (baseProto && !_isObjectArrayOrFunctionPrototype(baseProto) && !_hasVisited(visited, baseProto)) {
201
+ _forEachProp(baseProto, function (name) {
202
+ if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf)) {
203
+ baseFuncs[name] = _instFuncProxy(thisTarget, baseProto, name);
204
+ }
205
+ });
206
+ visited.push(baseProto);
207
+ baseProto = _getObjProto(baseProto);
208
+ }
209
+ return baseFuncs;
210
+ }
211
+ function _getInstFunc(target, funcName, proto, currentDynProtoProxy) {
212
+ var instFunc = null;
213
+ if (target && _hasOwnProperty(proto, DynClassName)) {
214
+ var instFuncTable = target[DynInstFuncTable] || {};
215
+ instFunc = (instFuncTable[proto[DynClassName]] || {})[funcName];
216
+ if (!instFunc) {
217
+ _throwTypeError("Missing [" + funcName + "] " + strFunction);
218
+ }
219
+ if (!instFunc[DynInstChkTag] && instFuncTable[DynAllowInstChkTag] !== false) {
220
+ var canAddInst = !_hasOwnProperty(target, funcName);
221
+ var objProto = _getObjProto(target);
222
+ var visited = [];
223
+ while (canAddInst && objProto && !_isObjectArrayOrFunctionPrototype(objProto) && !_hasVisited(visited, objProto)) {
224
+ var protoFunc = objProto[funcName];
225
+ if (protoFunc) {
226
+ canAddInst = (protoFunc === currentDynProtoProxy);
227
+ break;
228
+ }
229
+ visited.push(objProto);
230
+ objProto = _getObjProto(objProto);
231
+ }
232
+ try {
233
+ if (canAddInst) {
234
+ target[funcName] = instFunc;
235
+ }
236
+ instFunc[DynInstChkTag] = 1;
237
+ }
238
+ catch (e) {
239
+ instFuncTable[DynAllowInstChkTag] = false;
240
+ }
241
+ }
242
+ }
243
+ return instFunc;
244
+ }
245
+ function _getProtoFunc(funcName, proto, currentDynProtoProxy) {
246
+ var protoFunc = proto[funcName];
247
+ if (protoFunc === currentDynProtoProxy) {
248
+ protoFunc = _getObjProto(proto)[funcName];
249
+ }
250
+ if (typeof protoFunc !== strFunction) {
251
+ _throwTypeError("[" + funcName + "] is not a " + strFunction);
252
+ }
253
+ return protoFunc;
254
+ }
255
+ function _populatePrototype(proto, className, target, baseInstFuncs, setInstanceFunc) {
256
+ function _createDynamicPrototype(proto, funcName) {
257
+ var dynProtoProxy = function () {
258
+ var instFunc = _getInstFunc(this, funcName, proto, dynProtoProxy) || _getProtoFunc(funcName, proto, dynProtoProxy);
259
+ return instFunc.apply(this, arguments);
260
+ };
261
+ dynProtoProxy[DynProxyTag] = 1;
262
+ return dynProtoProxy;
263
+ }
264
+ if (!_isObjectOrArrayPrototype(proto)) {
265
+ var instFuncTable = target[DynInstFuncTable] = target[DynInstFuncTable] || {};
266
+ var instFuncs_1 = instFuncTable[className] = (instFuncTable[className] || {});
267
+ if (instFuncTable[DynAllowInstChkTag] !== false) {
268
+ instFuncTable[DynAllowInstChkTag] = !!setInstanceFunc;
269
+ }
270
+ _forEachProp(target, function (name) {
271
+ if (_isDynamicCandidate(target, name, false) && target[name] !== baseInstFuncs[name]) {
272
+ instFuncs_1[name] = target[name];
273
+ delete target[name];
274
+ if (!_hasOwnProperty(proto, name) || (proto[name] && !proto[name][DynProxyTag])) {
275
+ proto[name] = _createDynamicPrototype(proto, name);
276
+ }
277
+ }
278
+ });
279
+ }
280
+ }
281
+ function _checkPrototype(classProto, thisTarget) {
282
+ if (_objGetPrototypeOf) {
283
+ var visited = [];
284
+ var thisProto = _getObjProto(thisTarget);
285
+ while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) {
286
+ if (thisProto === classProto) {
287
+ return true;
288
+ }
289
+ visited.push(thisProto);
290
+ thisProto = _getObjProto(thisProto);
291
+ }
292
+ }
293
+ return false;
294
+ }
295
+ function _getObjName(target, unknownValue) {
296
+ if (_hasOwnProperty(target, Prototype)) {
297
+ return target.name || unknownValue || UnknownValue;
298
+ }
299
+ return (((target || {})[Constructor]) || {}).name || unknownValue || UnknownValue;
300
+ }
301
+ function dynamicProto(theClass, target, delegateFunc, options) {
302
+ if (!_hasOwnProperty(theClass, Prototype)) {
303
+ _throwTypeError("theClass is an invalid class definition.");
304
+ }
305
+ var classProto = theClass[Prototype];
306
+ if (!_checkPrototype(classProto, target)) {
307
+ _throwTypeError("[" + _getObjName(theClass) + "] is not in class hierarchy of [" + _getObjName(target) + "]");
308
+ }
309
+ var className = null;
310
+ if (_hasOwnProperty(classProto, DynClassName)) {
311
+ className = classProto[DynClassName];
312
+ }
313
+ else {
314
+ className = DynClassNamePrefix + _getObjName(theClass, "_") + "$" + _dynamicNames;
315
+ _dynamicNames++;
316
+ classProto[DynClassName] = className;
317
+ }
318
+ var perfOptions = dynamicProto[DynProtoDefaultOptions];
319
+ var useBaseInst = !!perfOptions[strUseBaseInst];
320
+ if (useBaseInst && options && options[strUseBaseInst] !== undefined) {
321
+ useBaseInst = !!options[strUseBaseInst];
322
+ }
323
+ var instFuncs = _getInstanceFuncs(target);
324
+ var baseFuncs = _getBaseFuncs(classProto, target, instFuncs, useBaseInst);
325
+ delegateFunc(target, baseFuncs);
326
+ var setInstanceFunc = !!_objGetPrototypeOf && !!perfOptions[strSetInstFuncs];
327
+ if (setInstanceFunc && options) {
328
+ setInstanceFunc = !!options[strSetInstFuncs];
329
+ }
330
+ _populatePrototype(classProto, className, target, instFuncs, setInstanceFunc !== false);
331
+ }
332
+ var perfDefaults = {
333
+ setInstFuncs: true,
334
+ useBaseInst: true
335
+ };
336
+ dynamicProto[DynProtoDefaultOptions] = perfDefaults;
337
+
97
338
  var strEmpty$1 = "";
98
339
 
99
340
  var strToISOString = "toISOString";
@@ -435,6 +676,7 @@
435
676
  var strDocumentMode = "documentMode";
436
677
  var strNavigator = "navigator";
437
678
  var strLocation = "location";
679
+ var strConsole = "console";
438
680
  var strPerformance = "performance";
439
681
  var strJSON = "JSON";
440
682
  var strCrypto = "crypto";
@@ -494,6 +736,12 @@
494
736
  }
495
737
  return getGlobalInst(strLocation);
496
738
  }
739
+ function getConsole() {
740
+ if (typeof console !== strShimUndefined) {
741
+ return console;
742
+ }
743
+ return getGlobalInst(strConsole);
744
+ }
497
745
  function getPerformance() {
498
746
  return getGlobalInst(strPerformance);
499
747
  }
@@ -558,6 +806,175 @@
558
806
  return _beaconsSupported;
559
807
  }
560
808
 
809
+ var _aiNamespace = null;
810
+ function _getExtensionNamespace() {
811
+ var target = getGlobalInst("Microsoft");
812
+ if (target) {
813
+ _aiNamespace = target["ApplicationInsights"];
814
+ }
815
+ return _aiNamespace;
816
+ }
817
+ function getDebugExt(config) {
818
+ var ns = _aiNamespace;
819
+ if (!ns && config.disableDbgExt !== true) {
820
+ ns = _aiNamespace || _getExtensionNamespace();
821
+ }
822
+ return ns ? ns["ChromeDbgExt"] : null;
823
+ }
824
+
825
+ var AiNonUserActionablePrefix = "AI (Internal): ";
826
+ var AiUserActionablePrefix = "AI: ";
827
+ var AIInternalMessagePrefix = "AITR_";
828
+ var strErrorToConsole = "errorToConsole";
829
+ var strWarnToConsole = "warnToConsole";
830
+ function _sanitizeDiagnosticText(text) {
831
+ if (text) {
832
+ return "\"" + text.replace(/\"/g, strEmpty$1) + "\"";
833
+ }
834
+ return strEmpty$1;
835
+ }
836
+ function _logToConsole(func, message) {
837
+ var theConsole = getConsole();
838
+ if (!!theConsole) {
839
+ var logFunc = "log";
840
+ if (theConsole[func]) {
841
+ logFunc = func;
842
+ }
843
+ if (isFunction(theConsole[logFunc])) {
844
+ theConsole[logFunc](message);
845
+ }
846
+ }
847
+ }
848
+ var _InternalLogMessage = /** @class */ (function () {
849
+ function _InternalLogMessage(msgId, msg, isUserAct, properties) {
850
+ if (isUserAct === void 0) { isUserAct = false; }
851
+ var _self = this;
852
+ _self.messageId = msgId;
853
+ _self.message =
854
+ (isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +
855
+ msgId;
856
+ var strProps = strEmpty$1;
857
+ if (hasJSON()) {
858
+ strProps = getJSON().stringify(properties);
859
+ }
860
+ var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : strEmpty$1) +
861
+ (properties ? " props:" + _sanitizeDiagnosticText(strProps) : strEmpty$1);
862
+ _self.message += diagnosticText;
863
+ }
864
+ _InternalLogMessage.dataType = "MessageData";
865
+ return _InternalLogMessage;
866
+ }());
867
+ var DiagnosticLogger = /** @class */ (function () {
868
+ function DiagnosticLogger(config) {
869
+ this.identifier = "DiagnosticLogger";
870
+ this.queue = [];
871
+ var _messageCount = 0;
872
+ var _messageLogged = {};
873
+ dynamicProto(DiagnosticLogger, this, function (_self) {
874
+ if (isNullOrUndefined(config)) {
875
+ config = {};
876
+ }
877
+ _self.consoleLoggingLevel = function () { return _getConfigValue("loggingLevelConsole", 0); };
878
+ _self.telemetryLoggingLevel = function () { return _getConfigValue("loggingLevelTelemetry", 1); };
879
+ _self.maxInternalMessageLimit = function () { return _getConfigValue("maxMessageLimit", 25); };
880
+ _self.enableDebugExceptions = function () { return _getConfigValue("enableDebugExceptions", false); };
881
+ _self.throwInternal = function (severity, msgId, msg, properties, isUserAct) {
882
+ if (isUserAct === void 0) { isUserAct = false; }
883
+ var message = new _InternalLogMessage(msgId, msg, isUserAct, properties);
884
+ if (_self.enableDebugExceptions()) {
885
+ throw message;
886
+ }
887
+ else {
888
+ var logFunc = severity === 1 ? strErrorToConsole : strWarnToConsole;
889
+ if (!isUndefined(message.message)) {
890
+ var logLevel = _self.consoleLoggingLevel();
891
+ if (isUserAct) {
892
+ var messageKey = +message.messageId;
893
+ if (!_messageLogged[messageKey] && logLevel >= severity) {
894
+ _self[logFunc](message.message);
895
+ _messageLogged[messageKey] = true;
896
+ }
897
+ }
898
+ else {
899
+ if (logLevel >= severity) {
900
+ _self[logFunc](message.message);
901
+ }
902
+ }
903
+ _self.logInternalMessage(severity, message);
904
+ }
905
+ else {
906
+ _debugExtMsg("throw" + (severity === 1 ? "Critical" : "Warning"), message);
907
+ }
908
+ }
909
+ };
910
+ _self.warnToConsole = function (message) {
911
+ _logToConsole("warn", message);
912
+ _debugExtMsg("warning", message);
913
+ };
914
+ _self.errorToConsole = function (message) {
915
+ _logToConsole("error", message);
916
+ _debugExtMsg("error", message);
917
+ };
918
+ _self.resetInternalMessageCount = function () {
919
+ _messageCount = 0;
920
+ _messageLogged = {};
921
+ };
922
+ _self.logInternalMessage = function (severity, message) {
923
+ if (_areInternalMessagesThrottled()) {
924
+ return;
925
+ }
926
+ var logMessage = true;
927
+ var messageKey = AIInternalMessagePrefix + message.messageId;
928
+ if (_messageLogged[messageKey]) {
929
+ logMessage = false;
930
+ }
931
+ else {
932
+ _messageLogged[messageKey] = true;
933
+ }
934
+ if (logMessage) {
935
+ if (severity <= _self.telemetryLoggingLevel()) {
936
+ _self.queue.push(message);
937
+ _messageCount++;
938
+ _debugExtMsg((severity === 1 ? "error" : "warn"), message);
939
+ }
940
+ if (_messageCount === _self.maxInternalMessageLimit()) {
941
+ var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app.";
942
+ var throttleMessage = new _InternalLogMessage(23 , throttleLimitMessage, false);
943
+ _self.queue.push(throttleMessage);
944
+ if (severity === 1 ) {
945
+ _self.errorToConsole(throttleLimitMessage);
946
+ }
947
+ else {
948
+ _self.warnToConsole(throttleLimitMessage);
949
+ }
950
+ }
951
+ }
952
+ };
953
+ function _getConfigValue(name, defValue) {
954
+ var value = config[name];
955
+ if (!isNullOrUndefined(value)) {
956
+ return value;
957
+ }
958
+ return defValue;
959
+ }
960
+ function _areInternalMessagesThrottled() {
961
+ return _messageCount >= _self.maxInternalMessageLimit();
962
+ }
963
+ function _debugExtMsg(name, data) {
964
+ var dbgExt = getDebugExt(config);
965
+ if (dbgExt && dbgExt.diagLog) {
966
+ dbgExt.diagLog(name, data);
967
+ }
968
+ }
969
+ });
970
+ }
971
+ return DiagnosticLogger;
972
+ }());
973
+ function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {
974
+ if (isUserAct === void 0) { isUserAct = false; }
975
+ (logger || new DiagnosticLogger()).throwInternal(severity, msgId, msg, properties, isUserAct);
976
+ }
977
+
561
978
  var UInt32Mask = 0x100000000;
562
979
  var MaxUInt32 = 0xffffffff;
563
980
  var _mwcSeeded = false;
@@ -859,7 +1276,7 @@
859
1276
  _supportsCookies = doc[strCookie] !== undefined;
860
1277
  }
861
1278
  catch (e) {
862
- logger && logger.throwInternal(2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
1279
+ _throwInternal(logger, 2 , 68 , "Cannot access document.cookie - " + getExceptionName(e), { exception: dumpObj(e) });
863
1280
  }
864
1281
  }
865
1282
  return _supportsCookies;
@@ -953,12 +1370,12 @@
953
1370
  }
954
1371
  return name;
955
1372
  }
956
- function _getEvtNamespace(eventName, namespaces) {
957
- if (namespaces) {
1373
+ function _getEvtNamespace(eventName, evtNamespace) {
1374
+ if (evtNamespace) {
958
1375
  var theNamespace_1 = "";
959
- if (isArray(namespaces)) {
1376
+ if (isArray(evtNamespace)) {
960
1377
  theNamespace_1 = "";
961
- arrForEach(namespaces, function (name) {
1378
+ arrForEach(evtNamespace, function (name) {
962
1379
  name = _normalizeNamespace(name);
963
1380
  if (name) {
964
1381
  if (name[0] !== ".") {
@@ -969,7 +1386,7 @@
969
1386
  });
970
1387
  }
971
1388
  else {
972
- theNamespace_1 = _normalizeNamespace(namespaces);
1389
+ theNamespace_1 = _normalizeNamespace(evtNamespace);
973
1390
  }
974
1391
  if (theNamespace_1) {
975
1392
  if (theNamespace_1[0] !== ".") {
@@ -1283,7 +1700,7 @@
1283
1700
  name = strTrim(name.toString());
1284
1701
  if (name.length > 150 ) {
1285
1702
  nameTrunc = name.substring(0, 150 );
1286
- logger && logger.throwInternal(2 , _InternalMessageId.NameTooLong, "name is too long. It has been truncated to " + 150 + " characters.", { name: name }, true);
1703
+ _throwInternal(logger, 2 , _InternalMessageId.NameTooLong, "name is too long. It has been truncated to " + 150 + " characters.", { name: name }, true);
1287
1704
  }
1288
1705
  }
1289
1706
  return nameTrunc || name;
@@ -1296,7 +1713,7 @@
1296
1713
  value = strTrim(value);
1297
1714
  if (value.toString().length > maxLength) {
1298
1715
  valueTrunc = value.toString().substring(0, maxLength);
1299
- logger && logger.throwInternal(2 , _InternalMessageId.StringValueTooLong, "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
1716
+ _throwInternal(logger, 2 , _InternalMessageId.StringValueTooLong, "string value is too long. It has been truncated to " + maxLength + " characters.", { value: value }, true);
1300
1717
  }
1301
1718
  }
1302
1719
  return valueTrunc || value;
@@ -1309,7 +1726,7 @@
1309
1726
  if (message) {
1310
1727
  if (message.length > 32768 ) {
1311
1728
  messageTrunc = message.substring(0, 32768 );
1312
- logger && logger.throwInternal(2 , _InternalMessageId.MessageTruncated, "message is too long, it has been truncated to " + 32768 + " characters.", { message: message }, true);
1729
+ _throwInternal(logger, 2 , _InternalMessageId.MessageTruncated, "message is too long, it has been truncated to " + 32768 + " characters.", { message: message }, true);
1313
1730
  }
1314
1731
  }
1315
1732
  return messageTrunc || message;
@@ -1320,7 +1737,7 @@
1320
1737
  var value = "" + exception;
1321
1738
  if (value.length > 32768 ) {
1322
1739
  exceptionTrunc = value.substring(0, 32768 );
1323
- logger && logger.throwInternal(2 , _InternalMessageId.ExceptionTruncated, "exception is too long, it has been truncated to " + 32768 + " characters.", { exception: exception }, true);
1740
+ _throwInternal(logger, 2 , _InternalMessageId.ExceptionTruncated, "exception is too long, it has been truncated to " + 32768 + " characters.", { exception: exception }, true);
1324
1741
  }
1325
1742
  }
1326
1743
  return exceptionTrunc || exception;
@@ -1334,7 +1751,7 @@
1334
1751
  value = getJSON().stringify(value);
1335
1752
  }
1336
1753
  catch (e) {
1337
- logger && logger.throwInternal(2 , _InternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e }, true);
1754
+ _throwInternal(logger, 2 , _InternalMessageId.CannotSerializeObjectNonSerializable, "custom property is not valid", { exception: e }, true);
1338
1755
  }
1339
1756
  }
1340
1757
  value = dataSanitizeString(logger, value, 8192 );
@@ -1365,7 +1782,7 @@
1365
1782
  input = strTrim(input);
1366
1783
  if (input.length > maxLength) {
1367
1784
  inputTrunc = input.substring(0, maxLength);
1368
- logger && logger.throwInternal(2 , _msgId, "input is too long, it has been truncated to " + maxLength + " characters.", { data: input }, true);
1785
+ _throwInternal(logger, 2 , _msgId, "input is too long, it has been truncated to " + maxLength + " characters.", { data: input }, true);
1369
1786
  }
1370
1787
  }
1371
1788
  return inputTrunc || input;
@@ -1503,8 +1920,12 @@
1503
1920
  _canUseLocalStorage = false;
1504
1921
  _canUseSessionStorage = false;
1505
1922
  }
1506
- function utlCanUseLocalStorage() {
1507
- if (_canUseLocalStorage === undefined) {
1923
+ function utlEnableStorage() {
1924
+ _canUseLocalStorage = utlCanUseLocalStorage(true);
1925
+ _canUseSessionStorage = utlCanUseSessionStorage(true);
1926
+ }
1927
+ function utlCanUseLocalStorage(reset) {
1928
+ if (reset || _canUseLocalStorage === undefined) {
1508
1929
  _canUseLocalStorage = !!_getVerifiedStorageObject(StorageType.LocalStorage);
1509
1930
  }
1510
1931
  return _canUseLocalStorage;
@@ -1517,7 +1938,7 @@
1517
1938
  }
1518
1939
  catch (e) {
1519
1940
  _canUseLocalStorage = false;
1520
- logger.throwInternal(2 , _InternalMessageId.BrowserCannotReadLocalStorage, "Browser failed read of local storage. " + getExceptionName(e), { exception: dumpObj(e) });
1941
+ _throwInternal(logger, 2 , _InternalMessageId.BrowserCannotReadLocalStorage, "Browser failed read of local storage. " + getExceptionName(e), { exception: dumpObj(e) });
1521
1942
  }
1522
1943
  }
1523
1944
  return null;
@@ -1531,7 +1952,7 @@
1531
1952
  }
1532
1953
  catch (e) {
1533
1954
  _canUseLocalStorage = false;
1534
- logger.throwInternal(2 , _InternalMessageId.BrowserCannotWriteLocalStorage, "Browser failed write to local storage. " + getExceptionName(e), { exception: dumpObj(e) });
1955
+ _throwInternal(logger, 2 , _InternalMessageId.BrowserCannotWriteLocalStorage, "Browser failed write to local storage. " + getExceptionName(e), { exception: dumpObj(e) });
1535
1956
  }
1536
1957
  }
1537
1958
  return false;
@@ -1545,13 +1966,13 @@
1545
1966
  }
1546
1967
  catch (e) {
1547
1968
  _canUseLocalStorage = false;
1548
- logger.throwInternal(2 , _InternalMessageId.BrowserFailedRemovalFromLocalStorage, "Browser failed removal of local storage item. " + getExceptionName(e), { exception: dumpObj(e) });
1969
+ _throwInternal(logger, 2 , _InternalMessageId.BrowserFailedRemovalFromLocalStorage, "Browser failed removal of local storage item. " + getExceptionName(e), { exception: dumpObj(e) });
1549
1970
  }
1550
1971
  }
1551
1972
  return false;
1552
1973
  }
1553
- function utlCanUseSessionStorage() {
1554
- if (_canUseSessionStorage === undefined) {
1974
+ function utlCanUseSessionStorage(reset) {
1975
+ if (reset || _canUseSessionStorage === undefined) {
1555
1976
  _canUseSessionStorage = !!_getVerifiedStorageObject(StorageType.SessionStorage);
1556
1977
  }
1557
1978
  return _canUseSessionStorage;
@@ -1573,7 +1994,7 @@
1573
1994
  }
1574
1995
  catch (e) {
1575
1996
  _canUseSessionStorage = false;
1576
- logger.throwInternal(2 , _InternalMessageId.BrowserCannotReadSessionStorage, "Browser failed read of session storage. " + getExceptionName(e), { exception: dumpObj(e) });
1997
+ _throwInternal(logger, 2 , _InternalMessageId.BrowserCannotReadSessionStorage, "Browser failed read of session storage. " + getExceptionName(e), { exception: dumpObj(e) });
1577
1998
  }
1578
1999
  }
1579
2000
  return null;
@@ -1587,7 +2008,7 @@
1587
2008
  }
1588
2009
  catch (e) {
1589
2010
  _canUseSessionStorage = false;
1590
- logger.throwInternal(2 , _InternalMessageId.BrowserCannotWriteSessionStorage, "Browser failed write to session storage. " + getExceptionName(e), { exception: dumpObj(e) });
2011
+ _throwInternal(logger, 2 , _InternalMessageId.BrowserCannotWriteSessionStorage, "Browser failed write to session storage. " + getExceptionName(e), { exception: dumpObj(e) });
1591
2012
  }
1592
2013
  }
1593
2014
  return false;
@@ -1601,7 +2022,7 @@
1601
2022
  }
1602
2023
  catch (e) {
1603
2024
  _canUseSessionStorage = false;
1604
- logger.throwInternal(2 , _InternalMessageId.BrowserFailedRemovalFromSessionStorage, "Browser failed removal of session storage item. " + getExceptionName(e), { exception: dumpObj(e) });
2025
+ _throwInternal(logger, 2 , _InternalMessageId.BrowserFailedRemovalFromSessionStorage, "Browser failed removal of session storage item. " + getExceptionName(e), { exception: dumpObj(e) });
1605
2026
  }
1606
2027
  }
1607
2028
  return false;
@@ -2921,6 +3342,7 @@
2921
3342
  exports.utlCanUseLocalStorage = utlCanUseLocalStorage;
2922
3343
  exports.utlCanUseSessionStorage = utlCanUseSessionStorage;
2923
3344
  exports.utlDisableStorage = utlDisableStorage;
3345
+ exports.utlEnableStorage = utlEnableStorage;
2924
3346
  exports.utlGetLocalStorage = utlGetLocalStorage;
2925
3347
  exports.utlGetSessionStorage = utlGetSessionStorage;
2926
3348
  exports.utlGetSessionStorageKeys = utlGetSessionStorageKeys;