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