@microsoft/applicationinsights-properties-js 3.0.0-beta.2301-15 → 3.0.0-beta.2301-18
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/applicationinsights-properties-js.integrity.json +9 -9
- package/browser/applicationinsights-properties-js.js +140 -93
- package/browser/applicationinsights-properties-js.js.map +1 -1
- package/browser/applicationinsights-properties-js.min.js +2 -2
- package/browser/applicationinsights-properties-js.min.js.map +1 -1
- package/dist/applicationinsights-properties-js.api.json +34 -0
- package/dist/applicationinsights-properties-js.api.md +3 -2
- package/dist/applicationinsights-properties-js.d.ts +4 -4
- package/dist/applicationinsights-properties-js.js +140 -93
- package/dist/applicationinsights-properties-js.js.map +1 -1
- package/dist/applicationinsights-properties-js.min.js +2 -2
- package/dist/applicationinsights-properties-js.min.js.map +1 -1
- package/dist/applicationinsights-properties-js.rollup.d.ts +4 -4
- package/dist-esm/Context/Application.js +1 -1
- package/dist-esm/Context/Device.js +1 -1
- package/dist-esm/Context/Internal.js +4 -3
- package/dist-esm/Context/Internal.js.map +1 -1
- package/dist-esm/Context/Location.js +1 -1
- package/dist-esm/Context/Session.js +23 -24
- package/dist-esm/Context/Session.js.map +1 -1
- package/dist-esm/Context/TelemetryTrace.js +1 -1
- package/dist-esm/Context/User.js +4 -3
- package/dist-esm/Context/User.js.map +1 -1
- package/dist-esm/Interfaces/IPropTelemetryContext.js +1 -1
- package/dist-esm/Interfaces/IPropertiesConfig.js +1 -1
- package/dist-esm/PropertiesPlugin.js +11 -12
- package/dist-esm/PropertiesPlugin.js.map +1 -1
- package/dist-esm/TelemetryContext.js +5 -5
- package/dist-esm/TelemetryContext.js.map +1 -1
- package/dist-esm/__DynamicConstants.js +3 -3
- package/dist-esm/__DynamicConstants.js.map +1 -1
- package/dist-esm/applicationinsights-properties-js.js +1 -1
- package/package.json +3 -3
- package/src/Context/Internal.ts +5 -3
- package/src/Context/Session.ts +27 -27
- package/src/Context/User.ts +6 -4
- package/src/Interfaces/IPropertiesConfig.ts +0 -1
- package/src/PropertiesPlugin.ts +10 -9
- package/src/TelemetryContext.ts +6 -6
- package/src/__DynamicConstants.ts +2 -2
- package/types/Context/Internal.d.ts +2 -1
- package/types/Context/Session.d.ts +2 -2
- package/types/Context/User.d.ts +2 -2
- package/types/Interfaces/IPropertiesConfig.d.ts +0 -1
- package/types/TelemetryContext.d.ts +2 -2
- package/types/__DynamicConstants.d.ts +2 -2
|
@@ -1562,6 +1562,15 @@
|
|
|
1562
1562
|
"text": "IAppInsightsCore",
|
|
1563
1563
|
"canonicalReference": "@microsoft/applicationinsights-core-js!IAppInsightsCore:interface"
|
|
1564
1564
|
},
|
|
1565
|
+
{
|
|
1566
|
+
"kind": "Content",
|
|
1567
|
+
"text": ", unloadHookContainer?: "
|
|
1568
|
+
},
|
|
1569
|
+
{
|
|
1570
|
+
"kind": "Reference",
|
|
1571
|
+
"text": "IUnloadHookContainer",
|
|
1572
|
+
"canonicalReference": "@microsoft/applicationinsights-core-js!IUnloadHookContainer:interface"
|
|
1573
|
+
},
|
|
1565
1574
|
{
|
|
1566
1575
|
"kind": "Content",
|
|
1567
1576
|
"text": ");"
|
|
@@ -1586,6 +1595,14 @@
|
|
|
1586
1595
|
"endIndex": 4
|
|
1587
1596
|
},
|
|
1588
1597
|
"isOptional": true
|
|
1598
|
+
},
|
|
1599
|
+
{
|
|
1600
|
+
"parameterName": "unloadHookContainer",
|
|
1601
|
+
"parameterTypeTokenRange": {
|
|
1602
|
+
"startIndex": 5,
|
|
1603
|
+
"endIndex": 6
|
|
1604
|
+
},
|
|
1605
|
+
"isOptional": true
|
|
1589
1606
|
}
|
|
1590
1607
|
]
|
|
1591
1608
|
},
|
|
@@ -1742,6 +1759,15 @@
|
|
|
1742
1759
|
"text": "IDistributedTraceContext",
|
|
1743
1760
|
"canonicalReference": "@microsoft/applicationinsights-core-js!IDistributedTraceContext:interface"
|
|
1744
1761
|
},
|
|
1762
|
+
{
|
|
1763
|
+
"kind": "Content",
|
|
1764
|
+
"text": ", unloadHookContainer?: "
|
|
1765
|
+
},
|
|
1766
|
+
{
|
|
1767
|
+
"kind": "Reference",
|
|
1768
|
+
"text": "IUnloadHookContainer",
|
|
1769
|
+
"canonicalReference": "@microsoft/applicationinsights-core-js!IUnloadHookContainer:interface"
|
|
1770
|
+
},
|
|
1745
1771
|
{
|
|
1746
1772
|
"kind": "Content",
|
|
1747
1773
|
"text": ");"
|
|
@@ -1774,6 +1800,14 @@
|
|
|
1774
1800
|
"endIndex": 6
|
|
1775
1801
|
},
|
|
1776
1802
|
"isOptional": true
|
|
1803
|
+
},
|
|
1804
|
+
{
|
|
1805
|
+
"parameterName": "unloadHookContainer",
|
|
1806
|
+
"parameterTypeTokenRange": {
|
|
1807
|
+
"startIndex": 7,
|
|
1808
|
+
"endIndex": 8
|
|
1809
|
+
},
|
|
1810
|
+
"isOptional": true
|
|
1777
1811
|
}
|
|
1778
1812
|
]
|
|
1779
1813
|
},
|
|
@@ -24,6 +24,7 @@ import { ITelemetryItem } from '@microsoft/applicationinsights-core-js';
|
|
|
24
24
|
import { ITelemetryPluginChain } from '@microsoft/applicationinsights-core-js';
|
|
25
25
|
import { ITelemetryTrace } from '@microsoft/applicationinsights-common';
|
|
26
26
|
import { ITraceState } from '@microsoft/applicationinsights-common';
|
|
27
|
+
import { IUnloadHookContainer } from '@microsoft/applicationinsights-core-js';
|
|
27
28
|
import { IUserContext } from '@microsoft/applicationinsights-common';
|
|
28
29
|
import { IWeb } from '@microsoft/applicationinsights-common';
|
|
29
30
|
|
|
@@ -94,7 +95,7 @@ export class Session implements ISession {
|
|
|
94
95
|
|
|
95
96
|
// @public (undocumented)
|
|
96
97
|
export class SessionManager {
|
|
97
|
-
constructor(config: ISessionConfig, core?: IAppInsightsCore);
|
|
98
|
+
constructor(config: ISessionConfig, core?: IAppInsightsCore, unloadHookContainer?: IUnloadHookContainer);
|
|
98
99
|
// (undocumented)
|
|
99
100
|
automaticSession: Session;
|
|
100
101
|
backup(): void;
|
|
@@ -105,7 +106,7 @@ export class SessionManager {
|
|
|
105
106
|
// @public (undocumented)
|
|
106
107
|
export class TelemetryContext implements IPropTelemetryContext {
|
|
107
108
|
// Warning: (ae-forgotten-export) The symbol "IPropertiesConfig" needs to be exported by the entry point applicationinsights-properties-js.d.ts
|
|
108
|
-
constructor(core: IAppInsightsCore, defaultConfig: IPropertiesConfig, previousTraceCtx?: IDistributedTraceContext);
|
|
109
|
+
constructor(core: IAppInsightsCore, defaultConfig: IPropertiesConfig, previousTraceCtx?: IDistributedTraceContext, unloadHookContainer?: IUnloadHookContainer);
|
|
109
110
|
// (undocumented)
|
|
110
111
|
appId: () => string;
|
|
111
112
|
// (undocumented)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Microsoft Application Insights properties plugin, 3.0.0-beta.2301-
|
|
2
|
+
* Microsoft Application Insights properties plugin, 3.0.0-beta.2301-18
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*
|
|
5
5
|
* Microsoft Application Insights Team
|
|
@@ -27,11 +27,11 @@ declare namespace ApplicationInsights {
|
|
|
27
27
|
import { ITelemetryPluginChain } from '@microsoft/applicationinsights-core-js';
|
|
28
28
|
import { ITelemetryTrace } from '@microsoft/applicationinsights-common';
|
|
29
29
|
import { ITraceState } from '@microsoft/applicationinsights-common';
|
|
30
|
+
import { IUnloadHookContainer } from '@microsoft/applicationinsights-core-js';
|
|
30
31
|
import { IUserContext } from '@microsoft/applicationinsights-common';
|
|
31
32
|
import { IWeb } from '@microsoft/applicationinsights-common';
|
|
32
33
|
|
|
33
34
|
interface IPropertiesConfig {
|
|
34
|
-
readonly instrumentationKey: string;
|
|
35
35
|
readonly accountId: string;
|
|
36
36
|
readonly sessionRenewalMs: number;
|
|
37
37
|
readonly samplingPercentage: number;
|
|
@@ -108,7 +108,7 @@ declare namespace ApplicationInsights {
|
|
|
108
108
|
|
|
109
109
|
class SessionManager {
|
|
110
110
|
automaticSession: Session;
|
|
111
|
-
constructor(config: ISessionConfig, core?: IAppInsightsCore);
|
|
111
|
+
constructor(config: ISessionConfig, core?: IAppInsightsCore, unloadHookContainer?: IUnloadHookContainer);
|
|
112
112
|
update(): void;
|
|
113
113
|
/**
|
|
114
114
|
* Record the current state of the automatic session and store it in our cookie string format
|
|
@@ -131,7 +131,7 @@ declare namespace ApplicationInsights {
|
|
|
131
131
|
web: IWeb;
|
|
132
132
|
appId: () => string;
|
|
133
133
|
getSessionId: () => string;
|
|
134
|
-
constructor(core: IAppInsightsCore, defaultConfig: IPropertiesConfig, previousTraceCtx?: IDistributedTraceContext);
|
|
134
|
+
constructor(core: IAppInsightsCore, defaultConfig: IPropertiesConfig, previousTraceCtx?: IDistributedTraceContext, unloadHookContainer?: IUnloadHookContainer);
|
|
135
135
|
applySessionContext(evt: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
|
|
136
136
|
applyOperatingSystemContxt(event: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
|
|
137
137
|
applyApplicationContext(event: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Application Insights JavaScript SDK - Properties Plugin, 3.0.0-beta.2301-
|
|
2
|
+
* Application Insights JavaScript SDK - Properties Plugin, 3.0.0-beta.2301-18
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
(function (global, factory) {
|
|
@@ -919,7 +919,6 @@
|
|
|
919
919
|
var _DYN_TIME = "time";
|
|
920
920
|
var _DYN_PROCESS_NEXT = "processNext";
|
|
921
921
|
var _DYN_GET_PROCESS_TEL_CONT0 = "getProcessTelContext";
|
|
922
|
-
var _DYN_CALL = "call";
|
|
923
922
|
var _DYN_LOGGING_LEVEL_CONSOL4 = "loggingLevelConsole";
|
|
924
923
|
var _DYN_CREATE_NEW = "createNew";
|
|
925
924
|
var _DYN_TEARDOWN = "teardown";
|
|
@@ -975,7 +974,7 @@
|
|
|
975
974
|
|
|
976
975
|
var strToString = "toString";
|
|
977
976
|
var _fnToString = ObjClass$1[strToString];
|
|
978
|
-
_fnToString
|
|
977
|
+
_fnToString.call(ObjClass$1);
|
|
979
978
|
var rCamelCase = /-([a-z])/g;
|
|
980
979
|
var rNormalizeInvalid = /([^\w\d_$])/g;
|
|
981
980
|
var rLeadingNumeric = /^(\d+[\w\d_$])/;
|
|
@@ -1197,7 +1196,7 @@
|
|
|
1197
1196
|
}
|
|
1198
1197
|
|
|
1199
1198
|
var _objDefineProperty = ObjDefineProperty;
|
|
1200
|
-
var version = "3.0.0-beta.2301-
|
|
1199
|
+
var version = "3.0.0-beta.2301-18";
|
|
1201
1200
|
var instanceName = "." + newId(6);
|
|
1202
1201
|
var _dataUid = 0;
|
|
1203
1202
|
function _createAccessor(target, prop, value) {
|
|
@@ -1393,6 +1392,10 @@
|
|
|
1393
1392
|
});
|
|
1394
1393
|
}
|
|
1395
1394
|
}
|
|
1395
|
+
function _getOwnPropGetter(target, name) {
|
|
1396
|
+
var propDesc = objGetOwnPropertyDescriptor(target, name);
|
|
1397
|
+
return propDesc && propDesc.get;
|
|
1398
|
+
}
|
|
1396
1399
|
function _makeDynamicProperty(state, theConfig, name, value) {
|
|
1397
1400
|
var detail = {
|
|
1398
1401
|
n: name,
|
|
@@ -1433,22 +1436,32 @@
|
|
|
1433
1436
|
};
|
|
1434
1437
|
function _setProperty(newValue) {
|
|
1435
1438
|
if (value !== newValue) {
|
|
1436
|
-
if (!!
|
|
1437
|
-
throwInvalidAccess("[" + name + "] is
|
|
1439
|
+
if (!!_getProperty[state.ro] && !state.upd) {
|
|
1440
|
+
throwInvalidAccess("[" + name + "] is read-only:" + dumpObj(theConfig));
|
|
1438
1441
|
}
|
|
1439
|
-
|
|
1440
|
-
|
|
1442
|
+
var isReferenced = _getProperty[state.rf];
|
|
1443
|
+
if (isPlainObject(value) || isArray(value)) {
|
|
1444
|
+
if (isReferenced) {
|
|
1445
|
+
objForEachKey(value, function (key) {
|
|
1446
|
+
value[key] = newValue[key];
|
|
1447
|
+
});
|
|
1448
|
+
objForEachKey(newValue, function (key, theValue) {
|
|
1449
|
+
_setDynamicProperty(state, value, key, theValue);
|
|
1450
|
+
});
|
|
1451
|
+
newValue = value;
|
|
1452
|
+
}
|
|
1453
|
+
else if (value && value[CFG_HANDLER_LINK]) {
|
|
1441
1454
|
objForEachKey(value, function (key) {
|
|
1442
|
-
var
|
|
1443
|
-
if (
|
|
1444
|
-
var valueState =
|
|
1455
|
+
var getter = _getOwnPropGetter(value, key);
|
|
1456
|
+
if (getter) {
|
|
1457
|
+
var valueState = getter[state.prop];
|
|
1445
1458
|
valueState && valueState.chng();
|
|
1446
1459
|
}
|
|
1447
1460
|
});
|
|
1448
1461
|
}
|
|
1449
1462
|
}
|
|
1450
1463
|
checkDynamic = false;
|
|
1451
|
-
if (isPlainObject(newValue) || isArray(newValue)) {
|
|
1464
|
+
if (!isReferenced && (isPlainObject(newValue) || isArray(newValue))) {
|
|
1452
1465
|
_makeDynamicObject(state, newValue);
|
|
1453
1466
|
}
|
|
1454
1467
|
value = newValue;
|
|
@@ -1456,20 +1469,27 @@
|
|
|
1456
1469
|
}
|
|
1457
1470
|
}
|
|
1458
1471
|
objDefineAccessors(theConfig, detail.n, _getProperty, _setProperty, true);
|
|
1472
|
+
return _getProperty();
|
|
1459
1473
|
}
|
|
1460
|
-
function _setDynamicProperty(state, target, name, value) {
|
|
1474
|
+
function _setDynamicProperty(state, target, name, value, inPlace, rdOnly) {
|
|
1461
1475
|
if (target) {
|
|
1462
|
-
var
|
|
1463
|
-
var
|
|
1464
|
-
if (propDesc && propDesc.get) {
|
|
1465
|
-
isDynamic = !!propDesc.get[state.prop];
|
|
1466
|
-
}
|
|
1476
|
+
var getter = _getOwnPropGetter(target, name);
|
|
1477
|
+
var isDynamic = getter && !!getter[state.prop];
|
|
1467
1478
|
if (!isDynamic) {
|
|
1468
|
-
_makeDynamicProperty(state, target, name, value);
|
|
1479
|
+
value = _makeDynamicProperty(state, target, name, value);
|
|
1480
|
+
if (inPlace || rdOnly) {
|
|
1481
|
+
getter = _getOwnPropGetter(target, name);
|
|
1482
|
+
}
|
|
1469
1483
|
}
|
|
1470
1484
|
else {
|
|
1471
1485
|
target[name] = value;
|
|
1472
1486
|
}
|
|
1487
|
+
if (inPlace) {
|
|
1488
|
+
getter[state.rf] = inPlace;
|
|
1489
|
+
}
|
|
1490
|
+
if (rdOnly) {
|
|
1491
|
+
getter[state.ro] = rdOnly;
|
|
1492
|
+
}
|
|
1473
1493
|
}
|
|
1474
1494
|
return value;
|
|
1475
1495
|
}
|
|
@@ -1494,8 +1514,10 @@
|
|
|
1494
1514
|
var symPrefix = "[[ai_";
|
|
1495
1515
|
var symPostfix = "]]";
|
|
1496
1516
|
function _createState(cfgHandler) {
|
|
1517
|
+
var _a;
|
|
1497
1518
|
var dynamicPropertySymbol = newSymbol(symPrefix + "get" + cfgHandler.uid + symPostfix);
|
|
1498
1519
|
var dynamicPropertyReadOnly = newSymbol(symPrefix + "ro" + cfgHandler.uid + symPostfix);
|
|
1520
|
+
var dynamicPropertyReferenced = newSymbol(symPrefix + "rf" + cfgHandler.uid + symPostfix);
|
|
1499
1521
|
var dynamicPropertyDetail = newSymbol(symPrefix + "dtl" + cfgHandler.uid + symPostfix);
|
|
1500
1522
|
var _waitingHandlers = null;
|
|
1501
1523
|
var _watcherTimer = null;
|
|
@@ -1513,7 +1535,9 @@
|
|
|
1513
1535
|
callback({
|
|
1514
1536
|
cfg: cfgHandler.cfg,
|
|
1515
1537
|
set: cfgHandler.set.bind(cfgHandler),
|
|
1516
|
-
setDf: cfgHandler[_DYN_SET_DF ].bind(cfgHandler)
|
|
1538
|
+
setDf: cfgHandler[_DYN_SET_DF ].bind(cfgHandler),
|
|
1539
|
+
ref: cfgHandler.ref.bind(cfgHandler),
|
|
1540
|
+
rdOnly: cfgHandler.rdOnly.bind(cfgHandler)
|
|
1517
1541
|
});
|
|
1518
1542
|
}
|
|
1519
1543
|
catch (e) {
|
|
@@ -1592,15 +1616,17 @@
|
|
|
1592
1616
|
}
|
|
1593
1617
|
}
|
|
1594
1618
|
}
|
|
1595
|
-
theState = {
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1619
|
+
theState = (_a = {
|
|
1620
|
+
prop: dynamicPropertySymbol,
|
|
1621
|
+
ro: dynamicPropertyReadOnly,
|
|
1622
|
+
rf: dynamicPropertyReferenced,
|
|
1623
|
+
hdlr: cfgHandler,
|
|
1624
|
+
add: _addWatcher
|
|
1625
|
+
},
|
|
1626
|
+
_a[_DYN_NOTIFY ] = _notifyWatchers,
|
|
1627
|
+
_a.use = _useHandler,
|
|
1628
|
+
_a.trk = _trackHandler,
|
|
1629
|
+
_a);
|
|
1604
1630
|
return theState;
|
|
1605
1631
|
}
|
|
1606
1632
|
|
|
@@ -1637,6 +1663,12 @@
|
|
|
1637
1663
|
function _block(configHandler) {
|
|
1638
1664
|
theState.use(null, configHandler);
|
|
1639
1665
|
}
|
|
1666
|
+
function _ref(target, name) {
|
|
1667
|
+
return _setDynamicProperty(theState, target, name, target[name], true);
|
|
1668
|
+
}
|
|
1669
|
+
function _rdOnly(target, name) {
|
|
1670
|
+
return _setDynamicProperty(theState, target, name, target[name], false, true);
|
|
1671
|
+
}
|
|
1640
1672
|
function _applyDefaults(theConfig, defaultValues) {
|
|
1641
1673
|
if (defaultValues) {
|
|
1642
1674
|
objForEachKey(defaultValues, function (name, value) {
|
|
@@ -1654,6 +1686,8 @@
|
|
|
1654
1686
|
_a.set = _setValue,
|
|
1655
1687
|
_a[_DYN_SET_DF ] = _applyDefaults,
|
|
1656
1688
|
_a[_DYN_WATCH ] = _watch,
|
|
1689
|
+
_a.ref = _ref,
|
|
1690
|
+
_a.rdOnly = _rdOnly,
|
|
1657
1691
|
_a._block = _block,
|
|
1658
1692
|
_a);
|
|
1659
1693
|
objDefineProp(cfgHandler, "uid", (_b = {},
|
|
@@ -2378,7 +2412,7 @@
|
|
|
2378
2412
|
if (onComplete && onComplete[_DYN_LENGTH$2 ] > 0) {
|
|
2379
2413
|
arrForEach(onComplete, function (completeDetails) {
|
|
2380
2414
|
try {
|
|
2381
|
-
completeDetails.func
|
|
2415
|
+
completeDetails.func.call(completeDetails.self, completeDetails.args);
|
|
2382
2416
|
}
|
|
2383
2417
|
catch (e) {
|
|
2384
2418
|
_throwInternal(core[_DYN_LOGGER ], 2 , 73 , "Unexpected Exception during onComplete - " + dumpObj(e));
|
|
@@ -2397,15 +2431,15 @@
|
|
|
2397
2431
|
if (!extCfg && createIfMissing) {
|
|
2398
2432
|
extCfg = {};
|
|
2399
2433
|
}
|
|
2400
|
-
|
|
2401
|
-
extCfg = cfg
|
|
2434
|
+
cfg[STR_EXTENSION_CONFIG] = extCfg;
|
|
2435
|
+
extCfg = dynamicHandler.ref(cfg, STR_EXTENSION_CONFIG);
|
|
2402
2436
|
if (extCfg) {
|
|
2403
2437
|
idCfg = extCfg[identifier];
|
|
2404
2438
|
if (!idCfg && createIfMissing) {
|
|
2405
2439
|
idCfg = {};
|
|
2406
2440
|
}
|
|
2407
|
-
|
|
2408
|
-
idCfg = extCfg
|
|
2441
|
+
extCfg[identifier] = idCfg;
|
|
2442
|
+
idCfg = dynamicHandler.ref(extCfg, identifier);
|
|
2409
2443
|
}
|
|
2410
2444
|
}
|
|
2411
2445
|
return idCfg;
|
|
@@ -2692,10 +2726,35 @@
|
|
|
2692
2726
|
};
|
|
2693
2727
|
}
|
|
2694
2728
|
|
|
2729
|
+
function createUnloadHookContainer() {
|
|
2730
|
+
var _hooks = [];
|
|
2731
|
+
function _doUnload(logger) {
|
|
2732
|
+
var oldHooks = _hooks;
|
|
2733
|
+
_hooks = [];
|
|
2734
|
+
arrForEach(oldHooks, function (fn) {
|
|
2735
|
+
try {
|
|
2736
|
+
(fn.rm || fn.remove).call(fn);
|
|
2737
|
+
}
|
|
2738
|
+
catch (e) {
|
|
2739
|
+
_throwInternal(logger, 2 , 73 , "Unloading:" + dumpObj(e));
|
|
2740
|
+
}
|
|
2741
|
+
});
|
|
2742
|
+
}
|
|
2743
|
+
function _addHook(hooks) {
|
|
2744
|
+
if (hooks) {
|
|
2745
|
+
arrAppend(_hooks, hooks);
|
|
2746
|
+
}
|
|
2747
|
+
}
|
|
2748
|
+
return {
|
|
2749
|
+
run: _doUnload,
|
|
2750
|
+
add: _addHook
|
|
2751
|
+
};
|
|
2752
|
+
}
|
|
2753
|
+
|
|
2695
2754
|
var _a$1;
|
|
2696
2755
|
var strGetPlugin = "getPlugin";
|
|
2697
2756
|
var defaultValues = (_a$1 = {},
|
|
2698
|
-
_a$1[STR_EXTENSION_CONFIG] = { isVal: isNotNullOrUndefined, v:
|
|
2757
|
+
_a$1[STR_EXTENSION_CONFIG] = { isVal: isNotNullOrUndefined, v: {} },
|
|
2699
2758
|
_a$1);
|
|
2700
2759
|
var BaseTelemetryPlugin = /** @class */ (function () {
|
|
2701
2760
|
function BaseTelemetryPlugin() {
|
|
@@ -2704,7 +2763,7 @@
|
|
|
2704
2763
|
var _rootCtx;
|
|
2705
2764
|
var _nextPlugin;
|
|
2706
2765
|
var _unloadHandlerContainer;
|
|
2707
|
-
var
|
|
2766
|
+
var _hookContainer;
|
|
2708
2767
|
_initDefaults();
|
|
2709
2768
|
dynamicProto(BaseTelemetryPlugin, _self, function (_self) {
|
|
2710
2769
|
_self[_DYN_INITIALIZE ] = function (config, core, extensions, pluginChain) {
|
|
@@ -2729,16 +2788,7 @@
|
|
|
2729
2788
|
if (!unloadDone) {
|
|
2730
2789
|
unloadDone = true;
|
|
2731
2790
|
_unloadHandlerContainer.run(theUnloadCtx, unloadState);
|
|
2732
|
-
|
|
2733
|
-
_hooks = [];
|
|
2734
|
-
arrForEach(oldHooks, function (fn) {
|
|
2735
|
-
try {
|
|
2736
|
-
(fn.rm || fn.remove)[_DYN_CALL ](fn);
|
|
2737
|
-
}
|
|
2738
|
-
catch (e) {
|
|
2739
|
-
_throwInternal(theUnloadCtx[_DYN_DIAG_LOG ](), 2 , 73 , "Unloading:" + dumpObj(e));
|
|
2740
|
-
}
|
|
2741
|
-
});
|
|
2791
|
+
_hookContainer.run(theUnloadCtx[_DYN_DIAG_LOG ]());
|
|
2742
2792
|
if (result === true) {
|
|
2743
2793
|
theUnloadCtx[_DYN_PROCESS_NEXT ](theUnloadState);
|
|
2744
2794
|
}
|
|
@@ -2778,12 +2828,9 @@
|
|
|
2778
2828
|
}
|
|
2779
2829
|
return result;
|
|
2780
2830
|
};
|
|
2781
|
-
_self._addHook = function (hooks) {
|
|
2782
|
-
if (hooks) {
|
|
2783
|
-
arrAppend(_hooks, hooks);
|
|
2784
|
-
}
|
|
2785
|
-
};
|
|
2786
2831
|
proxyFunctionAs(_self, "_addUnloadCb", function () { return _unloadHandlerContainer; }, "add");
|
|
2832
|
+
proxyFunctionAs(_self, "_addHook", function () { return _hookContainer; }, "add");
|
|
2833
|
+
objDefine(_self, "_unloadHooks", { g: function () { return _hookContainer; } });
|
|
2787
2834
|
});
|
|
2788
2835
|
_self[_DYN_DIAG_LOG ] = function (itemCtx) {
|
|
2789
2836
|
return _getTelCtx(itemCtx)[_DYN_DIAG_LOG ]();
|
|
@@ -2837,7 +2884,7 @@
|
|
|
2837
2884
|
_self[STR_CORE ] = null;
|
|
2838
2885
|
_rootCtx = null;
|
|
2839
2886
|
_nextPlugin = null;
|
|
2840
|
-
|
|
2887
|
+
_hookContainer = createUnloadHookContainer();
|
|
2841
2888
|
_unloadHandlerContainer = createUnloadHandlerContainer();
|
|
2842
2889
|
}
|
|
2843
2890
|
}
|
|
@@ -3225,12 +3272,13 @@
|
|
|
3225
3272
|
|
|
3226
3273
|
var Version = "2.8.5";
|
|
3227
3274
|
var Internal = /** @class */ (function () {
|
|
3228
|
-
function Internal(config) {
|
|
3275
|
+
function Internal(config, unloadHookContainer) {
|
|
3229
3276
|
var _this = this;
|
|
3230
|
-
onConfigChange((config), function () {
|
|
3277
|
+
var unloadHook = onConfigChange((config), function () {
|
|
3231
3278
|
var prefix = config.sdkExtension;
|
|
3232
3279
|
_this.sdkVersion = (prefix ? prefix + "_" : "") + "javascript:" + Version;
|
|
3233
3280
|
});
|
|
3281
|
+
unloadHookContainer && unloadHookContainer.add(unloadHook);
|
|
3234
3282
|
}
|
|
3235
3283
|
return Internal;
|
|
3236
3284
|
}());
|
|
@@ -3241,12 +3289,12 @@
|
|
|
3241
3289
|
return Location;
|
|
3242
3290
|
}());
|
|
3243
3291
|
|
|
3244
|
-
var _DYN_GET_TRACE_CTX = "getTraceCtx";
|
|
3245
|
-
var _DYN_TELEMETRY_TRACE = "telemetryTrace";
|
|
3246
3292
|
var _DYN_SESSION_MANAGER = "sessionManager";
|
|
3247
3293
|
var _DYN_UPDATE = "update";
|
|
3248
3294
|
var _DYN_IS_USER_COOKIE_SET = "isUserCookieSet";
|
|
3249
3295
|
var _DYN_IS_NEW_USER = "isNewUser";
|
|
3296
|
+
var _DYN_GET_TRACE_CTX = "getTraceCtx";
|
|
3297
|
+
var _DYN_TELEMETRY_TRACE = "telemetryTrace";
|
|
3250
3298
|
var _DYN_APPLY_SESSION_CONTEX0 = "applySessionContext";
|
|
3251
3299
|
var _DYN_APPLY_APPLICATION_CO1 = "applyApplicationContext";
|
|
3252
3300
|
var _DYN_APPLY_DEVICE_CONTEXT = "applyDeviceContext";
|
|
@@ -3281,15 +3329,25 @@
|
|
|
3281
3329
|
return Session;
|
|
3282
3330
|
}());
|
|
3283
3331
|
var _SessionManager = /** @class */ (function () {
|
|
3284
|
-
function _SessionManager(config, core) {
|
|
3332
|
+
function _SessionManager(config, core, unloadHookContainer) {
|
|
3285
3333
|
var self = this;
|
|
3334
|
+
var _storageNamePrefix;
|
|
3286
3335
|
var _cookieUpdatedTimestamp;
|
|
3287
3336
|
var _logger = safeGetLogger(core);
|
|
3288
3337
|
var _cookieManager = safeGetCookieMgr(core);
|
|
3338
|
+
var _sessionExpirationMs;
|
|
3339
|
+
var _sessionRenewalMs;
|
|
3289
3340
|
dynamicProto(_SessionManager, self, function (_self) {
|
|
3290
3341
|
if (!config) {
|
|
3291
3342
|
config = {};
|
|
3292
3343
|
}
|
|
3344
|
+
var unloadHook = onConfigChange(config, function (details) {
|
|
3345
|
+
_sessionExpirationMs = config.sessionExpirationMs || ACQUISITION_SPAN;
|
|
3346
|
+
_sessionRenewalMs = config.sessionRenewalMs || RENEWAL_SPAN;
|
|
3347
|
+
var sessionCookiePostfix = config.sessionCookiePostfix || config[_DYN_NAME_PREFIX ] || "";
|
|
3348
|
+
_storageNamePrefix = SESSION_COOKIE_NAME + sessionCookiePostfix;
|
|
3349
|
+
});
|
|
3350
|
+
unloadHookContainer && unloadHookContainer.add(unloadHook);
|
|
3293
3351
|
_self[_DYN_AUTOMATIC_SESSION ] = new Session();
|
|
3294
3352
|
_self[_DYN_UPDATE ] = function () {
|
|
3295
3353
|
var nowMs = utcNow();
|
|
@@ -3298,12 +3356,12 @@
|
|
|
3298
3356
|
if (!session.id) {
|
|
3299
3357
|
isExpired = !_initializeAutomaticSession(session);
|
|
3300
3358
|
}
|
|
3301
|
-
if (!isExpired && _sessionExpirationMs
|
|
3359
|
+
if (!isExpired && _sessionExpirationMs > 0) {
|
|
3302
3360
|
var timeSinceAcqMs = nowMs - session[_DYN_ACQUISITION_DATE ];
|
|
3303
3361
|
var timeSinceRenewalMs = nowMs - session[_DYN_RENEWAL_DATE ];
|
|
3304
3362
|
isExpired = timeSinceAcqMs < 0 || timeSinceRenewalMs < 0;
|
|
3305
|
-
isExpired = isExpired || timeSinceAcqMs > _sessionExpirationMs
|
|
3306
|
-
isExpired = isExpired || timeSinceRenewalMs > _sessionRenewalMs
|
|
3363
|
+
isExpired = isExpired || timeSinceAcqMs > _sessionExpirationMs;
|
|
3364
|
+
isExpired = isExpired || timeSinceRenewalMs > _sessionRenewalMs;
|
|
3307
3365
|
}
|
|
3308
3366
|
if (isExpired) {
|
|
3309
3367
|
_renew(nowMs);
|
|
@@ -3318,24 +3376,14 @@
|
|
|
3318
3376
|
var session = _self[_DYN_AUTOMATIC_SESSION ];
|
|
3319
3377
|
_setStorage(session.id, session[_DYN_ACQUISITION_DATE ], session[_DYN_RENEWAL_DATE ]);
|
|
3320
3378
|
};
|
|
3321
|
-
function _storageNamePrefix() {
|
|
3322
|
-
var sessionCookiePostfix = config.sessionCookiePostfix || config[_DYN_NAME_PREFIX ] || "";
|
|
3323
|
-
return SESSION_COOKIE_NAME + sessionCookiePostfix;
|
|
3324
|
-
}
|
|
3325
|
-
function _sessionExpirationMs() {
|
|
3326
|
-
return config.sessionExpirationMs || ACQUISITION_SPAN;
|
|
3327
|
-
}
|
|
3328
|
-
function _sessionRenewalMs() {
|
|
3329
|
-
return config.sessionRenewalMs || RENEWAL_SPAN;
|
|
3330
|
-
}
|
|
3331
3379
|
function _initializeAutomaticSession(session, now) {
|
|
3332
3380
|
var isValid = false;
|
|
3333
|
-
var cookieValue = _cookieManager.get(_storageNamePrefix
|
|
3381
|
+
var cookieValue = _cookieManager.get(_storageNamePrefix);
|
|
3334
3382
|
if (cookieValue && isFunction(cookieValue.split)) {
|
|
3335
3383
|
isValid = _initializeAutomaticSessionWithData(session, cookieValue);
|
|
3336
3384
|
}
|
|
3337
3385
|
else {
|
|
3338
|
-
var storageValue = utlGetLocalStorage(_logger, _storageNamePrefix
|
|
3386
|
+
var storageValue = utlGetLocalStorage(_logger, _storageNamePrefix);
|
|
3339
3387
|
if (storageValue) {
|
|
3340
3388
|
isValid = _initializeAutomaticSessionWithData(session, storageValue);
|
|
3341
3389
|
}
|
|
@@ -3381,8 +3429,8 @@
|
|
|
3381
3429
|
function _setCookie(session, nowMs) {
|
|
3382
3430
|
var acq = session[_DYN_ACQUISITION_DATE ];
|
|
3383
3431
|
session[_DYN_RENEWAL_DATE ] = nowMs;
|
|
3384
|
-
var renewalPeriodMs = _sessionRenewalMs
|
|
3385
|
-
var acqTimeLeftMs = (acq + _sessionExpirationMs
|
|
3432
|
+
var renewalPeriodMs = _sessionRenewalMs;
|
|
3433
|
+
var acqTimeLeftMs = (acq + _sessionExpirationMs) - nowMs;
|
|
3386
3434
|
var cookie = [session.id, acq, nowMs];
|
|
3387
3435
|
var maxAgeSec = 0;
|
|
3388
3436
|
if (acqTimeLeftMs < renewalPeriodMs) {
|
|
@@ -3392,11 +3440,11 @@
|
|
|
3392
3440
|
maxAgeSec = renewalPeriodMs / 1000;
|
|
3393
3441
|
}
|
|
3394
3442
|
var cookieDomain = config.cookieDomain || null;
|
|
3395
|
-
_cookieManager.set(_storageNamePrefix
|
|
3443
|
+
_cookieManager.set(_storageNamePrefix, cookie[_DYN_JOIN ]("|"), _sessionExpirationMs > 0 ? maxAgeSec : null, cookieDomain);
|
|
3396
3444
|
_cookieUpdatedTimestamp = nowMs;
|
|
3397
3445
|
}
|
|
3398
3446
|
function _setStorage(guid, acq, renewal) {
|
|
3399
|
-
utlSetLocalStorage(_logger, _storageNamePrefix
|
|
3447
|
+
utlSetLocalStorage(_logger, _storageNamePrefix, [guid, acq, renewal][_DYN_JOIN ]("|"));
|
|
3400
3448
|
}
|
|
3401
3449
|
});
|
|
3402
3450
|
}
|
|
@@ -3427,7 +3475,7 @@
|
|
|
3427
3475
|
return true;
|
|
3428
3476
|
}
|
|
3429
3477
|
var User = /** @class */ (function () {
|
|
3430
|
-
function User(config, core) {
|
|
3478
|
+
function User(config, core, unloadHookContainer) {
|
|
3431
3479
|
this.isNewUser = false;
|
|
3432
3480
|
this.isUserCookieSet = false;
|
|
3433
3481
|
var _logger = safeGetLogger(core);
|
|
@@ -3439,7 +3487,7 @@
|
|
|
3439
3487
|
enumerable: true,
|
|
3440
3488
|
get: function () { return config; }
|
|
3441
3489
|
});
|
|
3442
|
-
onConfigChange(config, function () {
|
|
3490
|
+
var unloadHook = onConfigChange(config, function () {
|
|
3443
3491
|
var userCookiePostfix = config[_DYN_USER_COOKIE_POSTFIX ] || "";
|
|
3444
3492
|
_storageNamePrefix = User.userCookieName + userCookiePostfix;
|
|
3445
3493
|
var cookie = _cookieManager.get(_storageNamePrefix);
|
|
@@ -3471,6 +3519,7 @@
|
|
|
3471
3519
|
}
|
|
3472
3520
|
}
|
|
3473
3521
|
});
|
|
3522
|
+
unloadHookContainer && unloadHookContainer.add(unloadHook);
|
|
3474
3523
|
function _generateNewId() {
|
|
3475
3524
|
var theConfig = (config || {});
|
|
3476
3525
|
var getNewId = theConfig[_DYN_GET_NEW_ID ] || newId;
|
|
@@ -3537,19 +3586,19 @@
|
|
|
3537
3586
|
return null;
|
|
3538
3587
|
}
|
|
3539
3588
|
var TelemetryContext = /** @class */ (function () {
|
|
3540
|
-
function TelemetryContext(core, defaultConfig, previousTraceCtx) {
|
|
3589
|
+
function TelemetryContext(core, defaultConfig, previousTraceCtx, unloadHookContainer) {
|
|
3541
3590
|
var _this = this;
|
|
3542
3591
|
var logger = core.logger;
|
|
3543
3592
|
dynamicProto(TelemetryContext, this, function (_self) {
|
|
3544
3593
|
_self.appId = _nullResult;
|
|
3545
3594
|
_self[_DYN_GET_SESSION_ID ] = _nullResult;
|
|
3546
3595
|
_self.application = new Application();
|
|
3547
|
-
_self.internal = new Internal(defaultConfig);
|
|
3596
|
+
_self.internal = new Internal(defaultConfig, unloadHookContainer);
|
|
3548
3597
|
if (hasWindow()) {
|
|
3549
|
-
_self[_DYN_SESSION_MANAGER ] = new _SessionManager(defaultConfig, core);
|
|
3598
|
+
_self[_DYN_SESSION_MANAGER ] = new _SessionManager(defaultConfig, core, unloadHookContainer);
|
|
3550
3599
|
_self.device = new Device();
|
|
3551
3600
|
_self.location = new Location();
|
|
3552
|
-
_self.user = new User(defaultConfig, core);
|
|
3601
|
+
_self.user = new User(defaultConfig, core, unloadHookContainer);
|
|
3553
3602
|
var traceId = void 0;
|
|
3554
3603
|
var parentId = void 0;
|
|
3555
3604
|
var name_1;
|
|
@@ -3660,9 +3709,7 @@
|
|
|
3660
3709
|
var _a;
|
|
3661
3710
|
var undefString;
|
|
3662
3711
|
var nullValue = null;
|
|
3663
|
-
var _defaultConfig = objDeepFreeze((_a = {
|
|
3664
|
-
instrumentationKey: undefString
|
|
3665
|
-
},
|
|
3712
|
+
var _defaultConfig = objDeepFreeze((_a = {},
|
|
3666
3713
|
_a[_DYN_ACCOUNT_ID ] = nullValue,
|
|
3667
3714
|
_a.sessionRenewalMs = 30 * 60 * 1000,
|
|
3668
3715
|
_a.samplingPercentage = 100,
|
|
@@ -3700,14 +3747,6 @@
|
|
|
3700
3747
|
_self.initialize = function (config, core, extensions, pluginChain) {
|
|
3701
3748
|
_base.initialize(config, core, extensions, pluginChain);
|
|
3702
3749
|
_populateDefaults(config);
|
|
3703
|
-
_previousTraceCtx = core[_DYN_GET_TRACE_CTX ](false);
|
|
3704
|
-
_context = new TelemetryContext(core, _extensionConfig, _previousTraceCtx);
|
|
3705
|
-
_distributedTraceCtx = createDistributedTraceContextFromTrace(_self.context[_DYN_TELEMETRY_TRACE ], _previousTraceCtx);
|
|
3706
|
-
core.setTraceCtx(_distributedTraceCtx);
|
|
3707
|
-
_self.context.appId = function () {
|
|
3708
|
-
var breezeChannel = core.getPlugin(BreezeChannelIdentifier);
|
|
3709
|
-
return breezeChannel ? breezeChannel.plugin["_appId"] : null;
|
|
3710
|
-
};
|
|
3711
3750
|
};
|
|
3712
3751
|
_self.processTelemetry = function (event, itemCtx) {
|
|
3713
3752
|
if (!isNullOrUndefined(event)) {
|
|
@@ -3758,6 +3797,14 @@
|
|
|
3758
3797
|
_extensionConfig = ctx.getExtCfg(identifier, _defaultConfig);
|
|
3759
3798
|
_self["_extConfig"] = _extensionConfig;
|
|
3760
3799
|
}));
|
|
3800
|
+
_previousTraceCtx = core[_DYN_GET_TRACE_CTX ](false);
|
|
3801
|
+
_context = new TelemetryContext(core, _extensionConfig, _previousTraceCtx, _self._unloadHooks);
|
|
3802
|
+
_distributedTraceCtx = createDistributedTraceContextFromTrace(_self.context[_DYN_TELEMETRY_TRACE ], _previousTraceCtx);
|
|
3803
|
+
core.setTraceCtx(_distributedTraceCtx);
|
|
3804
|
+
_self.context.appId = function () {
|
|
3805
|
+
var breezeChannel = core.getPlugin(BreezeChannelIdentifier);
|
|
3806
|
+
return breezeChannel ? breezeChannel.plugin["_appId"] : null;
|
|
3807
|
+
};
|
|
3761
3808
|
}
|
|
3762
3809
|
function _processTelemetryInternal(evt, itemCtx) {
|
|
3763
3810
|
getSetValue(evt, "tags", []);
|