@reactoo/watchtogether-sdk-js 2.5.75 → 2.5.77
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 +210 -165
- package/dist/watchtogether-sdk.min.js +2 -2
- package/example/index.html +1 -0
- package/package.json +1 -1
- package/src/models/asset.js +1 -1
- package/src/models/room.js +2 -2
- package/src/models/system.js +37 -0
- package/src/models/user.js +10 -8
- package/src/modules/wt-iot.js +3 -0
- package/src/modules/wt-room.js +7 -2
package/example/index.html
CHANGED
package/package.json
CHANGED
package/src/models/asset.js
CHANGED
|
@@ -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 = {}) => {
|
package/src/models/room.js
CHANGED
|
@@ -23,7 +23,7 @@ let room = function () {
|
|
|
23
23
|
|
|
24
24
|
return {
|
|
25
25
|
|
|
26
|
-
//TODO:
|
|
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:
|
|
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}))
|
package/src/models/system.js
CHANGED
|
@@ -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
|
}
|
package/src/models/user.js
CHANGED
|
@@ -107,8 +107,7 @@ let user = function () {
|
|
|
107
107
|
.then(client => client.apis.user.getUsers(apiParams))
|
|
108
108
|
},
|
|
109
109
|
|
|
110
|
-
//TODO:
|
|
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:
|
|
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:
|
|
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:
|
|
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 = {
|
package/src/modules/wt-iot.js
CHANGED
|
@@ -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];
|
package/src/modules/wt-room.js
CHANGED
|
@@ -785,8 +785,13 @@ class RoomSession {
|
|
|
785
785
|
}, true) : Promise.resolve()))
|
|
786
786
|
.finally(() => {
|
|
787
787
|
try {
|
|
788
|
-
if (handle.webrtcStuff.stream
|
|
789
|
-
|
|
788
|
+
if (handle.webrtcStuff.stream) {
|
|
789
|
+
if(!this.isRestarting) {
|
|
790
|
+
handle.webrtcStuff.stream.getTracks().forEach(track => track.stop());
|
|
791
|
+
}
|
|
792
|
+
else {
|
|
793
|
+
handle.webrtcStuff.stream.getTracks().forEach(track => track.onended = null);
|
|
794
|
+
}
|
|
790
795
|
}
|
|
791
796
|
} catch (e) {
|
|
792
797
|
// Do nothing
|