@uipath/robot
Advanced tools
@@ -450,3 +450,3 @@ "use strict"; | ||
| this.eventHandlers = new utils_1.Dispatcher(); | ||
| this.logger = new appinsightsLogger_1.AppInsightsLogger(); | ||
| this.logger = new appinsightsLogger_1.AppInsightsLogger(this.settings); | ||
| this.serverFeatures = new models_1.ServerFeatures([]); | ||
@@ -453,0 +453,0 @@ this.initializePortMutex = new async_mutex_1.Mutex(); |
+0
-14
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.UiPathRobot = void 0; | ||
| var traceEvent_1 = require("./enums/traceEvent"); | ||
| var models_1 = require("./models"); | ||
| var robotSDK_1 = require("./sdk/robotSDK"); | ||
| var appinsightsLogger_1 = require("./utils/logger/appinsightsLogger"); | ||
| /** | ||
@@ -20,14 +18,2 @@ * Browser invocation javascript SDK module. Accessible as UiPathRobot from browser console. | ||
| /** | ||
| * On page load analytics | ||
| */ | ||
| document.addEventListener('readystatechange', function () { | ||
| if (document.readyState === 'complete') { | ||
| var logger = new appinsightsLogger_1.AppInsightsLogger(); | ||
| if (!UiPathRobot.settings.disableTelemetry) { | ||
| logger.tracePage(); | ||
| logger.trace(traceEvent_1.TraceEvent.SDK_Loaded, {}, robotSDK.settings.appOrigin); | ||
| } | ||
| } | ||
| }); | ||
| /** | ||
| * Init method set custom consent code handling. | ||
@@ -34,0 +20,0 @@ * @returns {IRobotSDK} instance |
| import { ApplicationInsights } from '@microsoft/applicationinsights-web'; | ||
| import { TraceEvent } from '../../enums/traceEvent'; | ||
| import { ILogger } from './iLogger'; | ||
| import { Settings } from '../../models'; | ||
| /** | ||
@@ -8,4 +9,7 @@ * Appinsights logger. Stops logging for locally hosted files as file path might contain user info. | ||
| export declare class AppInsightsLogger implements ILogger { | ||
| appInsights: ApplicationInsights; | ||
| constructor(); | ||
| appInsights: ApplicationInsights | null; | ||
| settings: Settings; | ||
| constructor(settings: Settings); | ||
| private createLogger; | ||
| private skipTelemetry; | ||
| /** | ||
@@ -25,6 +29,2 @@ * Trace event method | ||
| traceError: (event: TraceEvent, error: any, appName?: string | undefined) => void; | ||
| /** | ||
| * Tracing page | ||
| */ | ||
| tracePage: () => void; | ||
| } |
@@ -10,9 +10,18 @@ "use strict"; | ||
| var AppInsightsLogger = /** @class */ (function () { | ||
| function AppInsightsLogger() { | ||
| function AppInsightsLogger(settings) { | ||
| var _this = this; | ||
| this.appInsights = new applicationinsights_web_1.ApplicationInsights({ | ||
| config: { | ||
| instrumentationKey: process.env.NODE_ENV === 'production' ? '025bfd02-04e8-4969-8293-94a1ec738e4e' : '45d1ba3e-f027-4fb0-a1cc-d6874a40ec00', | ||
| }, | ||
| }); | ||
| this.appInsights = null; | ||
| this.createLogger = function () { | ||
| if (_this.appInsights != null) { | ||
| return; | ||
| } | ||
| _this.appInsights = new applicationinsights_web_1.ApplicationInsights({ | ||
| config: { | ||
| instrumentationKey: '025bfd02-04e8-4969-8293-94a1ec738e4e', | ||
| disableAjaxTracking: true, | ||
| }, | ||
| }); | ||
| _this.appInsights.loadAppInsights(); | ||
| }; | ||
| this.skipTelemetry = function () { return window.location.protocol === 'file:' || _this.settings.disableTelemetry; }; | ||
| /** | ||
@@ -24,5 +33,11 @@ * Trace event method | ||
| this.trace = function (event, properties, appName) { | ||
| if (window.location.protocol !== 'file:') { | ||
| _this.appInsights.trackEvent({ name: event.toString(), properties: { application: appName, version: version_1.ROBOTJS_VERSION } }, properties); | ||
| var _a; | ||
| if (_this.skipTelemetry()) { | ||
| return; | ||
| } | ||
| _this.createLogger(); | ||
| (_a = _this.appInsights) === null || _a === void 0 ? void 0 : _a.trackEvent({ | ||
| name: event.toString(), | ||
| properties: { application: appName, version: version_1.ROBOTJS_VERSION } | ||
| }, properties); | ||
| }; | ||
@@ -35,20 +50,13 @@ /** | ||
| this.traceError = function (event, error, appName) { | ||
| if (window.location.protocol !== 'file:') { | ||
| _this.appInsights.trackException({ | ||
| properties: { method: event.toString(), application: appName, version: version_1.ROBOTJS_VERSION }, | ||
| exception: new Error(error), | ||
| }); | ||
| var _a; | ||
| if (_this.skipTelemetry()) { | ||
| return; | ||
| } | ||
| _this.createLogger(); | ||
| (_a = _this.appInsights) === null || _a === void 0 ? void 0 : _a.trackException({ | ||
| properties: { method: event.toString(), application: appName, version: version_1.ROBOTJS_VERSION }, | ||
| exception: new Error(error), | ||
| }); | ||
| }; | ||
| /** | ||
| * Tracing page | ||
| */ | ||
| this.tracePage = function () { | ||
| if (window.location.protocol !== 'file:') { | ||
| _this.appInsights.trackPageView(); | ||
| } | ||
| }; | ||
| if (window.location.protocol !== 'file:') { | ||
| this.appInsights.loadAppInsights(); | ||
| } | ||
| this.settings = settings; | ||
| } | ||
@@ -55,0 +63,0 @@ return AppInsightsLogger; |
@@ -1,1 +0,1 @@ | ||
| export declare const ROBOTJS_VERSION = "1.2.7"; | ||
| export declare const ROBOTJS_VERSION = "1.2.8"; |
+1
-1
| "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.ROBOTJS_VERSION = void 0; | ||
| exports.ROBOTJS_VERSION = '1.2.7'; | ||
| exports.ROBOTJS_VERSION = '1.2.8'; |
+1
-1
| { | ||
| "name": "@uipath/robot", | ||
| "version": "1.2.7", | ||
| "version": "1.2.8", | ||
| "description": "UiPath Robot javascript SDK enabling web pages to interact with UiPath Robots", | ||
@@ -5,0 +5,0 @@ "scripts": { |
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
7
-12.5%5
-16.67%519945
-0.05%3765
-0.16%