@microsoft/applicationinsights-core-js 3.0.0-beta.2208-03 → 3.0.0-beta.2208-16
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 +7 -0
- package/browser/applicationinsights-core-js.integrity.json +9 -9
- package/browser/applicationinsights-core-js.js +2040 -2155
- package/browser/applicationinsights-core-js.js.map +1 -1
- package/browser/applicationinsights-core-js.min.js +2 -2
- package/browser/applicationinsights-core-js.min.js.map +1 -1
- package/dist/applicationinsights-core-js.api.json +6998 -10817
- package/dist/applicationinsights-core-js.api.md +88 -177
- package/dist/applicationinsights-core-js.d.ts +94 -494
- package/dist/applicationinsights-core-js.js +2040 -2155
- package/dist/applicationinsights-core-js.js.map +1 -1
- package/dist/applicationinsights-core-js.min.js +2 -2
- package/dist/applicationinsights-core-js.min.js.map +1 -1
- package/dist/applicationinsights-core-js.rollup.d.ts +94 -494
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js +2 -2
- package/dist-esm/JavaScriptSDK/AppInsightsCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK/BaseCore.js +11 -12
- package/dist-esm/JavaScriptSDK/BaseCore.js.map +1 -1
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js +3 -2
- package/dist-esm/JavaScriptSDK/BaseTelemetryPlugin.js.map +1 -1
- package/dist-esm/JavaScriptSDK/ChannelController.js +2 -2
- package/dist-esm/JavaScriptSDK/ChannelController.js.map +1 -1
- package/dist-esm/JavaScriptSDK/CookieMgr.js +27 -26
- package/dist-esm/JavaScriptSDK/CookieMgr.js.map +1 -1
- package/dist-esm/JavaScriptSDK/CoreUtils.js +8 -140
- package/dist-esm/JavaScriptSDK/CoreUtils.js.map +1 -1
- package/dist-esm/JavaScriptSDK/DataCacheHelper.js +2 -2
- package/dist-esm/JavaScriptSDK/DataCacheHelper.js.map +1 -1
- package/dist-esm/JavaScriptSDK/DbgExtensionUtils.js +3 -3
- package/dist-esm/JavaScriptSDK/DbgExtensionUtils.js.map +1 -1
- package/dist-esm/JavaScriptSDK/DiagnosticLogger.js +4 -3
- package/dist-esm/JavaScriptSDK/DiagnosticLogger.js.map +1 -1
- package/dist-esm/JavaScriptSDK/EnvUtils.js +132 -136
- package/dist-esm/JavaScriptSDK/EnvUtils.js.map +1 -1
- package/dist-esm/JavaScriptSDK/EventHelpers.js +2 -3
- package/dist-esm/JavaScriptSDK/EventHelpers.js.map +1 -1
- package/dist-esm/JavaScriptSDK/HelperFuncs.js +23 -470
- package/dist-esm/JavaScriptSDK/HelperFuncs.js.map +1 -1
- package/dist-esm/JavaScriptSDK/InstrumentHooks.js +5 -5
- package/dist-esm/JavaScriptSDK/InstrumentHooks.js.map +1 -1
- package/dist-esm/JavaScriptSDK/InternalConstants.js +4 -4
- package/dist-esm/JavaScriptSDK/InternalConstants.js.map +1 -1
- package/dist-esm/JavaScriptSDK/NotificationManager.js +2 -2
- package/dist-esm/JavaScriptSDK/NotificationManager.js.map +1 -1
- package/dist-esm/JavaScriptSDK/PerfManager.js +4 -8
- package/dist-esm/JavaScriptSDK/PerfManager.js.map +1 -1
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js +3 -3
- package/dist-esm/JavaScriptSDK/ProcessTelemetryContext.js.map +1 -1
- package/dist-esm/JavaScriptSDK/RandomHelper.js +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js +2 -2
- package/dist-esm/JavaScriptSDK/TelemetryHelpers.js.map +1 -1
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js +3 -3
- package/dist-esm/JavaScriptSDK/TelemetryInitializerPlugin.js.map +1 -1
- package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js +2 -3
- package/dist-esm/JavaScriptSDK/UnloadHandlerContainer.js.map +1 -1
- package/dist-esm/JavaScriptSDK/W3cTraceParent.js +2 -2
- package/dist-esm/JavaScriptSDK/W3cTraceParent.js.map +1 -1
- package/dist-esm/JavaScriptSDK.Enums/EnumHelperFuncs.js +5 -31
- package/dist-esm/JavaScriptSDK.Enums/EnumHelperFuncs.js.map +1 -1
- package/dist-esm/JavaScriptSDK.Enums/EventsDiscardedReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/LoggingEnums.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/SendRequestReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUnloadReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Enums/TelemetryUpdateReason.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IAppInsightsCore.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IChannelControls.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IConfiguration.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ICookieMgr.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IDbgExtension.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IDiagnosticLogger.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IDistributedTraceContext.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IInstrumentHooks.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/INotificationListener.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/INotificationManager.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IPerfEvent.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IPerfManager.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IProcessTelemetryContext.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryInitializers.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryItem.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPlugin.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryPluginChain.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUnloadState.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITelemetryUpdateState.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/ITraceParent.js +1 -1
- package/dist-esm/JavaScriptSDK.Interfaces/IUnloadableComponent.js +1 -1
- package/dist-esm/__DynamicConstants.js +11 -13
- package/dist-esm/__DynamicConstants.js.map +1 -1
- package/dist-esm/applicationinsights-core-js.js +6 -5
- package/dist-esm/applicationinsights-core-js.js.map +1 -1
- package/package.json +4 -3
- package/src/JavaScriptSDK/AppInsightsCore.ts +1 -1
- package/src/JavaScriptSDK/BaseCore.ts +2 -4
- package/src/JavaScriptSDK/BaseTelemetryPlugin.ts +2 -1
- package/src/JavaScriptSDK/ChannelController.ts +1 -1
- package/src/JavaScriptSDK/CookieMgr.ts +6 -5
- package/src/JavaScriptSDK/CoreUtils.ts +7 -423
- package/src/JavaScriptSDK/DbgExtensionUtils.ts +2 -2
- package/src/JavaScriptSDK/DiagnosticLogger.ts +3 -2
- package/src/JavaScriptSDK/EnvUtils.ts +145 -148
- package/src/JavaScriptSDK/EventHelpers.ts +1 -2
- package/src/JavaScriptSDK/HelperFuncs.ts +22 -536
- package/src/JavaScriptSDK/InstrumentHooks.ts +4 -4
- package/src/JavaScriptSDK/InternalConstants.ts +3 -3
- package/src/JavaScriptSDK/NotificationManager.ts +1 -1
- package/src/JavaScriptSDK/PerfManager.ts +3 -7
- package/src/JavaScriptSDK/ProcessTelemetryContext.ts +4 -4
- package/src/JavaScriptSDK/TelemetryHelpers.ts +1 -1
- package/src/JavaScriptSDK/TelemetryInitializerPlugin.ts +2 -2
- package/src/JavaScriptSDK/UnloadHandlerContainer.ts +1 -2
- package/src/JavaScriptSDK/W3cTraceParent.ts +1 -1
- package/src/JavaScriptSDK.Enums/EnumHelperFuncs.ts +5 -36
- package/src/JavaScriptSDK.Interfaces/ITelemetryPlugin.ts +7 -0
- package/tsconfig.json +1 -1
- package/types/JavaScriptSDK/CoreUtils.d.ts +0 -270
- package/types/JavaScriptSDK/EnvUtils.d.ts +0 -65
- package/types/JavaScriptSDK/HelperFuncs.d.ts +3 -154
- package/types/JavaScriptSDK.Enums/EnumHelperFuncs.d.ts +6 -18
- package/types/JavaScriptSDK.Interfaces/ITelemetryPlugin.d.ts +6 -0
- package/types/__DynamicConstants.d.ts +2 -4
- package/types/applicationinsights-core-js.d.ts +5 -4
- package/types/tsdoc-metadata.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Application Insights JavaScript SDK - Core, 3.0.0-beta.2208-
|
|
2
|
+
* Application Insights JavaScript SDK - Core, 3.0.0-beta.2208-16
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
export { MinChannelPriorty } from "./JavaScriptSDK.Interfaces/IChannelControls";
|
|
@@ -8,11 +8,12 @@ export { AppInsightsCore } from "./JavaScriptSDK/AppInsightsCore";
|
|
|
8
8
|
export { BaseCore } from "./JavaScriptSDK/BaseCore";
|
|
9
9
|
export { BaseTelemetryPlugin } from "./JavaScriptSDK/BaseTelemetryPlugin";
|
|
10
10
|
export { randomValue, random32, mwcRandomSeed, mwcRandom32, newId } from "./JavaScriptSDK/RandomHelper";
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
11
|
+
export { Undefined, newGuid, perfNow, generateW3CId } from "./JavaScriptSDK/CoreUtils";
|
|
12
|
+
export { normalizeJsName, toISOString, dateNow, getExceptionName, strContains, setValue, getSetValue, proxyAssign, proxyFunctions, proxyFunctionAs, createClassFromInterface, optimizeObject, isNotUndefined, isNotNullOrUndefined, objExtend } from "./JavaScriptSDK/HelperFuncs";
|
|
13
|
+
export { isArray, isTypeof, isUndefined, isNullOrUndefined, objHasOwnProperty as hasOwnProperty, isObject, isFunction, objForEachKey, strEndsWith, strStartsWith, isDate, isError, isString, isNumber, isBoolean, arrForEach, arrIndexOf, arrReduce, arrMap, strTrim, objKeys, objDefineAccessors, throwError, isSymbol, isNotTruthy, isTruthy, objFreeze, objSeal, objToString, objDeepFreeze as deepFreeze, getInst as getGlobalInst, hasWindow, getWindow, hasDocument, getDocument, hasNavigator, getNavigator, hasHistory, getHistory, dumpObj } from "@nevware21/ts-utils";
|
|
14
|
+
export { createEnumStyle, createValueMap } from "./JavaScriptSDK.Enums/EnumHelperFuncs";
|
|
14
15
|
export { attachEvent, detachEvent, addEventHandler, addEventListeners, addPageUnloadEventListener, addPageHideEventListener, addPageShowEventListener, removeEventHandler, removeEventListeners, removePageUnloadEventListener, removePageHideEventListener, removePageShowEventListener, eventOn, eventOff, mergeEvtNamespace, __getRegisteredEvents } from "./JavaScriptSDK/EventHelpers";
|
|
15
|
-
export {
|
|
16
|
+
export { getCrypto, getMsCrypto, getLocation, getPerformance, hasJSON, getJSON, isReactNative, getConsole, isIE, getIEVersion, isSafari, setEnableEnvMocks, isBeaconsSupported, isFetchSupported, useXDomainRequest, isXhrSupported, findMetaTag, findNamedServerTiming } from "./JavaScriptSDK/EnvUtils";
|
|
16
17
|
export { getGlobal, objCreateFn as objCreate, strShimPrototype as strPrototype, strShimFunction as strFunction, strShimUndefined as strUndefined, strShimObject as strObject } from "@microsoft/applicationinsights-shims";
|
|
17
18
|
export { NotificationManager } from "./JavaScriptSDK/NotificationManager";
|
|
18
19
|
export { PerfEvent, PerfManager, doPerf, getGblPerfMgr, setGblPerfMgr } from "./JavaScriptSDK/PerfManager";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applicationinsights-core-js.js.map","sources":["applicationinsights-core-js.js"],"sourcesContent":["export { MinChannelPriorty } from \"./JavaScriptSDK.Interfaces/IChannelControls\";\r\nexport { EventsDiscardedReason } from \"./JavaScriptSDK.Enums/EventsDiscardedReason\";\r\nexport { AppInsightsCore } from \"./JavaScriptSDK/AppInsightsCore\";\r\nexport { BaseCore } from \"./JavaScriptSDK/BaseCore\";\r\nexport { BaseTelemetryPlugin } from \"./JavaScriptSDK/BaseTelemetryPlugin\";\r\nexport { randomValue, random32, mwcRandomSeed, mwcRandom32, newId } from \"./JavaScriptSDK/RandomHelper\";\r\nexport { CoreUtils,
|
|
1
|
+
{"version":3,"file":"applicationinsights-core-js.js.map","sources":["applicationinsights-core-js.js"],"sourcesContent":["export { MinChannelPriorty } from \"./JavaScriptSDK.Interfaces/IChannelControls\";\r\nexport { EventsDiscardedReason } from \"./JavaScriptSDK.Enums/EventsDiscardedReason\";\r\nexport { AppInsightsCore } from \"./JavaScriptSDK/AppInsightsCore\";\r\nexport { BaseCore } from \"./JavaScriptSDK/BaseCore\";\r\nexport { BaseTelemetryPlugin } from \"./JavaScriptSDK/BaseTelemetryPlugin\";\r\nexport { randomValue, random32, mwcRandomSeed, mwcRandom32, newId } from \"./JavaScriptSDK/RandomHelper\";\r\nexport { Undefined, newGuid, perfNow, generateW3CId } from \"./JavaScriptSDK/CoreUtils\";\r\nexport { normalizeJsName, toISOString, dateNow, getExceptionName, strContains, setValue, getSetValue, proxyAssign, proxyFunctions, proxyFunctionAs, createClassFromInterface, optimizeObject, isNotUndefined, isNotNullOrUndefined, objExtend } from \"./JavaScriptSDK/HelperFuncs\";\r\nexport { isArray, isTypeof, isUndefined, isNullOrUndefined, objHasOwnProperty as hasOwnProperty, isObject, isFunction, objForEachKey, strEndsWith, strStartsWith, isDate, isError, isString, isNumber, isBoolean, arrForEach, arrIndexOf, arrReduce, arrMap, strTrim, objKeys, objDefineAccessors, throwError, isSymbol, isNotTruthy, isTruthy, objFreeze, objSeal, objToString, objDeepFreeze as deepFreeze, getInst as getGlobalInst, hasWindow, getWindow, hasDocument, getDocument, hasNavigator, getNavigator, hasHistory, getHistory, dumpObj } from \"@nevware21/ts-utils\";\r\nexport { createEnumStyle, createValueMap } from \"./JavaScriptSDK.Enums/EnumHelperFuncs\";\r\nexport { attachEvent, detachEvent, addEventHandler, addEventListeners, addPageUnloadEventListener, addPageHideEventListener, addPageShowEventListener, removeEventHandler, removeEventListeners, removePageUnloadEventListener, removePageHideEventListener, removePageShowEventListener, eventOn, eventOff, mergeEvtNamespace, __getRegisteredEvents } from \"./JavaScriptSDK/EventHelpers\";\r\nexport { getCrypto, getMsCrypto, getLocation, getPerformance, hasJSON, getJSON, isReactNative, getConsole, isIE, getIEVersion, isSafari, setEnableEnvMocks, isBeaconsSupported, isFetchSupported, useXDomainRequest, isXhrSupported, findMetaTag, findNamedServerTiming } from \"./JavaScriptSDK/EnvUtils\";\r\nexport { getGlobal, objCreateFn as objCreate, strShimPrototype as strPrototype, strShimFunction as strFunction, strShimUndefined as strUndefined, strShimObject as strObject } from \"@microsoft/applicationinsights-shims\";\r\nexport { NotificationManager } from \"./JavaScriptSDK/NotificationManager\";\r\nexport { PerfEvent, PerfManager, doPerf, getGblPerfMgr, setGblPerfMgr } from \"./JavaScriptSDK/PerfManager\";\r\nexport { safeGetLogger, DiagnosticLogger, _InternalLogMessage, _throwInternal, _warnToConsole, _logInternalMessage } from \"./JavaScriptSDK/DiagnosticLogger\";\r\nexport { ProcessTelemetryContext, createProcessTelemetryContext\r\n// Explicitly NOT exporting createProcessTelemetryUnloadContext() and createProcessTelemetryUpdateContext() as these should only be created internally\r\n } from \"./JavaScriptSDK/ProcessTelemetryContext\";\r\nexport { initializePlugins, sortPlugins, unloadComponents } from \"./JavaScriptSDK/TelemetryHelpers\";\r\nexport { _InternalMessageId, LoggingSeverity } from \"./JavaScriptSDK.Enums/LoggingEnums\";\r\nexport { InstrumentProto, InstrumentProtos, InstrumentFunc, InstrumentFuncs, InstrumentEvent } from \"./JavaScriptSDK/InstrumentHooks\";\r\nexport { createCookieMgr, safeGetCookieMgr, uaDisallowsSameSiteNone, areCookiesSupported } from \"./JavaScriptSDK/CookieMgr\";\r\nexport { getDebugListener, getDebugExt } from \"./JavaScriptSDK/DbgExtensionUtils\";\r\nexport { createUniqueNamespace } from \"./JavaScriptSDK/DataCacheHelper\";\r\nexport { createUnloadHandlerContainer } from \"./JavaScriptSDK/UnloadHandlerContainer\";\r\nexport { createTraceParent, parseTraceParent, isValidTraceId, isValidSpanId, isValidTraceParent, isSampledFlag, formatTraceParent, findW3cTraceParent } from \"./JavaScriptSDK/W3cTraceParent\";\r\n//# sourceMappingURL=applicationinsights-core-js.js.map"],"names":[],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/applicationinsights-core-js",
|
|
3
3
|
"author": "Microsoft Application Insights Team",
|
|
4
|
-
"version": "3.0.0-beta.2208-
|
|
4
|
+
"version": "3.0.0-beta.2208-16",
|
|
5
5
|
"description": "Microsoft Application Insights Core Javascript SDK",
|
|
6
6
|
"homepage": "https://github.com/microsoft/ApplicationInsights-JS#readme",
|
|
7
7
|
"keywords": [
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@microsoft/ai-test-framework": "0.0.1",
|
|
42
42
|
"@microsoft/applicationinsights-rollup-plugin-uglify3-js": "1.0.0",
|
|
43
|
-
"@microsoft/applicationinsights-rollup-
|
|
43
|
+
"@microsoft/applicationinsights-rollup-es5": "1.0.0",
|
|
44
44
|
"@microsoft/api-extractor": "^7.18.1",
|
|
45
45
|
"grunt": "^1.5.3",
|
|
46
46
|
"grunt-cli": "^1.4.3",
|
|
@@ -65,7 +65,8 @@
|
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"@microsoft/applicationinsights-shims": "2.0.1",
|
|
68
|
-
"@microsoft/dynamicproto-js": "^1.1.6"
|
|
68
|
+
"@microsoft/dynamicproto-js": "^1.1.6",
|
|
69
|
+
"@nevware21/ts-utils": "^0.4.1"
|
|
69
70
|
},
|
|
70
71
|
"publishConfig": {
|
|
71
72
|
"tag": "beta"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
import dynamicProto from "@microsoft/dynamicproto-js";
|
|
4
|
+
import { isNullOrUndefined, throwError } from "@nevware21/ts-utils";
|
|
4
5
|
import { eEventsDiscardedReason } from "../JavaScriptSDK.Enums/EventsDiscardedReason";
|
|
5
6
|
import { IAppInsightsCore } from "../JavaScriptSDK.Interfaces/IAppInsightsCore";
|
|
6
7
|
import { IConfiguration } from "../JavaScriptSDK.Interfaces/IConfiguration";
|
|
@@ -10,7 +11,6 @@ import { ITelemetryItem } from "../JavaScriptSDK.Interfaces/ITelemetryItem";
|
|
|
10
11
|
import { IPlugin } from "../JavaScriptSDK.Interfaces/ITelemetryPlugin";
|
|
11
12
|
import { BaseCore } from "./BaseCore";
|
|
12
13
|
import { DiagnosticLogger } from "./DiagnosticLogger";
|
|
13
|
-
import { isNullOrUndefined, throwError } from "./HelperFuncs";
|
|
14
14
|
import { NotificationManager } from "./NotificationManager";
|
|
15
15
|
import { doPerf } from "./PerfManager";
|
|
16
16
|
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import dynamicProto from "@microsoft/dynamicproto-js";
|
|
6
6
|
import { objCreateFn } from "@microsoft/applicationinsights-shims";
|
|
7
|
+
import { arrForEach, arrIndexOf, isFunction, isNullOrUndefined, objFreeze, throwError } from "@nevware21/ts-utils";
|
|
7
8
|
import { _eInternalMessageId, eLoggingSeverity } from "../JavaScriptSDK.Enums/LoggingEnums";
|
|
8
9
|
import { SendRequestReason } from "../JavaScriptSDK.Enums/SendRequestReason";
|
|
9
10
|
import { TelemetryUnloadReason } from "../JavaScriptSDK.Enums/TelemetryUnloadReason";
|
|
@@ -32,10 +33,7 @@ import { createCookieMgr } from "./CookieMgr";
|
|
|
32
33
|
import { createUniqueNamespace } from "./DataCacheHelper";
|
|
33
34
|
import { getDebugListener } from "./DbgExtensionUtils";
|
|
34
35
|
import { DiagnosticLogger, _InternalLogMessage, _throwInternal, _warnToConsole } from "./DiagnosticLogger";
|
|
35
|
-
import {
|
|
36
|
-
arrForEach, arrIndexOf, getCfgValue, getSetValue, isFunction, isNullOrUndefined, objExtend, objFreeze, proxyFunctionAs, proxyFunctions,
|
|
37
|
-
throwError, toISOString
|
|
38
|
-
} from "./HelperFuncs";
|
|
36
|
+
import { getCfgValue, getSetValue, objExtend, proxyFunctionAs, proxyFunctions, toISOString } from "./HelperFuncs";
|
|
39
37
|
import { STR_CHANNELS, STR_CREATE_PERF_MGR, STR_DISABLED, STR_EXTENSIONS, STR_EXTENSION_CONFIG } from "./InternalConstants";
|
|
40
38
|
import { PerfManager, getGblPerfMgr } from "./PerfManager";
|
|
41
39
|
import {
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
"use strict";
|
|
4
4
|
|
|
5
5
|
import dynamicProto from "@microsoft/dynamicproto-js";
|
|
6
|
+
import { arrForEach, isArray, isFunction, isNullOrUndefined } from "@nevware21/ts-utils";
|
|
6
7
|
import { TelemetryUnloadReason } from "../JavaScriptSDK.Enums/TelemetryUnloadReason";
|
|
7
8
|
import { TelemetryUpdateReason } from "../JavaScriptSDK.Enums/TelemetryUpdateReason";
|
|
8
9
|
import { IAppInsightsCore } from "../JavaScriptSDK.Interfaces/IAppInsightsCore";
|
|
@@ -17,7 +18,7 @@ import { IPlugin, ITelemetryPlugin } from "../JavaScriptSDK.Interfaces/ITelemetr
|
|
|
17
18
|
import { ITelemetryPluginChain } from "../JavaScriptSDK.Interfaces/ITelemetryPluginChain";
|
|
18
19
|
import { ITelemetryUnloadState } from "../JavaScriptSDK.Interfaces/ITelemetryUnloadState";
|
|
19
20
|
import { ITelemetryUpdateState } from "../JavaScriptSDK.Interfaces/ITelemetryUpdateState";
|
|
20
|
-
import {
|
|
21
|
+
import { proxyFunctionAs, setValue } from "./HelperFuncs";
|
|
21
22
|
import { STR_EXTENSION_CONFIG } from "./InternalConstants";
|
|
22
23
|
import {
|
|
23
24
|
createProcessTelemetryContext, createProcessTelemetryUnloadContext, createProcessTelemetryUpdateContext
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
2
|
// // Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
+
import { arrForEach, isArray, objFreeze, throwError } from "@nevware21/ts-utils";
|
|
4
5
|
import { SendRequestReason } from "../JavaScriptSDK.Enums/SendRequestReason";
|
|
5
6
|
import { TelemetryUnloadReason } from "../JavaScriptSDK.Enums/TelemetryUnloadReason";
|
|
6
7
|
import { TelemetryUpdateReason } from "../JavaScriptSDK.Enums/TelemetryUpdateReason";
|
|
@@ -15,7 +16,6 @@ import { IPlugin } from "../JavaScriptSDK.Interfaces/ITelemetryPlugin";
|
|
|
15
16
|
import { ITelemetryPluginChain } from "../JavaScriptSDK.Interfaces/ITelemetryPluginChain";
|
|
16
17
|
import { ITelemetryUnloadState } from "../JavaScriptSDK.Interfaces/ITelemetryUnloadState";
|
|
17
18
|
import { ITelemetryUpdateState } from "../JavaScriptSDK.Interfaces/ITelemetryUpdateState";
|
|
18
|
-
import { arrForEach, isArray, objFreeze, throwError } from "./HelperFuncs";
|
|
19
19
|
import { createProcessTelemetryContext, createTelemetryProxyChain } from "./ProcessTelemetryContext";
|
|
20
20
|
import { initializePlugins } from "./TelemetryHelpers";
|
|
21
21
|
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
|
+
import {
|
|
4
|
+
arrForEach, dumpObj, getDocument, getNavigator, isFunction, isNullOrUndefined, isString, isTruthy, isUndefined, objForEachKey,
|
|
5
|
+
strEndsWith, strTrim
|
|
6
|
+
} from "@nevware21/ts-utils";
|
|
3
7
|
import { _eInternalMessageId, eLoggingSeverity } from "../JavaScriptSDK.Enums/LoggingEnums";
|
|
4
8
|
import { IAppInsightsCore } from "../JavaScriptSDK.Interfaces/IAppInsightsCore";
|
|
5
9
|
import { IConfiguration } from "../JavaScriptSDK.Interfaces/IConfiguration";
|
|
6
10
|
import { ICookieMgr, ICookieMgrConfig } from "../JavaScriptSDK.Interfaces/ICookieMgr";
|
|
7
11
|
import { IDiagnosticLogger } from "../JavaScriptSDK.Interfaces/IDiagnosticLogger";
|
|
8
12
|
import { _throwInternal } from "./DiagnosticLogger";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
arrForEach, dateNow, getExceptionName, isFunction, isNotNullOrUndefined, isNullOrUndefined, isString, isTruthy, isUndefined,
|
|
12
|
-
objForEachKey, setValue, strContains, strEndsWith, strTrim
|
|
13
|
-
} from "./HelperFuncs";
|
|
13
|
+
import { getLocation, isIE } from "./EnvUtils";
|
|
14
|
+
import { dateNow, getExceptionName, isNotNullOrUndefined, setValue, strContains } from "./HelperFuncs";
|
|
14
15
|
import { STR_EMPTY } from "./InternalConstants";
|
|
15
16
|
|
|
16
17
|
const strToGMTString = "toGMTString";
|
|
@@ -1,34 +1,19 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
"use strict";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { IDiagnosticLogger } from "../JavaScriptSDK.Interfaces/IDiagnosticLogger";
|
|
8
|
-
import { _gblCookieMgr } from "./CookieMgr";
|
|
9
|
-
import { getPerformance, isIE } from "./EnvUtils";
|
|
10
|
-
import { addEventHandler, attachEvent, detachEvent } from "./EventHelpers";
|
|
11
|
-
import {
|
|
12
|
-
arrForEach, arrIndexOf, arrMap, arrReduce, dateNow, hasOwnProperty, isArray, isBoolean, isDate, isError, isFunction, isNullOrUndefined,
|
|
13
|
-
isNumber, isObject, isString, isTypeof, isUndefined, objDefineAccessors, objKeys, strTrim, toISOString
|
|
14
|
-
} from "./HelperFuncs";
|
|
4
|
+
import { strShimUndefined } from "@microsoft/applicationinsights-shims";
|
|
5
|
+
import { getPerformance } from "./EnvUtils";
|
|
6
|
+
import { dateNow } from "./HelperFuncs";
|
|
15
7
|
import { STR_EMPTY } from "./InternalConstants";
|
|
16
|
-
import {
|
|
8
|
+
import { random32 } from "./RandomHelper";
|
|
17
9
|
|
|
18
|
-
let _cookieMgrs: ICookieMgr[] = null;
|
|
19
|
-
let _canUseCookies: boolean; // legacy supported config
|
|
20
|
-
|
|
21
10
|
// Added to help with minfication
|
|
22
11
|
export const Undefined = strShimUndefined;
|
|
12
|
+
|
|
23
13
|
export function newGuid(): string {
|
|
24
|
-
|
|
25
|
-
return randomValue(15); // Get a random value from 0..15
|
|
26
|
-
}
|
|
14
|
+
const uuid = generateW3CId();
|
|
27
15
|
|
|
28
|
-
return "
|
|
29
|
-
const r = (randomHexDigit() | 0), v = (c === "x" ? r : r & 0x3 | 0x8);
|
|
30
|
-
return v.toString(16);
|
|
31
|
-
});
|
|
16
|
+
return uuid.substring(0, 8) + "-" + uuid.substring(8, 12) + "-" + uuid.substring(12, 16) + "-" + uuid.substring(16, 20) + "-" + uuid.substring(20);
|
|
32
17
|
}
|
|
33
18
|
|
|
34
19
|
/**
|
|
@@ -84,405 +69,4 @@ export function generateW3CId(): string {
|
|
|
84
69
|
// "Set the two most significant bits (bits 6 and 7) of the clock_seq_hi_and_reserved to zero and one, respectively"
|
|
85
70
|
const clockSequenceHi = hexValues[8 + (random32() & 0x03) | 0];
|
|
86
71
|
return oct.substr(0, 8) + oct.substr(9, 4) + "4" + oct.substr(13, 3) + clockSequenceHi + oct.substr(16, 3) + oct.substr(19, 12);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Provides a collection of utility functions, included for backward compatibility with previous releases.
|
|
91
|
-
* @deprecated Marking this interface and instance as deprecated in favor of direct usage of the helper functions
|
|
92
|
-
* as direct usage provides better tree-shaking and minification by avoiding the inclusion of the unused items
|
|
93
|
-
* in your resulting code.
|
|
94
|
-
*/
|
|
95
|
-
export interface ICoreUtils {
|
|
96
|
-
/**
|
|
97
|
-
* Internal - Do not use directly.
|
|
98
|
-
* @deprecated Direct usage of this property is not recommend
|
|
99
|
-
*/
|
|
100
|
-
_canUseCookies: boolean;
|
|
101
|
-
|
|
102
|
-
isTypeof: (value: any, theType: string) => boolean;
|
|
103
|
-
|
|
104
|
-
isUndefined: (value: any) => boolean;
|
|
105
|
-
|
|
106
|
-
isNullOrUndefined: (value: any) => boolean;
|
|
107
|
-
|
|
108
|
-
hasOwnProperty: (obj: any, prop: string) => boolean;
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Checks if the passed of value is a function.
|
|
112
|
-
* @param {any} value - Value to be checked.
|
|
113
|
-
* @return {boolean} True if the value is a boolean, false otherwise.
|
|
114
|
-
*/
|
|
115
|
-
isFunction: (value: any) => value is Function;
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Checks if the passed of value is a function.
|
|
119
|
-
* @param {any} value - Value to be checked.
|
|
120
|
-
* @return {boolean} True if the value is a boolean, false otherwise.
|
|
121
|
-
*/
|
|
122
|
-
isObject: (value: any) => boolean;
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Check if an object is of type Date
|
|
126
|
-
*/
|
|
127
|
-
isDate: (obj: any) => obj is Date;
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Check if an object is of type Array
|
|
131
|
-
*/
|
|
132
|
-
isArray: (obj: any) => boolean;
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Check if an object is of type Error
|
|
136
|
-
*/
|
|
137
|
-
isError: (obj: any) => obj is Error;
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Checks if the type of value is a string.
|
|
141
|
-
* @param {any} value - Value to be checked.
|
|
142
|
-
* @return {boolean} True if the value is a string, false otherwise.
|
|
143
|
-
*/
|
|
144
|
-
isString: (value: any) => value is string;
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Checks if the type of value is a number.
|
|
148
|
-
* @param {any} value - Value to be checked.
|
|
149
|
-
* @return {boolean} True if the value is a number, false otherwise.
|
|
150
|
-
*/
|
|
151
|
-
isNumber: (value: any) => value is number;
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Checks if the type of value is a boolean.
|
|
155
|
-
* @param {any} value - Value to be checked.
|
|
156
|
-
* @return {boolean} True if the value is a boolean, false otherwise.
|
|
157
|
-
*/
|
|
158
|
-
isBoolean: (value: any) => value is boolean;
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* Convert a date to I.S.O. format in IE8
|
|
162
|
-
*/
|
|
163
|
-
toISOString: (date: Date) => string;
|
|
164
|
-
|
|
165
|
-
/**
|
|
166
|
-
* Performs the specified action for each element in an array. This helper exists to avoid adding a polyfil for older browsers
|
|
167
|
-
* that do not define Array.prototype.xxxx (eg. ES3 only, IE8) just in case any page checks for presence/absence of the prototype
|
|
168
|
-
* implementation. Note: For consistency this will not use the Array.prototype.xxxx implementation if it exists as this would
|
|
169
|
-
* cause a testing requirement to test with and without the implementations
|
|
170
|
-
* @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array. It can return -1 to break out of the loop
|
|
171
|
-
* @param thisArg [Optional] An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
|
|
172
|
-
*/
|
|
173
|
-
arrForEach: <T>(arr: T[], callbackfn: (value: T, index?: number, array?: T[]) => void|number, thisArg?: any) => void;
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* Returns the index of the first occurrence of a value in an array. This helper exists to avoid adding a polyfil for older browsers
|
|
177
|
-
* that do not define Array.prototype.xxxx (eg. ES3 only, IE8) just in case any page checks for presence/absence of the prototype
|
|
178
|
-
* implementation. Note: For consistency this will not use the Array.prototype.xxxx implementation if it exists as this would
|
|
179
|
-
* cause a testing requirement to test with and without the implementations
|
|
180
|
-
* @param searchElement The value to locate in the array.
|
|
181
|
-
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.
|
|
182
|
-
*/
|
|
183
|
-
arrIndexOf: <T>(arr: T[], searchElement: T, fromIndex?: number) => number;
|
|
184
|
-
|
|
185
|
-
/**
|
|
186
|
-
* Calls a defined callback function on each element of an array, and returns an array that contains the results. This helper exists
|
|
187
|
-
* to avoid adding a polyfil for older browsers that do not define Array.prototype.xxxx (eg. ES3 only, IE8) just in case any page
|
|
188
|
-
* checks for presence/absence of the prototype implementation. Note: For consistency this will not use the Array.prototype.xxxx
|
|
189
|
-
* implementation if it exists as this would cause a testing requirement to test with and without the implementations
|
|
190
|
-
* @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.
|
|
191
|
-
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
|
|
192
|
-
*/
|
|
193
|
-
arrMap: <T, R>(arr: T[], callbackfn: (value: T, index?: number, array?: T[]) => R, thisArg?: any) => R[];
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is
|
|
197
|
-
* provided as an argument in the next call to the callback function. This helper exists to avoid adding a polyfil for older browsers that do not define
|
|
198
|
-
* Array.prototype.xxxx (eg. ES3 only, IE8) just in case any page checks for presence/absence of the prototype implementation. Note: For consistency
|
|
199
|
-
* this will not use the Array.prototype.xxxx implementation if it exists as this would cause a testing requirement to test with and without the implementations
|
|
200
|
-
* @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.
|
|
201
|
-
* @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.
|
|
202
|
-
*/
|
|
203
|
-
arrReduce: <T, R>(arr: T[], callbackfn: (previousValue: T | R, currentValue?: T, currentIndex?: number, array?: T[]) => R, initialValue?: R) => R;
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* helper method to trim strings (IE8 does not implement String.prototype.trim)
|
|
207
|
-
*/
|
|
208
|
-
strTrim: (str: any) => string;
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* Creates an object that has the specified prototype, and that optionally contains specified properties. This helper exists to avoid adding a polyfil
|
|
212
|
-
* for older browsers that do not define Object.create eg. ES3 only, IE8 just in case any page checks for presence/absence of the prototype implementation.
|
|
213
|
-
* Note: For consistency this will not use the Object.create implementation if it exists as this would cause a testing requirement to test with and without the implementations
|
|
214
|
-
* @param obj Object to use as a prototype. May be null
|
|
215
|
-
*/
|
|
216
|
-
// tslint:disable-next-line: member-ordering
|
|
217
|
-
objCreate:(obj: object) => any;
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* Returns the names of the enumerable string properties and methods of an object. This helper exists to avoid adding a polyfil for older browsers
|
|
221
|
-
* that do not define Object.keys eg. ES3 only, IE8 just in case any page checks for presence/absence of the prototype implementation.
|
|
222
|
-
* Note: For consistency this will not use the Object.keys implementation if it exists as this would cause a testing requirement to test with and without the implementations
|
|
223
|
-
* @param obj Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
|
|
224
|
-
*/
|
|
225
|
-
objKeys: (obj: {}) => string[];
|
|
226
|
-
|
|
227
|
-
/**
|
|
228
|
-
* Try to define get/set object property accessors for the target object/prototype, this will provide compatibility with
|
|
229
|
-
* existing API definition when run within an ES5+ container that supports accessors but still enable the code to be loaded
|
|
230
|
-
* and executed in an ES3 container, providing basic IE8 compatibility.
|
|
231
|
-
* @param target The object on which to define the property.
|
|
232
|
-
* @param prop The name of the property to be defined or modified.
|
|
233
|
-
* @param getProp The getter function to wire against the getter.
|
|
234
|
-
* @param setProp The setter function to wire against the setter.
|
|
235
|
-
* @returns True if it was able to create the accessors otherwise false
|
|
236
|
-
*/
|
|
237
|
-
objDefineAccessors: <T>(target: any, prop: string, getProp?: () => T, setProp?: (v: T) => void) => boolean;
|
|
238
|
-
|
|
239
|
-
/**
|
|
240
|
-
* Trys to add an event handler for the specified event to the window, body and document
|
|
241
|
-
* @param eventName {string} - The name of the event
|
|
242
|
-
* @param callback {any} - The callback function that needs to be executed for the given event
|
|
243
|
-
* @return {boolean} - true if the handler was successfully added
|
|
244
|
-
*/
|
|
245
|
-
addEventHandler: (eventName: string, callback: any, evtNamespace?: string | string[]) => boolean;
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Return the current time via the Date now() function (if available) and falls back to (new Date()).getTime() if now() is unavailable (IE8 or less)
|
|
249
|
-
* https://caniuse.com/#search=Date.now
|
|
250
|
-
*/
|
|
251
|
-
dateNow: () => number;
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* Identifies whether the current environment appears to be IE
|
|
255
|
-
*/
|
|
256
|
-
isIE: () => boolean;
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* @deprecated - Use the core.getCookieMgr().disable()
|
|
260
|
-
* Force the SDK not to store and read any data from cookies.
|
|
261
|
-
*/
|
|
262
|
-
disableCookies: () => void;
|
|
263
|
-
|
|
264
|
-
newGuid: () => string;
|
|
265
|
-
|
|
266
|
-
/**
|
|
267
|
-
* Return the current value of the Performance Api now() function (if available) and fallback to dateNow() if it is unavailable (IE9 or less)
|
|
268
|
-
* https://caniuse.com/#search=performance.now
|
|
269
|
-
*/
|
|
270
|
-
perfNow: () => number;
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
* Generate random base64 id string.
|
|
274
|
-
* The default length is 22 which is 132-bits so almost the same as a GUID but as base64 (the previous default was 5)
|
|
275
|
-
* @param maxLength - Optional value to specify the length of the id to be generated, defaults to 22
|
|
276
|
-
*/
|
|
277
|
-
newId: (maxLength?: number) => string;
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* Generate a random value between 0 and maxValue, max value should be limited to a 32-bit maximum.
|
|
281
|
-
* So maxValue(16) will produce a number from 0..16 (range of 17)
|
|
282
|
-
* @param maxValue
|
|
283
|
-
*/
|
|
284
|
-
randomValue: (maxValue: number) => number;
|
|
285
|
-
|
|
286
|
-
/**
|
|
287
|
-
* generate a random 32-bit number (0x000000..0xFFFFFFFF) or (-0x80000000..0x7FFFFFFF), defaults un-unsigned.
|
|
288
|
-
* @param signed - True to return a signed 32-bit number (-0x80000000..0x7FFFFFFF) otherwise an unsigned one (0x000000..0xFFFFFFFF)
|
|
289
|
-
*/
|
|
290
|
-
random32: (signed?: boolean) => number;
|
|
291
|
-
|
|
292
|
-
/**
|
|
293
|
-
* Seed the MWC random number generator with the specified seed or a random value
|
|
294
|
-
* @param value - optional the number to used as the seed, if undefined, null or zero a random value will be chosen
|
|
295
|
-
*/
|
|
296
|
-
mwcRandomSeed: (value?: number) => void;
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* Generate a random 32-bit number between (0x000000..0xFFFFFFFF) or (-0x80000000..0x7FFFFFFF), using MWC (Multiply with carry)
|
|
300
|
-
* instead of Math.random() defaults to un-signed.
|
|
301
|
-
* Used as a replacement random generator for IE to avoid issues with older IE instances.
|
|
302
|
-
* @param signed - True to return a signed 32-bit number (-0x80000000..0x7FFFFFFF) otherwise an unsigned one (0x000000..0xFFFFFFFF)
|
|
303
|
-
*/
|
|
304
|
-
mwcRandom32: (signed?: boolean) => number;
|
|
305
|
-
|
|
306
|
-
/**
|
|
307
|
-
* generate W3C trace id
|
|
308
|
-
*/
|
|
309
|
-
generateW3CId: () => string;
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
/**
|
|
313
|
-
* Provides a collection of utility functions, included for backward compatibility with previous releases.
|
|
314
|
-
* @deprecated Marking this instance as deprecated in favor of direct usage of the helper functions
|
|
315
|
-
* as direct usage provides better tree-shaking and minification by avoiding the inclusion of the unused items
|
|
316
|
-
* in your resulting code.
|
|
317
|
-
*/
|
|
318
|
-
export const CoreUtils: ICoreUtils = {
|
|
319
|
-
_canUseCookies: undefined,
|
|
320
|
-
isTypeof: isTypeof,
|
|
321
|
-
isUndefined: isUndefined,
|
|
322
|
-
isNullOrUndefined: isNullOrUndefined,
|
|
323
|
-
hasOwnProperty: hasOwnProperty,
|
|
324
|
-
isFunction: isFunction,
|
|
325
|
-
isObject: isObject,
|
|
326
|
-
isDate: isDate,
|
|
327
|
-
isArray: isArray,
|
|
328
|
-
isError: isError,
|
|
329
|
-
isString: isString,
|
|
330
|
-
isNumber: isNumber,
|
|
331
|
-
isBoolean: isBoolean,
|
|
332
|
-
toISOString: toISOString,
|
|
333
|
-
arrForEach: arrForEach,
|
|
334
|
-
arrIndexOf: arrIndexOf,
|
|
335
|
-
arrMap: arrMap,
|
|
336
|
-
arrReduce: arrReduce,
|
|
337
|
-
strTrim: strTrim,
|
|
338
|
-
objCreate: objCreateFn,
|
|
339
|
-
objKeys: objKeys,
|
|
340
|
-
objDefineAccessors: objDefineAccessors,
|
|
341
|
-
addEventHandler: addEventHandler,
|
|
342
|
-
dateNow: dateNow,
|
|
343
|
-
isIE: isIE,
|
|
344
|
-
disableCookies: disableCookies,
|
|
345
|
-
newGuid: newGuid,
|
|
346
|
-
perfNow: perfNow,
|
|
347
|
-
newId: newId,
|
|
348
|
-
randomValue: randomValue,
|
|
349
|
-
random32: random32,
|
|
350
|
-
mwcRandomSeed: mwcRandomSeed,
|
|
351
|
-
mwcRandom32: mwcRandom32,
|
|
352
|
-
generateW3CId: generateW3CId
|
|
353
|
-
};
|
|
354
|
-
|
|
355
|
-
const GuidRegex = /[xy]/g;
|
|
356
|
-
|
|
357
|
-
export interface IEventHelper {
|
|
358
|
-
/**
|
|
359
|
-
* Binds the specified function to an event, so that the function gets called whenever the event fires on the object
|
|
360
|
-
* @param obj Object to add the event too.
|
|
361
|
-
* @param eventNameWithoutOn String that specifies any of the standard DHTML Events without "on" prefix
|
|
362
|
-
* @param handlerRef Pointer that specifies the function to call when event fires
|
|
363
|
-
* @returns True if the function was bound successfully to the event, otherwise false
|
|
364
|
-
*/
|
|
365
|
-
Attach: (obj: any, eventNameWithoutOn: string, handlerRef: any) => boolean;
|
|
366
|
-
|
|
367
|
-
/**
|
|
368
|
-
* Binds the specified function to an event, so that the function gets called whenever the event fires on the object
|
|
369
|
-
* @deprecated Use {@link EventHelper#Attach} as we are already in a class call EventHelper the extra "Event" just causes a larger result
|
|
370
|
-
* @param obj Object to add the event too.
|
|
371
|
-
* @param eventNameWithoutOn String that specifies any of the standard DHTML Events without "on" prefix
|
|
372
|
-
* @param handlerRef Pointer that specifies the function to call when event fires
|
|
373
|
-
* @returns True if the function was bound successfully to the event, otherwise false
|
|
374
|
-
*/
|
|
375
|
-
AttachEvent: (obj: any, eventNameWithoutOn: string, handlerRef: any) => boolean;
|
|
376
|
-
|
|
377
|
-
/**
|
|
378
|
-
* Removes an event handler for the specified event
|
|
379
|
-
* @param eventName {string} - The name of the event
|
|
380
|
-
* @param callback {any} - The callback function that needs to be executed for the given event
|
|
381
|
-
* @return {boolean} - true if the handler was successfully added
|
|
382
|
-
*/
|
|
383
|
-
Detach: (obj: any, eventNameWithoutOn: string, handlerRef: any) => void;
|
|
384
|
-
|
|
385
|
-
/**
|
|
386
|
-
* Removes an event handler for the specified event
|
|
387
|
-
* @deprecated Use {@link EventHelper#Detach} as we are already in a class call EventHelper the extra "Event" just causes a larger result
|
|
388
|
-
* @param eventName {string} - The name of the event
|
|
389
|
-
* @param callback {any} - The callback function that needs to be executed for the given event
|
|
390
|
-
* @return {boolean} - true if the handler was successfully added
|
|
391
|
-
*/
|
|
392
|
-
DetachEvent: (obj: any, eventNameWithoutOn: string, handlerRef: any) => void;
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
export const EventHelper: IEventHelper = {
|
|
396
|
-
Attach: attachEvent,
|
|
397
|
-
AttachEvent: attachEvent,
|
|
398
|
-
Detach: detachEvent,
|
|
399
|
-
DetachEvent: detachEvent
|
|
400
|
-
};
|
|
401
|
-
|
|
402
|
-
/**
|
|
403
|
-
* Helper to support backward compatibility for users that use the legacy cookie handling functions and the use the internal
|
|
404
|
-
* CoreUtils._canUseCookies global flag to enable/disable cookies usage.
|
|
405
|
-
* Note: This has the following deliberate side-effects
|
|
406
|
-
* - Creates the global (legacy) cookie manager if it does not already exist
|
|
407
|
-
* - Attempts to add "listeners" to the CoreUtils._canUseCookies property to support the legacy usage
|
|
408
|
-
* @param config
|
|
409
|
-
* @param logger
|
|
410
|
-
* @returns
|
|
411
|
-
*/
|
|
412
|
-
export function _legacyCookieMgr(config?: IConfiguration, logger?: IDiagnosticLogger): ICookieMgr {
|
|
413
|
-
let cookieMgr = _gblCookieMgr(config, logger);
|
|
414
|
-
let legacyCanUseCookies = (CoreUtils as any)._canUseCookies;
|
|
415
|
-
|
|
416
|
-
if (_cookieMgrs === null) {
|
|
417
|
-
_cookieMgrs = [];
|
|
418
|
-
_canUseCookies = legacyCanUseCookies;
|
|
419
|
-
|
|
420
|
-
// Dynamically create get/set property accessors for backward compatibility for enabling / disabling cookies
|
|
421
|
-
// this WILL NOT work for ES3 browsers (< IE8)
|
|
422
|
-
objDefineAccessors<boolean>(CoreUtils, "_canUseCookies",
|
|
423
|
-
() => {
|
|
424
|
-
return _canUseCookies;
|
|
425
|
-
},
|
|
426
|
-
(value) => {
|
|
427
|
-
_canUseCookies = value;
|
|
428
|
-
arrForEach(_cookieMgrs, (mgr) => {
|
|
429
|
-
mgr.setEnabled(value);
|
|
430
|
-
});
|
|
431
|
-
});
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
if (arrIndexOf(_cookieMgrs, cookieMgr) === -1) {
|
|
435
|
-
_cookieMgrs.push(cookieMgr);
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
if (isBoolean(legacyCanUseCookies)) {
|
|
439
|
-
cookieMgr.setEnabled(legacyCanUseCookies);
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
if (isBoolean(_canUseCookies)) {
|
|
443
|
-
cookieMgr.setEnabled(_canUseCookies);
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
return cookieMgr;
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
/**
|
|
450
|
-
* @deprecated - Use the core.getCookieMgr().disable()
|
|
451
|
-
* Force the SDK not to store and read any data from cookies.
|
|
452
|
-
*/
|
|
453
|
-
export function disableCookies() {
|
|
454
|
-
_legacyCookieMgr().setEnabled(false);
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
/**
|
|
458
|
-
* @deprecated - Use the core.getCookieMgr().isEnabled()
|
|
459
|
-
* Helper method to tell if document.cookie object is available and whether it can be used.
|
|
460
|
-
*/
|
|
461
|
-
export function canUseCookies(logger: IDiagnosticLogger): any {
|
|
462
|
-
return _legacyCookieMgr(null, logger).isEnabled();
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
/**
|
|
466
|
-
* @deprecated - Use the core.getCookieMgr().get()
|
|
467
|
-
* helper method to access userId and sessionId cookie
|
|
468
|
-
*/
|
|
469
|
-
export function getCookie(logger: IDiagnosticLogger, name: string) {
|
|
470
|
-
return _legacyCookieMgr(null, logger).get(name);
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
/**
|
|
474
|
-
* @deprecated - Use the core.getCookieMgr().set()
|
|
475
|
-
* helper method to set userId and sessionId cookie
|
|
476
|
-
*/
|
|
477
|
-
export function setCookie(logger: IDiagnosticLogger, name: string, value: string, domain?: string) {
|
|
478
|
-
_legacyCookieMgr(null, logger).set(name, value, null, domain);
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
/**
|
|
482
|
-
* @deprecated - Use the core.getCookieMgr().del()
|
|
483
|
-
* Deletes a cookie by setting it's expiration time in the past.
|
|
484
|
-
* @param name - The name of the cookie to delete.
|
|
485
|
-
*/
|
|
486
|
-
export function deleteCookie(logger: IDiagnosticLogger, name: string) {
|
|
487
|
-
return _legacyCookieMgr(null, logger).del(name);
|
|
488
72
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2
2
|
// Licensed under the MIT License.
|
|
3
3
|
|
|
4
|
+
import { getInst } from "@nevware21/ts-utils";
|
|
4
5
|
import { IConfiguration } from "../JavaScriptSDK.Interfaces/IConfiguration";
|
|
5
6
|
import { IDbgExtension } from "../JavaScriptSDK.Interfaces/IDbgExtension";
|
|
6
7
|
import { INotificationListener } from "../JavaScriptSDK.Interfaces/INotificationListener";
|
|
7
|
-
import { getGlobalInst } from "./EnvUtils";
|
|
8
8
|
|
|
9
9
|
const listenerFuncs = [ "eventsSent", "eventsDiscarded", "eventsSendRequest", "perfEvent" ];
|
|
10
10
|
|
|
@@ -26,7 +26,7 @@ function _listenerProxyFunc(name: string, config: IConfiguration) {
|
|
|
26
26
|
|
|
27
27
|
function _getExtensionNamespace() {
|
|
28
28
|
// Cache the lookup of the global namespace object
|
|
29
|
-
let target =
|
|
29
|
+
let target = getInst("Microsoft");
|
|
30
30
|
if (target) {
|
|
31
31
|
_aiNamespace = target["ApplicationInsights"];
|
|
32
32
|
}
|