@microsoft/applicationinsights-clickanalytics-js 2.7.5-nightly.2204-03 → 2.7.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/browser/ai.clck.2.7.6.cjs.js +2013 -0
- package/browser/ai.clck.2.7.6.cjs.js.map +1 -0
- package/browser/ai.clck.2.7.6.cjs.min.js +6 -0
- package/browser/ai.clck.2.7.6.cjs.min.js.map +1 -0
- package/browser/ai.clck.2.7.6.gbl.js +2017 -0
- package/browser/ai.clck.2.7.6.gbl.js.map +1 -0
- package/browser/ai.clck.2.7.6.gbl.min.js +6 -0
- package/browser/ai.clck.2.7.6.gbl.min.js.map +1 -0
- package/browser/ai.clck.2.7.6.integrity.json +66 -0
- package/browser/ai.clck.2.7.6.js +2019 -0
- package/browser/ai.clck.2.7.6.js.map +1 -0
- package/browser/ai.clck.2.7.6.min.js +6 -0
- package/browser/ai.clck.2.7.6.min.js.map +1 -0
- package/browser/ai.clck.2.cjs.js +818 -1688
- package/browser/ai.clck.2.cjs.js.map +1 -1
- package/browser/ai.clck.2.cjs.min.js +2 -2
- package/browser/ai.clck.2.cjs.min.js.map +1 -1
- package/browser/ai.clck.2.gbl.js +818 -1688
- package/browser/ai.clck.2.gbl.js.map +1 -1
- package/browser/ai.clck.2.gbl.min.js +2 -2
- package/browser/ai.clck.2.gbl.min.js.map +1 -1
- package/browser/ai.clck.2.js +818 -1688
- package/browser/ai.clck.2.js.map +1 -1
- package/browser/ai.clck.2.min.js +2 -2
- package/browser/ai.clck.2.min.js.map +1 -1
- package/dist/applicationinsights-clickanalytics-js.api.json +27 -29
- package/dist/applicationinsights-clickanalytics-js.api.md +0 -1
- package/dist/applicationinsights-clickanalytics-js.d.ts +5 -2
- package/dist/applicationinsights-clickanalytics-js.js +818 -1688
- package/dist/applicationinsights-clickanalytics-js.js.map +1 -1
- package/dist/applicationinsights-clickanalytics-js.min.js +2 -2
- package/dist/applicationinsights-clickanalytics-js.min.js.map +1 -1
- package/dist/applicationinsights-clickanalytics-js.rollup.d.ts +5 -2
- package/dist-esm/Behaviours.js +1 -1
- package/dist-esm/ClickAnalyticsPlugin.js +50 -74
- package/dist-esm/ClickAnalyticsPlugin.js.map +1 -1
- package/dist-esm/DataCollector.js +2 -4
- package/dist-esm/DataCollector.js.map +1 -1
- package/dist-esm/Enums.js +1 -1
- package/dist-esm/Interfaces/Datamodel.js +1 -1
- package/dist-esm/applicationinsights-clickanalytics-js.js +1 -1
- package/dist-esm/common/Utils.js +1 -1
- package/dist-esm/events/PageAction.js +126 -128
- package/dist-esm/events/PageAction.js.map +1 -1
- package/dist-esm/events/WebEvent.js +94 -109
- package/dist-esm/events/WebEvent.js.map +1 -1
- package/dist-esm/handlers/AutoCaptureHandler.js +83 -85
- package/dist-esm/handlers/AutoCaptureHandler.js.map +1 -1
- package/dist-esm/handlers/DomContentHandler.js +276 -279
- package/dist-esm/handlers/DomContentHandler.js.map +1 -1
- package/package.json +56 -59
- package/src/ClickAnalyticsPlugin.ts +47 -92
- package/src/DataCollector.ts +22 -24
- package/src/Interfaces/Datamodel.ts +21 -20
- package/src/common/Utils.ts +8 -8
- package/src/events/PageAction.ts +131 -165
- package/src/events/WebEvent.ts +78 -147
- package/src/handlers/AutoCaptureHandler.ts +79 -89
- package/src/handlers/DomContentHandler.ts +303 -336
- package/types/ClickAnalyticsPlugin.d.ts +4 -1
- package/types/Interfaces/Datamodel.d.ts +2 -3
- package/types/events/PageAction.d.ts +6 -6
- package/types/events/WebEvent.d.ts +17 -17
- package/types/handlers/AutoCaptureHandler.d.ts +10 -2
- package/types/handlers/DomContentHandler.d.ts +50 -3
- package/types/tsdoc-metadata.json +1 -1
- package/browser/ai.clck.2.7.5-nightly.2204-03.cjs.js +0 -2883
- package/browser/ai.clck.2.7.5-nightly.2204-03.cjs.js.map +0 -1
- package/browser/ai.clck.2.7.5-nightly.2204-03.cjs.min.js +0 -6
- package/browser/ai.clck.2.7.5-nightly.2204-03.cjs.min.js.map +0 -1
- package/browser/ai.clck.2.7.5-nightly.2204-03.gbl.js +0 -2887
- package/browser/ai.clck.2.7.5-nightly.2204-03.gbl.js.map +0 -1
- package/browser/ai.clck.2.7.5-nightly.2204-03.gbl.min.js +0 -6
- package/browser/ai.clck.2.7.5-nightly.2204-03.gbl.min.js.map +0 -1
- package/browser/ai.clck.2.7.5-nightly.2204-03.integrity.json +0 -66
- package/browser/ai.clck.2.7.5-nightly.2204-03.js +0 -2889
- package/browser/ai.clck.2.7.5-nightly.2204-03.js.map +0 -1
- package/browser/ai.clck.2.7.5-nightly.2204-03.min.js +0 -6
- package/browser/ai.clck.2.7.5-nightly.2204-03.min.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Application Insights JavaScript SDK - Click Analytics, 2.7.
|
|
2
|
+
* Application Insights JavaScript SDK - Click Analytics, 2.7.6
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -75,9 +75,7 @@
|
|
|
75
75
|
var __assignFn = ObjAssign || __objAssignFnImpl;
|
|
76
76
|
var extendStaticsFn = function (d, b) {
|
|
77
77
|
extendStaticsFn = ObjClass["setPrototypeOf"] ||
|
|
78
|
-
({ __proto__: [] } instanceof Array && function (d, b) {
|
|
79
|
-
d.__proto__ = b;
|
|
80
|
-
}) ||
|
|
78
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
81
79
|
function (d, b) {
|
|
82
80
|
for (var p in b) {
|
|
83
81
|
if (b[strShimHasOwnProperty](p)) {
|
|
@@ -92,14 +90,12 @@
|
|
|
92
90
|
throwTypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
93
91
|
}
|
|
94
92
|
extendStaticsFn(d, b);
|
|
95
|
-
function __() {
|
|
96
|
-
this.constructor = d;
|
|
97
|
-
}
|
|
93
|
+
function __() { this.constructor = d; }
|
|
98
94
|
d[strShimPrototype] = b === null ? objCreateFn(b) : (__[strShimPrototype] = b[strShimPrototype], new __());
|
|
99
95
|
}
|
|
100
96
|
|
|
101
97
|
/*!
|
|
102
|
-
* Microsoft Dynamic Proto Utility, 1.1.
|
|
98
|
+
* Microsoft Dynamic Proto Utility, 1.1.6
|
|
103
99
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
104
100
|
*/
|
|
105
101
|
var Constructor = 'constructor';
|
|
@@ -113,11 +109,14 @@
|
|
|
113
109
|
var DynAllowInstChkTag = DynInstChkTag;
|
|
114
110
|
var DynProtoDefaultOptions = '_dfOpts';
|
|
115
111
|
var UnknownValue = '_unknown_';
|
|
116
|
-
var str__Proto
|
|
112
|
+
var str__Proto = "__proto__";
|
|
113
|
+
var DynProtoBaseProto = "_dyn" + str__Proto;
|
|
114
|
+
var DynProtoCurrent = "_dynInstProto";
|
|
117
115
|
var strUseBaseInst = 'useBaseInst';
|
|
118
116
|
var strSetInstFuncs = 'setInstFuncs';
|
|
119
117
|
var Obj = Object;
|
|
120
|
-
var _objGetPrototypeOf
|
|
118
|
+
var _objGetPrototypeOf = Obj["getPrototypeOf"];
|
|
119
|
+
var _objGetOwnProps = Obj["getOwnPropertyNames"];
|
|
121
120
|
var _dynamicNames = 0;
|
|
122
121
|
function _hasOwnProperty(obj, prop) {
|
|
123
122
|
return obj && Obj[Prototype$1].hasOwnProperty.call(obj, prop);
|
|
@@ -128,23 +127,26 @@
|
|
|
128
127
|
function _isObjectArrayOrFunctionPrototype(target) {
|
|
129
128
|
return _isObjectOrArrayPrototype(target) || target === Function[Prototype$1];
|
|
130
129
|
}
|
|
131
|
-
function _getObjProto
|
|
130
|
+
function _getObjProto(target) {
|
|
131
|
+
var newProto;
|
|
132
132
|
if (target) {
|
|
133
|
-
if (_objGetPrototypeOf
|
|
134
|
-
return _objGetPrototypeOf
|
|
133
|
+
if (_objGetPrototypeOf) {
|
|
134
|
+
return _objGetPrototypeOf(target);
|
|
135
135
|
}
|
|
136
|
-
var
|
|
137
|
-
|
|
138
|
-
|
|
136
|
+
var curProto = target[str__Proto] || target[Prototype$1] || (target[Constructor] ? target[Constructor][Prototype$1] : null);
|
|
137
|
+
newProto = target[DynProtoBaseProto] || curProto;
|
|
138
|
+
if (!_hasOwnProperty(target, DynProtoBaseProto)) {
|
|
139
|
+
delete target[DynProtoCurrent];
|
|
140
|
+
newProto = target[DynProtoBaseProto] = target[DynProtoCurrent] || target[DynProtoBaseProto];
|
|
141
|
+
target[DynProtoCurrent] = curProto;
|
|
139
142
|
}
|
|
140
143
|
}
|
|
141
|
-
return
|
|
144
|
+
return newProto;
|
|
142
145
|
}
|
|
143
146
|
function _forEachProp(target, func) {
|
|
144
147
|
var props = [];
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
props = getOwnProps(target);
|
|
148
|
+
if (_objGetOwnProps) {
|
|
149
|
+
props = _objGetOwnProps(target);
|
|
148
150
|
}
|
|
149
151
|
else {
|
|
150
152
|
for (var name_1 in target) {
|
|
@@ -199,16 +201,16 @@
|
|
|
199
201
|
_forEachProp(instFuncs, function (name) {
|
|
200
202
|
baseFuncs[name] = _instFuncProxy(thisTarget, instFuncs, name);
|
|
201
203
|
});
|
|
202
|
-
var baseProto = _getObjProto
|
|
204
|
+
var baseProto = _getObjProto(classProto);
|
|
203
205
|
var visited = [];
|
|
204
206
|
while (baseProto && !_isObjectArrayOrFunctionPrototype(baseProto) && !_hasVisited(visited, baseProto)) {
|
|
205
207
|
_forEachProp(baseProto, function (name) {
|
|
206
|
-
if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf
|
|
208
|
+
if (!baseFuncs[name] && _isDynamicCandidate(baseProto, name, !_objGetPrototypeOf)) {
|
|
207
209
|
baseFuncs[name] = _instFuncProxy(thisTarget, baseProto, name);
|
|
208
210
|
}
|
|
209
211
|
});
|
|
210
212
|
visited.push(baseProto);
|
|
211
|
-
baseProto = _getObjProto
|
|
213
|
+
baseProto = _getObjProto(baseProto);
|
|
212
214
|
}
|
|
213
215
|
return baseFuncs;
|
|
214
216
|
}
|
|
@@ -222,7 +224,7 @@
|
|
|
222
224
|
}
|
|
223
225
|
if (!instFunc[DynInstChkTag] && instFuncTable[DynAllowInstChkTag] !== false) {
|
|
224
226
|
var canAddInst = !_hasOwnProperty(target, funcName);
|
|
225
|
-
var objProto = _getObjProto
|
|
227
|
+
var objProto = _getObjProto(target);
|
|
226
228
|
var visited = [];
|
|
227
229
|
while (canAddInst && objProto && !_isObjectArrayOrFunctionPrototype(objProto) && !_hasVisited(visited, objProto)) {
|
|
228
230
|
var protoFunc = objProto[funcName];
|
|
@@ -231,7 +233,7 @@
|
|
|
231
233
|
break;
|
|
232
234
|
}
|
|
233
235
|
visited.push(objProto);
|
|
234
|
-
objProto = _getObjProto
|
|
236
|
+
objProto = _getObjProto(objProto);
|
|
235
237
|
}
|
|
236
238
|
try {
|
|
237
239
|
if (canAddInst) {
|
|
@@ -249,7 +251,7 @@
|
|
|
249
251
|
function _getProtoFunc(funcName, proto, currentDynProtoProxy) {
|
|
250
252
|
var protoFunc = proto[funcName];
|
|
251
253
|
if (protoFunc === currentDynProtoProxy) {
|
|
252
|
-
protoFunc = _getObjProto
|
|
254
|
+
protoFunc = _getObjProto(proto)[funcName];
|
|
253
255
|
}
|
|
254
256
|
if (typeof protoFunc !== strFunction) {
|
|
255
257
|
_throwTypeError("[" + funcName + "] is not a " + strFunction);
|
|
@@ -283,18 +285,19 @@
|
|
|
283
285
|
}
|
|
284
286
|
}
|
|
285
287
|
function _checkPrototype(classProto, thisTarget) {
|
|
286
|
-
if (_objGetPrototypeOf
|
|
288
|
+
if (_objGetPrototypeOf) {
|
|
287
289
|
var visited = [];
|
|
288
|
-
var thisProto = _getObjProto
|
|
290
|
+
var thisProto = _getObjProto(thisTarget);
|
|
289
291
|
while (thisProto && !_isObjectArrayOrFunctionPrototype(thisProto) && !_hasVisited(visited, thisProto)) {
|
|
290
292
|
if (thisProto === classProto) {
|
|
291
293
|
return true;
|
|
292
294
|
}
|
|
293
295
|
visited.push(thisProto);
|
|
294
|
-
thisProto = _getObjProto
|
|
296
|
+
thisProto = _getObjProto(thisProto);
|
|
295
297
|
}
|
|
298
|
+
return false;
|
|
296
299
|
}
|
|
297
|
-
return
|
|
300
|
+
return true;
|
|
298
301
|
}
|
|
299
302
|
function _getObjName(target, unknownValue) {
|
|
300
303
|
if (_hasOwnProperty(target, Prototype$1)) {
|
|
@@ -327,7 +330,7 @@
|
|
|
327
330
|
var instFuncs = _getInstanceFuncs(target);
|
|
328
331
|
var baseFuncs = _getBaseFuncs(classProto, target, instFuncs, useBaseInst);
|
|
329
332
|
delegateFunc(target, baseFuncs);
|
|
330
|
-
var setInstanceFunc = !!_objGetPrototypeOf
|
|
333
|
+
var setInstanceFunc = !!_objGetPrototypeOf && !!perfOptions[strSetInstFuncs];
|
|
331
334
|
if (setInstanceFunc && options) {
|
|
332
335
|
setInstanceFunc = !!options[strSetInstFuncs];
|
|
333
336
|
}
|
|
@@ -339,52 +342,105 @@
|
|
|
339
342
|
};
|
|
340
343
|
dynamicProto[DynProtoDefaultOptions] = perfDefaults;
|
|
341
344
|
|
|
342
|
-
var
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
var
|
|
348
|
-
|
|
349
|
-
|
|
345
|
+
var LoggingSeverity;
|
|
346
|
+
(function (LoggingSeverity) {
|
|
347
|
+
LoggingSeverity[LoggingSeverity["CRITICAL"] = 1] = "CRITICAL";
|
|
348
|
+
LoggingSeverity[LoggingSeverity["WARNING"] = 2] = "WARNING";
|
|
349
|
+
})(LoggingSeverity || (LoggingSeverity = {}));
|
|
350
|
+
var _InternalMessageId = {
|
|
351
|
+
BrowserDoesNotSupportLocalStorage: 0,
|
|
352
|
+
BrowserCannotReadLocalStorage: 1,
|
|
353
|
+
BrowserCannotReadSessionStorage: 2,
|
|
354
|
+
BrowserCannotWriteLocalStorage: 3,
|
|
355
|
+
BrowserCannotWriteSessionStorage: 4,
|
|
356
|
+
BrowserFailedRemovalFromLocalStorage: 5,
|
|
357
|
+
BrowserFailedRemovalFromSessionStorage: 6,
|
|
358
|
+
CannotSendEmptyTelemetry: 7,
|
|
359
|
+
ClientPerformanceMathError: 8,
|
|
360
|
+
ErrorParsingAISessionCookie: 9,
|
|
361
|
+
ErrorPVCalc: 10,
|
|
362
|
+
ExceptionWhileLoggingError: 11,
|
|
363
|
+
FailedAddingTelemetryToBuffer: 12,
|
|
364
|
+
FailedMonitorAjaxAbort: 13,
|
|
365
|
+
FailedMonitorAjaxDur: 14,
|
|
366
|
+
FailedMonitorAjaxOpen: 15,
|
|
367
|
+
FailedMonitorAjaxRSC: 16,
|
|
368
|
+
FailedMonitorAjaxSend: 17,
|
|
369
|
+
FailedMonitorAjaxGetCorrelationHeader: 18,
|
|
370
|
+
FailedToAddHandlerForOnBeforeUnload: 19,
|
|
371
|
+
FailedToSendQueuedTelemetry: 20,
|
|
372
|
+
FailedToReportDataLoss: 21,
|
|
373
|
+
FlushFailed: 22,
|
|
374
|
+
MessageLimitPerPVExceeded: 23,
|
|
375
|
+
MissingRequiredFieldSpecification: 24,
|
|
376
|
+
NavigationTimingNotSupported: 25,
|
|
377
|
+
OnError: 26,
|
|
378
|
+
SessionRenewalDateIsZero: 27,
|
|
379
|
+
SenderNotInitialized: 28,
|
|
380
|
+
StartTrackEventFailed: 29,
|
|
381
|
+
StopTrackEventFailed: 30,
|
|
382
|
+
StartTrackFailed: 31,
|
|
383
|
+
StopTrackFailed: 32,
|
|
384
|
+
TelemetrySampledAndNotSent: 33,
|
|
385
|
+
TrackEventFailed: 34,
|
|
386
|
+
TrackExceptionFailed: 35,
|
|
387
|
+
TrackMetricFailed: 36,
|
|
388
|
+
TrackPVFailed: 37,
|
|
389
|
+
TrackPVFailedCalc: 38,
|
|
390
|
+
TrackTraceFailed: 39,
|
|
391
|
+
TransmissionFailed: 40,
|
|
392
|
+
FailedToSetStorageBuffer: 41,
|
|
393
|
+
FailedToRestoreStorageBuffer: 42,
|
|
394
|
+
InvalidBackendResponse: 43,
|
|
395
|
+
FailedToFixDepricatedValues: 44,
|
|
396
|
+
InvalidDurationValue: 45,
|
|
397
|
+
TelemetryEnvelopeInvalid: 46,
|
|
398
|
+
CreateEnvelopeError: 47,
|
|
399
|
+
CannotSerializeObject: 48,
|
|
400
|
+
CannotSerializeObjectNonSerializable: 49,
|
|
401
|
+
CircularReferenceDetected: 50,
|
|
402
|
+
ClearAuthContextFailed: 51,
|
|
403
|
+
ExceptionTruncated: 52,
|
|
404
|
+
IllegalCharsInName: 53,
|
|
405
|
+
ItemNotInArray: 54,
|
|
406
|
+
MaxAjaxPerPVExceeded: 55,
|
|
407
|
+
MessageTruncated: 56,
|
|
408
|
+
NameTooLong: 57,
|
|
409
|
+
SampleRateOutOfRange: 58,
|
|
410
|
+
SetAuthContextFailed: 59,
|
|
411
|
+
SetAuthContextFailedAccountName: 60,
|
|
412
|
+
StringValueTooLong: 61,
|
|
413
|
+
StartCalledMoreThanOnce: 62,
|
|
414
|
+
StopCalledWithoutStart: 63,
|
|
415
|
+
TelemetryInitializerFailed: 64,
|
|
416
|
+
TrackArgumentsNotSpecified: 65,
|
|
417
|
+
UrlTooLong: 66,
|
|
418
|
+
SessionStorageBufferFull: 67,
|
|
419
|
+
CannotAccessCookie: 68,
|
|
420
|
+
IdTooLong: 69,
|
|
421
|
+
InvalidEvent: 70,
|
|
422
|
+
FailedMonitorAjaxSetRequestHeader: 71,
|
|
423
|
+
SendBrowserInfoOnUserInit: 72,
|
|
424
|
+
PluginException: 73,
|
|
425
|
+
NotificationException: 74,
|
|
426
|
+
SnippetScriptLoadFailure: 99,
|
|
427
|
+
InvalidInstrumentationKey: 100,
|
|
428
|
+
CannotParseAiBlobValue: 101,
|
|
429
|
+
InvalidContentBlob: 102,
|
|
430
|
+
TrackPageActionEventFailed: 103,
|
|
431
|
+
FailedAddingCustomDefinedRequestContext: 104,
|
|
432
|
+
InMemoryStorageBufferFull: 105
|
|
433
|
+
};
|
|
350
434
|
|
|
351
|
-
var
|
|
352
|
-
var
|
|
353
|
-
var
|
|
354
|
-
var cStrTrim = "trim";
|
|
435
|
+
var strOnPrefix = "on";
|
|
436
|
+
var strAttachEvent = "attachEvent";
|
|
437
|
+
var strAddEventHelper = "addEventListener";
|
|
355
438
|
var strToString = "toString";
|
|
356
|
-
var
|
|
357
|
-
var strConstructor = "constructor";
|
|
358
|
-
var _objDefineProperty$1 = ObjDefineProperty;
|
|
359
|
-
var _objFreeze = ObjClass.freeze;
|
|
360
|
-
ObjClass.seal;
|
|
361
|
-
var _objKeys = ObjClass.keys;
|
|
362
|
-
var StringProto = String[strShimPrototype];
|
|
363
|
-
StringProto[cStrTrim];
|
|
364
|
-
StringProto[cStrEndsWith];
|
|
365
|
-
StringProto[cStrStartsWith];
|
|
366
|
-
var DateProto = Date[strShimPrototype];
|
|
367
|
-
DateProto[strToISOString];
|
|
439
|
+
var _objDefineProperty = ObjDefineProperty;
|
|
368
440
|
var _isArray = Array.isArray;
|
|
369
441
|
var _objToString = ObjProto[strToString];
|
|
370
442
|
var _fnToString = ObjHasOwnProperty[strToString];
|
|
371
|
-
|
|
372
|
-
var rCamelCase = /-([a-z])/g;
|
|
373
|
-
var rNormalizeInvalid = /([^\w\d_$])/g;
|
|
374
|
-
var rLeadingNumeric = /^(\d+[\w\d_$])/;
|
|
375
|
-
var _objGetPrototypeOf = Object["getPrototypeOf"];
|
|
376
|
-
function _getObjProto(target) {
|
|
377
|
-
if (target) {
|
|
378
|
-
if (_objGetPrototypeOf) {
|
|
379
|
-
return _objGetPrototypeOf(target);
|
|
380
|
-
}
|
|
381
|
-
var newProto = target[str__Proto] || target[strShimPrototype] || target[strConstructor];
|
|
382
|
-
if (newProto) {
|
|
383
|
-
return newProto;
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
return null;
|
|
387
|
-
}
|
|
443
|
+
_fnToString.call(ObjClass);
|
|
388
444
|
function isUndefined(value) {
|
|
389
445
|
return value === undefined || typeof value === strShimUndefined;
|
|
390
446
|
}
|
|
@@ -394,24 +450,27 @@
|
|
|
394
450
|
function hasOwnProperty(obj, prop) {
|
|
395
451
|
return !!(obj && ObjHasOwnProperty.call(obj, prop));
|
|
396
452
|
}
|
|
397
|
-
function isObject(value) {
|
|
398
|
-
return !!(value && typeof value === strShimObject);
|
|
399
|
-
}
|
|
400
453
|
function isFunction(value) {
|
|
401
454
|
return !!(value && typeof value === strShimFunction);
|
|
402
455
|
}
|
|
403
|
-
function
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
456
|
+
function attachEvent(obj, eventNameWithoutOn, handlerRef, useCapture) {
|
|
457
|
+
if (useCapture === void 0) { useCapture = false; }
|
|
458
|
+
var result = false;
|
|
459
|
+
if (!isNullOrUndefined(obj)) {
|
|
460
|
+
try {
|
|
461
|
+
if (!isNullOrUndefined(obj[strAddEventHelper])) {
|
|
462
|
+
obj[strAddEventHelper](eventNameWithoutOn, handlerRef, useCapture);
|
|
463
|
+
result = true;
|
|
464
|
+
}
|
|
465
|
+
else if (!isNullOrUndefined(obj[strAttachEvent])) {
|
|
466
|
+
obj[strAttachEvent](strOnPrefix + eventNameWithoutOn, handlerRef);
|
|
467
|
+
result = true;
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
catch (e) {
|
|
471
|
+
}
|
|
413
472
|
}
|
|
414
|
-
return
|
|
473
|
+
return result;
|
|
415
474
|
}
|
|
416
475
|
function objForEachKey(target, callbackfn) {
|
|
417
476
|
if (target) {
|
|
@@ -422,12 +481,6 @@
|
|
|
422
481
|
}
|
|
423
482
|
}
|
|
424
483
|
}
|
|
425
|
-
function strContains(value, search) {
|
|
426
|
-
if (value && search) {
|
|
427
|
-
return value.indexOf(search) !== -1;
|
|
428
|
-
}
|
|
429
|
-
return false;
|
|
430
|
-
}
|
|
431
484
|
var isArray = _isArray || _isArrayPoly;
|
|
432
485
|
function _isArrayPoly(obj) {
|
|
433
486
|
return !!(obj && _objToString.call(obj) === "[object Array]");
|
|
@@ -435,28 +488,6 @@
|
|
|
435
488
|
function isError(obj) {
|
|
436
489
|
return !!(obj && _objToString.call(obj) === "[object Error]");
|
|
437
490
|
}
|
|
438
|
-
function isString(value) {
|
|
439
|
-
return typeof value === "string";
|
|
440
|
-
}
|
|
441
|
-
function isBoolean(value) {
|
|
442
|
-
return typeof value === "boolean";
|
|
443
|
-
}
|
|
444
|
-
function isPlainObject(value) {
|
|
445
|
-
var result = false;
|
|
446
|
-
if (value && typeof value === "object") {
|
|
447
|
-
var proto = _objGetPrototypeOf ? _objGetPrototypeOf(value) : _getObjProto(value);
|
|
448
|
-
if (!proto) {
|
|
449
|
-
result = true;
|
|
450
|
-
}
|
|
451
|
-
else {
|
|
452
|
-
if (proto[strConstructor] && ObjHasOwnProperty.call(proto, strConstructor)) {
|
|
453
|
-
proto = proto[strConstructor];
|
|
454
|
-
}
|
|
455
|
-
result = typeof proto === strShimFunction && _fnToString.call(proto) === _objFunctionString;
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
return result;
|
|
459
|
-
}
|
|
460
491
|
function arrForEach(arr, callbackfn, thisArg) {
|
|
461
492
|
var len = arr.length;
|
|
462
493
|
try {
|
|
@@ -471,42 +502,8 @@
|
|
|
471
502
|
catch (e) {
|
|
472
503
|
}
|
|
473
504
|
}
|
|
474
|
-
var _objKeysHasDontEnumBug = !({ toString: null }).propertyIsEnumerable("toString");
|
|
475
|
-
var _objKeysDontEnums = [
|
|
476
|
-
"toString",
|
|
477
|
-
"toLocaleString",
|
|
478
|
-
"valueOf",
|
|
479
|
-
"hasOwnProperty",
|
|
480
|
-
"isPrototypeOf",
|
|
481
|
-
"propertyIsEnumerable",
|
|
482
|
-
"constructor"
|
|
483
|
-
];
|
|
484
|
-
function objKeys(obj) {
|
|
485
|
-
var objType = typeof obj;
|
|
486
|
-
if (objType !== strShimFunction && (objType !== strShimObject || obj === null)) {
|
|
487
|
-
throwTypeError("objKeys called on non-object");
|
|
488
|
-
}
|
|
489
|
-
if (!_objKeysHasDontEnumBug && _objKeys) {
|
|
490
|
-
return _objKeys(obj);
|
|
491
|
-
}
|
|
492
|
-
var result = [];
|
|
493
|
-
for (var prop in obj) {
|
|
494
|
-
if (obj && ObjHasOwnProperty.call(obj, prop)) {
|
|
495
|
-
result.push(prop);
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
if (_objKeysHasDontEnumBug) {
|
|
499
|
-
var dontEnumsLength = _objKeysDontEnums.length;
|
|
500
|
-
for (var lp = 0; lp < dontEnumsLength; lp++) {
|
|
501
|
-
if (obj && ObjHasOwnProperty.call(obj, _objKeysDontEnums[lp])) {
|
|
502
|
-
result.push(_objKeysDontEnums[lp]);
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
}
|
|
506
|
-
return result;
|
|
507
|
-
}
|
|
508
505
|
function objDefineAccessors(target, prop, getProp, setProp) {
|
|
509
|
-
if (_objDefineProperty
|
|
506
|
+
if (_objDefineProperty) {
|
|
510
507
|
try {
|
|
511
508
|
var descriptor = {
|
|
512
509
|
enumerable: true,
|
|
@@ -518,7 +515,7 @@
|
|
|
518
515
|
if (setProp) {
|
|
519
516
|
descriptor.set = setProp;
|
|
520
517
|
}
|
|
521
|
-
_objDefineProperty
|
|
518
|
+
_objDefineProperty(target, prop, descriptor);
|
|
522
519
|
return true;
|
|
523
520
|
}
|
|
524
521
|
catch (e) {
|
|
@@ -526,10 +523,6 @@
|
|
|
526
523
|
}
|
|
527
524
|
return false;
|
|
528
525
|
}
|
|
529
|
-
function _doNothing(value) {
|
|
530
|
-
return value;
|
|
531
|
-
}
|
|
532
|
-
var objFreeze = _objFreeze || _doNothing;
|
|
533
526
|
function dateNow() {
|
|
534
527
|
var dt = Date;
|
|
535
528
|
return dt.now ? dt.now() : new dt().getTime();
|
|
@@ -538,7 +531,7 @@
|
|
|
538
531
|
if (isError(object)) {
|
|
539
532
|
return object.name;
|
|
540
533
|
}
|
|
541
|
-
return
|
|
534
|
+
return "";
|
|
542
535
|
}
|
|
543
536
|
function setValue(target, field, value, valChk, srcChk) {
|
|
544
537
|
var theValue = value;
|
|
@@ -551,105 +544,13 @@
|
|
|
551
544
|
}
|
|
552
545
|
return theValue;
|
|
553
546
|
}
|
|
554
|
-
function throwError(message) {
|
|
555
|
-
throw new Error(message);
|
|
556
|
-
}
|
|
557
|
-
function _createProxyFunction(source, funcName) {
|
|
558
|
-
var srcFunc = null;
|
|
559
|
-
var src = null;
|
|
560
|
-
if (isFunction(source)) {
|
|
561
|
-
srcFunc = source;
|
|
562
|
-
}
|
|
563
|
-
else {
|
|
564
|
-
src = source;
|
|
565
|
-
}
|
|
566
|
-
return function () {
|
|
567
|
-
var originalArguments = arguments;
|
|
568
|
-
if (srcFunc) {
|
|
569
|
-
src = srcFunc();
|
|
570
|
-
}
|
|
571
|
-
if (src) {
|
|
572
|
-
return src[funcName].apply(src, originalArguments);
|
|
573
|
-
}
|
|
574
|
-
};
|
|
575
|
-
}
|
|
576
|
-
function proxyFunctionAs(target, name, source, theFunc, overwriteTarget) {
|
|
577
|
-
if (overwriteTarget === void 0) { overwriteTarget = true; }
|
|
578
|
-
if (target && name && source) {
|
|
579
|
-
if (overwriteTarget || isUndefined(target[name])) {
|
|
580
|
-
target[name] = _createProxyFunction(source, theFunc);
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
function createEnumStyle(values) {
|
|
585
|
-
var enumClass = {};
|
|
586
|
-
objForEachKey(values, function (field, value) {
|
|
587
|
-
enumClass[field] = value;
|
|
588
|
-
if (!isUndefined(enumClass[value])) {
|
|
589
|
-
throwError("[" + value + "] exists for " + field);
|
|
590
|
-
}
|
|
591
|
-
enumClass[value] = field;
|
|
592
|
-
});
|
|
593
|
-
return objFreeze(enumClass);
|
|
594
|
-
}
|
|
595
|
-
function objExtend(obj1, obj2, obj3, obj4, obj5, obj6) {
|
|
596
|
-
var theArgs = arguments;
|
|
597
|
-
var extended = theArgs[0] || {};
|
|
598
|
-
var argLen = theArgs.length;
|
|
599
|
-
var deep = false;
|
|
600
|
-
var idx = 1;
|
|
601
|
-
if (argLen > 0 && isBoolean(extended)) {
|
|
602
|
-
deep = extended;
|
|
603
|
-
extended = theArgs[idx] || {};
|
|
604
|
-
idx++;
|
|
605
|
-
}
|
|
606
|
-
if (!isObject(extended)) {
|
|
607
|
-
extended = {};
|
|
608
|
-
}
|
|
609
|
-
for (; idx < argLen; idx++) {
|
|
610
|
-
var arg = theArgs[idx];
|
|
611
|
-
var isArgArray = isArray(arg);
|
|
612
|
-
var isArgObj = isObject(arg);
|
|
613
|
-
for (var prop in arg) {
|
|
614
|
-
var propOk = (isArgArray && (prop in arg)) || (isArgObj && (ObjHasOwnProperty.call(arg, prop)));
|
|
615
|
-
if (!propOk) {
|
|
616
|
-
continue;
|
|
617
|
-
}
|
|
618
|
-
var newValue = arg[prop];
|
|
619
|
-
var isNewArray = void 0;
|
|
620
|
-
if (deep && newValue && ((isNewArray = isArray(newValue)) || isPlainObject(newValue))) {
|
|
621
|
-
var clone = extended[prop];
|
|
622
|
-
if (isNewArray) {
|
|
623
|
-
if (!isArray(clone)) {
|
|
624
|
-
clone = [];
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
else if (!isPlainObject(clone)) {
|
|
628
|
-
clone = {};
|
|
629
|
-
}
|
|
630
|
-
newValue = objExtend(deep, clone, newValue);
|
|
631
|
-
}
|
|
632
|
-
if (newValue !== undefined) {
|
|
633
|
-
extended[prop] = newValue;
|
|
634
|
-
}
|
|
635
|
-
}
|
|
636
|
-
}
|
|
637
|
-
return extended;
|
|
638
|
-
}
|
|
639
547
|
|
|
640
548
|
var strWindow = "window";
|
|
641
549
|
var strDocument = "document";
|
|
642
|
-
var strNavigator = "navigator";
|
|
643
550
|
var strLocation = "location";
|
|
644
551
|
var strConsole = "console";
|
|
645
552
|
var strPerformance = "performance";
|
|
646
553
|
var strJSON = "JSON";
|
|
647
|
-
var strCrypto = "crypto";
|
|
648
|
-
var strMsCrypto = "msCrypto";
|
|
649
|
-
var strMsie = "msie";
|
|
650
|
-
var strTrident = "trident/";
|
|
651
|
-
var _isTrident = null;
|
|
652
|
-
var _navUserAgentCheck = null;
|
|
653
554
|
var _enableMocks = false;
|
|
654
555
|
function getGlobalInst(name) {
|
|
655
556
|
var gbl = getGlobal();
|
|
@@ -679,15 +580,6 @@
|
|
|
679
580
|
}
|
|
680
581
|
return getGlobalInst(strDocument);
|
|
681
582
|
}
|
|
682
|
-
function hasNavigator() {
|
|
683
|
-
return Boolean(typeof navigator === strShimObject && navigator);
|
|
684
|
-
}
|
|
685
|
-
function getNavigator() {
|
|
686
|
-
if (hasNavigator()) {
|
|
687
|
-
return navigator;
|
|
688
|
-
}
|
|
689
|
-
return getGlobalInst(strNavigator);
|
|
690
|
-
}
|
|
691
583
|
function getLocation(checkForMock) {
|
|
692
584
|
if (checkForMock && _enableMocks) {
|
|
693
585
|
var mockLocation = getGlobalInst("__mockLocation");
|
|
@@ -718,24 +610,9 @@
|
|
|
718
610
|
}
|
|
719
611
|
return null;
|
|
720
612
|
}
|
|
721
|
-
function getCrypto() {
|
|
722
|
-
return getGlobalInst(strCrypto);
|
|
723
|
-
}
|
|
724
|
-
function getMsCrypto() {
|
|
725
|
-
return getGlobalInst(strMsCrypto);
|
|
726
|
-
}
|
|
727
|
-
function isIE() {
|
|
728
|
-
var nav = getNavigator();
|
|
729
|
-
if (nav && (nav.userAgent !== _navUserAgentCheck || _isTrident === null)) {
|
|
730
|
-
_navUserAgentCheck = nav.userAgent;
|
|
731
|
-
var userAgent = (_navUserAgentCheck || strEmpty).toLowerCase();
|
|
732
|
-
_isTrident = (strContains(userAgent, strMsie) || strContains(userAgent, strTrident));
|
|
733
|
-
}
|
|
734
|
-
return _isTrident;
|
|
735
|
-
}
|
|
736
613
|
function dumpObj(object) {
|
|
737
614
|
var objectTypeDump = Object[strShimPrototype].toString.call(object);
|
|
738
|
-
var propertyValueDump =
|
|
615
|
+
var propertyValueDump = "";
|
|
739
616
|
if (objectTypeDump === "[object Error]") {
|
|
740
617
|
propertyValueDump = "{ stack: '" + object.stack + "', message: '" + object.message + "', name: '" + object.name + "'";
|
|
741
618
|
}
|
|
@@ -768,9 +645,9 @@
|
|
|
768
645
|
var strWarnToConsole = "warnToConsole";
|
|
769
646
|
function _sanitizeDiagnosticText(text) {
|
|
770
647
|
if (text) {
|
|
771
|
-
return "\"" + text.replace(/\"/g,
|
|
648
|
+
return "\"" + text.replace(/\"/g, "") + "\"";
|
|
772
649
|
}
|
|
773
|
-
return
|
|
650
|
+
return "";
|
|
774
651
|
}
|
|
775
652
|
function _logToConsole(func, message) {
|
|
776
653
|
var theConsole = getConsole();
|
|
@@ -792,12 +669,12 @@
|
|
|
792
669
|
_self.message =
|
|
793
670
|
(isUserAct ? AiUserActionablePrefix : AiNonUserActionablePrefix) +
|
|
794
671
|
msgId;
|
|
795
|
-
var strProps =
|
|
672
|
+
var strProps = "";
|
|
796
673
|
if (hasJSON()) {
|
|
797
674
|
strProps = getJSON().stringify(properties);
|
|
798
675
|
}
|
|
799
|
-
var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) :
|
|
800
|
-
(properties ? " props:" + _sanitizeDiagnosticText(strProps) :
|
|
676
|
+
var diagnosticText = (msg ? " message:" + _sanitizeDiagnosticText(msg) : "") +
|
|
677
|
+
(properties ? " props:" + _sanitizeDiagnosticText(strProps) : "");
|
|
801
678
|
_self.message += diagnosticText;
|
|
802
679
|
}
|
|
803
680
|
_InternalLogMessage.dataType = "MessageData";
|
|
@@ -824,10 +701,10 @@
|
|
|
824
701
|
if (isUserAct === void 0) { isUserAct = false; }
|
|
825
702
|
var message = new _InternalLogMessage(msgId, msg, isUserAct, properties);
|
|
826
703
|
if (_self.enableDebugExceptions()) {
|
|
827
|
-
throw message;
|
|
704
|
+
throw dumpObj(message);
|
|
828
705
|
}
|
|
829
706
|
else {
|
|
830
|
-
var logFunc = severity ===
|
|
707
|
+
var logFunc = severity === LoggingSeverity.CRITICAL ? strErrorToConsole : strWarnToConsole;
|
|
831
708
|
if (!isUndefined(message.message)) {
|
|
832
709
|
var logLevel = _self.consoleLoggingLevel();
|
|
833
710
|
if (isUserAct) {
|
|
@@ -845,7 +722,7 @@
|
|
|
845
722
|
_self.logInternalMessage(severity, message);
|
|
846
723
|
}
|
|
847
724
|
else {
|
|
848
|
-
_debugExtMsg("throw" + (severity ===
|
|
725
|
+
_debugExtMsg("throw" + (severity === LoggingSeverity.CRITICAL ? "Critical" : "Warning"), message);
|
|
849
726
|
}
|
|
850
727
|
}
|
|
851
728
|
};
|
|
@@ -877,13 +754,13 @@
|
|
|
877
754
|
if (severity <= _self.telemetryLoggingLevel()) {
|
|
878
755
|
_self.queue.push(message);
|
|
879
756
|
_messageCount++;
|
|
880
|
-
_debugExtMsg((severity ===
|
|
757
|
+
_debugExtMsg((severity === LoggingSeverity.CRITICAL ? "error" : "warn"), message);
|
|
881
758
|
}
|
|
882
759
|
if (_messageCount === _self.maxInternalMessageLimit()) {
|
|
883
760
|
var throttleLimitMessage = "Internal events throttle limit per PageView reached for this app.";
|
|
884
|
-
var throttleMessage = new _InternalLogMessage(
|
|
761
|
+
var throttleMessage = new _InternalLogMessage(_InternalMessageId.MessageLimitPerPVExceeded, throttleLimitMessage, false);
|
|
885
762
|
_self.queue.push(throttleMessage);
|
|
886
|
-
if (severity ===
|
|
763
|
+
if (severity === LoggingSeverity.CRITICAL) {
|
|
887
764
|
_self.errorToConsole(throttleLimitMessage);
|
|
888
765
|
}
|
|
889
766
|
else {
|
|
@@ -912,10 +789,6 @@
|
|
|
912
789
|
}
|
|
913
790
|
return DiagnosticLogger;
|
|
914
791
|
}());
|
|
915
|
-
function _throwInternal(logger, severity, msgId, msg, properties, isUserAct) {
|
|
916
|
-
if (isUserAct === void 0) { isUserAct = false; }
|
|
917
|
-
(logger || new DiagnosticLogger()).throwInternal(severity, msgId, msg, properties, isUserAct);
|
|
918
|
-
}
|
|
919
792
|
|
|
920
793
|
var strExecutionContextKey = "ctx";
|
|
921
794
|
var PerfEvent = /** @class */ (function () {
|
|
@@ -1029,634 +902,207 @@
|
|
|
1029
902
|
return func();
|
|
1030
903
|
}
|
|
1031
904
|
|
|
1032
|
-
var
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
}
|
|
1052
|
-
}
|
|
1053
|
-
function random32(signed) {
|
|
1054
|
-
var value = 0;
|
|
1055
|
-
var c = getCrypto() || getMsCrypto();
|
|
1056
|
-
if (c && c.getRandomValues) {
|
|
1057
|
-
value = c.getRandomValues(new Uint32Array(1))[0] & MaxUInt32;
|
|
1058
|
-
}
|
|
1059
|
-
if (value === 0 && isIE()) {
|
|
1060
|
-
if (!_mwcSeeded) {
|
|
1061
|
-
_autoSeedMwc();
|
|
1062
|
-
}
|
|
1063
|
-
value = mwcRandom32() & MaxUInt32;
|
|
1064
|
-
}
|
|
1065
|
-
if (value === 0) {
|
|
1066
|
-
value = Math.floor((UInt32Mask * Math.random()) | 0);
|
|
1067
|
-
}
|
|
1068
|
-
if (!signed) {
|
|
1069
|
-
value >>>= 0;
|
|
1070
|
-
}
|
|
1071
|
-
return value;
|
|
1072
|
-
}
|
|
1073
|
-
function mwcRandom32(signed) {
|
|
1074
|
-
_mwcZ = (36969 * (_mwcZ & 0xFFFF) + (_mwcZ >> 16)) & MaxUInt32;
|
|
1075
|
-
_mwcW = (18000 * (_mwcW & 0xFFFF) + (_mwcW >> 16)) & MaxUInt32;
|
|
1076
|
-
var value = (((_mwcZ << 16) + (_mwcW & 0xFFFF)) >>> 0) & MaxUInt32 | 0;
|
|
1077
|
-
if (!signed) {
|
|
1078
|
-
value >>>= 0;
|
|
1079
|
-
}
|
|
1080
|
-
return value;
|
|
1081
|
-
}
|
|
1082
|
-
function newId(maxLength) {
|
|
1083
|
-
if (maxLength === void 0) { maxLength = 22; }
|
|
1084
|
-
var base64chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
1085
|
-
var number = random32() >>> 0;
|
|
1086
|
-
var chars = 0;
|
|
1087
|
-
var result = strEmpty;
|
|
1088
|
-
while (result.length < maxLength) {
|
|
1089
|
-
chars++;
|
|
1090
|
-
result += base64chars.charAt(number & 0x3F);
|
|
1091
|
-
number >>>= 6;
|
|
1092
|
-
if (chars === 5) {
|
|
1093
|
-
number = (((random32() << 2) & 0xFFFFFFFF) | (number & 0x03)) >>> 0;
|
|
1094
|
-
chars = 0;
|
|
1095
|
-
}
|
|
1096
|
-
}
|
|
1097
|
-
return result;
|
|
1098
|
-
}
|
|
1099
|
-
|
|
1100
|
-
var _objDefineProperty = ObjDefineProperty;
|
|
1101
|
-
var version = "2.7.5-nightly.2204-03";
|
|
1102
|
-
var instanceName = "." + newId(6);
|
|
1103
|
-
var _dataUid = 0;
|
|
1104
|
-
function _createAccessor(target, prop, value) {
|
|
1105
|
-
if (_objDefineProperty) {
|
|
1106
|
-
try {
|
|
1107
|
-
_objDefineProperty(target, prop, {
|
|
1108
|
-
value: value,
|
|
1109
|
-
enumerable: false,
|
|
1110
|
-
configurable: true
|
|
1111
|
-
});
|
|
1112
|
-
return true;
|
|
1113
|
-
}
|
|
1114
|
-
catch (e) {
|
|
1115
|
-
}
|
|
1116
|
-
}
|
|
1117
|
-
return false;
|
|
1118
|
-
}
|
|
1119
|
-
function _canAcceptData(target) {
|
|
1120
|
-
return target.nodeType === 1 || target.nodeType === 9 || !(+target.nodeType);
|
|
1121
|
-
}
|
|
1122
|
-
function _getCache(data, target) {
|
|
1123
|
-
var theCache = target[data.id];
|
|
1124
|
-
if (!theCache) {
|
|
1125
|
-
theCache = {};
|
|
1126
|
-
try {
|
|
1127
|
-
if (_canAcceptData(target)) {
|
|
1128
|
-
if (!_createAccessor(target, data.id, theCache)) {
|
|
1129
|
-
target[data.id] = theCache;
|
|
1130
|
-
}
|
|
1131
|
-
}
|
|
1132
|
-
}
|
|
1133
|
-
catch (e) {
|
|
1134
|
-
}
|
|
1135
|
-
}
|
|
1136
|
-
return theCache;
|
|
1137
|
-
}
|
|
1138
|
-
function createUniqueNamespace(name, includeVersion) {
|
|
1139
|
-
if (includeVersion === void 0) { includeVersion = false; }
|
|
1140
|
-
return normalizeJsName(name + (_dataUid++) + (includeVersion ? "." + version : "") + instanceName);
|
|
1141
|
-
}
|
|
1142
|
-
function createElmNodeData(name) {
|
|
1143
|
-
var data = {
|
|
1144
|
-
id: createUniqueNamespace("_aiData-" + (name || "") + "." + version),
|
|
1145
|
-
accept: function (target) {
|
|
1146
|
-
return _canAcceptData(target);
|
|
1147
|
-
},
|
|
1148
|
-
get: function (target, name, defValue, addDefault) {
|
|
1149
|
-
var theCache = target[data.id];
|
|
1150
|
-
if (!theCache) {
|
|
1151
|
-
if (addDefault) {
|
|
1152
|
-
theCache = _getCache(data, target);
|
|
1153
|
-
theCache[normalizeJsName(name)] = defValue;
|
|
1154
|
-
}
|
|
1155
|
-
return defValue;
|
|
1156
|
-
}
|
|
1157
|
-
return theCache[normalizeJsName(name)];
|
|
1158
|
-
},
|
|
1159
|
-
kill: function (target, name) {
|
|
1160
|
-
if (target && target[name]) {
|
|
1161
|
-
try {
|
|
1162
|
-
delete target[name];
|
|
1163
|
-
}
|
|
1164
|
-
catch (e) {
|
|
1165
|
-
}
|
|
1166
|
-
}
|
|
1167
|
-
}
|
|
1168
|
-
};
|
|
1169
|
-
return data;
|
|
1170
|
-
}
|
|
1171
|
-
|
|
1172
|
-
var strDoUnload = "_doUnload";
|
|
1173
|
-
var pluginStateData = createElmNodeData("plugin");
|
|
1174
|
-
function _getPluginState(plugin) {
|
|
1175
|
-
return pluginStateData.get(plugin, "state", {}, true);
|
|
1176
|
-
}
|
|
1177
|
-
function unloadComponents(components, unloadCtx, unloadState, asyncCallback) {
|
|
1178
|
-
var idx = 0;
|
|
1179
|
-
function _doUnload() {
|
|
1180
|
-
while (idx < components.length) {
|
|
1181
|
-
var component = components[idx++];
|
|
1182
|
-
if (component) {
|
|
1183
|
-
var func = component[strDoUnload] || component[strDoTeardown];
|
|
1184
|
-
if (isFunction(func)) {
|
|
1185
|
-
if (func.call(component, unloadCtx, unloadState, _doUnload) === true) {
|
|
1186
|
-
return true;
|
|
1187
|
-
}
|
|
1188
|
-
}
|
|
905
|
+
var TelemetryPluginChain = /** @class */ (function () {
|
|
906
|
+
function TelemetryPluginChain(plugin, defItemCtx) {
|
|
907
|
+
var _self = this;
|
|
908
|
+
var _nextProxy = null;
|
|
909
|
+
var _hasProcessTelemetry = isFunction(plugin.processTelemetry);
|
|
910
|
+
var _hasSetNext = isFunction(plugin.setNextPlugin);
|
|
911
|
+
_self._hasRun = false;
|
|
912
|
+
_self.getPlugin = function () {
|
|
913
|
+
return plugin;
|
|
914
|
+
};
|
|
915
|
+
_self.getNext = function () {
|
|
916
|
+
return _nextProxy;
|
|
917
|
+
};
|
|
918
|
+
_self.setNext = function (nextPlugin) {
|
|
919
|
+
_nextProxy = nextPlugin;
|
|
920
|
+
};
|
|
921
|
+
_self.processTelemetry = function (env, itemCtx) {
|
|
922
|
+
if (!itemCtx) {
|
|
923
|
+
itemCtx = defItemCtx;
|
|
1189
924
|
}
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
var strTelemetryPluginChain = "TelemetryPluginChain";
|
|
1196
|
-
var strHasRunFlags = "_hasRun";
|
|
1197
|
-
var strGetTelCtx = "_getTelCtx";
|
|
1198
|
-
var _chainId = 0;
|
|
1199
|
-
function _getNextProxyStart(proxy, config, core, startAt) {
|
|
1200
|
-
while (proxy) {
|
|
1201
|
-
if (proxy.getPlugin() === startAt) {
|
|
1202
|
-
return proxy;
|
|
1203
|
-
}
|
|
1204
|
-
proxy = proxy.getNext();
|
|
1205
|
-
}
|
|
1206
|
-
return createTelemetryProxyChain([startAt], config, core);
|
|
1207
|
-
}
|
|
1208
|
-
function _createInternalContext(telemetryChain, config, core, startAt) {
|
|
1209
|
-
var _nextProxy = null;
|
|
1210
|
-
var _onComplete = [];
|
|
1211
|
-
if (startAt !== null) {
|
|
1212
|
-
_nextProxy = startAt ? _getNextProxyStart(telemetryChain, config, core, startAt) : telemetryChain;
|
|
1213
|
-
}
|
|
1214
|
-
var context = {
|
|
1215
|
-
_next: _moveNext,
|
|
1216
|
-
ctx: {
|
|
1217
|
-
core: function () {
|
|
1218
|
-
return core;
|
|
1219
|
-
},
|
|
1220
|
-
diagLog: function () {
|
|
1221
|
-
return safeGetLogger(core, config);
|
|
1222
|
-
},
|
|
1223
|
-
getCfg: function () {
|
|
1224
|
-
return config;
|
|
1225
|
-
},
|
|
1226
|
-
getExtCfg: _getExtCfg,
|
|
1227
|
-
getConfig: _getConfig,
|
|
1228
|
-
hasNext: function () {
|
|
1229
|
-
return !!_nextProxy;
|
|
1230
|
-
},
|
|
1231
|
-
getNext: function () {
|
|
1232
|
-
return _nextProxy;
|
|
1233
|
-
},
|
|
1234
|
-
setNext: function (nextPlugin) {
|
|
1235
|
-
_nextProxy = nextPlugin;
|
|
1236
|
-
},
|
|
1237
|
-
iterate: _iterateChain,
|
|
1238
|
-
onComplete: _addOnComplete
|
|
1239
|
-
}
|
|
1240
|
-
};
|
|
1241
|
-
function _addOnComplete(onComplete, that) {
|
|
1242
|
-
var args = [];
|
|
1243
|
-
for (var _i = 2; _i < arguments.length; _i++) {
|
|
1244
|
-
args[_i - 2] = arguments[_i];
|
|
1245
|
-
}
|
|
1246
|
-
if (onComplete) {
|
|
1247
|
-
_onComplete.push({
|
|
1248
|
-
func: onComplete,
|
|
1249
|
-
self: !isUndefined(that) ? that : context.ctx,
|
|
1250
|
-
args: args
|
|
1251
|
-
});
|
|
1252
|
-
}
|
|
1253
|
-
}
|
|
1254
|
-
function _moveNext() {
|
|
1255
|
-
var nextProxy = _nextProxy;
|
|
1256
|
-
_nextProxy = nextProxy ? nextProxy.getNext() : null;
|
|
1257
|
-
if (!nextProxy) {
|
|
1258
|
-
var onComplete = _onComplete;
|
|
1259
|
-
if (onComplete && onComplete.length > 0) {
|
|
1260
|
-
arrForEach(onComplete, function (completeDetails) {
|
|
925
|
+
var identifier = plugin ? plugin.identifier : "TelemetryPluginChain";
|
|
926
|
+
doPerf(itemCtx ? itemCtx.core() : null, function () { return identifier + ":processTelemetry"; }, function () {
|
|
927
|
+
if (plugin && _hasProcessTelemetry) {
|
|
928
|
+
_self._hasRun = true;
|
|
1261
929
|
try {
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
930
|
+
itemCtx.setNext(_nextProxy);
|
|
931
|
+
if (_hasSetNext) {
|
|
932
|
+
plugin.setNextPlugin(_nextProxy);
|
|
933
|
+
}
|
|
934
|
+
_nextProxy && (_nextProxy._hasRun = false);
|
|
935
|
+
plugin.processTelemetry(env, itemCtx);
|
|
1266
936
|
}
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
return nextProxy;
|
|
1272
|
-
}
|
|
1273
|
-
function _getExtCfg(identifier, defaultValue, mergeDefault) {
|
|
1274
|
-
if (defaultValue === void 0) { defaultValue = {}; }
|
|
1275
|
-
if (mergeDefault === void 0) { mergeDefault = 0 ; }
|
|
1276
|
-
var theConfig;
|
|
1277
|
-
if (config) {
|
|
1278
|
-
var extConfig = config.extensionConfig;
|
|
1279
|
-
if (extConfig && identifier) {
|
|
1280
|
-
theConfig = extConfig[identifier];
|
|
1281
|
-
}
|
|
1282
|
-
}
|
|
1283
|
-
if (!theConfig) {
|
|
1284
|
-
theConfig = defaultValue;
|
|
1285
|
-
}
|
|
1286
|
-
else if (isObject(defaultValue)) {
|
|
1287
|
-
if (mergeDefault !== 0 ) {
|
|
1288
|
-
var newConfig_1 = objExtend(true, defaultValue, theConfig);
|
|
1289
|
-
if (config && mergeDefault === 2 ) {
|
|
1290
|
-
objForEachKey(defaultValue, function (field) {
|
|
1291
|
-
if (isNullOrUndefined(newConfig_1[field])) {
|
|
1292
|
-
var cfgValue = config[field];
|
|
1293
|
-
if (!isNullOrUndefined(cfgValue)) {
|
|
1294
|
-
newConfig_1[field] = cfgValue;
|
|
1295
|
-
}
|
|
937
|
+
catch (error) {
|
|
938
|
+
var hasRun = _nextProxy && _nextProxy._hasRun;
|
|
939
|
+
if (!_nextProxy || !hasRun) {
|
|
940
|
+
itemCtx.diagLog().throwInternal(LoggingSeverity.CRITICAL, _InternalMessageId.PluginException, "Plugin [" + plugin.identifier + "] failed during processTelemetry - " + dumpObj(error));
|
|
1296
941
|
}
|
|
1297
|
-
|
|
942
|
+
if (_nextProxy && !hasRun) {
|
|
943
|
+
_nextProxy.processTelemetry(env, itemCtx);
|
|
944
|
+
}
|
|
945
|
+
}
|
|
1298
946
|
}
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
var theValue;
|
|
1306
|
-
var extConfig = _getExtCfg(identifier, null);
|
|
1307
|
-
if (extConfig && !isNullOrUndefined(extConfig[field])) {
|
|
1308
|
-
theValue = extConfig[field];
|
|
1309
|
-
}
|
|
1310
|
-
else if (config && !isNullOrUndefined(config[field])) {
|
|
1311
|
-
theValue = config[field];
|
|
1312
|
-
}
|
|
1313
|
-
return !isNullOrUndefined(theValue) ? theValue : defaultValue;
|
|
947
|
+
else if (_nextProxy) {
|
|
948
|
+
_self._hasRun = true;
|
|
949
|
+
_nextProxy.processTelemetry(env, itemCtx);
|
|
950
|
+
}
|
|
951
|
+
}, function () { return ({ item: env }); }, !(env.sync));
|
|
952
|
+
};
|
|
1314
953
|
}
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
954
|
+
return TelemetryPluginChain;
|
|
955
|
+
}());
|
|
956
|
+
|
|
957
|
+
function _createProxyChain(plugins, itemCtx) {
|
|
958
|
+
var proxies = [];
|
|
959
|
+
if (plugins && plugins.length > 0) {
|
|
960
|
+
var lastProxy = null;
|
|
961
|
+
for (var idx = 0; idx < plugins.length; idx++) {
|
|
962
|
+
var thePlugin = plugins[idx];
|
|
963
|
+
if (thePlugin && isFunction(thePlugin.processTelemetry)) {
|
|
964
|
+
var newProxy = new TelemetryPluginChain(thePlugin, itemCtx);
|
|
965
|
+
proxies.push(newProxy);
|
|
966
|
+
if (lastProxy) {
|
|
967
|
+
lastProxy.setNext(newProxy);
|
|
968
|
+
}
|
|
969
|
+
lastProxy = newProxy;
|
|
1321
970
|
}
|
|
1322
971
|
}
|
|
1323
972
|
}
|
|
1324
|
-
return
|
|
973
|
+
return proxies.length > 0 ? proxies[0] : null;
|
|
1325
974
|
}
|
|
1326
|
-
function
|
|
1327
|
-
var
|
|
1328
|
-
var
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
975
|
+
function _copyProxyChain(proxy, itemCtx, startAt) {
|
|
976
|
+
var plugins = [];
|
|
977
|
+
var add = startAt ? false : true;
|
|
978
|
+
if (proxy) {
|
|
979
|
+
while (proxy) {
|
|
980
|
+
var thePlugin = proxy.getPlugin();
|
|
981
|
+
if (add || thePlugin === startAt) {
|
|
982
|
+
add = true;
|
|
983
|
+
plugins.push(thePlugin);
|
|
984
|
+
}
|
|
985
|
+
proxy = proxy.getNext();
|
|
1338
986
|
}
|
|
1339
|
-
return createProcessTelemetryContext(plugins || context.getNext(), config, core, startAt);
|
|
1340
987
|
}
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
return context;
|
|
1344
|
-
}
|
|
1345
|
-
function createProcessTelemetryUnloadContext(telemetryChain, config, core, startAt) {
|
|
1346
|
-
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1347
|
-
var context = internalContext.ctx;
|
|
1348
|
-
function _processNext(unloadState) {
|
|
1349
|
-
var nextPlugin = internalContext._next();
|
|
1350
|
-
nextPlugin && nextPlugin.unload(context, unloadState);
|
|
1351
|
-
return !nextPlugin;
|
|
1352
|
-
}
|
|
1353
|
-
function _createNew(plugins, startAt) {
|
|
1354
|
-
if (plugins === void 0) { plugins = null; }
|
|
1355
|
-
if (isArray(plugins)) {
|
|
1356
|
-
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1357
|
-
}
|
|
1358
|
-
return createProcessTelemetryUnloadContext(plugins || context.getNext(), config, core, startAt);
|
|
988
|
+
if (!add) {
|
|
989
|
+
plugins.push(startAt);
|
|
1359
990
|
}
|
|
1360
|
-
|
|
1361
|
-
context.createNew = _createNew;
|
|
1362
|
-
return context;
|
|
991
|
+
return _createProxyChain(plugins, itemCtx);
|
|
1363
992
|
}
|
|
1364
|
-
function
|
|
1365
|
-
var
|
|
1366
|
-
var
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
993
|
+
function _copyPluginChain(srcPlugins, itemCtx, startAt) {
|
|
994
|
+
var plugins = srcPlugins;
|
|
995
|
+
var add = false;
|
|
996
|
+
if (startAt && srcPlugins) {
|
|
997
|
+
plugins = [];
|
|
998
|
+
arrForEach(srcPlugins, function (thePlugin) {
|
|
999
|
+
if (add || thePlugin === startAt) {
|
|
1000
|
+
add = true;
|
|
1001
|
+
plugins.push(thePlugin);
|
|
1371
1002
|
}
|
|
1372
1003
|
});
|
|
1373
1004
|
}
|
|
1374
|
-
|
|
1375
|
-
if (plugins
|
|
1376
|
-
|
|
1377
|
-
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1005
|
+
if (startAt && !add) {
|
|
1006
|
+
if (!plugins) {
|
|
1007
|
+
plugins = [];
|
|
1378
1008
|
}
|
|
1379
|
-
|
|
1009
|
+
plugins.push(startAt);
|
|
1380
1010
|
}
|
|
1381
|
-
|
|
1382
|
-
context.createNew = _createNew;
|
|
1383
|
-
return context;
|
|
1011
|
+
return _createProxyChain(plugins, itemCtx);
|
|
1384
1012
|
}
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
add = true;
|
|
1013
|
+
var ProcessTelemetryContext = /** @class */ (function () {
|
|
1014
|
+
function ProcessTelemetryContext(plugins, config, core, startAt) {
|
|
1015
|
+
var _self = this;
|
|
1016
|
+
var _nextProxy = null;
|
|
1017
|
+
if (startAt !== null) {
|
|
1018
|
+
if (plugins && isFunction(plugins.getPlugin)) {
|
|
1019
|
+
_nextProxy = _copyProxyChain(plugins, _self, startAt || plugins.getPlugin());
|
|
1393
1020
|
}
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
firstProxy = newProxy;
|
|
1021
|
+
else {
|
|
1022
|
+
if (startAt) {
|
|
1023
|
+
_nextProxy = _copyPluginChain(plugins, _self, startAt);
|
|
1398
1024
|
}
|
|
1399
|
-
if (
|
|
1400
|
-
|
|
1025
|
+
else if (isUndefined(startAt)) {
|
|
1026
|
+
_nextProxy = _createProxyChain(plugins, _self);
|
|
1401
1027
|
}
|
|
1402
|
-
lastProxy_1 = newProxy;
|
|
1403
1028
|
}
|
|
1404
|
-
});
|
|
1405
|
-
}
|
|
1406
|
-
if (startAt && !firstProxy) {
|
|
1407
|
-
return createTelemetryProxyChain([startAt], config, core);
|
|
1408
|
-
}
|
|
1409
|
-
return firstProxy;
|
|
1410
|
-
}
|
|
1411
|
-
function createTelemetryPluginProxy(plugin, config, core) {
|
|
1412
|
-
var nextProxy = null;
|
|
1413
|
-
var hasProcessTelemetry = isFunction(plugin.processTelemetry);
|
|
1414
|
-
var hasSetNext = isFunction(plugin.setNextPlugin);
|
|
1415
|
-
var chainId;
|
|
1416
|
-
if (plugin) {
|
|
1417
|
-
chainId = plugin.identifier + "-" + plugin.priority + "-" + _chainId++;
|
|
1418
|
-
}
|
|
1419
|
-
else {
|
|
1420
|
-
chainId = "Unknown-0-" + _chainId++;
|
|
1421
|
-
}
|
|
1422
|
-
var proxyChain = {
|
|
1423
|
-
getPlugin: function () {
|
|
1424
|
-
return plugin;
|
|
1425
|
-
},
|
|
1426
|
-
getNext: function () {
|
|
1427
|
-
return nextProxy;
|
|
1428
|
-
},
|
|
1429
|
-
processTelemetry: _processTelemetry,
|
|
1430
|
-
unload: _unloadPlugin,
|
|
1431
|
-
update: _updatePlugin,
|
|
1432
|
-
_id: chainId,
|
|
1433
|
-
_setNext: function (nextPlugin) {
|
|
1434
|
-
nextProxy = nextPlugin;
|
|
1435
1029
|
}
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
}
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
}
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
hasRunContext = itemCtx[strHasRunFlags] = {};
|
|
1453
|
-
}
|
|
1454
|
-
itemCtx.setNext(nextProxy);
|
|
1455
|
-
if (plugin) {
|
|
1456
|
-
doPerf(itemCtx[strCore](), function () { return identifier + ":" + name; }, function () {
|
|
1457
|
-
hasRunContext[chainId] = true;
|
|
1458
|
-
try {
|
|
1459
|
-
var nextId = nextProxy ? nextProxy._id : strEmpty;
|
|
1460
|
-
if (nextId) {
|
|
1461
|
-
hasRunContext[nextId] = false;
|
|
1462
|
-
}
|
|
1463
|
-
hasRun = processPluginFn(itemCtx);
|
|
1464
|
-
}
|
|
1465
|
-
catch (error) {
|
|
1466
|
-
var hasNextRun = nextProxy ? hasRunContext[nextProxy._id] : true;
|
|
1467
|
-
if (hasNextRun) {
|
|
1468
|
-
hasRun = true;
|
|
1469
|
-
}
|
|
1470
|
-
if (!nextProxy || !hasNextRun) {
|
|
1471
|
-
_throwInternal(itemCtx.diagLog(), 1 , 73 , "Plugin [" + plugin.identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
|
|
1472
|
-
}
|
|
1030
|
+
_self.core = function () {
|
|
1031
|
+
return core;
|
|
1032
|
+
};
|
|
1033
|
+
_self.diagLog = function () {
|
|
1034
|
+
return safeGetLogger(core, config);
|
|
1035
|
+
};
|
|
1036
|
+
_self.getCfg = function () {
|
|
1037
|
+
return config;
|
|
1038
|
+
};
|
|
1039
|
+
_self.getExtCfg = function (identifier, defaultValue) {
|
|
1040
|
+
if (defaultValue === void 0) { defaultValue = {}; }
|
|
1041
|
+
var theConfig;
|
|
1042
|
+
if (config) {
|
|
1043
|
+
var extConfig = config.extensionConfig;
|
|
1044
|
+
if (extConfig && identifier) {
|
|
1045
|
+
theConfig = extConfig[identifier];
|
|
1473
1046
|
}
|
|
1474
|
-
}, details, isAsync);
|
|
1475
|
-
}
|
|
1476
|
-
return hasRun;
|
|
1477
|
-
}
|
|
1478
|
-
function _processTelemetry(env, itemCtx) {
|
|
1479
|
-
itemCtx = itemCtx || _getTelCtx();
|
|
1480
|
-
function _callProcessTelemetry(itemCtx) {
|
|
1481
|
-
if (!plugin || !hasProcessTelemetry) {
|
|
1482
|
-
return false;
|
|
1483
|
-
}
|
|
1484
|
-
var pluginState = _getPluginState(plugin);
|
|
1485
|
-
if (pluginState[strTeardown] || pluginState[strDisabled]) {
|
|
1486
|
-
return false;
|
|
1487
1047
|
}
|
|
1488
|
-
|
|
1489
|
-
|
|
1048
|
+
return (theConfig ? theConfig : defaultValue);
|
|
1049
|
+
};
|
|
1050
|
+
_self.getConfig = function (identifier, field, defaultValue) {
|
|
1051
|
+
if (defaultValue === void 0) { defaultValue = false; }
|
|
1052
|
+
var theValue;
|
|
1053
|
+
var extConfig = _self.getExtCfg(identifier, null);
|
|
1054
|
+
if (extConfig && !isNullOrUndefined(extConfig[field])) {
|
|
1055
|
+
theValue = extConfig[field];
|
|
1490
1056
|
}
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
}
|
|
1494
|
-
if (!_processChain(itemCtx, _callProcessTelemetry, "processTelemetry", function () { return ({ item: env }); }, !(env.sync))) {
|
|
1495
|
-
itemCtx.processNext(env);
|
|
1496
|
-
}
|
|
1497
|
-
}
|
|
1498
|
-
function _unloadPlugin(unloadCtx, unloadState) {
|
|
1499
|
-
function _callTeardown() {
|
|
1500
|
-
var hasRun = false;
|
|
1501
|
-
if (plugin) {
|
|
1502
|
-
var pluginState = _getPluginState(plugin);
|
|
1503
|
-
var pluginCore = plugin[strCore] || pluginState.core;
|
|
1504
|
-
if (plugin && (!pluginCore || pluginCore === unloadCtx[strCore]()) && !pluginState[strTeardown]) {
|
|
1505
|
-
pluginState[strCore] = null;
|
|
1506
|
-
pluginState[strTeardown] = true;
|
|
1507
|
-
pluginState[strIsInitialized] = false;
|
|
1508
|
-
if (plugin[strTeardown] && plugin[strTeardown](unloadCtx, unloadState) === true) {
|
|
1509
|
-
hasRun = true;
|
|
1510
|
-
}
|
|
1511
|
-
}
|
|
1057
|
+
else if (config && !isNullOrUndefined(config[field])) {
|
|
1058
|
+
theValue = config[field];
|
|
1512
1059
|
}
|
|
1513
|
-
return
|
|
1514
|
-
}
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
}
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
}
|
|
1060
|
+
return !isNullOrUndefined(theValue) ? theValue : defaultValue;
|
|
1061
|
+
};
|
|
1062
|
+
_self.hasNext = function () {
|
|
1063
|
+
return _nextProxy != null;
|
|
1064
|
+
};
|
|
1065
|
+
_self.getNext = function () {
|
|
1066
|
+
return _nextProxy;
|
|
1067
|
+
};
|
|
1068
|
+
_self.setNext = function (nextPlugin) {
|
|
1069
|
+
_nextProxy = nextPlugin;
|
|
1070
|
+
};
|
|
1071
|
+
_self.processNext = function (env) {
|
|
1072
|
+
var nextPlugin = _nextProxy;
|
|
1073
|
+
if (nextPlugin) {
|
|
1074
|
+
_nextProxy = nextPlugin.getNext();
|
|
1075
|
+
nextPlugin.processTelemetry(env, _self);
|
|
1530
1076
|
}
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
}
|
|
1077
|
+
};
|
|
1078
|
+
_self.createNew = function (plugins, startAt) {
|
|
1079
|
+
if (plugins === void 0) { plugins = null; }
|
|
1080
|
+
return new ProcessTelemetryContext(plugins || _nextProxy, config, core, startAt);
|
|
1081
|
+
};
|
|
1536
1082
|
}
|
|
1537
|
-
return
|
|
1538
|
-
}
|
|
1083
|
+
return ProcessTelemetryContext;
|
|
1084
|
+
}());
|
|
1539
1085
|
|
|
1540
1086
|
var strExtensionConfig = "extensionConfig";
|
|
1541
1087
|
|
|
1542
|
-
function createUnloadHandlerContainer() {
|
|
1543
|
-
var handlers = [];
|
|
1544
|
-
function _addHandler(handler) {
|
|
1545
|
-
if (handler) {
|
|
1546
|
-
handlers.push(handler);
|
|
1547
|
-
}
|
|
1548
|
-
}
|
|
1549
|
-
function _runHandlers(unloadCtx, unloadState) {
|
|
1550
|
-
arrForEach(handlers, function (handler) {
|
|
1551
|
-
try {
|
|
1552
|
-
handler(unloadCtx, unloadState);
|
|
1553
|
-
}
|
|
1554
|
-
catch (e) {
|
|
1555
|
-
_throwInternal(unloadCtx.diagLog(), 2 , 73 , "Unexpected error calling unload handler - " + dumpObj(e));
|
|
1556
|
-
}
|
|
1557
|
-
});
|
|
1558
|
-
handlers = [];
|
|
1559
|
-
}
|
|
1560
|
-
return {
|
|
1561
|
-
add: _addHandler,
|
|
1562
|
-
run: _runHandlers
|
|
1563
|
-
};
|
|
1564
|
-
}
|
|
1565
|
-
|
|
1566
1088
|
var strGetPlugin = "getPlugin";
|
|
1567
1089
|
var BaseTelemetryPlugin = /** @class */ (function () {
|
|
1568
1090
|
function BaseTelemetryPlugin() {
|
|
1569
1091
|
var _self = this;
|
|
1570
|
-
var _isinitialized;
|
|
1571
|
-
var _rootCtx;
|
|
1572
|
-
var _nextPlugin;
|
|
1573
|
-
|
|
1574
|
-
var _hooks;
|
|
1575
|
-
_initDefaults();
|
|
1576
|
-
dynamicProto(BaseTelemetryPlugin, _self, function (_self) {
|
|
1577
|
-
_self.initialize = function (config, core, extensions, pluginChain) {
|
|
1578
|
-
_setDefaults(config, core, pluginChain);
|
|
1579
|
-
_isinitialized = true;
|
|
1580
|
-
};
|
|
1581
|
-
_self.teardown = function (unloadCtx, unloadState) {
|
|
1582
|
-
if (!_self.core || (unloadCtx && _self.core !== unloadCtx.core())) {
|
|
1583
|
-
return;
|
|
1584
|
-
}
|
|
1585
|
-
var result;
|
|
1586
|
-
var unloadDone = false;
|
|
1587
|
-
var theUnloadCtx = unloadCtx || createProcessTelemetryUnloadContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
|
|
1588
|
-
var theUnloadState = unloadState || {
|
|
1589
|
-
reason: 0 ,
|
|
1590
|
-
isAsync: false
|
|
1591
|
-
};
|
|
1592
|
-
function _unloadCallback() {
|
|
1593
|
-
if (!unloadDone) {
|
|
1594
|
-
unloadDone = true;
|
|
1595
|
-
_unloadHandlerContainer.run(theUnloadCtx, unloadState);
|
|
1596
|
-
arrForEach(_hooks, function (fn) {
|
|
1597
|
-
fn.rm();
|
|
1598
|
-
});
|
|
1599
|
-
_hooks = [];
|
|
1600
|
-
if (result === true) {
|
|
1601
|
-
theUnloadCtx.processNext(theUnloadState);
|
|
1602
|
-
}
|
|
1603
|
-
_initDefaults();
|
|
1604
|
-
}
|
|
1605
|
-
}
|
|
1606
|
-
if (!_self[strDoTeardown] || _self[strDoTeardown](theUnloadCtx, theUnloadState, _unloadCallback) !== true) {
|
|
1607
|
-
_unloadCallback();
|
|
1608
|
-
}
|
|
1609
|
-
else {
|
|
1610
|
-
result = true;
|
|
1611
|
-
}
|
|
1612
|
-
return result;
|
|
1613
|
-
};
|
|
1614
|
-
_self.update = function (updateCtx, updateState) {
|
|
1615
|
-
if (!_self.core || (updateCtx && _self.core !== updateCtx.core())) {
|
|
1616
|
-
return;
|
|
1617
|
-
}
|
|
1618
|
-
var result;
|
|
1619
|
-
var updateDone = false;
|
|
1620
|
-
var theUpdateCtx = updateCtx || createProcessTelemetryUpdateContext(null, {}, _self.core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
|
|
1621
|
-
var theUpdateState = updateState || {
|
|
1622
|
-
reason: 0
|
|
1623
|
-
};
|
|
1624
|
-
function _updateCallback() {
|
|
1625
|
-
if (!updateDone) {
|
|
1626
|
-
updateDone = true;
|
|
1627
|
-
_setDefaults(theUpdateCtx.getCfg(), theUpdateCtx.core(), theUpdateCtx.getNext());
|
|
1628
|
-
}
|
|
1629
|
-
}
|
|
1630
|
-
if (!_self._doUpdate || _self._doUpdate(theUpdateCtx, theUpdateState, _updateCallback) !== true) {
|
|
1631
|
-
_updateCallback();
|
|
1632
|
-
}
|
|
1633
|
-
else {
|
|
1634
|
-
result = true;
|
|
1635
|
-
}
|
|
1636
|
-
return result;
|
|
1637
|
-
};
|
|
1638
|
-
_self._addHook = function (hooks) {
|
|
1639
|
-
if (hooks) {
|
|
1640
|
-
if (isArray(hooks)) {
|
|
1641
|
-
_hooks = _hooks.concat(hooks);
|
|
1642
|
-
}
|
|
1643
|
-
else {
|
|
1644
|
-
_hooks.push(hooks);
|
|
1645
|
-
}
|
|
1646
|
-
}
|
|
1647
|
-
};
|
|
1648
|
-
proxyFunctionAs(_self, "_addUnloadCb", function () { return _unloadHandlerContainer; }, "add");
|
|
1649
|
-
});
|
|
1092
|
+
var _isinitialized = false;
|
|
1093
|
+
var _rootCtx = null;
|
|
1094
|
+
var _nextPlugin = null;
|
|
1095
|
+
_self.core = null;
|
|
1650
1096
|
_self.diagLog = function (itemCtx) {
|
|
1651
|
-
return _getTelCtx(itemCtx).diagLog();
|
|
1097
|
+
return _self._getTelCtx(itemCtx).diagLog();
|
|
1652
1098
|
};
|
|
1653
|
-
_self
|
|
1099
|
+
_self.isInitialized = function () {
|
|
1654
1100
|
return _isinitialized;
|
|
1655
1101
|
};
|
|
1656
1102
|
_self.setInitialized = function (isInitialized) {
|
|
1657
1103
|
_isinitialized = isInitialized;
|
|
1658
1104
|
};
|
|
1659
|
-
_self
|
|
1105
|
+
_self.setNextPlugin = function (next) {
|
|
1660
1106
|
_nextPlugin = next;
|
|
1661
1107
|
};
|
|
1662
1108
|
_self.processNext = function (env, itemCtx) {
|
|
@@ -1667,12 +1113,11 @@
|
|
|
1667
1113
|
_nextPlugin.processTelemetry(env, null);
|
|
1668
1114
|
}
|
|
1669
1115
|
};
|
|
1670
|
-
_self._getTelCtx =
|
|
1671
|
-
function _getTelCtx(currentCtx) {
|
|
1116
|
+
_self._getTelCtx = function (currentCtx) {
|
|
1672
1117
|
if (currentCtx === void 0) { currentCtx = null; }
|
|
1673
1118
|
var itemCtx = currentCtx;
|
|
1674
1119
|
if (!itemCtx) {
|
|
1675
|
-
var rootCtx = _rootCtx ||
|
|
1120
|
+
var rootCtx = _rootCtx || new ProcessTelemetryContext(null, {}, _self.core);
|
|
1676
1121
|
if (_nextPlugin && _nextPlugin[strGetPlugin]) {
|
|
1677
1122
|
itemCtx = rootCtx.createNew(null, _nextPlugin[strGetPlugin]);
|
|
1678
1123
|
}
|
|
@@ -1681,8 +1126,8 @@
|
|
|
1681
1126
|
}
|
|
1682
1127
|
}
|
|
1683
1128
|
return itemCtx;
|
|
1684
|
-
}
|
|
1685
|
-
function
|
|
1129
|
+
};
|
|
1130
|
+
_self._baseTelInit = function (config, core, extensions, pluginChain) {
|
|
1686
1131
|
if (config) {
|
|
1687
1132
|
setValue(config, strExtensionConfig, [], null, isNullOrUndefined);
|
|
1688
1133
|
}
|
|
@@ -1694,280 +1139,16 @@
|
|
|
1694
1139
|
nextPlugin = _nextPlugin[strGetPlugin]();
|
|
1695
1140
|
}
|
|
1696
1141
|
_self.core = core;
|
|
1697
|
-
_rootCtx =
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
_isinitialized = false;
|
|
1701
|
-
_self.core = null;
|
|
1702
|
-
_rootCtx = null;
|
|
1703
|
-
_nextPlugin = null;
|
|
1704
|
-
_hooks = [];
|
|
1705
|
-
_unloadHandlerContainer = createUnloadHandlerContainer();
|
|
1706
|
-
}
|
|
1142
|
+
_rootCtx = new ProcessTelemetryContext(pluginChain, config, core, nextPlugin);
|
|
1143
|
+
_isinitialized = true;
|
|
1144
|
+
};
|
|
1707
1145
|
}
|
|
1146
|
+
BaseTelemetryPlugin.prototype.initialize = function (config, core, extensions, pluginChain) {
|
|
1147
|
+
this._baseTelInit(config, core, extensions, pluginChain);
|
|
1148
|
+
};
|
|
1708
1149
|
return BaseTelemetryPlugin;
|
|
1709
1150
|
}());
|
|
1710
1151
|
|
|
1711
|
-
var strOnPrefix = "on";
|
|
1712
|
-
var strAttachEvent = "attachEvent";
|
|
1713
|
-
var strAddEventHelper = "addEventListener";
|
|
1714
|
-
var strDetachEvent = "detachEvent";
|
|
1715
|
-
var strRemoveEventListener = "removeEventListener";
|
|
1716
|
-
var strEvents = "events";
|
|
1717
|
-
createUniqueNamespace("aiEvtPageHide");
|
|
1718
|
-
createUniqueNamespace("aiEvtPageShow");
|
|
1719
|
-
var rRemoveEmptyNs = /\.[\.]+/g;
|
|
1720
|
-
var rRemoveTrailingEmptyNs = /[\.]+$/;
|
|
1721
|
-
var _guid = 1;
|
|
1722
|
-
var elmNodeData = createElmNodeData("events");
|
|
1723
|
-
var eventNamespace = /^([^.]*)(?:\.(.+)|)/;
|
|
1724
|
-
function _normalizeNamespace(name) {
|
|
1725
|
-
if (name && name.replace) {
|
|
1726
|
-
return name.replace(/^\s*\.*|\.*\s*$/g, "");
|
|
1727
|
-
}
|
|
1728
|
-
return name;
|
|
1729
|
-
}
|
|
1730
|
-
function _getEvtNamespace(eventName, evtNamespace) {
|
|
1731
|
-
if (evtNamespace) {
|
|
1732
|
-
var theNamespace_1 = "";
|
|
1733
|
-
if (isArray(evtNamespace)) {
|
|
1734
|
-
theNamespace_1 = "";
|
|
1735
|
-
arrForEach(evtNamespace, function (name) {
|
|
1736
|
-
name = _normalizeNamespace(name);
|
|
1737
|
-
if (name) {
|
|
1738
|
-
if (name[0] !== ".") {
|
|
1739
|
-
name = "." + name;
|
|
1740
|
-
}
|
|
1741
|
-
theNamespace_1 += name;
|
|
1742
|
-
}
|
|
1743
|
-
});
|
|
1744
|
-
}
|
|
1745
|
-
else {
|
|
1746
|
-
theNamespace_1 = _normalizeNamespace(evtNamespace);
|
|
1747
|
-
}
|
|
1748
|
-
if (theNamespace_1) {
|
|
1749
|
-
if (theNamespace_1[0] !== ".") {
|
|
1750
|
-
theNamespace_1 = "." + theNamespace_1;
|
|
1751
|
-
}
|
|
1752
|
-
eventName = (eventName || "") + theNamespace_1;
|
|
1753
|
-
}
|
|
1754
|
-
}
|
|
1755
|
-
var parsedEvent = (eventNamespace.exec(eventName || "") || []);
|
|
1756
|
-
return {
|
|
1757
|
-
type: parsedEvent[1],
|
|
1758
|
-
ns: ((parsedEvent[2] || "").replace(rRemoveEmptyNs, ".").replace(rRemoveTrailingEmptyNs, "").split(".").sort()).join(".")
|
|
1759
|
-
};
|
|
1760
|
-
}
|
|
1761
|
-
function _getRegisteredEvents(target, evtName, addDefault) {
|
|
1762
|
-
if (addDefault === void 0) { addDefault = true; }
|
|
1763
|
-
var aiEvts = elmNodeData.get(target, strEvents, {}, addDefault);
|
|
1764
|
-
var registeredEvents = aiEvts[evtName];
|
|
1765
|
-
if (!registeredEvents) {
|
|
1766
|
-
registeredEvents = aiEvts[evtName] = [];
|
|
1767
|
-
}
|
|
1768
|
-
return registeredEvents;
|
|
1769
|
-
}
|
|
1770
|
-
function _doDetach(obj, evtName, handlerRef, useCapture) {
|
|
1771
|
-
if (obj && evtName && evtName.type) {
|
|
1772
|
-
if (obj[strRemoveEventListener]) {
|
|
1773
|
-
obj[strRemoveEventListener](evtName.type, handlerRef, useCapture);
|
|
1774
|
-
}
|
|
1775
|
-
else if (obj[strDetachEvent]) {
|
|
1776
|
-
obj[strDetachEvent](strOnPrefix + evtName.type, handlerRef);
|
|
1777
|
-
}
|
|
1778
|
-
}
|
|
1779
|
-
}
|
|
1780
|
-
function _doAttach(obj, evtName, handlerRef, useCapture) {
|
|
1781
|
-
var result = false;
|
|
1782
|
-
if (obj && evtName && evtName.type && handlerRef) {
|
|
1783
|
-
if (obj[strAddEventHelper]) {
|
|
1784
|
-
obj[strAddEventHelper](evtName.type, handlerRef, useCapture);
|
|
1785
|
-
result = true;
|
|
1786
|
-
}
|
|
1787
|
-
else if (obj[strAttachEvent]) {
|
|
1788
|
-
obj[strAttachEvent](strOnPrefix + evtName.type, handlerRef);
|
|
1789
|
-
result = true;
|
|
1790
|
-
}
|
|
1791
|
-
}
|
|
1792
|
-
return result;
|
|
1793
|
-
}
|
|
1794
|
-
function _doUnregister(target, events, evtName, unRegFn) {
|
|
1795
|
-
var idx = events.length;
|
|
1796
|
-
while (idx--) {
|
|
1797
|
-
var theEvent = events[idx];
|
|
1798
|
-
if (theEvent) {
|
|
1799
|
-
if (!evtName.ns || evtName.ns === theEvent.evtName.ns) {
|
|
1800
|
-
if (!unRegFn || unRegFn(theEvent)) {
|
|
1801
|
-
_doDetach(target, theEvent.evtName, theEvent.handler, theEvent.capture);
|
|
1802
|
-
events.splice(idx, 1);
|
|
1803
|
-
}
|
|
1804
|
-
}
|
|
1805
|
-
}
|
|
1806
|
-
}
|
|
1807
|
-
}
|
|
1808
|
-
function _unregisterEvents(target, evtName, unRegFn) {
|
|
1809
|
-
if (evtName.type) {
|
|
1810
|
-
_doUnregister(target, _getRegisteredEvents(target, evtName.type), evtName, unRegFn);
|
|
1811
|
-
}
|
|
1812
|
-
else {
|
|
1813
|
-
var eventCache = elmNodeData.get(target, strEvents, {});
|
|
1814
|
-
objForEachKey(eventCache, function (evtType, events) {
|
|
1815
|
-
_doUnregister(target, events, evtName, unRegFn);
|
|
1816
|
-
});
|
|
1817
|
-
if (objKeys(eventCache).length === 0) {
|
|
1818
|
-
elmNodeData.kill(target, strEvents);
|
|
1819
|
-
}
|
|
1820
|
-
}
|
|
1821
|
-
}
|
|
1822
|
-
function mergeEvtNamespace(theNamespace, namespaces) {
|
|
1823
|
-
var newNamespaces;
|
|
1824
|
-
if (namespaces) {
|
|
1825
|
-
if (isArray(namespaces)) {
|
|
1826
|
-
newNamespaces = [theNamespace].concat(namespaces);
|
|
1827
|
-
}
|
|
1828
|
-
else {
|
|
1829
|
-
newNamespaces = [theNamespace, namespaces];
|
|
1830
|
-
}
|
|
1831
|
-
newNamespaces = (_getEvtNamespace("xx", newNamespaces).ns).split(".");
|
|
1832
|
-
}
|
|
1833
|
-
else {
|
|
1834
|
-
newNamespaces = theNamespace;
|
|
1835
|
-
}
|
|
1836
|
-
return newNamespaces;
|
|
1837
|
-
}
|
|
1838
|
-
function eventOn(target, eventName, handlerRef, evtNamespace, useCapture) {
|
|
1839
|
-
if (useCapture === void 0) { useCapture = false; }
|
|
1840
|
-
var result = false;
|
|
1841
|
-
if (target) {
|
|
1842
|
-
try {
|
|
1843
|
-
var evtName = _getEvtNamespace(eventName, evtNamespace);
|
|
1844
|
-
result = _doAttach(target, evtName, handlerRef, useCapture);
|
|
1845
|
-
if (result && elmNodeData.accept(target)) {
|
|
1846
|
-
var registeredEvent = {
|
|
1847
|
-
guid: _guid++,
|
|
1848
|
-
evtName: evtName,
|
|
1849
|
-
handler: handlerRef,
|
|
1850
|
-
capture: useCapture
|
|
1851
|
-
};
|
|
1852
|
-
_getRegisteredEvents(target, evtName.type).push(registeredEvent);
|
|
1853
|
-
}
|
|
1854
|
-
}
|
|
1855
|
-
catch (e) {
|
|
1856
|
-
}
|
|
1857
|
-
}
|
|
1858
|
-
return result;
|
|
1859
|
-
}
|
|
1860
|
-
function eventOff(target, eventName, handlerRef, evtNamespace, useCapture) {
|
|
1861
|
-
if (useCapture === void 0) { useCapture = false; }
|
|
1862
|
-
if (target) {
|
|
1863
|
-
try {
|
|
1864
|
-
var evtName_1 = _getEvtNamespace(eventName, evtNamespace);
|
|
1865
|
-
var found_1 = false;
|
|
1866
|
-
_unregisterEvents(target, evtName_1, function (regEvent) {
|
|
1867
|
-
if ((evtName_1.ns && !handlerRef) || regEvent.handler === handlerRef) {
|
|
1868
|
-
found_1 = true;
|
|
1869
|
-
return true;
|
|
1870
|
-
}
|
|
1871
|
-
return false;
|
|
1872
|
-
});
|
|
1873
|
-
if (!found_1) {
|
|
1874
|
-
_doDetach(target, evtName_1, handlerRef, useCapture);
|
|
1875
|
-
}
|
|
1876
|
-
}
|
|
1877
|
-
catch (e) {
|
|
1878
|
-
}
|
|
1879
|
-
}
|
|
1880
|
-
}
|
|
1881
|
-
|
|
1882
|
-
var LoggingSeverity = createEnumStyle({
|
|
1883
|
-
CRITICAL: 1 ,
|
|
1884
|
-
WARNING: 2
|
|
1885
|
-
});
|
|
1886
|
-
var _InternalMessageId = createEnumStyle({
|
|
1887
|
-
BrowserDoesNotSupportLocalStorage: 0 ,
|
|
1888
|
-
BrowserCannotReadLocalStorage: 1 ,
|
|
1889
|
-
BrowserCannotReadSessionStorage: 2 ,
|
|
1890
|
-
BrowserCannotWriteLocalStorage: 3 ,
|
|
1891
|
-
BrowserCannotWriteSessionStorage: 4 ,
|
|
1892
|
-
BrowserFailedRemovalFromLocalStorage: 5 ,
|
|
1893
|
-
BrowserFailedRemovalFromSessionStorage: 6 ,
|
|
1894
|
-
CannotSendEmptyTelemetry: 7 ,
|
|
1895
|
-
ClientPerformanceMathError: 8 ,
|
|
1896
|
-
ErrorParsingAISessionCookie: 9 ,
|
|
1897
|
-
ErrorPVCalc: 10 ,
|
|
1898
|
-
ExceptionWhileLoggingError: 11 ,
|
|
1899
|
-
FailedAddingTelemetryToBuffer: 12 ,
|
|
1900
|
-
FailedMonitorAjaxAbort: 13 ,
|
|
1901
|
-
FailedMonitorAjaxDur: 14 ,
|
|
1902
|
-
FailedMonitorAjaxOpen: 15 ,
|
|
1903
|
-
FailedMonitorAjaxRSC: 16 ,
|
|
1904
|
-
FailedMonitorAjaxSend: 17 ,
|
|
1905
|
-
FailedMonitorAjaxGetCorrelationHeader: 18 ,
|
|
1906
|
-
FailedToAddHandlerForOnBeforeUnload: 19 ,
|
|
1907
|
-
FailedToSendQueuedTelemetry: 20 ,
|
|
1908
|
-
FailedToReportDataLoss: 21 ,
|
|
1909
|
-
FlushFailed: 22 ,
|
|
1910
|
-
MessageLimitPerPVExceeded: 23 ,
|
|
1911
|
-
MissingRequiredFieldSpecification: 24 ,
|
|
1912
|
-
NavigationTimingNotSupported: 25 ,
|
|
1913
|
-
OnError: 26 ,
|
|
1914
|
-
SessionRenewalDateIsZero: 27 ,
|
|
1915
|
-
SenderNotInitialized: 28 ,
|
|
1916
|
-
StartTrackEventFailed: 29 ,
|
|
1917
|
-
StopTrackEventFailed: 30 ,
|
|
1918
|
-
StartTrackFailed: 31 ,
|
|
1919
|
-
StopTrackFailed: 32 ,
|
|
1920
|
-
TelemetrySampledAndNotSent: 33 ,
|
|
1921
|
-
TrackEventFailed: 34 ,
|
|
1922
|
-
TrackExceptionFailed: 35 ,
|
|
1923
|
-
TrackMetricFailed: 36 ,
|
|
1924
|
-
TrackPVFailed: 37 ,
|
|
1925
|
-
TrackPVFailedCalc: 38 ,
|
|
1926
|
-
TrackTraceFailed: 39 ,
|
|
1927
|
-
TransmissionFailed: 40 ,
|
|
1928
|
-
FailedToSetStorageBuffer: 41 ,
|
|
1929
|
-
FailedToRestoreStorageBuffer: 42 ,
|
|
1930
|
-
InvalidBackendResponse: 43 ,
|
|
1931
|
-
FailedToFixDepricatedValues: 44 ,
|
|
1932
|
-
InvalidDurationValue: 45 ,
|
|
1933
|
-
TelemetryEnvelopeInvalid: 46 ,
|
|
1934
|
-
CreateEnvelopeError: 47 ,
|
|
1935
|
-
CannotSerializeObject: 48 ,
|
|
1936
|
-
CannotSerializeObjectNonSerializable: 49 ,
|
|
1937
|
-
CircularReferenceDetected: 50 ,
|
|
1938
|
-
ClearAuthContextFailed: 51 ,
|
|
1939
|
-
ExceptionTruncated: 52 ,
|
|
1940
|
-
IllegalCharsInName: 53 ,
|
|
1941
|
-
ItemNotInArray: 54 ,
|
|
1942
|
-
MaxAjaxPerPVExceeded: 55 ,
|
|
1943
|
-
MessageTruncated: 56 ,
|
|
1944
|
-
NameTooLong: 57 ,
|
|
1945
|
-
SampleRateOutOfRange: 58 ,
|
|
1946
|
-
SetAuthContextFailed: 59 ,
|
|
1947
|
-
SetAuthContextFailedAccountName: 60 ,
|
|
1948
|
-
StringValueTooLong: 61 ,
|
|
1949
|
-
StartCalledMoreThanOnce: 62 ,
|
|
1950
|
-
StopCalledWithoutStart: 63 ,
|
|
1951
|
-
TelemetryInitializerFailed: 64 ,
|
|
1952
|
-
TrackArgumentsNotSpecified: 65 ,
|
|
1953
|
-
UrlTooLong: 66 ,
|
|
1954
|
-
SessionStorageBufferFull: 67 ,
|
|
1955
|
-
CannotAccessCookie: 68 ,
|
|
1956
|
-
IdTooLong: 69 ,
|
|
1957
|
-
InvalidEvent: 70 ,
|
|
1958
|
-
FailedMonitorAjaxSetRequestHeader: 71 ,
|
|
1959
|
-
SendBrowserInfoOnUserInit: 72 ,
|
|
1960
|
-
PluginException: 73 ,
|
|
1961
|
-
NotificationException: 74 ,
|
|
1962
|
-
SnippetScriptLoadFailure: 99 ,
|
|
1963
|
-
InvalidInstrumentationKey: 100 ,
|
|
1964
|
-
CannotParseAiBlobValue: 101 ,
|
|
1965
|
-
InvalidContentBlob: 102 ,
|
|
1966
|
-
TrackPageActionEventFailed: 103 ,
|
|
1967
|
-
FailedAddingCustomDefinedRequestContext: 104 ,
|
|
1968
|
-
InMemoryStorageBufferFull: 105
|
|
1969
|
-
});
|
|
1970
|
-
|
|
1971
1152
|
var strNotSpecified = "not_specified";
|
|
1972
1153
|
|
|
1973
1154
|
var PropertiesPluginIdentifier = "AppInsightsPropertiesPlugin";
|
|
@@ -2262,200 +1443,188 @@
|
|
|
2262
1443
|
}
|
|
2263
1444
|
|
|
2264
1445
|
var WebEvent = /** @class */ (function () {
|
|
2265
|
-
function WebEvent(
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
|
|
2301
|
-
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
if (
|
|
2305
|
-
|
|
2306
|
-
for (var metaTag in _self._metaTags) {
|
|
2307
|
-
if (metaTag != "behavior" && metaTag != "market" && metaTag != "pageType") {
|
|
2308
|
-
_self._pageTags.metaTags[metaTag] = _self._metaTags[metaTag];
|
|
2309
|
-
}
|
|
2310
|
-
}
|
|
2311
|
-
}
|
|
2312
|
-
event.properties = event.properties || {};
|
|
2313
|
-
event.properties["pageTags"] = _self._pageTags;
|
|
2314
|
-
};
|
|
2315
|
-
_self._getBehavior = function (overrideValues) {
|
|
2316
|
-
var behavior;
|
|
2317
|
-
if (overrideValues && isValueAssigned(overrideValues.behavior)) {
|
|
2318
|
-
behavior = overrideValues.behavior;
|
|
2319
|
-
}
|
|
2320
|
-
else if (isValueAssigned(_self._behaviorMetaTag)) {
|
|
2321
|
-
behavior = _self._behaviorMetaTag;
|
|
2322
|
-
}
|
|
2323
|
-
return _self._getValidBehavior(behavior);
|
|
2324
|
-
};
|
|
2325
|
-
_self._getValidBehavior = function (behavior) {
|
|
2326
|
-
return _self._config.behaviorValidator(behavior);
|
|
2327
|
-
};
|
|
2328
|
-
_self._doUnload = function (unloadCtx, unloadState, asyncCallback) {
|
|
2329
|
-
_initDefaults();
|
|
2330
|
-
};
|
|
2331
|
-
function _getMetaData(metaTags, coreData, metaTagName) {
|
|
2332
|
-
if (coreData && coreData[metaTagName]) {
|
|
2333
|
-
return coreData[metaTagName];
|
|
2334
|
-
}
|
|
2335
|
-
if (metaTags) {
|
|
2336
|
-
return metaTags[metaTagName];
|
|
1446
|
+
function WebEvent(_clickAnalyticsPlugin, _config, _contentHandler, _pageTagsCallback, _metaTags, _traceLogger) {
|
|
1447
|
+
this._clickAnalyticsPlugin = _clickAnalyticsPlugin;
|
|
1448
|
+
this._config = _config;
|
|
1449
|
+
this._contentHandler = _contentHandler;
|
|
1450
|
+
this._pageTagsCallback = _pageTagsCallback;
|
|
1451
|
+
this._metaTags = _metaTags;
|
|
1452
|
+
this._traceLogger = _traceLogger;
|
|
1453
|
+
this._pageTags = {};
|
|
1454
|
+
}
|
|
1455
|
+
WebEvent.prototype.setBasicProperties = function (event, overrideValues) {
|
|
1456
|
+
if (!isValueAssigned(event.name)) {
|
|
1457
|
+
event.pageName = getPageName(this._config, overrideValues);
|
|
1458
|
+
}
|
|
1459
|
+
if (!isValueAssigned(event.uri) && hasWindow) {
|
|
1460
|
+
event.uri = getUri(this._config, getLocation());
|
|
1461
|
+
}
|
|
1462
|
+
};
|
|
1463
|
+
WebEvent.prototype.setCommonProperties = function (event, overrideValues) {
|
|
1464
|
+
this.setBasicProperties(event, overrideValues);
|
|
1465
|
+
this._setPageTags(event, overrideValues);
|
|
1466
|
+
this._pageTypeMetaTag = this._getMetaData(this._metaTags, this._config.coreData, "pageType");
|
|
1467
|
+
this._behaviorMetaTag = this._getMetaData(this._metaTags, this._config.coreData, "behavior");
|
|
1468
|
+
if (isValueAssigned(overrideValues.pageType)) {
|
|
1469
|
+
event.pageType = overrideValues.pageType;
|
|
1470
|
+
}
|
|
1471
|
+
if (isValueAssigned(this._pageTypeMetaTag) && !isValueAssigned(event.pageType)) {
|
|
1472
|
+
event.pageType = this._pageTypeMetaTag;
|
|
1473
|
+
}
|
|
1474
|
+
};
|
|
1475
|
+
WebEvent.prototype._setPageTags = function (event, overrideValues) {
|
|
1476
|
+
if (this._pageTagsCallback) {
|
|
1477
|
+
this._pageTags = extend(true, this._pageTags, this._pageTagsCallback());
|
|
1478
|
+
}
|
|
1479
|
+
if (isValueAssigned(overrideValues.pageTags)) {
|
|
1480
|
+
this._pageTags = extend(true, this._pageTags, overrideValues.pageTags);
|
|
1481
|
+
}
|
|
1482
|
+
if (this._metaTags) {
|
|
1483
|
+
this._pageTags.metaTags = {};
|
|
1484
|
+
for (var metaTag in this._metaTags) {
|
|
1485
|
+
if (metaTag != "behavior" && metaTag != "market" && metaTag != "pageType") {
|
|
1486
|
+
this._pageTags.metaTags[metaTag] = this._metaTags[metaTag];
|
|
2337
1487
|
}
|
|
2338
|
-
return "";
|
|
2339
1488
|
}
|
|
2340
|
-
}
|
|
2341
|
-
|
|
1489
|
+
}
|
|
1490
|
+
event.properties = event.properties || {};
|
|
1491
|
+
event.properties["pageTags"] = this._pageTags;
|
|
1492
|
+
};
|
|
1493
|
+
WebEvent.prototype._getBehavior = function (overrideValues) {
|
|
1494
|
+
var behavior;
|
|
1495
|
+
if (overrideValues && isValueAssigned(overrideValues.behavior)) {
|
|
1496
|
+
behavior = overrideValues.behavior;
|
|
1497
|
+
}
|
|
1498
|
+
else if (isValueAssigned(this._behaviorMetaTag)) {
|
|
1499
|
+
behavior = this._behaviorMetaTag;
|
|
1500
|
+
}
|
|
1501
|
+
return this._getValidBehavior(behavior);
|
|
1502
|
+
};
|
|
1503
|
+
WebEvent.prototype._getValidBehavior = function (behavior) {
|
|
1504
|
+
return this._config.behaviorValidator(behavior);
|
|
1505
|
+
};
|
|
1506
|
+
WebEvent.prototype._getMetaData = function (metaTags, coreData, metaTagName) {
|
|
1507
|
+
if (coreData && coreData[metaTagName]) {
|
|
1508
|
+
return coreData[metaTagName];
|
|
1509
|
+
}
|
|
1510
|
+
else if (metaTags) {
|
|
1511
|
+
return metaTags[metaTagName];
|
|
1512
|
+
}
|
|
1513
|
+
return "";
|
|
1514
|
+
};
|
|
2342
1515
|
return WebEvent;
|
|
2343
1516
|
}());
|
|
2344
1517
|
|
|
2345
1518
|
var PageAction = /** @class */ (function (_super) {
|
|
2346
1519
|
__extendsFn(PageAction, _super);
|
|
2347
|
-
function PageAction(
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
});
|
|
2380
|
-
}
|
|
2381
|
-
_self._clickAnalyticsPlugin.core.track(event);
|
|
2382
|
-
};
|
|
2383
|
-
_self.capturePageAction = function (element, overrideValues, customProperties, isRightClick) {
|
|
2384
|
-
overrideValues = !isValueAssigned(overrideValues) ? {} : overrideValues;
|
|
2385
|
-
var pageActionEvent = { name: "" };
|
|
2386
|
-
var pageActionProperties = isValueAssigned(customProperties) ? customProperties : {};
|
|
2387
|
-
_self.setCommonProperties(pageActionEvent, overrideValues);
|
|
2388
|
-
pageActionEvent.behavior = _self._getBehavior(overrideValues);
|
|
2389
|
-
var elementContent = {};
|
|
2390
|
-
if (isRightClick) {
|
|
2391
|
-
pageActionEvent.behavior = _self._config.defaultRightClickBhvr;
|
|
2392
|
-
}
|
|
2393
|
-
if (element) {
|
|
2394
|
-
pageActionEvent.targetUri = getClickTarget(element);
|
|
2395
|
-
elementContent = _self._contentHandler.getElementContent(element);
|
|
2396
|
-
if (elementContent.bhvr && !isValueAssigned(overrideValues.behavior)) {
|
|
2397
|
-
var currentBehavior = extractFieldFromObject(elementContent, "bhvr");
|
|
2398
|
-
pageActionEvent.behavior = _self._getValidBehavior(currentBehavior);
|
|
2399
|
-
}
|
|
2400
|
-
if (!isValueAssigned(elementContent.id) && !isValueAssigned(elementContent.contentName)) {
|
|
2401
|
-
_self._traceLogger.throwInternal(LoggingSeverity.WARNING, _ExtendedInternalMessageId.InvalidContentBlob, "Missing attributes id or contentName in click event. Click event information will still be collected!");
|
|
2402
|
-
}
|
|
2403
|
-
}
|
|
2404
|
-
pageActionEvent.name = elementContent.id || elementContent.contentName || strNotSpecified;
|
|
2405
|
-
pageActionEvent.parentId = elementContent.parentid || elementContent.parentName || strNotSpecified;
|
|
2406
|
-
if (isValueAssigned(overrideValues.actionType)) {
|
|
2407
|
-
pageActionEvent.actionType = overrideValues.actionType;
|
|
2408
|
-
}
|
|
2409
|
-
if (isValueAssigned(overrideValues.clickCoordinateX) && isValueAssigned(overrideValues.clickCoordinateY)) {
|
|
2410
|
-
pageActionEvent.clickCoordinates = overrideValues.clickCoordinateX + "X" + overrideValues.clickCoordinateY;
|
|
2411
|
-
}
|
|
2412
|
-
_sanitizePageActionEventContent(elementContent);
|
|
2413
|
-
pageActionEvent.content = bracketIt(JSON.stringify(extend(elementContent, overrideValues && overrideValues.contentTags ? overrideValues.contentTags : {})));
|
|
2414
|
-
pageActionEvent.timeToAction = _getTimeToClick();
|
|
2415
|
-
pageActionEvent.refUri = isValueAssigned(overrideValues.refUri) ? overrideValues.refUri : _self._config.coreData.referrerUri;
|
|
2416
|
-
if (_isUndefinedEvent(pageActionEvent)) {
|
|
2417
|
-
return;
|
|
2418
|
-
}
|
|
2419
|
-
_self.trackPageAction(pageActionEvent, pageActionProperties);
|
|
2420
|
-
};
|
|
2421
|
-
function _getTimeToClick() {
|
|
2422
|
-
var perf = getPerformance();
|
|
2423
|
-
if (perf && perf.timing) {
|
|
2424
|
-
var isNavigationStart = perf.timing.navigationStart;
|
|
2425
|
-
if (isNavigationStart && isNavigationStart !== 0) {
|
|
2426
|
-
return new Date().getTime() - isNavigationStart;
|
|
2427
|
-
}
|
|
2428
|
-
}
|
|
2429
|
-
return -1;
|
|
2430
|
-
}
|
|
2431
|
-
function _populateEventDataIfPresent(obj, property, value) {
|
|
2432
|
-
if (isValueAssigned(value)) {
|
|
2433
|
-
obj[property] = value;
|
|
2434
|
-
}
|
|
2435
|
-
}
|
|
2436
|
-
function _sanitizePageActionEventContent(pageActionContent) {
|
|
2437
|
-
if (pageActionContent) {
|
|
2438
|
-
delete pageActionContent.id;
|
|
2439
|
-
delete pageActionContent.parentid;
|
|
2440
|
-
delete pageActionContent.parentname;
|
|
2441
|
-
if (_self._config && _self._config.dataTags && isValueAssigned(_self._config.dataTags.parentDataTag)) {
|
|
2442
|
-
delete pageActionContent[_self._config.dataTags.parentDataTag];
|
|
2443
|
-
}
|
|
1520
|
+
function PageAction() {
|
|
1521
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
1522
|
+
}
|
|
1523
|
+
PageAction.prototype.trackPageAction = function (pageActionEvent, properties) {
|
|
1524
|
+
var _this = this;
|
|
1525
|
+
var ext = {};
|
|
1526
|
+
ext["web"] = {};
|
|
1527
|
+
var event = {
|
|
1528
|
+
name: "Microsoft.ApplicationInsights.{0}.Event",
|
|
1529
|
+
baseType: "EventData",
|
|
1530
|
+
ext: ext,
|
|
1531
|
+
data: {},
|
|
1532
|
+
baseData: {}
|
|
1533
|
+
};
|
|
1534
|
+
this._populateEventDataIfPresent(event.baseData, "name", pageActionEvent.name);
|
|
1535
|
+
this._populateEventDataIfPresent(event.data, "baseTypeSource", "ClickEvent");
|
|
1536
|
+
this._populateEventDataIfPresent(event.data, "uri", pageActionEvent.uri);
|
|
1537
|
+
this._populateEventDataIfPresent(event.data, "pageType", pageActionEvent.pageType);
|
|
1538
|
+
this._populateEventDataIfPresent(event.data, "properties", pageActionEvent.properties);
|
|
1539
|
+
this._populateEventDataIfPresent(event.data, "actionType", pageActionEvent.actionType);
|
|
1540
|
+
this._populateEventDataIfPresent(event.data, "behavior", pageActionEvent.behavior);
|
|
1541
|
+
this._populateEventDataIfPresent(event.data, "clickCoordinates", pageActionEvent.clickCoordinates);
|
|
1542
|
+
this._populateEventDataIfPresent(event.data, "content", pageActionEvent.content);
|
|
1543
|
+
this._populateEventDataIfPresent(event.data, "targetUri", pageActionEvent.targetUri);
|
|
1544
|
+
this._populateEventDataIfPresent(event.data, "timeToAction", pageActionEvent.timeToAction);
|
|
1545
|
+
this._populateEventDataIfPresent(event.data, "refUri", pageActionEvent.refUri);
|
|
1546
|
+
this._populateEventDataIfPresent(event.data, "pageName", pageActionEvent.pageName);
|
|
1547
|
+
this._populateEventDataIfPresent(event.data, "parentId", pageActionEvent.parentId);
|
|
1548
|
+
if (properties) {
|
|
1549
|
+
objForEachKey(properties, function (property, value) {
|
|
1550
|
+
if (!event.data[property]) {
|
|
1551
|
+
_this._populateEventDataIfPresent(event.data, property, value);
|
|
2444
1552
|
}
|
|
1553
|
+
});
|
|
1554
|
+
}
|
|
1555
|
+
this._clickAnalyticsPlugin.core.track(event);
|
|
1556
|
+
};
|
|
1557
|
+
PageAction.prototype.capturePageAction = function (element, overrideValues, customProperties, isRightClick) {
|
|
1558
|
+
overrideValues = !isValueAssigned(overrideValues) ? {} : overrideValues;
|
|
1559
|
+
var pageActionEvent = { name: "" };
|
|
1560
|
+
var pageActionProperties = isValueAssigned(customProperties) ? customProperties : {};
|
|
1561
|
+
this.setCommonProperties(pageActionEvent, overrideValues);
|
|
1562
|
+
pageActionEvent.behavior = this._getBehavior(overrideValues);
|
|
1563
|
+
var elementContent = {};
|
|
1564
|
+
if (isRightClick) {
|
|
1565
|
+
pageActionEvent.behavior = this._config.defaultRightClickBhvr;
|
|
1566
|
+
}
|
|
1567
|
+
if (element) {
|
|
1568
|
+
pageActionEvent.targetUri = getClickTarget(element);
|
|
1569
|
+
elementContent = this._contentHandler.getElementContent(element);
|
|
1570
|
+
if (elementContent.bhvr && !isValueAssigned(overrideValues.behavior)) {
|
|
1571
|
+
var currentBehavior = extractFieldFromObject(elementContent, "bhvr");
|
|
1572
|
+
pageActionEvent.behavior = this._getValidBehavior(currentBehavior);
|
|
1573
|
+
}
|
|
1574
|
+
if (!isValueAssigned(elementContent.id) && !isValueAssigned(elementContent.contentName)) {
|
|
1575
|
+
this._traceLogger.throwInternal(LoggingSeverity.WARNING, _ExtendedInternalMessageId.InvalidContentBlob, "Missing attributes id or contentName in click event. Click event information will still be collected!");
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
pageActionEvent.name = elementContent.id || elementContent.contentName || strNotSpecified;
|
|
1579
|
+
pageActionEvent.parentId = elementContent.parentid || elementContent.parentName || strNotSpecified;
|
|
1580
|
+
if (isValueAssigned(overrideValues.actionType)) {
|
|
1581
|
+
pageActionEvent.actionType = overrideValues.actionType;
|
|
1582
|
+
}
|
|
1583
|
+
if (isValueAssigned(overrideValues.clickCoordinateX) && isValueAssigned(overrideValues.clickCoordinateY)) {
|
|
1584
|
+
pageActionEvent.clickCoordinates = overrideValues.clickCoordinateX + "X" + overrideValues.clickCoordinateY;
|
|
1585
|
+
}
|
|
1586
|
+
this._sanitizePageActionEventContent(elementContent);
|
|
1587
|
+
pageActionEvent.content = bracketIt(JSON.stringify(extend(elementContent, overrideValues && overrideValues.contentTags ? overrideValues.contentTags : {})));
|
|
1588
|
+
pageActionEvent.timeToAction = this._getTimeToClick();
|
|
1589
|
+
pageActionEvent.refUri = isValueAssigned(overrideValues.refUri) ? overrideValues.refUri : this._config.coreData.referrerUri;
|
|
1590
|
+
if (this._isUndefinedEvent(pageActionEvent))
|
|
1591
|
+
return;
|
|
1592
|
+
this.trackPageAction(pageActionEvent, pageActionProperties);
|
|
1593
|
+
};
|
|
1594
|
+
PageAction.prototype._getTimeToClick = function () {
|
|
1595
|
+
var perf = getPerformance();
|
|
1596
|
+
if (perf && perf.timing) {
|
|
1597
|
+
var isNavigationStart = perf.timing.navigationStart;
|
|
1598
|
+
if (isNavigationStart && isNavigationStart !== 0) {
|
|
1599
|
+
return new Date().getTime() - isNavigationStart;
|
|
2445
1600
|
}
|
|
2446
|
-
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
1601
|
+
}
|
|
1602
|
+
return -1;
|
|
1603
|
+
};
|
|
1604
|
+
PageAction.prototype._populateEventDataIfPresent = function (obj, property, value) {
|
|
1605
|
+
if (isValueAssigned(value)) {
|
|
1606
|
+
obj[property] = value;
|
|
1607
|
+
}
|
|
1608
|
+
};
|
|
1609
|
+
PageAction.prototype._sanitizePageActionEventContent = function (pageActionContent) {
|
|
1610
|
+
if (pageActionContent) {
|
|
1611
|
+
delete pageActionContent.id;
|
|
1612
|
+
delete pageActionContent.parentid;
|
|
1613
|
+
delete pageActionContent.parentname;
|
|
1614
|
+
if (this._config && this._config.dataTags && isValueAssigned(this._config.dataTags.parentDataTag)) {
|
|
1615
|
+
delete pageActionContent[this._config.dataTags.parentDataTag];
|
|
2455
1616
|
}
|
|
2456
|
-
}
|
|
2457
|
-
|
|
2458
|
-
|
|
1617
|
+
}
|
|
1618
|
+
};
|
|
1619
|
+
PageAction.prototype._isUndefinedEvent = function (pageActionEvent) {
|
|
1620
|
+
if (this._config.dropInvalidEvents) {
|
|
1621
|
+
if (pageActionEvent.name === strNotSpecified
|
|
1622
|
+
&& pageActionEvent.parentId === strNotSpecified
|
|
1623
|
+
&& pageActionEvent.content === "[{}]")
|
|
1624
|
+
return true;
|
|
1625
|
+
}
|
|
1626
|
+
return false;
|
|
1627
|
+
};
|
|
2459
1628
|
return PageAction;
|
|
2460
1629
|
}(WebEvent));
|
|
2461
1630
|
|
|
@@ -2478,83 +1647,77 @@
|
|
|
2478
1647
|
this._config = _config;
|
|
2479
1648
|
this._pageAction = _pageAction;
|
|
2480
1649
|
this._traceLogger = _traceLogger;
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
1650
|
+
}
|
|
1651
|
+
AutoCaptureHandler.prototype.click = function () {
|
|
1652
|
+
var _this = this;
|
|
1653
|
+
var win = getWindow();
|
|
1654
|
+
var doc = getDocument();
|
|
1655
|
+
if (win) {
|
|
1656
|
+
var event_1 = (navigator.appVersion.indexOf("MSIE") !== -1) ? "click" : "mousedown";
|
|
1657
|
+
attachEvent(win, event_1, function (evt) { _this._processClick(evt); });
|
|
1658
|
+
attachEvent(win, "keyup", function (evt) { _this._processClick(evt); });
|
|
1659
|
+
}
|
|
1660
|
+
else if (doc) {
|
|
1661
|
+
attachEvent(doc, "click", function (evt) { _this._processClick(evt); });
|
|
1662
|
+
attachEvent(doc, "keyup", function (evt) { _this._processClick(evt); });
|
|
1663
|
+
}
|
|
1664
|
+
};
|
|
1665
|
+
AutoCaptureHandler.prototype.capturePageAction = function (element, overrideValues, customProperties, isRightClick) {
|
|
1666
|
+
var donotTrackTag = this._config.dataTags.customDataPrefix + this._config.dataTags.dntDataTag;
|
|
1667
|
+
if (!isElementDnt(element, donotTrackTag)) {
|
|
1668
|
+
this._pageAction.capturePageAction(element, overrideValues, customProperties, isRightClick);
|
|
1669
|
+
}
|
|
1670
|
+
};
|
|
1671
|
+
AutoCaptureHandler.prototype._processClick = function (clickEvent) {
|
|
1672
|
+
var clickCaptureElements = { A: true, BUTTON: true, AREA: true, INPUT: true };
|
|
1673
|
+
var win = getWindow();
|
|
1674
|
+
if (isNullOrUndefined(clickEvent) && win) {
|
|
1675
|
+
clickEvent = win.event;
|
|
1676
|
+
}
|
|
1677
|
+
if (clickEvent) {
|
|
1678
|
+
var element = clickEvent.srcElement || clickEvent.target;
|
|
1679
|
+
var overrideValues = {
|
|
1680
|
+
clickCoordinateX: clickEvent.pageX,
|
|
1681
|
+
clickCoordinateY: clickEvent.pageY
|
|
2499
1682
|
};
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
1683
|
+
var isRightClickObj = isRightClick(clickEvent);
|
|
1684
|
+
if (isRightClickObj) {
|
|
1685
|
+
overrideValues.actionType = ActionType.CLICKRIGHT;
|
|
1686
|
+
}
|
|
1687
|
+
else if (isLeftClick(clickEvent)) {
|
|
1688
|
+
overrideValues.actionType = ActionType.CLICKLEFT;
|
|
1689
|
+
}
|
|
1690
|
+
else if (isKeyboardEnter(clickEvent)) {
|
|
1691
|
+
overrideValues.actionType = ActionType.KEYBOARDENTER;
|
|
1692
|
+
}
|
|
1693
|
+
else if (isKeyboardSpace(clickEvent)) {
|
|
1694
|
+
overrideValues.actionType = ActionType.KEYBOARDSPACE;
|
|
2505
1695
|
}
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
1696
|
+
else if (isMiddleClick(clickEvent)) {
|
|
1697
|
+
overrideValues.actionType = ActionType.CLICKMIDDLE;
|
|
1698
|
+
}
|
|
1699
|
+
else {
|
|
1700
|
+
return;
|
|
1701
|
+
}
|
|
1702
|
+
while (element && element.tagName) {
|
|
1703
|
+
if (element.control && clickCaptureElements[element.control.tagName.toUpperCase()]) {
|
|
1704
|
+
element = element.control;
|
|
2511
1705
|
}
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
var
|
|
2519
|
-
if (
|
|
2520
|
-
|
|
2521
|
-
}
|
|
2522
|
-
else if (isLeftClick(clickEvent)) {
|
|
2523
|
-
overrideValues.actionType = ActionType.CLICKLEFT;
|
|
2524
|
-
}
|
|
2525
|
-
else if (isKeyboardEnter(clickEvent)) {
|
|
2526
|
-
overrideValues.actionType = ActionType.KEYBOARDENTER;
|
|
2527
|
-
}
|
|
2528
|
-
else if (isKeyboardSpace(clickEvent)) {
|
|
2529
|
-
overrideValues.actionType = ActionType.KEYBOARDSPACE;
|
|
2530
|
-
}
|
|
2531
|
-
else if (isMiddleClick(clickEvent)) {
|
|
2532
|
-
overrideValues.actionType = ActionType.CLICKMIDDLE;
|
|
2533
|
-
}
|
|
2534
|
-
else {
|
|
2535
|
-
return;
|
|
2536
|
-
}
|
|
2537
|
-
while (element && element.tagName) {
|
|
2538
|
-
if (element.control && clickCaptureElements[element.control.tagName.toUpperCase()]) {
|
|
2539
|
-
element = element.control;
|
|
2540
|
-
}
|
|
2541
|
-
var tagNameUpperCased = element.tagName.toUpperCase();
|
|
2542
|
-
if (!clickCaptureElements[tagNameUpperCased]) {
|
|
2543
|
-
element = element.parentElement || element.parentNode;
|
|
2544
|
-
continue;
|
|
2545
|
-
}
|
|
2546
|
-
else {
|
|
2547
|
-
var sendEvent = tagNameUpperCased === "INPUT" ? clickCaptureInputTypes[element.type.toUpperCase()] : true;
|
|
2548
|
-
if (sendEvent) {
|
|
2549
|
-
_capturePageAction(element, overrideValues, {}, isRightClickObj);
|
|
2550
|
-
}
|
|
2551
|
-
break;
|
|
2552
|
-
}
|
|
1706
|
+
var tagNameUpperCased = element.tagName.toUpperCase();
|
|
1707
|
+
if (!clickCaptureElements[tagNameUpperCased]) {
|
|
1708
|
+
element = element.parentElement || element.parentNode;
|
|
1709
|
+
continue;
|
|
1710
|
+
}
|
|
1711
|
+
else {
|
|
1712
|
+
var sendEvent = tagNameUpperCased === "INPUT" ? clickCaptureInputTypes[element.type.toUpperCase()] : true;
|
|
1713
|
+
if (sendEvent) {
|
|
1714
|
+
this.capturePageAction(element, overrideValues, {}, isRightClickObj);
|
|
2553
1715
|
}
|
|
1716
|
+
break;
|
|
2554
1717
|
}
|
|
2555
1718
|
}
|
|
2556
|
-
}
|
|
2557
|
-
}
|
|
1719
|
+
}
|
|
1720
|
+
};
|
|
2558
1721
|
return AutoCaptureHandler;
|
|
2559
1722
|
}());
|
|
2560
1723
|
|
|
@@ -2563,318 +1726,285 @@
|
|
|
2563
1726
|
function DomContentHandler(_config, _traceLogger) {
|
|
2564
1727
|
this._config = _config;
|
|
2565
1728
|
this._traceLogger = _traceLogger;
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
try {
|
|
2593
|
-
elementContent = JSON.parse(biBlobValue);
|
|
2594
|
-
}
|
|
2595
|
-
catch (e) {
|
|
2596
|
-
_self._traceLogger.throwInternal(LoggingSeverity.CRITICAL, _ExtendedInternalMessageId.CannotParseAiBlobValue, "Can not parse " + biBlobValue);
|
|
2597
|
-
}
|
|
2598
|
-
}
|
|
2599
|
-
else {
|
|
2600
|
-
elementContent = extend(elementContent, _populateElementContent(element, dataTagPrefix, parentDataTagPrefix, aiBlobAttributeTag));
|
|
2601
|
-
}
|
|
2602
|
-
}
|
|
2603
|
-
else {
|
|
2604
|
-
elementContent = extend(elementContent, _populateElementContentwithDataTag(element, dataTagPrefix, parentDataTagPrefix, aiBlobAttributeTag));
|
|
1729
|
+
}
|
|
1730
|
+
DomContentHandler.prototype.getMetadata = function () {
|
|
1731
|
+
var metaTags = {};
|
|
1732
|
+
if (hasDocument) {
|
|
1733
|
+
metaTags = isValueAssigned(this._config.dataTags.metaDataPrefix) ? this._getMetaDataFromDOM(this._config.dataTags.captureAllMetaDataContent, this._config.dataTags.metaDataPrefix, false) :
|
|
1734
|
+
this._getMetaDataFromDOM(this._config.dataTags.captureAllMetaDataContent, "", false);
|
|
1735
|
+
}
|
|
1736
|
+
return metaTags;
|
|
1737
|
+
};
|
|
1738
|
+
DomContentHandler.prototype.getElementContent = function (element) {
|
|
1739
|
+
if (!element) {
|
|
1740
|
+
return {};
|
|
1741
|
+
}
|
|
1742
|
+
var elementContent = {};
|
|
1743
|
+
var biBlobValue;
|
|
1744
|
+
var parentDataTagPrefix;
|
|
1745
|
+
var dataTagPrefix = this._config.dataTags.customDataPrefix;
|
|
1746
|
+
var aiBlobAttributeTag = dataTagPrefix + this._config.dataTags.aiBlobAttributeTag;
|
|
1747
|
+
if (isValueAssigned(this._config.dataTags.parentDataTag)) {
|
|
1748
|
+
parentDataTagPrefix = dataTagPrefix + this._config.dataTags.parentDataTag;
|
|
1749
|
+
}
|
|
1750
|
+
if (!this._isTracked(element, dataTagPrefix, aiBlobAttributeTag)) {
|
|
1751
|
+
biBlobValue = element.getAttribute(aiBlobAttributeTag);
|
|
1752
|
+
if (biBlobValue) {
|
|
1753
|
+
try {
|
|
1754
|
+
elementContent = JSON.parse(biBlobValue);
|
|
2605
1755
|
}
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
elementContent = extend(elementContent, _getParentDetails(element, elementContent, dataTagPrefix, aiBlobAttributeTag));
|
|
1756
|
+
catch (e) {
|
|
1757
|
+
this._traceLogger.throwInternal(LoggingSeverity.CRITICAL, _ExtendedInternalMessageId.CannotParseAiBlobValue, "Can not parse " + biBlobValue);
|
|
2609
1758
|
}
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
1759
|
+
}
|
|
1760
|
+
else {
|
|
1761
|
+
elementContent = extend(elementContent, this._populateElementContent(element, dataTagPrefix, parentDataTagPrefix, aiBlobAttributeTag));
|
|
1762
|
+
}
|
|
1763
|
+
}
|
|
1764
|
+
else {
|
|
1765
|
+
elementContent = extend(elementContent, this._populateElementContentwithDataTag(element, dataTagPrefix, parentDataTagPrefix, aiBlobAttributeTag));
|
|
1766
|
+
}
|
|
1767
|
+
removeInvalidElements(elementContent);
|
|
1768
|
+
if (parentDataTagPrefix) {
|
|
1769
|
+
elementContent = extend(elementContent, this._getParentDetails(element, elementContent, dataTagPrefix, aiBlobAttributeTag));
|
|
1770
|
+
}
|
|
1771
|
+
return elementContent;
|
|
1772
|
+
};
|
|
1773
|
+
DomContentHandler.prototype._captureElementContentWithDataTag = function (contentElement, elementContent, dataTagPrefix) {
|
|
1774
|
+
for (var i = 0, attrib; i < contentElement.attributes.length; i++) {
|
|
1775
|
+
attrib = contentElement.attributes[i];
|
|
1776
|
+
if (attrib.name.indexOf(dataTagPrefix) !== 0) {
|
|
1777
|
+
continue;
|
|
1778
|
+
}
|
|
1779
|
+
var attribName = attrib.name.replace(dataTagPrefix, "");
|
|
1780
|
+
elementContent[attribName] = attrib.value;
|
|
1781
|
+
}
|
|
1782
|
+
};
|
|
1783
|
+
DomContentHandler.prototype._walkUpDomChainCaptureData = function (el, elementContent, dataTagPrefix, parentDataTagPrefix, aiBlobAttributeTag) {
|
|
1784
|
+
var element = el;
|
|
1785
|
+
var parentDataTagFound = false;
|
|
1786
|
+
var elementLevelFlag = false;
|
|
1787
|
+
while (!isNullOrUndefined(element) && !isNullOrUndefined(element.attributes)) {
|
|
1788
|
+
var attributes = element.attributes;
|
|
1789
|
+
for (var i = 0; i < attributes.length; i++) {
|
|
1790
|
+
var attrib = attributes[i];
|
|
1791
|
+
if (attrib.name.indexOf(dataTagPrefix) !== 0) {
|
|
1792
|
+
continue;
|
|
1793
|
+
}
|
|
1794
|
+
if (attrib.name.indexOf(parentDataTagPrefix) === 0) {
|
|
1795
|
+
parentDataTagFound = true;
|
|
1796
|
+
}
|
|
1797
|
+
if (attrib.name.indexOf(aiBlobAttributeTag) === 0) {
|
|
1798
|
+
continue;
|
|
1799
|
+
}
|
|
1800
|
+
var attribName = attrib.name.replace(dataTagPrefix, "");
|
|
1801
|
+
if (elementLevelFlag && attribName === "id")
|
|
1802
|
+
continue;
|
|
1803
|
+
if (!isValueAssigned(elementContent[attribName])) {
|
|
2619
1804
|
elementContent[attribName] = attrib.value;
|
|
2620
1805
|
}
|
|
2621
1806
|
}
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
var parentDataTagFound = false;
|
|
2625
|
-
var elementLevelFlag = false;
|
|
2626
|
-
while (!isNullOrUndefined(element) && !isNullOrUndefined(element.attributes)) {
|
|
2627
|
-
var attributes = element.attributes;
|
|
2628
|
-
for (var i = 0; i < attributes.length; i++) {
|
|
2629
|
-
var attrib = attributes[i];
|
|
2630
|
-
if (attrib.name.indexOf(dataTagPrefix) !== 0) {
|
|
2631
|
-
continue;
|
|
2632
|
-
}
|
|
2633
|
-
if (attrib.name.indexOf(parentDataTagPrefix) === 0) {
|
|
2634
|
-
parentDataTagFound = true;
|
|
2635
|
-
}
|
|
2636
|
-
if (attrib.name.indexOf(aiBlobAttributeTag) === 0) {
|
|
2637
|
-
continue;
|
|
2638
|
-
}
|
|
2639
|
-
var attribName = attrib.name.replace(dataTagPrefix, "");
|
|
2640
|
-
if (elementLevelFlag && attribName === "id") {
|
|
2641
|
-
continue;
|
|
2642
|
-
}
|
|
2643
|
-
if (!isValueAssigned(elementContent[attribName])) {
|
|
2644
|
-
elementContent[attribName] = attrib.value;
|
|
2645
|
-
}
|
|
2646
|
-
}
|
|
2647
|
-
if (parentDataTagFound) {
|
|
2648
|
-
break;
|
|
2649
|
-
}
|
|
2650
|
-
elementLevelFlag = true;
|
|
2651
|
-
element = element.parentNode;
|
|
2652
|
-
}
|
|
1807
|
+
if (parentDataTagFound) {
|
|
1808
|
+
break;
|
|
2653
1809
|
}
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
1810
|
+
elementLevelFlag = true;
|
|
1811
|
+
element = element.parentNode;
|
|
1812
|
+
}
|
|
1813
|
+
};
|
|
1814
|
+
DomContentHandler.prototype._populateElementContent = function (element, dataTagPrefix, parentDataTagPrefix, aiBlobAttributeTag) {
|
|
1815
|
+
var elementContent = {};
|
|
1816
|
+
if (!element)
|
|
1817
|
+
return elementContent;
|
|
1818
|
+
var htmlContent = this._getHtmlIdAndContentName(element);
|
|
1819
|
+
elementContent = {
|
|
1820
|
+
id: htmlContent.id || "",
|
|
1821
|
+
contentName: htmlContent.contentName || ""
|
|
1822
|
+
};
|
|
1823
|
+
if (isValueAssigned(parentDataTagPrefix)) {
|
|
1824
|
+
this._walkUpDomChainCaptureData(element, elementContent, dataTagPrefix, parentDataTagPrefix, aiBlobAttributeTag);
|
|
1825
|
+
}
|
|
1826
|
+
if (!elementContent.id && !elementContent.contentName) {
|
|
1827
|
+
this._traceLogger.throwInternal(LoggingSeverity.WARNING, _ExtendedInternalMessageId.InvalidContentBlob, "Invalid content blob. Missing required attributes (id, contentName. " +
|
|
1828
|
+
" Content information will still be collected!");
|
|
1829
|
+
}
|
|
1830
|
+
return elementContent;
|
|
1831
|
+
};
|
|
1832
|
+
DomContentHandler.prototype._populateElementContentwithDataTag = function (element, dataTagPrefix, parentDataTagPrefix, aiBlobAttributeTag) {
|
|
1833
|
+
var elementContent = {};
|
|
1834
|
+
if (!element)
|
|
1835
|
+
return elementContent;
|
|
1836
|
+
var htmlContent = this._getHtmlIdAndContentName(element);
|
|
1837
|
+
if (isValueAssigned(parentDataTagPrefix)) {
|
|
1838
|
+
this._walkUpDomChainCaptureData(element, elementContent, dataTagPrefix, parentDataTagPrefix, aiBlobAttributeTag);
|
|
1839
|
+
}
|
|
1840
|
+
else {
|
|
1841
|
+
this._captureElementContentWithDataTag(element, elementContent, dataTagPrefix);
|
|
1842
|
+
}
|
|
1843
|
+
if (this._config.dataTags.useDefaultContentNameOrId) {
|
|
1844
|
+
if (!isValueAssigned(elementContent.id)) {
|
|
1845
|
+
elementContent.id = htmlContent.id || "";
|
|
2672
1846
|
}
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
|
|
2677
|
-
|
|
2678
|
-
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
if (!elementContent.id && !elementContent.contentName) {
|
|
2693
|
-
_traceLogger.throwInternal(LoggingSeverity.WARNING, _ExtendedInternalMessageId.InvalidContentBlob, "Invalid content blob. Missing required attributes (id, contentName. " +
|
|
2694
|
-
" Content information will still be collected!");
|
|
2695
|
-
}
|
|
2696
|
-
return elementContent;
|
|
2697
|
-
}
|
|
2698
|
-
function _getMetaDataFromDOM(captureAllMetaDataContent, prefix, removePrefix) {
|
|
2699
|
-
var metaElements;
|
|
2700
|
-
var metaData = {};
|
|
2701
|
-
if (hasDocument) {
|
|
2702
|
-
metaElements = document.querySelectorAll("meta");
|
|
2703
|
-
for (var i = 0; i < metaElements.length; i++) {
|
|
2704
|
-
var meta = metaElements[i];
|
|
2705
|
-
if (meta.name) {
|
|
2706
|
-
if (captureAllMetaDataContent || meta.name.indexOf(prefix) === 0) {
|
|
2707
|
-
var name_1 = removePrefix ? meta.name.replace(prefix, "") : meta.name;
|
|
2708
|
-
metaData[name_1] = meta.content;
|
|
2709
|
-
}
|
|
2710
|
-
}
|
|
1847
|
+
elementContent.contentName = htmlContent.contentName || "";
|
|
1848
|
+
}
|
|
1849
|
+
if (!elementContent.id && !elementContent.contentName) {
|
|
1850
|
+
this._traceLogger.throwInternal(LoggingSeverity.WARNING, _ExtendedInternalMessageId.InvalidContentBlob, "Invalid content blob. Missing required attributes (id, contentName. " +
|
|
1851
|
+
" Content information will still be collected!");
|
|
1852
|
+
}
|
|
1853
|
+
return elementContent;
|
|
1854
|
+
};
|
|
1855
|
+
DomContentHandler.prototype._getMetaDataFromDOM = function (captureAllMetaDataContent, prefix, removePrefix) {
|
|
1856
|
+
var metaElements;
|
|
1857
|
+
var metaData = {};
|
|
1858
|
+
if (hasDocument) {
|
|
1859
|
+
metaElements = document.querySelectorAll("meta");
|
|
1860
|
+
for (var i = 0; i < metaElements.length; i++) {
|
|
1861
|
+
var meta = metaElements[i];
|
|
1862
|
+
if (meta.name) {
|
|
1863
|
+
if (captureAllMetaDataContent || meta.name.indexOf(prefix) === 0) {
|
|
1864
|
+
var name_1 = removePrefix ? meta.name.replace(prefix, "") : meta.name;
|
|
1865
|
+
metaData[name_1] = meta.content;
|
|
2711
1866
|
}
|
|
2712
1867
|
}
|
|
2713
|
-
return metaData;
|
|
2714
1868
|
}
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2743
|
-
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
|
|
2747
|
-
}
|
|
2748
|
-
|
|
2749
|
-
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
2777
|
-
|
|
2778
|
-
|
|
2779
|
-
|
|
2780
|
-
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
}
|
|
2784
|
-
catch (e) {
|
|
2785
|
-
_traceLogger.throwInternal(LoggingSeverity.CRITICAL, _ExtendedInternalMessageId.CannotParseAiBlobValue, "Can not parse " + dataAttr);
|
|
2786
|
-
}
|
|
2787
|
-
if (telemetryObject) {
|
|
2788
|
-
parentId = telemetryObject.id;
|
|
2789
|
-
}
|
|
2790
|
-
}
|
|
2791
|
-
else {
|
|
2792
|
-
parentId = closestParentElement.getAttribute(dataTagPrefix + "id");
|
|
2793
|
-
}
|
|
1869
|
+
}
|
|
1870
|
+
return metaData;
|
|
1871
|
+
};
|
|
1872
|
+
DomContentHandler.prototype._getDefaultContentName = function (element, useDefaultContentName) {
|
|
1873
|
+
if (useDefaultContentName === false || !element.tagName) {
|
|
1874
|
+
return "";
|
|
1875
|
+
}
|
|
1876
|
+
var doc = getDocument() || {};
|
|
1877
|
+
var contentName;
|
|
1878
|
+
switch (element.tagName) {
|
|
1879
|
+
case "A":
|
|
1880
|
+
contentName = doc.all ? element.innerText || element.innerHTML : element.text || element.innerHTML;
|
|
1881
|
+
break;
|
|
1882
|
+
case "IMG":
|
|
1883
|
+
case "AREA":
|
|
1884
|
+
contentName = element.alt;
|
|
1885
|
+
break;
|
|
1886
|
+
default:
|
|
1887
|
+
contentName = element.value || element.name || element.alt || element.innerText || element.id;
|
|
1888
|
+
}
|
|
1889
|
+
return contentName.substring(0, MAX_CONTENTNAME_LENGTH);
|
|
1890
|
+
};
|
|
1891
|
+
DomContentHandler.prototype._isTracked = function (element, dataTag, aiBlobAttributeTag) {
|
|
1892
|
+
var attrs = element.attributes;
|
|
1893
|
+
var dataTagFound = false;
|
|
1894
|
+
for (var i = 0; i < attrs.length; i++) {
|
|
1895
|
+
var attributeName = attrs[i].name;
|
|
1896
|
+
if (attributeName === aiBlobAttributeTag) {
|
|
1897
|
+
return false;
|
|
1898
|
+
}
|
|
1899
|
+
else if (attributeName.indexOf(dataTag) === 0) {
|
|
1900
|
+
dataTagFound = true;
|
|
1901
|
+
}
|
|
1902
|
+
}
|
|
1903
|
+
return dataTagFound;
|
|
1904
|
+
};
|
|
1905
|
+
DomContentHandler.prototype._getHtmlIdAndContentName = function (element) {
|
|
1906
|
+
var htmlContent = {};
|
|
1907
|
+
if (!element)
|
|
1908
|
+
return htmlContent;
|
|
1909
|
+
if (this._config.dataTags.useDefaultContentNameOrId) {
|
|
1910
|
+
var customizedContentName = this._config.callback.contentName ? this._config.callback.contentName(element, this._config.dataTags.useDefaultContentNameOrId) : "";
|
|
1911
|
+
var defaultContentName = this._getDefaultContentName(element, this._config.dataTags.useDefaultContentNameOrId);
|
|
1912
|
+
htmlContent = {
|
|
1913
|
+
id: element.id,
|
|
1914
|
+
contentName: customizedContentName || defaultContentName || element.getAttribute("alt")
|
|
1915
|
+
};
|
|
1916
|
+
}
|
|
1917
|
+
return htmlContent;
|
|
1918
|
+
};
|
|
1919
|
+
DomContentHandler.prototype._getParentDetails = function (element, elementContent, dataTagPrefix, aiBlobAttributeTag) {
|
|
1920
|
+
var parentId = elementContent["parentid"];
|
|
1921
|
+
var parentName = elementContent["parentname"];
|
|
1922
|
+
var parentInfo = {};
|
|
1923
|
+
if (parentId || parentName || !element) {
|
|
1924
|
+
return parentInfo;
|
|
1925
|
+
}
|
|
1926
|
+
return this._populateParentInfo(element, dataTagPrefix, aiBlobAttributeTag);
|
|
1927
|
+
};
|
|
1928
|
+
DomContentHandler.prototype._populateParentInfo = function (element, dataTagPrefix, aiBlobAttributeTag) {
|
|
1929
|
+
var parentInfo = {};
|
|
1930
|
+
var parentId;
|
|
1931
|
+
var closestParentElement = walkUpDomChainWithElementValidation(element.parentElement, this._isTracked, dataTagPrefix);
|
|
1932
|
+
if (closestParentElement) {
|
|
1933
|
+
var dataAttr = closestParentElement.getAttribute(aiBlobAttributeTag) || element[aiBlobAttributeTag];
|
|
1934
|
+
if (dataAttr) {
|
|
1935
|
+
try {
|
|
1936
|
+
var telemetryObject = JSON.parse(dataAttr);
|
|
2794
1937
|
}
|
|
2795
|
-
|
|
2796
|
-
|
|
1938
|
+
catch (e) {
|
|
1939
|
+
this._traceLogger.throwInternal(LoggingSeverity.CRITICAL, _ExtendedInternalMessageId.CannotParseAiBlobValue, "Can not parse " + dataAttr);
|
|
2797
1940
|
}
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
parentInfo["parentid"] = htmlContent.id;
|
|
2801
|
-
parentInfo["parentname"] = htmlContent.contentName;
|
|
1941
|
+
if (telemetryObject) {
|
|
1942
|
+
parentId = telemetryObject.id;
|
|
2802
1943
|
}
|
|
2803
|
-
return parentInfo;
|
|
2804
1944
|
}
|
|
2805
|
-
|
|
2806
|
-
|
|
1945
|
+
else {
|
|
1946
|
+
parentId = closestParentElement.getAttribute(dataTagPrefix + "id");
|
|
1947
|
+
}
|
|
1948
|
+
}
|
|
1949
|
+
if (parentId) {
|
|
1950
|
+
parentInfo["parentid"] = parentId;
|
|
1951
|
+
}
|
|
1952
|
+
else {
|
|
1953
|
+
var htmlContent = this._getHtmlIdAndContentName(element.parentElement);
|
|
1954
|
+
parentInfo["parentid"] = htmlContent.id;
|
|
1955
|
+
parentInfo["parentname"] = htmlContent.contentName;
|
|
1956
|
+
}
|
|
1957
|
+
return parentInfo;
|
|
1958
|
+
};
|
|
2807
1959
|
return DomContentHandler;
|
|
2808
1960
|
}());
|
|
2809
1961
|
|
|
2810
1962
|
var ClickAnalyticsPlugin = /** @class */ (function (_super) {
|
|
2811
1963
|
__extendsFn(ClickAnalyticsPlugin, _super);
|
|
2812
1964
|
function ClickAnalyticsPlugin() {
|
|
2813
|
-
var _this = _super.
|
|
1965
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
2814
1966
|
_this.identifier = "ClickAnalyticsPlugin";
|
|
2815
1967
|
_this.priority = 181;
|
|
2816
|
-
var _config;
|
|
2817
|
-
var _pageAction;
|
|
2818
|
-
var _autoCaptureHandler;
|
|
2819
|
-
var _contentHandler;
|
|
2820
|
-
dynamicProto(ClickAnalyticsPlugin, _this, function (_self, _base) {
|
|
2821
|
-
var _identifier = _self.identifier;
|
|
2822
|
-
_initDefaults();
|
|
2823
|
-
_self.initialize = function (config, core, extensions, pluginChain) {
|
|
2824
|
-
if (isNullOrUndefined(core)) {
|
|
2825
|
-
throwError("Error initializing");
|
|
2826
|
-
}
|
|
2827
|
-
config.extensionConfig = config.extensionConfig || [];
|
|
2828
|
-
config.extensionConfig[_identifier] = config.extensionConfig[_identifier] || {};
|
|
2829
|
-
_config = mergeConfig(config.extensionConfig[_identifier]);
|
|
2830
|
-
_super.prototype.initialize.call(_this, config, core, extensions, pluginChain);
|
|
2831
|
-
var logger = _self.diagLog();
|
|
2832
|
-
_contentHandler = _contentHandler ? _contentHandler : new DomContentHandler(_config, logger);
|
|
2833
|
-
var metaTags = _contentHandler.getMetadata();
|
|
2834
|
-
_pageAction = new PageAction(_this, _config, _contentHandler, _config.callback.pageActionPageTags, metaTags, logger);
|
|
2835
|
-
_autoCaptureHandler = _autoCaptureHandler ? _autoCaptureHandler : new AutoCaptureHandler(_self, _config, _pageAction, logger);
|
|
2836
|
-
if (_config.autoCapture) {
|
|
2837
|
-
_autoCaptureHandler.click();
|
|
2838
|
-
}
|
|
2839
|
-
var _propertiesExtension;
|
|
2840
|
-
arrForEach(extensions, function (extension) {
|
|
2841
|
-
if (extension.identifier === PropertiesPluginIdentifier) {
|
|
2842
|
-
_propertiesExtension = extension;
|
|
2843
|
-
}
|
|
2844
|
-
});
|
|
2845
|
-
if (_propertiesExtension && _propertiesExtension.context &&
|
|
2846
|
-
_propertiesExtension.context.internal && _propertiesExtension.context.internal.sdkVersion) {
|
|
2847
|
-
_propertiesExtension.context.internal.sdkVersion += "_ClickPlugin" + ClickAnalyticsPlugin.Version;
|
|
2848
|
-
}
|
|
2849
|
-
};
|
|
2850
|
-
_self.processTelemetry = function (env, itemCtx) {
|
|
2851
|
-
_self.processNext(env, itemCtx);
|
|
2852
|
-
};
|
|
2853
|
-
_self.trackPageAction = function (pageAction, customProperties) {
|
|
2854
|
-
try {
|
|
2855
|
-
_pageAction.trackPageAction(pageAction, customProperties);
|
|
2856
|
-
}
|
|
2857
|
-
catch (e) {
|
|
2858
|
-
_throwInternal(_self.diagLog(), LoggingSeverity.CRITICAL, _ExtendedInternalMessageId.TrackPageActionEventFailed, "trackPageAction failed, page action event will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
2859
|
-
}
|
|
2860
|
-
};
|
|
2861
|
-
_self._doTeardown = function (unloadCtx, unloadState, asyncCallback) {
|
|
2862
|
-
return unloadComponents([
|
|
2863
|
-
_autoCaptureHandler,
|
|
2864
|
-
_contentHandler,
|
|
2865
|
-
_pageAction
|
|
2866
|
-
], unloadCtx, unloadState);
|
|
2867
|
-
};
|
|
2868
|
-
});
|
|
2869
|
-
function _initDefaults() {
|
|
2870
|
-
_config = null;
|
|
2871
|
-
_pageAction = null;
|
|
2872
|
-
_autoCaptureHandler = null;
|
|
2873
|
-
_contentHandler = null;
|
|
2874
|
-
}
|
|
2875
1968
|
return _this;
|
|
2876
1969
|
}
|
|
2877
|
-
ClickAnalyticsPlugin.
|
|
1970
|
+
ClickAnalyticsPlugin.prototype.initialize = function (config, core, extensions, pluginChain) {
|
|
1971
|
+
if (isNullOrUndefined(core)) {
|
|
1972
|
+
throw Error("Error initializing");
|
|
1973
|
+
}
|
|
1974
|
+
config.extensionConfig = config.extensionConfig || [];
|
|
1975
|
+
config.extensionConfig[this.identifier] = config.extensionConfig[this.identifier] || {};
|
|
1976
|
+
this._config = mergeConfig(config.extensionConfig[this.identifier]);
|
|
1977
|
+
_super.prototype.initialize.call(this, config, core, extensions, pluginChain);
|
|
1978
|
+
this._contentHandler = this._contentHandler ? this._contentHandler : new DomContentHandler(this._config, this.diagLog());
|
|
1979
|
+
var metaTags = this._contentHandler.getMetadata();
|
|
1980
|
+
this.pageAction = new PageAction(this, this._config, this._contentHandler, this._config.callback.pageActionPageTags, metaTags, this.diagLog());
|
|
1981
|
+
this._autoCaptureHandler = this._autoCaptureHandler ? this._autoCaptureHandler : new AutoCaptureHandler(this, this._config, this.pageAction, this.diagLog());
|
|
1982
|
+
if (this._config.autoCapture) {
|
|
1983
|
+
this._autoCaptureHandler.click();
|
|
1984
|
+
}
|
|
1985
|
+
var _propertiesExtension;
|
|
1986
|
+
arrForEach(extensions, function (extension) {
|
|
1987
|
+
if (extension.identifier === PropertiesPluginIdentifier) {
|
|
1988
|
+
_propertiesExtension = extension;
|
|
1989
|
+
}
|
|
1990
|
+
});
|
|
1991
|
+
if (_propertiesExtension && _propertiesExtension.context &&
|
|
1992
|
+
_propertiesExtension.context.internal && _propertiesExtension.context.internal.sdkVersion) {
|
|
1993
|
+
_propertiesExtension.context.internal.sdkVersion += "_ClickPlugin" + ClickAnalyticsPlugin.Version;
|
|
1994
|
+
}
|
|
1995
|
+
};
|
|
1996
|
+
ClickAnalyticsPlugin.prototype.processTelemetry = function (env, itemCtx) {
|
|
1997
|
+
this.processNext(env, itemCtx);
|
|
1998
|
+
};
|
|
1999
|
+
ClickAnalyticsPlugin.prototype.trackPageAction = function (pageAction, customProperties) {
|
|
2000
|
+
try {
|
|
2001
|
+
this.pageAction.trackPageAction(pageAction, customProperties);
|
|
2002
|
+
}
|
|
2003
|
+
catch (e) {
|
|
2004
|
+
this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _ExtendedInternalMessageId.TrackPageActionEventFailed, "trackPageAction failed, page action event will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
2005
|
+
}
|
|
2006
|
+
};
|
|
2007
|
+
ClickAnalyticsPlugin.Version = "2.7.6";
|
|
2878
2008
|
return ClickAnalyticsPlugin;
|
|
2879
2009
|
}(BaseTelemetryPlugin));
|
|
2880
2010
|
|