@reactoo/watchtogether-sdk-js 2.6.13 → 2.6.20
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 +733 -411
- package/dist/watchtogether-sdk.min.js +2 -2
- package/example/index.html +60 -27
- package/package.json +1 -3
- package/src/models/iot.js +1 -1
- package/src/models/room-session.js +7 -10
- package/src/models/utils.js +18 -3
- package/src/modules/wt-fingerprint.js +46 -0
- package/src/modules/wt-room.js +530 -333
- package/src/modules/wt-utils.js +48 -45
package/src/modules/wt-utils.js
CHANGED
|
@@ -1,55 +1,58 @@
|
|
|
1
|
-
import FingerprintJs from "@fingerprintjs/fingerprintjs";
|
|
2
|
-
import FingerprintJsPro from "@fingerprintjs/fingerprintjs-pro";
|
|
1
|
+
// import FingerprintJs from "@fingerprintjs/fingerprintjs";
|
|
2
|
+
// import FingerprintJsPro from "@fingerprintjs/fingerprintjs-pro";
|
|
3
|
+
import {getFingerPrint} from "./wt-fingerprint";
|
|
3
4
|
|
|
4
5
|
let wait = function(ms) { return new Promise(resolve => setTimeout(resolve, ms))};
|
|
5
6
|
|
|
6
7
|
|
|
7
|
-
const getFingerPrint = function(instanceType, salt) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const getPreciseFingerPrint = function() {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
}
|
|
8
|
+
// const getFingerPrint = function(instanceType, salt) {
|
|
9
|
+
//
|
|
10
|
+
// let fingerprint = FingerprintJs.load({
|
|
11
|
+
// monitoring: false
|
|
12
|
+
// })
|
|
13
|
+
//
|
|
14
|
+
// return fingerprint
|
|
15
|
+
// .then(fp => fp.get())
|
|
16
|
+
// .then(result => {
|
|
17
|
+
// const components = {
|
|
18
|
+
// ...result.components,
|
|
19
|
+
// instanceType: { value: instanceType + '_' + salt },
|
|
20
|
+
// }
|
|
21
|
+
// return [8,13,18,23].reduce((acc, cur) => {
|
|
22
|
+
// return acc.slice(0,cur) + '-' + acc.slice(cur)
|
|
23
|
+
// }, FingerprintJs.hashComponents(components)).substring(0,36)
|
|
24
|
+
// })
|
|
25
|
+
// }
|
|
26
|
+
//
|
|
27
|
+
// const getPreciseFingerPrint = function() {
|
|
28
|
+
//
|
|
29
|
+
// let fingerprintPro = FingerprintJsPro.load({
|
|
30
|
+
// monitoring: false,
|
|
31
|
+
// apiKey: '5UHdpSuX3wHr3CjyEiSP',
|
|
32
|
+
// endpoint: "https://fingerprint.reactoo.com"
|
|
33
|
+
// })
|
|
34
|
+
//
|
|
35
|
+
// return fingerprintPro
|
|
36
|
+
// .then(fp => fp.get())
|
|
37
|
+
// .then(result => {
|
|
38
|
+
// let id = result.visitorId.padEnd(32, '0');
|
|
39
|
+
// return [8,13,18,23].reduce((acc, cur) => {
|
|
40
|
+
// return acc.slice(0,cur) + '-' + acc.slice(cur)
|
|
41
|
+
// }, id).substring(0,36)
|
|
42
|
+
// })
|
|
43
|
+
// }
|
|
43
44
|
|
|
44
45
|
|
|
45
46
|
let getBrowserFingerprint = function (instanceType = '', usePrecise = false, salt = '') {
|
|
46
|
-
if(!usePrecise) {
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
47
|
+
// if(!usePrecise) {
|
|
48
|
+
// return getFingerPrint(instanceType, salt)
|
|
49
|
+
// }
|
|
50
|
+
// else {
|
|
51
|
+
// return getPreciseFingerPrint()
|
|
52
|
+
// .catch(() => getFingerPrint(instanceType, salt))
|
|
53
|
+
// }
|
|
54
|
+
|
|
55
|
+
return getFingerPrint(instanceType, salt);
|
|
53
56
|
};
|
|
54
57
|
|
|
55
58
|
let generateUUID = function () {
|