@microsoft/applicationinsights-clickanalytics-js 2.7.5-nightly.2204-03 → 2.7.5-nightly.2204-23

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.
Files changed (79) hide show
  1. package/browser/ai.clck.2.7.5-nightly.2204-23.cjs.js +2011 -0
  2. package/browser/ai.clck.2.7.5-nightly.2204-23.cjs.js.map +1 -0
  3. package/browser/ai.clck.2.7.5-nightly.2204-23.cjs.min.js +6 -0
  4. package/browser/ai.clck.2.7.5-nightly.2204-23.cjs.min.js.map +1 -0
  5. package/browser/ai.clck.2.7.5-nightly.2204-23.gbl.js +2015 -0
  6. package/browser/ai.clck.2.7.5-nightly.2204-23.gbl.js.map +1 -0
  7. package/browser/ai.clck.2.7.5-nightly.2204-23.gbl.min.js +6 -0
  8. package/browser/ai.clck.2.7.5-nightly.2204-23.gbl.min.js.map +1 -0
  9. package/browser/ai.clck.2.7.5-nightly.2204-23.integrity.json +66 -0
  10. package/browser/ai.clck.2.7.5-nightly.2204-23.js +2017 -0
  11. package/browser/ai.clck.2.7.5-nightly.2204-23.js.map +1 -0
  12. package/browser/ai.clck.2.7.5-nightly.2204-23.min.js +6 -0
  13. package/browser/ai.clck.2.7.5-nightly.2204-23.min.js.map +1 -0
  14. package/browser/ai.clck.2.cjs.js +810 -1682
  15. package/browser/ai.clck.2.cjs.js.map +1 -1
  16. package/browser/ai.clck.2.cjs.min.js +2 -2
  17. package/browser/ai.clck.2.cjs.min.js.map +1 -1
  18. package/browser/ai.clck.2.gbl.js +810 -1682
  19. package/browser/ai.clck.2.gbl.js.map +1 -1
  20. package/browser/ai.clck.2.gbl.min.js +2 -2
  21. package/browser/ai.clck.2.gbl.min.js.map +1 -1
  22. package/browser/ai.clck.2.js +810 -1682
  23. package/browser/ai.clck.2.js.map +1 -1
  24. package/browser/ai.clck.2.min.js +2 -2
  25. package/browser/ai.clck.2.min.js.map +1 -1
  26. package/dist/applicationinsights-clickanalytics-js.api.json +27 -29
  27. package/dist/applicationinsights-clickanalytics-js.api.md +0 -1
  28. package/dist/applicationinsights-clickanalytics-js.d.ts +5 -2
  29. package/dist/applicationinsights-clickanalytics-js.js +810 -1682
  30. package/dist/applicationinsights-clickanalytics-js.js.map +1 -1
  31. package/dist/applicationinsights-clickanalytics-js.min.js +2 -2
  32. package/dist/applicationinsights-clickanalytics-js.min.js.map +1 -1
  33. package/dist/applicationinsights-clickanalytics-js.rollup.d.ts +5 -2
  34. package/dist-esm/Behaviours.js +1 -1
  35. package/dist-esm/ClickAnalyticsPlugin.js +50 -74
  36. package/dist-esm/ClickAnalyticsPlugin.js.map +1 -1
  37. package/dist-esm/DataCollector.js +2 -4
  38. package/dist-esm/DataCollector.js.map +1 -1
  39. package/dist-esm/Enums.js +1 -1
  40. package/dist-esm/Interfaces/Datamodel.js +1 -1
  41. package/dist-esm/applicationinsights-clickanalytics-js.js +1 -1
  42. package/dist-esm/common/Utils.js +1 -1
  43. package/dist-esm/events/PageAction.js +126 -128
  44. package/dist-esm/events/PageAction.js.map +1 -1
  45. package/dist-esm/events/WebEvent.js +94 -109
  46. package/dist-esm/events/WebEvent.js.map +1 -1
  47. package/dist-esm/handlers/AutoCaptureHandler.js +83 -85
  48. package/dist-esm/handlers/AutoCaptureHandler.js.map +1 -1
  49. package/dist-esm/handlers/DomContentHandler.js +276 -279
  50. package/dist-esm/handlers/DomContentHandler.js.map +1 -1
  51. package/package.json +6 -6
  52. package/src/ClickAnalyticsPlugin.ts +47 -92
  53. package/src/DataCollector.ts +22 -24
  54. package/src/Interfaces/Datamodel.ts +21 -20
  55. package/src/common/Utils.ts +8 -8
  56. package/src/events/PageAction.ts +131 -165
  57. package/src/events/WebEvent.ts +78 -147
  58. package/src/handlers/AutoCaptureHandler.ts +79 -89
  59. package/src/handlers/DomContentHandler.ts +303 -336
  60. package/types/ClickAnalyticsPlugin.d.ts +4 -1
  61. package/types/Interfaces/Datamodel.d.ts +2 -3
  62. package/types/events/PageAction.d.ts +6 -6
  63. package/types/events/WebEvent.d.ts +17 -17
  64. package/types/handlers/AutoCaptureHandler.d.ts +10 -2
  65. package/types/handlers/DomContentHandler.d.ts +50 -3
  66. package/types/tsdoc-metadata.json +1 -1
  67. package/browser/ai.clck.2.7.5-nightly.2204-03.cjs.js +0 -2883
  68. package/browser/ai.clck.2.7.5-nightly.2204-03.cjs.js.map +0 -1
  69. package/browser/ai.clck.2.7.5-nightly.2204-03.cjs.min.js +0 -6
  70. package/browser/ai.clck.2.7.5-nightly.2204-03.cjs.min.js.map +0 -1
  71. package/browser/ai.clck.2.7.5-nightly.2204-03.gbl.js +0 -2887
  72. package/browser/ai.clck.2.7.5-nightly.2204-03.gbl.js.map +0 -1
  73. package/browser/ai.clck.2.7.5-nightly.2204-03.gbl.min.js +0 -6
  74. package/browser/ai.clck.2.7.5-nightly.2204-03.gbl.min.js.map +0 -1
  75. package/browser/ai.clck.2.7.5-nightly.2204-03.integrity.json +0 -66
  76. package/browser/ai.clck.2.7.5-nightly.2204-03.js +0 -2889
  77. package/browser/ai.clck.2.7.5-nightly.2204-03.js.map +0 -1
  78. package/browser/ai.clck.2.7.5-nightly.2204-03.min.js +0 -6
  79. package/browser/ai.clck.2.7.5-nightly.2204-03.min.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft.ApplicationInsights, 2.7.5-nightly.2204-03
2
+ * Microsoft.ApplicationInsights, 2.7.5-nightly.2204-23
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -34,7 +34,10 @@ export declare class ClickAnalyticsPlugin extends BaseTelemetryPlugin {
34
34
  identifier: string;
35
35
  priority: number;
36
36
  static Version: string;
37
- constructor();
37
+ private _config;
38
+ private pageAction;
39
+ private _autoCaptureHandler;
40
+ private _contentHandler;
38
41
  initialize(config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
39
42
  processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
40
43
  /**
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Click Analytics, 2.7.5-nightly.2204-03
2
+ * Application Insights JavaScript SDK - Click Analytics, 2.7.5-nightly.2204-23
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  /**
@@ -1,13 +1,12 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Click Analytics, 2.7.5-nightly.2204-03
2
+ * Application Insights JavaScript SDK - Click Analytics, 2.7.5-nightly.2204-23
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 dynamicProto from "@microsoft/dynamicproto-js";
10
- import { BaseTelemetryPlugin, isNullOrUndefined, LoggingSeverity, arrForEach, dumpObj, getExceptionName, throwError, _throwInternal, unloadComponents } from "@microsoft/applicationinsights-core-js";
9
+ import { BaseTelemetryPlugin, isNullOrUndefined, LoggingSeverity, arrForEach, dumpObj, getExceptionName } from "@microsoft/applicationinsights-core-js";
11
10
  import { PropertiesPluginIdentifier } from "@microsoft/applicationinsights-common";
12
11
  import { mergeConfig, BehaviorMapValidator, BehaviorValueValidator, BehaviorEnumValidator, _ExtendedInternalMessageId } from "./common/Utils";
13
12
  import { PageAction } from "./events/PageAction";
@@ -17,81 +16,58 @@ export { BehaviorMapValidator, BehaviorValueValidator, BehaviorEnumValidator };
17
16
  var ClickAnalyticsPlugin = /** @class */ (function (_super) {
18
17
  __extends(ClickAnalyticsPlugin, _super);
19
18
  function ClickAnalyticsPlugin() {
20
- var _this = _super.call(this) || this;
19
+ var _this = _super !== null && _super.apply(this, arguments) || this;
21
20
  _this.identifier = "ClickAnalyticsPlugin";
22
21
  _this.priority = 181;
23
- var _config;
24
- var _pageAction;
25
- var _autoCaptureHandler;
26
- var _contentHandler;
27
- dynamicProto(ClickAnalyticsPlugin, _this, function (_self, _base) {
28
- var _identifier = _self.identifier;
29
- _initDefaults();
30
- _self.initialize = function (config, core, extensions, pluginChain) {
31
- if (isNullOrUndefined(core)) {
32
- throwError("Error initializing");
33
- }
34
- config.extensionConfig = config.extensionConfig || [];
35
- config.extensionConfig[_identifier] = config.extensionConfig[_identifier] || {};
36
- _config = mergeConfig(config.extensionConfig[_identifier]);
37
- _super.prototype.initialize.call(_this, config, core, extensions, pluginChain);
38
- var logger = _self.diagLog();
39
- // Default to DOM content handler
40
- _contentHandler = _contentHandler ? _contentHandler : new DomContentHandler(_config, logger);
41
- var metaTags = _contentHandler.getMetadata();
42
- _pageAction = new PageAction(_this, _config, _contentHandler, _config.callback.pageActionPageTags, metaTags, logger);
43
- // Default to DOM autoCapture handler
44
- _autoCaptureHandler = _autoCaptureHandler ? _autoCaptureHandler : new AutoCaptureHandler(_self, _config, _pageAction, logger);
45
- if (_config.autoCapture) {
46
- _autoCaptureHandler.click();
47
- }
48
- // Find the properties plugin.
49
- var _propertiesExtension;
50
- arrForEach(extensions, function (extension) {
51
- if (extension.identifier === PropertiesPluginIdentifier) {
52
- _propertiesExtension = extension;
53
- }
54
- });
55
- // Append Click Analytics Plugin Version to SDK version.
56
- if (_propertiesExtension && _propertiesExtension.context &&
57
- _propertiesExtension.context.internal && _propertiesExtension.context.internal.sdkVersion) {
58
- _propertiesExtension.context.internal.sdkVersion += "_ClickPlugin" + ClickAnalyticsPlugin.Version;
59
- }
60
- };
61
- _self.processTelemetry = function (env, itemCtx) {
62
- _self.processNext(env, itemCtx);
63
- };
64
- _self.trackPageAction = function (pageAction, customProperties) {
65
- try {
66
- _pageAction.trackPageAction(pageAction, customProperties);
67
- }
68
- catch (e) {
69
- _throwInternal(_self.diagLog(), LoggingSeverity.CRITICAL, _ExtendedInternalMessageId.TrackPageActionEventFailed, "trackPageAction failed, page action event will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
70
- }
71
- };
72
- _self._doTeardown = function (unloadCtx, unloadState, asyncCallback) {
73
- return unloadComponents([
74
- _autoCaptureHandler,
75
- _contentHandler,
76
- _pageAction
77
- ], unloadCtx, unloadState, function () {
78
- _initDefaults();
79
- asyncCallback && asyncCallback();
80
- });
81
- };
82
- });
83
- function _initDefaults() {
84
- _config = null;
85
- _pageAction = null;
86
- _autoCaptureHandler = null;
87
- _contentHandler = null;
88
- }
89
22
  return _this;
90
23
  }
91
- // Removed Stub for ClickAnalyticsPlugin.prototype.initialize.
92
- // Removed Stub for ClickAnalyticsPlugin.prototype.processTelemetry.
93
- // Removed Stub for ClickAnalyticsPlugin.prototype.trackPageAction.
94
- ClickAnalyticsPlugin.Version = "2.7.5-nightly.2204-03";
24
+ ClickAnalyticsPlugin.prototype.initialize = function (config, core, extensions, pluginChain) {
25
+ if (isNullOrUndefined(core)) {
26
+ throw Error("Error initializing");
27
+ }
28
+ config.extensionConfig = config.extensionConfig || [];
29
+ config.extensionConfig[this.identifier] = config.extensionConfig[this.identifier] || {};
30
+ this._config = mergeConfig(config.extensionConfig[this.identifier]);
31
+ _super.prototype.initialize.call(this, config, core, extensions, pluginChain);
32
+ // Default to DOM content handler
33
+ this._contentHandler = this._contentHandler ? this._contentHandler : new DomContentHandler(this._config, this.diagLog());
34
+ var metaTags = this._contentHandler.getMetadata();
35
+ this.pageAction = new PageAction(this, this._config, this._contentHandler, this._config.callback.pageActionPageTags, metaTags, this.diagLog());
36
+ // Default to DOM autoCapture handler
37
+ this._autoCaptureHandler = this._autoCaptureHandler ? this._autoCaptureHandler : new AutoCaptureHandler(this, this._config, this.pageAction, this.diagLog());
38
+ if (this._config.autoCapture) {
39
+ this._autoCaptureHandler.click();
40
+ }
41
+ // Find the properties plugin.
42
+ var _propertiesExtension;
43
+ arrForEach(extensions, function (extension) {
44
+ if (extension.identifier === PropertiesPluginIdentifier) {
45
+ _propertiesExtension = extension;
46
+ }
47
+ });
48
+ // Append Click Analytics Plugin Version to SDK version.
49
+ if (_propertiesExtension && _propertiesExtension.context &&
50
+ _propertiesExtension.context.internal && _propertiesExtension.context.internal.sdkVersion) {
51
+ _propertiesExtension.context.internal.sdkVersion += "_ClickPlugin" + ClickAnalyticsPlugin.Version;
52
+ }
53
+ };
54
+ ClickAnalyticsPlugin.prototype.processTelemetry = function (env, itemCtx) {
55
+ this.processNext(env, itemCtx);
56
+ };
57
+ /**
58
+ * Logs a page action event.
59
+ * @param IPageActionTelemetry
60
+ * @param customProperties Additional data used to filter events and metrics. Defaults to empty.
61
+ */
62
+ ClickAnalyticsPlugin.prototype.trackPageAction = function (pageAction, customProperties) {
63
+ try {
64
+ this.pageAction.trackPageAction(pageAction, customProperties);
65
+ }
66
+ catch (e) {
67
+ this.diagLog().throwInternal(LoggingSeverity.CRITICAL, _ExtendedInternalMessageId.TrackPageActionEventFailed, "trackPageAction failed, page action event will not be collected: " + getExceptionName(e), { exception: dumpObj(e) });
68
+ }
69
+ };
70
+ ClickAnalyticsPlugin.Version = "2.7.5-nightly.2204-23";
95
71
  return ClickAnalyticsPlugin;
96
72
  }(BaseTelemetryPlugin));
97
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 dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { BaseTelemetryPlugin, isNullOrUndefined, LoggingSeverity, arrForEach, dumpObj, getExceptionName, throwError, _throwInternal, unloadComponents } 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.call(this) || this;\r\n _this.identifier = \"ClickAnalyticsPlugin\";\r\n _this.priority = 181;\r\n var _config;\r\n var _pageAction;\r\n var _autoCaptureHandler;\r\n var _contentHandler;\r\n dynamicProto(ClickAnalyticsPlugin, _this, function (_self, _base) {\r\n var _identifier = _self.identifier;\r\n _initDefaults();\r\n _self.initialize = function (config, core, extensions, pluginChain) {\r\n if (isNullOrUndefined(core)) {\r\n throwError(\"Error initializing\");\r\n }\r\n config.extensionConfig = config.extensionConfig || [];\r\n config.extensionConfig[_identifier] = config.extensionConfig[_identifier] || {};\r\n _config = mergeConfig(config.extensionConfig[_identifier]);\r\n _super.prototype.initialize.call(_this, config, core, extensions, pluginChain);\r\n var logger = _self.diagLog();\r\n // Default to DOM content handler\r\n _contentHandler = _contentHandler ? _contentHandler : new DomContentHandler(_config, logger);\r\n var metaTags = _contentHandler.getMetadata();\r\n _pageAction = new PageAction(_this, _config, _contentHandler, _config.callback.pageActionPageTags, metaTags, logger);\r\n // Default to DOM autoCapture handler\r\n _autoCaptureHandler = _autoCaptureHandler ? _autoCaptureHandler : new AutoCaptureHandler(_self, _config, _pageAction, logger);\r\n if (_config.autoCapture) {\r\n _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 _self.processTelemetry = function (env, itemCtx) {\r\n _self.processNext(env, itemCtx);\r\n };\r\n _self.trackPageAction = function (pageAction, customProperties) {\r\n try {\r\n _pageAction.trackPageAction(pageAction, customProperties);\r\n }\r\n catch (e) {\r\n _throwInternal(_self.diagLog(), LoggingSeverity.CRITICAL, _ExtendedInternalMessageId.TrackPageActionEventFailed, \"trackPageAction failed, page action event will not be collected: \" + getExceptionName(e), { exception: dumpObj(e) });\r\n }\r\n };\r\n _self._doTeardown = function (unloadCtx, unloadState, asyncCallback) {\r\n return unloadComponents([\r\n _autoCaptureHandler,\r\n _contentHandler,\r\n _pageAction\r\n ], unloadCtx, unloadState, function () {\r\n _initDefaults();\r\n asyncCallback && asyncCallback();\r\n });\r\n };\r\n });\r\n function _initDefaults() {\r\n _config = null;\r\n _pageAction = null;\r\n _autoCaptureHandler = null;\r\n _contentHandler = null;\r\n }\r\n return _this;\r\n }\r\n ClickAnalyticsPlugin.prototype.initialize = function (config, core, extensions, pluginChain) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n ClickAnalyticsPlugin.prototype.processTelemetry = function (env, itemCtx) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\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 // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n ClickAnalyticsPlugin.Version = \"2.7.5-nightly.2204-03\";\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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;mEAaM;AACN;AACA;AACA;AACA;AACA"}
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.5-nightly.2204-23\";\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,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Click Analytics, 2.7.5-nightly.2204-03
2
+ * Application Insights JavaScript SDK - Click Analytics, 2.7.5-nightly.2204-23
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  /**
@@ -90,9 +90,7 @@ function onDomReadyDo(f) {
90
90
  /// <summary> fires function f on domRead </summary>
91
91
  /// <param type='function'>function to call on domRead</param>
92
92
  var doc = getDocument() || {};
93
- /in/.test(doc.readyState) ? setTimeout(function () {
94
- onDomReadyDo(f);
95
- }, 100) : f.call();
93
+ /in/.test(doc.readyState) ? setTimeout(function () { onDomReadyDo(f); }, 100) : f.call();
96
94
  }
97
95
  /**
98
96
  * Gets the pageName from the DOM or by calling a override if set.
@@ -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 \"@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 () {\r\n onDomReadyDo(f);\r\n }, 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;AACA;AACA"}
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,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Click Analytics, 2.7.5-nightly.2204-03
2
+ * Application Insights JavaScript SDK - Click Analytics, 2.7.5-nightly.2204-23
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Click Analytics, 2.7.5-nightly.2204-03
2
+ * Application Insights JavaScript SDK - Click Analytics, 2.7.5-nightly.2204-23
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Click Analytics, 2.7.5-nightly.2204-03
2
+ * Application Insights JavaScript SDK - Click Analytics, 2.7.5-nightly.2204-23
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
 
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Click Analytics, 2.7.5-nightly.2204-03
2
+ * Application Insights JavaScript SDK - Click Analytics, 2.7.5-nightly.2204-23
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  /**
@@ -1,12 +1,11 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Click Analytics, 2.7.5-nightly.2204-03
2
+ * Application Insights JavaScript SDK - Click Analytics, 2.7.5-nightly.2204-23
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 dynamicProto from "@microsoft/dynamicproto-js";
10
9
  import { WebEvent } from "./WebEvent";
11
10
  import * as DataCollector from "../DataCollector";
12
11
  import { getPerformance, LoggingSeverity, objForEachKey } from "@microsoft/applicationinsights-core-js";
@@ -14,137 +13,136 @@ import { extractFieldFromObject, bracketIt, isValueAssigned, extend, _ExtendedIn
14
13
  import { strNotSpecified } from "@microsoft/applicationinsights-common";
15
14
  var PageAction = /** @class */ (function (_super) {
16
15
  __extends(PageAction, _super);
17
- function PageAction(clickAnalyticsPlugin, config, contentHandler, pageTagsCallback, metaTags, traceLogger) {
18
- var _this = _super.call(this, clickAnalyticsPlugin, config, contentHandler, pageTagsCallback, metaTags, traceLogger) || this;
19
- dynamicProto(PageAction, _this, function (_self, _base) {
20
- _self.trackPageAction = function (pageActionEvent, properties) {
21
- // Get part A properties
22
- var ext = {};
23
- ext["web"] = {};
24
- var event = {
25
- name: "Microsoft.ApplicationInsights.{0}.Event",
26
- baseType: "EventData",
27
- ext: ext,
28
- data: {},
29
- baseData: {}
30
- };
31
- _populateEventDataIfPresent(event.baseData, "name", pageActionEvent.name);
32
- _populateEventDataIfPresent(event.data, "baseTypeSource", "ClickEvent");
33
- _populateEventDataIfPresent(event.data, "uri", pageActionEvent.uri);
34
- _populateEventDataIfPresent(event.data, "pageType", pageActionEvent.pageType);
35
- _populateEventDataIfPresent(event.data, "properties", pageActionEvent.properties);
36
- _populateEventDataIfPresent(event.data, "actionType", pageActionEvent.actionType);
37
- _populateEventDataIfPresent(event.data, "behavior", pageActionEvent.behavior);
38
- _populateEventDataIfPresent(event.data, "clickCoordinates", pageActionEvent.clickCoordinates);
39
- _populateEventDataIfPresent(event.data, "content", pageActionEvent.content);
40
- _populateEventDataIfPresent(event.data, "targetUri", pageActionEvent.targetUri);
41
- _populateEventDataIfPresent(event.data, "timeToAction", pageActionEvent.timeToAction);
42
- _populateEventDataIfPresent(event.data, "refUri", pageActionEvent.refUri);
43
- _populateEventDataIfPresent(event.data, "pageName", pageActionEvent.pageName);
44
- _populateEventDataIfPresent(event.data, "parentId", pageActionEvent.parentId);
45
- if (properties) {
46
- objForEachKey(properties, function (property, value) {
47
- if (!event.data[property]) {
48
- _populateEventDataIfPresent(event.data, property, value);
49
- }
50
- });
51
- }
52
- _self._clickAnalyticsPlugin.core.track(event);
53
- };
54
- /**
55
- * API to create and send a populated PageAction event
56
- * @param element - DOM element
57
- * @param overrideValues - PageAction overrides
58
- * @param customProperties - Custom properties(Part C)
59
- * @param isRightClick - Flag for mouse right clicks
60
- */
61
- _self.capturePageAction = function (element, overrideValues, customProperties, isRightClick) {
62
- overrideValues = !isValueAssigned(overrideValues) ? {} : overrideValues;
63
- var pageActionEvent = { name: "" };
64
- var pageActionProperties = isValueAssigned(customProperties) ? customProperties : {};
65
- _self.setCommonProperties(pageActionEvent, overrideValues);
66
- pageActionEvent.behavior = _self._getBehavior(overrideValues);
67
- // element in scope is needed for below properties. We cannot pass element into the plugin call chain.
68
- // process them here.
69
- var elementContent = {};
70
- if (isRightClick) {
71
- // Default behavior for righ click
72
- pageActionEvent.behavior = _self._config.defaultRightClickBhvr;
73
- }
74
- // Fill PartB
75
- if (element) {
76
- pageActionEvent.targetUri = DataCollector.getClickTarget(element);
77
- elementContent = _self._contentHandler.getElementContent(element); // collect id,cn tags
78
- // if the element has a data-*-bhvr attrib defined, use it.
79
- if (elementContent.bhvr && !isValueAssigned(overrideValues.behavior)) {
80
- var currentBehavior = extractFieldFromObject(elementContent, "bhvr");
81
- pageActionEvent.behavior = _self._getValidBehavior(currentBehavior);
82
- }
83
- // Validate to ensure the minimum required field 'contentName' or 'id' is present. However,
84
- // requiring these fields would result in majority of adopter's content from being collected.
85
- // Just throw a warning and continue collection.
86
- if (!isValueAssigned(elementContent.id) && !isValueAssigned(elementContent.contentName)) {
87
- _self._traceLogger.throwInternal(LoggingSeverity.WARNING, _ExtendedInternalMessageId.InvalidContentBlob, "Missing attributes id or contentName in click event. Click event information will still be collected!");
88
- }
89
- }
90
- pageActionEvent.name = elementContent.id || elementContent.contentName || strNotSpecified;
91
- pageActionEvent.parentId = elementContent.parentid || elementContent.parentName || strNotSpecified;
92
- if (isValueAssigned(overrideValues.actionType)) {
93
- pageActionEvent.actionType = overrideValues.actionType;
94
- }
95
- if (isValueAssigned(overrideValues.clickCoordinateX) && isValueAssigned(overrideValues.clickCoordinateY)) {
96
- pageActionEvent.clickCoordinates = overrideValues.clickCoordinateX + "X" + overrideValues.clickCoordinateY;
97
- }
98
- _sanitizePageActionEventContent(elementContent);
99
- pageActionEvent.content = bracketIt(JSON.stringify(extend(elementContent, overrideValues && overrideValues.contentTags ? overrideValues.contentTags : {})));
100
- pageActionEvent.timeToAction = _getTimeToClick();
101
- pageActionEvent.refUri = isValueAssigned(overrideValues.refUri) ? overrideValues.refUri : _self._config.coreData.referrerUri;
102
- if (_isUndefinedEvent(pageActionEvent)) {
103
- return;
104
- }
105
- _self.trackPageAction(pageActionEvent, pageActionProperties);
106
- };
107
- // capture performance data into PageTags
108
- function _getTimeToClick() {
109
- var perf = getPerformance();
110
- if (perf && perf.timing) {
111
- var isNavigationStart = perf.timing.navigationStart;
112
- if (isNavigationStart && isNavigationStart !== 0) {
113
- return new Date().getTime() - isNavigationStart;
114
- }
16
+ function PageAction() {
17
+ return _super !== null && _super.apply(this, arguments) || this;
18
+ }
19
+ /**
20
+ * API to send pageAction event
21
+ * @param pageActionEvent - PageAction event
22
+ * @param properties - PageAction properties(Part C)
23
+ */
24
+ PageAction.prototype.trackPageAction = function (pageActionEvent, properties) {
25
+ var _this = this;
26
+ // Get part A properties
27
+ var ext = {};
28
+ ext["web"] = {};
29
+ var event = {
30
+ name: "Microsoft.ApplicationInsights.{0}.Event",
31
+ baseType: "EventData",
32
+ ext: ext,
33
+ data: {},
34
+ baseData: {}
35
+ };
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
+ if (properties) {
51
+ objForEachKey(properties, function (property, value) {
52
+ if (!event.data[property]) {
53
+ _this._populateEventDataIfPresent(event.data, property, value);
115
54
  }
116
- return -1;
55
+ });
56
+ }
57
+ this._clickAnalyticsPlugin.core.track(event);
58
+ };
59
+ /**
60
+ * API to create and send a populated PageAction event
61
+ * @param element - DOM element
62
+ * @param overrideValues - PageAction overrides
63
+ * @param customProperties - Custom properties(Part C)
64
+ * @param isRightClick - Flag for mouse right clicks
65
+ */
66
+ PageAction.prototype.capturePageAction = function (element, overrideValues, customProperties, isRightClick) {
67
+ overrideValues = !isValueAssigned(overrideValues) ? {} : overrideValues;
68
+ var pageActionEvent = { name: "" };
69
+ var pageActionProperties = isValueAssigned(customProperties) ? customProperties : {};
70
+ this.setCommonProperties(pageActionEvent, overrideValues);
71
+ pageActionEvent.behavior = this._getBehavior(overrideValues);
72
+ // element in scope is needed for below properties. We cannot pass element into the plugin call chain.
73
+ // process them here.
74
+ var elementContent = {};
75
+ if (isRightClick) {
76
+ // Default behavior for righ click
77
+ pageActionEvent.behavior = this._config.defaultRightClickBhvr;
78
+ }
79
+ // Fill PartB
80
+ if (element) {
81
+ pageActionEvent.targetUri = DataCollector.getClickTarget(element);
82
+ elementContent = this._contentHandler.getElementContent(element); // collect id,cn tags
83
+ // if the element has a data-*-bhvr attrib defined, use it.
84
+ if (elementContent.bhvr && !isValueAssigned(overrideValues.behavior)) {
85
+ var currentBehavior = extractFieldFromObject(elementContent, "bhvr");
86
+ pageActionEvent.behavior = this._getValidBehavior(currentBehavior);
117
87
  }
118
- function _populateEventDataIfPresent(obj, property, value) {
119
- if (isValueAssigned(value)) {
120
- obj[property] = value;
121
- }
88
+ // Validate to ensure the minimum required field 'contentName' or 'id' is present. However,
89
+ // requiring these fields would result in majority of adopter's content from being collected.
90
+ // Just throw a warning and continue collection.
91
+ if (!isValueAssigned(elementContent.id) && !isValueAssigned(elementContent.contentName)) {
92
+ this._traceLogger.throwInternal(LoggingSeverity.WARNING, _ExtendedInternalMessageId.InvalidContentBlob, "Missing attributes id or contentName in click event. Click event information will still be collected!");
122
93
  }
123
- function _sanitizePageActionEventContent(pageActionContent) {
124
- if (pageActionContent) {
125
- delete pageActionContent.id;
126
- delete pageActionContent.parentid;
127
- delete pageActionContent.parentname;
128
- if (_self._config && _self._config.dataTags && isValueAssigned(_self._config.dataTags.parentDataTag)) {
129
- delete pageActionContent[_self._config.dataTags.parentDataTag];
130
- }
131
- }
94
+ }
95
+ pageActionEvent.name = elementContent.id || elementContent.contentName || strNotSpecified;
96
+ pageActionEvent.parentId = elementContent.parentid || elementContent.parentName || strNotSpecified;
97
+ if (isValueAssigned(overrideValues.actionType)) {
98
+ pageActionEvent.actionType = overrideValues.actionType;
99
+ }
100
+ if (isValueAssigned(overrideValues.clickCoordinateX) && isValueAssigned(overrideValues.clickCoordinateY)) {
101
+ pageActionEvent.clickCoordinates = overrideValues.clickCoordinateX + "X" + overrideValues.clickCoordinateY;
102
+ }
103
+ this._sanitizePageActionEventContent(elementContent);
104
+ pageActionEvent.content = bracketIt(JSON.stringify(extend(elementContent, overrideValues && overrideValues.contentTags ? overrideValues.contentTags : {})));
105
+ pageActionEvent.timeToAction = this._getTimeToClick();
106
+ pageActionEvent.refUri = isValueAssigned(overrideValues.refUri) ? overrideValues.refUri : this._config.coreData.referrerUri;
107
+ if (this._isUndefinedEvent(pageActionEvent))
108
+ return;
109
+ this.trackPageAction(pageActionEvent, pageActionProperties);
110
+ };
111
+ // capture performance data into PageTags
112
+ PageAction.prototype._getTimeToClick = function () {
113
+ var perf = getPerformance();
114
+ if (perf && perf.timing) {
115
+ var isNavigationStart = perf.timing.navigationStart;
116
+ if (isNavigationStart && isNavigationStart !== 0) {
117
+ return new Date().getTime() - isNavigationStart;
132
118
  }
133
- function _isUndefinedEvent(pageActionEvent) {
134
- if (_self._config.dropInvalidEvents) {
135
- if (pageActionEvent.name === strNotSpecified
136
- && pageActionEvent.parentId === strNotSpecified
137
- && pageActionEvent.content === "[{}]") {
138
- return true;
139
- }
140
- }
141
- return false;
119
+ }
120
+ return -1;
121
+ };
122
+ PageAction.prototype._populateEventDataIfPresent = function (obj, property, value) {
123
+ if (isValueAssigned(value)) {
124
+ obj[property] = value;
125
+ }
126
+ };
127
+ PageAction.prototype._sanitizePageActionEventContent = function (pageActionContent) {
128
+ if (pageActionContent) {
129
+ delete pageActionContent.id;
130
+ delete pageActionContent.parentid;
131
+ delete pageActionContent.parentname;
132
+ if (this._config && this._config.dataTags && isValueAssigned(this._config.dataTags.parentDataTag)) {
133
+ delete pageActionContent[this._config.dataTags.parentDataTag];
142
134
  }
143
- });
144
- return _this;
145
- }
146
- // Removed Stub for PageAction.prototype.trackPageAction.
147
- // Removed Stub for PageAction.prototype.capturePageAction.
135
+ }
136
+ };
137
+ PageAction.prototype._isUndefinedEvent = function (pageActionEvent) {
138
+ if (this._config.dropInvalidEvents) {
139
+ if (pageActionEvent.name === strNotSpecified
140
+ && pageActionEvent.parentId === strNotSpecified
141
+ && pageActionEvent.content === "[{}]")
142
+ return true;
143
+ }
144
+ return false;
145
+ };
148
146
  return PageAction;
149
147
  }(WebEvent));
150
148
  export { PageAction };
@@ -1 +1 @@
1
- {"version":3,"file":"PageAction.js.map","sources":["PageAction.js"],"sourcesContent":["/**\r\n * @copyright Microsoft 2020\r\n */\r\nimport { __extends } from \"tslib\";\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { WebEvent } from \"./WebEvent\";\r\nimport * as DataCollector from \"../DataCollector\";\r\nimport { getPerformance, LoggingSeverity, objForEachKey } from \"@microsoft/applicationinsights-core-js\";\r\nimport { extractFieldFromObject, bracketIt, isValueAssigned, extend, _ExtendedInternalMessageId } from \"../common/Utils\";\r\nimport { strNotSpecified } from \"@microsoft/applicationinsights-common\";\r\nvar PageAction = /** @class */ (function (_super) {\r\n __extends(PageAction, _super);\r\n function PageAction(clickAnalyticsPlugin, config, contentHandler, pageTagsCallback, metaTags, traceLogger) {\r\n var _this = _super.call(this, clickAnalyticsPlugin, config, contentHandler, pageTagsCallback, metaTags, traceLogger) || this;\r\n dynamicProto(PageAction, _this, function (_self, _base) {\r\n _self.trackPageAction = function (pageActionEvent, properties) {\r\n // Get part A properties\r\n var ext = {};\r\n ext[\"web\"] = {};\r\n var event = {\r\n name: \"Microsoft.ApplicationInsights.{0}.Event\",\r\n baseType: \"EventData\",\r\n ext: ext,\r\n data: {},\r\n baseData: {}\r\n };\r\n _populateEventDataIfPresent(event.baseData, \"name\", pageActionEvent.name);\r\n _populateEventDataIfPresent(event.data, \"baseTypeSource\", \"ClickEvent\");\r\n _populateEventDataIfPresent(event.data, \"uri\", pageActionEvent.uri);\r\n _populateEventDataIfPresent(event.data, \"pageType\", pageActionEvent.pageType);\r\n _populateEventDataIfPresent(event.data, \"properties\", pageActionEvent.properties);\r\n _populateEventDataIfPresent(event.data, \"actionType\", pageActionEvent.actionType);\r\n _populateEventDataIfPresent(event.data, \"behavior\", pageActionEvent.behavior);\r\n _populateEventDataIfPresent(event.data, \"clickCoordinates\", pageActionEvent.clickCoordinates);\r\n _populateEventDataIfPresent(event.data, \"content\", pageActionEvent.content);\r\n _populateEventDataIfPresent(event.data, \"targetUri\", pageActionEvent.targetUri);\r\n _populateEventDataIfPresent(event.data, \"timeToAction\", pageActionEvent.timeToAction);\r\n _populateEventDataIfPresent(event.data, \"refUri\", pageActionEvent.refUri);\r\n _populateEventDataIfPresent(event.data, \"pageName\", pageActionEvent.pageName);\r\n _populateEventDataIfPresent(event.data, \"parentId\", pageActionEvent.parentId);\r\n if (properties) {\r\n objForEachKey(properties, function (property, value) {\r\n if (!event.data[property]) {\r\n _populateEventDataIfPresent(event.data, property, value);\r\n }\r\n });\r\n }\r\n _self._clickAnalyticsPlugin.core.track(event);\r\n };\r\n /**\r\n * API to create and send a populated PageAction event\r\n * @param element - DOM element\r\n * @param overrideValues - PageAction overrides\r\n * @param customProperties - Custom properties(Part C)\r\n * @param isRightClick - Flag for mouse right clicks\r\n */\r\n _self.capturePageAction = function (element, overrideValues, customProperties, isRightClick) {\r\n overrideValues = !isValueAssigned(overrideValues) ? {} : overrideValues;\r\n var pageActionEvent = { name: \"\" };\r\n var pageActionProperties = isValueAssigned(customProperties) ? customProperties : {};\r\n _self.setCommonProperties(pageActionEvent, overrideValues);\r\n pageActionEvent.behavior = _self._getBehavior(overrideValues);\r\n // element in scope is needed for below properties. We cannot pass element into the plugin call chain.\r\n // process them here.\r\n var elementContent = {};\r\n if (isRightClick) {\r\n // Default behavior for righ click\r\n pageActionEvent.behavior = _self._config.defaultRightClickBhvr;\r\n }\r\n // Fill PartB\r\n if (element) {\r\n pageActionEvent.targetUri = DataCollector.getClickTarget(element);\r\n elementContent = _self._contentHandler.getElementContent(element); // collect id,cn tags\r\n // if the element has a data-*-bhvr attrib defined, use it.\r\n if (elementContent.bhvr && !isValueAssigned(overrideValues.behavior)) {\r\n var currentBehavior = extractFieldFromObject(elementContent, \"bhvr\");\r\n pageActionEvent.behavior = _self._getValidBehavior(currentBehavior);\r\n }\r\n // Validate to ensure the minimum required field 'contentName' or 'id' is present. However,\r\n // requiring these fields would result in majority of adopter's content from being collected.\r\n // Just throw a warning and continue collection.\r\n if (!isValueAssigned(elementContent.id) && !isValueAssigned(elementContent.contentName)) {\r\n _self._traceLogger.throwInternal(LoggingSeverity.WARNING, _ExtendedInternalMessageId.InvalidContentBlob, \"Missing attributes id or contentName in click event. Click event information will still be collected!\");\r\n }\r\n }\r\n pageActionEvent.name = elementContent.id || elementContent.contentName || strNotSpecified;\r\n pageActionEvent.parentId = elementContent.parentid || elementContent.parentName || strNotSpecified;\r\n if (isValueAssigned(overrideValues.actionType)) {\r\n pageActionEvent.actionType = overrideValues.actionType;\r\n }\r\n if (isValueAssigned(overrideValues.clickCoordinateX) && isValueAssigned(overrideValues.clickCoordinateY)) {\r\n pageActionEvent.clickCoordinates = overrideValues.clickCoordinateX + \"X\" + overrideValues.clickCoordinateY;\r\n }\r\n _sanitizePageActionEventContent(elementContent);\r\n pageActionEvent.content = bracketIt(JSON.stringify(extend(elementContent, overrideValues && overrideValues.contentTags ? overrideValues.contentTags : {})));\r\n pageActionEvent.timeToAction = _getTimeToClick();\r\n pageActionEvent.refUri = isValueAssigned(overrideValues.refUri) ? overrideValues.refUri : _self._config.coreData.referrerUri;\r\n if (_isUndefinedEvent(pageActionEvent)) {\r\n return;\r\n }\r\n _self.trackPageAction(pageActionEvent, pageActionProperties);\r\n };\r\n // capture performance data into PageTags\r\n function _getTimeToClick() {\r\n var perf = getPerformance();\r\n if (perf && perf.timing) {\r\n var isNavigationStart = perf.timing.navigationStart;\r\n if (isNavigationStart && isNavigationStart !== 0) {\r\n return new Date().getTime() - isNavigationStart;\r\n }\r\n }\r\n return -1;\r\n }\r\n function _populateEventDataIfPresent(obj, property, value) {\r\n if (isValueAssigned(value)) {\r\n obj[property] = value;\r\n }\r\n }\r\n function _sanitizePageActionEventContent(pageActionContent) {\r\n if (pageActionContent) {\r\n delete pageActionContent.id;\r\n delete pageActionContent.parentid;\r\n delete pageActionContent.parentname;\r\n if (_self._config && _self._config.dataTags && isValueAssigned(_self._config.dataTags.parentDataTag)) {\r\n delete pageActionContent[_self._config.dataTags.parentDataTag];\r\n }\r\n }\r\n }\r\n function _isUndefinedEvent(pageActionEvent) {\r\n if (_self._config.dropInvalidEvents) {\r\n if (pageActionEvent.name === strNotSpecified\r\n && pageActionEvent.parentId === strNotSpecified\r\n && pageActionEvent.content === \"[{}]\") {\r\n return true;\r\n }\r\n }\r\n return false;\r\n }\r\n });\r\n return _this;\r\n }\r\n /**\r\n * API to send pageAction event\r\n * @param pageActionEvent - PageAction event\r\n * @param properties - PageAction properties(Part C)\r\n */\r\n PageAction.prototype.trackPageAction = function (pageActionEvent, properties) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n /**\r\n * API to create and send a populated PageAction event\r\n * @param element - DOM element\r\n * @param overrideValues - PageAction overrides\r\n * @param customProperties - Custom properties(Part C)\r\n * @param isRightClick - Flag for mouse right clicks\r\n */\r\n PageAction.prototype.capturePageAction = function (element, overrideValues, customProperties, isRightClick) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n };\r\n return PageAction;\r\n}(WebEvent));\r\nexport { PageAction };\r\n//# sourceMappingURL=PageAction.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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;2DAiBM;AACN;AACA;AACA;AACA"}
1
+ {"version":3,"file":"PageAction.js.map","sources":["PageAction.js"],"sourcesContent":["/**\r\n * @copyright Microsoft 2020\r\n */\r\nimport { __extends } from \"tslib\";\r\nimport { WebEvent } from \"./WebEvent\";\r\nimport * as DataCollector from \"../DataCollector\";\r\nimport { getPerformance, LoggingSeverity, objForEachKey } from \"@microsoft/applicationinsights-core-js\";\r\nimport { extractFieldFromObject, bracketIt, isValueAssigned, extend, _ExtendedInternalMessageId } from \"../common/Utils\";\r\nimport { strNotSpecified } from \"@microsoft/applicationinsights-common\";\r\nvar PageAction = /** @class */ (function (_super) {\r\n __extends(PageAction, _super);\r\n function PageAction() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /**\r\n * API to send pageAction event\r\n * @param pageActionEvent - PageAction event\r\n * @param properties - PageAction properties(Part C)\r\n */\r\n PageAction.prototype.trackPageAction = function (pageActionEvent, properties) {\r\n var _this = this;\r\n // Get part A properties\r\n var ext = {};\r\n ext[\"web\"] = {};\r\n var event = {\r\n name: \"Microsoft.ApplicationInsights.{0}.Event\",\r\n baseType: \"EventData\",\r\n ext: ext,\r\n data: {},\r\n baseData: {}\r\n };\r\n this._populateEventDataIfPresent(event.baseData, \"name\", pageActionEvent.name);\r\n this._populateEventDataIfPresent(event.data, \"baseTypeSource\", \"ClickEvent\");\r\n this._populateEventDataIfPresent(event.data, \"uri\", pageActionEvent.uri);\r\n this._populateEventDataIfPresent(event.data, \"pageType\", pageActionEvent.pageType);\r\n this._populateEventDataIfPresent(event.data, \"properties\", pageActionEvent.properties);\r\n this._populateEventDataIfPresent(event.data, \"actionType\", pageActionEvent.actionType);\r\n this._populateEventDataIfPresent(event.data, \"behavior\", pageActionEvent.behavior);\r\n this._populateEventDataIfPresent(event.data, \"clickCoordinates\", pageActionEvent.clickCoordinates);\r\n this._populateEventDataIfPresent(event.data, \"content\", pageActionEvent.content);\r\n this._populateEventDataIfPresent(event.data, \"targetUri\", pageActionEvent.targetUri);\r\n this._populateEventDataIfPresent(event.data, \"timeToAction\", pageActionEvent.timeToAction);\r\n this._populateEventDataIfPresent(event.data, \"refUri\", pageActionEvent.refUri);\r\n this._populateEventDataIfPresent(event.data, \"pageName\", pageActionEvent.pageName);\r\n this._populateEventDataIfPresent(event.data, \"parentId\", pageActionEvent.parentId);\r\n if (properties) {\r\n objForEachKey(properties, function (property, value) {\r\n if (!event.data[property]) {\r\n _this._populateEventDataIfPresent(event.data, property, value);\r\n }\r\n });\r\n }\r\n this._clickAnalyticsPlugin.core.track(event);\r\n };\r\n /**\r\n * API to create and send a populated PageAction event\r\n * @param element - DOM element\r\n * @param overrideValues - PageAction overrides\r\n * @param customProperties - Custom properties(Part C)\r\n * @param isRightClick - Flag for mouse right clicks\r\n */\r\n PageAction.prototype.capturePageAction = function (element, overrideValues, customProperties, isRightClick) {\r\n overrideValues = !isValueAssigned(overrideValues) ? {} : overrideValues;\r\n var pageActionEvent = { name: \"\" };\r\n var pageActionProperties = isValueAssigned(customProperties) ? customProperties : {};\r\n this.setCommonProperties(pageActionEvent, overrideValues);\r\n pageActionEvent.behavior = this._getBehavior(overrideValues);\r\n // element in scope is needed for below properties. We cannot pass element into the plugin call chain.\r\n // process them here.\r\n var elementContent = {};\r\n if (isRightClick) {\r\n // Default behavior for righ click\r\n pageActionEvent.behavior = this._config.defaultRightClickBhvr;\r\n }\r\n // Fill PartB\r\n if (element) {\r\n pageActionEvent.targetUri = DataCollector.getClickTarget(element);\r\n elementContent = this._contentHandler.getElementContent(element); // collect id,cn tags\r\n // if the element has a data-*-bhvr attrib defined, use it.\r\n if (elementContent.bhvr && !isValueAssigned(overrideValues.behavior)) {\r\n var currentBehavior = extractFieldFromObject(elementContent, \"bhvr\");\r\n pageActionEvent.behavior = this._getValidBehavior(currentBehavior);\r\n }\r\n // Validate to ensure the minimum required field 'contentName' or 'id' is present. However,\r\n // requiring these fields would result in majority of adopter's content from being collected.\r\n // Just throw a warning and continue collection.\r\n if (!isValueAssigned(elementContent.id) && !isValueAssigned(elementContent.contentName)) {\r\n this._traceLogger.throwInternal(LoggingSeverity.WARNING, _ExtendedInternalMessageId.InvalidContentBlob, \"Missing attributes id or contentName in click event. Click event information will still be collected!\");\r\n }\r\n }\r\n pageActionEvent.name = elementContent.id || elementContent.contentName || strNotSpecified;\r\n pageActionEvent.parentId = elementContent.parentid || elementContent.parentName || strNotSpecified;\r\n if (isValueAssigned(overrideValues.actionType)) {\r\n pageActionEvent.actionType = overrideValues.actionType;\r\n }\r\n if (isValueAssigned(overrideValues.clickCoordinateX) && isValueAssigned(overrideValues.clickCoordinateY)) {\r\n pageActionEvent.clickCoordinates = overrideValues.clickCoordinateX + \"X\" + overrideValues.clickCoordinateY;\r\n }\r\n this._sanitizePageActionEventContent(elementContent);\r\n pageActionEvent.content = bracketIt(JSON.stringify(extend(elementContent, overrideValues && overrideValues.contentTags ? overrideValues.contentTags : {})));\r\n pageActionEvent.timeToAction = this._getTimeToClick();\r\n pageActionEvent.refUri = isValueAssigned(overrideValues.refUri) ? overrideValues.refUri : this._config.coreData.referrerUri;\r\n if (this._isUndefinedEvent(pageActionEvent))\r\n return;\r\n this.trackPageAction(pageActionEvent, pageActionProperties);\r\n };\r\n // capture performance data into PageTags\r\n PageAction.prototype._getTimeToClick = function () {\r\n var perf = getPerformance();\r\n if (perf && perf.timing) {\r\n var isNavigationStart = perf.timing.navigationStart;\r\n if (isNavigationStart && isNavigationStart !== 0) {\r\n return new Date().getTime() - isNavigationStart;\r\n }\r\n }\r\n return -1;\r\n };\r\n PageAction.prototype._populateEventDataIfPresent = function (obj, property, value) {\r\n if (isValueAssigned(value)) {\r\n obj[property] = value;\r\n }\r\n };\r\n PageAction.prototype._sanitizePageActionEventContent = function (pageActionContent) {\r\n if (pageActionContent) {\r\n delete pageActionContent.id;\r\n delete pageActionContent.parentid;\r\n delete pageActionContent.parentname;\r\n if (this._config && this._config.dataTags && isValueAssigned(this._config.dataTags.parentDataTag)) {\r\n delete pageActionContent[this._config.dataTags.parentDataTag];\r\n }\r\n }\r\n };\r\n PageAction.prototype._isUndefinedEvent = function (pageActionEvent) {\r\n if (this._config.dropInvalidEvents) {\r\n if (pageActionEvent.name === strNotSpecified\r\n && pageActionEvent.parentId === strNotSpecified\r\n && pageActionEvent.content === \"[{}]\")\r\n return true;\r\n }\r\n return false;\r\n };\r\n return PageAction;\r\n}(WebEvent));\r\nexport { PageAction };\r\n//# sourceMappingURL=PageAction.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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA"}