stream-chat 9.18.1 → 9.19.1

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.
@@ -6850,7 +6850,7 @@ var BaseSearchSourceBase = class {
6850
6850
  updatePaginationStateFromQuery(result) {
6851
6851
  const { items, next } = result;
6852
6852
  const stateUpdate = {};
6853
- if (next || next === null) {
6853
+ if (Object.prototype.hasOwnProperty.call(result, "next")) {
6854
6854
  stateUpdate.next = next;
6855
6855
  stateUpdate.hasNext = !!next;
6856
6856
  } else {
@@ -8038,8 +8038,8 @@ var TextComposer = class {
8038
8038
  0,
8039
8039
  typeof maxLengthOnEdit === "number" ? maxLengthOnEdit : textBeforeTrim.length
8040
8040
  );
8041
- const expectedCursorPosition = currentText.slice(0, finalSelection.start).length + text.length;
8042
- const cursorPosition = expectedCursorPosition >= finalText.length ? finalText.length : currentText.slice(0, expectedCursorPosition).length;
8041
+ const expectedCursorPosition = finalSelection.start + text.length;
8042
+ const cursorPosition = Math.min(expectedCursorPosition, finalText.length);
8043
8043
  await this.handleChange({
8044
8044
  text: finalText,
8045
8045
  selection: {
@@ -9200,9 +9200,6 @@ var _MessageComposer = class _MessageComposer extends WithSubscriptions {
9200
9200
  get config() {
9201
9201
  return this.configState.getLatestValue();
9202
9202
  }
9203
- updateConfig(config) {
9204
- this.configState.partialNext(mergeWith(this.config, config));
9205
- }
9206
9203
  get contextType() {
9207
9204
  return _MessageComposer.evaluateContextType(this.compositionContext);
9208
9205
  }
@@ -9261,6 +9258,9 @@ var _MessageComposer = class _MessageComposer extends WithSubscriptions {
9261
9258
  const draftWasChanged = !!this.lastChange.draftUpdate && this.lastChange.draftUpdate < this.lastChange.stateUpdate;
9262
9259
  return editedMessageWasUpdated || draftWasChanged || composingMessageFromScratch;
9263
9260
  }
9261
+ updateConfig(config) {
9262
+ this.configState.partialNext(mergeWith(this.config, config));
9263
+ }
9264
9264
  logStateUpdateTimestamp() {
9265
9265
  this.editingAuditState.partialNext({
9266
9266
  lastChange: { ...this.lastChange, stateUpdate: (/* @__PURE__ */ new Date()).getTime() }
@@ -10438,6 +10438,11 @@ var Channel = class {
10438
10438
  }
10439
10439
  }
10440
10440
  this.getClient()._addChannelConfig(state.channel);
10441
+ if (typeof state.channel.config?.shared_locations !== "undefined") {
10442
+ this.messageComposer.updateConfig({
10443
+ location: { enabled: state.channel.config.shared_locations }
10444
+ });
10445
+ }
10441
10446
  const { messageSet } = this._initializeState(state, messageSetToAddToIfDoesNotExist);
10442
10447
  messageSet.pagination = {
10443
10448
  ...messageSet.pagination,
@@ -10950,13 +10955,21 @@ var Channel = class {
10950
10955
  }
10951
10956
  break;
10952
10957
  case "channel.hidden":
10953
- channel.data = { ...channel.data, hidden: true };
10958
+ channel.data = {
10959
+ ...channel.data,
10960
+ blocked: !!event.channel?.blocked,
10961
+ hidden: true
10962
+ };
10954
10963
  if (event.clear_history) {
10955
10964
  channelState.clearMessages();
10956
10965
  }
10957
10966
  break;
10958
10967
  case "channel.visible":
10959
- channel.data = { ...channel.data, hidden: false };
10968
+ channel.data = {
10969
+ ...channel.data,
10970
+ blocked: !!event.channel?.blocked,
10971
+ hidden: false
10972
+ };
10960
10973
  this.getClient().offlineDb?.handleChannelVisibilityEvent({ event });
10961
10974
  break;
10962
10975
  case "user.banned":
@@ -16212,7 +16225,7 @@ var StreamChat = class _StreamChat {
16212
16225
  if (this.userAgent) {
16213
16226
  return this.userAgent;
16214
16227
  }
16215
- const version = "9.18.1";
16228
+ const version = "9.19.1";
16216
16229
  const clientBundle = "browser-cjs";
16217
16230
  let userAgentString = "";
16218
16231
  if (this.sdkIdentifier) {