367 lines
15 KiB
JavaScript
367 lines
15 KiB
JavaScript
"use strict";
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
var Microsoft;
|
|
(function (Microsoft) {
|
|
var ApplicationInsights;
|
|
(function (ApplicationInsights) {
|
|
"use strict";
|
|
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
})(Microsoft || (Microsoft = {}));
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
// THIS FILE WAS AUTOGENERATED
|
|
var Microsoft;
|
|
(function (Microsoft) {
|
|
var Telemetry;
|
|
(function (Telemetry) {
|
|
"use strict";
|
|
/**
|
|
* Data struct to contain only C section with custom fields.
|
|
*/
|
|
var Base = /** @class */ (function () {
|
|
function Base() {
|
|
}
|
|
return Base;
|
|
}());
|
|
Telemetry.Base = Base;
|
|
})(Telemetry = Microsoft.Telemetry || (Microsoft.Telemetry = {}));
|
|
})(Microsoft || (Microsoft = {}));
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
// THIS FILE WAS AUTOGENERATED
|
|
/// <reference path="Base.ts" />
|
|
var Microsoft;
|
|
(function (Microsoft) {
|
|
var Telemetry;
|
|
(function (Telemetry) {
|
|
"use strict";
|
|
/**
|
|
* System variables for a telemetry item.
|
|
*/
|
|
var Envelope = /** @class */ (function () {
|
|
function Envelope() {
|
|
this.ver = 1;
|
|
this.sampleRate = 100.0;
|
|
this.tags = {};
|
|
}
|
|
return Envelope;
|
|
}());
|
|
Telemetry.Envelope = Envelope;
|
|
})(Telemetry = Microsoft.Telemetry || (Microsoft.Telemetry = {}));
|
|
})(Microsoft || (Microsoft = {}));
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
var Microsoft;
|
|
(function (Microsoft) {
|
|
var ApplicationInsights;
|
|
(function (ApplicationInsights) {
|
|
var Context;
|
|
(function (Context) {
|
|
"use strict";
|
|
})(Context = ApplicationInsights.Context || (ApplicationInsights.Context = {}));
|
|
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
})(Microsoft || (Microsoft = {}));
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
var Microsoft;
|
|
(function (Microsoft) {
|
|
var ApplicationInsights;
|
|
(function (ApplicationInsights) {
|
|
var Context;
|
|
(function (Context) {
|
|
"use strict";
|
|
})(Context = ApplicationInsights.Context || (ApplicationInsights.Context = {}));
|
|
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
})(Microsoft || (Microsoft = {}));
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
var Microsoft;
|
|
(function (Microsoft) {
|
|
var ApplicationInsights;
|
|
(function (ApplicationInsights) {
|
|
var Context;
|
|
(function (Context) {
|
|
"use strict";
|
|
})(Context = ApplicationInsights.Context || (ApplicationInsights.Context = {}));
|
|
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
})(Microsoft || (Microsoft = {}));
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
var Microsoft;
|
|
(function (Microsoft) {
|
|
var ApplicationInsights;
|
|
(function (ApplicationInsights) {
|
|
var Context;
|
|
(function (Context) {
|
|
"use strict";
|
|
})(Context = ApplicationInsights.Context || (ApplicationInsights.Context = {}));
|
|
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
})(Microsoft || (Microsoft = {}));
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
var Microsoft;
|
|
(function (Microsoft) {
|
|
var ApplicationInsights;
|
|
(function (ApplicationInsights) {
|
|
var Context;
|
|
(function (Context) {
|
|
"use strict";
|
|
})(Context = ApplicationInsights.Context || (ApplicationInsights.Context = {}));
|
|
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
})(Microsoft || (Microsoft = {}));
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
var Microsoft;
|
|
(function (Microsoft) {
|
|
var ApplicationInsights;
|
|
(function (ApplicationInsights) {
|
|
var Context;
|
|
(function (Context) {
|
|
"use strict";
|
|
})(Context = ApplicationInsights.Context || (ApplicationInsights.Context = {}));
|
|
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
})(Microsoft || (Microsoft = {}));
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
var Microsoft;
|
|
(function (Microsoft) {
|
|
var ApplicationInsights;
|
|
(function (ApplicationInsights) {
|
|
var Context;
|
|
(function (Context) {
|
|
"use strict";
|
|
})(Context = ApplicationInsights.Context || (ApplicationInsights.Context = {}));
|
|
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
})(Microsoft || (Microsoft = {}));
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
var Microsoft;
|
|
(function (Microsoft) {
|
|
var ApplicationInsights;
|
|
(function (ApplicationInsights) {
|
|
var Context;
|
|
(function (Context) {
|
|
"use strict";
|
|
})(Context = ApplicationInsights.Context || (ApplicationInsights.Context = {}));
|
|
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
})(Microsoft || (Microsoft = {}));
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
var Microsoft;
|
|
(function (Microsoft) {
|
|
var ApplicationInsights;
|
|
(function (ApplicationInsights) {
|
|
"use strict";
|
|
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
})(Microsoft || (Microsoft = {}));
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
/// <reference path="./ISerializable.ts" />
|
|
var Microsoft;
|
|
(function (Microsoft) {
|
|
var ApplicationInsights;
|
|
(function (ApplicationInsights) {
|
|
"use strict";
|
|
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
})(Microsoft || (Microsoft = {}));
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
/// <reference path="./Contracts/Generated/Envelope.ts" />
|
|
/// <reference path="./Context/IApplication.ts"/>
|
|
/// <reference path="./Context/IDevice.ts"/>
|
|
/// <reference path="./Context/IInternal.ts"/>
|
|
/// <reference path="./Context/ILocation.ts"/>
|
|
/// <reference path="./Context/IOperation.ts"/>
|
|
/// <reference path="./Context/ISample.ts"/>
|
|
/// <reference path="./Context/IUser.ts"/>
|
|
/// <reference path="./Context/ISession.ts"/>
|
|
/// <reference path="./Telemetry/IEnvelope.ts"/>
|
|
var Microsoft;
|
|
(function (Microsoft) {
|
|
var ApplicationInsights;
|
|
(function (ApplicationInsights) {
|
|
"use strict";
|
|
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
})(Microsoft || (Microsoft = {}));
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
// THIS FILE WAS AUTOGENERATED
|
|
var AI;
|
|
(function (AI) {
|
|
"use strict";
|
|
/**
|
|
* Defines the level of severity for the event.
|
|
*/
|
|
var SeverityLevel;
|
|
(function (SeverityLevel) {
|
|
SeverityLevel[SeverityLevel["Verbose"] = 0] = "Verbose";
|
|
SeverityLevel[SeverityLevel["Information"] = 1] = "Information";
|
|
SeverityLevel[SeverityLevel["Warning"] = 2] = "Warning";
|
|
SeverityLevel[SeverityLevel["Error"] = 3] = "Error";
|
|
SeverityLevel[SeverityLevel["Critical"] = 4] = "Critical";
|
|
})(SeverityLevel = AI.SeverityLevel || (AI.SeverityLevel = {}));
|
|
})(AI || (AI = {}));
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
/// <reference path="./IConfig.ts" />
|
|
/// <reference path="./ITelemetryContext.ts" />
|
|
/// <reference path="./Contracts/Generated/SeverityLevel.ts" />
|
|
var Microsoft;
|
|
(function (Microsoft) {
|
|
var ApplicationInsights;
|
|
(function (ApplicationInsights) {
|
|
"use strict";
|
|
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
})(Microsoft || (Microsoft = {}));
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
var Microsoft;
|
|
(function (Microsoft) {
|
|
var ApplicationInsights;
|
|
(function (ApplicationInsights) {
|
|
"use strict";
|
|
var UtilHelpers = /** @class */ (function () {
|
|
function UtilHelpers() {
|
|
}
|
|
/**
|
|
* generate random id string
|
|
*/
|
|
UtilHelpers.newId = function () {
|
|
var base64chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
|
|
var result = "";
|
|
// tslint:disable-next-line:insecure-random
|
|
var random = Math.random() * 1073741824; //5 symbols in base64, almost maxint
|
|
while (random > 0) {
|
|
var char = base64chars.charAt(random % 64);
|
|
result += char;
|
|
random = Math.floor(random / 64);
|
|
}
|
|
return result;
|
|
};
|
|
return UtilHelpers;
|
|
}());
|
|
ApplicationInsights.UtilHelpers = UtilHelpers;
|
|
})(ApplicationInsights = Microsoft.ApplicationInsights || (Microsoft.ApplicationInsights = {}));
|
|
})(Microsoft || (Microsoft = {}));
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// Licensed under the MIT License.
|
|
define("JavaScriptSDK.Module/AppInsightsModule", ["require", "exports"], function (require, exports) {
|
|
/// <reference path="../JavaScriptSDK.Interfaces/IConfig.ts"/>
|
|
/// <reference path="../JavaScriptSDK.Interfaces/IAppInsights.ts"/>
|
|
/// <reference path="../JavaScriptSDK/UtilHelpers.ts"/>
|
|
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
var AppInsightsModule = /** @class */ (function () {
|
|
function AppInsightsModule() {
|
|
}
|
|
AppInsightsModule._createLazyMethod = function (name) {
|
|
var aiObject = window[AppInsightsModule.appInsightsName];
|
|
// Define a temporary method that queues-up a the real method call
|
|
aiObject[name] = function () {
|
|
// Capture the original arguments passed to the method
|
|
var originalArguments = arguments;
|
|
// If the queue is available, it means that the function wasn't yet replaced with actual function value
|
|
if (aiObject.queue) {
|
|
aiObject.queue.push(function () { return aiObject[name].apply(aiObject, originalArguments); });
|
|
}
|
|
else {
|
|
// otherwise execute the function
|
|
aiObject[name].apply(aiObject, originalArguments);
|
|
}
|
|
};
|
|
};
|
|
;
|
|
AppInsightsModule._defineLazyMethods = function () {
|
|
var aiObject = window[AppInsightsModule.appInsightsName];
|
|
// capture initial cookie if possible
|
|
try {
|
|
aiObject.cookie = document.cookie;
|
|
}
|
|
catch (e) {
|
|
}
|
|
aiObject.queue = [];
|
|
var method = [
|
|
"clearAuthenticatedUserContext",
|
|
"flush",
|
|
"setAuthenticatedUserContext",
|
|
"startTrackEvent",
|
|
"startTrackPage",
|
|
"stopTrackEvent",
|
|
"stopTrackPage",
|
|
"trackDependency",
|
|
"trackEvent",
|
|
"trackException",
|
|
"trackMetric",
|
|
"trackPageView",
|
|
"trackTrace"
|
|
];
|
|
while (method.length) {
|
|
AppInsightsModule._createLazyMethod(method.pop());
|
|
}
|
|
};
|
|
AppInsightsModule._download = function (aiConfig) {
|
|
AppInsightsModule.getAppInsightsInstance().config = aiConfig;
|
|
var aiObject = window[AppInsightsModule.appInsightsName];
|
|
// if script was previously downloaded and initialized, queue will be deleted, reinitialize it
|
|
if (!aiObject.queue) {
|
|
aiObject.queue = [];
|
|
}
|
|
setTimeout(function () {
|
|
var scriptElement = document.createElement("script");
|
|
scriptElement.src = aiConfig.url || "https://az416426.vo.msecnd.net/scripts/a/ai.0.js";
|
|
document.head.appendChild(scriptElement);
|
|
});
|
|
// collect global errors by wrapping the window.onerror method
|
|
if (!aiConfig.disableExceptionTracking) {
|
|
var method_1 = "onerror";
|
|
AppInsightsModule._createLazyMethod("_" + method_1);
|
|
var originalOnError = window[method_1];
|
|
window[method_1] = function (message, url, lineNumber, columnNumber, error) {
|
|
var handled = originalOnError && originalOnError(message, url, lineNumber, columnNumber, error);
|
|
if (handled !== true) {
|
|
aiObject["_" + method_1](message, url, lineNumber, columnNumber, error);
|
|
}
|
|
return handled;
|
|
};
|
|
}
|
|
};
|
|
AppInsightsModule.getAppInsightsInstance = function () {
|
|
if (typeof window === 'undefined') {
|
|
return;
|
|
}
|
|
if (!window[AppInsightsModule.appInsightsName]) {
|
|
window[AppInsightsModule.appInsightsName] = {
|
|
downloadAndSetup: AppInsightsModule._download,
|
|
// exposing it for unit tests only, not part of interface
|
|
_defineLazyMethods: AppInsightsModule._defineLazyMethods
|
|
};
|
|
AppInsightsModule._defineLazyMethods();
|
|
}
|
|
return window[AppInsightsModule.appInsightsName];
|
|
};
|
|
AppInsightsModule.appInsightsInitialized = false;
|
|
AppInsightsModule.appInsightsName = "appInsights";
|
|
/**
|
|
* Static constructor, attempt to ES5 get accessor
|
|
*/
|
|
AppInsightsModule._staticInit = (function () {
|
|
// Dynamically create get/set property accessors
|
|
var defineProp = Object["defineProperty"];
|
|
try {
|
|
defineProp && defineProp(AppInsightsModule.prototype, "appInsightsInstance", {
|
|
get: AppInsightsModule.getAppInsightsInstance,
|
|
enumerable: true,
|
|
configurable: true
|
|
});
|
|
}
|
|
catch (e) {
|
|
// IE8 Defines a defineProperty on Object but it's only supported for DOM elements so it will throw
|
|
// We will just ignore this here.
|
|
}
|
|
})();
|
|
return AppInsightsModule;
|
|
}());
|
|
exports.AppInsights = AppInsightsModule.getAppInsightsInstance();
|
|
});
|
|
//# sourceMappingURL=ai.module.js.map
|