@reactoo/watchtogether-sdk-js 2.5.51 → 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.
@@ -119,7 +119,7 @@
119
119
  console.log('Iot message:', r);
120
120
  });
121
121
 
122
- Instance.auth.deviceLogin() // login as browser
122
+ Instance.auth.deviceLogin(true) // login as browser
123
123
  .then(r => Instance.iot.iotLogin()) // login to mqtt
124
124
  .then(r => {
125
125
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactoo/watchtogether-sdk-js",
3
- "version": "2.5.51",
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",
@@ -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 => {
@@ -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 getBrowserFingerprint = function (instanceType = '', salt = '') {
8
- return fingerprint
9
- .then(fp => fp.get())
10
- .then(result => {
11
- const components = {
12
- ...result.components,
13
- instanceType: { value: instanceType + '_' + salt },
14
- }
15
- return [8,13,18,23].reduce((acc, cur) => {
16
- return acc.slice(0,cur) + '-' + acc.slice(cur)
17
- }, FingerprintJs.hashComponents(components)).substring(0,36)
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 () {