@reactoo/watchtogether-sdk-js 2.5.46 → 2.5.55
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/dist/watchtogether-sdk.js +22 -10
- package/dist/watchtogether-sdk.min.js +2 -2
- package/example/index.html +1 -1
- package/package.json +2 -1
- package/src/models/auth.js +2 -2
- package/src/modules/wt-room.js +19 -3
- package/src/modules/wt-utils.js +32 -12
package/example/index.html
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactoo/watchtogether-sdk-js",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.55",
|
|
4
4
|
"description": "Javascript SDK for Reactoo",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"unpkg": "dist/watchtogether-sdk.min.js",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@fingerprintjs/fingerprintjs": "^3.3.2",
|
|
46
|
+
"@fingerprintjs/fingerprintjs-pro": "^3.7.0",
|
|
46
47
|
"aws-iot-device-sdk": "^2.2.11",
|
|
47
48
|
"serialize-error": "9.1.0",
|
|
48
49
|
"swagger-client": "^3.18.0",
|
package/src/models/auth.js
CHANGED
|
@@ -33,8 +33,8 @@ let auth = function () {
|
|
|
33
33
|
return this.__privates.providerAuth;
|
|
34
34
|
},
|
|
35
35
|
|
|
36
|
-
deviceLogin: (salt) => {
|
|
37
|
-
return getBrowserFingerprint(this.__instanceType, salt)
|
|
36
|
+
deviceLogin: ( usePrecise = false, salt = 'ThisIsSaltyAF') => {
|
|
37
|
+
return getBrowserFingerprint(this.__instanceType, usePrecise, salt)
|
|
38
38
|
.then( deviceId => Promise.all([deviceId, this.__privates.auth.__client]))
|
|
39
39
|
.then(([deviceId, client]) => client.apis.auth.deviceSignIn({},{requestBody:{deviceId, domain: location.hostname}}))
|
|
40
40
|
.then(response => {
|
package/src/modules/wt-room.js
CHANGED
|
@@ -98,9 +98,9 @@ class RoomSession {
|
|
|
98
98
|
participant: {
|
|
99
99
|
"watchparty": ['participant', 'talkback'],
|
|
100
100
|
"commentary": ['participant', 'talkback'],
|
|
101
|
-
"videowall": ['host', 'talkback', 'observerSolo1', 'observerSolo2', 'observerSolo3'],
|
|
102
|
-
"videowall-queue": ['host', 'talkback', 'observerSolo1', 'observerSolo2', 'observerSolo3'],
|
|
103
|
-
"videowall-queue-video": ['host', 'talkback', 'observerSolo1', 'observerSolo2', 'observerSolo3']
|
|
101
|
+
"videowall": ['host', 'talkback', 'observer', 'observerSolo1', 'observerSolo2', 'observerSolo3'],
|
|
102
|
+
"videowall-queue": ['host', 'talkback', 'observer', 'observerSolo1', 'observerSolo2', 'observerSolo3'],
|
|
103
|
+
"videowall-queue-video": ['host', 'talkback', 'observer', 'observerSolo1', 'observerSolo2', 'observerSolo3']
|
|
104
104
|
},
|
|
105
105
|
monitor: {
|
|
106
106
|
"watchparty": ['participant'],
|
|
@@ -271,6 +271,9 @@ class RoomSession {
|
|
|
271
271
|
case 'monitor':
|
|
272
272
|
return 'addRemoteTalkback';
|
|
273
273
|
case 'observer':
|
|
274
|
+
case 'observerSolo1':
|
|
275
|
+
case 'observerSolo2':
|
|
276
|
+
case 'observerSolo3':
|
|
274
277
|
return 'addRemoteObserver';
|
|
275
278
|
case 'host':
|
|
276
279
|
return 'addRemoteInstructor';
|
|
@@ -304,6 +307,9 @@ class RoomSession {
|
|
|
304
307
|
case 'monitor':
|
|
305
308
|
return 'removeRemoteTalkback';
|
|
306
309
|
case 'observer':
|
|
310
|
+
case 'observerSolo1':
|
|
311
|
+
case 'observerSolo2':
|
|
312
|
+
case 'observerSolo3':
|
|
307
313
|
return 'removeRemoteObserver';
|
|
308
314
|
case 'host':
|
|
309
315
|
return 'removeRemoteInstructor';
|
|
@@ -685,6 +691,7 @@ class RoomSession {
|
|
|
685
691
|
tid: generateUUID(),
|
|
686
692
|
id: handle.handleId,
|
|
687
693
|
userId: decodeJanusDisplay(handle.userId)?.userId,
|
|
694
|
+
role: decodeJanusDisplay(handle.userId)?.role,
|
|
688
695
|
stream: null,
|
|
689
696
|
track: null,
|
|
690
697
|
adding: false,
|
|
@@ -1261,6 +1268,7 @@ class RoomSession {
|
|
|
1261
1268
|
tid: generateUUID(),
|
|
1262
1269
|
id: handle.handleId,
|
|
1263
1270
|
userId: decodeJanusDisplay(handle.userId)?.userId,
|
|
1271
|
+
role: decodeJanusDisplay(handle.userId)?.role,
|
|
1264
1272
|
stream: config.stream,
|
|
1265
1273
|
track: null,
|
|
1266
1274
|
optional: true,
|
|
@@ -1282,6 +1290,7 @@ class RoomSession {
|
|
|
1282
1290
|
tid: generateUUID(),
|
|
1283
1291
|
id: handle.handleId,
|
|
1284
1292
|
userId: decodeJanusDisplay(handle.userId)?.userId,
|
|
1293
|
+
role: decodeJanusDisplay(handle.userId)?.role,
|
|
1285
1294
|
stream: config.stream,
|
|
1286
1295
|
track: null,
|
|
1287
1296
|
optional: true,
|
|
@@ -1335,6 +1344,7 @@ class RoomSession {
|
|
|
1335
1344
|
mid,
|
|
1336
1345
|
id: handle.handleId,
|
|
1337
1346
|
userId: decodeJanusDisplay(handle.userId)?.userId,
|
|
1347
|
+
role: decodeJanusDisplay(handle.userId)?.role,
|
|
1338
1348
|
stream: config.stream,
|
|
1339
1349
|
track: event.track,
|
|
1340
1350
|
constructId: this.constructId,
|
|
@@ -1363,6 +1373,7 @@ class RoomSession {
|
|
|
1363
1373
|
id: handle.handleId,
|
|
1364
1374
|
mid,
|
|
1365
1375
|
userId: decodeJanusDisplay(handle.userId)?.userId,
|
|
1376
|
+
role: decodeJanusDisplay(handle.userId)?.role,
|
|
1366
1377
|
stream: config.stream,
|
|
1367
1378
|
track: ev.target,
|
|
1368
1379
|
constructId: this.constructId,
|
|
@@ -1389,6 +1400,7 @@ class RoomSession {
|
|
|
1389
1400
|
id: handle.handleId,
|
|
1390
1401
|
mid,
|
|
1391
1402
|
userId: decodeJanusDisplay(handle.userId)?.userId,
|
|
1403
|
+
role: decodeJanusDisplay(handle.userId)?.role,
|
|
1392
1404
|
stream: config.stream,
|
|
1393
1405
|
kind: ev.target.kind,
|
|
1394
1406
|
track: ev.target,
|
|
@@ -1410,6 +1422,7 @@ class RoomSession {
|
|
|
1410
1422
|
id: handle.handleId,
|
|
1411
1423
|
mid,
|
|
1412
1424
|
userId: decodeJanusDisplay(handle.userId)?.userId,
|
|
1425
|
+
role: decodeJanusDisplay(handle.userId)?.role,
|
|
1413
1426
|
stream: config.stream,
|
|
1414
1427
|
kind: ev.target.kind,
|
|
1415
1428
|
track: ev.target,
|
|
@@ -2014,6 +2027,7 @@ class RoomSession {
|
|
|
2014
2027
|
tid: generateUUID(),
|
|
2015
2028
|
id: handle.handleId,
|
|
2016
2029
|
userId: decodeJanusDisplay(handle.userId)?.userId,
|
|
2030
|
+
role: decodeJanusDisplay(handle.userId)?.role,
|
|
2017
2031
|
track,
|
|
2018
2032
|
stream: config.stream,
|
|
2019
2033
|
adding: true,
|
|
@@ -2027,6 +2041,7 @@ class RoomSession {
|
|
|
2027
2041
|
tid:generateUUID(),
|
|
2028
2042
|
id: handle.handleId,
|
|
2029
2043
|
userId: decodeJanusDisplay(handle.userId)?.userId,
|
|
2044
|
+
role: decodeJanusDisplay(handle.userId)?.role,
|
|
2030
2045
|
track: ev.target,
|
|
2031
2046
|
stream: config.stream,
|
|
2032
2047
|
adding: false,
|
|
@@ -2044,6 +2059,7 @@ class RoomSession {
|
|
|
2044
2059
|
tid: generateUUID(),
|
|
2045
2060
|
id: handle.handleId,
|
|
2046
2061
|
userId: decodeJanusDisplay(handle.userId)?.userId,
|
|
2062
|
+
role: decodeJanusDisplay(handle.userId)?.role,
|
|
2047
2063
|
stream: null,
|
|
2048
2064
|
adding: false,
|
|
2049
2065
|
constructId: this.constructId,
|
package/src/modules/wt-utils.js
CHANGED
|
@@ -1,21 +1,41 @@
|
|
|
1
1
|
import FingerprintJs from "@fingerprintjs/fingerprintjs";
|
|
2
|
+
import FingerprintJsPro from "@fingerprintjs/fingerprintjs-pro";
|
|
2
3
|
|
|
3
4
|
let wait = function(ms) { return new Promise(resolve => setTimeout(resolve, ms))};
|
|
4
5
|
let fingerprint = FingerprintJs.load({
|
|
5
6
|
monitoring: false
|
|
6
7
|
})
|
|
7
|
-
let
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
8
|
+
let fingerprintPro = FingerprintJsPro.load({
|
|
9
|
+
monitoring: false,
|
|
10
|
+
apiKey: '5UHdpSuX3wHr3CjyEiSP',
|
|
11
|
+
endpoint: "https://fingerprint.reactoo.com"
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
let getBrowserFingerprint = function (instanceType = '', usePrecise = false, salt = '') {
|
|
15
|
+
|
|
16
|
+
if(!usePrecise) {
|
|
17
|
+
return fingerprint
|
|
18
|
+
.then(fp => fp.get())
|
|
19
|
+
.then(result => {
|
|
20
|
+
const components = {
|
|
21
|
+
...result.components,
|
|
22
|
+
instanceType: { value: instanceType + '_' + salt },
|
|
23
|
+
}
|
|
24
|
+
return [8,13,18,23].reduce((acc, cur) => {
|
|
25
|
+
return acc.slice(0,cur) + '-' + acc.slice(cur)
|
|
26
|
+
}, FingerprintJs.hashComponents(components)).substring(0,36)
|
|
27
|
+
})
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
return fingerprintPro
|
|
31
|
+
.then(fp => fp.get())
|
|
32
|
+
.then(result => {
|
|
33
|
+
let id = result.visitorId.padEnd(32, '0');
|
|
34
|
+
return [8,13,18,23].reduce((acc, cur) => {
|
|
35
|
+
return acc.slice(0,cur) + '-' + acc.slice(cur)
|
|
36
|
+
}, id).substring(0,36)
|
|
37
|
+
})
|
|
38
|
+
}
|
|
19
39
|
};
|
|
20
40
|
|
|
21
41
|
let generateUUID = function () {
|