@reactoo/watchtogether-sdk-js 2.4.33 → 2.4.40
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 +5 -5
- package/dist/watchtogether-sdk.min.js +2 -2
- package/example/index.html +2 -33
- package/package.json +2 -2
- package/src/index.js +2 -2
- package/src/models/room-session.js +0 -4
- package/src/models/room.js +12 -2
- package/src/modules/wt-auth.js +2 -2
package/example/index.html
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
|
|
26
26
|
<script>
|
|
27
27
|
|
|
28
|
-
let roomId = '
|
|
28
|
+
let roomId = 'fc2d34f2-de58-42a0-9312-5cd40f2d754e'; //It will create room automatically if not set
|
|
29
29
|
let pinHash = undefined;//'967ca05f-7fab-a205-5913-39393bbbe923';
|
|
30
30
|
|
|
31
31
|
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
console.log('Iot message:', r);
|
|
124
124
|
});
|
|
125
125
|
|
|
126
|
-
Instance.auth.
|
|
126
|
+
Instance.auth.deviceLogin() // login as browser
|
|
127
127
|
.then(r => Instance.iot.iotLogin()) // login to mqtt
|
|
128
128
|
.then(r => {
|
|
129
129
|
|
|
@@ -153,37 +153,6 @@
|
|
|
153
153
|
})
|
|
154
154
|
.then(r => Instance.room.createSession({roomId:r.roomId, pinHash: r.pinHash})) // pin hash is not needed if you're owner of the room
|
|
155
155
|
.then(session => {
|
|
156
|
-
Instance.user.getUserSelf().then(r => {
|
|
157
|
-
Instance.user.getIntegrationPublic('sportBuff',{
|
|
158
|
-
"operation": "auth",
|
|
159
|
-
uuid: r.data._id,
|
|
160
|
-
username: r.data.displayname
|
|
161
|
-
})
|
|
162
|
-
.then(r => console.log('wooo',r))
|
|
163
|
-
|
|
164
|
-
})
|
|
165
|
-
|
|
166
|
-
;
|
|
167
|
-
|
|
168
|
-
Instance.user.getVideos({type:'room', roomId, includeUserModels: true});
|
|
169
|
-
|
|
170
|
-
// Instance.user.getUserSelf().then(r => {
|
|
171
|
-
// console.log(r.data._id);
|
|
172
|
-
// return Instance.room.queue({roomId, operation:'join', userId:r.data._id});
|
|
173
|
-
// }).then(r => {
|
|
174
|
-
// console.log(r.data);
|
|
175
|
-
// return Instance.room.queue({roomId, operation:'status'});
|
|
176
|
-
// })
|
|
177
|
-
// .then(r => {
|
|
178
|
-
// console.log(r.data);
|
|
179
|
-
// return Instance.room.queue({roomId,userId:'eu-west-1:f3532bdd-cc3a-4c62-a77e-4f1f544d8fa9', operation:'approve'});
|
|
180
|
-
// })
|
|
181
|
-
// .then(r => {
|
|
182
|
-
// console.log(r.data);
|
|
183
|
-
// })
|
|
184
|
-
|
|
185
|
-
//
|
|
186
|
-
|
|
187
156
|
|
|
188
157
|
|
|
189
158
|
sessionHandler = session;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reactoo/watchtogether-sdk-js",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.40",
|
|
4
4
|
"description": "Javascript SDK for Reactoo",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"unpkg": "dist/watchtogether-sdk.min.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@babel/plugin-proposal-class-properties": "^7.16.0",
|
|
30
30
|
"@babel/plugin-proposal-optional-chaining": "^7.16.0",
|
|
31
31
|
"@babel/plugin-proposal-private-property-in-object": "^7.16.0",
|
|
32
|
-
"@babel/preset-env": "^7.16.
|
|
32
|
+
"@babel/preset-env": "^7.16.4",
|
|
33
33
|
"acorn": "^6.4.2",
|
|
34
34
|
"babel-core": "^6.26.3",
|
|
35
35
|
"babel-loader": "^8.2.3",
|
package/src/index.js
CHANGED
|
@@ -39,9 +39,9 @@ function WatchTogether(modules = {}, instanceType, debug, playerFactory, provide
|
|
|
39
39
|
this.utils = utils;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
let watchTogether = function ({debug = true, isProduction = true, language = 'en-GB', storagePrefix = ""} = {}) {
|
|
42
|
+
let watchTogether = function ({debug = true, isProduction = true, language = 'en-GB', storagePrefix = "", apiUrl = null} = {}) {
|
|
43
43
|
let room = new Room(debug);
|
|
44
|
-
let auth = new Auth(debug, isProduction, language, storagePrefix);
|
|
44
|
+
let auth = new Auth(debug, isProduction, language, storagePrefix, apiUrl);
|
|
45
45
|
// let iot = new Iot(debug);
|
|
46
46
|
let iot = new Iot2(debug);
|
|
47
47
|
|
|
@@ -29,11 +29,7 @@ let roomSession = function ({roomId, pinHash, isTalkback, isMonitor, isInstructo
|
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
const emitter = _emitter_();
|
|
32
|
-
|
|
33
32
|
let alpTimeoutId = null;
|
|
34
|
-
let publishRetry = 0;
|
|
35
|
-
const maxPublishRetry = 3;
|
|
36
|
-
|
|
37
33
|
let ___; // return object
|
|
38
34
|
|
|
39
35
|
room.on('addLocalParticipant', () => {
|
package/src/models/room.js
CHANGED
|
@@ -159,6 +159,16 @@ let room = function () {
|
|
|
159
159
|
}))
|
|
160
160
|
},
|
|
161
161
|
|
|
162
|
+
getRoomChatList: ({roomId, type = "normal", size = 50, startKey = null} = {}) => {
|
|
163
|
+
let apiParams = {
|
|
164
|
+
roomId, type,
|
|
165
|
+
size,
|
|
166
|
+
...(startKey && {startKey})
|
|
167
|
+
};
|
|
168
|
+
return this.__privates.auth.__client
|
|
169
|
+
.then(client => client.apis.wt.getRoomChatList(apiParams))
|
|
170
|
+
},
|
|
171
|
+
|
|
162
172
|
getRoomsList: ({
|
|
163
173
|
type = 'participant',
|
|
164
174
|
activeOnly = null,
|
|
@@ -186,10 +196,10 @@ let room = function () {
|
|
|
186
196
|
|
|
187
197
|
},
|
|
188
198
|
|
|
189
|
-
setUser: ({userId, roomId, flag, timestamp, option}) => {
|
|
199
|
+
setUser: ({messageId, userId, roomId, flag, timestamp, option}) => {
|
|
190
200
|
//leave, kick, ban, unban, approve, report
|
|
191
201
|
return this.__privates.auth.__client
|
|
192
|
-
.then(client => client.apis.wt.setUser({userId, roomId, flag, timestamp, option}));
|
|
202
|
+
.then(client => client.apis.wt.setUser({messageId, userId, roomId, flag, timestamp, option}));
|
|
193
203
|
},
|
|
194
204
|
|
|
195
205
|
getRoomById: (id, pinHash = undefined, showPublic = undefined, demo = false) => {
|
package/src/modules/wt-auth.js
CHANGED
|
@@ -4,7 +4,7 @@ import emitter from './wt-emitter';
|
|
|
4
4
|
|
|
5
5
|
class Auth {
|
|
6
6
|
|
|
7
|
-
constructor(enableDebugFlag, isProduction = true, language = 'en-GB', storagePrefix = "") {
|
|
7
|
+
constructor(enableDebugFlag, isProduction = true, language = 'en-GB', storagePrefix = "", apiUrl = null) {
|
|
8
8
|
|
|
9
9
|
this.ID_TOKEN = `${storagePrefix !== "" ? storagePrefix+'_':''}rwt_idToken`;
|
|
10
10
|
this.ACCESS_TOKEN = `${storagePrefix !== "" ? storagePrefix+'_':''}rwt_accessToken`;
|
|
@@ -22,7 +22,7 @@ class Auth {
|
|
|
22
22
|
this.__isRefreshing = false;
|
|
23
23
|
this.__isLogged = null;
|
|
24
24
|
this.__parsedJwt = null;
|
|
25
|
-
this.__specUrl = isProduction === true ? config.apiUrl : config.devApiUrl;
|
|
25
|
+
this.__specUrl = apiUrl ? apiUrl : (isProduction === true ? config.apiUrl : config.devApiUrl);
|
|
26
26
|
this.__client = this.initialize(true);
|
|
27
27
|
}
|
|
28
28
|
|