@reactoo/watchtogether-sdk-js 2.7.35 → 2.7.36

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.7.34
3
+ * @version 2.7.35
4
4
  */
5
5
  (function webpackUniversalModuleDefinition(root, factory) {
6
6
  if(typeof exports === 'object' && typeof module === 'object')
@@ -16502,6 +16502,7 @@ let asset = function () {
16502
16502
  uploadAsset: function (file, roomIds) {
16503
16503
  let id = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
16504
16504
  let initiationData = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
16505
+ let assetData = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
16505
16506
  return _this.__privates.auth.__client.then(client => Promise.all([client, initiationData ? Promise.resolve(initiationData) : client.apis.asset.initiateAssetUpload({
16506
16507
  id: id || (0,_modules_wt_utils__WEBPACK_IMPORTED_MODULE_0__.generateUUID)()
16507
16508
  })])).then(_ref2 => {
@@ -16523,7 +16524,8 @@ let asset = function () {
16523
16524
  title: file.name,
16524
16525
  ...(roomIds ? {
16525
16526
  roomIds
16526
- } : {})
16527
+ } : {}),
16528
+ ...(assetData ? assetData : {})
16527
16529
  }
16528
16530
  }), idn]);
16529
16531
  });
@@ -16706,6 +16708,8 @@ let iot = function () {
16706
16708
  var _this = this;
16707
16709
  let __currentTopics = new Set();
16708
16710
  let visibilityChangeHandler = null;
16711
+ let keepAliveIntervalId = null;
16712
+ let shouldBeConnected = false;
16709
16713
  return {
16710
16714
  __promise: null,
16711
16715
  __updateCredentials: () => {
@@ -16728,6 +16732,9 @@ let iot = function () {
16728
16732
  },
16729
16733
  onClosed: () => {
16730
16734
  this.__privates.iot.log('MQTT client closed');
16735
+ if (shouldBeConnected) {
16736
+ this.iot.__updateCredentials();
16737
+ }
16731
16738
  },
16732
16739
  onError: () => {
16733
16740
  this.__privates.iot.log('MQTT client error');
@@ -16756,7 +16763,9 @@ let iot = function () {
16756
16763
  });
16757
16764
  let __currentTopicsCopy = new Set(__currentTopics); // Keep this line
16758
16765
  __currentTopics.clear();
16766
+ shouldBeConnected = true;
16759
16767
  _this.iot.setupVisibilityChangeListener();
16768
+ //this.iot.setupKeepAliveInterval();
16760
16769
  _this.iot.$on('connect', _this.iot.onConnect, _this);
16761
16770
  _this.iot.$on('closed', _this.iot.onClosed, _this);
16762
16771
  _this.iot.$on('error', _this.iot.onError, _this);
@@ -16787,7 +16796,9 @@ let iot = function () {
16787
16796
  __currentTopics.clear();
16788
16797
  }
16789
16798
  return _this.__privates.iot.disconnect().then(() => {
16799
+ shouldBeConnected = false;
16790
16800
  _this.iot.disableVisibilityChangeListener();
16801
+ //this.iot.disableKeepAliveInterval();
16791
16802
  _this.iot.$off('connect', _this.iot.onConnect, _this);
16792
16803
  _this.iot.$off('closed', _this.iot.onClosed, _this);
16793
16804
  _this.iot.$off('error', _this.iot.onError, _this);
@@ -16838,6 +16849,14 @@ let iot = function () {
16838
16849
  return this.iot.__updateCredentials();
16839
16850
  });
16840
16851
  },
16852
+ setupKeepAliveInterval: () => {
16853
+ clearInterval(keepAliveIntervalId);
16854
+ keepAliveIntervalId = setInterval(this.iot.checkConnection, 30000);
16855
+ },
16856
+ disableKeepAliveInterval: () => {
16857
+ clearInterval(keepAliveIntervalId);
16858
+ keepAliveIntervalId = null;
16859
+ },
16841
16860
  setupVisibilityChangeListener: () => {
16842
16861
  if (visibilityChangeHandler) {
16843
16862
  // Listener is already set up
@@ -25361,7 +25380,7 @@ class Iot {
25361
25380
  // room
25362
25381
  if (event === 'message' || event === 'template_updated' || event === 'record_start' || event === 'record_stop' || event === 'record_configured' || event === 'record_livestream_available' || event === 'record_livestream_kick' || event === 'user_update_displayname' || event === 'user_update_avatar' || event === 'user_update_bio' || event === 'user_update_customattributes' || event === 'user_update_privateattributes' || event === 'channel_changed' || event === "instance_homepage_changed" || event === "instance_settings_changed" || event === "externalmix_changed" || event === "video_uploaded" || event === "change_user_devices" || event === "queue" || event === "title_changed" || event === "videowall_changed" || event === 'left' ||
25363
25382
  //user removed room a.k.a. left the room
25364
- event === 'kicked' || event === 'banned' || event === 'unbanned' || event === 'approved' || event === 'muted' || event === 'unmuted' || event === 'messageRemoved' || event === 'messageReported' || event === 'chatClear' || event === 'handRaised' || event === 'handLowered' || event === 'handsCleared' || event === 'volume_set') {
25383
+ event === 'kicked' || event === 'banned' || event === 'unbanned' || event === 'approved' || event === 'muted' || event === 'unmuted' || event === 'messageRemoved' || event === 'messageReported' || event === 'chatClear' || event === 'handRaised' || event === 'handLowered' || event === 'handsCleared' || event === 'volume_set' || event === 'asset_created') {
25365
25384
  this.emit('message', {
25366
25385
  event,
25367
25386
  ...message,