stream-chat 6.8.0 → 6.9.0

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/index.es.js CHANGED
@@ -810,40 +810,46 @@ var ChannelState = /*#__PURE__*/function () {
810
810
  var _loadMessageIntoState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(messageId, parentMessageId) {
811
811
  var _this$threads$parentM;
812
812
 
813
- var messageSetIndex, switchedToMessageSet, loadedMessageThread, messageIdToFind;
813
+ var limit,
814
+ messageSetIndex,
815
+ switchedToMessageSet,
816
+ loadedMessageThread,
817
+ messageIdToFind,
818
+ _args = arguments;
814
819
  return _regeneratorRuntime.wrap(function _callee$(_context) {
815
820
  while (1) {
816
821
  switch (_context.prev = _context.next) {
817
822
  case 0:
823
+ limit = _args.length > 2 && _args[2] !== undefined ? _args[2] : 25;
818
824
  switchedToMessageSet = false;
819
825
  loadedMessageThread = false;
820
826
  messageIdToFind = parentMessageId || messageId;
821
827
 
822
828
  if (!(messageId === 'latest')) {
823
- _context.next = 9;
829
+ _context.next = 10;
824
830
  break;
825
831
  }
826
832
 
827
833
  if (!(this.messages === this.latestMessages)) {
828
- _context.next = 6;
834
+ _context.next = 7;
829
835
  break;
830
836
  }
831
837
 
832
838
  return _context.abrupt("return");
833
839
 
834
- case 6:
840
+ case 7:
835
841
  messageSetIndex = this.messageSets.findIndex(function (s) {
836
842
  return s.isLatest;
837
843
  });
838
- _context.next = 10;
844
+ _context.next = 11;
839
845
  break;
840
846
 
841
- case 9:
847
+ case 10:
842
848
  messageSetIndex = this.findMessageSetIndex({
843
849
  id: messageIdToFind
844
850
  });
845
851
 
846
- case 10:
852
+ case 11:
847
853
  if (messageSetIndex !== -1) {
848
854
  this.switchToMessageSet(messageSetIndex);
849
855
  switchedToMessageSet = true;
@@ -854,39 +860,39 @@ var ChannelState = /*#__PURE__*/function () {
854
860
  }));
855
861
 
856
862
  if (!(switchedToMessageSet && loadedMessageThread)) {
857
- _context.next = 14;
863
+ _context.next = 15;
858
864
  break;
859
865
  }
860
866
 
861
867
  return _context.abrupt("return");
862
868
 
863
- case 14:
869
+ case 15:
864
870
  if (switchedToMessageSet) {
865
- _context.next = 17;
871
+ _context.next = 18;
866
872
  break;
867
873
  }
868
874
 
869
- _context.next = 17;
875
+ _context.next = 18;
870
876
  return this._channel.query({
871
877
  messages: {
872
878
  id_around: messageIdToFind,
873
- limit: 25
879
+ limit: limit
874
880
  }
875
881
  }, 'new');
876
882
 
877
- case 17:
883
+ case 18:
878
884
  if (!(!loadedMessageThread && parentMessageId)) {
879
- _context.next = 20;
885
+ _context.next = 21;
880
886
  break;
881
887
  }
882
888
 
883
- _context.next = 20;
889
+ _context.next = 21;
884
890
  return this._channel.getReplies(parentMessageId, {
885
891
  id_around: messageId,
886
- limit: 25
892
+ limit: limit
887
893
  });
888
894
 
889
- case 20:
895
+ case 21:
890
896
  messageSetIndex = this.findMessageSetIndex({
891
897
  id: messageIdToFind
892
898
  });
@@ -895,7 +901,7 @@ var ChannelState = /*#__PURE__*/function () {
895
901
  this.switchToMessageSet(messageSetIndex);
896
902
  }
897
903
 
898
- case 22:
904
+ case 23:
899
905
  case "end":
900
906
  return _context.stop();
901
907
  }
@@ -1941,6 +1947,7 @@ var Channel = /*#__PURE__*/function () {
1941
1947
  key: "updatePartial",
1942
1948
  value: function () {
1943
1949
  var _updatePartial = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(update) {
1950
+ var data;
1944
1951
  return _regeneratorRuntime.wrap(function _callee8$(_context8) {
1945
1952
  while (1) {
1946
1953
  switch (_context8.prev = _context8.next) {
@@ -1949,9 +1956,11 @@ var Channel = /*#__PURE__*/function () {
1949
1956
  return this.getClient().patch(this._channelURL(), update);
1950
1957
 
1951
1958
  case 2:
1952
- return _context8.abrupt("return", _context8.sent);
1959
+ data = _context8.sent;
1960
+ this.data = data.channel;
1961
+ return _context8.abrupt("return", data);
1953
1962
 
1954
- case 3:
1963
+ case 5:
1955
1964
  case "end":
1956
1965
  return _context8.stop();
1957
1966
  }
@@ -3193,9 +3202,10 @@ var Channel = /*#__PURE__*/function () {
3193
3202
 
3194
3203
  this._initializeState(state, messageSetToAddToIfDoesNotExist);
3195
3204
 
3205
+ this.data = state.channel;
3196
3206
  return _context31.abrupt("return", state);
3197
3207
 
3198
- case 12:
3208
+ case 13:
3199
3209
  case "end":
3200
3210
  return _context31.stop();
3201
3211
  }
@@ -6957,23 +6967,28 @@ var StreamChat = /*#__PURE__*/function () {
6957
6967
  */
6958
6968
  function () {
6959
6969
  var _updateAppSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(options) {
6960
- var _options$apn_config;
6961
-
6970
+ var apn_config;
6962
6971
  return _regeneratorRuntime.wrap(function _callee7$(_context7) {
6963
6972
  while (1) {
6964
6973
  switch (_context7.prev = _context7.next) {
6965
6974
  case 0:
6966
- if ((_options$apn_config = options.apn_config) !== null && _options$apn_config !== void 0 && _options$apn_config.p12_cert) {
6967
- options.apn_config.p12_cert = Buffer.from(options.apn_config.p12_cert).toString('base64');
6975
+ apn_config = options.apn_config;
6976
+
6977
+ if (apn_config !== null && apn_config !== void 0 && apn_config.p12_cert) {
6978
+ options = _objectSpread(_objectSpread({}, options), {}, {
6979
+ apn_config: _objectSpread(_objectSpread({}, apn_config), {}, {
6980
+ p12_cert: Buffer.from(apn_config.p12_cert).toString('base64')
6981
+ })
6982
+ });
6968
6983
  }
6969
6984
 
6970
- _context7.next = 3;
6985
+ _context7.next = 4;
6971
6986
  return this.patch(this.baseURL + '/app', options);
6972
6987
 
6973
- case 3:
6988
+ case 4:
6974
6989
  return _context7.abrupt("return", _context7.sent);
6975
6990
 
6976
- case 4:
6991
+ case 5:
6977
6992
  case "end":
6978
6993
  return _context7.stop();
6979
6994
  }
@@ -9800,7 +9815,7 @@ var StreamChat = /*#__PURE__*/function () {
9800
9815
  }, {
9801
9816
  key: "getUserAgent",
9802
9817
  value: function getUserAgent() {
9803
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "6.8.0");
9818
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "6.9.0");
9804
9819
  }
9805
9820
  }, {
9806
9821
  key: "setUserAgent",