@microsoft/1ds-post-js 3.2.2 → 3.2.3
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/README.md +1 -1
- package/bundle/{ms.post-3.2.2.gbl.js → ms.post-3.2.3.gbl.js} +732 -726
- package/bundle/ms.post-3.2.3.gbl.js.map +1 -0
- package/bundle/ms.post-3.2.3.gbl.min.js +7 -0
- package/bundle/ms.post-3.2.3.gbl.min.js.map +1 -0
- package/bundle/ms.post-3.2.3.integrity.json +46 -0
- package/bundle/{ms.post-3.2.2.js → ms.post-3.2.3.js} +732 -726
- package/bundle/ms.post-3.2.3.js.map +1 -0
- package/bundle/ms.post-3.2.3.min.js +7 -0
- package/bundle/ms.post-3.2.3.min.js.map +1 -0
- package/bundle/ms.post.gbl.js +731 -725
- package/bundle/ms.post.gbl.js.map +1 -1
- package/bundle/ms.post.gbl.min.js +2 -2
- package/bundle/ms.post.gbl.min.js.map +1 -1
- package/bundle/ms.post.integrity.json +17 -17
- package/bundle/ms.post.js +731 -725
- package/bundle/ms.post.js.map +1 -1
- package/bundle/ms.post.min.js +2 -2
- package/bundle/ms.post.min.js.map +1 -1
- package/dist/ms.post.js +18 -12
- package/dist/ms.post.js.map +1 -1
- package/dist/ms.post.min.js +2 -2
- package/dist/ms.post.min.js.map +1 -1
- package/dist-esm/src/BatchNotificationActions.js +1 -1
- package/dist-esm/src/ClockSkewManager.js +1 -1
- package/dist-esm/src/Constants.js +1 -1
- package/dist-esm/src/DataModels.js +1 -1
- package/dist-esm/src/EventBatch.js +1 -1
- package/dist-esm/src/HttpManager.js +63 -63
- package/dist-esm/src/HttpManager.js.map +1 -1
- package/dist-esm/src/Index.js +1 -1
- package/dist-esm/src/KillSwitch.js +1 -1
- package/dist-esm/src/PostChannel.js +65 -57
- package/dist-esm/src/PostChannel.js.map +1 -1
- package/dist-esm/src/RetryPolicy.js +1 -1
- package/dist-esm/src/Serializer.js +1 -1
- package/dist-esm/src/TimeoutOverrideWrapper.js +1 -1
- package/dist-esm/src/typings/XDomainRequest.js +1 -1
- package/package.json +2 -2
- package/src/PostChannel.ts +29 -16
- package/bundle/ms.post-3.2.2.gbl.js.map +0 -1
- package/bundle/ms.post-3.2.2.gbl.min.js +0 -7
- package/bundle/ms.post-3.2.2.gbl.min.js.map +0 -1
- package/bundle/ms.post-3.2.2.integrity.json +0 -46
- package/bundle/ms.post-3.2.2.js.map +0 -1
- package/bundle/ms.post-3.2.2.min.js +0 -7
- package/bundle/ms.post-3.2.2.min.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* 1DS JS SDK POST plugin, 3.2.
|
|
2
|
+
* 1DS JS SDK POST plugin, 3.2.3
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
* (Microsoft Internal Only)
|
|
5
5
|
*/
|
|
@@ -1214,7 +1214,7 @@
|
|
|
1214
1214
|
}
|
|
1215
1215
|
|
|
1216
1216
|
var _objDefineProperty = ObjDefineProperty;
|
|
1217
|
-
var version = "2.8.
|
|
1217
|
+
var version = "2.8.4";
|
|
1218
1218
|
var instanceName = "." + newId(6);
|
|
1219
1219
|
var _dataUid = 0;
|
|
1220
1220
|
function _createAccessor(target, prop, value) {
|
|
@@ -1285,822 +1285,822 @@
|
|
|
1285
1285
|
return data;
|
|
1286
1286
|
}
|
|
1287
1287
|
|
|
1288
|
-
var
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
var
|
|
1294
|
-
var
|
|
1295
|
-
var
|
|
1296
|
-
var
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1288
|
+
var strOnPrefix = "on";
|
|
1289
|
+
var strAttachEvent = "attachEvent";
|
|
1290
|
+
var strAddEventHelper = "addEventListener";
|
|
1291
|
+
var strDetachEvent = "detachEvent";
|
|
1292
|
+
var strRemoveEventListener = "removeEventListener";
|
|
1293
|
+
var strEvents = "events";
|
|
1294
|
+
var strVisibilityChangeEvt = "visibilitychange";
|
|
1295
|
+
var strPageHide = "pagehide";
|
|
1296
|
+
var strPageShow = "pageshow";
|
|
1297
|
+
var strUnload = "unload";
|
|
1298
|
+
var strBeforeUnload = "beforeunload";
|
|
1299
|
+
var strPageHideNamespace = createUniqueNamespace("aiEvtPageHide");
|
|
1300
|
+
var strPageShowNamespace = createUniqueNamespace("aiEvtPageShow");
|
|
1301
|
+
var rRemoveEmptyNs = /\.[\.]+/g;
|
|
1302
|
+
var rRemoveTrailingEmptyNs = /[\.]+$/;
|
|
1303
|
+
var _guid = 1;
|
|
1304
|
+
var elmNodeData = createElmNodeData("events");
|
|
1305
|
+
var eventNamespace = /^([^.]*)(?:\.(.+)|)/;
|
|
1306
|
+
function _normalizeNamespace(name) {
|
|
1307
|
+
if (name && name.replace) {
|
|
1308
|
+
return name.replace(/^\s*\.*|\.*\s*$/g, "");
|
|
1303
1309
|
}
|
|
1304
|
-
return
|
|
1310
|
+
return name;
|
|
1305
1311
|
}
|
|
1306
|
-
function
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
return safeGetLogger(core, config);
|
|
1320
|
-
},
|
|
1321
|
-
getCfg: function () {
|
|
1322
|
-
return config;
|
|
1323
|
-
},
|
|
1324
|
-
getExtCfg: _getExtCfg,
|
|
1325
|
-
getConfig: _getConfig,
|
|
1326
|
-
hasNext: function () {
|
|
1327
|
-
return !!_nextProxy;
|
|
1328
|
-
},
|
|
1329
|
-
getNext: function () {
|
|
1330
|
-
return _nextProxy;
|
|
1331
|
-
},
|
|
1332
|
-
setNext: function (nextPlugin) {
|
|
1333
|
-
_nextProxy = nextPlugin;
|
|
1334
|
-
},
|
|
1335
|
-
iterate: _iterateChain,
|
|
1336
|
-
onComplete: _addOnComplete
|
|
1337
|
-
}
|
|
1338
|
-
};
|
|
1339
|
-
function _addOnComplete(onComplete, that) {
|
|
1340
|
-
var args = [];
|
|
1341
|
-
for (var _i = 2; _i < arguments.length; _i++) {
|
|
1342
|
-
args[_i - 2] = arguments[_i];
|
|
1343
|
-
}
|
|
1344
|
-
if (onComplete) {
|
|
1345
|
-
_onComplete.push({
|
|
1346
|
-
func: onComplete,
|
|
1347
|
-
self: !isUndefined(that) ? that : context.ctx,
|
|
1348
|
-
args: args
|
|
1312
|
+
function _getEvtNamespace(eventName, evtNamespace) {
|
|
1313
|
+
if (evtNamespace) {
|
|
1314
|
+
var theNamespace_1 = "";
|
|
1315
|
+
if (isArray(evtNamespace)) {
|
|
1316
|
+
theNamespace_1 = "";
|
|
1317
|
+
arrForEach(evtNamespace, function (name) {
|
|
1318
|
+
name = _normalizeNamespace(name);
|
|
1319
|
+
if (name) {
|
|
1320
|
+
if (name[0] !== ".") {
|
|
1321
|
+
name = "." + name;
|
|
1322
|
+
}
|
|
1323
|
+
theNamespace_1 += name;
|
|
1324
|
+
}
|
|
1349
1325
|
});
|
|
1350
1326
|
}
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
var nextProxy = _nextProxy;
|
|
1354
|
-
_nextProxy = nextProxy ? nextProxy.getNext() : null;
|
|
1355
|
-
if (!nextProxy) {
|
|
1356
|
-
var onComplete = _onComplete;
|
|
1357
|
-
if (onComplete && onComplete.length > 0) {
|
|
1358
|
-
arrForEach(onComplete, function (completeDetails) {
|
|
1359
|
-
try {
|
|
1360
|
-
completeDetails.func.call(completeDetails.self, completeDetails.args);
|
|
1361
|
-
}
|
|
1362
|
-
catch (e) {
|
|
1363
|
-
_throwInternal(core.logger, 2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
|
|
1364
|
-
}
|
|
1365
|
-
});
|
|
1366
|
-
_onComplete = [];
|
|
1367
|
-
}
|
|
1327
|
+
else {
|
|
1328
|
+
theNamespace_1 = _normalizeNamespace(evtNamespace);
|
|
1368
1329
|
}
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
if (defaultValue === void 0) { defaultValue = {}; }
|
|
1373
|
-
if (mergeDefault === void 0) { mergeDefault = 0 ; }
|
|
1374
|
-
var theConfig;
|
|
1375
|
-
if (config) {
|
|
1376
|
-
var extConfig = config.extensionConfig;
|
|
1377
|
-
if (extConfig && identifier) {
|
|
1378
|
-
theConfig = extConfig[identifier];
|
|
1330
|
+
if (theNamespace_1) {
|
|
1331
|
+
if (theNamespace_1[0] !== ".") {
|
|
1332
|
+
theNamespace_1 = "." + theNamespace_1;
|
|
1379
1333
|
}
|
|
1334
|
+
eventName = (eventName || "") + theNamespace_1;
|
|
1380
1335
|
}
|
|
1381
|
-
|
|
1382
|
-
|
|
1336
|
+
}
|
|
1337
|
+
var parsedEvent = (eventNamespace.exec(eventName || "") || []);
|
|
1338
|
+
return {
|
|
1339
|
+
type: parsedEvent[1],
|
|
1340
|
+
ns: ((parsedEvent[2] || "").replace(rRemoveEmptyNs, ".").replace(rRemoveTrailingEmptyNs, "").split(".").sort()).join(".")
|
|
1341
|
+
};
|
|
1342
|
+
}
|
|
1343
|
+
function _getRegisteredEvents(target, evtName, addDefault) {
|
|
1344
|
+
if (addDefault === void 0) { addDefault = true; }
|
|
1345
|
+
var aiEvts = elmNodeData.get(target, strEvents, {}, addDefault);
|
|
1346
|
+
var registeredEvents = aiEvts[evtName];
|
|
1347
|
+
if (!registeredEvents) {
|
|
1348
|
+
registeredEvents = aiEvts[evtName] = [];
|
|
1349
|
+
}
|
|
1350
|
+
return registeredEvents;
|
|
1351
|
+
}
|
|
1352
|
+
function _doDetach(obj, evtName, handlerRef, useCapture) {
|
|
1353
|
+
if (obj && evtName && evtName.type) {
|
|
1354
|
+
if (obj[strRemoveEventListener]) {
|
|
1355
|
+
obj[strRemoveEventListener](evtName.type, handlerRef, useCapture);
|
|
1383
1356
|
}
|
|
1384
|
-
else if (
|
|
1385
|
-
|
|
1386
|
-
var newConfig_1 = objExtend(true, defaultValue, theConfig);
|
|
1387
|
-
if (config && mergeDefault === 2 ) {
|
|
1388
|
-
objForEachKey(defaultValue, function (field) {
|
|
1389
|
-
if (isNullOrUndefined(newConfig_1[field])) {
|
|
1390
|
-
var cfgValue = config[field];
|
|
1391
|
-
if (!isNullOrUndefined(cfgValue)) {
|
|
1392
|
-
newConfig_1[field] = cfgValue;
|
|
1393
|
-
}
|
|
1394
|
-
}
|
|
1395
|
-
});
|
|
1396
|
-
}
|
|
1397
|
-
theConfig = newConfig_1;
|
|
1398
|
-
}
|
|
1357
|
+
else if (obj[strDetachEvent]) {
|
|
1358
|
+
obj[strDetachEvent](strOnPrefix + evtName.type, handlerRef);
|
|
1399
1359
|
}
|
|
1400
|
-
return theConfig;
|
|
1401
1360
|
}
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
if (
|
|
1407
|
-
|
|
1361
|
+
}
|
|
1362
|
+
function _doAttach(obj, evtName, handlerRef, useCapture) {
|
|
1363
|
+
var result = false;
|
|
1364
|
+
if (obj && evtName && evtName.type && handlerRef) {
|
|
1365
|
+
if (obj[strAddEventHelper]) {
|
|
1366
|
+
obj[strAddEventHelper](evtName.type, handlerRef, useCapture);
|
|
1367
|
+
result = true;
|
|
1408
1368
|
}
|
|
1409
|
-
else if (
|
|
1410
|
-
|
|
1369
|
+
else if (obj[strAttachEvent]) {
|
|
1370
|
+
obj[strAttachEvent](strOnPrefix + evtName.type, handlerRef);
|
|
1371
|
+
result = true;
|
|
1411
1372
|
}
|
|
1412
|
-
return !isNullOrUndefined(theValue) ? theValue : defaultValue;
|
|
1413
1373
|
}
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1374
|
+
return result;
|
|
1375
|
+
}
|
|
1376
|
+
function _doUnregister(target, events, evtName, unRegFn) {
|
|
1377
|
+
var idx = events.length;
|
|
1378
|
+
while (idx--) {
|
|
1379
|
+
var theEvent = events[idx];
|
|
1380
|
+
if (theEvent) {
|
|
1381
|
+
if (!evtName.ns || evtName.ns === theEvent.evtName.ns) {
|
|
1382
|
+
if (!unRegFn || unRegFn(theEvent)) {
|
|
1383
|
+
_doDetach(target, theEvent.evtName, theEvent.handler, theEvent.capture);
|
|
1384
|
+
events.splice(idx, 1);
|
|
1385
|
+
}
|
|
1420
1386
|
}
|
|
1421
1387
|
}
|
|
1422
1388
|
}
|
|
1423
|
-
return context;
|
|
1424
1389
|
}
|
|
1425
|
-
function
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
function _processNext(env) {
|
|
1429
|
-
var nextPlugin = internalContext._next();
|
|
1430
|
-
nextPlugin && nextPlugin.processTelemetry(env, context);
|
|
1431
|
-
return !nextPlugin;
|
|
1390
|
+
function _unregisterEvents(target, evtName, unRegFn) {
|
|
1391
|
+
if (evtName.type) {
|
|
1392
|
+
_doUnregister(target, _getRegisteredEvents(target, evtName.type), evtName, unRegFn);
|
|
1432
1393
|
}
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1394
|
+
else {
|
|
1395
|
+
var eventCache = elmNodeData.get(target, strEvents, {});
|
|
1396
|
+
objForEachKey(eventCache, function (evtType, events) {
|
|
1397
|
+
_doUnregister(target, events, evtName, unRegFn);
|
|
1398
|
+
});
|
|
1399
|
+
if (objKeys(eventCache).length === 0) {
|
|
1400
|
+
elmNodeData.kill(target, strEvents);
|
|
1437
1401
|
}
|
|
1438
|
-
return createProcessTelemetryContext(plugins || context.getNext(), config, core, startAt);
|
|
1439
1402
|
}
|
|
1440
|
-
context.processNext = _processNext;
|
|
1441
|
-
context.createNew = _createNew;
|
|
1442
|
-
return context;
|
|
1443
1403
|
}
|
|
1444
|
-
function
|
|
1445
|
-
var
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
var nextPlugin = internalContext._next();
|
|
1450
|
-
nextPlugin && nextPlugin.unload(context, unloadState);
|
|
1451
|
-
return !nextPlugin;
|
|
1452
|
-
}
|
|
1453
|
-
function _createNew(plugins, startAt) {
|
|
1454
|
-
if (plugins === void 0) { plugins = null; }
|
|
1455
|
-
if (isArray(plugins)) {
|
|
1456
|
-
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1404
|
+
function mergeEvtNamespace(theNamespace, namespaces) {
|
|
1405
|
+
var newNamespaces;
|
|
1406
|
+
if (namespaces) {
|
|
1407
|
+
if (isArray(namespaces)) {
|
|
1408
|
+
newNamespaces = [theNamespace].concat(namespaces);
|
|
1457
1409
|
}
|
|
1458
|
-
|
|
1410
|
+
else {
|
|
1411
|
+
newNamespaces = [theNamespace, namespaces];
|
|
1412
|
+
}
|
|
1413
|
+
newNamespaces = (_getEvtNamespace("xx", newNamespaces).ns).split(".");
|
|
1459
1414
|
}
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
return context;
|
|
1463
|
-
}
|
|
1464
|
-
function createProcessTelemetryUpdateContext(telemetryChain, core, startAt) {
|
|
1465
|
-
var config = core.config || {};
|
|
1466
|
-
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1467
|
-
var context = internalContext.ctx;
|
|
1468
|
-
function _processNext(updateState) {
|
|
1469
|
-
return context.iterate(function (plugin) {
|
|
1470
|
-
if (isFunction(plugin.update)) {
|
|
1471
|
-
plugin.update(context, updateState);
|
|
1472
|
-
}
|
|
1473
|
-
});
|
|
1474
|
-
}
|
|
1475
|
-
function _createNew(plugins, startAt) {
|
|
1476
|
-
if (plugins === void 0) { plugins = null; }
|
|
1477
|
-
if (isArray(plugins)) {
|
|
1478
|
-
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1479
|
-
}
|
|
1480
|
-
return createProcessTelemetryUpdateContext(plugins || context.getNext(), core, startAt);
|
|
1415
|
+
else {
|
|
1416
|
+
newNamespaces = theNamespace;
|
|
1481
1417
|
}
|
|
1482
|
-
|
|
1483
|
-
context.createNew = _createNew;
|
|
1484
|
-
return context;
|
|
1418
|
+
return newNamespaces;
|
|
1485
1419
|
}
|
|
1486
|
-
function
|
|
1487
|
-
|
|
1488
|
-
var
|
|
1489
|
-
if (
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
}
|
|
1500
|
-
|
|
1501
|
-
lastProxy_1._setNext(newProxy);
|
|
1502
|
-
}
|
|
1503
|
-
lastProxy_1 = newProxy;
|
|
1420
|
+
function eventOn(target, eventName, handlerRef, evtNamespace, useCapture) {
|
|
1421
|
+
if (useCapture === void 0) { useCapture = false; }
|
|
1422
|
+
var result = false;
|
|
1423
|
+
if (target) {
|
|
1424
|
+
try {
|
|
1425
|
+
var evtName = _getEvtNamespace(eventName, evtNamespace);
|
|
1426
|
+
result = _doAttach(target, evtName, handlerRef, useCapture);
|
|
1427
|
+
if (result && elmNodeData.accept(target)) {
|
|
1428
|
+
var registeredEvent = {
|
|
1429
|
+
guid: _guid++,
|
|
1430
|
+
evtName: evtName,
|
|
1431
|
+
handler: handlerRef,
|
|
1432
|
+
capture: useCapture
|
|
1433
|
+
};
|
|
1434
|
+
_getRegisteredEvents(target, evtName.type).push(registeredEvent);
|
|
1504
1435
|
}
|
|
1505
|
-
});
|
|
1506
|
-
}
|
|
1507
|
-
if (startAt && !firstProxy) {
|
|
1508
|
-
return createTelemetryProxyChain([startAt], config, core);
|
|
1509
|
-
}
|
|
1510
|
-
return firstProxy;
|
|
1511
|
-
}
|
|
1512
|
-
function createTelemetryPluginProxy(plugin, config, core) {
|
|
1513
|
-
var nextProxy = null;
|
|
1514
|
-
var hasProcessTelemetry = isFunction(plugin.processTelemetry);
|
|
1515
|
-
var hasSetNext = isFunction(plugin.setNextPlugin);
|
|
1516
|
-
var chainId;
|
|
1517
|
-
if (plugin) {
|
|
1518
|
-
chainId = plugin.identifier + "-" + plugin.priority + "-" + _chainId++;
|
|
1519
|
-
}
|
|
1520
|
-
else {
|
|
1521
|
-
chainId = "Unknown-0-" + _chainId++;
|
|
1522
|
-
}
|
|
1523
|
-
var proxyChain = {
|
|
1524
|
-
getPlugin: function () {
|
|
1525
|
-
return plugin;
|
|
1526
|
-
},
|
|
1527
|
-
getNext: function () {
|
|
1528
|
-
return nextProxy;
|
|
1529
|
-
},
|
|
1530
|
-
processTelemetry: _processTelemetry,
|
|
1531
|
-
unload: _unloadPlugin,
|
|
1532
|
-
update: _updatePlugin,
|
|
1533
|
-
_id: chainId,
|
|
1534
|
-
_setNext: function (nextPlugin) {
|
|
1535
|
-
nextProxy = nextPlugin;
|
|
1536
1436
|
}
|
|
1537
|
-
|
|
1538
|
-
function _getTelCtx() {
|
|
1539
|
-
var itemCtx;
|
|
1540
|
-
if (plugin && isFunction(plugin[strGetTelCtx])) {
|
|
1541
|
-
itemCtx = plugin[strGetTelCtx]();
|
|
1542
|
-
}
|
|
1543
|
-
if (!itemCtx) {
|
|
1544
|
-
itemCtx = createProcessTelemetryContext(proxyChain, config, core);
|
|
1437
|
+
catch (e) {
|
|
1545
1438
|
}
|
|
1546
|
-
return itemCtx;
|
|
1547
1439
|
}
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
var nextId = nextProxy ? nextProxy._id : strEmpty;
|
|
1561
|
-
if (nextId) {
|
|
1562
|
-
hasRunContext[nextId] = false;
|
|
1563
|
-
}
|
|
1564
|
-
hasRun = processPluginFn(itemCtx);
|
|
1565
|
-
}
|
|
1566
|
-
catch (error) {
|
|
1567
|
-
var hasNextRun = nextProxy ? hasRunContext[nextProxy._id] : true;
|
|
1568
|
-
if (hasNextRun) {
|
|
1569
|
-
hasRun = true;
|
|
1570
|
-
}
|
|
1571
|
-
if (!nextProxy || !hasNextRun) {
|
|
1572
|
-
_throwInternal(itemCtx.diagLog(), 1 , 73 , "Plugin [" + identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
|
|
1573
|
-
}
|
|
1440
|
+
return result;
|
|
1441
|
+
}
|
|
1442
|
+
function eventOff(target, eventName, handlerRef, evtNamespace, useCapture) {
|
|
1443
|
+
if (useCapture === void 0) { useCapture = false; }
|
|
1444
|
+
if (target) {
|
|
1445
|
+
try {
|
|
1446
|
+
var evtName_1 = _getEvtNamespace(eventName, evtNamespace);
|
|
1447
|
+
var found_1 = false;
|
|
1448
|
+
_unregisterEvents(target, evtName_1, function (regEvent) {
|
|
1449
|
+
if ((evtName_1.ns && !handlerRef) || regEvent.handler === handlerRef) {
|
|
1450
|
+
found_1 = true;
|
|
1451
|
+
return true;
|
|
1574
1452
|
}
|
|
1575
|
-
}, details, isAsync);
|
|
1576
|
-
}
|
|
1577
|
-
return hasRun;
|
|
1578
|
-
}
|
|
1579
|
-
function _processTelemetry(env, itemCtx) {
|
|
1580
|
-
itemCtx = itemCtx || _getTelCtx();
|
|
1581
|
-
function _callProcessTelemetry(itemCtx) {
|
|
1582
|
-
if (!plugin || !hasProcessTelemetry) {
|
|
1583
1453
|
return false;
|
|
1454
|
+
});
|
|
1455
|
+
if (!found_1) {
|
|
1456
|
+
_doDetach(target, evtName_1, handlerRef, useCapture);
|
|
1584
1457
|
}
|
|
1585
|
-
var pluginState = _getPluginState(plugin);
|
|
1586
|
-
if (pluginState.teardown || pluginState[strDisabled]) {
|
|
1587
|
-
return false;
|
|
1588
|
-
}
|
|
1589
|
-
if (hasSetNext) {
|
|
1590
|
-
plugin.setNextPlugin(nextProxy);
|
|
1591
|
-
}
|
|
1592
|
-
plugin.processTelemetry(env, itemCtx);
|
|
1593
|
-
return true;
|
|
1594
1458
|
}
|
|
1595
|
-
|
|
1596
|
-
itemCtx.processNext(env);
|
|
1459
|
+
catch (e) {
|
|
1597
1460
|
}
|
|
1598
1461
|
}
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
pluginState[strCore] = null;
|
|
1607
|
-
pluginState[strTeardown] = true;
|
|
1608
|
-
pluginState[strIsInitialized] = false;
|
|
1609
|
-
if (plugin[strTeardown] && plugin[strTeardown](unloadCtx, unloadState) === true) {
|
|
1610
|
-
hasRun = true;
|
|
1611
|
-
}
|
|
1612
|
-
}
|
|
1613
|
-
}
|
|
1614
|
-
return hasRun;
|
|
1615
|
-
}
|
|
1616
|
-
if (!_processChain(unloadCtx, _callTeardown, "unload", function () { }, unloadState.isAsync)) {
|
|
1617
|
-
unloadCtx.processNext(unloadState);
|
|
1618
|
-
}
|
|
1462
|
+
}
|
|
1463
|
+
function addEventHandler(eventName, callback, evtNamespace) {
|
|
1464
|
+
var result = false;
|
|
1465
|
+
var w = getWindow();
|
|
1466
|
+
if (w) {
|
|
1467
|
+
result = eventOn(w, eventName, callback, evtNamespace);
|
|
1468
|
+
result = eventOn(w["body"], eventName, callback, evtNamespace) || result;
|
|
1619
1469
|
}
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1470
|
+
var doc = getDocument();
|
|
1471
|
+
if (doc) {
|
|
1472
|
+
result = eventOn(doc, eventName, callback, evtNamespace) || result;
|
|
1473
|
+
}
|
|
1474
|
+
return result;
|
|
1475
|
+
}
|
|
1476
|
+
function removeEventHandler(eventName, callback, evtNamespace) {
|
|
1477
|
+
var w = getWindow();
|
|
1478
|
+
if (w) {
|
|
1479
|
+
eventOff(w, eventName, callback, evtNamespace);
|
|
1480
|
+
eventOff(w["body"], eventName, callback, evtNamespace);
|
|
1481
|
+
}
|
|
1482
|
+
var doc = getDocument();
|
|
1483
|
+
if (doc) {
|
|
1484
|
+
eventOff(doc, eventName, callback, evtNamespace);
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
function _addEventListeners(events, listener, excludeEvents, evtNamespace) {
|
|
1488
|
+
var added = false;
|
|
1489
|
+
if (listener && events && events.length > 0) {
|
|
1490
|
+
arrForEach(events, function (name) {
|
|
1491
|
+
if (name) {
|
|
1492
|
+
if (!excludeEvents || arrIndexOf(excludeEvents, name) === -1) {
|
|
1493
|
+
added = addEventHandler(name, listener, evtNamespace) || added;
|
|
1630
1494
|
}
|
|
1631
1495
|
}
|
|
1632
|
-
|
|
1633
|
-
}
|
|
1634
|
-
if (!_processChain(updateCtx, _callUpdate, "update", function () { }, false)) {
|
|
1635
|
-
updateCtx.processNext(updateState);
|
|
1636
|
-
}
|
|
1496
|
+
});
|
|
1637
1497
|
}
|
|
1638
|
-
return
|
|
1498
|
+
return added;
|
|
1639
1499
|
}
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
if (handler) {
|
|
1647
|
-
handlers.push(handler);
|
|
1500
|
+
function addEventListeners(events, listener, excludeEvents, evtNamespace) {
|
|
1501
|
+
var added = false;
|
|
1502
|
+
if (listener && events && isArray(events)) {
|
|
1503
|
+
added = _addEventListeners(events, listener, excludeEvents, evtNamespace);
|
|
1504
|
+
if (!added && excludeEvents && excludeEvents.length > 0) {
|
|
1505
|
+
added = _addEventListeners(events, listener, null, evtNamespace);
|
|
1648
1506
|
}
|
|
1649
1507
|
}
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1508
|
+
return added;
|
|
1509
|
+
}
|
|
1510
|
+
function removeEventListeners(events, listener, evtNamespace) {
|
|
1511
|
+
if (events && isArray(events)) {
|
|
1512
|
+
arrForEach(events, function (name) {
|
|
1513
|
+
if (name) {
|
|
1514
|
+
removeEventHandler(name, listener, evtNamespace);
|
|
1657
1515
|
}
|
|
1658
1516
|
});
|
|
1659
|
-
handlers = [];
|
|
1660
1517
|
}
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1518
|
+
}
|
|
1519
|
+
function addPageUnloadEventListener(listener, excludeEvents, evtNamespace) {
|
|
1520
|
+
return addEventListeners([strBeforeUnload, strUnload, strPageHide], listener, excludeEvents, evtNamespace);
|
|
1521
|
+
}
|
|
1522
|
+
function removePageUnloadEventListener(listener, evtNamespace) {
|
|
1523
|
+
removeEventListeners([strBeforeUnload, strUnload, strPageHide], listener, evtNamespace);
|
|
1524
|
+
}
|
|
1525
|
+
function addPageHideEventListener(listener, excludeEvents, evtNamespace) {
|
|
1526
|
+
function _handlePageVisibility(evt) {
|
|
1527
|
+
var doc = getDocument();
|
|
1528
|
+
if (listener && doc && doc.visibilityState === "hidden") {
|
|
1529
|
+
listener(evt);
|
|
1530
|
+
}
|
|
1531
|
+
}
|
|
1532
|
+
var newNamespaces = mergeEvtNamespace(strPageHideNamespace, evtNamespace);
|
|
1533
|
+
var pageUnloadAdded = _addEventListeners([strPageHide], listener, excludeEvents, newNamespaces);
|
|
1534
|
+
if (!excludeEvents || arrIndexOf(excludeEvents, strVisibilityChangeEvt) === -1) {
|
|
1535
|
+
pageUnloadAdded = _addEventListeners([strVisibilityChangeEvt], _handlePageVisibility, excludeEvents, newNamespaces) || pageUnloadAdded;
|
|
1536
|
+
}
|
|
1537
|
+
if (!pageUnloadAdded && excludeEvents) {
|
|
1538
|
+
pageUnloadAdded = addPageHideEventListener(listener, null, evtNamespace);
|
|
1539
|
+
}
|
|
1540
|
+
return pageUnloadAdded;
|
|
1541
|
+
}
|
|
1542
|
+
function removePageHideEventListener(listener, evtNamespace) {
|
|
1543
|
+
var newNamespaces = mergeEvtNamespace(strPageHideNamespace, evtNamespace);
|
|
1544
|
+
removeEventListeners([strPageHide], listener, newNamespaces);
|
|
1545
|
+
removeEventListeners([strVisibilityChangeEvt], null, newNamespaces);
|
|
1546
|
+
}
|
|
1547
|
+
function addPageShowEventListener(listener, excludeEvents, evtNamespace) {
|
|
1548
|
+
function _handlePageVisibility(evt) {
|
|
1549
|
+
var doc = getDocument();
|
|
1550
|
+
if (listener && doc && doc.visibilityState === "visible") {
|
|
1551
|
+
listener(evt);
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
var newNamespaces = mergeEvtNamespace(strPageShowNamespace, evtNamespace);
|
|
1555
|
+
var pageShowAdded = _addEventListeners([strPageShow], listener, excludeEvents, newNamespaces);
|
|
1556
|
+
pageShowAdded = _addEventListeners([strVisibilityChangeEvt], _handlePageVisibility, excludeEvents, newNamespaces) || pageShowAdded;
|
|
1557
|
+
if (!pageShowAdded && excludeEvents) {
|
|
1558
|
+
pageShowAdded = addPageShowEventListener(listener, null, evtNamespace);
|
|
1559
|
+
}
|
|
1560
|
+
return pageShowAdded;
|
|
1561
|
+
}
|
|
1562
|
+
function removePageShowEventListener(listener, evtNamespace) {
|
|
1563
|
+
var newNamespaces = mergeEvtNamespace(strPageShowNamespace, evtNamespace);
|
|
1564
|
+
removeEventListeners([strPageShow], listener, newNamespaces);
|
|
1565
|
+
removeEventListeners([strVisibilityChangeEvt], null, newNamespaces);
|
|
1665
1566
|
}
|
|
1666
1567
|
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
return
|
|
1715
|
-
}
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1568
|
+
function perfNow() {
|
|
1569
|
+
var perf = getPerformance();
|
|
1570
|
+
if (perf && perf.now) {
|
|
1571
|
+
return perf.now();
|
|
1572
|
+
}
|
|
1573
|
+
return dateNow();
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
var pluginStateData = createElmNodeData("plugin");
|
|
1577
|
+
function _getPluginState(plugin) {
|
|
1578
|
+
return pluginStateData.get(plugin, "state", {}, true);
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1581
|
+
var strTelemetryPluginChain = "TelemetryPluginChain";
|
|
1582
|
+
var strHasRunFlags = "_hasRun";
|
|
1583
|
+
var strGetTelCtx = "_getTelCtx";
|
|
1584
|
+
var _chainId = 0;
|
|
1585
|
+
function _getNextProxyStart(proxy, core, startAt) {
|
|
1586
|
+
while (proxy) {
|
|
1587
|
+
if (proxy.getPlugin() === startAt) {
|
|
1588
|
+
return proxy;
|
|
1589
|
+
}
|
|
1590
|
+
proxy = proxy.getNext();
|
|
1591
|
+
}
|
|
1592
|
+
return createTelemetryProxyChain([startAt], core.config || {}, core);
|
|
1593
|
+
}
|
|
1594
|
+
function _createInternalContext(telemetryChain, config, core, startAt) {
|
|
1595
|
+
var _nextProxy = null;
|
|
1596
|
+
var _onComplete = [];
|
|
1597
|
+
if (startAt !== null) {
|
|
1598
|
+
_nextProxy = startAt ? _getNextProxyStart(telemetryChain, core, startAt) : telemetryChain;
|
|
1599
|
+
}
|
|
1600
|
+
var context = {
|
|
1601
|
+
_next: _moveNext,
|
|
1602
|
+
ctx: {
|
|
1603
|
+
core: function () {
|
|
1604
|
+
return core;
|
|
1605
|
+
},
|
|
1606
|
+
diagLog: function () {
|
|
1607
|
+
return safeGetLogger(core, config);
|
|
1608
|
+
},
|
|
1609
|
+
getCfg: function () {
|
|
1610
|
+
return config;
|
|
1611
|
+
},
|
|
1612
|
+
getExtCfg: _getExtCfg,
|
|
1613
|
+
getConfig: _getConfig,
|
|
1614
|
+
hasNext: function () {
|
|
1615
|
+
return !!_nextProxy;
|
|
1616
|
+
},
|
|
1617
|
+
getNext: function () {
|
|
1618
|
+
return _nextProxy;
|
|
1619
|
+
},
|
|
1620
|
+
setNext: function (nextPlugin) {
|
|
1621
|
+
_nextProxy = nextPlugin;
|
|
1622
|
+
},
|
|
1623
|
+
iterate: _iterateChain,
|
|
1624
|
+
onComplete: _addOnComplete
|
|
1625
|
+
}
|
|
1626
|
+
};
|
|
1627
|
+
function _addOnComplete(onComplete, that) {
|
|
1628
|
+
var args = [];
|
|
1629
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
1630
|
+
args[_i - 2] = arguments[_i];
|
|
1631
|
+
}
|
|
1632
|
+
if (onComplete) {
|
|
1633
|
+
_onComplete.push({
|
|
1634
|
+
func: onComplete,
|
|
1635
|
+
self: !isUndefined(that) ? that : context.ctx,
|
|
1636
|
+
args: args
|
|
1637
|
+
});
|
|
1638
|
+
}
|
|
1639
|
+
}
|
|
1640
|
+
function _moveNext() {
|
|
1641
|
+
var nextProxy = _nextProxy;
|
|
1642
|
+
_nextProxy = nextProxy ? nextProxy.getNext() : null;
|
|
1643
|
+
if (!nextProxy) {
|
|
1644
|
+
var onComplete = _onComplete;
|
|
1645
|
+
if (onComplete && onComplete.length > 0) {
|
|
1646
|
+
arrForEach(onComplete, function (completeDetails) {
|
|
1647
|
+
try {
|
|
1648
|
+
completeDetails.func.call(completeDetails.self, completeDetails.args);
|
|
1745
1649
|
}
|
|
1746
|
-
|
|
1747
|
-
|
|
1650
|
+
catch (e) {
|
|
1651
|
+
_throwInternal(core.logger, 2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
|
|
1748
1652
|
}
|
|
1749
|
-
}
|
|
1750
|
-
|
|
1751
|
-
proxyFunctionAs(_self, "_addUnloadCb", function () { return _unloadHandlerContainer; }, "add");
|
|
1752
|
-
});
|
|
1753
|
-
_self.diagLog = function (itemCtx) {
|
|
1754
|
-
return _getTelCtx(itemCtx).diagLog();
|
|
1755
|
-
};
|
|
1756
|
-
_self[strIsInitialized] = function () {
|
|
1757
|
-
return _isinitialized;
|
|
1758
|
-
};
|
|
1759
|
-
_self.setInitialized = function (isInitialized) {
|
|
1760
|
-
_isinitialized = isInitialized;
|
|
1761
|
-
};
|
|
1762
|
-
_self[strSetNextPlugin] = function (next) {
|
|
1763
|
-
_nextPlugin = next;
|
|
1764
|
-
};
|
|
1765
|
-
_self.processNext = function (env, itemCtx) {
|
|
1766
|
-
if (itemCtx) {
|
|
1767
|
-
itemCtx.processNext(env);
|
|
1768
|
-
}
|
|
1769
|
-
else if (_nextPlugin && isFunction(_nextPlugin.processTelemetry)) {
|
|
1770
|
-
_nextPlugin.processTelemetry(env, null);
|
|
1771
|
-
}
|
|
1772
|
-
};
|
|
1773
|
-
_self._getTelCtx = _getTelCtx;
|
|
1774
|
-
function _getTelCtx(currentCtx) {
|
|
1775
|
-
if (currentCtx === void 0) { currentCtx = null; }
|
|
1776
|
-
var itemCtx = currentCtx;
|
|
1777
|
-
if (!itemCtx) {
|
|
1778
|
-
var rootCtx = _rootCtx || createProcessTelemetryContext(null, {}, _self.core);
|
|
1779
|
-
if (_nextPlugin && _nextPlugin[strGetPlugin]) {
|
|
1780
|
-
itemCtx = rootCtx.createNew(null, _nextPlugin[strGetPlugin]);
|
|
1781
|
-
}
|
|
1782
|
-
else {
|
|
1783
|
-
itemCtx = rootCtx.createNew(null, _nextPlugin);
|
|
1784
|
-
}
|
|
1653
|
+
});
|
|
1654
|
+
_onComplete = [];
|
|
1785
1655
|
}
|
|
1786
|
-
return itemCtx;
|
|
1787
1656
|
}
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
var
|
|
1796
|
-
if (
|
|
1797
|
-
|
|
1657
|
+
return nextProxy;
|
|
1658
|
+
}
|
|
1659
|
+
function _getExtCfg(identifier, defaultValue, mergeDefault) {
|
|
1660
|
+
if (defaultValue === void 0) { defaultValue = {}; }
|
|
1661
|
+
if (mergeDefault === void 0) { mergeDefault = 0 ; }
|
|
1662
|
+
var theConfig;
|
|
1663
|
+
if (config) {
|
|
1664
|
+
var extConfig = config.extensionConfig;
|
|
1665
|
+
if (extConfig && identifier) {
|
|
1666
|
+
theConfig = extConfig[identifier];
|
|
1798
1667
|
}
|
|
1799
|
-
_self.core = core;
|
|
1800
|
-
_rootCtx = createProcessTelemetryContext(pluginChain, config, core, nextPlugin);
|
|
1801
1668
|
}
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
_self.core = null;
|
|
1805
|
-
_rootCtx = null;
|
|
1806
|
-
_nextPlugin = null;
|
|
1807
|
-
_hooks = [];
|
|
1808
|
-
_unloadHandlerContainer = createUnloadHandlerContainer();
|
|
1669
|
+
if (!theConfig) {
|
|
1670
|
+
theConfig = defaultValue;
|
|
1809
1671
|
}
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
var strPageShow = "pageshow";
|
|
1823
|
-
var strUnload = "unload";
|
|
1824
|
-
var strBeforeUnload = "beforeunload";
|
|
1825
|
-
var strPageHideNamespace = createUniqueNamespace("aiEvtPageHide");
|
|
1826
|
-
var strPageShowNamespace = createUniqueNamespace("aiEvtPageShow");
|
|
1827
|
-
var rRemoveEmptyNs = /\.[\.]+/g;
|
|
1828
|
-
var rRemoveTrailingEmptyNs = /[\.]+$/;
|
|
1829
|
-
var _guid = 1;
|
|
1830
|
-
var elmNodeData = createElmNodeData("events");
|
|
1831
|
-
var eventNamespace = /^([^.]*)(?:\.(.+)|)/;
|
|
1832
|
-
function _normalizeNamespace(name) {
|
|
1833
|
-
if (name && name.replace) {
|
|
1834
|
-
return name.replace(/^\s*\.*|\.*\s*$/g, "");
|
|
1835
|
-
}
|
|
1836
|
-
return name;
|
|
1837
|
-
}
|
|
1838
|
-
function _getEvtNamespace(eventName, evtNamespace) {
|
|
1839
|
-
if (evtNamespace) {
|
|
1840
|
-
var theNamespace_1 = "";
|
|
1841
|
-
if (isArray(evtNamespace)) {
|
|
1842
|
-
theNamespace_1 = "";
|
|
1843
|
-
arrForEach(evtNamespace, function (name) {
|
|
1844
|
-
name = _normalizeNamespace(name);
|
|
1845
|
-
if (name) {
|
|
1846
|
-
if (name[0] !== ".") {
|
|
1847
|
-
name = "." + name;
|
|
1848
|
-
}
|
|
1849
|
-
theNamespace_1 += name;
|
|
1672
|
+
else if (isObject(defaultValue)) {
|
|
1673
|
+
if (mergeDefault !== 0 ) {
|
|
1674
|
+
var newConfig_1 = objExtend(true, defaultValue, theConfig);
|
|
1675
|
+
if (config && mergeDefault === 2 ) {
|
|
1676
|
+
objForEachKey(defaultValue, function (field) {
|
|
1677
|
+
if (isNullOrUndefined(newConfig_1[field])) {
|
|
1678
|
+
var cfgValue = config[field];
|
|
1679
|
+
if (!isNullOrUndefined(cfgValue)) {
|
|
1680
|
+
newConfig_1[field] = cfgValue;
|
|
1681
|
+
}
|
|
1682
|
+
}
|
|
1683
|
+
});
|
|
1850
1684
|
}
|
|
1851
|
-
|
|
1685
|
+
theConfig = newConfig_1;
|
|
1686
|
+
}
|
|
1852
1687
|
}
|
|
1853
|
-
|
|
1854
|
-
|
|
1688
|
+
return theConfig;
|
|
1689
|
+
}
|
|
1690
|
+
function _getConfig(identifier, field, defaultValue) {
|
|
1691
|
+
if (defaultValue === void 0) { defaultValue = false; }
|
|
1692
|
+
var theValue;
|
|
1693
|
+
var extConfig = _getExtCfg(identifier, null);
|
|
1694
|
+
if (extConfig && !isNullOrUndefined(extConfig[field])) {
|
|
1695
|
+
theValue = extConfig[field];
|
|
1855
1696
|
}
|
|
1856
|
-
if (
|
|
1857
|
-
|
|
1858
|
-
|
|
1697
|
+
else if (config && !isNullOrUndefined(config[field])) {
|
|
1698
|
+
theValue = config[field];
|
|
1699
|
+
}
|
|
1700
|
+
return !isNullOrUndefined(theValue) ? theValue : defaultValue;
|
|
1701
|
+
}
|
|
1702
|
+
function _iterateChain(cb) {
|
|
1703
|
+
var nextPlugin;
|
|
1704
|
+
while (!!(nextPlugin = context._next())) {
|
|
1705
|
+
var plugin = nextPlugin.getPlugin();
|
|
1706
|
+
if (plugin) {
|
|
1707
|
+
cb(plugin);
|
|
1859
1708
|
}
|
|
1860
|
-
eventName = (eventName || "") + theNamespace_1;
|
|
1861
1709
|
}
|
|
1862
1710
|
}
|
|
1863
|
-
|
|
1864
|
-
return {
|
|
1865
|
-
type: parsedEvent[1],
|
|
1866
|
-
ns: ((parsedEvent[2] || "").replace(rRemoveEmptyNs, ".").replace(rRemoveTrailingEmptyNs, "").split(".").sort()).join(".")
|
|
1867
|
-
};
|
|
1711
|
+
return context;
|
|
1868
1712
|
}
|
|
1869
|
-
function
|
|
1870
|
-
|
|
1871
|
-
var
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1713
|
+
function createProcessTelemetryContext(telemetryChain, config, core, startAt) {
|
|
1714
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1715
|
+
var context = internalContext.ctx;
|
|
1716
|
+
function _processNext(env) {
|
|
1717
|
+
var nextPlugin = internalContext._next();
|
|
1718
|
+
nextPlugin && nextPlugin.processTelemetry(env, context);
|
|
1719
|
+
return !nextPlugin;
|
|
1875
1720
|
}
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
if (obj[strRemoveEventListener]) {
|
|
1881
|
-
obj[strRemoveEventListener](evtName.type, handlerRef, useCapture);
|
|
1721
|
+
function _createNew(plugins, startAt) {
|
|
1722
|
+
if (plugins === void 0) { plugins = null; }
|
|
1723
|
+
if (isArray(plugins)) {
|
|
1724
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1882
1725
|
}
|
|
1883
|
-
|
|
1884
|
-
|
|
1726
|
+
return createProcessTelemetryContext(plugins || context.getNext(), config, core, startAt);
|
|
1727
|
+
}
|
|
1728
|
+
context.processNext = _processNext;
|
|
1729
|
+
context.createNew = _createNew;
|
|
1730
|
+
return context;
|
|
1731
|
+
}
|
|
1732
|
+
function createProcessTelemetryUnloadContext(telemetryChain, core, startAt) {
|
|
1733
|
+
var config = core.config || {};
|
|
1734
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1735
|
+
var context = internalContext.ctx;
|
|
1736
|
+
function _processNext(unloadState) {
|
|
1737
|
+
var nextPlugin = internalContext._next();
|
|
1738
|
+
nextPlugin && nextPlugin.unload(context, unloadState);
|
|
1739
|
+
return !nextPlugin;
|
|
1740
|
+
}
|
|
1741
|
+
function _createNew(plugins, startAt) {
|
|
1742
|
+
if (plugins === void 0) { plugins = null; }
|
|
1743
|
+
if (isArray(plugins)) {
|
|
1744
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1885
1745
|
}
|
|
1746
|
+
return createProcessTelemetryUnloadContext(plugins || context.getNext(), core, startAt);
|
|
1886
1747
|
}
|
|
1748
|
+
context.processNext = _processNext;
|
|
1749
|
+
context.createNew = _createNew;
|
|
1750
|
+
return context;
|
|
1887
1751
|
}
|
|
1888
|
-
function
|
|
1889
|
-
var
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1752
|
+
function createProcessTelemetryUpdateContext(telemetryChain, core, startAt) {
|
|
1753
|
+
var config = core.config || {};
|
|
1754
|
+
var internalContext = _createInternalContext(telemetryChain, config, core, startAt);
|
|
1755
|
+
var context = internalContext.ctx;
|
|
1756
|
+
function _processNext(updateState) {
|
|
1757
|
+
return context.iterate(function (plugin) {
|
|
1758
|
+
if (isFunction(plugin.update)) {
|
|
1759
|
+
plugin.update(context, updateState);
|
|
1760
|
+
}
|
|
1761
|
+
});
|
|
1762
|
+
}
|
|
1763
|
+
function _createNew(plugins, startAt) {
|
|
1764
|
+
if (plugins === void 0) { plugins = null; }
|
|
1765
|
+
if (isArray(plugins)) {
|
|
1766
|
+
plugins = createTelemetryProxyChain(plugins, config, core, startAt);
|
|
1898
1767
|
}
|
|
1768
|
+
return createProcessTelemetryUpdateContext(plugins || context.getNext(), core, startAt);
|
|
1899
1769
|
}
|
|
1900
|
-
|
|
1770
|
+
context.processNext = _processNext;
|
|
1771
|
+
context.createNew = _createNew;
|
|
1772
|
+
return context;
|
|
1901
1773
|
}
|
|
1902
|
-
function
|
|
1903
|
-
var
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1774
|
+
function createTelemetryProxyChain(plugins, config, core, startAt) {
|
|
1775
|
+
var firstProxy = null;
|
|
1776
|
+
var add = startAt ? false : true;
|
|
1777
|
+
if (isArray(plugins) && plugins.length > 0) {
|
|
1778
|
+
var lastProxy_1 = null;
|
|
1779
|
+
arrForEach(plugins, function (thePlugin) {
|
|
1780
|
+
if (!add && startAt === thePlugin) {
|
|
1781
|
+
add = true;
|
|
1782
|
+
}
|
|
1783
|
+
if (add && thePlugin && isFunction(thePlugin.processTelemetry)) {
|
|
1784
|
+
var newProxy = createTelemetryPluginProxy(thePlugin, config, core);
|
|
1785
|
+
if (!firstProxy) {
|
|
1786
|
+
firstProxy = newProxy;
|
|
1911
1787
|
}
|
|
1788
|
+
if (lastProxy_1) {
|
|
1789
|
+
lastProxy_1._setNext(newProxy);
|
|
1790
|
+
}
|
|
1791
|
+
lastProxy_1 = newProxy;
|
|
1912
1792
|
}
|
|
1913
|
-
}
|
|
1793
|
+
});
|
|
1794
|
+
}
|
|
1795
|
+
if (startAt && !firstProxy) {
|
|
1796
|
+
return createTelemetryProxyChain([startAt], config, core);
|
|
1914
1797
|
}
|
|
1798
|
+
return firstProxy;
|
|
1915
1799
|
}
|
|
1916
|
-
function
|
|
1917
|
-
|
|
1918
|
-
|
|
1800
|
+
function createTelemetryPluginProxy(plugin, config, core) {
|
|
1801
|
+
var nextProxy = null;
|
|
1802
|
+
var hasProcessTelemetry = isFunction(plugin.processTelemetry);
|
|
1803
|
+
var hasSetNext = isFunction(plugin.setNextPlugin);
|
|
1804
|
+
var chainId;
|
|
1805
|
+
if (plugin) {
|
|
1806
|
+
chainId = plugin.identifier + "-" + plugin.priority + "-" + _chainId++;
|
|
1919
1807
|
}
|
|
1920
1808
|
else {
|
|
1921
|
-
|
|
1922
|
-
objForEachKey(eventCache, function (evtType, events) {
|
|
1923
|
-
_doUnregister(target, events, evtName, unRegFn);
|
|
1924
|
-
});
|
|
1925
|
-
if (objKeys(eventCache).length === 0) {
|
|
1926
|
-
elmNodeData.kill(target, strEvents);
|
|
1927
|
-
}
|
|
1809
|
+
chainId = "Unknown-0-" + _chainId++;
|
|
1928
1810
|
}
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1811
|
+
var proxyChain = {
|
|
1812
|
+
getPlugin: function () {
|
|
1813
|
+
return plugin;
|
|
1814
|
+
},
|
|
1815
|
+
getNext: function () {
|
|
1816
|
+
return nextProxy;
|
|
1817
|
+
},
|
|
1818
|
+
processTelemetry: _processTelemetry,
|
|
1819
|
+
unload: _unloadPlugin,
|
|
1820
|
+
update: _updatePlugin,
|
|
1821
|
+
_id: chainId,
|
|
1822
|
+
_setNext: function (nextPlugin) {
|
|
1823
|
+
nextProxy = nextPlugin;
|
|
1935
1824
|
}
|
|
1936
|
-
|
|
1937
|
-
|
|
1825
|
+
};
|
|
1826
|
+
function _getTelCtx() {
|
|
1827
|
+
var itemCtx;
|
|
1828
|
+
if (plugin && isFunction(plugin[strGetTelCtx])) {
|
|
1829
|
+
itemCtx = plugin[strGetTelCtx]();
|
|
1938
1830
|
}
|
|
1939
|
-
|
|
1831
|
+
if (!itemCtx) {
|
|
1832
|
+
itemCtx = createProcessTelemetryContext(proxyChain, config, core);
|
|
1833
|
+
}
|
|
1834
|
+
return itemCtx;
|
|
1940
1835
|
}
|
|
1941
|
-
|
|
1942
|
-
|
|
1836
|
+
function _processChain(itemCtx, processPluginFn, name, details, isAsync) {
|
|
1837
|
+
var hasRun = false;
|
|
1838
|
+
var identifier = plugin ? plugin.identifier : strTelemetryPluginChain;
|
|
1839
|
+
var hasRunContext = itemCtx[strHasRunFlags];
|
|
1840
|
+
if (!hasRunContext) {
|
|
1841
|
+
hasRunContext = itemCtx[strHasRunFlags] = {};
|
|
1842
|
+
}
|
|
1843
|
+
itemCtx.setNext(nextProxy);
|
|
1844
|
+
if (plugin) {
|
|
1845
|
+
doPerf(itemCtx[strCore](), function () { return identifier + ":" + name; }, function () {
|
|
1846
|
+
hasRunContext[chainId] = true;
|
|
1847
|
+
try {
|
|
1848
|
+
var nextId = nextProxy ? nextProxy._id : strEmpty;
|
|
1849
|
+
if (nextId) {
|
|
1850
|
+
hasRunContext[nextId] = false;
|
|
1851
|
+
}
|
|
1852
|
+
hasRun = processPluginFn(itemCtx);
|
|
1853
|
+
}
|
|
1854
|
+
catch (error) {
|
|
1855
|
+
var hasNextRun = nextProxy ? hasRunContext[nextProxy._id] : true;
|
|
1856
|
+
if (hasNextRun) {
|
|
1857
|
+
hasRun = true;
|
|
1858
|
+
}
|
|
1859
|
+
if (!nextProxy || !hasNextRun) {
|
|
1860
|
+
_throwInternal(itemCtx.diagLog(), 1 , 73 , "Plugin [" + identifier + "] failed during " + name + " - " + dumpObj(error) + ", run flags: " + dumpObj(hasRunContext));
|
|
1861
|
+
}
|
|
1862
|
+
}
|
|
1863
|
+
}, details, isAsync);
|
|
1864
|
+
}
|
|
1865
|
+
return hasRun;
|
|
1943
1866
|
}
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
evtName: evtName,
|
|
1957
|
-
handler: handlerRef,
|
|
1958
|
-
capture: useCapture
|
|
1959
|
-
};
|
|
1960
|
-
_getRegisteredEvents(target, evtName.type).push(registeredEvent);
|
|
1867
|
+
function _processTelemetry(env, itemCtx) {
|
|
1868
|
+
itemCtx = itemCtx || _getTelCtx();
|
|
1869
|
+
function _callProcessTelemetry(itemCtx) {
|
|
1870
|
+
if (!plugin || !hasProcessTelemetry) {
|
|
1871
|
+
return false;
|
|
1872
|
+
}
|
|
1873
|
+
var pluginState = _getPluginState(plugin);
|
|
1874
|
+
if (pluginState.teardown || pluginState[strDisabled]) {
|
|
1875
|
+
return false;
|
|
1876
|
+
}
|
|
1877
|
+
if (hasSetNext) {
|
|
1878
|
+
plugin.setNextPlugin(nextProxy);
|
|
1961
1879
|
}
|
|
1880
|
+
plugin.processTelemetry(env, itemCtx);
|
|
1881
|
+
return true;
|
|
1962
1882
|
}
|
|
1963
|
-
|
|
1883
|
+
if (!_processChain(itemCtx, _callProcessTelemetry, "processTelemetry", function () { return ({ item: env }); }, !(env.sync))) {
|
|
1884
|
+
itemCtx.processNext(env);
|
|
1964
1885
|
}
|
|
1965
1886
|
}
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1887
|
+
function _unloadPlugin(unloadCtx, unloadState) {
|
|
1888
|
+
function _callTeardown() {
|
|
1889
|
+
var hasRun = false;
|
|
1890
|
+
if (plugin) {
|
|
1891
|
+
var pluginState = _getPluginState(plugin);
|
|
1892
|
+
var pluginCore = plugin[strCore] || pluginState.core;
|
|
1893
|
+
if (plugin && (!pluginCore || pluginCore === unloadCtx[strCore]()) && !pluginState[strTeardown]) {
|
|
1894
|
+
pluginState[strCore] = null;
|
|
1895
|
+
pluginState[strTeardown] = true;
|
|
1896
|
+
pluginState[strIsInitialized] = false;
|
|
1897
|
+
if (plugin[strTeardown] && plugin[strTeardown](unloadCtx, unloadState) === true) {
|
|
1898
|
+
hasRun = true;
|
|
1899
|
+
}
|
|
1978
1900
|
}
|
|
1979
|
-
return false;
|
|
1980
|
-
});
|
|
1981
|
-
if (!found_1) {
|
|
1982
|
-
_doDetach(target, evtName_1, handlerRef, useCapture);
|
|
1983
1901
|
}
|
|
1902
|
+
return hasRun;
|
|
1984
1903
|
}
|
|
1985
|
-
|
|
1904
|
+
if (!_processChain(unloadCtx, _callTeardown, "unload", function () { }, unloadState.isAsync)) {
|
|
1905
|
+
unloadCtx.processNext(unloadState);
|
|
1986
1906
|
}
|
|
1987
1907
|
}
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
result = eventOn(doc, eventName, callback, evtNamespace) || result;
|
|
1999
|
-
}
|
|
2000
|
-
return result;
|
|
2001
|
-
}
|
|
2002
|
-
function removeEventHandler(eventName, callback, evtNamespace) {
|
|
2003
|
-
var w = getWindow();
|
|
2004
|
-
if (w) {
|
|
2005
|
-
eventOff(w, eventName, callback, evtNamespace);
|
|
2006
|
-
eventOff(w["body"], eventName, callback, evtNamespace);
|
|
2007
|
-
}
|
|
2008
|
-
var doc = getDocument();
|
|
2009
|
-
if (doc) {
|
|
2010
|
-
eventOff(doc, eventName, callback, evtNamespace);
|
|
2011
|
-
}
|
|
2012
|
-
}
|
|
2013
|
-
function _addEventListeners(events, listener, excludeEvents, evtNamespace) {
|
|
2014
|
-
var added = false;
|
|
2015
|
-
if (listener && events && events.length > 0) {
|
|
2016
|
-
arrForEach(events, function (name) {
|
|
2017
|
-
if (name) {
|
|
2018
|
-
if (!excludeEvents || arrIndexOf(excludeEvents, name) === -1) {
|
|
2019
|
-
added = addEventHandler(name, listener, evtNamespace) || added;
|
|
1908
|
+
function _updatePlugin(updateCtx, updateState) {
|
|
1909
|
+
function _callUpdate() {
|
|
1910
|
+
var hasRun = false;
|
|
1911
|
+
if (plugin) {
|
|
1912
|
+
var pluginState = _getPluginState(plugin);
|
|
1913
|
+
var pluginCore = plugin[strCore] || pluginState.core;
|
|
1914
|
+
if (plugin && (!pluginCore || pluginCore === updateCtx[strCore]()) && !pluginState[strTeardown]) {
|
|
1915
|
+
if (plugin[strUpdate] && plugin[strUpdate](updateCtx, updateState) === true) {
|
|
1916
|
+
hasRun = true;
|
|
1917
|
+
}
|
|
2020
1918
|
}
|
|
2021
1919
|
}
|
|
2022
|
-
|
|
1920
|
+
return hasRun;
|
|
1921
|
+
}
|
|
1922
|
+
if (!_processChain(updateCtx, _callUpdate, "update", function () { }, false)) {
|
|
1923
|
+
updateCtx.processNext(updateState);
|
|
1924
|
+
}
|
|
2023
1925
|
}
|
|
2024
|
-
return
|
|
1926
|
+
return objFreeze(proxyChain);
|
|
2025
1927
|
}
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
1928
|
+
|
|
1929
|
+
var strExtensionConfig = "extensionConfig";
|
|
1930
|
+
|
|
1931
|
+
function createUnloadHandlerContainer() {
|
|
1932
|
+
var handlers = [];
|
|
1933
|
+
function _addHandler(handler) {
|
|
1934
|
+
if (handler) {
|
|
1935
|
+
handlers.push(handler);
|
|
2032
1936
|
}
|
|
2033
1937
|
}
|
|
2034
|
-
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
1938
|
+
function _runHandlers(unloadCtx, unloadState) {
|
|
1939
|
+
arrForEach(handlers, function (handler) {
|
|
1940
|
+
try {
|
|
1941
|
+
handler(unloadCtx, unloadState);
|
|
1942
|
+
}
|
|
1943
|
+
catch (e) {
|
|
1944
|
+
_throwInternal(unloadCtx.diagLog(), 2 , 73 , "Unexpected error calling unload handler - " + dumpObj(e));
|
|
2041
1945
|
}
|
|
2042
1946
|
});
|
|
1947
|
+
handlers = [];
|
|
2043
1948
|
}
|
|
1949
|
+
return {
|
|
1950
|
+
add: _addHandler,
|
|
1951
|
+
run: _runHandlers
|
|
1952
|
+
};
|
|
2044
1953
|
}
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
var
|
|
2054
|
-
|
|
2055
|
-
|
|
1954
|
+
|
|
1955
|
+
var strGetPlugin = "getPlugin";
|
|
1956
|
+
var BaseTelemetryPlugin = /** @class */ (function () {
|
|
1957
|
+
function BaseTelemetryPlugin() {
|
|
1958
|
+
var _self = this;
|
|
1959
|
+
var _isinitialized;
|
|
1960
|
+
var _rootCtx;
|
|
1961
|
+
var _nextPlugin;
|
|
1962
|
+
var _unloadHandlerContainer;
|
|
1963
|
+
var _hooks;
|
|
1964
|
+
_initDefaults();
|
|
1965
|
+
dynamicProto(BaseTelemetryPlugin, _self, function (_self) {
|
|
1966
|
+
_self.initialize = function (config, core, extensions, pluginChain) {
|
|
1967
|
+
_setDefaults(config, core, pluginChain);
|
|
1968
|
+
_isinitialized = true;
|
|
1969
|
+
};
|
|
1970
|
+
_self.teardown = function (unloadCtx, unloadState) {
|
|
1971
|
+
var core = _self.core;
|
|
1972
|
+
if (!core || (unloadCtx && core !== unloadCtx.core())) {
|
|
1973
|
+
return;
|
|
1974
|
+
}
|
|
1975
|
+
var result;
|
|
1976
|
+
var unloadDone = false;
|
|
1977
|
+
var theUnloadCtx = unloadCtx || createProcessTelemetryUnloadContext(null, core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
|
|
1978
|
+
var theUnloadState = unloadState || {
|
|
1979
|
+
reason: 0 ,
|
|
1980
|
+
isAsync: false
|
|
1981
|
+
};
|
|
1982
|
+
function _unloadCallback() {
|
|
1983
|
+
if (!unloadDone) {
|
|
1984
|
+
unloadDone = true;
|
|
1985
|
+
_unloadHandlerContainer.run(theUnloadCtx, unloadState);
|
|
1986
|
+
arrForEach(_hooks, function (fn) {
|
|
1987
|
+
fn.rm();
|
|
1988
|
+
});
|
|
1989
|
+
_hooks = [];
|
|
1990
|
+
if (result === true) {
|
|
1991
|
+
theUnloadCtx.processNext(theUnloadState);
|
|
1992
|
+
}
|
|
1993
|
+
_initDefaults();
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
if (!_self[strDoTeardown] || _self[strDoTeardown](theUnloadCtx, theUnloadState, _unloadCallback) !== true) {
|
|
1997
|
+
_unloadCallback();
|
|
1998
|
+
}
|
|
1999
|
+
else {
|
|
2000
|
+
result = true;
|
|
2001
|
+
}
|
|
2002
|
+
return result;
|
|
2003
|
+
};
|
|
2004
|
+
_self.update = function (updateCtx, updateState) {
|
|
2005
|
+
var core = _self.core;
|
|
2006
|
+
if (!core || (updateCtx && core !== updateCtx.core())) {
|
|
2007
|
+
return;
|
|
2008
|
+
}
|
|
2009
|
+
var result;
|
|
2010
|
+
var updateDone = false;
|
|
2011
|
+
var theUpdateCtx = updateCtx || createProcessTelemetryUpdateContext(null, core, _nextPlugin && _nextPlugin[strGetPlugin] ? _nextPlugin[strGetPlugin]() : _nextPlugin);
|
|
2012
|
+
var theUpdateState = updateState || {
|
|
2013
|
+
reason: 0
|
|
2014
|
+
};
|
|
2015
|
+
function _updateCallback() {
|
|
2016
|
+
if (!updateDone) {
|
|
2017
|
+
updateDone = true;
|
|
2018
|
+
_setDefaults(theUpdateCtx.getCfg(), theUpdateCtx.core(), theUpdateCtx.getNext());
|
|
2019
|
+
}
|
|
2020
|
+
}
|
|
2021
|
+
if (!_self._doUpdate || _self._doUpdate(theUpdateCtx, theUpdateState, _updateCallback) !== true) {
|
|
2022
|
+
_updateCallback();
|
|
2023
|
+
}
|
|
2024
|
+
else {
|
|
2025
|
+
result = true;
|
|
2026
|
+
}
|
|
2027
|
+
return result;
|
|
2028
|
+
};
|
|
2029
|
+
_self._addHook = function (hooks) {
|
|
2030
|
+
if (hooks) {
|
|
2031
|
+
if (isArray(hooks)) {
|
|
2032
|
+
_hooks = _hooks.concat(hooks);
|
|
2033
|
+
}
|
|
2034
|
+
else {
|
|
2035
|
+
_hooks.push(hooks);
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
2038
|
+
};
|
|
2039
|
+
proxyFunctionAs(_self, "_addUnloadCb", function () { return _unloadHandlerContainer; }, "add");
|
|
2040
|
+
});
|
|
2041
|
+
_self.diagLog = function (itemCtx) {
|
|
2042
|
+
return _getTelCtx(itemCtx).diagLog();
|
|
2043
|
+
};
|
|
2044
|
+
_self[strIsInitialized] = function () {
|
|
2045
|
+
return _isinitialized;
|
|
2046
|
+
};
|
|
2047
|
+
_self.setInitialized = function (isInitialized) {
|
|
2048
|
+
_isinitialized = isInitialized;
|
|
2049
|
+
};
|
|
2050
|
+
_self[strSetNextPlugin] = function (next) {
|
|
2051
|
+
_nextPlugin = next;
|
|
2052
|
+
};
|
|
2053
|
+
_self.processNext = function (env, itemCtx) {
|
|
2054
|
+
if (itemCtx) {
|
|
2055
|
+
itemCtx.processNext(env);
|
|
2056
|
+
}
|
|
2057
|
+
else if (_nextPlugin && isFunction(_nextPlugin.processTelemetry)) {
|
|
2058
|
+
_nextPlugin.processTelemetry(env, null);
|
|
2059
|
+
}
|
|
2060
|
+
};
|
|
2061
|
+
_self._getTelCtx = _getTelCtx;
|
|
2062
|
+
function _getTelCtx(currentCtx) {
|
|
2063
|
+
if (currentCtx === void 0) { currentCtx = null; }
|
|
2064
|
+
var itemCtx = currentCtx;
|
|
2065
|
+
if (!itemCtx) {
|
|
2066
|
+
var rootCtx = _rootCtx || createProcessTelemetryContext(null, {}, _self.core);
|
|
2067
|
+
if (_nextPlugin && _nextPlugin[strGetPlugin]) {
|
|
2068
|
+
itemCtx = rootCtx.createNew(null, _nextPlugin[strGetPlugin]);
|
|
2069
|
+
}
|
|
2070
|
+
else {
|
|
2071
|
+
itemCtx = rootCtx.createNew(null, _nextPlugin);
|
|
2072
|
+
}
|
|
2073
|
+
}
|
|
2074
|
+
return itemCtx;
|
|
2056
2075
|
}
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
2070
|
-
|
|
2071
|
-
|
|
2072
|
-
|
|
2073
|
-
|
|
2074
|
-
|
|
2075
|
-
|
|
2076
|
-
|
|
2077
|
-
|
|
2076
|
+
function _setDefaults(config, core, pluginChain) {
|
|
2077
|
+
if (config) {
|
|
2078
|
+
setValue(config, strExtensionConfig, [], null, isNullOrUndefined);
|
|
2079
|
+
}
|
|
2080
|
+
if (!pluginChain && core) {
|
|
2081
|
+
pluginChain = core.getProcessTelContext().getNext();
|
|
2082
|
+
}
|
|
2083
|
+
var nextPlugin = _nextPlugin;
|
|
2084
|
+
if (_nextPlugin && _nextPlugin[strGetPlugin]) {
|
|
2085
|
+
nextPlugin = _nextPlugin[strGetPlugin]();
|
|
2086
|
+
}
|
|
2087
|
+
_self.core = core;
|
|
2088
|
+
_rootCtx = createProcessTelemetryContext(pluginChain, config, core, nextPlugin);
|
|
2089
|
+
}
|
|
2090
|
+
function _initDefaults() {
|
|
2091
|
+
_isinitialized = false;
|
|
2092
|
+
_self.core = null;
|
|
2093
|
+
_rootCtx = null;
|
|
2094
|
+
_nextPlugin = null;
|
|
2095
|
+
_hooks = [];
|
|
2096
|
+
_unloadHandlerContainer = createUnloadHandlerContainer();
|
|
2078
2097
|
}
|
|
2079
2098
|
}
|
|
2080
|
-
|
|
2081
|
-
|
|
2082
|
-
pageShowAdded = _addEventListeners([strVisibilityChangeEvt], _handlePageVisibility, excludeEvents, newNamespaces) || pageShowAdded;
|
|
2083
|
-
if (!pageShowAdded && excludeEvents) {
|
|
2084
|
-
pageShowAdded = addPageShowEventListener(listener, null, evtNamespace);
|
|
2085
|
-
}
|
|
2086
|
-
return pageShowAdded;
|
|
2087
|
-
}
|
|
2088
|
-
function removePageShowEventListener(listener, evtNamespace) {
|
|
2089
|
-
var newNamespaces = mergeEvtNamespace(strPageShowNamespace, evtNamespace);
|
|
2090
|
-
removeEventListeners([strPageShow], listener, newNamespaces);
|
|
2091
|
-
removeEventListeners([strVisibilityChangeEvt], null, newNamespaces);
|
|
2092
|
-
}
|
|
2093
|
-
|
|
2094
|
-
function perfNow() {
|
|
2095
|
-
var perf = getPerformance();
|
|
2096
|
-
if (perf && perf.now) {
|
|
2097
|
-
return perf.now();
|
|
2098
|
-
}
|
|
2099
|
-
return dateNow();
|
|
2100
|
-
}
|
|
2099
|
+
return BaseTelemetryPlugin;
|
|
2100
|
+
}());
|
|
2101
2101
|
|
|
2102
2102
|
var _a$1;
|
|
2103
|
-
var Version = '3.2.
|
|
2103
|
+
var Version = '3.2.3';
|
|
2104
2104
|
var FullVersionString = "1DS-Web-JS-" + Version;
|
|
2105
2105
|
var strDisabledPropertyName = "Microsoft_ApplicationInsights_BypassAjaxInstrumentation";
|
|
2106
2106
|
var strWithCredentials = "withCredentials";
|
|
@@ -3673,7 +3673,7 @@
|
|
|
3673
3673
|
var _this = _super.call(this) || this;
|
|
3674
3674
|
_this.identifier = "PostChannel";
|
|
3675
3675
|
_this.priority = 1011;
|
|
3676
|
-
_this.version = '3.2.
|
|
3676
|
+
_this.version = '3.2.3';
|
|
3677
3677
|
var _config;
|
|
3678
3678
|
var _isTeardownCalled = false;
|
|
3679
3679
|
var _flushCallbackQueue = [];
|
|
@@ -3698,7 +3698,6 @@
|
|
|
3698
3698
|
var _delayedBatchReason;
|
|
3699
3699
|
var _optimizeObject = true;
|
|
3700
3700
|
var _isPageUnloadTriggered = false;
|
|
3701
|
-
var _disableXhrSync = false;
|
|
3702
3701
|
var _maxEventSendAttempts = MaxSendAttempts;
|
|
3703
3702
|
var _maxUnloadEventSendAttempts = MaxSyncUnloadSendAttempts;
|
|
3704
3703
|
var _evtNamespace;
|
|
@@ -3730,7 +3729,6 @@
|
|
|
3730
3729
|
if (_config.autoFlushEventsLimit > 0) {
|
|
3731
3730
|
_autoFlushEventsLimit = _config.autoFlushEventsLimit;
|
|
3732
3731
|
}
|
|
3733
|
-
_disableXhrSync = _config.disableXhrSync;
|
|
3734
3732
|
if (isNumber(_config[strMaxEventRetryAttempts])) {
|
|
3735
3733
|
_maxEventSendAttempts = _config[strMaxEventRetryAttempts];
|
|
3736
3734
|
}
|
|
@@ -3938,13 +3936,13 @@
|
|
|
3938
3936
|
_self.flush = function (async, callback, sendReason) {
|
|
3939
3937
|
if (async === void 0) { async = true; }
|
|
3940
3938
|
if (!_paused) {
|
|
3941
|
-
_clearScheduledTimer();
|
|
3942
3939
|
sendReason = sendReason || 1 ;
|
|
3943
3940
|
if (async) {
|
|
3944
|
-
_queueBatches(1 , 0 , sendReason);
|
|
3945
|
-
_resetQueueCounts();
|
|
3946
3941
|
if (_flushCallbackTimerId == null) {
|
|
3942
|
+
_clearScheduledTimer();
|
|
3943
|
+
_queueBatches(1 , 0 , sendReason);
|
|
3947
3944
|
_flushCallbackTimerId = _createTimer(function () {
|
|
3945
|
+
_flushCallbackTimerId = null;
|
|
3948
3946
|
_flushImpl(callback, sendReason);
|
|
3949
3947
|
}, 0);
|
|
3950
3948
|
}
|
|
@@ -3953,10 +3951,14 @@
|
|
|
3953
3951
|
}
|
|
3954
3952
|
}
|
|
3955
3953
|
else {
|
|
3954
|
+
var cleared = _clearScheduledTimer();
|
|
3956
3955
|
_sendEventsForLatencyAndAbove(1 , 1 , sendReason);
|
|
3957
3956
|
if (callback !== null && callback !== undefined) {
|
|
3958
3957
|
callback();
|
|
3959
3958
|
}
|
|
3959
|
+
if (cleared) {
|
|
3960
|
+
_scheduleTimer();
|
|
3961
|
+
}
|
|
3960
3962
|
}
|
|
3961
3963
|
}
|
|
3962
3964
|
};
|
|
@@ -4047,7 +4049,6 @@
|
|
|
4047
4049
|
_delayedBatchReason = null;
|
|
4048
4050
|
_optimizeObject = true;
|
|
4049
4051
|
_isPageUnloadTriggered = false;
|
|
4050
|
-
_disableXhrSync = false;
|
|
4051
4052
|
_maxEventSendAttempts = MaxSendAttempts;
|
|
4052
4053
|
_maxUnloadEventSendAttempts = MaxSyncUnloadSendAttempts;
|
|
4053
4054
|
_evtNamespace = null;
|
|
@@ -4079,7 +4080,9 @@
|
|
|
4079
4080
|
_timeoutWrapper.clear(_scheduledTimerId);
|
|
4080
4081
|
_scheduledTimerId = null;
|
|
4081
4082
|
_timerCount = 0;
|
|
4083
|
+
return true;
|
|
4082
4084
|
}
|
|
4085
|
+
return false;
|
|
4083
4086
|
}
|
|
4084
4087
|
function _releaseAllQueues(sendType, sendReason) {
|
|
4085
4088
|
_clearScheduledTimer();
|
|
@@ -4243,18 +4246,20 @@
|
|
|
4243
4246
|
}
|
|
4244
4247
|
function _flushImpl(callback, sendReason) {
|
|
4245
4248
|
_sendEventsForLatencyAndAbove(1 , 0 , sendReason);
|
|
4249
|
+
_resetQueueCounts();
|
|
4246
4250
|
_waitForIdleManager(function () {
|
|
4247
4251
|
if (callback) {
|
|
4248
4252
|
callback();
|
|
4249
4253
|
}
|
|
4250
4254
|
if (_flushCallbackQueue.length > 0) {
|
|
4251
|
-
_flushCallbackTimerId = _createTimer(function () {
|
|
4255
|
+
_flushCallbackTimerId = _createTimer(function () {
|
|
4256
|
+
_flushCallbackTimerId = null;
|
|
4257
|
+
_flushImpl(_flushCallbackQueue.shift(), sendReason);
|
|
4258
|
+
}, 0);
|
|
4252
4259
|
}
|
|
4253
4260
|
else {
|
|
4254
4261
|
_flushCallbackTimerId = null;
|
|
4255
|
-
|
|
4256
|
-
_scheduleTimer();
|
|
4257
|
-
}
|
|
4262
|
+
_scheduleTimer();
|
|
4258
4263
|
}
|
|
4259
4264
|
});
|
|
4260
4265
|
}
|
|
@@ -4264,6 +4269,7 @@
|
|
|
4264
4269
|
}
|
|
4265
4270
|
else {
|
|
4266
4271
|
_flushCallbackTimerId = _createTimer(function () {
|
|
4272
|
+
_flushCallbackTimerId = null;
|
|
4267
4273
|
_waitForIdleManager(callback);
|
|
4268
4274
|
}, FlushCheckTimer);
|
|
4269
4275
|
}
|
|
@@ -4399,4 +4405,4 @@
|
|
|
4399
4405
|
(function(obj, prop, descriptor) { /* ai_es3_polyfil defineProperty */ var func = Object["defineProperty"]; if (func) { try { return func(obj, prop, descriptor); } catch(e) { /* IE8 defines defineProperty, but will throw */ } } if (descriptor && typeof descriptor.value !== undefined) { obj[prop] = descriptor.value; } return obj; })(exports, '__esModule', { value: true });
|
|
4400
4406
|
|
|
4401
4407
|
})(this.oneDS = this.oneDS || {});
|
|
4402
|
-
//# sourceMappingURL=ms.post-3.2.
|
|
4408
|
+
//# sourceMappingURL=ms.post-3.2.3.gbl.js.map
|