@reactoo/watchtogether-sdk-js 2.5.89 → 2.5.91
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 +52 -41
- package/dist/watchtogether-sdk.min.js +2 -2
- package/package.json +2 -2
- package/src/models/room-session.js +2 -2
- package/src/modules/sync-modules/{sync-universal.js → sync-dazn.js} +2 -2
- package/src/modules/wt-iot.js +1 -1
- package/src/modules/wt-utils.js +42 -28
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.91",
|
|
4
4
|
"description": "Javascript SDK for Reactoo",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"unpkg": "dist/watchtogether-sdk.min.js",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@fingerprintjs/fingerprintjs": "^3.3.2",
|
|
46
|
-
"@fingerprintjs/fingerprintjs-pro": "^3.
|
|
46
|
+
"@fingerprintjs/fingerprintjs-pro": "^3.8.1",
|
|
47
47
|
"aws-iot-device-sdk": "^2.2.11",
|
|
48
48
|
"serialize-error": "9.1.0",
|
|
49
49
|
"swagger-client": "^3.18.0",
|
|
@@ -15,7 +15,7 @@ import syncVodDashJs from "../modules/sync-modules/sync-dash-vod";
|
|
|
15
15
|
import syncDoris from "../modules/sync-modules/sync-doris";
|
|
16
16
|
import syncDisabled from "../modules/sync-modules/sync-disabled";
|
|
17
17
|
import syncDaznDash from "../modules/sync-modules/sync-dazn-dash";
|
|
18
|
-
import
|
|
18
|
+
import syncDazn from "../modules/sync-modules/sync-dazn";
|
|
19
19
|
import syncModule from "../modules/sync-modules/sync-module";
|
|
20
20
|
|
|
21
21
|
let roomSession = function ({roomId, pinHash, role}, room, wt) {
|
|
@@ -205,7 +205,7 @@ let roomSession = function ({roomId, pinHash, role}, room, wt) {
|
|
|
205
205
|
// DAZN interface
|
|
206
206
|
renderPlayer: function (playerWrapper, fullscreenElement, roomId) {
|
|
207
207
|
try {
|
|
208
|
-
this.syncModule =
|
|
208
|
+
this.syncModule = syncDazn({room, wt, roomSession: this, emitter});
|
|
209
209
|
this.playerInterface = wt.__privates.playerFactory(playerWrapper, fullscreenElement, this.syncModule.getHandlers(), {roomId});
|
|
210
210
|
this.syncModule.initialize({playerInterface: this.playerInterface});
|
|
211
211
|
return true;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {setExactTimeout} from "../wt-utils";
|
|
2
2
|
import localEmitter from "../wt-emitter";
|
|
3
3
|
|
|
4
|
-
const
|
|
4
|
+
const syncDazn = function ({room, wt, roomSession, emitter} = {}) {
|
|
5
5
|
|
|
6
6
|
//SYNC VARS
|
|
7
7
|
let _emitter = localEmitter();
|
|
@@ -530,4 +530,4 @@ const syncUniversal = function ({room, wt, roomSession, emitter} = {}) {
|
|
|
530
530
|
|
|
531
531
|
};
|
|
532
532
|
|
|
533
|
-
export default
|
|
533
|
+
export default syncDazn;
|
package/src/modules/wt-iot.js
CHANGED
|
@@ -232,7 +232,7 @@ class Iot {
|
|
|
232
232
|
else if(topic[1] === 'asset') {
|
|
233
233
|
this.emit('message', {event: 'asset', assetId: topic[2], ...payload});
|
|
234
234
|
}
|
|
235
|
-
} else if(topic[0] === 'wtr') {
|
|
235
|
+
} else if(topic[0] === 'wtr' || topic[0] === 'gwtr') {
|
|
236
236
|
const recorderId = topic[1];
|
|
237
237
|
const sessionId = topic[2];
|
|
238
238
|
if(topic[3] === 'control') {
|
package/src/modules/wt-utils.js
CHANGED
|
@@ -2,39 +2,53 @@ import FingerprintJs from "@fingerprintjs/fingerprintjs";
|
|
|
2
2
|
import FingerprintJsPro from "@fingerprintjs/fingerprintjs-pro";
|
|
3
3
|
|
|
4
4
|
let wait = function(ms) { return new Promise(resolve => setTimeout(resolve, ms))};
|
|
5
|
-
let fingerprint = FingerprintJs.load({
|
|
6
|
-
monitoring: false
|
|
7
|
-
})
|
|
8
|
-
let fingerprintPro = FingerprintJsPro.load({
|
|
9
|
-
monitoring: false,
|
|
10
|
-
apiKey: '5UHdpSuX3wHr3CjyEiSP',
|
|
11
|
-
endpoint: "https://fingerprint.reactoo.com"
|
|
12
|
-
})
|
|
13
5
|
|
|
14
|
-
let getBrowserFingerprint = function (instanceType = '', usePrecise = false, salt = '') {
|
|
15
6
|
|
|
7
|
+
const getFingerPrint = function(instanceType, salt) {
|
|
8
|
+
|
|
9
|
+
let fingerprint = FingerprintJs.load({
|
|
10
|
+
monitoring: false
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
return fingerprint
|
|
14
|
+
.then(fp => fp.get())
|
|
15
|
+
.then(result => {
|
|
16
|
+
const components = {
|
|
17
|
+
...result.components,
|
|
18
|
+
instanceType: { value: instanceType + '_' + salt },
|
|
19
|
+
}
|
|
20
|
+
return [8,13,18,23].reduce((acc, cur) => {
|
|
21
|
+
return acc.slice(0,cur) + '-' + acc.slice(cur)
|
|
22
|
+
}, FingerprintJs.hashComponents(components)).substring(0,36)
|
|
23
|
+
})
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const getPreciseFingerPrint = function() {
|
|
27
|
+
|
|
28
|
+
let fingerprintPro = FingerprintJsPro.load({
|
|
29
|
+
monitoring: false,
|
|
30
|
+
apiKey: '5UHdpSuX3wHr3CjyEiSP',
|
|
31
|
+
endpoint: "https://fingerprint.reactoo.com"
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
return fingerprintPro
|
|
35
|
+
.then(fp => fp.get())
|
|
36
|
+
.then(result => {
|
|
37
|
+
let id = result.visitorId.padEnd(32, '0');
|
|
38
|
+
return [8,13,18,23].reduce((acc, cur) => {
|
|
39
|
+
return acc.slice(0,cur) + '-' + acc.slice(cur)
|
|
40
|
+
}, id).substring(0,36)
|
|
41
|
+
})
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
let getBrowserFingerprint = function (instanceType = '', usePrecise = false, salt = '') {
|
|
16
46
|
if(!usePrecise) {
|
|
17
|
-
return
|
|
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
|
-
})
|
|
47
|
+
return getFingerPrint(instanceType, salt)
|
|
28
48
|
}
|
|
29
49
|
else {
|
|
30
|
-
return
|
|
31
|
-
.
|
|
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
|
-
})
|
|
50
|
+
return getPreciseFingerPrint()
|
|
51
|
+
.catch(() => getFingerPrint(instanceType, salt))
|
|
38
52
|
}
|
|
39
53
|
};
|
|
40
54
|
|