mezon-js 2.7.38 → 2.7.40

Sign up to get free protection for your applications and to get access to all the features.
package/api.gen.ts CHANGED
@@ -552,6 +552,8 @@ export interface ApiEventManagement {
552
552
  title?: string;
553
553
  //
554
554
  user_ids?: Array<string>;
555
+ //
556
+ create_time?: string;
555
557
  }
556
558
 
557
559
  /** */
package/dist/api.gen.d.ts CHANGED
@@ -315,6 +315,7 @@ export interface ApiEventManagement {
315
315
  start_time?: string;
316
316
  title?: string;
317
317
  user_ids?: Array<string>;
318
+ create_time?: string;
318
319
  }
319
320
  /** */
320
321
  export interface ApiFilterParam {
@@ -4154,6 +4154,10 @@ var _DefaultSocket = class _DefaultSocket {
4154
4154
  n.content = n.content ? JSON.parse(n.content) : void 0;
4155
4155
  this.onnotification(n);
4156
4156
  });
4157
+ } else if (message.voice_started_event) {
4158
+ this.onvoicestarted(message.voice_started_event);
4159
+ } else if (message.voice_ended_event) {
4160
+ this.onvoiceended(message.voice_ended_event);
4157
4161
  } else if (message.voice_joined_event) {
4158
4162
  this.onvoicejoined(message.voice_joined_event);
4159
4163
  } else if (message.voice_leaved_event) {
@@ -4251,7 +4255,7 @@ var _DefaultSocket = class _DefaultSocket {
4251
4255
  };
4252
4256
  this.adapter.onError = (evt) => {
4253
4257
  reject(evt);
4254
- this.onerror(evt);
4258
+ this.adapter.close();
4255
4259
  };
4256
4260
  setTimeout(() => {
4257
4261
  reject("The socket timed out when trying to connect.");
@@ -4347,6 +4351,16 @@ var _DefaultSocket = class _DefaultSocket {
4347
4351
  console.log(statusPresence);
4348
4352
  }
4349
4353
  }
4354
+ onvoiceended(voice) {
4355
+ if (this.verbose && window && window.console) {
4356
+ console.log(voice);
4357
+ }
4358
+ }
4359
+ onvoicestarted(voice) {
4360
+ if (this.verbose && window && window.console) {
4361
+ console.log(voice);
4362
+ }
4363
+ }
4350
4364
  onvoicejoined(voiceParticipant) {
4351
4365
  if (this.verbose && window && window.console) {
4352
4366
  console.log(voiceParticipant);
@@ -4537,9 +4551,9 @@ var _DefaultSocket = class _DefaultSocket {
4537
4551
  updateStatus(status) {
4538
4552
  return this.send({ status_update: { status } });
4539
4553
  }
4540
- writeChatMessage(clan_id, channel_id, channel_label, mode, content, mentions, attachments, references, anonymous_message, mention_everyone) {
4554
+ writeChatMessage(clan_id, channel_id, channel_label, mode, content, mentions, attachments, references, anonymous_message, mention_everyone, notifi_content) {
4541
4555
  return __async(this, null, function* () {
4542
- const response = yield this.send({ channel_message_send: { clan_id, channel_id, channel_label, mode, content, mentions, attachments, references, anonymous_message, mention_everyone } });
4556
+ const response = yield this.send({ channel_message_send: { clan_id, channel_id, channel_label, mode, content, mentions, attachments, references, anonymous_message, mention_everyone, notifi_content } });
4543
4557
  return response.channel_message_ack;
4544
4558
  });
4545
4559
  }
@@ -4125,6 +4125,10 @@ var _DefaultSocket = class _DefaultSocket {
4125
4125
  n.content = n.content ? JSON.parse(n.content) : void 0;
4126
4126
  this.onnotification(n);
4127
4127
  });
4128
+ } else if (message.voice_started_event) {
4129
+ this.onvoicestarted(message.voice_started_event);
4130
+ } else if (message.voice_ended_event) {
4131
+ this.onvoiceended(message.voice_ended_event);
4128
4132
  } else if (message.voice_joined_event) {
4129
4133
  this.onvoicejoined(message.voice_joined_event);
4130
4134
  } else if (message.voice_leaved_event) {
@@ -4222,7 +4226,7 @@ var _DefaultSocket = class _DefaultSocket {
4222
4226
  };
4223
4227
  this.adapter.onError = (evt) => {
4224
4228
  reject(evt);
4225
- this.onerror(evt);
4229
+ this.adapter.close();
4226
4230
  };
4227
4231
  setTimeout(() => {
4228
4232
  reject("The socket timed out when trying to connect.");
@@ -4318,6 +4322,16 @@ var _DefaultSocket = class _DefaultSocket {
4318
4322
  console.log(statusPresence);
4319
4323
  }
4320
4324
  }
4325
+ onvoiceended(voice) {
4326
+ if (this.verbose && window && window.console) {
4327
+ console.log(voice);
4328
+ }
4329
+ }
4330
+ onvoicestarted(voice) {
4331
+ if (this.verbose && window && window.console) {
4332
+ console.log(voice);
4333
+ }
4334
+ }
4321
4335
  onvoicejoined(voiceParticipant) {
4322
4336
  if (this.verbose && window && window.console) {
4323
4337
  console.log(voiceParticipant);
@@ -4508,9 +4522,9 @@ var _DefaultSocket = class _DefaultSocket {
4508
4522
  updateStatus(status) {
4509
4523
  return this.send({ status_update: { status } });
4510
4524
  }
4511
- writeChatMessage(clan_id, channel_id, channel_label, mode, content, mentions, attachments, references, anonymous_message, mention_everyone) {
4525
+ writeChatMessage(clan_id, channel_id, channel_label, mode, content, mentions, attachments, references, anonymous_message, mention_everyone, notifi_content) {
4512
4526
  return __async(this, null, function* () {
4513
- const response = yield this.send({ channel_message_send: { clan_id, channel_id, channel_label, mode, content, mentions, attachments, references, anonymous_message, mention_everyone } });
4527
+ const response = yield this.send({ channel_message_send: { clan_id, channel_id, channel_label, mode, content, mentions, attachments, references, anonymous_message, mention_everyone, notifi_content } });
4514
4528
  return response.channel_message_ack;
4515
4529
  });
4516
4530
  }
package/dist/socket.d.ts CHANGED
@@ -199,6 +199,7 @@ interface ChannelMessageSend {
199
199
  attachments?: Array<MessageAttachmentEvent>;
200
200
  anonymous_message?: boolean;
201
201
  mention_everyone?: boolean;
202
+ notifi_content: any;
202
203
  };
203
204
  }
204
205
  /** Update a message previously sent to a realtime chat channel. */
@@ -238,6 +239,16 @@ export interface ChannelPresenceEvent {
238
239
  /** Presences of users who left the channel. */
239
240
  leaves: Presence[];
240
241
  }
242
+ export interface VoiceEndedEvent {
243
+ id: string;
244
+ clan_id: string;
245
+ voice_channel_id: string;
246
+ }
247
+ export interface VoiceStartedEvent {
248
+ id: string;
249
+ clan_id: string;
250
+ voice_channel_id: string;
251
+ }
241
252
  export interface VoiceLeavedEvent {
242
253
  id: string;
243
254
  clan_id: string;
@@ -552,7 +563,7 @@ export interface Socket {
552
563
  /** Update the status for the current user online. */
553
564
  updateStatus(status?: string): Promise<void>;
554
565
  /** Send a chat message to a chat channel on the server. */
555
- writeChatMessage(clan_id: string, channel_id: string, channel_label: string, mode: number, content?: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?: boolean): Promise<ChannelMessageAck>;
566
+ writeChatMessage(clan_id: string, channel_id: string, channel_label: string, mode: number, content?: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?: boolean, notifi_content?: any): Promise<ChannelMessageAck>;
556
567
  /** Send message typing */
557
568
  writeMessageTyping(channel_id: string, channel_label: string, mode: number): Promise<MessageTypingEvent>;
558
569
  /** Send message reaction */
@@ -602,6 +613,8 @@ export interface Socket {
602
613
  onmessagereaction: (messageReactionEvent: MessageReactionEvent) => void;
603
614
  /** Receive channel presence updates. */
604
615
  onchannelpresence: (channelPresence: ChannelPresenceEvent) => void;
616
+ onvoicestarted: (voice: VoiceStartedEvent) => void;
617
+ onvoiceended: (voice: VoiceEndedEvent) => void;
605
618
  onvoicejoined: (voiceParticipant: VoiceJoinedEvent) => void;
606
619
  onvoiceleaved: (voiceParticipant: VoiceLeavedEvent) => void;
607
620
  onchannelcreated: (channelCreated: ChannelCreatedEvent) => void;
@@ -652,6 +665,8 @@ export declare class DefaultSocket implements Socket {
652
665
  onpartymatchmakerticket(partyMatched: PartyMatchmakerTicket): void;
653
666
  onpartypresence(partyPresence: PartyPresenceEvent): void;
654
667
  onstatuspresence(statusPresence: StatusPresenceEvent): void;
668
+ onvoiceended(voice: VoiceEndedEvent): void;
669
+ onvoicestarted(voice: VoiceStartedEvent): void;
655
670
  onvoicejoined(voiceParticipant: VoiceJoinedEvent): void;
656
671
  onvoiceleaved(voiceParticipant: VoiceLeavedEvent): void;
657
672
  onchannelcreated(channelCreated: ChannelCreatedEvent): void;
@@ -679,7 +694,7 @@ export declare class DefaultSocket implements Socket {
679
694
  unfollowUsers(user_ids: string[]): Promise<void>;
680
695
  updateChatMessage(channel_id: string, channel_label: string, mode: number, message_id: string, content: any): Promise<ChannelMessageAck>;
681
696
  updateStatus(status?: string): Promise<void>;
682
- writeChatMessage(clan_id: string, channel_id: string, channel_label: string, mode: number, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?: Boolean): Promise<ChannelMessageAck>;
697
+ writeChatMessage(clan_id: string, channel_id: string, channel_label: string, mode: number, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?: Boolean, notifi_content?: any): Promise<ChannelMessageAck>;
683
698
  writeMessageReaction(id: string, channel_id: string, channel_label: string, mode: number, message_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean): Promise<MessageReactionEvent>;
684
699
  writeMessageTyping(channel_id: string, channel_label: string, mode: number): Promise<MessageTypingEvent>;
685
700
  writeLastSeenMessage(channel_id: string, channel_label: string, mode: number, message_id: string, timestamp: string): Promise<LastSeenMessageEvent>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.7.38",
3
+ "version": "2.7.40",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },
package/socket.ts CHANGED
@@ -276,6 +276,8 @@ interface ChannelMessageSend {
276
276
  anonymous_message?: boolean;
277
277
  //
278
278
  mention_everyone?: boolean;
279
+ //
280
+ notifi_content: any;
279
281
  };
280
282
  }
281
283
 
@@ -323,6 +325,24 @@ export interface ChannelPresenceEvent {
323
325
  leaves: Presence[];
324
326
  }
325
327
 
328
+ export interface VoiceEndedEvent {
329
+ // id voice
330
+ id: string;
331
+ // The unique identifier of the chat clan.
332
+ clan_id: string;
333
+ // voice channel name
334
+ voice_channel_id: string;
335
+ }
336
+
337
+ export interface VoiceStartedEvent {
338
+ // id voice
339
+ id: string;
340
+ // The unique identifier of the chat clan.
341
+ clan_id: string;
342
+ // voice channel name
343
+ voice_channel_id: string;
344
+ }
345
+
326
346
  export interface VoiceLeavedEvent {
327
347
  // event id
328
348
  id: string;
@@ -717,7 +737,7 @@ export interface Socket {
717
737
  updateStatus(status? : string) : Promise<void>;
718
738
 
719
739
  /** Send a chat message to a chat channel on the server. */
720
- writeChatMessage(clan_id: string, channel_id: string, channel_label: string, mode: number, content?: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?:boolean) : Promise<ChannelMessageAck>;
740
+ writeChatMessage(clan_id: string, channel_id: string, channel_label: string, mode: number, content?: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?:boolean, notifi_content?: any) : Promise<ChannelMessageAck>;
721
741
 
722
742
  /** Send message typing */
723
743
  writeMessageTyping(channel_id: string, channel_label: string, mode: number) : Promise<MessageTypingEvent>;
@@ -790,6 +810,12 @@ export interface Socket {
790
810
  /** Receive channel presence updates. */
791
811
  onchannelpresence: (channelPresence: ChannelPresenceEvent) => void;
792
812
 
813
+ // when someone start the voice room
814
+ onvoicestarted: (voice: VoiceStartedEvent) => void;
815
+
816
+ // when someone end the voice room
817
+ onvoiceended: (voice: VoiceEndedEvent) => void;
818
+
793
819
  // when someone join to voice room
794
820
  onvoicejoined: (voiceParticipant: VoiceJoinedEvent) => void;
795
821
 
@@ -877,6 +903,10 @@ export class DefaultSocket implements Socket {
877
903
  n.content = n.content ? JSON.parse(n.content) : undefined;
878
904
  this.onnotification(n);
879
905
  });
906
+ } else if (message.voice_started_event) {
907
+ this.onvoicestarted(message.voice_started_event)
908
+ } else if (message.voice_ended_event) {
909
+ this.onvoiceended(message.voice_ended_event)
880
910
  } else if (message.voice_joined_event) {
881
911
  this.onvoicejoined(message.voice_joined_event)
882
912
  } else if (message.voice_leaved_event) {
@@ -978,12 +1008,9 @@ export class DefaultSocket implements Socket {
978
1008
  }
979
1009
  this.adapter.onError = (evt: Event) => {
980
1010
  reject(evt);
981
- // TODO: do not close the adapter
982
- this.onerror(evt);
983
- //this.adapter.close();
1011
+ this.adapter.close();
984
1012
  }
985
1013
 
986
-
987
1014
  setTimeout(() => {
988
1015
  // if promise has resolved by now, the reject() is a no-op
989
1016
  reject("The socket timed out when trying to connect.");
@@ -1099,6 +1126,18 @@ export class DefaultSocket implements Socket {
1099
1126
  }
1100
1127
  }
1101
1128
 
1129
+ onvoiceended(voice: VoiceEndedEvent) {
1130
+ if (this.verbose && window && window.console) {
1131
+ console.log(voice);
1132
+ }
1133
+ }
1134
+
1135
+ onvoicestarted(voice: VoiceStartedEvent) {
1136
+ if (this.verbose && window && window.console) {
1137
+ console.log(voice);
1138
+ }
1139
+ }
1140
+
1102
1141
  onvoicejoined(voiceParticipant: VoiceJoinedEvent) {
1103
1142
  if (this.verbose && window && window.console) {
1104
1143
  console.log(voiceParticipant);
@@ -1309,8 +1348,8 @@ export class DefaultSocket implements Socket {
1309
1348
  return this.send({status_update: {status: status}});
1310
1349
  }
1311
1350
 
1312
- async writeChatMessage(clan_id: string, channel_id: string, channel_label: string, mode: number, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?:Boolean ): Promise<ChannelMessageAck> {
1313
- const response = await this.send({channel_message_send: {clan_id: clan_id, channel_id: channel_id, channel_label:channel_label, mode:mode, content: content, mentions: mentions, attachments: attachments, references: references, anonymous_message: anonymous_message, mention_everyone:mention_everyone}});
1351
+ async writeChatMessage(clan_id: string, channel_id: string, channel_label: string, mode: number, content: any, mentions?: Array<ApiMessageMention>, attachments?: Array<ApiMessageAttachment>, references?: Array<ApiMessageRef>, anonymous_message?: boolean, mention_everyone?:Boolean, notifi_content?: any ): Promise<ChannelMessageAck> {
1352
+ const response = await this.send({channel_message_send: {clan_id: clan_id, channel_id: channel_id, channel_label:channel_label, mode:mode, content: content, mentions: mentions, attachments: attachments, references: references, anonymous_message: anonymous_message, mention_everyone:mention_everyone, notifi_content:notifi_content}});
1314
1353
  return response.channel_message_ack;
1315
1354
  }
1316
1355