@reactoo/watchtogether-sdk-js 2.6.6 → 2.6.8

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.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  * @reactoo/watchtogether-sdk-js
3
- * @version 2.6.6
3
+ * @version 2.6.8
4
4
  */
5
5
  (function webpackUniversalModuleDefinition(root, factory) {
6
6
  if(typeof exports === 'object' && typeof module === 'object')
@@ -10102,7 +10102,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var seri
10102
10102
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
10103
10103
 
10104
10104
  "use strict";
10105
- eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _modules_wt_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../modules/wt-utils */ \"./src/modules/wt-utils.js\");\n/* harmony import */ var serialize_error__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! serialize-error */ \"./node_modules/serialize-error/index.js\");\n\n\n\n\nlet user = function () {\n var _this = this;\n return {\n updateUserSelf: function () {\n let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.user.updateMyself({\n ...(data.lastRoomId && {\n lastRoomId: data.lastRoomId\n })\n }, {\n requestBody: {\n ...data\n }\n }));\n },\n updateUser: function () {\n let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.user.updateUser({\n ...data\n }, {\n requestBody: {\n ...data\n }\n }));\n },\n uploadAvatar: (file, lastRoomId) => {\n let id = Object(_modules_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"generateUUID\"])();\n return this.__privates.auth.__client.then(client => Promise.all([client, client.apis.user.initiateMyAvatarUpload({\n id\n })])).then(_ref => {\n let [client, response] = _ref;\n return Promise.all([client, client.http({\n url: response.data.signedUrl,\n method: response.data.httpMethod,\n headers: {\n \"Content-Type\": file.type\n },\n body: file\n })]);\n }).then(_ref2 => {\n let [client, response] = _ref2;\n return client.apis.user.publishMyAvatar({\n id,\n lastRoomId\n });\n });\n },\n uploadReaction: files => {\n let id = Object(_modules_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"generateUUID\"])();\n return this.__privates.auth.__client.then(client => Promise.all([client, client.apis.reaction.initiateReactionUpload({\n id: id,\n segmentCount: files.length || 0\n })])).then(_ref3 => {\n let [client, response] = _ref3;\n return Promise.all([client, ...response.data.signedUrlSegments.map((url, index) => client.http({\n url,\n method: response.data.httpMethod,\n headers: {\n \"Content-Type\": files[index].type\n },\n body: files[index]\n }))]);\n }).then(_ref4 => {\n let [client] = _ref4;\n return client.apis.reaction.processReaction({\n id: id,\n type: 'concat'\n });\n }).then(response => response.data.key);\n },\n uploadVideo: function (roomId, files) {\n let privateAttributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n let id = Object(_modules_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"generateUUID\"])();\n return _this.__privates.auth.__client.then(client => Promise.all([client, client.apis.video.initiateVideoUpload({\n id,\n segmentCount: files.length || 0\n })])).then(_ref5 => {\n let [client, response] = _ref5;\n return Promise.all([client, response.data.signedUrlSegments.reduce((acc, url, index) => acc.then(() => client.http({\n url,\n method: response.data.httpMethod,\n headers: {\n \"Content-Type\": files[index].type\n },\n body: files[index]\n })), Promise.resolve())]);\n }).then(_ref6 => {\n let [client] = _ref6;\n return client.apis.video.publishVideo({\n _id: id,\n roomId\n }, {\n requestBody: {\n _id: id,\n roomId,\n privateAttributes\n }\n });\n });\n },\n getReactionById: id => {\n return this.__privates.auth.__client.then(client => client.apis.reaction.getReactionById({\n id\n }));\n },\n getReactions: function () {\n let {\n userId,\n roomId,\n type,\n size,\n startKey,\n includeUserModels = false\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let apiParams = {\n ...(roomId && {\n roomId\n }),\n ...(userId && {\n userId\n }),\n ...(size && {\n size\n }),\n ...(startKey && {\n startKey\n }),\n includeUserModels,\n type\n };\n return _this.__privates.auth.__client.then(client => client.apis.reaction.getReactions(apiParams));\n },\n getVideoById: id => {\n return this.__privates.auth.__client.then(client => client.apis.video.getVideoById({\n id\n }));\n },\n getVideos: function () {\n let {\n roomId,\n userId,\n type,\n size,\n startKey,\n includeUserModels = false,\n includeRoomQueueStatus\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let apiParams = {\n ...(roomId && {\n roomId\n }),\n ...(userId && {\n userId\n }),\n ...(size && {\n size\n }),\n ...(startKey && {\n startKey\n }),\n ...(includeRoomQueueStatus && {\n includeRoomQueueStatus\n }),\n includeUserModels,\n type\n };\n return _this.__privates.auth.__client.then(client => client.apis.video.getVideos(apiParams));\n },\n getUserSelf: () => {\n return this.__privates.auth.__client.then(client => client.apis.user.getUserMyself());\n },\n getUserById: id => {\n return this.__privates.auth.__client.then(client => client.apis.user.getUserById({\n id\n }));\n },\n getUsersByIds: function () {\n let {\n ids = [],\n size = null,\n startKey = null\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let apiParams = {\n type: 'ids',\n ...(size && {\n size\n }),\n ...(ids && {\n ids: ids.join(',')\n }),\n ...(startKey && {\n startKey\n })\n };\n return _this.__privates.auth.__client.then(client => client.apis.user.getUsers(apiParams));\n },\n getUsers: function () {\n let {\n type,\n userId,\n roomId,\n size = 20,\n startKey = null\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let apiParams = {\n type,\n size,\n ...(roomId && {\n roomId\n }),\n ...(userId && {\n userId\n }),\n ...(startKey && {\n startKey\n })\n };\n return _this.__privates.auth.__client.then(client => client.apis.user.getUsers(apiParams));\n },\n //TODO:deprecated\n track: function () {\n let {\n eventType = 'ERROR',\n message\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.wt.track({}, {\n requestBody: {\n \"eventType\": eventType,\n \"appType\": \"web\",\n \"deviceType\": `desktop${navigator.maxTouchPoints ? '/touch' : ''}`,\n \"os\": navigator.platform,\n \"browser\": navigator.userAgent,\n \"domain\": location.host,\n \"url\": location.href,\n \"message\": Object(serialize_error__WEBPACK_IMPORTED_MODULE_1__[\"serializeError\"])(message)\n }\n }));\n },\n //TODO:deprecated\n getTranslation: function () {\n let {\n namespace = 'wt'\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.system.getTranslation({\n namespace\n }));\n },\n //TODO:deprecated\n getConfig: function () {\n let {\n instanceType = _this.__instanceType,\n domain = location.hostname\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.system.getConfig({\n instanceType,\n domain\n }));\n },\n //TODO:deprecated\n getIntegrationPublic: function (type) {\n let data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return _this.__privates.auth.__client.then(client => client.apis.system.integrationPublic({\n type\n }, {\n requestBody: {\n ...data\n }\n }));\n },\n //TODO:deprecated\n updateConfig: function () {\n let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.wt.updateConfig({\n id: data.instanceType || _this.__instanceType\n }, {\n requestBody: {\n ...data\n }\n }));\n },\n //TODO:deprecated\n admin: function () {\n let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.wt.admin({}, {\n requestBody: {\n instanceType: _this.__instanceType,\n ...data\n }\n }));\n },\n //TODO:deprecated\n analytics: function () {\n let {\n action,\n startKey = null,\n limit = 20\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let apiParams = {\n action,\n limit,\n ...(startKey && {\n startKey\n })\n };\n return _this.__privates.auth.__client.then(client => client.apis.wt.analytics({}, {\n requestBody: {\n instanceType: _this.__instanceType,\n ...apiParams\n }\n }));\n }\n };\n};\n/* harmony default export */ __webpack_exports__[\"default\"] = (user);\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/models/user.js?");
10105
+ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _modules_wt_utils__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../modules/wt-utils */ \"./src/modules/wt-utils.js\");\n/* harmony import */ var serialize_error__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! serialize-error */ \"./node_modules/serialize-error/index.js\");\n\n\n\n\nlet user = function () {\n var _this = this;\n return {\n updateUserSelf: function () {\n let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.user.updateMyself({\n ...(data.lastRoomId && {\n lastRoomId: data.lastRoomId\n })\n }, {\n requestBody: {\n ...data\n }\n }));\n },\n updateUser: function () {\n let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.user.updateUser({\n id: data.id,\n lastRoomId: data.lastRoomId\n }, {\n requestBody: {\n displayname: data.displayname,\n bio: data.bio\n }\n }));\n },\n uploadAvatar: (file, lastRoomId) => {\n let id = Object(_modules_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"generateUUID\"])();\n return this.__privates.auth.__client.then(client => Promise.all([client, client.apis.user.initiateMyAvatarUpload({\n id\n })])).then(_ref => {\n let [client, response] = _ref;\n return Promise.all([client, client.http({\n url: response.data.signedUrl,\n method: response.data.httpMethod,\n headers: {\n \"Content-Type\": file.type\n },\n body: file\n })]);\n }).then(_ref2 => {\n let [client, response] = _ref2;\n return client.apis.user.publishMyAvatar({\n id,\n lastRoomId\n });\n });\n },\n uploadReaction: files => {\n let id = Object(_modules_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"generateUUID\"])();\n return this.__privates.auth.__client.then(client => Promise.all([client, client.apis.reaction.initiateReactionUpload({\n id: id,\n segmentCount: files.length || 0\n })])).then(_ref3 => {\n let [client, response] = _ref3;\n return Promise.all([client, ...response.data.signedUrlSegments.map((url, index) => client.http({\n url,\n method: response.data.httpMethod,\n headers: {\n \"Content-Type\": files[index].type\n },\n body: files[index]\n }))]);\n }).then(_ref4 => {\n let [client] = _ref4;\n return client.apis.reaction.processReaction({\n id: id,\n type: 'concat'\n });\n }).then(response => response.data.key);\n },\n uploadVideo: function (roomId, files) {\n let privateAttributes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n let id = Object(_modules_wt_utils__WEBPACK_IMPORTED_MODULE_0__[\"generateUUID\"])();\n return _this.__privates.auth.__client.then(client => Promise.all([client, client.apis.video.initiateVideoUpload({\n id,\n segmentCount: files.length || 0\n })])).then(_ref5 => {\n let [client, response] = _ref5;\n return Promise.all([client, response.data.signedUrlSegments.reduce((acc, url, index) => acc.then(() => client.http({\n url,\n method: response.data.httpMethod,\n headers: {\n \"Content-Type\": files[index].type\n },\n body: files[index]\n })), Promise.resolve())]);\n }).then(_ref6 => {\n let [client] = _ref6;\n return client.apis.video.publishVideo({\n _id: id,\n roomId\n }, {\n requestBody: {\n _id: id,\n roomId,\n privateAttributes\n }\n });\n });\n },\n getReactionById: id => {\n return this.__privates.auth.__client.then(client => client.apis.reaction.getReactionById({\n id\n }));\n },\n getReactions: function () {\n let {\n userId,\n roomId,\n type,\n size,\n startKey,\n includeUserModels = false\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let apiParams = {\n ...(roomId && {\n roomId\n }),\n ...(userId && {\n userId\n }),\n ...(size && {\n size\n }),\n ...(startKey && {\n startKey\n }),\n includeUserModels,\n type\n };\n return _this.__privates.auth.__client.then(client => client.apis.reaction.getReactions(apiParams));\n },\n getVideoById: id => {\n return this.__privates.auth.__client.then(client => client.apis.video.getVideoById({\n id\n }));\n },\n getVideos: function () {\n let {\n roomId,\n userId,\n type,\n size,\n startKey,\n includeUserModels = false,\n includeRoomQueueStatus\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let apiParams = {\n ...(roomId && {\n roomId\n }),\n ...(userId && {\n userId\n }),\n ...(size && {\n size\n }),\n ...(startKey && {\n startKey\n }),\n ...(includeRoomQueueStatus && {\n includeRoomQueueStatus\n }),\n includeUserModels,\n type\n };\n return _this.__privates.auth.__client.then(client => client.apis.video.getVideos(apiParams));\n },\n getUserSelf: () => {\n return this.__privates.auth.__client.then(client => client.apis.user.getUserMyself());\n },\n getUserById: id => {\n return this.__privates.auth.__client.then(client => client.apis.user.getUserById({\n id\n }));\n },\n getUsersByIds: function () {\n let {\n ids = [],\n size = null,\n startKey = null\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let apiParams = {\n type: 'ids',\n ...(size && {\n size\n }),\n ...(ids && {\n ids: ids.join(',')\n }),\n ...(startKey && {\n startKey\n })\n };\n return _this.__privates.auth.__client.then(client => client.apis.user.getUsers(apiParams));\n },\n getUsers: function () {\n let {\n type,\n userId,\n roomId,\n size = 20,\n startKey = null\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let apiParams = {\n type,\n size,\n ...(roomId && {\n roomId\n }),\n ...(userId && {\n userId\n }),\n ...(startKey && {\n startKey\n })\n };\n return _this.__privates.auth.__client.then(client => client.apis.user.getUsers(apiParams));\n },\n //TODO:deprecated\n track: function () {\n let {\n eventType = 'ERROR',\n message\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.wt.track({}, {\n requestBody: {\n \"eventType\": eventType,\n \"appType\": \"web\",\n \"deviceType\": `desktop${navigator.maxTouchPoints ? '/touch' : ''}`,\n \"os\": navigator.platform,\n \"browser\": navigator.userAgent,\n \"domain\": location.host,\n \"url\": location.href,\n \"message\": Object(serialize_error__WEBPACK_IMPORTED_MODULE_1__[\"serializeError\"])(message)\n }\n }));\n },\n //TODO:deprecated\n getTranslation: function () {\n let {\n namespace = 'wt'\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.system.getTranslation({\n namespace\n }));\n },\n //TODO:deprecated\n getConfig: function () {\n let {\n instanceType = _this.__instanceType,\n domain = location.hostname\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.system.getConfig({\n instanceType,\n domain\n }));\n },\n //TODO:deprecated\n getIntegrationPublic: function (type) {\n let data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n return _this.__privates.auth.__client.then(client => client.apis.system.integrationPublic({\n type\n }, {\n requestBody: {\n ...data\n }\n }));\n },\n //TODO:deprecated\n updateConfig: function () {\n let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.wt.updateConfig({\n id: data.instanceType || _this.__instanceType\n }, {\n requestBody: {\n ...data\n }\n }));\n },\n //TODO:deprecated\n admin: function () {\n let data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return _this.__privates.auth.__client.then(client => client.apis.wt.admin({}, {\n requestBody: {\n instanceType: _this.__instanceType,\n ...data\n }\n }));\n },\n //TODO:deprecated\n analytics: function () {\n let {\n action,\n startKey = null,\n limit = 20\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let apiParams = {\n action,\n limit,\n ...(startKey && {\n startKey\n })\n };\n return _this.__privates.auth.__client.then(client => client.apis.wt.analytics({}, {\n requestBody: {\n instanceType: _this.__instanceType,\n ...apiParams\n }\n }));\n }\n };\n};\n/* harmony default export */ __webpack_exports__[\"default\"] = (user);\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/models/user.js?");
10106
10106
 
10107
10107
  /***/ }),
10108
10108
 
@@ -10114,7 +10114,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _mod
10114
10114
  /***/ (function(module, __webpack_exports__, __webpack_require__) {
10115
10115
 
10116
10116
  "use strict";
10117
- eval("__webpack_require__.r(__webpack_exports__);\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n getUserStream() {\n let {\n hasVideo,\n hasAudio = true,\n isHd,\n aDeviceId,\n vDeviceId,\n lfps,\n autoGainControl = false,\n echoCancellation = true,\n noiseSuppression = true,\n channelCount = 1,\n muteAudio = false,\n muteVideo = false\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let audioOnlyConstraints = {\n audio: {\n ...(aDeviceId && {\n deviceId: {\n exact: aDeviceId\n }\n }),\n autoGainControl,\n echoCancellation,\n noiseSuppression,\n channelCount\n }\n };\n let videoOnlyConstraints = {\n video: {\n ...(vDeviceId && {\n deviceId: {\n exact: vDeviceId\n }\n }),\n facingMode: {\n ideal: \"user\"\n },\n ...(lfps ? {\n frameRate: {\n ideal: 10,\n max: 30\n }\n } : {\n frameRate: {\n ideal: 30,\n max: 30\n }\n }),\n width: {\n ideal: isHd ? 1280 : 320\n },\n height: {\n ideal: isHd ? 720 : 240\n }\n }\n };\n let fullConstraints = {\n ...(hasAudio ? audioOnlyConstraints : {\n audio: false\n }),\n ...(hasVideo ? videoOnlyConstraints : {\n video: false\n })\n };\n return navigator.mediaDevices.getUserMedia(fullConstraints).then(stream => {\n if (muteAudio) {\n stream.getAudioTracks().forEach(track => track.enabled = false);\n }\n if (muteVideo) {\n stream.getVideoTracks().forEach(track => track.enabled = false);\n }\n return stream;\n });\n }\n});\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/models/utils.js?");
10117
+ eval("__webpack_require__.r(__webpack_exports__);\n\n\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n getUserStream() {\n let {\n hasVideo,\n hasAudio = true,\n isHd,\n aDeviceId,\n vDeviceId,\n lfps,\n autoGainControl = false,\n echoCancellation = true,\n noiseSuppression = true,\n channelCount = 1,\n muteAudio = false,\n muteVideo = false,\n stream = null\n } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let audioOnlyConstraints = {\n audio: {\n ...(aDeviceId && {\n deviceId: {\n exact: aDeviceId\n }\n }),\n autoGainControl,\n echoCancellation,\n noiseSuppression,\n channelCount\n }\n };\n let videoOnlyConstraints = {\n video: {\n ...(vDeviceId && {\n deviceId: {\n exact: vDeviceId\n }\n }),\n facingMode: {\n ideal: \"user\"\n },\n ...(lfps ? {\n frameRate: {\n ideal: 10,\n max: 30\n }\n } : {\n frameRate: {\n ideal: 30,\n max: 30\n }\n }),\n width: {\n ideal: isHd ? 1280 : 320\n },\n height: {\n ideal: isHd ? 720 : 240\n }\n }\n };\n let fullConstraints = {\n ...(hasAudio ? audioOnlyConstraints : {\n audio: false\n }),\n ...(hasVideo ? videoOnlyConstraints : {\n video: false\n })\n };\n if (stream) {\n let returnPromises = [];\n const videoTrack = stream.getVideoTracks()[0];\n const audioTrack = stream.getAudioTracks()[0];\n if (videoTrack) {\n returnPromises.push(videoTrack.applyConstraints(videoOnlyConstraints.video));\n }\n if (audioTrack) {\n returnPromises.push(audioTrack.applyConstraints(audioOnlyConstraints.audio));\n }\n return Promise.all(returnPromises).then(() => {\n if (muteAudio) {\n stream.getAudioTracks().forEach(track => track.enabled = false);\n }\n if (muteVideo) {\n stream.getVideoTracks().forEach(track => track.enabled = false);\n }\n return stream;\n });\n }\n return navigator.mediaDevices.getUserMedia(fullConstraints).then(stream => {\n if (muteAudio) {\n stream.getAudioTracks().forEach(track => track.enabled = false);\n }\n if (muteVideo) {\n stream.getVideoTracks().forEach(track => track.enabled = false);\n }\n return stream;\n });\n }\n});\n\n//# sourceURL=webpack://WatchTogetherSDK/./src/models/utils.js?");
10118
10118
 
10119
10119
  /***/ }),
10120
10120