@microsoft/applicationinsights-clickanalytics-js 3.0.0-beta.2303-11 → 3.0.0-nightly3.2304-28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/{ai.clck.3.0.0-beta.2303-11.cjs.js → es5/ai.clck.3.0.0-nightly3.2304-28.cjs.js} +810 -786
- package/browser/es5/ai.clck.3.0.0-nightly3.2304-28.cjs.js.map +1 -0
- package/browser/es5/ai.clck.3.0.0-nightly3.2304-28.cjs.min.js +6 -0
- package/browser/es5/ai.clck.3.0.0-nightly3.2304-28.cjs.min.js.map +1 -0
- package/browser/{ai.clck.3.0.0-beta.2303-11.gbl.js → es5/ai.clck.3.0.0-nightly3.2304-28.gbl.js} +809 -785
- package/browser/es5/ai.clck.3.0.0-nightly3.2304-28.gbl.js.map +1 -0
- package/browser/es5/ai.clck.3.0.0-nightly3.2304-28.gbl.min.js +6 -0
- package/browser/es5/ai.clck.3.0.0-nightly3.2304-28.gbl.min.js.map +1 -0
- package/browser/es5/ai.clck.3.0.0-nightly3.2304-28.integrity.json +66 -0
- package/browser/{ai.clck.3.0.0-beta.2303-11.js → es5/ai.clck.3.0.0-nightly3.2304-28.js} +809 -785
- package/browser/es5/ai.clck.3.0.0-nightly3.2304-28.js.map +1 -0
- package/browser/es5/ai.clck.3.0.0-nightly3.2304-28.min.js +6 -0
- package/browser/es5/ai.clck.3.0.0-nightly3.2304-28.min.js.map +1 -0
- package/browser/{ai.clck.3.cjs.js → es5/ai.clck.3.cjs.js} +809 -785
- package/browser/es5/ai.clck.3.cjs.js.map +1 -0
- package/browser/es5/ai.clck.3.cjs.min.js +6 -0
- package/browser/es5/ai.clck.3.cjs.min.js.map +1 -0
- package/browser/{ai.clck.3.gbl.js → es5/ai.clck.3.gbl.js} +808 -784
- package/browser/es5/ai.clck.3.gbl.js.map +1 -0
- package/browser/es5/ai.clck.3.gbl.min.js +6 -0
- package/browser/es5/ai.clck.3.gbl.min.js.map +1 -0
- package/browser/{ai.clck.3.js → es5/ai.clck.3.js} +808 -784
- package/browser/es5/ai.clck.3.js.map +1 -0
- package/browser/es5/ai.clck.3.min.js +6 -0
- package/browser/es5/ai.clck.3.min.js.map +1 -0
- package/dist/{applicationinsights-clickanalytics-js.js → es5/applicationinsights-clickanalytics-js.js} +808 -784
- package/dist/es5/applicationinsights-clickanalytics-js.js.map +1 -0
- package/dist/es5/applicationinsights-clickanalytics-js.min.js +6 -0
- package/dist/es5/applicationinsights-clickanalytics-js.min.js.map +1 -0
- package/{dist-esm → dist-es5}/Behaviours.js +1 -1
- package/{dist-esm → dist-es5}/ClickAnalyticsPlugin.js +2 -2
- package/{dist-esm → dist-es5}/ClickAnalyticsPlugin.js.map +1 -1
- package/{dist-esm → dist-es5}/DataCollector.js +1 -1
- package/{dist-esm → dist-es5}/Enums.js +1 -1
- package/{dist-esm → dist-es5}/Interfaces/Datamodel.js +1 -1
- package/{dist-esm → dist-es5}/__DynamicConstants.js +1 -1
- package/{dist-esm → dist-es5}/applicationinsights-clickanalytics-js.js +1 -1
- package/{dist-esm → dist-es5}/common/Utils.js +1 -1
- package/{dist-esm → dist-es5}/events/PageAction.js +1 -1
- package/{dist-esm → dist-es5}/events/WebEvent.js +1 -1
- package/{dist-esm → dist-es5}/handlers/AutoCaptureHandler.js +1 -1
- package/{dist-esm → dist-es5}/handlers/DomContentHandler.js +3 -2
- package/dist-es5/handlers/DomContentHandler.js.map +1 -0
- package/package.json +19 -18
- package/tsconfig.json +4 -3
- package/types/applicationinsights-clickanalytics-js.d.ts +101 -2
- package/{dist/applicationinsights-clickanalytics-js.d.ts → types/applicationinsights-clickanalytics-js.namespaced.d.ts} +1 -1
- package/browser/ai.clck.3.0.0-beta.2303-11.cjs.js.map +0 -1
- package/browser/ai.clck.3.0.0-beta.2303-11.cjs.min.js +0 -6
- package/browser/ai.clck.3.0.0-beta.2303-11.cjs.min.js.map +0 -1
- package/browser/ai.clck.3.0.0-beta.2303-11.gbl.js.map +0 -1
- package/browser/ai.clck.3.0.0-beta.2303-11.gbl.min.js +0 -6
- package/browser/ai.clck.3.0.0-beta.2303-11.gbl.min.js.map +0 -1
- package/browser/ai.clck.3.0.0-beta.2303-11.integrity.json +0 -66
- package/browser/ai.clck.3.0.0-beta.2303-11.js.map +0 -1
- package/browser/ai.clck.3.0.0-beta.2303-11.min.js +0 -6
- package/browser/ai.clck.3.0.0-beta.2303-11.min.js.map +0 -1
- package/browser/ai.clck.3.cjs.js.map +0 -1
- package/browser/ai.clck.3.cjs.min.js +0 -6
- package/browser/ai.clck.3.cjs.min.js.map +0 -1
- package/browser/ai.clck.3.gbl.js.map +0 -1
- package/browser/ai.clck.3.gbl.min.js +0 -6
- package/browser/ai.clck.3.gbl.min.js.map +0 -1
- package/browser/ai.clck.3.js.map +0 -1
- package/browser/ai.clck.3.min.js +0 -6
- package/browser/ai.clck.3.min.js.map +0 -1
- package/dist/applicationinsights-clickanalytics-js.api.json +0 -695
- package/dist/applicationinsights-clickanalytics-js.api.md +0 -46
- package/dist/applicationinsights-clickanalytics-js.js.map +0 -1
- package/dist/applicationinsights-clickanalytics-js.min.js +0 -6
- package/dist/applicationinsights-clickanalytics-js.min.js.map +0 -1
- package/dist/applicationinsights-clickanalytics-js.rollup.d.ts +0 -102
- package/dist-esm/handlers/DomContentHandler.js.map +0 -1
- package/src/Behaviours.ts +0 -165
- package/src/ClickAnalyticsPlugin.ts +0 -183
- package/src/DataCollector.ts +0 -159
- package/src/Enums.ts +0 -15
- package/src/Interfaces/Datamodel.ts +0 -300
- package/src/__DynamicConstants.ts +0 -61
- package/src/applicationinsights-clickanalytics-js.ts +0 -6
- package/src/common/Utils.ts +0 -281
- package/src/events/PageAction.ts +0 -197
- package/src/events/WebEvent.ts +0 -202
- package/src/handlers/AutoCaptureHandler.ts +0 -121
- package/src/handlers/DomContentHandler.ts +0 -395
- package/types/Behaviours.d.ts +0 -99
- package/types/ClickAnalyticsPlugin.d.ts +0 -22
- package/types/DataCollector.d.ts +0 -39
- package/types/Enums.d.ts +0 -14
- package/types/Interfaces/Datamodel.d.ts +0 -291
- package/types/__DynamicConstants.d.ts +0 -49
- package/types/common/Utils.d.ts +0 -123
- package/types/events/PageAction.d.ts +0 -28
- package/types/events/WebEvent.d.ts +0 -54
- package/types/handlers/AutoCaptureHandler.d.ts +0 -20
- package/types/handlers/DomContentHandler.d.ts +0 -29
- package/types/tsdoc-metadata.json +0 -11
- /package/{dist-esm → dist-es5}/Behaviours.js.map +0 -0
- /package/{dist-esm → dist-es5}/DataCollector.js.map +0 -0
- /package/{dist-esm → dist-es5}/Enums.js.map +0 -0
- /package/{dist-esm → dist-es5}/Interfaces/Datamodel.js.map +0 -0
- /package/{dist-esm → dist-es5}/__DynamicConstants.js.map +0 -0
- /package/{dist-esm → dist-es5}/applicationinsights-clickanalytics-js.js.map +0 -0
- /package/{dist-esm → dist-es5}/common/Utils.js.map +0 -0
- /package/{dist-esm → dist-es5}/events/PageAction.js.map +0 -0
- /package/{dist-esm → dist-es5}/events/WebEvent.js.map +0 -0
- /package/{dist-esm → dist-es5}/handlers/AutoCaptureHandler.js.map +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Application Insights JavaScript SDK - Click Analytics, 3.0.0-
|
|
2
|
+
* Application Insights JavaScript SDK - Click Analytics, 3.0.0-nightly3.2304-28
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
@@ -141,7 +141,7 @@ var ClickAnalyticsPlugin = /** @class */ (function (_super) {
|
|
|
141
141
|
// Removed Stub for ClickAnalyticsPlugin.prototype.initialize.
|
|
142
142
|
// Removed Stub for ClickAnalyticsPlugin.prototype.processTelemetry.
|
|
143
143
|
// Removed Stub for ClickAnalyticsPlugin.prototype.trackPageAction.
|
|
144
|
-
ClickAnalyticsPlugin.Version = "3.0.0-
|
|
144
|
+
ClickAnalyticsPlugin.Version = "3.0.0-nightly3.2304-28";
|
|
145
145
|
return ClickAnalyticsPlugin;
|
|
146
146
|
}(BaseTelemetryPlugin));
|
|
147
147
|
export { ClickAnalyticsPlugin };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClickAnalyticsPlugin.js.map","sources":["ClickAnalyticsPlugin.js"],"sourcesContent":["/**\r\n* @copyright Microsoft 2020\r\n*/\r\nvar _a, _b, _c, _d;\r\nimport { __extends } from \"tslib\";\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { PropertiesPluginIdentifier } from \"@microsoft/applicationinsights-common\";\r\nimport { BaseTelemetryPlugin, _throwInternal, arrForEach, cfgDfFunc, cfgDfMerge, cfgDfString, cfgDfValidate, createProcessTelemetryContext, dumpObj, getExceptionName, isNullOrUndefined, onConfigChange, throwError, unloadComponents } from \"@microsoft/applicationinsights-core-js\";\r\nimport { hasDocument, objDeepFreeze } from \"@nevware21/ts-utils\";\r\nimport { _DYN_BEHAVIOR_VALIDATOR, _DYN_CAPTURE_ALL_META_DAT2, _DYN_CONTENT_NAME, _DYN_DEFAULT_RIGHT_CLICK_3, _DYN_INDEX_OF, _DYN_META_DATA_PREFIX, _DYN_PAGE_ACTION_PAGE_TAG0, _DYN_PAGE_NAME, _DYN_PAGE_TYPE, _DYN_PARENT_DATA_TAG, _DYN_REQUEST_URI, _DYN_TRACK_PAGE_ACTION, _DYN_USE_DEFAULT_CONTENT_1, _DYN__DO_UNLOAD } from \"./__DynamicConstants\";\r\nimport { BehaviorEnumValidator, BehaviorMapValidator, BehaviorValueValidator, DEFAULT_AI_BLOB_ATTRIBUTE_TAG, DEFAULT_DATA_PREFIX, DEFAULT_DONOT_TRACK_TAG } 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 defaultValues = objDeepFreeze((_a = {\r\n autoCapture: true,\r\n callback: cfgDfMerge((_b = {},\r\n _b[_DYN_PAGE_ACTION_PAGE_TAG0 /* @min:pageActionPageTags */] = cfgDfFunc(),\r\n _b[_DYN_PAGE_NAME /* @min:pageName */] = cfgDfFunc(),\r\n _b[_DYN_CONTENT_NAME /* @min:contentName */] = cfgDfFunc(),\r\n _b)),\r\n pageTags: {},\r\n coreData: cfgDfMerge((_c = {\r\n referrerUri: hasDocument ? document.referrer : \"\"\r\n },\r\n _c[_DYN_REQUEST_URI /* @min:requestUri */] = cfgDfString(),\r\n _c[_DYN_PAGE_NAME /* @min:pageName */] = cfgDfString(),\r\n _c[_DYN_PAGE_TYPE /* @min:pageType */] = cfgDfString(),\r\n _c)),\r\n dataTags: cfgDfMerge((_d = {},\r\n _d[_DYN_USE_DEFAULT_CONTENT_1 /* @min:useDefaultContentNameOrId */] = false,\r\n _d.aiBlobAttributeTag = DEFAULT_AI_BLOB_ATTRIBUTE_TAG,\r\n _d.customDataPrefix = cfgDfValidate(_dataPrefixChk, DEFAULT_DATA_PREFIX),\r\n _d[_DYN_CAPTURE_ALL_META_DAT2 /* @min:captureAllMetaDataContent */] = false,\r\n _d.dntDataTag = DEFAULT_DONOT_TRACK_TAG,\r\n _d[_DYN_META_DATA_PREFIX /* @min:metaDataPrefix */] = cfgDfString(),\r\n _d[_DYN_PARENT_DATA_TAG /* @min:parentDataTag */] = cfgDfString(),\r\n _d))\r\n },\r\n _a[_DYN_BEHAVIOR_VALIDATOR /* @min:behaviorValidator */] = cfgDfFunc(function (key) { return key || \"\"; }),\r\n _a[_DYN_DEFAULT_RIGHT_CLICK_3 /* @min:defaultRightClickBhvr */] = cfgDfString(),\r\n _a.dropInvalidEvents = false,\r\n _a.urlCollectHash = false,\r\n _a.urlCollectQuery = false,\r\n _a));\r\nfunction _dataPrefixChk(val) {\r\n return val && val[_DYN_INDEX_OF /* @min:%2eindexOf */](DEFAULT_DATA_PREFIX) === 0;\r\n}\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 var _autoCapture;\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 _super.prototype.initialize.call(_this, config, core, extensions, pluginChain);\r\n _populateDefaults(config);\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[_DYN_TRACK_PAGE_ACTION /* @min:%2etrackPageAction */] = function (pageAction, customProperties) {\r\n try {\r\n _pageAction[_DYN_TRACK_PAGE_ACTION /* @min:%2etrackPageAction */](pageAction, customProperties);\r\n }\r\n catch (e) {\r\n _throwInternal(_self.diagLog(), 1 /* eLoggingSeverity.CRITICAL */, 103 /* _eInternalMessageId.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 function _populateDefaults(config) {\r\n var _this = this;\r\n var core = _self.core;\r\n _self._addHook(onConfigChange(config, function (details) {\r\n var config = details.cfg;\r\n var ctx = createProcessTelemetryContext(null, config, core);\r\n var _config = ctx.getExtCfg(_identifier, defaultValues);\r\n var logger = _self.diagLog();\r\n _contentHandler = new DomContentHandler(_config, logger);\r\n var metaTags = _contentHandler.getMetadata();\r\n _pageAction = new PageAction(_this, _config, _contentHandler, _config.callback[_DYN_PAGE_ACTION_PAGE_TAG0 /* @min:%2epageActionPageTags */], metaTags, logger);\r\n // Default to DOM autoCapture handler\r\n if (_autoCaptureHandler) {\r\n _autoCaptureHandler[_DYN__DO_UNLOAD /* @min:%2e_doUnload */]();\r\n }\r\n _autoCaptureHandler = new AutoCaptureHandler(_self, _config, _pageAction, logger);\r\n var autoCapture = !!_config.autoCapture;\r\n if (!_autoCapture && autoCapture) {\r\n _autoCaptureHandler.click();\r\n }\r\n _autoCapture = autoCapture;\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 _autoCapture = false;\r\n }\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 = \"3.0.0-
|
|
1
|
+
{"version":3,"file":"ClickAnalyticsPlugin.js.map","sources":["ClickAnalyticsPlugin.js"],"sourcesContent":["/**\r\n* @copyright Microsoft 2020\r\n*/\r\nvar _a, _b, _c, _d;\r\nimport { __extends } from \"tslib\";\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { PropertiesPluginIdentifier } from \"@microsoft/applicationinsights-common\";\r\nimport { BaseTelemetryPlugin, _throwInternal, arrForEach, cfgDfFunc, cfgDfMerge, cfgDfString, cfgDfValidate, createProcessTelemetryContext, dumpObj, getExceptionName, isNullOrUndefined, onConfigChange, throwError, unloadComponents } from \"@microsoft/applicationinsights-core-js\";\r\nimport { hasDocument, objDeepFreeze } from \"@nevware21/ts-utils\";\r\nimport { _DYN_BEHAVIOR_VALIDATOR, _DYN_CAPTURE_ALL_META_DAT2, _DYN_CONTENT_NAME, _DYN_DEFAULT_RIGHT_CLICK_3, _DYN_INDEX_OF, _DYN_META_DATA_PREFIX, _DYN_PAGE_ACTION_PAGE_TAG0, _DYN_PAGE_NAME, _DYN_PAGE_TYPE, _DYN_PARENT_DATA_TAG, _DYN_REQUEST_URI, _DYN_TRACK_PAGE_ACTION, _DYN_USE_DEFAULT_CONTENT_1, _DYN__DO_UNLOAD } from \"./__DynamicConstants\";\r\nimport { BehaviorEnumValidator, BehaviorMapValidator, BehaviorValueValidator, DEFAULT_AI_BLOB_ATTRIBUTE_TAG, DEFAULT_DATA_PREFIX, DEFAULT_DONOT_TRACK_TAG } 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 defaultValues = objDeepFreeze((_a = {\r\n autoCapture: true,\r\n callback: cfgDfMerge((_b = {},\r\n _b[_DYN_PAGE_ACTION_PAGE_TAG0 /* @min:pageActionPageTags */] = cfgDfFunc(),\r\n _b[_DYN_PAGE_NAME /* @min:pageName */] = cfgDfFunc(),\r\n _b[_DYN_CONTENT_NAME /* @min:contentName */] = cfgDfFunc(),\r\n _b)),\r\n pageTags: {},\r\n coreData: cfgDfMerge((_c = {\r\n referrerUri: hasDocument ? document.referrer : \"\"\r\n },\r\n _c[_DYN_REQUEST_URI /* @min:requestUri */] = cfgDfString(),\r\n _c[_DYN_PAGE_NAME /* @min:pageName */] = cfgDfString(),\r\n _c[_DYN_PAGE_TYPE /* @min:pageType */] = cfgDfString(),\r\n _c)),\r\n dataTags: cfgDfMerge((_d = {},\r\n _d[_DYN_USE_DEFAULT_CONTENT_1 /* @min:useDefaultContentNameOrId */] = false,\r\n _d.aiBlobAttributeTag = DEFAULT_AI_BLOB_ATTRIBUTE_TAG,\r\n _d.customDataPrefix = cfgDfValidate(_dataPrefixChk, DEFAULT_DATA_PREFIX),\r\n _d[_DYN_CAPTURE_ALL_META_DAT2 /* @min:captureAllMetaDataContent */] = false,\r\n _d.dntDataTag = DEFAULT_DONOT_TRACK_TAG,\r\n _d[_DYN_META_DATA_PREFIX /* @min:metaDataPrefix */] = cfgDfString(),\r\n _d[_DYN_PARENT_DATA_TAG /* @min:parentDataTag */] = cfgDfString(),\r\n _d))\r\n },\r\n _a[_DYN_BEHAVIOR_VALIDATOR /* @min:behaviorValidator */] = cfgDfFunc(function (key) { return key || \"\"; }),\r\n _a[_DYN_DEFAULT_RIGHT_CLICK_3 /* @min:defaultRightClickBhvr */] = cfgDfString(),\r\n _a.dropInvalidEvents = false,\r\n _a.urlCollectHash = false,\r\n _a.urlCollectQuery = false,\r\n _a));\r\nfunction _dataPrefixChk(val) {\r\n return val && val[_DYN_INDEX_OF /* @min:%2eindexOf */](DEFAULT_DATA_PREFIX) === 0;\r\n}\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 var _autoCapture;\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 _super.prototype.initialize.call(_this, config, core, extensions, pluginChain);\r\n _populateDefaults(config);\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[_DYN_TRACK_PAGE_ACTION /* @min:%2etrackPageAction */] = function (pageAction, customProperties) {\r\n try {\r\n _pageAction[_DYN_TRACK_PAGE_ACTION /* @min:%2etrackPageAction */](pageAction, customProperties);\r\n }\r\n catch (e) {\r\n _throwInternal(_self.diagLog(), 1 /* eLoggingSeverity.CRITICAL */, 103 /* _eInternalMessageId.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 function _populateDefaults(config) {\r\n var _this = this;\r\n var core = _self.core;\r\n _self._addHook(onConfigChange(config, function (details) {\r\n var config = details.cfg;\r\n var ctx = createProcessTelemetryContext(null, config, core);\r\n var _config = ctx.getExtCfg(_identifier, defaultValues);\r\n var logger = _self.diagLog();\r\n _contentHandler = new DomContentHandler(_config, logger);\r\n var metaTags = _contentHandler.getMetadata();\r\n _pageAction = new PageAction(_this, _config, _contentHandler, _config.callback[_DYN_PAGE_ACTION_PAGE_TAG0 /* @min:%2epageActionPageTags */], metaTags, logger);\r\n // Default to DOM autoCapture handler\r\n if (_autoCaptureHandler) {\r\n _autoCaptureHandler[_DYN__DO_UNLOAD /* @min:%2e_doUnload */]();\r\n }\r\n _autoCaptureHandler = new AutoCaptureHandler(_self, _config, _pageAction, logger);\r\n var autoCapture = !!_config.autoCapture;\r\n if (!_autoCapture && autoCapture) {\r\n _autoCaptureHandler.click();\r\n }\r\n _autoCapture = autoCapture;\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 _autoCapture = false;\r\n }\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 = \"3.0.0-nightly3.2304-28\";\r\n return ClickAnalyticsPlugin;\r\n}(BaseTelemetryPlugin));\r\nexport { ClickAnalyticsPlugin };\r\n//# sourceMappingURL=ClickAnalyticsPlugin.js.map"],"names":[],"mappings":";;;;AAAA;AACA;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;;mEAaM;AACN;AACA;AACA;AACA;AACA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* Application Insights JavaScript SDK - Click Analytics, 3.0.0-
|
|
2
|
+
* Application Insights JavaScript SDK - Click Analytics, 3.0.0-nightly3.2304-28
|
|
3
3
|
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
4
|
*/
|
|
5
5
|
/**
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import dynamicProto from "@microsoft/dynamicproto-js";
|
|
9
9
|
import { _throwInternal, getDocument, hasDocument, isNullOrUndefined, objExtend } from "@microsoft/applicationinsights-core-js";
|
|
10
|
+
import { strSubstring } from "@nevware21/ts-utils";
|
|
10
11
|
import { _DYN_ATTRIBUTES, _DYN_CAPTURE_ALL_META_DAT2, _DYN_CONTENT, _DYN_CONTENT_NAME, _DYN_CUSTOM_DATA_PREFIX, _DYN_DATA_TAGS, _DYN_GET_ATTRIBUTE, _DYN_GET_ELEMENT_CONTENT, _DYN_INDEX_OF, _DYN_LENGTH, _DYN_META_DATA_PREFIX, _DYN_NAME, _DYN_PARENT_DATA_TAG, _DYN_PARENT_ELEMENT, _DYN_PARENT_NODE, _DYN_TAG_NAME, _DYN_USE_DEFAULT_CONTENT_1, _DYN__CONFIG, _DYN__TRACE_LOGGER } from "../__DynamicConstants";
|
|
11
12
|
import { isValueAssigned, removeInvalidElements, walkUpDomChainWithElementValidation } from "../common/Utils";
|
|
12
13
|
var MAX_CONTENTNAME_LENGTH = 200;
|
|
@@ -222,7 +223,7 @@ var DomContentHandler = /** @class */ (function () {
|
|
|
222
223
|
default:
|
|
223
224
|
contentName = element.value || element[_DYN_NAME /* @min:%2ename */] || element.alt || element.innerText || element.id;
|
|
224
225
|
}
|
|
225
|
-
return contentName
|
|
226
|
+
return strSubstring(contentName, 0, MAX_CONTENTNAME_LENGTH);
|
|
226
227
|
}
|
|
227
228
|
/**
|
|
228
229
|
* Check if the user wants to track the element, which means if the element has any tags with data-* or customDataPrefix
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DomContentHandler.js.map","sources":["DomContentHandler.js"],"sourcesContent":["/**\r\n* @copyright Microsoft 2020\r\n*/\r\nimport dynamicProto from \"@microsoft/dynamicproto-js\";\r\nimport { _throwInternal, getDocument, hasDocument, isNullOrUndefined, objExtend } from \"@microsoft/applicationinsights-core-js\";\r\nimport { strSubstring } from \"@nevware21/ts-utils\";\r\nimport { _DYN_ATTRIBUTES, _DYN_CAPTURE_ALL_META_DAT2, _DYN_CONTENT, _DYN_CONTENT_NAME, _DYN_CUSTOM_DATA_PREFIX, _DYN_DATA_TAGS, _DYN_GET_ATTRIBUTE, _DYN_GET_ELEMENT_CONTENT, _DYN_INDEX_OF, _DYN_LENGTH, _DYN_META_DATA_PREFIX, _DYN_NAME, _DYN_PARENT_DATA_TAG, _DYN_PARENT_ELEMENT, _DYN_PARENT_NODE, _DYN_TAG_NAME, _DYN_USE_DEFAULT_CONTENT_1, _DYN__CONFIG, _DYN__TRACE_LOGGER } from \"../__DynamicConstants\";\r\nimport { isValueAssigned, removeInvalidElements, walkUpDomChainWithElementValidation } from \"../common/Utils\";\r\nvar MAX_CONTENTNAME_LENGTH = 200;\r\nvar DomContentHandler = /** @class */ (function () {\r\n /**\r\n * @param config - ClickAnalytics configuration object\r\n * @param traceLogger - Trace logger to log to console.\r\n */\r\n function DomContentHandler(_config, _traceLogger) {\r\n this._config = _config;\r\n this._traceLogger = _traceLogger;\r\n dynamicProto(DomContentHandler, this, function (_self) {\r\n _self.getMetadata = function () {\r\n var dataTags = (_self[_DYN__CONFIG /* @min:%2e_config */] || {})[_DYN_DATA_TAGS /* @min:%2edataTags */];\r\n var metaTags = {};\r\n if (hasDocument) {\r\n metaTags = isValueAssigned(dataTags.metaDataPrefix) ? _getMetaDataFromDOM(dataTags[_DYN_CAPTURE_ALL_META_DAT2 /* @min:%2ecaptureAllMetaDataContent */], dataTags[_DYN_META_DATA_PREFIX /* @min:%2emetaDataPrefix */], false) :\r\n _getMetaDataFromDOM(dataTags[_DYN_CAPTURE_ALL_META_DAT2 /* @min:%2ecaptureAllMetaDataContent */], \"\", false);\r\n }\r\n return metaTags;\r\n };\r\n _self[_DYN_GET_ELEMENT_CONTENT /* @min:%2egetElementContent */] = function (element) {\r\n if (!element) {\r\n return {};\r\n }\r\n var dataTags = (_self[_DYN__CONFIG /* @min:%2e_config */] || {})[_DYN_DATA_TAGS /* @min:%2edataTags */];\r\n var elementContent = {};\r\n var biBlobValue;\r\n var parentDataTagPrefix;\r\n var dataTagPrefix = dataTags[_DYN_CUSTOM_DATA_PREFIX /* @min:%2ecustomDataPrefix */];\r\n var aiBlobAttributeTag = dataTagPrefix + dataTags.aiBlobAttributeTag;\r\n if (isValueAssigned(dataTags[_DYN_PARENT_DATA_TAG /* @min:%2eparentDataTag */])) {\r\n parentDataTagPrefix = dataTagPrefix + dataTags[_DYN_PARENT_DATA_TAG /* @min:%2eparentDataTag */];\r\n }\r\n if (!_isTracked(element, dataTagPrefix, aiBlobAttributeTag)) {\r\n // capture blob from element or hierarchy\r\n biBlobValue = element[_DYN_GET_ATTRIBUTE /* @min:%2egetAttribute */](aiBlobAttributeTag);\r\n if (biBlobValue) {\r\n try {\r\n elementContent = JSON.parse(biBlobValue);\r\n }\r\n catch (e) {\r\n _throwInternal(_self[_DYN__TRACE_LOGGER /* @min:%2e_traceLogger */], 1 /* eLoggingSeverity.CRITICAL */, 101 /* _eInternalMessageId.CannotParseAiBlobValue */, \"Can not parse \" + biBlobValue);\r\n }\r\n }\r\n else {\r\n // traverse up the DOM to find the closest parent with data-* tag defined\r\n //contentElement = walkUpDomChainWithElementValidation(element, _self._isTracked, dataTagPrefix);\r\n elementContent = objExtend(elementContent, _populateElementContent(element, dataTagPrefix, parentDataTagPrefix, aiBlobAttributeTag));\r\n }\r\n }\r\n else {\r\n elementContent = objExtend(elementContent, _populateElementContentwithDataTag(element, dataTagPrefix, parentDataTagPrefix, aiBlobAttributeTag));\r\n }\r\n removeInvalidElements(elementContent);\r\n if (parentDataTagPrefix) {\r\n elementContent = objExtend(elementContent, _getParentDetails(element, elementContent, dataTagPrefix, aiBlobAttributeTag));\r\n }\r\n return elementContent;\r\n };\r\n /**\r\n * Capture current level Element content\r\n */\r\n function _captureElementContentWithDataTag(contentElement, elementContent, dataTagPrefix) {\r\n for (var i = 0, attrib; i < contentElement.attributes[_DYN_LENGTH /* @min:%2elength */]; i++) {\r\n attrib = contentElement[_DYN_ATTRIBUTES /* @min:%2eattributes */][i];\r\n if (attrib.name[_DYN_INDEX_OF /* @min:%2eindexOf */](dataTagPrefix) !== 0) {\r\n continue;\r\n }\r\n var attribName = attrib[_DYN_NAME /* @min:%2ename */].replace(dataTagPrefix, \"\");\r\n elementContent[attribName] = attrib.value;\r\n }\r\n }\r\n /**\r\n * Walk Up the DOM to capture Element content\r\n */\r\n function _walkUpDomChainCaptureData(el, elementContent, dataTagPrefix, parentDataTagPrefix, aiBlobAttributeTag) {\r\n var element = el;\r\n var parentDataTagFound = false;\r\n var elementLevelFlag = false; // Use this flag to capture 'id' only at the incoming html element level.\r\n while (!isNullOrUndefined(element) && !isNullOrUndefined(element[_DYN_ATTRIBUTES /* @min:%2eattributes */])) {\r\n var attributes = element[_DYN_ATTRIBUTES /* @min:%2eattributes */];\r\n for (var i = 0; i < attributes[_DYN_LENGTH /* @min:%2elength */]; i++) {\r\n var attrib = attributes[i];\r\n if (attrib.name[_DYN_INDEX_OF /* @min:%2eindexOf */](dataTagPrefix) !== 0) {\r\n continue;\r\n }\r\n if (attrib.name[_DYN_INDEX_OF /* @min:%2eindexOf */](parentDataTagPrefix) === 0) {\r\n parentDataTagFound = true;\r\n }\r\n // Todo handle blob data\r\n if (attrib.name[_DYN_INDEX_OF /* @min:%2eindexOf */](aiBlobAttributeTag) === 0) {\r\n continue;\r\n }\r\n var attribName = attrib[_DYN_NAME /* @min:%2ename */].replace(dataTagPrefix, \"\");\r\n if (elementLevelFlag && attribName === \"id\") {\r\n continue; // skip capturing id if not at the first level.\r\n }\r\n if (!isValueAssigned(elementContent[attribName])) {\r\n elementContent[attribName] = attrib.value;\r\n }\r\n }\r\n // break after current level;\r\n if (parentDataTagFound) {\r\n break;\r\n }\r\n elementLevelFlag = true; // after the initial level set this flag to true.\r\n element = element[_DYN_PARENT_NODE /* @min:%2eparentNode */];\r\n }\r\n }\r\n /**\r\n * Capture Element content along with Data Tag attributes and values\r\n */\r\n function _populateElementContent(element, dataTagPrefix, parentDataTagPrefix, aiBlobAttributeTag) {\r\n var elementContent = {};\r\n if (!element) {\r\n return elementContent;\r\n }\r\n var htmlContent = _getHtmlIdAndContentName(element);\r\n elementContent = {\r\n id: htmlContent.id || \"\",\r\n contentName: htmlContent[_DYN_CONTENT_NAME /* @min:%2econtentName */] || \"\"\r\n };\r\n if (isValueAssigned(parentDataTagPrefix)) {\r\n _walkUpDomChainCaptureData(element, elementContent, dataTagPrefix, parentDataTagPrefix, aiBlobAttributeTag);\r\n }\r\n // Validate to ensure the minimum required field 'id' or 'contentName' is present.\r\n // The content schema defines id, aN and sN as required fields. 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 (!elementContent.id && !elementContent[_DYN_CONTENT_NAME /* @min:%2econtentName */]) {\r\n _throwInternal(_traceLogger, 2 /* eLoggingSeverity.WARNING */, 102 /* _eInternalMessageId.InvalidContentBlob */, \"Invalid content blob. Missing required attributes (id, contentName. \" +\r\n \" Content information will still be collected!\");\r\n }\r\n return elementContent;\r\n }\r\n /**\r\n * Capture Element content along with Data Tag attributes and values\r\n */\r\n function _populateElementContentwithDataTag(element, dataTagPrefix, parentDataTagPrefix, aiBlobAttributeTag) {\r\n var dataTags = (_self[_DYN__CONFIG /* @min:%2e_config */] || {})[_DYN_DATA_TAGS /* @min:%2edataTags */];\r\n var elementContent = {};\r\n if (!element) {\r\n return elementContent;\r\n }\r\n var htmlContent = _getHtmlIdAndContentName(element);\r\n if (isValueAssigned(parentDataTagPrefix)) {\r\n _walkUpDomChainCaptureData(element, elementContent, dataTagPrefix, parentDataTagPrefix, aiBlobAttributeTag);\r\n }\r\n else {\r\n _captureElementContentWithDataTag(element, elementContent, dataTagPrefix);\r\n }\r\n if (dataTags[_DYN_USE_DEFAULT_CONTENT_1 /* @min:%2euseDefaultContentNameOrId */]) {\r\n if (!isValueAssigned(elementContent.id)) {\r\n elementContent.id = htmlContent.id || \"\";\r\n }\r\n elementContent[_DYN_CONTENT_NAME /* @min:%2econtentName */] = htmlContent[_DYN_CONTENT_NAME /* @min:%2econtentName */] || \"\";\r\n }\r\n // Validate to ensure the minimum required field 'id' or 'contentName' is present.\r\n // The content schema defines id, aN and sN as required fields. 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 (!elementContent.id && !elementContent[_DYN_CONTENT_NAME /* @min:%2econtentName */]) {\r\n _throwInternal(_traceLogger, 2 /* eLoggingSeverity.WARNING */, 102 /* _eInternalMessageId.InvalidContentBlob */, \"Invalid content blob. Missing required attributes (id, contentName. \" +\r\n \" Content information will still be collected!\");\r\n }\r\n return elementContent;\r\n }\r\n /**\r\n * Retrieve a specified metadata tag value from the DOM.\r\n * @param captureAllMetaDataContent - Flag to capture all metadata content\r\n * @param prefix - Prefix to search the metatags with.\r\n * @param removePrefix - Specifies if the prefix must be excluded from key names in the returned collection.\r\n * @returns Metadata collection/property bag\r\n */\r\n function _getMetaDataFromDOM(captureAllMetaDataContent, prefix, removePrefix) {\r\n var metaElements;\r\n var metaData = {};\r\n if (hasDocument) {\r\n metaElements = document.querySelectorAll(\"meta\");\r\n for (var i = 0; i < metaElements[_DYN_LENGTH /* @min:%2elength */]; i++) {\r\n var meta = metaElements[i];\r\n if (meta[_DYN_NAME /* @min:%2ename */]) {\r\n if (captureAllMetaDataContent || meta.name[_DYN_INDEX_OF /* @min:%2eindexOf */](prefix) === 0) {\r\n var name_1 = removePrefix ? meta[_DYN_NAME /* @min:%2ename */].replace(prefix, \"\") : meta[_DYN_NAME /* @min:%2ename */];\r\n metaData[name_1] = meta[_DYN_CONTENT /* @min:%2econtent */];\r\n }\r\n }\r\n }\r\n }\r\n return metaData;\r\n }\r\n /**\r\n * Gets the default content name.\r\n * @param element - An html element\r\n * @param useDefaultContentNameOrId - Flag indicating if an element is market PII.\r\n * @returns Content name\r\n */\r\n function _getDefaultContentName(element, useDefaultContentName) {\r\n if (useDefaultContentName === false || !element[_DYN_TAG_NAME /* @min:%2etagName */]) {\r\n return \"\";\r\n }\r\n var doc = getDocument() || {};\r\n var contentName;\r\n switch (element[_DYN_TAG_NAME /* @min:%2etagName */]) {\r\n case \"A\":\r\n contentName = doc.all ? element.innerText || element.innerHTML : element.text || element.innerHTML;\r\n break;\r\n case \"IMG\":\r\n case \"AREA\":\r\n contentName = element.alt;\r\n break;\r\n default:\r\n contentName = element.value || element[_DYN_NAME /* @min:%2ename */] || element.alt || element.innerText || element.id;\r\n }\r\n return strSubstring(contentName, 0, MAX_CONTENTNAME_LENGTH);\r\n }\r\n /**\r\n * Check if the user wants to track the element, which means if the element has any tags with data-* or customDataPrefix\r\n * @param element - An html element\r\n * @returns true if any data-* exist, otherwise return false\r\n */\r\n function _isTracked(element, dataTag, aiBlobAttributeTag) {\r\n var attrs = element[_DYN_ATTRIBUTES /* @min:%2eattributes */];\r\n var dataTagFound = false;\r\n for (var i = 0; i < attrs[_DYN_LENGTH /* @min:%2elength */]; i++) {\r\n var attributeName = attrs[i][_DYN_NAME /* @min:%2ename */];\r\n if (attributeName === aiBlobAttributeTag) {\r\n // ignore if the attribute name is equal to aiBlobAttributeTag\r\n return false;\r\n }\r\n else if (attributeName[_DYN_INDEX_OF /* @min:%2eindexOf */](dataTag) === 0) {\r\n dataTagFound = true;\r\n }\r\n }\r\n return dataTagFound;\r\n }\r\n function _getHtmlIdAndContentName(element) {\r\n var _a;\r\n var dataTags = (_self[_DYN__CONFIG /* @min:%2e_config */] || {})[_DYN_DATA_TAGS /* @min:%2edataTags */];\r\n var callback = (_self[_DYN__CONFIG /* @min:%2e_config */] || {}).callback;\r\n var htmlContent = {};\r\n if (!element) {\r\n return htmlContent;\r\n }\r\n if (dataTags[_DYN_USE_DEFAULT_CONTENT_1 /* @min:%2euseDefaultContentNameOrId */]) {\r\n var customizedContentName = callback[_DYN_CONTENT_NAME /* @min:%2econtentName */] ? callback[_DYN_CONTENT_NAME /* @min:%2econtentName */](element, dataTags[_DYN_USE_DEFAULT_CONTENT_1 /* @min:%2euseDefaultContentNameOrId */]) : \"\";\r\n var defaultContentName = _getDefaultContentName(element, dataTags[_DYN_USE_DEFAULT_CONTENT_1 /* @min:%2euseDefaultContentNameOrId */]);\r\n htmlContent = (_a = {\r\n id: element.id\r\n },\r\n _a[_DYN_CONTENT_NAME /* @min:contentName */] = customizedContentName || defaultContentName || element[_DYN_GET_ATTRIBUTE /* @min:%2egetAttribute */](\"alt\"),\r\n _a);\r\n }\r\n return htmlContent;\r\n }\r\n /**\r\n * Computes the parentId of a given element.\r\n * @param element - An html element\r\n * @returns An object containing the closest parentId , can be empty if nothing was found\r\n */\r\n function _getParentDetails(element, elementContent, dataTagPrefix, aiBlobAttributeTag) {\r\n var parentId = elementContent[\"parentid\"];\r\n var parentName = elementContent[\"parentname\"];\r\n var parentInfo = {};\r\n if (parentId || parentName || !element) {\r\n return parentInfo;\r\n }\r\n return _populateParentInfo(element, dataTagPrefix, aiBlobAttributeTag);\r\n }\r\n /**\r\n * Check if parent info already set up, if so take and put into content, if not walk up the DOM to find correct info\r\n * @param element - An html element that the user wants to track\r\n * @returns An object containing the parent info, can be empty if nothing was found\r\n */\r\n function _populateParentInfo(element, dataTagPrefix, aiBlobAttributeTag) {\r\n var parentInfo = {};\r\n var parentId;\r\n // if the user does not set up parent info, walk to the DOM, find the closest parent element (with tags) and populate the info\r\n var closestParentElement = walkUpDomChainWithElementValidation(element[_DYN_PARENT_ELEMENT /* @min:%2eparentElement */], _isTracked, dataTagPrefix);\r\n if (closestParentElement) {\r\n var dataAttr = closestParentElement[_DYN_GET_ATTRIBUTE /* @min:%2egetAttribute */](aiBlobAttributeTag) || element[aiBlobAttributeTag];\r\n if (dataAttr) {\r\n try {\r\n var telemetryObject = JSON.parse(dataAttr);\r\n }\r\n catch (e) {\r\n _throwInternal(_traceLogger, 1 /* eLoggingSeverity.CRITICAL */, 101 /* _eInternalMessageId.CannotParseAiBlobValue */, \"Can not parse \" + dataAttr);\r\n }\r\n if (telemetryObject) {\r\n parentId = telemetryObject.id;\r\n }\r\n }\r\n else {\r\n parentId = closestParentElement[_DYN_GET_ATTRIBUTE /* @min:%2egetAttribute */](dataTagPrefix + \"id\");\r\n }\r\n }\r\n if (parentId) {\r\n parentInfo[\"parentid\"] = parentId;\r\n }\r\n else {\r\n var htmlContent = _getHtmlIdAndContentName(element[_DYN_PARENT_ELEMENT /* @min:%2eparentElement */]);\r\n parentInfo[\"parentid\"] = htmlContent.id;\r\n parentInfo[\"parentname\"] = htmlContent[_DYN_CONTENT_NAME /* @min:%2econtentName */];\r\n }\r\n return parentInfo;\r\n }\r\n });\r\n }\r\n /**\r\n * Collect metatags from DOM.\r\n * Collect data from meta tags.\r\n * @returns {object} - Metatags collection/property bag\r\n */\r\n DomContentHandler.prototype.getMetadata = function () {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n /**\r\n * Collect data-* attributes for the given element.\r\n * All attributes with data-* prefix or user provided customDataPrefix are collected.'data-*' prefix is removed from the key name.\r\n * @param element - The element from which attributes need to be collected.\r\n * @returns String representation of the Json array of element attributes\r\n */\r\n DomContentHandler.prototype.getElementContent = function (element) {\r\n // @DynamicProtoStub -- DO NOT add any code as this will be removed during packaging\r\n return null;\r\n };\r\n return DomContentHandler;\r\n}());\r\nexport { DomContentHandler };\r\n//# sourceMappingURL=DomContentHandler.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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;kEAkBM,CAAC;;;;;6BACsB;AAC7B;AACA;AACA"}
|
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/applicationinsights-clickanalytics-js",
|
|
3
|
-
"version": "3.0.0-
|
|
3
|
+
"version": "3.0.0-nightly3.2304-28",
|
|
4
4
|
"description": "Microsoft Application Insights Click Analytics extension",
|
|
5
5
|
"homepage": "https://github.com/microsoft/ApplicationInsights-JS#readme",
|
|
6
6
|
"author": "Microsoft Application Insights Team",
|
|
7
|
-
"main": "dist/applicationinsights-clickanalytics-js.js",
|
|
8
|
-
"module": "dist-
|
|
7
|
+
"main": "dist/es5/applicationinsights-clickanalytics-js.js",
|
|
8
|
+
"module": "dist-es5/applicationinsights-clickanalytics-js.js",
|
|
9
9
|
"types": "types/applicationinsights-clickanalytics-js.d.ts",
|
|
10
10
|
"sideEffects": false,
|
|
11
11
|
"scripts": {
|
|
12
12
|
"build": "npm run build:esm && npm run build:browser && npm run sri && npm run dtsgen",
|
|
13
13
|
"build:esm": "grunt clickanalytics",
|
|
14
|
-
"build:browser": "rollup -c",
|
|
14
|
+
"build:browser": "rollup -c rollup.config.js --bundleConfigAsCjs",
|
|
15
15
|
"rebuild": "npm run build",
|
|
16
16
|
"test": "grunt clickanalyticstests",
|
|
17
17
|
"mintest": "grunt clickanalytics-mintests",
|
|
@@ -19,22 +19,23 @@
|
|
|
19
19
|
"dtsgen": "api-extractor run --local && node ../../scripts/dtsgen.js 'Microsoft.ApplicationInsights'",
|
|
20
20
|
"sri": "node ../../tools/subResourceIntegrity/generateIntegrityFile.js",
|
|
21
21
|
"ai-min": "grunt clickanalytics-min",
|
|
22
|
-
"ai-restore": "grunt clickanalytics-restore"
|
|
22
|
+
"ai-restore": "grunt clickanalytics-restore",
|
|
23
|
+
"npm-pack": "npm pack"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|
|
25
26
|
"@microsoft/ai-test-framework": "0.0.1",
|
|
26
27
|
"@microsoft/applicationinsights-rollup-plugin-uglify3-js": "1.0.0",
|
|
27
|
-
"@microsoft/applicationinsights-rollup-es5": "1.0.
|
|
28
|
+
"@microsoft/applicationinsights-rollup-es5": "1.0.1",
|
|
28
29
|
"@microsoft/api-extractor": "^7.18.1",
|
|
29
30
|
"typescript": "^4.9.3",
|
|
30
31
|
"tslib": "^2.0.0",
|
|
31
32
|
"globby": "^11.0.0",
|
|
32
33
|
"magic-string": "^0.25.7",
|
|
33
|
-
"@rollup/plugin-commonjs": "^
|
|
34
|
-
"@rollup/plugin-node-resolve": "^
|
|
35
|
-
"@rollup/plugin-replace": "^
|
|
34
|
+
"@rollup/plugin-commonjs": "^24.0.0",
|
|
35
|
+
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
36
|
+
"@rollup/plugin-replace": "^5.0.2",
|
|
36
37
|
"rollup-plugin-cleanup": "^3.2.1",
|
|
37
|
-
"rollup": "^
|
|
38
|
+
"rollup": "^3.20.0",
|
|
38
39
|
"grunt": "^1.5.3",
|
|
39
40
|
"grunt-cli": "^1.4.3",
|
|
40
41
|
"grunt-contrib-qunit": "^6.2.1",
|
|
@@ -45,19 +46,19 @@
|
|
|
45
46
|
"tslib": "*"
|
|
46
47
|
},
|
|
47
48
|
"dependencies": {
|
|
48
|
-
"@microsoft/dynamicproto-js": "^
|
|
49
|
-
"@microsoft/applicationinsights-shims": "
|
|
50
|
-
"@microsoft/applicationinsights-core-js": "3.0.0-
|
|
51
|
-
"@microsoft/applicationinsights-common": "3.0.0-
|
|
52
|
-
"@microsoft/applicationinsights-properties-js": "3.0.0-
|
|
53
|
-
"@nevware21/ts-utils": ">= 0.
|
|
49
|
+
"@microsoft/dynamicproto-js": "^2.0.2",
|
|
50
|
+
"@microsoft/applicationinsights-shims": "3.0.1",
|
|
51
|
+
"@microsoft/applicationinsights-core-js": "3.0.0-nightly3.2304-28",
|
|
52
|
+
"@microsoft/applicationinsights-common": "3.0.0-nightly3.2304-28",
|
|
53
|
+
"@microsoft/applicationinsights-properties-js": "3.0.0-nightly3.2304-28",
|
|
54
|
+
"@nevware21/ts-utils": ">= 0.9.4 < 2.x"
|
|
54
55
|
},
|
|
55
56
|
"repository": {
|
|
56
57
|
"type": "git",
|
|
57
|
-
"url": "https://github.com/microsoft/ApplicationInsights-JS/tree/
|
|
58
|
+
"url": "https://github.com/microsoft/ApplicationInsights-JS/tree/main/extensions/applicationinsights-clickanalytics-js"
|
|
58
59
|
},
|
|
59
60
|
"license": "MIT",
|
|
60
61
|
"publishConfig": {
|
|
61
|
-
"tag": "
|
|
62
|
+
"tag": "nightly3"
|
|
62
63
|
}
|
|
63
64
|
}
|
package/tsconfig.json
CHANGED
|
@@ -14,9 +14,10 @@
|
|
|
14
14
|
"skipLibCheck": true,
|
|
15
15
|
"forceConsistentCasingInFileNames": true,
|
|
16
16
|
"declaration": true,
|
|
17
|
-
"declarationDir": "
|
|
18
|
-
"outDir": "
|
|
19
|
-
"rootDir": "./
|
|
17
|
+
"declarationDir": "build/types",
|
|
18
|
+
"outDir": "dist-es5",
|
|
19
|
+
"rootDir": "./src",
|
|
20
|
+
"removeComments": false
|
|
20
21
|
},
|
|
21
22
|
"include": [
|
|
22
23
|
"./src/**/*.ts"
|
|
@@ -1,2 +1,101 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Microsoft.ApplicationInsights, 3.0.0-nightly3.2304-28
|
|
3
|
+
* Copyright (c) Microsoft and contributors. All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* Microsoft Application Insights Team
|
|
6
|
+
* https://github.com/microsoft/ApplicationInsights-JS#readme
|
|
7
|
+
*
|
|
8
|
+
* ---------------------------------------------------------------------------
|
|
9
|
+
* This is a single combined (rollup) declaration file for the package,
|
|
10
|
+
* if you require a namespace wrapped version it is also available.
|
|
11
|
+
* - Namespaced version: types/applicationinsights-clickanalytics-js.namespaced.d.ts
|
|
12
|
+
* ---------------------------------------------------------------------------
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { BaseTelemetryPlugin } from '@microsoft/applicationinsights-core-js';
|
|
16
|
+
import { IAppInsightsCore } from '@microsoft/applicationinsights-core-js';
|
|
17
|
+
import { IConfig } from '@microsoft/applicationinsights-common';
|
|
18
|
+
import { IConfiguration } from '@microsoft/applicationinsights-core-js';
|
|
19
|
+
import { ICustomProperties } from '@microsoft/applicationinsights-core-js';
|
|
20
|
+
import { IEventTelemetry } from '@microsoft/applicationinsights-common';
|
|
21
|
+
import { IPlugin } from '@microsoft/applicationinsights-core-js';
|
|
22
|
+
import { IProcessTelemetryContext } from '@microsoft/applicationinsights-core-js';
|
|
23
|
+
import { ITelemetryItem } from '@microsoft/applicationinsights-core-js';
|
|
24
|
+
import { ITelemetryPluginChain } from '@microsoft/applicationinsights-core-js';
|
|
25
|
+
|
|
26
|
+
export declare function BehaviorEnumValidator(enumObj: any): (key: string) => any;
|
|
27
|
+
|
|
28
|
+
export declare function BehaviorMapValidator(map: any): (key: string) => any;
|
|
29
|
+
|
|
30
|
+
export declare function BehaviorValueValidator(behaviorArray: string[]): (key: string) => string;
|
|
31
|
+
|
|
32
|
+
export declare class ClickAnalyticsPlugin extends BaseTelemetryPlugin {
|
|
33
|
+
identifier: string;
|
|
34
|
+
priority: number;
|
|
35
|
+
static Version: string;
|
|
36
|
+
constructor();
|
|
37
|
+
initialize(config: IConfiguration & IConfig, core: IAppInsightsCore, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain): void;
|
|
38
|
+
processTelemetry(env: ITelemetryItem, itemCtx?: IProcessTelemetryContext): void;
|
|
39
|
+
/**
|
|
40
|
+
* Logs a page action event.
|
|
41
|
+
* @param IPageActionTelemetry
|
|
42
|
+
* @param customProperties - Additional data used to filter events and metrics. Defaults to empty.
|
|
43
|
+
*/
|
|
44
|
+
trackPageAction(pageAction?: IPageActionTelemetry, customProperties?: ICustomProperties): void;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Page Action event
|
|
49
|
+
*/
|
|
50
|
+
declare interface IPageActionTelemetry extends IEventTelemetry {
|
|
51
|
+
/**
|
|
52
|
+
* Target uri for PageAction events
|
|
53
|
+
*/
|
|
54
|
+
targetUri?: string;
|
|
55
|
+
/**
|
|
56
|
+
* One of the awa.actionType values
|
|
57
|
+
*/
|
|
58
|
+
actionType?: string;
|
|
59
|
+
/**
|
|
60
|
+
* One of the awa.behavior values.
|
|
61
|
+
*/
|
|
62
|
+
behavior?: string | number;
|
|
63
|
+
/**
|
|
64
|
+
* X, Y representing the absolute co-ordinates withrespect to topleft corner of the page. This should be normalized for the screen resolution to provide better heat map.
|
|
65
|
+
*/
|
|
66
|
+
clickCoordinates?: string;
|
|
67
|
+
/**
|
|
68
|
+
* JSON-formatted array of content acted upon
|
|
69
|
+
*/
|
|
70
|
+
content?: any;
|
|
71
|
+
/**
|
|
72
|
+
* Version indicating content version which aids in parsing the content.
|
|
73
|
+
*/
|
|
74
|
+
contentVer?: string;
|
|
75
|
+
/**
|
|
76
|
+
* Uri of the referrer, this is a convinence for adaptors to just leverage PageAction for click analytics without linking it to the respective Page Views.
|
|
77
|
+
*/
|
|
78
|
+
refUri?: string;
|
|
79
|
+
/**
|
|
80
|
+
* Time taken in milliseconds since the user saw the page and took the action (such as click on a link, etc.). This will be in seconds.
|
|
81
|
+
*/
|
|
82
|
+
timeToAction?: number;
|
|
83
|
+
/**
|
|
84
|
+
* A relative or absolute URL that identifies the page or other item. Defaults to the window location.
|
|
85
|
+
*/
|
|
86
|
+
uri?: string;
|
|
87
|
+
/**
|
|
88
|
+
* Page type
|
|
89
|
+
*/
|
|
90
|
+
pageType?: string;
|
|
91
|
+
/**
|
|
92
|
+
* Title of the page
|
|
93
|
+
*/
|
|
94
|
+
pageName?: string;
|
|
95
|
+
/**
|
|
96
|
+
* Content Id (Parent Id) of the parent in which the content was located;
|
|
97
|
+
*/
|
|
98
|
+
parentId?: string;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export { }
|