@reactoo/watchtogether-sdk-js 2.5.75 → 2.5.76

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.
@@ -43,6 +43,7 @@
43
43
  // }
44
44
 
45
45
  function hento() {
46
+ //Instance.system.getSettings();
46
47
  Instance.auth.socialAuth({provider: 'youtube', action: 'generateAuthUrl'})
47
48
  .then(r => {
48
49
  window.open(r.data.redirectUrl);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reactoo/watchtogether-sdk-js",
3
- "version": "2.5.75",
3
+ "version": "2.5.76",
4
4
  "description": "Javascript SDK for Reactoo",
5
5
  "main": "src/index.js",
6
6
  "unpkg": "dist/watchtogether-sdk.min.js",
@@ -28,7 +28,7 @@ let asset = function() {
28
28
  return this.__privates.auth.__client
29
29
  .then(client => Promise.all([client, client.apis.asset.initiateAssetUpload({id})]))
30
30
  .then(([client, response]) => Promise.all([client, client.http({url: response.data.signedUrl, method: response.data.httpMethod, headers: {"Content-Type":file.type}, body:file}), response.data.id]))
31
- .then(([client, response, idn]) => client.apis.asset.publishAsset({id:idn}, {requestBody: {title: file.name, ...(roomIds ? {roomIds} : {})}}))
31
+ .then(([client, response, idn]) => Promise.all([client.apis.asset.publishAsset({id:idn}, {requestBody: {title: file.name, ...(roomIds ? {roomIds} : {})}}), idn]))
32
32
  ;
33
33
  },
34
34
  downloadAsset: (url, options = {}) => {
@@ -23,7 +23,7 @@ let room = function () {
23
23
 
24
24
  return {
25
25
 
26
- //TODO: new model
26
+ //TODO:deprecated
27
27
  integration: (data = {}) => {
28
28
  return this.__privates.auth.__client
29
29
  .then(client => client.apis.system.integration({type: this.__instanceType}, {
@@ -37,7 +37,7 @@ let room = function () {
37
37
  }));
38
38
  },
39
39
 
40
- //TODO: new model
40
+ //TODO:deprecated
41
41
  getAnalytics: (data = {}) => {
42
42
  return this.__privates.auth.__client
43
43
  .then(client => client.apis.system.getAnalytics({instanceType: this.__instanceType, ...data}))
@@ -1,5 +1,7 @@
1
1
  'use strict';
2
2
 
3
+ import {serializeError} from "serialize-error";
4
+
3
5
  let system = function () {
4
6
  return {
5
7
  integration: (data = {}) => {
@@ -38,6 +40,41 @@ let system = function () {
38
40
  getIntegrationPublic: (type, data = {}) => {
39
41
  return this.__privates.auth.__client
40
42
  .then(client => client.apis.system.integrationPublic({type}, {requestBody:{...data}}))
43
+ },
44
+ admin: (data = {}) => {
45
+ return this.__privates.auth.__client
46
+ .then(client => client.apis.wt.admin({},{requestBody:{instanceType : this.__instanceType, ...data}}));
47
+ },
48
+ analytics: ({action, startKey = null, limit = 20} = {}) => {
49
+
50
+ let apiParams = {
51
+ action,
52
+ limit,
53
+ ...(startKey && {startKey})
54
+ };
55
+ return this.__privates.auth.__client
56
+ .then(client => client.apis.wt.analytics({},{requestBody:{instanceType : this.__instanceType, ...apiParams}}));
57
+
58
+ },
59
+ track: ({eventType = 'ERROR', message} = {}) => {
60
+ return this.__privates.auth.__client
61
+ .then(client => client.apis.wt.track({},{
62
+ requestBody:{
63
+ "eventType": eventType,
64
+ "appType": "web",
65
+ "deviceType": `desktop${navigator.maxTouchPoints ? '/touch' : ''}`,
66
+ "os": navigator.platform,
67
+ "browser": navigator.userAgent,
68
+ "domain": location.host,
69
+ "url": location.href,
70
+ "message": serializeError(message)
71
+ }
72
+ }));
73
+ },
74
+ getSchemas: () => {
75
+ return this.__privates.auth.__client.then(client => {
76
+ return client.spec?.components?.schemas
77
+ })
41
78
  }
42
79
  }
43
80
  }
@@ -107,8 +107,7 @@ let user = function () {
107
107
  .then(client => client.apis.user.getUsers(apiParams))
108
108
  },
109
109
 
110
- //TODO: should have own model
111
-
110
+ //TODO:deprecated
112
111
  track: ({eventType = 'ERROR', message} = {}) => {
113
112
  return this.__privates.auth.__client
114
113
  .then(client => client.apis.wt.track({},{
@@ -125,34 +124,37 @@ let user = function () {
125
124
  }));
126
125
  },
127
126
 
128
- //TODO: new model
127
+ //TODO:deprecated
129
128
  getTranslation: ({namespace = 'wt'} = {}) => {
130
129
  return this.__privates.auth.__client
131
130
  .then(client => client.apis.system.getTranslation({namespace}))
132
131
  },
133
132
 
134
- //TODO: new model
133
+ //TODO:deprecated
135
134
  getConfig: ({instanceType = this.__instanceType, domain = location.hostname} = {}) => {
136
135
  return this.__privates.auth.__client
137
136
  .then(client => client.apis.system.getConfig({instanceType, domain}));
138
137
  },
139
138
 
140
- //TODO: new model
139
+ //TODO:deprecated
141
140
  getIntegrationPublic: (type, data = {}) => {
142
141
  return this.__privates.auth.__client
143
142
  .then(client => client.apis.system.integrationPublic({type}, {requestBody:{...data}}))
144
143
  },
145
-
144
+
145
+ //TODO:deprecated
146
146
  updateConfig: (data = {}) => {
147
147
  return this.__privates.auth.__client
148
148
  .then(client => client.apis.wt.updateConfig({id: data.instanceType || this.__instanceType},{requestBody:{...data}}));
149
149
  },
150
-
150
+
151
+ //TODO:deprecated
151
152
  admin: (data = {}) => {
152
153
  return this.__privates.auth.__client
153
154
  .then(client => client.apis.wt.admin({},{requestBody:{instanceType : this.__instanceType, ...data}}));
154
155
  },
155
-
156
+
157
+ //TODO:deprecated
156
158
  analytics: ({action, startKey = null, limit = 20} = {}) => {
157
159
 
158
160
  let apiParams = {
@@ -228,6 +228,9 @@ class Iot {
228
228
  const event = payload.event;
229
229
  this.emit('message', {event, ...payload});
230
230
  }
231
+ else if(topic[1] === 'asset') {
232
+ this.emit('message', {event: 'asset', assetId: topic[2], ...payload});
233
+ }
231
234
  } else if(topic[0] === 'wtr') {
232
235
  const recorderId = topic[1];
233
236
  const sessionId = topic[2];