stream-chat 8.24.0 → 8.25.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/src/channel.ts CHANGED
@@ -914,6 +914,7 @@ export class Channel<StreamChatGenerics extends ExtendableGenerics = DefaultGene
914
914
  if (Array.isArray(this.data?.own_capabilities) && !this.data?.own_capabilities.includes('read-events'))
915
915
  return false;
916
916
 
917
+ // FIXME: see #1265, adjust and count new messages even when the channel is muted
917
918
  if (this.muteStatus().muted) return false;
918
919
 
919
920
  return true;
package/src/client.ts CHANGED
@@ -1261,19 +1261,6 @@ export class StreamChat<StreamChatGenerics extends ExtendableGenerics = DefaultG
1261
1261
  }
1262
1262
 
1263
1263
  if (event.type === 'notification.channel_mutes_updated' && event.me?.channel_mutes) {
1264
- const currentMutedChannelIds: string[] = [];
1265
- const nextMutedChannelIds: string[] = [];
1266
-
1267
- this.mutedChannels.forEach((mute) => mute.channel && currentMutedChannelIds.push(mute.channel.cid));
1268
- event.me.channel_mutes.forEach((mute) => mute.channel && nextMutedChannelIds.push(mute.channel.cid));
1269
-
1270
- /** Set the unread count of un-muted channels to 0, which is the behaviour of backend */
1271
- currentMutedChannelIds.forEach((cid) => {
1272
- if (!nextMutedChannelIds.includes(cid) && this.activeChannels[cid]) {
1273
- this.activeChannels[cid].state.unreadCount = 0;
1274
- }
1275
- });
1276
-
1277
1264
  this.mutedChannels = event.me.channel_mutes;
1278
1265
  }
1279
1266
 
@@ -2972,11 +2959,11 @@ export class StreamChat<StreamChatGenerics extends ExtendableGenerics = DefaultG
2972
2959
  }
2973
2960
 
2974
2961
  campaign(idOrData: string | CampaignData, data?: CampaignData) {
2975
- if (typeof idOrData === 'string') {
2976
- return new Campaign(this, idOrData, data);
2962
+ if (idOrData && typeof idOrData === 'object') {
2963
+ return new Campaign(this, null, idOrData);
2977
2964
  }
2978
2965
 
2979
- return new Campaign(this, null, idOrData);
2966
+ return new Campaign(this, idOrData, data);
2980
2967
  }
2981
2968
 
2982
2969
  segment(type: SegmentType, idOrData: string | SegmentData, data?: SegmentData) {
@@ -3120,6 +3107,7 @@ export class StreamChat<StreamChatGenerics extends ExtendableGenerics = DefaultG
3120
3107
  {
3121
3108
  segments: SegmentResponse[];
3122
3109
  next?: string;
3110
+ prev?: string;
3123
3111
  } & APIResponse
3124
3112
  >(this.baseURL + `/segments/query`, {
3125
3113
  filter,
@@ -3189,6 +3177,7 @@ export class StreamChat<StreamChatGenerics extends ExtendableGenerics = DefaultG
3189
3177
  {
3190
3178
  campaigns: CampaignResponse[];
3191
3179
  next?: string;
3180
+ prev?: string;
3192
3181
  } & APIResponse
3193
3182
  >(this.baseURL + `/campaigns/query`, {
3194
3183
  filter,
@@ -3231,8 +3220,7 @@ export class StreamChat<StreamChatGenerics extends ExtendableGenerics = DefaultG
3231
3220
  */
3232
3221
  async stopCampaign(id: string) {
3233
3222
  this.validateServerSideAuth();
3234
- const { campaign } = await this.patch<{ campaign: CampaignResponse }>(this.baseURL + `/campaigns/${id}/stop`);
3235
- return campaign;
3223
+ return this.post<{ campaign: CampaignResponse }>(this.baseURL + `/campaigns/${id}/stop`);
3236
3224
  }
3237
3225
 
3238
3226
  /**
package/src/types.ts CHANGED
@@ -616,6 +616,7 @@ export type MessageResponseBase<
616
616
  > = MessageBase<StreamChatGenerics> & {
617
617
  type: MessageLabel;
618
618
  args?: string;
619
+ before_message_send_failed?: boolean;
619
620
  channel?: ChannelResponse<StreamChatGenerics>;
620
621
  cid?: string;
621
622
  command?: string;
@@ -2134,6 +2135,7 @@ export type FileUploadConfig = {
2134
2135
  allowed_mime_types?: string[] | null;
2135
2136
  blocked_file_extensions?: string[] | null;
2136
2137
  blocked_mime_types?: string[] | null;
2138
+ size_limit?: number | null;
2137
2139
  };
2138
2140
 
2139
2141
  export type FirebaseConfig = {
@@ -2601,8 +2603,12 @@ export type CampaignStats = {
2601
2603
  export type CampaignResponse = {
2602
2604
  created_at: string;
2603
2605
  id: string;
2606
+ segments: SegmentResponse[];
2607
+ sender: UserResponse;
2604
2608
  stats: CampaignStats;
2609
+ status: 'draft' | 'scheduled' | 'in_progress' | 'completed' | 'stopped';
2605
2610
  updated_at: string;
2611
+ users: UserResponse[];
2606
2612
  scheduled_for?: string;
2607
2613
  } & CampaignData;
2608
2614