@microsoft/applicationinsights-clickanalytics-js 2.7.1-nightly.202110-07 → 2.7.1-nightly.202110-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/browser/{ai.clck.2.7.1-nightly.202110-07.cjs.js → ai.clck.2.7.1-nightly.202110-16.cjs.js} +129 -120
- package/browser/ai.clck.2.7.1-nightly.202110-16.cjs.js.map +1 -0
- package/browser/ai.clck.2.7.1-nightly.202110-16.cjs.min.js +6 -0
- package/browser/ai.clck.2.7.1-nightly.202110-16.cjs.min.js.map +1 -0
- package/browser/{ai.clck.2.7.1-nightly.202110-07.gbl.js → ai.clck.2.7.1-nightly.202110-16.gbl.js} +129 -120
- package/browser/ai.clck.2.7.1-nightly.202110-16.gbl.js.map +1 -0
- package/browser/ai.clck.2.7.1-nightly.202110-16.gbl.min.js +6 -0
- package/browser/ai.clck.2.7.1-nightly.202110-16.gbl.min.js.map +1 -0
- package/browser/ai.clck.2.7.1-nightly.202110-16.integrity.json +66 -0
- package/browser/{ai.clck.2.7.1-nightly.202110-07.js → ai.clck.2.7.1-nightly.202110-16.js} +129 -120
- package/browser/ai.clck.2.7.1-nightly.202110-16.js.map +1 -0
- package/browser/ai.clck.2.7.1-nightly.202110-16.min.js +6 -0
- package/browser/ai.clck.2.7.1-nightly.202110-16.min.js.map +1 -0
- package/browser/ai.clck.2.cjs.js +128 -119
- package/browser/ai.clck.2.cjs.js.map +1 -1
- package/browser/ai.clck.2.cjs.min.js +2 -2
- package/browser/ai.clck.2.cjs.min.js.map +1 -1
- package/browser/ai.clck.2.gbl.js +128 -119
- package/browser/ai.clck.2.gbl.js.map +1 -1
- package/browser/ai.clck.2.gbl.min.js +2 -2
- package/browser/ai.clck.2.gbl.min.js.map +1 -1
- package/browser/ai.clck.2.js +128 -119
- package/browser/ai.clck.2.js.map +1 -1
- package/browser/ai.clck.2.min.js +2 -2
- package/browser/ai.clck.2.min.js.map +1 -1
- package/dist/applicationinsights-clickanalytics-js.api.json +1 -1
- package/dist/applicationinsights-clickanalytics-js.d.ts +1 -1
- package/dist/applicationinsights-clickanalytics-js.js +128 -119
- package/dist/applicationinsights-clickanalytics-js.js.map +1 -1
- package/dist/applicationinsights-clickanalytics-js.min.js +2 -2
- package/dist/applicationinsights-clickanalytics-js.min.js.map +1 -1
- package/dist/applicationinsights-clickanalytics-js.rollup.d.ts +1 -1
- package/dist-esm/Behaviours.js +1 -1
- package/dist-esm/ClickAnalyticsPlugin.js +5 -5
- package/dist-esm/ClickAnalyticsPlugin.js.map +1 -1
- package/dist-esm/DataCollector.js +16 -16
- package/dist-esm/DataCollector.js.map +1 -1
- package/dist-esm/Enums.js +10 -10
- package/dist-esm/Enums.js.map +1 -1
- package/dist-esm/Interfaces/Datamodel.js +1 -1
- package/dist-esm/applicationinsights-clickanalytics-js.js +1 -1
- package/dist-esm/common/Utils.js +25 -25
- package/dist-esm/common/Utils.js.map +1 -1
- package/dist-esm/events/PageAction.js +24 -24
- package/dist-esm/events/PageAction.js.map +1 -1
- package/dist-esm/events/WebEvent.js +8 -8
- package/dist-esm/events/WebEvent.js.map +1 -1
- package/dist-esm/handlers/AutoCaptureHandler.js +8 -8
- package/dist-esm/handlers/AutoCaptureHandler.js.map +1 -1
- package/dist-esm/handlers/DomContentHandler.js +26 -26
- package/dist-esm/handlers/DomContentHandler.js.map +1 -1
- package/package.json +4 -5
- package/src/ClickAnalyticsPlugin.ts +5 -5
- package/src/DataCollector.ts +16 -16
- package/src/Enums.ts +9 -9
- package/src/common/Utils.ts +25 -25
- package/src/events/PageAction.ts +25 -25
- package/src/events/WebEvent.ts +9 -9
- package/src/handlers/AutoCaptureHandler.ts +9 -9
- package/src/handlers/DomContentHandler.ts +26 -26
- package/types/ClickAnalyticsPlugin.d.ts +2 -2
- package/types/DataCollector.d.ts +1 -1
- package/types/common/Utils.d.ts +1 -1
- package/types/events/PageAction.d.ts +2 -2
- package/types/events/WebEvent.d.ts +3 -3
- package/types/handlers/AutoCaptureHandler.d.ts +2 -2
- package/types/handlers/DomContentHandler.d.ts +1 -1
- package/types/tsdoc-metadata.json +1 -1
- package/browser/ai.clck.2.7.1-nightly.202110-07.cjs.js.map +0 -1
- package/browser/ai.clck.2.7.1-nightly.202110-07.cjs.min.js +0 -6
- package/browser/ai.clck.2.7.1-nightly.202110-07.cjs.min.js.map +0 -1
- package/browser/ai.clck.2.7.1-nightly.202110-07.gbl.js.map +0 -1
- package/browser/ai.clck.2.7.1-nightly.202110-07.gbl.min.js +0 -6
- package/browser/ai.clck.2.7.1-nightly.202110-07.gbl.min.js.map +0 -1
- package/browser/ai.clck.2.7.1-nightly.202110-07.integrity.json +0 -66
- package/browser/ai.clck.2.7.1-nightly.202110-07.js.map +0 -1
- package/browser/ai.clck.2.7.1-nightly.202110-07.min.js +0 -6
- package/browser/ai.clck.2.7.1-nightly.202110-07.min.js.map +0 -1
package/dist-esm/Behaviours.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Application Insights JavaScript SDK - Click Analytics, 2.7.1-nightly.202110-
|
|
2
|
+
* Application Insights JavaScript SDK - Click Analytics, 2.7.1-nightly.202110-16
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
import { __extendsFn as __extends } from "@microsoft/applicationinsights-shims";
|
|
9
9
|
import { BaseTelemetryPlugin, isNullOrUndefined, LoggingSeverity, arrForEach, dumpObj, getExceptionName } from "@microsoft/applicationinsights-core-js";
|
|
10
10
|
import { PropertiesPluginIdentifier } from "@microsoft/applicationinsights-common";
|
|
11
|
-
import { mergeConfig, BehaviorMapValidator, BehaviorValueValidator, BehaviorEnumValidator, _ExtendedInternalMessageId } from
|
|
12
|
-
import { PageAction } from
|
|
11
|
+
import { mergeConfig, BehaviorMapValidator, BehaviorValueValidator, BehaviorEnumValidator, _ExtendedInternalMessageId } from "./common/Utils";
|
|
12
|
+
import { PageAction } from "./events/PageAction";
|
|
13
13
|
import { AutoCaptureHandler } from "./handlers/AutoCaptureHandler";
|
|
14
14
|
import { DomContentHandler } from "./handlers/DomContentHandler";
|
|
15
15
|
export { BehaviorMapValidator, BehaviorValueValidator, BehaviorEnumValidator };
|
|
@@ -17,7 +17,7 @@ var ClickAnalyticsPlugin = /** @class */ (function (_super) {
|
|
|
17
17
|
__extends(ClickAnalyticsPlugin, _super);
|
|
18
18
|
function ClickAnalyticsPlugin() {
|
|
19
19
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
20
|
-
_this.identifier =
|
|
20
|
+
_this.identifier = "ClickAnalyticsPlugin";
|
|
21
21
|
_this.priority = 181;
|
|
22
22
|
return _this;
|
|
23
23
|
}
|
|
@@ -67,7 +67,7 @@ var ClickAnalyticsPlugin = /** @class */ (function (_super) {
|
|
|
67
67
|
this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _ExtendedInternalMessageId.TrackPageActionEventFailed, "trackPageAction failed, page action event will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
|
-
ClickAnalyticsPlugin.Version = "2.7.1-nightly.202110-
|
|
70
|
+
ClickAnalyticsPlugin.Version = "2.7.1-nightly.202110-16";
|
|
71
71
|
return ClickAnalyticsPlugin;
|
|
72
72
|
}(BaseTelemetryPlugin));
|
|
73
73
|
export { ClickAnalyticsPlugin };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClickAnalyticsPlugin.js.map","sources":["ClickAnalyticsPlugin.js"],"sourcesContent":["/**\r\n * @copyright Microsoft 2020\r\n */\r\nimport { __extends } from \"tslib\";\r\nimport { BaseTelemetryPlugin, isNullOrUndefined, LoggingSeverity, arrForEach, dumpObj, getExceptionName } from \"@microsoft/applicationinsights-core-js\";\r\nimport { PropertiesPluginIdentifier } from \"@microsoft/applicationinsights-common\";\r\nimport { mergeConfig, BehaviorMapValidator, BehaviorValueValidator, BehaviorEnumValidator, _ExtendedInternalMessageId } from
|
|
1
|
+
{"version":3,"file":"ClickAnalyticsPlugin.js.map","sources":["ClickAnalyticsPlugin.js"],"sourcesContent":["/**\r\n * @copyright Microsoft 2020\r\n */\r\nimport { __extends } from \"tslib\";\r\nimport { BaseTelemetryPlugin, isNullOrUndefined, LoggingSeverity, arrForEach, dumpObj, getExceptionName } from \"@microsoft/applicationinsights-core-js\";\r\nimport { PropertiesPluginIdentifier } from \"@microsoft/applicationinsights-common\";\r\nimport { mergeConfig, BehaviorMapValidator, BehaviorValueValidator, BehaviorEnumValidator, _ExtendedInternalMessageId } from \"./common/Utils\";\r\nimport { PageAction } from \"./events/PageAction\";\r\nimport { AutoCaptureHandler } from \"./handlers/AutoCaptureHandler\";\r\nimport { DomContentHandler } from \"./handlers/DomContentHandler\";\r\nexport { BehaviorMapValidator, BehaviorValueValidator, BehaviorEnumValidator };\r\nvar ClickAnalyticsPlugin = /** @class */ (function (_super) {\r\n __extends(ClickAnalyticsPlugin, _super);\r\n function ClickAnalyticsPlugin() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n _this.identifier = \"ClickAnalyticsPlugin\";\r\n _this.priority = 181;\r\n return _this;\r\n }\r\n ClickAnalyticsPlugin.prototype.initialize = function (config, core, extensions, pluginChain) {\r\n if (isNullOrUndefined(core)) {\r\n throw Error(\"Error initializing\");\r\n }\r\n config.extensionConfig = config.extensionConfig || [];\r\n config.extensionConfig[this.identifier] = config.extensionConfig[this.identifier] || {};\r\n this._config = mergeConfig(config.extensionConfig[this.identifier]);\r\n _super.prototype.initialize.call(this, config, core, extensions, pluginChain);\r\n // Default to DOM content handler\r\n this._contentHandler = this._contentHandler ? this._contentHandler : new DomContentHandler(this._config, this.diagLog());\r\n var metaTags = this._contentHandler.getMetadata();\r\n this.pageAction = new PageAction(this, this._config, this._contentHandler, this._config.callback.pageActionPageTags, metaTags, this.diagLog());\r\n // Default to DOM autoCapture handler\r\n this._autoCaptureHandler = this._autoCaptureHandler ? this._autoCaptureHandler : new AutoCaptureHandler(this, this._config, this.pageAction, this.diagLog());\r\n if (this._config.autoCapture) {\r\n this._autoCaptureHandler.click();\r\n }\r\n // Find the properties plugin.\r\n var _propertiesExtension;\r\n arrForEach(extensions, function (extension) {\r\n if (extension.identifier === PropertiesPluginIdentifier) {\r\n _propertiesExtension = extension;\r\n }\r\n });\r\n // Append Click Analytics Plugin Version to SDK version.\r\n if (_propertiesExtension && _propertiesExtension.context &&\r\n _propertiesExtension.context.internal && _propertiesExtension.context.internal.sdkVersion) {\r\n _propertiesExtension.context.internal.sdkVersion += \"_ClickPlugin\" + ClickAnalyticsPlugin.Version;\r\n }\r\n };\r\n ClickAnalyticsPlugin.prototype.processTelemetry = function (env, itemCtx) {\r\n this.processNext(env, itemCtx);\r\n };\r\n /**\r\n * Logs a page action event.\r\n * @param IPageActionTelemetry\r\n * @param customProperties Additional data used to filter events and metrics. Defaults to empty.\r\n */\r\n ClickAnalyticsPlugin.prototype.trackPageAction = function (pageAction, customProperties) {\r\n try {\r\n this.pageAction.trackPageAction(pageAction, customProperties);\r\n }\r\n catch (e) {\r\n this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _ExtendedInternalMessageId.TrackPageActionEventFailed, \"trackPageAction failed, page action event will not be collected: \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n };\r\n ClickAnalyticsPlugin.Version = \"2.7.1-nightly.202110-16\";\r\n return ClickAnalyticsPlugin;\r\n}(BaseTelemetryPlugin));\r\nexport { ClickAnalyticsPlugin };\r\n//# sourceMappingURL=ClickAnalyticsPlugin.js.map"],"names":[],"mappings":";;;;AAAA;AACA;AACA;AACA,gFAAkC;AAClC;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;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Application Insights JavaScript SDK - Click Analytics, 2.7.1-nightly.202110-
|
|
2
|
+
* Application Insights JavaScript SDK - Click Analytics, 2.7.1-nightly.202110-16
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* @copyright Microsoft 2020
|
|
7
7
|
*/
|
|
8
|
-
import { getLocation, getDocument, getWindow, hasDocument, isFunction } from
|
|
9
|
-
import { findClosestAnchor, isValueAssigned } from
|
|
8
|
+
import { getLocation, getDocument, getWindow, hasDocument, isFunction } from "@microsoft/applicationinsights-core-js";
|
|
9
|
+
import { findClosestAnchor, isValueAssigned } from "./common/Utils";
|
|
10
10
|
var clickCaptureInputTypes = { BUTTON: true, CHECKBOX: true, RADIO: true, RESET: true, SUBMIT: true };
|
|
11
11
|
/**
|
|
12
12
|
* Get Image href of a given HTMLImageElement
|
|
@@ -27,23 +27,23 @@ export function getImageHref(element) {
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
return
|
|
30
|
+
return "";
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* Get click target
|
|
34
34
|
* @returns Click target URI
|
|
35
35
|
*/
|
|
36
36
|
export function getClickTarget(element) {
|
|
37
|
-
var clickTarget =
|
|
37
|
+
var clickTarget = "";
|
|
38
38
|
switch (element.tagName) {
|
|
39
|
-
case
|
|
40
|
-
case
|
|
41
|
-
clickTarget = element.href ||
|
|
39
|
+
case "A":
|
|
40
|
+
case "AREA":
|
|
41
|
+
clickTarget = element.href || "";
|
|
42
42
|
break;
|
|
43
|
-
case
|
|
43
|
+
case "IMG":
|
|
44
44
|
clickTarget = getImageHref(element);
|
|
45
45
|
break;
|
|
46
|
-
case
|
|
46
|
+
case "INPUT":
|
|
47
47
|
var type = element.type;
|
|
48
48
|
if (type && (clickCaptureInputTypes[type.toUpperCase()])) {
|
|
49
49
|
var loc = getLocation() || {};
|
|
@@ -65,19 +65,19 @@ export function getClickTarget(element) {
|
|
|
65
65
|
*/
|
|
66
66
|
export function onDomLoaded(callback) {
|
|
67
67
|
onDomReadyDo(function () {
|
|
68
|
-
if (hasDocument && document.readyState ===
|
|
68
|
+
if (hasDocument && document.readyState === "complete") {
|
|
69
69
|
callback();
|
|
70
70
|
}
|
|
71
71
|
else {
|
|
72
72
|
var win = getWindow();
|
|
73
73
|
if (win) {
|
|
74
74
|
if (win.addEventListener) {
|
|
75
|
-
win.addEventListener(
|
|
75
|
+
win.addEventListener("load", function () {
|
|
76
76
|
callback();
|
|
77
77
|
}); // NB **not** 'onload'
|
|
78
78
|
}
|
|
79
79
|
else if (win.attachEvent) {
|
|
80
|
-
win.attachEvent(
|
|
80
|
+
win.attachEvent("onload", function () {
|
|
81
81
|
callback();
|
|
82
82
|
}); // IE8
|
|
83
83
|
}
|
|
@@ -125,8 +125,8 @@ export function sanitizeUrl(config, location) {
|
|
|
125
125
|
if (!location) {
|
|
126
126
|
return null;
|
|
127
127
|
}
|
|
128
|
-
var url = location.protocol +
|
|
129
|
-
(isValueAssigned(location.port) ?
|
|
128
|
+
var url = location.protocol + "//" + (location.hostname || location.host) + // location.hostname is not supported on Opera and Opera for Android
|
|
129
|
+
(isValueAssigned(location.port) ? ":" + location.port : "") +
|
|
130
130
|
location.pathname;
|
|
131
131
|
return url;
|
|
132
132
|
}
|
|
@@ -137,7 +137,7 @@ export function sanitizeUrl(config, location) {
|
|
|
137
137
|
* @returns Flag indicating if an element is market PII.
|
|
138
138
|
*/
|
|
139
139
|
export function getUri(config, location) {
|
|
140
|
-
if (config.coreData && config.coreData.requestUri && config.coreData.requestUri !==
|
|
140
|
+
if (config.coreData && config.coreData.requestUri && config.coreData.requestUri !== "") {
|
|
141
141
|
return config.coreData.requestUri;
|
|
142
142
|
}
|
|
143
143
|
return sanitizeUrl(config, location);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataCollector.js.map","sources":["DataCollector.js"],"sourcesContent":["/**\r\n * @copyright Microsoft 2020\r\n */\r\nimport { getLocation, getDocument, getWindow, hasDocument, isFunction } from
|
|
1
|
+
{"version":3,"file":"DataCollector.js.map","sources":["DataCollector.js"],"sourcesContent":["/**\r\n * @copyright Microsoft 2020\r\n */\r\nimport { getLocation, getDocument, getWindow, hasDocument, isFunction } from \"@microsoft/applicationinsights-core-js\";\r\nimport { findClosestAnchor, isValueAssigned } from \"./common/Utils\";\r\nvar clickCaptureInputTypes = { BUTTON: true, CHECKBOX: true, RADIO: true, RESET: true, SUBMIT: true };\r\n/**\r\n * Get Image href of a given HTMLImageElement\r\n * @param element - An html image element\r\n * @returns Href value.\r\n */\r\nexport function getImageHref(element) {\r\n var temp = element;\r\n if (temp) {\r\n var parent = findClosestAnchor(temp);\r\n if (parent.length === 1) {\r\n var firstParent = parent[0];\r\n if (firstParent.href) {\r\n return firstParent.href;\r\n }\r\n else if (firstParent.src) {\r\n return (firstParent.src);\r\n }\r\n }\r\n }\r\n return \"\";\r\n}\r\n/**\r\n * Get click target\r\n * @returns Click target URI\r\n */\r\nexport function getClickTarget(element) {\r\n var clickTarget = \"\";\r\n switch (element.tagName) {\r\n case \"A\":\r\n case \"AREA\":\r\n clickTarget = element.href || \"\";\r\n break;\r\n case \"IMG\":\r\n clickTarget = getImageHref(element);\r\n break;\r\n case \"INPUT\":\r\n var type = element.type;\r\n if (type && (clickCaptureInputTypes[type.toUpperCase()])) {\r\n var loc = getLocation() || {};\r\n if (element.form) {\r\n clickTarget = element.form.action || (loc.pathname || \"\");\r\n }\r\n else {\r\n clickTarget = loc.pathname || \"\";\r\n }\r\n }\r\n break;\r\n default:\r\n break;\r\n }\r\n return clickTarget;\r\n}\r\n/**\r\n * Execute callback when DOM finish loading\r\n */\r\nexport function onDomLoaded(callback) {\r\n onDomReadyDo(function () {\r\n if (hasDocument && document.readyState === \"complete\") {\r\n callback();\r\n }\r\n else {\r\n var win = getWindow();\r\n if (win) {\r\n if (win.addEventListener) {\r\n win.addEventListener(\"load\", function () {\r\n callback();\r\n }); // NB **not** 'onload'\r\n }\r\n else if (win.attachEvent) {\r\n win.attachEvent(\"onload\", function () {\r\n callback();\r\n }); // IE8\r\n }\r\n }\r\n }\r\n });\r\n}\r\n// use smallest domready ever for IE8. When IE8 is deprecated, use addEventListener('DomContentLoaded')\r\nfunction onDomReadyDo(f) {\r\n /// <summary> fires function f on domRead </summary>\r\n /// <param type='function'>function to call on domRead</param>\r\n var doc = getDocument() || {};\r\n /in/.test(doc.readyState) ? setTimeout(function () { onDomReadyDo(f); }, 100) : f.call();\r\n}\r\n/**\r\n * Gets the pageName from the DOM or by calling a override if set.\r\n * @param config - configuration object\r\n * @returns Page name.\r\n */\r\nexport function getPageName(config, overrideValues) {\r\n /// <summary>\r\n /// Gets the pageName from the DOM or by calling a override if set.\r\n /// </summary>\r\n if (overrideValues && overrideValues.pageName) {\r\n return overrideValues.pageName;\r\n }\r\n else if (config.callback && isFunction(config.callback.pageName)) {\r\n return config.callback.pageName();\r\n }\r\n else if (config.coreData && config.coreData.pageName) {\r\n return config.coreData.pageName;\r\n }\r\n else {\r\n var doc = getDocument();\r\n return doc && doc.title || \"\";\r\n }\r\n}\r\n/**\r\n * Sanitize URL values\r\n * @param config - Configuration\r\n * @param location - window.location or document.location\r\n * @returns Flag indicating if an element is market PII.\r\n */\r\nexport function sanitizeUrl(config, location) {\r\n if (!location) {\r\n return null;\r\n }\r\n var url = location.protocol + \"//\" + (location.hostname || location.host) + // location.hostname is not supported on Opera and Opera for Android\r\n (isValueAssigned(location.port) ? \":\" + location.port : \"\") +\r\n location.pathname;\r\n return url;\r\n}\r\n/**\r\n * Get URI, sanitize the value if configured on\r\n * @param config - Configuration\r\n * @param location - window.location or document.location\r\n * @returns Flag indicating if an element is market PII.\r\n */\r\nexport function getUri(config, location) {\r\n if (config.coreData && config.coreData.requestUri && config.coreData.requestUri !== \"\") {\r\n return config.coreData.requestUri;\r\n }\r\n return sanitizeUrl(config, location);\r\n}\r\n//# sourceMappingURL=DataCollector.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;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;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;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;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;AACA;AACA;AACA;AACA;AACA"}
|
package/dist-esm/Enums.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Application Insights JavaScript SDK - Click Analytics, 2.7.1-nightly.202110-
|
|
2
|
+
* Application Insights JavaScript SDK - Click Analytics, 2.7.1-nightly.202110-16
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* @copyright Microsoft 2020
|
|
7
7
|
*/
|
|
8
8
|
export var ActionType = {
|
|
9
|
-
CLICKLEFT:
|
|
10
|
-
CLICKRIGHT:
|
|
11
|
-
CLICKMIDDLE:
|
|
12
|
-
SCROLL:
|
|
13
|
-
ZOOM:
|
|
14
|
-
RESIZE:
|
|
15
|
-
KEYBOARDENTER:
|
|
16
|
-
KEYBOARDSPACE:
|
|
17
|
-
OTHER:
|
|
9
|
+
CLICKLEFT: "CL",
|
|
10
|
+
CLICKRIGHT: "CR",
|
|
11
|
+
CLICKMIDDLE: "CM",
|
|
12
|
+
SCROLL: "S",
|
|
13
|
+
ZOOM: "Z",
|
|
14
|
+
RESIZE: "R",
|
|
15
|
+
KEYBOARDENTER: "KE",
|
|
16
|
+
KEYBOARDSPACE: "KS",
|
|
17
|
+
OTHER: "O"
|
|
18
18
|
};
|
|
19
19
|
//# sourceMappingURL=Enums.js.map
|
package/dist-esm/Enums.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Enums.js.map","sources":["Enums.js"],"sourcesContent":["/**\r\n * @copyright Microsoft 2020\r\n */\r\nexport var ActionType = {\r\n CLICKLEFT:
|
|
1
|
+
{"version":3,"file":"Enums.js.map","sources":["Enums.js"],"sourcesContent":["/**\r\n * @copyright Microsoft 2020\r\n */\r\nexport var ActionType = {\r\n CLICKLEFT: \"CL\",\r\n CLICKRIGHT: \"CR\",\r\n CLICKMIDDLE: \"CM\",\r\n SCROLL: \"S\",\r\n ZOOM: \"Z\",\r\n RESIZE: \"R\",\r\n KEYBOARDENTER: \"KE\",\r\n KEYBOARDSPACE: \"KS\",\r\n OTHER: \"O\"\r\n};\r\n//# sourceMappingURL=Enums.js.map"],"names":[],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
package/dist-esm/common/Utils.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Application Insights JavaScript SDK - Click Analytics, 2.7.1-nightly.202110-
|
|
2
|
+
* Application Insights JavaScript SDK - Click Analytics, 2.7.1-nightly.202110-16
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
@@ -8,10 +8,10 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { __assignFn as __assign } from "@microsoft/applicationinsights-shims";
|
|
10
10
|
import { isNullOrUndefined, _InternalMessageId, hasDocument, hasOwnProperty, arrForEach } from "@microsoft/applicationinsights-core-js";
|
|
11
|
-
var Prototype =
|
|
12
|
-
var DEFAULT_DONOT_TRACK_TAG =
|
|
13
|
-
var DEFAULT_AI_BLOB_ATTRIBUTE_TAG =
|
|
14
|
-
var DEFAULT_DATA_PREFIX =
|
|
11
|
+
var Prototype = "prototype";
|
|
12
|
+
var DEFAULT_DONOT_TRACK_TAG = "ai-dnt";
|
|
13
|
+
var DEFAULT_AI_BLOB_ATTRIBUTE_TAG = "ai-blob";
|
|
14
|
+
var DEFAULT_DATA_PREFIX = "data-";
|
|
15
15
|
export var _ExtendedInternalMessageId = __assign(__assign({}, _InternalMessageId), { CannotParseAiBlobValue: 101, InvalidContentBlob: 102, TrackPageActionEventFailed: 103 });
|
|
16
16
|
/**
|
|
17
17
|
* Finds attributes in overrideConfig which are invalid or should be objects
|
|
@@ -24,7 +24,7 @@ export function removeNonObjectsAndInvalidElements(overrideConfig, attributeName
|
|
|
24
24
|
for (var i in attributeNamesExpectedObjects) {
|
|
25
25
|
if (attributeNamesExpectedObjects.hasOwnProperty(i)) {
|
|
26
26
|
var objectName = attributeNamesExpectedObjects[i];
|
|
27
|
-
if (typeof overrideConfig[objectName] ===
|
|
27
|
+
if (typeof overrideConfig[objectName] === "object") {
|
|
28
28
|
removeInvalidElements(overrideConfig[objectName]);
|
|
29
29
|
}
|
|
30
30
|
else {
|
|
@@ -44,7 +44,7 @@ export function removeInvalidElements(object) {
|
|
|
44
44
|
/// the workaround regarding 'callback'
|
|
45
45
|
for (var property in object) {
|
|
46
46
|
if (!isValueAssigned(object[property]) ||
|
|
47
|
-
(JSON.stringify(object[property]) ===
|
|
47
|
+
(JSON.stringify(object[property]) === "{}" && (property !== "callback"))) {
|
|
48
48
|
delete object[property];
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -58,7 +58,7 @@ export function isValueAssigned(value) {
|
|
|
58
58
|
/// <summary> takes a value and checks for undefined, null and empty string </summary>
|
|
59
59
|
/// <param type="any"> value to be tested </param>
|
|
60
60
|
/// <returns> true if value is null undefined or emptyString </returns>
|
|
61
|
-
return !(isNullOrUndefined(value) || value ===
|
|
61
|
+
return !(isNullOrUndefined(value) || value === "");
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
64
64
|
* Determines whether an event is a right click or not
|
|
@@ -67,10 +67,10 @@ export function isValueAssigned(value) {
|
|
|
67
67
|
*/
|
|
68
68
|
export function isRightClick(evt) {
|
|
69
69
|
try {
|
|
70
|
-
if (
|
|
70
|
+
if ("which" in evt) { // Chrome, FF, ...
|
|
71
71
|
return (evt.which === 3);
|
|
72
72
|
}
|
|
73
|
-
else if (
|
|
73
|
+
else if ("button" in evt) { // IE, ...
|
|
74
74
|
return (evt.button === 2);
|
|
75
75
|
}
|
|
76
76
|
}
|
|
@@ -85,10 +85,10 @@ export function isRightClick(evt) {
|
|
|
85
85
|
*/
|
|
86
86
|
export function isLeftClick(evt) {
|
|
87
87
|
try {
|
|
88
|
-
if (
|
|
88
|
+
if ("which" in evt) { // Chrome, FF, ...
|
|
89
89
|
return (evt.which === 1);
|
|
90
90
|
}
|
|
91
|
-
else if (
|
|
91
|
+
else if ("button" in evt) { // IE, ...
|
|
92
92
|
return (evt.button === 1);
|
|
93
93
|
}
|
|
94
94
|
}
|
|
@@ -103,10 +103,10 @@ export function isLeftClick(evt) {
|
|
|
103
103
|
*/
|
|
104
104
|
export function isMiddleClick(evt) {
|
|
105
105
|
try {
|
|
106
|
-
if (
|
|
106
|
+
if ("which" in evt) { // Chrome, FF, ...
|
|
107
107
|
return (evt.which === 2);
|
|
108
108
|
}
|
|
109
|
-
else if (
|
|
109
|
+
else if ("button" in evt) { // IE, ...
|
|
110
110
|
return (evt.button === 4);
|
|
111
111
|
}
|
|
112
112
|
}
|
|
@@ -121,7 +121,7 @@ export function isMiddleClick(evt) {
|
|
|
121
121
|
*/
|
|
122
122
|
export function isKeyboardEnter(evt) {
|
|
123
123
|
try {
|
|
124
|
-
if (
|
|
124
|
+
if ("keyCode" in evt) { // Chrome, FF, ...
|
|
125
125
|
return (evt.keyCode === 13);
|
|
126
126
|
}
|
|
127
127
|
}
|
|
@@ -136,7 +136,7 @@ export function isKeyboardEnter(evt) {
|
|
|
136
136
|
*/
|
|
137
137
|
export function isKeyboardSpace(evt) {
|
|
138
138
|
try {
|
|
139
|
-
if (
|
|
139
|
+
if ("keyCode" in evt) { // Chrome, FF, ...
|
|
140
140
|
return (evt.keyCode === 32);
|
|
141
141
|
}
|
|
142
142
|
}
|
|
@@ -202,7 +202,7 @@ export function walkUpDomChainWithElementValidation(el, validationMethod, valida
|
|
|
202
202
|
* @returns Is element an anchor
|
|
203
203
|
*/
|
|
204
204
|
export function isElementAnAnchor(element) {
|
|
205
|
-
return element.nodeName ===
|
|
205
|
+
return element.nodeName === "A";
|
|
206
206
|
}
|
|
207
207
|
/**
|
|
208
208
|
* Walks up DOM tree to find anchor element
|
|
@@ -238,7 +238,7 @@ export function bracketIt(str) {
|
|
|
238
238
|
/// <summary>
|
|
239
239
|
/// Adds surrounding square brackets to the passed in text
|
|
240
240
|
/// </summary>
|
|
241
|
-
return
|
|
241
|
+
return "[" + str + "]";
|
|
242
242
|
}
|
|
243
243
|
/**
|
|
244
244
|
* Pass in the objects to merge as arguments.
|
|
@@ -258,7 +258,7 @@ export function extend(obj, obj2, obj3, obj4, obj5) {
|
|
|
258
258
|
var objProto = Object[Prototype];
|
|
259
259
|
var theArgs = arguments;
|
|
260
260
|
// Check if a deep merge
|
|
261
|
-
if (objProto.toString.call(theArgs[0]) ===
|
|
261
|
+
if (objProto.toString.call(theArgs[0]) === "[object Boolean]") {
|
|
262
262
|
deep = theArgs[0];
|
|
263
263
|
i++;
|
|
264
264
|
}
|
|
@@ -267,7 +267,7 @@ export function extend(obj, obj2, obj3, obj4, obj5) {
|
|
|
267
267
|
for (var prop in obj) {
|
|
268
268
|
if (hasOwnProperty(obj, prop)) {
|
|
269
269
|
// If deep merge and property is an object, merge properties
|
|
270
|
-
if (deep && objProto.toString.call(obj[prop]) ===
|
|
270
|
+
if (deep && objProto.toString.call(obj[prop]) === "[object Object]") {
|
|
271
271
|
extended[prop] = extend(true, extended[prop], obj[prop]);
|
|
272
272
|
}
|
|
273
273
|
else {
|
|
@@ -300,10 +300,10 @@ export function mergeConfig(overrideConfig) {
|
|
|
300
300
|
pageTags: {},
|
|
301
301
|
// overrideValues to use instead of collecting automatically
|
|
302
302
|
coreData: {
|
|
303
|
-
referrerUri: hasDocument ? document.referrer :
|
|
304
|
-
requestUri:
|
|
305
|
-
pageName:
|
|
306
|
-
pageType:
|
|
303
|
+
referrerUri: hasDocument ? document.referrer : "",
|
|
304
|
+
requestUri: "",
|
|
305
|
+
pageName: "",
|
|
306
|
+
pageType: ""
|
|
307
307
|
},
|
|
308
308
|
dataTags: {
|
|
309
309
|
useDefaultContentNameOrId: false,
|
|
@@ -318,7 +318,7 @@ export function mergeConfig(overrideConfig) {
|
|
|
318
318
|
};
|
|
319
319
|
var attributesThatAreObjectsInConfig = [];
|
|
320
320
|
for (var attribute in defaultConfig) {
|
|
321
|
-
if (typeof defaultConfig[attribute] ===
|
|
321
|
+
if (typeof defaultConfig[attribute] === "object") {
|
|
322
322
|
attributesThatAreObjectsInConfig.push(attribute);
|
|
323
323
|
}
|
|
324
324
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Utils.js.map","sources":["Utils.js"],"sourcesContent":["/**\r\n * @copyright Microsoft 2020\r\n * File containing utility functions.\r\n */\r\nimport { __assign } from \"tslib\";\r\nimport { isNullOrUndefined, _InternalMessageId, hasDocument, hasOwnProperty, arrForEach } from \"@microsoft/applicationinsights-core-js\";\r\nvar Prototype = 'prototype';\r\nvar DEFAULT_DONOT_TRACK_TAG = 'ai-dnt';\r\nvar DEFAULT_AI_BLOB_ATTRIBUTE_TAG = 'ai-blob';\r\nvar DEFAULT_DATA_PREFIX = 'data-';\r\nexport var _ExtendedInternalMessageId = __assign(__assign({}, _InternalMessageId), { CannotParseAiBlobValue: 101, InvalidContentBlob: 102, TrackPageActionEventFailed: 103 });\r\n/**\r\n * Finds attributes in overrideConfig which are invalid or should be objects\r\n * and deletes them. useful in override config\r\n * @param overrideConfig - override config object\r\n * @param attributeNamesExpectedObjects - attributes that should be objects in override config object\r\n */\r\nexport function removeNonObjectsAndInvalidElements(overrideConfig, attributeNamesExpectedObjects) {\r\n removeInvalidElements(overrideConfig);\r\n for (var i in attributeNamesExpectedObjects) {\r\n if (attributeNamesExpectedObjects.hasOwnProperty(i)) {\r\n var objectName = attributeNamesExpectedObjects[i];\r\n if (typeof overrideConfig[objectName] === 'object') {\r\n removeInvalidElements(overrideConfig[objectName]);\r\n }\r\n else {\r\n delete overrideConfig[objectName];\r\n }\r\n }\r\n }\r\n}\r\n/**\r\n * Finds attributes in object which are invalid\r\n * and deletes them. useful in override config\r\n * @param object Input object\r\n */\r\nexport function removeInvalidElements(object) {\r\n /// Because the config object 'callback' contains only functions,\r\n /// when it is stringified it returns the empty object. This explains\r\n /// the workaround regarding 'callback'\r\n for (var property in object) {\r\n if (!isValueAssigned(object[property]) ||\r\n (JSON.stringify(object[property]) === '{}' && (property !== 'callback'))) {\r\n delete object[property];\r\n }\r\n }\r\n}\r\n/**\r\n * Checks if value is assigned to the given param.\r\n * @param value - The token from which the tenant id is to be extracted.\r\n * @returns True/false denoting if value is assigned to the param.\r\n */\r\nexport function isValueAssigned(value) {\r\n /// <summary> takes a value and checks for undefined, null and empty string </summary>\r\n /// <param type=\"any\"> value to be tested </param>\r\n /// <returns> true if value is null undefined or emptyString </returns>\r\n return !(isNullOrUndefined(value) || value === '');\r\n}\r\n/**\r\n * Determines whether an event is a right click or not\r\n * @param evt - Mouse event\r\n * @returns true if the event is a right click\r\n */\r\nexport function isRightClick(evt) {\r\n try {\r\n if ('which' in evt) { // Chrome, FF, ...\r\n return (evt.which === 3);\r\n }\r\n else if ('button' in evt) { // IE, ...\r\n return (evt.button === 2);\r\n }\r\n }\r\n catch (e) {\r\n // This can happen with some native browser objects, but should not happen for the type we are checking for\r\n }\r\n}\r\n/**\r\n * Determines whether an event is a left click or not\r\n * @param evt - Mouse event\r\n * @returns true if the event is a left click\r\n */\r\nexport function isLeftClick(evt) {\r\n try {\r\n if ('which' in evt) { // Chrome, FF, ...\r\n return (evt.which === 1);\r\n }\r\n else if ('button' in evt) { // IE, ...\r\n return (evt.button === 1);\r\n }\r\n }\r\n catch (e) {\r\n // This can happen with some native browser objects, but should not happen for the type we are checking for\r\n }\r\n}\r\n/**\r\n * Determines whether an event is a middle click or not\r\n * @param evt - Mouse event\r\n * @returns true if the event is a middle click\r\n */\r\nexport function isMiddleClick(evt) {\r\n try {\r\n if ('which' in evt) { // Chrome, FF, ...\r\n return (evt.which === 2);\r\n }\r\n else if ('button' in evt) { // IE, ...\r\n return (evt.button === 4);\r\n }\r\n }\r\n catch (e) {\r\n // This can happen with some native browser objects, but should not happen for the type we are checking for\r\n }\r\n}\r\n/**\r\n * Determines whether an event is a keyboard enter or not\r\n * @param evt - Keyboard event\r\n * @returns true if the event is a keyboard enter\r\n */\r\nexport function isKeyboardEnter(evt) {\r\n try {\r\n if ('keyCode' in evt) { // Chrome, FF, ...\r\n return (evt.keyCode === 13);\r\n }\r\n }\r\n catch (e) {\r\n // This can happen with some native browser objects, but should not happen for the type we are checking for\r\n }\r\n}\r\n/**\r\n * Determines whether an event is a keyboard space or not\r\n * @param evt - Keyboard event\r\n * @returns true if the event is a space enter\r\n */\r\nexport function isKeyboardSpace(evt) {\r\n try {\r\n if ('keyCode' in evt) { // Chrome, FF, ...\r\n return (evt.keyCode === 32);\r\n }\r\n }\r\n catch (e) {\r\n // This can happen with some native browser objects, but should not happen for the type we are checking for\r\n }\r\n}\r\n/**\r\n * Determines whether the elemt have a DNT(Do Not Track) tag\r\n * @param element - DOM element\r\n * @param doNotTrackFieldName - DOM element\r\n * @returns true if the element must not be tarcked\r\n */\r\nexport function isElementDnt(element, doNotTrackFieldName) {\r\n var dntElement = findClosestByAttribute(element, doNotTrackFieldName);\r\n if (!isValueAssigned(dntElement)) {\r\n return false;\r\n }\r\n return true;\r\n}\r\n/**\r\n * Walks up DOM tree to find element with attribute\r\n * @param el - DOM element\r\n * @param attribute - Attribute name\r\n * @returns Dom element which contains attribute\r\n */\r\nexport function findClosestByAttribute(el, attribute) {\r\n return walkUpDomChainWithElementValidation(el, isAttributeInElement, attribute);\r\n}\r\n/**\r\n * checks if attribute is in element.\r\n * method checks for empty string, in case the attribute is set but no value is assigned to it\r\n * @param element - DOM element\r\n * @param attributeToLookFor - Attribute name\r\n * @returns true if attribute is in element, even if empty string\r\n */\r\nexport function isAttributeInElement(element, attributeToLookFor) {\r\n var value = element.getAttribute(attributeToLookFor);\r\n return isValueAssigned(value);\r\n}\r\n/**\r\n * Walks up DOM tree to find element which matches validationMethod\r\n * @param el - DOM element\r\n * @param validationMethod - DOM element validation method\r\n * @param validationMethodParam - DOM element validation method parameters\r\n * @returns Dom element which is an anchor\r\n */\r\nexport function walkUpDomChainWithElementValidation(el, validationMethod, validationMethodParam) {\r\n var element = el;\r\n if (element) {\r\n while (!validationMethod(element, validationMethodParam)) {\r\n element = element.parentNode;\r\n if (!element || !(element.getAttribute)) {\r\n return null;\r\n }\r\n }\r\n return element;\r\n }\r\n}\r\n/**\r\n * Determine if DOM element is an anchor\r\n * @param element - DOM element\r\n * @returns Is element an anchor\r\n */\r\nexport function isElementAnAnchor(element) {\r\n return element.nodeName === 'A';\r\n}\r\n/**\r\n * Walks up DOM tree to find anchor element\r\n * @param element - DOM element\r\n * @returns Dom element which is an anchor\r\n */\r\nexport function findClosestAnchor(element) {\r\n /// <summary> Walks up DOM tree to find anchor element </summary>\r\n /// <param type='object'> DOM element </param>\r\n /// <returns> Dom element which is an anchor</returns>\r\n return walkUpDomChainWithElementValidation(element, isElementAnAnchor);\r\n}\r\n/**\r\n * Returns the specified field and also removes the property from the object if exists.\r\n * @param obj - Input object\r\n * @param fieldName - >Name of the field/property to be extracted\r\n * @returns Value of the specified tag\r\n */\r\nexport function extractFieldFromObject(obj, fieldName) {\r\n var fieldValue;\r\n if (obj && obj[fieldName]) {\r\n fieldValue = obj[fieldName];\r\n delete obj[fieldName];\r\n }\r\n return fieldValue;\r\n}\r\n/**\r\n * Adds surrounding square brackets to the passed in text\r\n * @param str - Input string\r\n * @returns String with surrounding brackets\r\n */\r\nexport function bracketIt(str) {\r\n /// <summary>\r\n /// Adds surrounding square brackets to the passed in text\r\n /// </summary>\r\n return '[' + str + ']';\r\n}\r\n/**\r\n * Pass in the objects to merge as arguments.\r\n * @param obj1 - object to merge. Set this argument to 'true' for a deep extend.\r\n * @param obj2 - object to merge.\r\n * @param obj3 - object to merge.\r\n * @param obj4 - object to merge.\r\n * @param obj5 - object to merge.\r\n * @returns The extended object.\r\n */\r\nexport function extend(obj, obj2, obj3, obj4, obj5) {\r\n // Variables\r\n var extended = {};\r\n var deep = false;\r\n var i = 0;\r\n var length = arguments.length;\r\n var objProto = Object[Prototype];\r\n var theArgs = arguments;\r\n // Check if a deep merge\r\n if (objProto.toString.call(theArgs[0]) === '[object Boolean]') {\r\n deep = theArgs[0];\r\n i++;\r\n }\r\n // Merge the object into the extended object\r\n var merge = function (obj) {\r\n for (var prop in obj) {\r\n if (hasOwnProperty(obj, prop)) {\r\n // If deep merge and property is an object, merge properties\r\n if (deep && objProto.toString.call(obj[prop]) === '[object Object]') {\r\n extended[prop] = extend(true, extended[prop], obj[prop]);\r\n }\r\n else {\r\n extended[prop] = obj[prop];\r\n }\r\n }\r\n }\r\n };\r\n // Loop through each object and conduct a merge\r\n for (; i < length; i++) {\r\n var obj = theArgs[i];\r\n merge(obj);\r\n }\r\n return extended;\r\n}\r\nexport function validateContentNamePrefix(config, defaultDataPrefix) {\r\n return isValueAssigned(config.dataTags.customDataPrefix) && (config.dataTags.customDataPrefix.indexOf(defaultDataPrefix) === 0);\r\n}\r\n/**\r\n * Merge passed in configuration with default configuration\r\n * @param overrideConfig\r\n */\r\nexport function mergeConfig(overrideConfig) {\r\n var defaultConfig = {\r\n // General library settings\r\n autoCapture: true,\r\n callback: {\r\n pageActionPageTags: null\r\n },\r\n pageTags: {},\r\n // overrideValues to use instead of collecting automatically\r\n coreData: {\r\n referrerUri: hasDocument ? document.referrer : '',\r\n requestUri: '',\r\n pageName: '',\r\n pageType: ''\r\n },\r\n dataTags: {\r\n useDefaultContentNameOrId: false,\r\n aiBlobAttributeTag: DEFAULT_AI_BLOB_ATTRIBUTE_TAG,\r\n customDataPrefix: DEFAULT_DATA_PREFIX,\r\n captureAllMetaDataContent: false,\r\n dntDataTag: DEFAULT_DONOT_TRACK_TAG\r\n },\r\n behaviorValidator: function (key) { return key || \"\"; },\r\n defaultRightClickBhvr: \"\",\r\n dropInvalidEvents: false\r\n };\r\n var attributesThatAreObjectsInConfig = [];\r\n for (var attribute in defaultConfig) {\r\n if (typeof defaultConfig[attribute] === 'object') {\r\n attributesThatAreObjectsInConfig.push(attribute);\r\n }\r\n }\r\n if (overrideConfig) {\r\n // delete attributes that should be object and\r\n // delete properties that are null, undefined, ''\r\n removeNonObjectsAndInvalidElements(overrideConfig, attributesThatAreObjectsInConfig);\r\n if (isValueAssigned(overrideConfig.dataTags)) {\r\n overrideConfig.dataTags.customDataPrefix = validateContentNamePrefix(overrideConfig, DEFAULT_DATA_PREFIX) ? overrideConfig.dataTags.customDataPrefix : DEFAULT_DATA_PREFIX;\r\n }\r\n return extend(true, defaultConfig, overrideConfig);\r\n }\r\n}\r\nexport function BehaviorMapValidator(map) {\r\n return function (key) { return map[key] || \"\"; };\r\n}\r\nexport function BehaviorValueValidator(behaviorArray) {\r\n return function (key) {\r\n var result;\r\n arrForEach(behaviorArray, function (value) {\r\n if (value === key) {\r\n result = value;\r\n return -1;\r\n }\r\n });\r\n return result || \"\";\r\n };\r\n}\r\nexport function BehaviorEnumValidator(enumObj) {\r\n return function (key) { return enumObj[key] || \"\"; };\r\n}\r\n//# sourceMappingURL=Utils.js.map"],"names":[],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA,8EAAiC;AACjC;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;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;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;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;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;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;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;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;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;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;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;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
|
1
|
+
{"version":3,"file":"Utils.js.map","sources":["Utils.js"],"sourcesContent":["/**\r\n * @copyright Microsoft 2020\r\n * File containing utility functions.\r\n */\r\nimport { __assign } from \"tslib\";\r\nimport { isNullOrUndefined, _InternalMessageId, hasDocument, hasOwnProperty, arrForEach } from \"@microsoft/applicationinsights-core-js\";\r\nvar Prototype = \"prototype\";\r\nvar DEFAULT_DONOT_TRACK_TAG = \"ai-dnt\";\r\nvar DEFAULT_AI_BLOB_ATTRIBUTE_TAG = \"ai-blob\";\r\nvar DEFAULT_DATA_PREFIX = \"data-\";\r\nexport var _ExtendedInternalMessageId = __assign(__assign({}, _InternalMessageId), { CannotParseAiBlobValue: 101, InvalidContentBlob: 102, TrackPageActionEventFailed: 103 });\r\n/**\r\n * Finds attributes in overrideConfig which are invalid or should be objects\r\n * and deletes them. useful in override config\r\n * @param overrideConfig - override config object\r\n * @param attributeNamesExpectedObjects - attributes that should be objects in override config object\r\n */\r\nexport function removeNonObjectsAndInvalidElements(overrideConfig, attributeNamesExpectedObjects) {\r\n removeInvalidElements(overrideConfig);\r\n for (var i in attributeNamesExpectedObjects) {\r\n if (attributeNamesExpectedObjects.hasOwnProperty(i)) {\r\n var objectName = attributeNamesExpectedObjects[i];\r\n if (typeof overrideConfig[objectName] === \"object\") {\r\n removeInvalidElements(overrideConfig[objectName]);\r\n }\r\n else {\r\n delete overrideConfig[objectName];\r\n }\r\n }\r\n }\r\n}\r\n/**\r\n * Finds attributes in object which are invalid\r\n * and deletes them. useful in override config\r\n * @param object Input object\r\n */\r\nexport function removeInvalidElements(object) {\r\n /// Because the config object 'callback' contains only functions,\r\n /// when it is stringified it returns the empty object. This explains\r\n /// the workaround regarding 'callback'\r\n for (var property in object) {\r\n if (!isValueAssigned(object[property]) ||\r\n (JSON.stringify(object[property]) === \"{}\" && (property !== \"callback\"))) {\r\n delete object[property];\r\n }\r\n }\r\n}\r\n/**\r\n * Checks if value is assigned to the given param.\r\n * @param value - The token from which the tenant id is to be extracted.\r\n * @returns True/false denoting if value is assigned to the param.\r\n */\r\nexport function isValueAssigned(value) {\r\n /// <summary> takes a value and checks for undefined, null and empty string </summary>\r\n /// <param type=\"any\"> value to be tested </param>\r\n /// <returns> true if value is null undefined or emptyString </returns>\r\n return !(isNullOrUndefined(value) || value === \"\");\r\n}\r\n/**\r\n * Determines whether an event is a right click or not\r\n * @param evt - Mouse event\r\n * @returns true if the event is a right click\r\n */\r\nexport function isRightClick(evt) {\r\n try {\r\n if (\"which\" in evt) { // Chrome, FF, ...\r\n return (evt.which === 3);\r\n }\r\n else if (\"button\" in evt) { // IE, ...\r\n return (evt.button === 2);\r\n }\r\n }\r\n catch (e) {\r\n // This can happen with some native browser objects, but should not happen for the type we are checking for\r\n }\r\n}\r\n/**\r\n * Determines whether an event is a left click or not\r\n * @param evt - Mouse event\r\n * @returns true if the event is a left click\r\n */\r\nexport function isLeftClick(evt) {\r\n try {\r\n if (\"which\" in evt) { // Chrome, FF, ...\r\n return (evt.which === 1);\r\n }\r\n else if (\"button\" in evt) { // IE, ...\r\n return (evt.button === 1);\r\n }\r\n }\r\n catch (e) {\r\n // This can happen with some native browser objects, but should not happen for the type we are checking for\r\n }\r\n}\r\n/**\r\n * Determines whether an event is a middle click or not\r\n * @param evt - Mouse event\r\n * @returns true if the event is a middle click\r\n */\r\nexport function isMiddleClick(evt) {\r\n try {\r\n if (\"which\" in evt) { // Chrome, FF, ...\r\n return (evt.which === 2);\r\n }\r\n else if (\"button\" in evt) { // IE, ...\r\n return (evt.button === 4);\r\n }\r\n }\r\n catch (e) {\r\n // This can happen with some native browser objects, but should not happen for the type we are checking for\r\n }\r\n}\r\n/**\r\n * Determines whether an event is a keyboard enter or not\r\n * @param evt - Keyboard event\r\n * @returns true if the event is a keyboard enter\r\n */\r\nexport function isKeyboardEnter(evt) {\r\n try {\r\n if (\"keyCode\" in evt) { // Chrome, FF, ...\r\n return (evt.keyCode === 13);\r\n }\r\n }\r\n catch (e) {\r\n // This can happen with some native browser objects, but should not happen for the type we are checking for\r\n }\r\n}\r\n/**\r\n * Determines whether an event is a keyboard space or not\r\n * @param evt - Keyboard event\r\n * @returns true if the event is a space enter\r\n */\r\nexport function isKeyboardSpace(evt) {\r\n try {\r\n if (\"keyCode\" in evt) { // Chrome, FF, ...\r\n return (evt.keyCode === 32);\r\n }\r\n }\r\n catch (e) {\r\n // This can happen with some native browser objects, but should not happen for the type we are checking for\r\n }\r\n}\r\n/**\r\n * Determines whether the elemt have a DNT(Do Not Track) tag\r\n * @param element - DOM element\r\n * @param doNotTrackFieldName - DOM element\r\n * @returns true if the element must not be tarcked\r\n */\r\nexport function isElementDnt(element, doNotTrackFieldName) {\r\n var dntElement = findClosestByAttribute(element, doNotTrackFieldName);\r\n if (!isValueAssigned(dntElement)) {\r\n return false;\r\n }\r\n return true;\r\n}\r\n/**\r\n * Walks up DOM tree to find element with attribute\r\n * @param el - DOM element\r\n * @param attribute - Attribute name\r\n * @returns Dom element which contains attribute\r\n */\r\nexport function findClosestByAttribute(el, attribute) {\r\n return walkUpDomChainWithElementValidation(el, isAttributeInElement, attribute);\r\n}\r\n/**\r\n * checks if attribute is in element.\r\n * method checks for empty string, in case the attribute is set but no value is assigned to it\r\n * @param element - DOM element\r\n * @param attributeToLookFor - Attribute name\r\n * @returns true if attribute is in element, even if empty string\r\n */\r\nexport function isAttributeInElement(element, attributeToLookFor) {\r\n var value = element.getAttribute(attributeToLookFor);\r\n return isValueAssigned(value);\r\n}\r\n/**\r\n * Walks up DOM tree to find element which matches validationMethod\r\n * @param el - DOM element\r\n * @param validationMethod - DOM element validation method\r\n * @param validationMethodParam - DOM element validation method parameters\r\n * @returns Dom element which is an anchor\r\n */\r\nexport function walkUpDomChainWithElementValidation(el, validationMethod, validationMethodParam) {\r\n var element = el;\r\n if (element) {\r\n while (!validationMethod(element, validationMethodParam)) {\r\n element = element.parentNode;\r\n if (!element || !(element.getAttribute)) {\r\n return null;\r\n }\r\n }\r\n return element;\r\n }\r\n}\r\n/**\r\n * Determine if DOM element is an anchor\r\n * @param element - DOM element\r\n * @returns Is element an anchor\r\n */\r\nexport function isElementAnAnchor(element) {\r\n return element.nodeName === \"A\";\r\n}\r\n/**\r\n * Walks up DOM tree to find anchor element\r\n * @param element - DOM element\r\n * @returns Dom element which is an anchor\r\n */\r\nexport function findClosestAnchor(element) {\r\n /// <summary> Walks up DOM tree to find anchor element </summary>\r\n /// <param type='object'> DOM element </param>\r\n /// <returns> Dom element which is an anchor</returns>\r\n return walkUpDomChainWithElementValidation(element, isElementAnAnchor);\r\n}\r\n/**\r\n * Returns the specified field and also removes the property from the object if exists.\r\n * @param obj - Input object\r\n * @param fieldName - >Name of the field/property to be extracted\r\n * @returns Value of the specified tag\r\n */\r\nexport function extractFieldFromObject(obj, fieldName) {\r\n var fieldValue;\r\n if (obj && obj[fieldName]) {\r\n fieldValue = obj[fieldName];\r\n delete obj[fieldName];\r\n }\r\n return fieldValue;\r\n}\r\n/**\r\n * Adds surrounding square brackets to the passed in text\r\n * @param str - Input string\r\n * @returns String with surrounding brackets\r\n */\r\nexport function bracketIt(str) {\r\n /// <summary>\r\n /// Adds surrounding square brackets to the passed in text\r\n /// </summary>\r\n return \"[\" + str + \"]\";\r\n}\r\n/**\r\n * Pass in the objects to merge as arguments.\r\n * @param obj1 - object to merge. Set this argument to 'true' for a deep extend.\r\n * @param obj2 - object to merge.\r\n * @param obj3 - object to merge.\r\n * @param obj4 - object to merge.\r\n * @param obj5 - object to merge.\r\n * @returns The extended object.\r\n */\r\nexport function extend(obj, obj2, obj3, obj4, obj5) {\r\n // Variables\r\n var extended = {};\r\n var deep = false;\r\n var i = 0;\r\n var length = arguments.length;\r\n var objProto = Object[Prototype];\r\n var theArgs = arguments;\r\n // Check if a deep merge\r\n if (objProto.toString.call(theArgs[0]) === \"[object Boolean]\") {\r\n deep = theArgs[0];\r\n i++;\r\n }\r\n // Merge the object into the extended object\r\n var merge = function (obj) {\r\n for (var prop in obj) {\r\n if (hasOwnProperty(obj, prop)) {\r\n // If deep merge and property is an object, merge properties\r\n if (deep && objProto.toString.call(obj[prop]) === \"[object Object]\") {\r\n extended[prop] = extend(true, extended[prop], obj[prop]);\r\n }\r\n else {\r\n extended[prop] = obj[prop];\r\n }\r\n }\r\n }\r\n };\r\n // Loop through each object and conduct a merge\r\n for (; i < length; i++) {\r\n var obj = theArgs[i];\r\n merge(obj);\r\n }\r\n return extended;\r\n}\r\nexport function validateContentNamePrefix(config, defaultDataPrefix) {\r\n return isValueAssigned(config.dataTags.customDataPrefix) && (config.dataTags.customDataPrefix.indexOf(defaultDataPrefix) === 0);\r\n}\r\n/**\r\n * Merge passed in configuration with default configuration\r\n * @param overrideConfig\r\n */\r\nexport function mergeConfig(overrideConfig) {\r\n var defaultConfig = {\r\n // General library settings\r\n autoCapture: true,\r\n callback: {\r\n pageActionPageTags: null\r\n },\r\n pageTags: {},\r\n // overrideValues to use instead of collecting automatically\r\n coreData: {\r\n referrerUri: hasDocument ? document.referrer : \"\",\r\n requestUri: \"\",\r\n pageName: \"\",\r\n pageType: \"\"\r\n },\r\n dataTags: {\r\n useDefaultContentNameOrId: false,\r\n aiBlobAttributeTag: DEFAULT_AI_BLOB_ATTRIBUTE_TAG,\r\n customDataPrefix: DEFAULT_DATA_PREFIX,\r\n captureAllMetaDataContent: false,\r\n dntDataTag: DEFAULT_DONOT_TRACK_TAG\r\n },\r\n behaviorValidator: function (key) { return key || \"\"; },\r\n defaultRightClickBhvr: \"\",\r\n dropInvalidEvents: false\r\n };\r\n var attributesThatAreObjectsInConfig = [];\r\n for (var attribute in defaultConfig) {\r\n if (typeof defaultConfig[attribute] === \"object\") {\r\n attributesThatAreObjectsInConfig.push(attribute);\r\n }\r\n }\r\n if (overrideConfig) {\r\n // delete attributes that should be object and\r\n // delete properties that are null, undefined, ''\r\n removeNonObjectsAndInvalidElements(overrideConfig, attributesThatAreObjectsInConfig);\r\n if (isValueAssigned(overrideConfig.dataTags)) {\r\n overrideConfig.dataTags.customDataPrefix = validateContentNamePrefix(overrideConfig, DEFAULT_DATA_PREFIX) ? overrideConfig.dataTags.customDataPrefix : DEFAULT_DATA_PREFIX;\r\n }\r\n return extend(true, defaultConfig, overrideConfig);\r\n }\r\n}\r\nexport function BehaviorMapValidator(map) {\r\n return function (key) { return map[key] || \"\"; };\r\n}\r\nexport function BehaviorValueValidator(behaviorArray) {\r\n return function (key) {\r\n var result;\r\n arrForEach(behaviorArray, function (value) {\r\n if (value === key) {\r\n result = value;\r\n return -1;\r\n }\r\n });\r\n return result || \"\";\r\n };\r\n}\r\nexport function BehaviorEnumValidator(enumObj) {\r\n return function (key) { return enumObj[key] || \"\"; };\r\n}\r\n//# sourceMappingURL=Utils.js.map"],"names":[],"mappings":";;;;AAAA;AACA;AACA;AACA;AACA,8EAAiC;AACjC;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;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;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;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;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;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;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;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;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;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;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;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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Application Insights JavaScript SDK - Click Analytics, 2.7.1-nightly.202110-
|
|
2
|
+
* Application Insights JavaScript SDK - Click Analytics, 2.7.1-nightly.202110-16
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
6
6
|
* @copyright Microsoft 2020
|
|
7
7
|
*/
|
|
8
8
|
import { __extendsFn as __extends } from "@microsoft/applicationinsights-shims";
|
|
9
|
-
import { WebEvent } from
|
|
10
|
-
import * as DataCollector from
|
|
9
|
+
import { WebEvent } from "./WebEvent";
|
|
10
|
+
import * as DataCollector from "../DataCollector";
|
|
11
11
|
import { getPerformance, LoggingSeverity, objForEachKey } from "@microsoft/applicationinsights-core-js";
|
|
12
|
-
import { extractFieldFromObject, bracketIt, isValueAssigned, extend, _ExtendedInternalMessageId } from
|
|
13
|
-
import { strNotSpecified } from
|
|
12
|
+
import { extractFieldFromObject, bracketIt, isValueAssigned, extend, _ExtendedInternalMessageId } from "../common/Utils";
|
|
13
|
+
import { strNotSpecified } from "@microsoft/applicationinsights-common";
|
|
14
14
|
var PageAction = /** @class */ (function (_super) {
|
|
15
15
|
__extends(PageAction, _super);
|
|
16
16
|
function PageAction() {
|
|
@@ -25,28 +25,28 @@ var PageAction = /** @class */ (function (_super) {
|
|
|
25
25
|
var _this = this;
|
|
26
26
|
// Get part A properties
|
|
27
27
|
var ext = {};
|
|
28
|
-
ext[
|
|
28
|
+
ext["web"] = {};
|
|
29
29
|
var event = {
|
|
30
30
|
name: "Microsoft.ApplicationInsights.{0}.Event",
|
|
31
|
-
baseType:
|
|
31
|
+
baseType: "EventData",
|
|
32
32
|
ext: ext,
|
|
33
33
|
data: {},
|
|
34
34
|
baseData: {}
|
|
35
35
|
};
|
|
36
|
-
this._populateEventDataIfPresent(event.baseData,
|
|
37
|
-
this._populateEventDataIfPresent(event.data,
|
|
38
|
-
this._populateEventDataIfPresent(event.data,
|
|
39
|
-
this._populateEventDataIfPresent(event.data,
|
|
40
|
-
this._populateEventDataIfPresent(event.data,
|
|
41
|
-
this._populateEventDataIfPresent(event.data,
|
|
42
|
-
this._populateEventDataIfPresent(event.data,
|
|
43
|
-
this._populateEventDataIfPresent(event.data,
|
|
44
|
-
this._populateEventDataIfPresent(event.data,
|
|
45
|
-
this._populateEventDataIfPresent(event.data,
|
|
46
|
-
this._populateEventDataIfPresent(event.data,
|
|
47
|
-
this._populateEventDataIfPresent(event.data,
|
|
48
|
-
this._populateEventDataIfPresent(event.data,
|
|
49
|
-
this._populateEventDataIfPresent(event.data,
|
|
36
|
+
this._populateEventDataIfPresent(event.baseData, "name", pageActionEvent.name);
|
|
37
|
+
this._populateEventDataIfPresent(event.data, "baseTypeSource", "ClickEvent");
|
|
38
|
+
this._populateEventDataIfPresent(event.data, "uri", pageActionEvent.uri);
|
|
39
|
+
this._populateEventDataIfPresent(event.data, "pageType", pageActionEvent.pageType);
|
|
40
|
+
this._populateEventDataIfPresent(event.data, "properties", pageActionEvent.properties);
|
|
41
|
+
this._populateEventDataIfPresent(event.data, "actionType", pageActionEvent.actionType);
|
|
42
|
+
this._populateEventDataIfPresent(event.data, "behavior", pageActionEvent.behavior);
|
|
43
|
+
this._populateEventDataIfPresent(event.data, "clickCoordinates", pageActionEvent.clickCoordinates);
|
|
44
|
+
this._populateEventDataIfPresent(event.data, "content", pageActionEvent.content);
|
|
45
|
+
this._populateEventDataIfPresent(event.data, "targetUri", pageActionEvent.targetUri);
|
|
46
|
+
this._populateEventDataIfPresent(event.data, "timeToAction", pageActionEvent.timeToAction);
|
|
47
|
+
this._populateEventDataIfPresent(event.data, "refUri", pageActionEvent.refUri);
|
|
48
|
+
this._populateEventDataIfPresent(event.data, "pageName", pageActionEvent.pageName);
|
|
49
|
+
this._populateEventDataIfPresent(event.data, "parentId", pageActionEvent.parentId);
|
|
50
50
|
if (properties) {
|
|
51
51
|
objForEachKey(properties, function (property, value) {
|
|
52
52
|
if (!event.data[property]) {
|
|
@@ -65,7 +65,7 @@ var PageAction = /** @class */ (function (_super) {
|
|
|
65
65
|
*/
|
|
66
66
|
PageAction.prototype.capturePageAction = function (element, overrideValues, customProperties, isRightClick) {
|
|
67
67
|
overrideValues = !isValueAssigned(overrideValues) ? {} : overrideValues;
|
|
68
|
-
var pageActionEvent = { name:
|
|
68
|
+
var pageActionEvent = { name: "" };
|
|
69
69
|
var pageActionProperties = isValueAssigned(customProperties) ? customProperties : {};
|
|
70
70
|
this.setCommonProperties(pageActionEvent, overrideValues);
|
|
71
71
|
pageActionEvent.behavior = this._getBehavior(overrideValues);
|
|
@@ -82,7 +82,7 @@ var PageAction = /** @class */ (function (_super) {
|
|
|
82
82
|
elementContent = this._contentHandler.getElementContent(element); // collect id,cn tags
|
|
83
83
|
// if the element has a data-*-bhvr attrib defined, use it.
|
|
84
84
|
if (elementContent.bhvr && !isValueAssigned(overrideValues.behavior)) {
|
|
85
|
-
var currentBehavior = extractFieldFromObject(elementContent,
|
|
85
|
+
var currentBehavior = extractFieldFromObject(elementContent, "bhvr");
|
|
86
86
|
pageActionEvent.behavior = this._getValidBehavior(currentBehavior);
|
|
87
87
|
}
|
|
88
88
|
// Validate to ensure the minimum required field 'contentName' or 'id' is present. However,
|
|
@@ -98,7 +98,7 @@ var PageAction = /** @class */ (function (_super) {
|
|
|
98
98
|
pageActionEvent.actionType = overrideValues.actionType;
|
|
99
99
|
}
|
|
100
100
|
if (isValueAssigned(overrideValues.clickCoordinateX) && isValueAssigned(overrideValues.clickCoordinateY)) {
|
|
101
|
-
pageActionEvent.clickCoordinates = overrideValues.clickCoordinateX +
|
|
101
|
+
pageActionEvent.clickCoordinates = overrideValues.clickCoordinateX + "X" + overrideValues.clickCoordinateY;
|
|
102
102
|
}
|
|
103
103
|
this._sanitizePageActionEventContent(elementContent);
|
|
104
104
|
pageActionEvent.content = bracketIt(JSON.stringify(extend(elementContent, overrideValues && overrideValues.contentTags ? overrideValues.contentTags : {})));
|