@microsoft/applicationinsights-clickanalytics-js 2.8.0-nightly.2202-06 → 2.8.0-nightly.2204-06

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 (80) hide show
  1. package/browser/ai.clck.2.8.0-nightly.2204-06.cjs.js +2890 -0
  2. package/browser/ai.clck.2.8.0-nightly.2204-06.cjs.js.map +1 -0
  3. package/browser/ai.clck.2.8.0-nightly.2204-06.cjs.min.js +6 -0
  4. package/browser/ai.clck.2.8.0-nightly.2204-06.cjs.min.js.map +1 -0
  5. package/browser/ai.clck.2.8.0-nightly.2204-06.gbl.js +2894 -0
  6. package/browser/ai.clck.2.8.0-nightly.2204-06.gbl.js.map +1 -0
  7. package/browser/ai.clck.2.8.0-nightly.2204-06.gbl.min.js +6 -0
  8. package/browser/ai.clck.2.8.0-nightly.2204-06.gbl.min.js.map +1 -0
  9. package/browser/ai.clck.2.8.0-nightly.2204-06.integrity.json +66 -0
  10. package/browser/ai.clck.2.8.0-nightly.2204-06.js +2896 -0
  11. package/browser/ai.clck.2.8.0-nightly.2204-06.js.map +1 -0
  12. package/browser/ai.clck.2.8.0-nightly.2204-06.min.js +6 -0
  13. package/browser/ai.clck.2.8.0-nightly.2204-06.min.js.map +1 -0
  14. package/browser/ai.clck.2.cjs.js +1689 -805
  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 +1689 -805
  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 +1689 -805
  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 +38 -13
  27. package/dist/applicationinsights-clickanalytics-js.api.md +1 -0
  28. package/dist/applicationinsights-clickanalytics-js.d.ts +2 -5
  29. package/dist/applicationinsights-clickanalytics-js.js +1689 -805
  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 +2 -5
  34. package/dist-esm/Behaviours.js +1 -1
  35. package/dist-esm/ClickAnalyticsPlugin.js +75 -51
  36. package/dist-esm/ClickAnalyticsPlugin.js.map +1 -1
  37. package/dist-esm/DataCollector.js +4 -2
  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 +130 -128
  44. package/dist-esm/events/PageAction.js.map +1 -1
  45. package/dist-esm/events/WebEvent.js +109 -94
  46. package/dist-esm/events/WebEvent.js.map +1 -1
  47. package/dist-esm/handlers/AutoCaptureHandler.js +85 -83
  48. package/dist-esm/handlers/AutoCaptureHandler.js.map +1 -1
  49. package/dist-esm/handlers/DomContentHandler.js +281 -278
  50. package/dist-esm/handlers/DomContentHandler.js.map +1 -1
  51. package/package.json +5 -5
  52. package/src/ClickAnalyticsPlugin.ts +94 -49
  53. package/src/DataCollector.ts +24 -22
  54. package/src/Interfaces/Datamodel.ts +20 -21
  55. package/src/common/Utils.ts +8 -8
  56. package/src/events/PageAction.ts +166 -132
  57. package/src/events/WebEvent.ts +147 -78
  58. package/src/handlers/AutoCaptureHandler.ts +92 -79
  59. package/src/handlers/DomContentHandler.ts +337 -304
  60. package/types/ClickAnalyticsPlugin.d.ts +1 -4
  61. package/types/Interfaces/Datamodel.d.ts +3 -2
  62. package/types/common/Utils.d.ts +79 -79
  63. package/types/events/PageAction.d.ts +6 -6
  64. package/types/events/WebEvent.d.ts +17 -17
  65. package/types/handlers/AutoCaptureHandler.d.ts +2 -10
  66. package/types/handlers/DomContentHandler.d.ts +3 -50
  67. package/types/tsdoc-metadata.json +1 -1
  68. package/browser/ai.clck.2.8.0-nightly.2202-06.cjs.js +0 -2006
  69. package/browser/ai.clck.2.8.0-nightly.2202-06.cjs.js.map +0 -1
  70. package/browser/ai.clck.2.8.0-nightly.2202-06.cjs.min.js +0 -6
  71. package/browser/ai.clck.2.8.0-nightly.2202-06.cjs.min.js.map +0 -1
  72. package/browser/ai.clck.2.8.0-nightly.2202-06.gbl.js +0 -2010
  73. package/browser/ai.clck.2.8.0-nightly.2202-06.gbl.js.map +0 -1
  74. package/browser/ai.clck.2.8.0-nightly.2202-06.gbl.min.js +0 -6
  75. package/browser/ai.clck.2.8.0-nightly.2202-06.gbl.min.js.map +0 -1
  76. package/browser/ai.clck.2.8.0-nightly.2202-06.integrity.json +0 -66
  77. package/browser/ai.clck.2.8.0-nightly.2202-06.js +0 -2012
  78. package/browser/ai.clck.2.8.0-nightly.2202-06.js.map +0 -1
  79. package/browser/ai.clck.2.8.0-nightly.2202-06.min.js +0 -6
  80. package/browser/ai.clck.2.8.0-nightly.2202-06.min.js.map +0 -1
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Microsoft.ApplicationInsights, 2.8.0-nightly.2202-06
2
+ * Microsoft.ApplicationInsights, 2.8.0-nightly.2204-06
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  *
5
5
  * Microsoft Application Insights Team
@@ -34,10 +34,7 @@ export declare class ClickAnalyticsPlugin extends BaseTelemetryPlugin {
34
34
  identifier: string;
35
35
  priority: number;
36
36
  static Version: string;
37
- private _config;
38
- private pageAction;
39
- private _autoCaptureHandler;
40
- private _contentHandler;
37
+ constructor();
41
38
  initialize(config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
42
39
  processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
43
40
  /**
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Click Analytics, 2.8.0-nightly.2202-06
2
+ * Application Insights JavaScript SDK - Click Analytics, 2.8.0-nightly.2204-06
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  /**
@@ -1,14 +1,15 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Click Analytics, 2.8.0-nightly.2202-06
2
+ * Application Insights JavaScript SDK - Click Analytics, 2.8.0-nightly.2204-06
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 { BaseTelemetryPlugin, isNullOrUndefined, LoggingSeverity, arrForEach, dumpObj, getExceptionName } from "@microsoft/applicationinsights-core-js";
9
+ import dynamicProto from "@microsoft/dynamicproto-js";
10
+ import { BaseTelemetryPlugin, isNullOrUndefined, arrForEach, dumpObj, getExceptionName, throwError, _throwInternal, unloadComponents } from "@microsoft/applicationinsights-core-js";
10
11
  import { PropertiesPluginIdentifier } from "@microsoft/applicationinsights-common";
11
- import { mergeConfig, BehaviorMapValidator, BehaviorValueValidator, BehaviorEnumValidator, _ExtendedInternalMessageId } from "./common/Utils";
12
+ import { mergeConfig, BehaviorMapValidator, BehaviorValueValidator, BehaviorEnumValidator } from "./common/Utils";
12
13
  import { PageAction } from "./events/PageAction";
13
14
  import { AutoCaptureHandler } from "./handlers/AutoCaptureHandler";
14
15
  import { DomContentHandler } from "./handlers/DomContentHandler";
@@ -16,58 +17,81 @@ export { BehaviorMapValidator, BehaviorValueValidator, BehaviorEnumValidator };
16
17
  var ClickAnalyticsPlugin = /** @class */ (function (_super) {
17
18
  __extends(ClickAnalyticsPlugin, _super);
18
19
  function ClickAnalyticsPlugin() {
19
- var _this = _super !== null && _super.apply(this, arguments) || this;
20
+ var _this = _super.call(this) || this;
20
21
  _this.identifier = "ClickAnalyticsPlugin";
21
22
  _this.priority = 181;
22
- return _this;
23
- }
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
- }
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(), 1 /* CRITICAL */, 103 /* 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
+ };
47
82
  });
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;
83
+ function _initDefaults() {
84
+ _config = null;
85
+ _pageAction = null;
86
+ _autoCaptureHandler = null;
87
+ _contentHandler = null;
52
88
  }
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.8.0-nightly.2202-06";
89
+ return _this;
90
+ }
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.8.0-nightly.2204-06";
71
95
  return ClickAnalyticsPlugin;
72
96
  }(BaseTelemetryPlugin));
73
97
  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 \"./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.8.0-nightly.2202-06\";\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
+ {"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, arrForEach, dumpObj, getExceptionName, throwError, _throwInternal, unloadComponents } from \"@microsoft/applicationinsights-core-js\";\r\nimport { PropertiesPluginIdentifier } from \"@microsoft/applicationinsights-common\";\r\nimport { mergeConfig, BehaviorMapValidator, BehaviorValueValidator, BehaviorEnumValidator } 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(), 1 /* CRITICAL */, 103 /* 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.8.0-nightly.2204-06\";\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,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Click Analytics, 2.8.0-nightly.2202-06
2
+ * Application Insights JavaScript SDK - Click Analytics, 2.8.0-nightly.2204-06
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  /**
@@ -90,7 +90,9 @@ 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 () { onDomReadyDo(f); }, 100) : f.call();
93
+ /in/.test(doc.readyState) ? setTimeout(function () {
94
+ onDomReadyDo(f);
95
+ }, 100) : f.call();
94
96
  }
95
97
  /**
96
98
  * 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 () { 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"}
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"}
package/dist-esm/Enums.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Click Analytics, 2.8.0-nightly.2202-06
2
+ * Application Insights JavaScript SDK - Click Analytics, 2.8.0-nightly.2204-06
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.8.0-nightly.2202-06
2
+ * Application Insights JavaScript SDK - Click Analytics, 2.8.0-nightly.2204-06
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.8.0-nightly.2202-06
2
+ * Application Insights JavaScript SDK - Click Analytics, 2.8.0-nightly.2204-06
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.8.0-nightly.2202-06
2
+ * Application Insights JavaScript SDK - Click Analytics, 2.8.0-nightly.2204-06
3
3
  * Copyright (c) Microsoft and contributors. All rights reserved.
4
4
  */
5
5
  /**
@@ -1,148 +1,150 @@
1
1
  /*
2
- * Application Insights JavaScript SDK - Click Analytics, 2.8.0-nightly.2202-06
2
+ * Application Insights JavaScript SDK - Click Analytics, 2.8.0-nightly.2204-06
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";
9
10
  import { WebEvent } from "./WebEvent";
10
11
  import * as DataCollector from "../DataCollector";
11
- import { getPerformance, LoggingSeverity, objForEachKey } from "@microsoft/applicationinsights-core-js";
12
- import { extractFieldFromObject, bracketIt, isValueAssigned, extend, _ExtendedInternalMessageId } from "../common/Utils";
12
+ import { getPerformance, objForEachKey, _throwInternal } from "@microsoft/applicationinsights-core-js";
13
+ import { extractFieldFromObject, bracketIt, isValueAssigned, extend } from "../common/Utils";
13
14
  import { strNotSpecified } from "@microsoft/applicationinsights-common";
14
15
  var PageAction = /** @class */ (function (_super) {
15
16
  __extends(PageAction, _super);
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);
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
+ _throwInternal(_self._traceLogger, 2 /* WARNING */, 102 /* 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;
54
104
  }
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);
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
+ }
115
+ }
116
+ return -1;
87
117
  }
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!");
118
+ function _populateEventDataIfPresent(obj, property, value) {
119
+ if (isValueAssigned(value)) {
120
+ obj[property] = value;
121
+ }
93
122
  }
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;
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
+ }
118
132
  }
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];
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;
134
142
  }
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
- };
143
+ });
144
+ return _this;
145
+ }
146
+ // Removed Stub for PageAction.prototype.trackPageAction.
147
+ // Removed Stub for PageAction.prototype.capturePageAction.
146
148
  return PageAction;
147
149
  }(WebEvent));
148
150
  export { PageAction };