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