stream-chat 9.5.0 → 9.5.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.
package/dist/esm/index.js CHANGED
@@ -6411,15 +6411,14 @@ var pollStateChangeValidators = {
6411
6411
  return { max_votes_allowed: "Type a number from 2 to 10" };
6412
6412
  return { max_votes_allowed: void 0 };
6413
6413
  },
6414
- options: ({ value }) => {
6414
+ options: ({ value: options }) => {
6415
6415
  const errors = {};
6416
6416
  const seenOptions = /* @__PURE__ */ new Set();
6417
- value.forEach((option) => {
6418
- const trimmedText = option.text.trim();
6419
- if (seenOptions.has(trimmedText)) {
6417
+ options.forEach((option) => {
6418
+ if (seenOptions.has(option.text) && option.text.length) {
6420
6419
  errors[option.id] = "Option already exists";
6421
6420
  } else {
6422
- seenOptions.add(trimmedText);
6421
+ seenOptions.add(option.text);
6423
6422
  }
6424
6423
  });
6425
6424
  return Object.keys(errors).length > 0 ? { options: errors } : { options: void 0 };
@@ -6772,13 +6771,13 @@ var PollComposer = class {
6772
6771
  }
6773
6772
  get canCreatePoll() {
6774
6773
  const { data, errors } = this.state.getLatestValue();
6775
- const hasAtLeastOneOption = data.options.filter((o) => !!o.text).length > 0;
6774
+ const hasAtLeastOneNonEmptyOption = data.options.filter((o) => !!o.text.trim()).length > 0;
6776
6775
  const hasName = !!data.name;
6777
6776
  const maxVotesAllowedNumber = parseInt(
6778
6777
  data.max_votes_allowed?.match(VALID_MAX_VOTES_VALUE_REGEX)?.[0] || ""
6779
6778
  );
6780
6779
  const validMaxVotesAllowed = data.max_votes_allowed === "" || !!maxVotesAllowedNumber && (2 <= maxVotesAllowedNumber || maxVotesAllowedNumber <= 10);
6781
- return hasAtLeastOneOption && hasName && validMaxVotesAllowed && Object.values(errors).filter((errorText) => !!errorText).length === 0;
6780
+ return hasAtLeastOneNonEmptyOption && hasName && validMaxVotesAllowed && Object.values(errors).filter((errorText) => !!errorText).length === 0;
6782
6781
  }
6783
6782
  };
6784
6783
 
@@ -15712,7 +15711,7 @@ var StreamChat = class _StreamChat {
15712
15711
  data
15713
15712
  );
15714
15713
  }
15715
- DBDeleteChannelType(channelType) {
15714
+ deleteChannelType(channelType) {
15716
15715
  return this.delete(
15717
15716
  this.baseURL + `/channeltypes/${encodeURIComponent(channelType)}`
15718
15717
  );
@@ -16055,7 +16054,7 @@ var StreamChat = class _StreamChat {
16055
16054
  if (this.userAgent) {
16056
16055
  return this.userAgent;
16057
16056
  }
16058
- const version = "9.5.0";
16057
+ const version = "9.5.1";
16059
16058
  const clientBundle = "browser-esm";
16060
16059
  let userAgentString = "";
16061
16060
  if (this.sdkIdentifier) {