New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@openreplay/tracker-assist

Package Overview
Dependencies
Maintainers
3
Versions
99
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@openreplay/tracker-assist - npm Package Compare versions

Comparing version 5.0.2 to 6.0.0-beta.1

jest.config.js

4

CHANGELOG.md

@@ -0,1 +1,5 @@

## 6.0.0
- added support for multi tab assist session
## 5.0.2

@@ -2,0 +6,0 @@

2

cjs/Assist.d.ts

@@ -27,3 +27,3 @@ import type { Properties } from 'csstype';

private readonly noSecureMode;
readonly version = "5.0.2";
readonly version = "6.0.0-beta.1";
private socket;

@@ -30,0 +30,0 @@ private peer;

@@ -25,3 +25,3 @@ "use strict";

this.noSecureMode = noSecureMode;
this.version = '5.0.2';
this.version = '6.0.0-beta.1';
this.socket = null;

@@ -81,4 +81,4 @@ this.peer = null;

}
emit(ev, ...args) {
this.socket && this.socket.emit(ev, ...args);
emit(ev, args) {
this.socket && this.socket.emit(ev, { meta: { tabId: this.app.getTabId(), }, data: args, });
}

@@ -113,3 +113,3 @@ get agentsConnected() {

}
const peerID = `${app.getProjectKey()}-${sessionId}`;
const peerID = `${app.getProjectKey()}-${sessionId}-${this.app.getTabId()}`;
// SocketIO

@@ -121,2 +121,3 @@ const socket = this.socket = (0, socket_io_client_1.connect)(this.getHost(), {

'identity': 'session',
'tabId': this.app.getTabId(),
'sessionInfo': JSON.stringify(Object.assign({ pageTitle: document.title, active: true }, this.app.getSessionInfo())),

@@ -126,3 +127,8 @@ },

});
socket.onAny((...args) => app.debug.log('Socket:', ...args));
socket.onAny((...args) => {
if (args[0] === 'messages' || args[0] === 'UPDATE_SESSION') {
return;
}
app.debug.log('Socket:', ...args);
});
this.remoteControl = new RemoteControl_js_1.default(this.options, id => {

@@ -141,24 +147,27 @@ var _a;

return callingAgents.get(id);
}, (id, isDenied) => {
}, (id, isDenied) => onRelease(id, isDenied));
const onRelease = (id, isDenied) => {
var _a, _b, _c;
if (id) {
const cb = this.agents[id].onControlReleased;
delete this.agents[id].onControlReleased;
typeof cb === 'function' && cb();
this.emit('control_rejected', id);
{
if (id) {
const cb = this.agents[id].onControlReleased;
delete this.agents[id].onControlReleased;
typeof cb === 'function' && cb();
this.emit('control_rejected', id);
}
if (annot != null) {
annot.remove();
annot = null;
}
callUI === null || callUI === void 0 ? void 0 : callUI.hideRemoteControl();
if (this.callingState !== CallingState.True) {
callUI === null || callUI === void 0 ? void 0 : callUI.remove();
callUI = null;
}
if (isDenied) {
const info = id ? (_a = this.agents[id]) === null || _a === void 0 ? void 0 : _a.agentInfo : {};
(_c = (_b = this.options).onRemoteControlDeny) === null || _c === void 0 ? void 0 : _c.call(_b, info || {});
}
}
if (annot != null) {
annot.remove();
annot = null;
}
callUI === null || callUI === void 0 ? void 0 : callUI.hideRemoteControl();
if (this.callingState !== CallingState.True) {
callUI === null || callUI === void 0 ? void 0 : callUI.remove();
callUI = null;
}
if (isDenied) {
const info = id ? (_a = this.agents[id]) === null || _a === void 0 ? void 0 : _a.agentInfo : {};
(_c = (_b = this.options).onRemoteControlDeny) === null || _c === void 0 ? void 0 : _c.call(_b, info || {});
}
});
};
const onAcceptRecording = () => {

@@ -173,18 +182,30 @@ socket.emit('recording_accepted');

const recordingState = new ScreenRecordingState_js_1.default(this.options.recordingConfirm);
// TODO: check incoming args
socket.on('request_control', this.remoteControl.requestControl);
socket.on('release_control', this.remoteControl.releaseControl);
socket.on('scroll', this.remoteControl.scroll);
socket.on('click', this.remoteControl.click);
socket.on('move', this.remoteControl.move);
socket.on('focus', (clientID, nodeID) => {
const el = app.nodes.getNode(nodeID);
if (el instanceof HTMLElement && this.remoteControl) {
this.remoteControl.focus(clientID, el);
function processEvent(agentId, event, callback) {
if (app.getTabId() === event.meta.tabId) {
return callback === null || callback === void 0 ? void 0 : callback(agentId, event.data);
}
});
socket.on('input', this.remoteControl.input);
socket.on('moveAnnotation', (_, p) => annot && annot.move(p)); // TODO: restrict by id
socket.on('startAnnotation', (_, p) => annot && annot.start(p));
socket.on('stopAnnotation', () => annot && annot.stop());
}
if (this.remoteControl !== null) {
socket.on('request_control', (agentId, dataObj) => {
var _a;
processEvent(agentId, dataObj, (_a = this.remoteControl) === null || _a === void 0 ? void 0 : _a.requestControl);
});
socket.on('release_control', (agentId, dataObj) => {
processEvent(agentId, dataObj, (_, data) => { var _a; return (_a = this.remoteControl) === null || _a === void 0 ? void 0 : _a.releaseControl(data); });
});
socket.on('scroll', (id, event) => { var _a; return processEvent(id, event, (_a = this.remoteControl) === null || _a === void 0 ? void 0 : _a.scroll); });
socket.on('click', (id, event) => { var _a; return processEvent(id, event, (_a = this.remoteControl) === null || _a === void 0 ? void 0 : _a.click); });
socket.on('move', (id, event) => { var _a; return processEvent(id, event, (_a = this.remoteControl) === null || _a === void 0 ? void 0 : _a.move); });
socket.on('focus', (id, event) => processEvent(id, event, (clientID, nodeID) => {
const el = app.nodes.getNode(nodeID);
if (el instanceof HTMLElement && this.remoteControl) {
this.remoteControl.focus(clientID, el);
}
}));
socket.on('input', (id, event) => { var _a; return processEvent(id, event, (_a = this.remoteControl) === null || _a === void 0 ? void 0 : _a.input); });
}
// TODO: restrict by id
socket.on('moveAnnotation', (id, event) => processEvent(id, event, (_, d) => annot && annot.move(d)));
socket.on('startAnnotation', (id, event) => processEvent(id, event, (_, d) => annot === null || annot === void 0 ? void 0 : annot.start(d)));
socket.on('stopAnnotation', (id, event) => processEvent(id, event, annot === null || annot === void 0 ? void 0 : annot.stop));
socket.on('NEW_AGENT', (id, info) => {

@@ -198,3 +219,6 @@ var _a, _b;

this.app.stop();
this.app.start().then(() => { this.assistDemandedRestart = false; }).catch(e => app.debug.error(e));
setTimeout(() => {
this.app.start().then(() => { this.assistDemandedRestart = false; }).catch(e => app.debug.error(e));
// TODO: check if it's needed; basically allowing some time for the app to finish everything before starting again
}, 500);
});

@@ -213,3 +237,6 @@ socket.on('AGENTS_CONNECTED', (ids) => {

this.app.stop();
this.app.start().then(() => { this.assistDemandedRestart = false; }).catch(e => app.debug.error(e));
setTimeout(() => {
this.app.start().then(() => { this.assistDemandedRestart = false; }).catch(e => app.debug.error(e));
// TODO: check if it's needed; basically allowing some time for the app to finish everything before starting again
}, 500);
(_a = this.remoteControl) === null || _a === void 0 ? void 0 : _a.reconnect(ids);

@@ -231,3 +258,4 @@ });

});
socket.on('call_end', (id) => {
socket.on('call_end', (info) => {
const id = info.data;
if (!callingAgents.has(id)) {

@@ -239,11 +267,20 @@ app.debug.warn('Received call_end from unknown agent', id);

});
socket.on('_agent_name', (id, name) => {
socket.on('_agent_name', (id, info) => {
if (app.getTabId() !== info.meta.tabId)
return;
const name = info.data;
callingAgents.set(id, name);
updateCallerNames();
});
socket.on('videofeed', (_, feedState) => {
socket.on('videofeed', (_, info) => {
if (app.getTabId() !== info.meta.tabId)
return;
const feedState = info.data;
callUI === null || callUI === void 0 ? void 0 : callUI.toggleVideoStream(feedState);
});
socket.on('request_recording', (id, agentData) => {
socket.on('request_recording', (id, info) => {
var _a, _b;
if (app.getTabId() !== info.meta.tabId)
return;
const agentData = info.data;
if (!recordingState.isActive) {

@@ -257,3 +294,5 @@ (_b = (_a = this.options).onRecordingRequest) === null || _b === void 0 ? void 0 : _b.call(_a, JSON.parse(agentData));

});
socket.on('stop_recording', (id) => {
socket.on('stop_recording', (id, info) => {
if (app.getTabId() !== info.meta.tabId)
return;
if (recordingState.isActive) {

@@ -421,2 +460,5 @@ recordingState.stopAgentRecording(id);

call.answer(lStreams[call.peer].stream);
document.addEventListener('visibilitychange', () => {
initiateCallEnd();
});
this.setCallingState(CallingState.True);

@@ -423,0 +465,0 @@ if (!callEndCallback) {

@@ -22,3 +22,3 @@ import type { Options as AssistOptions } from './Assist';

scroll: (id: any, d: any) => void;
move: (id: any, xy: any) => void;
move: (id: any, xy: any) => false | void | undefined;
private focused;

@@ -25,0 +25,0 @@ click: (id: any, xy: any) => void;

@@ -23,2 +23,3 @@ "use strict";

this.onRelease = onRelease;
this.mouse = null;
this.status = RCStatus.Disabled;

@@ -81,2 +82,6 @@ this.agentID = null;

this.mouse.mount();
document.addEventListener('visibilitychange', () => {
if (document.hidden)
this.releaseControl(false);
});
};

@@ -89,3 +94,6 @@ this.resetMouse = () => {

this.scroll = (id, d) => { var _a; id === this.agentID && ((_a = this.mouse) === null || _a === void 0 ? void 0 : _a.scroll(d)); };
this.move = (id, xy) => { var _a; id === this.agentID && ((_a = this.mouse) === null || _a === void 0 ? void 0 : _a.move(xy)); };
this.move = (id, xy) => {
var _a;
return id === this.agentID && ((_a = this.mouse) === null || _a === void 0 ? void 0 : _a.move(xy));
};
this.focused = null;

@@ -106,3 +114,5 @@ this.click = (id, xy) => {

if (this.focused instanceof HTMLTextAreaElement
|| this.focused instanceof HTMLInputElement) {
|| this.focused instanceof HTMLInputElement
|| this.focused.tagName === 'INPUT'
|| this.focused.tagName === 'TEXTAREA') {
setInputValue.call(this.focused, value);

@@ -109,0 +119,0 @@ const ev = new Event('input', { bubbles: true, });

@@ -27,3 +27,3 @@ import type { Properties } from 'csstype';

private readonly noSecureMode;
readonly version = "5.0.2";
readonly version = "6.0.0-beta.1";
private socket;

@@ -30,0 +30,0 @@ private peer;

@@ -23,3 +23,3 @@ import { connect, } from 'socket.io-client';

this.noSecureMode = noSecureMode;
this.version = '5.0.2';
this.version = '6.0.0-beta.1';
this.socket = null;

@@ -79,4 +79,4 @@ this.peer = null;

}
emit(ev, ...args) {
this.socket && this.socket.emit(ev, ...args);
emit(ev, args) {
this.socket && this.socket.emit(ev, { meta: { tabId: this.app.getTabId(), }, data: args, });
}

@@ -111,3 +111,3 @@ get agentsConnected() {

}
const peerID = `${app.getProjectKey()}-${sessionId}`;
const peerID = `${app.getProjectKey()}-${sessionId}-${this.app.getTabId()}`;
// SocketIO

@@ -119,2 +119,3 @@ const socket = this.socket = connect(this.getHost(), {

'identity': 'session',
'tabId': this.app.getTabId(),
'sessionInfo': JSON.stringify(Object.assign({ pageTitle: document.title, active: true }, this.app.getSessionInfo())),

@@ -124,3 +125,8 @@ },

});
socket.onAny((...args) => app.debug.log('Socket:', ...args));
socket.onAny((...args) => {
if (args[0] === 'messages' || args[0] === 'UPDATE_SESSION') {
return;
}
app.debug.log('Socket:', ...args);
});
this.remoteControl = new RemoteControl(this.options, id => {

@@ -139,24 +145,27 @@ var _a;

return callingAgents.get(id);
}, (id, isDenied) => {
}, (id, isDenied) => onRelease(id, isDenied));
const onRelease = (id, isDenied) => {
var _a, _b, _c;
if (id) {
const cb = this.agents[id].onControlReleased;
delete this.agents[id].onControlReleased;
typeof cb === 'function' && cb();
this.emit('control_rejected', id);
{
if (id) {
const cb = this.agents[id].onControlReleased;
delete this.agents[id].onControlReleased;
typeof cb === 'function' && cb();
this.emit('control_rejected', id);
}
if (annot != null) {
annot.remove();
annot = null;
}
callUI === null || callUI === void 0 ? void 0 : callUI.hideRemoteControl();
if (this.callingState !== CallingState.True) {
callUI === null || callUI === void 0 ? void 0 : callUI.remove();
callUI = null;
}
if (isDenied) {
const info = id ? (_a = this.agents[id]) === null || _a === void 0 ? void 0 : _a.agentInfo : {};
(_c = (_b = this.options).onRemoteControlDeny) === null || _c === void 0 ? void 0 : _c.call(_b, info || {});
}
}
if (annot != null) {
annot.remove();
annot = null;
}
callUI === null || callUI === void 0 ? void 0 : callUI.hideRemoteControl();
if (this.callingState !== CallingState.True) {
callUI === null || callUI === void 0 ? void 0 : callUI.remove();
callUI = null;
}
if (isDenied) {
const info = id ? (_a = this.agents[id]) === null || _a === void 0 ? void 0 : _a.agentInfo : {};
(_c = (_b = this.options).onRemoteControlDeny) === null || _c === void 0 ? void 0 : _c.call(_b, info || {});
}
});
};
const onAcceptRecording = () => {

@@ -171,18 +180,30 @@ socket.emit('recording_accepted');

const recordingState = new ScreenRecordingState(this.options.recordingConfirm);
// TODO: check incoming args
socket.on('request_control', this.remoteControl.requestControl);
socket.on('release_control', this.remoteControl.releaseControl);
socket.on('scroll', this.remoteControl.scroll);
socket.on('click', this.remoteControl.click);
socket.on('move', this.remoteControl.move);
socket.on('focus', (clientID, nodeID) => {
const el = app.nodes.getNode(nodeID);
if (el instanceof HTMLElement && this.remoteControl) {
this.remoteControl.focus(clientID, el);
function processEvent(agentId, event, callback) {
if (app.getTabId() === event.meta.tabId) {
return callback === null || callback === void 0 ? void 0 : callback(agentId, event.data);
}
});
socket.on('input', this.remoteControl.input);
socket.on('moveAnnotation', (_, p) => annot && annot.move(p)); // TODO: restrict by id
socket.on('startAnnotation', (_, p) => annot && annot.start(p));
socket.on('stopAnnotation', () => annot && annot.stop());
}
if (this.remoteControl !== null) {
socket.on('request_control', (agentId, dataObj) => {
var _a;
processEvent(agentId, dataObj, (_a = this.remoteControl) === null || _a === void 0 ? void 0 : _a.requestControl);
});
socket.on('release_control', (agentId, dataObj) => {
processEvent(agentId, dataObj, (_, data) => { var _a; return (_a = this.remoteControl) === null || _a === void 0 ? void 0 : _a.releaseControl(data); });
});
socket.on('scroll', (id, event) => { var _a; return processEvent(id, event, (_a = this.remoteControl) === null || _a === void 0 ? void 0 : _a.scroll); });
socket.on('click', (id, event) => { var _a; return processEvent(id, event, (_a = this.remoteControl) === null || _a === void 0 ? void 0 : _a.click); });
socket.on('move', (id, event) => { var _a; return processEvent(id, event, (_a = this.remoteControl) === null || _a === void 0 ? void 0 : _a.move); });
socket.on('focus', (id, event) => processEvent(id, event, (clientID, nodeID) => {
const el = app.nodes.getNode(nodeID);
if (el instanceof HTMLElement && this.remoteControl) {
this.remoteControl.focus(clientID, el);
}
}));
socket.on('input', (id, event) => { var _a; return processEvent(id, event, (_a = this.remoteControl) === null || _a === void 0 ? void 0 : _a.input); });
}
// TODO: restrict by id
socket.on('moveAnnotation', (id, event) => processEvent(id, event, (_, d) => annot && annot.move(d)));
socket.on('startAnnotation', (id, event) => processEvent(id, event, (_, d) => annot === null || annot === void 0 ? void 0 : annot.start(d)));
socket.on('stopAnnotation', (id, event) => processEvent(id, event, annot === null || annot === void 0 ? void 0 : annot.stop));
socket.on('NEW_AGENT', (id, info) => {

@@ -196,3 +217,6 @@ var _a, _b;

this.app.stop();
this.app.start().then(() => { this.assistDemandedRestart = false; }).catch(e => app.debug.error(e));
setTimeout(() => {
this.app.start().then(() => { this.assistDemandedRestart = false; }).catch(e => app.debug.error(e));
// TODO: check if it's needed; basically allowing some time for the app to finish everything before starting again
}, 500);
});

@@ -211,3 +235,6 @@ socket.on('AGENTS_CONNECTED', (ids) => {

this.app.stop();
this.app.start().then(() => { this.assistDemandedRestart = false; }).catch(e => app.debug.error(e));
setTimeout(() => {
this.app.start().then(() => { this.assistDemandedRestart = false; }).catch(e => app.debug.error(e));
// TODO: check if it's needed; basically allowing some time for the app to finish everything before starting again
}, 500);
(_a = this.remoteControl) === null || _a === void 0 ? void 0 : _a.reconnect(ids);

@@ -229,3 +256,4 @@ });

});
socket.on('call_end', (id) => {
socket.on('call_end', (info) => {
const id = info.data;
if (!callingAgents.has(id)) {

@@ -237,11 +265,20 @@ app.debug.warn('Received call_end from unknown agent', id);

});
socket.on('_agent_name', (id, name) => {
socket.on('_agent_name', (id, info) => {
if (app.getTabId() !== info.meta.tabId)
return;
const name = info.data;
callingAgents.set(id, name);
updateCallerNames();
});
socket.on('videofeed', (_, feedState) => {
socket.on('videofeed', (_, info) => {
if (app.getTabId() !== info.meta.tabId)
return;
const feedState = info.data;
callUI === null || callUI === void 0 ? void 0 : callUI.toggleVideoStream(feedState);
});
socket.on('request_recording', (id, agentData) => {
socket.on('request_recording', (id, info) => {
var _a, _b;
if (app.getTabId() !== info.meta.tabId)
return;
const agentData = info.data;
if (!recordingState.isActive) {

@@ -255,3 +292,5 @@ (_b = (_a = this.options).onRecordingRequest) === null || _b === void 0 ? void 0 : _b.call(_a, JSON.parse(agentData));

});
socket.on('stop_recording', (id) => {
socket.on('stop_recording', (id, info) => {
if (app.getTabId() !== info.meta.tabId)
return;
if (recordingState.isActive) {

@@ -419,2 +458,5 @@ recordingState.stopAgentRecording(id);

call.answer(lStreams[call.peer].stream);
document.addEventListener('visibilitychange', () => {
initiateCallEnd();
});
this.setCallingState(CallingState.True);

@@ -421,0 +463,0 @@ if (!callEndCallback) {

@@ -22,3 +22,3 @@ import type { Options as AssistOptions } from './Assist';

scroll: (id: any, d: any) => void;
move: (id: any, xy: any) => void;
move: (id: any, xy: any) => false | void | undefined;
private focused;

@@ -25,0 +25,0 @@ click: (id: any, xy: any) => void;

@@ -20,2 +20,3 @@ import Mouse from './Mouse.js';

this.onRelease = onRelease;
this.mouse = null;
this.status = RCStatus.Disabled;

@@ -78,2 +79,6 @@ this.agentID = null;

this.mouse.mount();
document.addEventListener('visibilitychange', () => {
if (document.hidden)
this.releaseControl(false);
});
};

@@ -86,3 +91,6 @@ this.resetMouse = () => {

this.scroll = (id, d) => { var _a; id === this.agentID && ((_a = this.mouse) === null || _a === void 0 ? void 0 : _a.scroll(d)); };
this.move = (id, xy) => { var _a; id === this.agentID && ((_a = this.mouse) === null || _a === void 0 ? void 0 : _a.move(xy)); };
this.move = (id, xy) => {
var _a;
return id === this.agentID && ((_a = this.mouse) === null || _a === void 0 ? void 0 : _a.move(xy));
};
this.focused = null;

@@ -103,3 +111,5 @@ this.click = (id, xy) => {

if (this.focused instanceof HTMLTextAreaElement
|| this.focused instanceof HTMLInputElement) {
|| this.focused instanceof HTMLInputElement
|| this.focused.tagName === 'INPUT'
|| this.focused.tagName === 'TEXTAREA') {
setInputValue.call(this.focused, value);

@@ -106,0 +116,0 @@ const ev = new Event('input', { bubbles: true, });

{
"name": "@openreplay/tracker-assist",
"description": "Tracker plugin for screen assistance through the WebRTC",
"version": "5.0.2",
"version": "6.0.0-beta.1",
"keywords": [

@@ -16,2 +16,3 @@ "WebRTC",

"scripts": {
"tsrun": "tsc",
"lint": "eslint src --ext .ts,.js --fix --quiet",

@@ -27,3 +28,6 @@ "build": "npm run build-es && npm run build-cjs",

"prepare": "cd ../../ && husky install tracker/.husky/",
"lint-front": "lint-staged"
"lint-front": "lint-staged",
"test": "jest --coverage=false",
"test:ci": "jest --coverage=true",
"postversion": "npm run build"
},

@@ -36,3 +40,3 @@ "dependencies": {

"peerDependencies": {
"@openreplay/tracker": ">=5.0.0"
"@openreplay/tracker": ">=8.0.0"
},

@@ -47,5 +51,8 @@ "devDependencies": {

"husky": "^8.0.1",
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.3.1",
"lint-staged": "^13.0.3",
"prettier": "^2.7.1",
"replace-in-files-cli": "^1.0.0",
"ts-jest": "^29.0.3",
"typescript": "^4.6.0-dev.20211126"

@@ -52,0 +59,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc