change(assist) - added an option config

This commit is contained in:
Shekar Siri 2021-11-18 18:37:54 +05:30
parent 08946b3c62
commit f2994d9faf
2 changed files with 13 additions and 14 deletions

View file

@ -1,6 +1,6 @@
{ {
"name": "@openreplay/tracker-assist", "name": "@openreplay/tracker-assist",
"version": "3.4.3", "version": "3.4.6",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {
@ -30,12 +30,6 @@
"js-tokens": "^4.0.0" "js-tokens": "^4.0.0"
} }
}, },
"@medv/finder": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/@medv/finder/-/finder-2.1.0.tgz",
"integrity": "sha512-Egrg5XO4kLol24b1Kv50HDfi5hW0yQ6aWSsO0Hea1eJ4rogKElIN0M86FdVnGF4XIGYyA7QWx0MgbOzVPA0qkA==",
"dev": true
},
"@nodelib/fs.scandir": { "@nodelib/fs.scandir": {
"version": "2.1.5", "version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
@ -63,12 +57,11 @@
} }
}, },
"@openreplay/tracker": { "@openreplay/tracker": {
"version": "3.4.4", "version": "3.4.7",
"resolved": "https://registry.npmjs.org/@openreplay/tracker/-/tracker-3.4.4.tgz", "resolved": "https://registry.npmjs.org/@openreplay/tracker/-/tracker-3.4.7.tgz",
"integrity": "sha512-IcuxwwTt1RtLZw9QlQVAVNqoybv0ZkD2ZDk2FeHEQ/+BItsMhG61/4/lB2yXKLTLr6ydeKTzwYvxfr1vwxn2dw==", "integrity": "sha512-E9ZwjPwo9WbThV9nAQbK8EKLwJcLBgQG51ND3LB+p21xaz0WcMETIaJDFFmHhhwvkCQ1Vi43gK3cjoOoHF4XFg==",
"dev": true, "dev": true,
"requires": { "requires": {
"@medv/finder": "^2.0.0",
"error-stack-parser": "^2.0.6" "error-stack-parser": "^2.0.6"
} }
}, },

View file

@ -14,6 +14,7 @@ export interface Options {
confirmText: string, confirmText: string,
confirmStyle: Object, // Styles object confirmStyle: Object, // Styles object
session_calling_peer_key: string, session_calling_peer_key: string,
config: Object
} }
enum CallingState { enum CallingState {
@ -37,6 +38,7 @@ export default function(opts: Partial<Options> = {}) {
confirmText: "You have a call. Do you want to answer?", confirmText: "You have a call. Do you want to answer?",
confirmStyle: {}, confirmStyle: {},
session_calling_peer_key: "__openreplay_calling_peer", session_calling_peer_key: "__openreplay_calling_peer",
config: null
}, },
opts, opts,
); );
@ -70,12 +72,16 @@ export default function(opts: Partial<Options> = {}) {
app.attachStartCallback(function() { app.attachStartCallback(function() {
if (assistDemandedRestart) { return; } if (assistDemandedRestart) { return; }
const peerID = `${app.getProjectKey()}-${app.getSessionID()}` const peerID = `${app.getProjectKey()}-${app.getSessionID()}`
peer = new Peer(peerID, { const _opt = {
// @ts-ignore // @ts-ignore
host: app.getHost(), host: app.getHost(),
path: '/assist', path: '/assist',
port: location.protocol === 'http:' && appOptions.__DISABLE_SECURE_MODE ? 80 : 443, port: location.protocol === 'http:' && appOptions.__DISABLE_SECURE_MODE ? 80 : 443,
}); }
if (options.config) {
_opt['config'] = options.config
}
peer = new Peer(peerID, _opt);
log('Peer created: ', peer) log('Peer created: ', peer)
peer.on('error', e => warn("Peer error: ", e.type, e)) peer.on('error', e => warn("Peer error: ", e.type, e))
peer.on('connection', function(conn) { peer.on('connection', function(conn) {