mezon-js 2.7.66 → 2.7.68

Sign up to get free protection for your applications and to get access to all the features.
@@ -4536,6 +4536,8 @@ var _DefaultSocket = class _DefaultSocket {
4536
4536
  this.onmessagereaction(message.message_reaction_event);
4537
4537
  } else if (message.channel_presence_event) {
4538
4538
  this.onchannelpresence(message.channel_presence_event);
4539
+ } else if (message.last_pin_message_event) {
4540
+ this.onpinmessage(message.last_pin_message_event);
4539
4541
  } else {
4540
4542
  if (this.verbose && window && window.console) {
4541
4543
  console.log("Unrecognized message received: %o", message);
@@ -4628,6 +4630,11 @@ var _DefaultSocket = class _DefaultSocket {
4628
4630
  console.log(statusPresence);
4629
4631
  }
4630
4632
  }
4633
+ onpinmessage(pin) {
4634
+ if (this.verbose && window && window.console) {
4635
+ console.log(pin);
4636
+ }
4637
+ }
4631
4638
  onvoiceended(voice) {
4632
4639
  if (this.verbose && window && window.console) {
4633
4640
  console.log(voice);
@@ -4809,6 +4816,12 @@ var _DefaultSocket = class _DefaultSocket {
4809
4816
  return response.last_seen_message_event;
4810
4817
  });
4811
4818
  }
4819
+ writeLastPinMessage(channel_id, mode, message_id, timestamp) {
4820
+ return __async(this, null, function* () {
4821
+ const response = yield this.send({ last_pin_message_event: { channel_id, mode, message_id, timestamp } });
4822
+ return response.last_pin_message_event;
4823
+ });
4824
+ }
4812
4825
  writeVoiceJoined(id, clanId, clanName, voiceChannelId, voiceChannelLabel, participant, lastScreenshot) {
4813
4826
  return __async(this, null, function* () {
4814
4827
  const response = yield this.send({ voice_joined_event: { clan_id: clanId, clan_name: clanName, id, participant, voice_channel_id: voiceChannelId, voice_channel_label: voiceChannelLabel, last_screenshot: lastScreenshot } });
@@ -4507,6 +4507,8 @@ var _DefaultSocket = class _DefaultSocket {
4507
4507
  this.onmessagereaction(message.message_reaction_event);
4508
4508
  } else if (message.channel_presence_event) {
4509
4509
  this.onchannelpresence(message.channel_presence_event);
4510
+ } else if (message.last_pin_message_event) {
4511
+ this.onpinmessage(message.last_pin_message_event);
4510
4512
  } else {
4511
4513
  if (this.verbose && window && window.console) {
4512
4514
  console.log("Unrecognized message received: %o", message);
@@ -4599,6 +4601,11 @@ var _DefaultSocket = class _DefaultSocket {
4599
4601
  console.log(statusPresence);
4600
4602
  }
4601
4603
  }
4604
+ onpinmessage(pin) {
4605
+ if (this.verbose && window && window.console) {
4606
+ console.log(pin);
4607
+ }
4608
+ }
4602
4609
  onvoiceended(voice) {
4603
4610
  if (this.verbose && window && window.console) {
4604
4611
  console.log(voice);
@@ -4780,6 +4787,12 @@ var _DefaultSocket = class _DefaultSocket {
4780
4787
  return response.last_seen_message_event;
4781
4788
  });
4782
4789
  }
4790
+ writeLastPinMessage(channel_id, mode, message_id, timestamp) {
4791
+ return __async(this, null, function* () {
4792
+ const response = yield this.send({ last_pin_message_event: { channel_id, mode, message_id, timestamp } });
4793
+ return response.last_pin_message_event;
4794
+ });
4795
+ }
4783
4796
  writeVoiceJoined(id, clanId, clanName, voiceChannelId, voiceChannelLabel, participant, lastScreenshot) {
4784
4797
  return __async(this, null, function* () {
4785
4798
  const response = yield this.send({ voice_joined_event: { clan_id: clanId, clan_name: clanName, id, participant, voice_channel_id: voiceChannelId, voice_channel_label: voiceChannelLabel, last_screenshot: lastScreenshot } });
package/dist/socket.d.ts CHANGED
@@ -72,6 +72,15 @@ interface ChannelLeave {
72
72
  };
73
73
  }
74
74
  /** Last seen message by user */
75
+ export interface LastPinMessageEvent {
76
+ /** The channel this message belongs to. */
77
+ channel_id: string;
78
+ mode: number;
79
+ channel_label: string;
80
+ /** The unique ID of this message. */
81
+ message_id: string;
82
+ }
83
+ /** Last seen message by user */
75
84
  export interface LastSeenMessageEvent {
76
85
  /** The channel this message belongs to. */
77
86
  channel_id: string;
@@ -402,6 +411,8 @@ export interface Socket {
402
411
  writeMessageReaction(id: string, channel_id: string, mode: number, message_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean): Promise<MessageReactionEvent>;
403
412
  /** Send last seen message */
404
413
  writeLastSeenMessage(channel_id: string, mode: number, message_id: string, timestamp: string): Promise<LastSeenMessageEvent>;
414
+ /** Send last pin message */
415
+ writeLastPinMessage(channel_id: string, mode: number, message_id: string, timestamp: string): Promise<LastPinMessageEvent>;
405
416
  /** send voice joined */
406
417
  writeVoiceJoined(id: string, clanId: string, clanName: string, voiceChannelId: string, voiceChannelLabel: string, participant: string, lastScreenshot: string): Promise<VoiceJoinedEvent>;
407
418
  /** send voice leaved */
@@ -433,6 +444,8 @@ export interface Socket {
433
444
  onmessagereaction: (messageReactionEvent: MessageReactionEvent) => void;
434
445
  /** Receive channel presence updates. */
435
446
  onchannelpresence: (channelPresence: ChannelPresenceEvent) => void;
447
+ /** pin message event */
448
+ onpinmessage: (pin: LastPinMessageEvent) => void;
436
449
  onvoicestarted: (voice: VoiceStartedEvent) => void;
437
450
  onvoiceended: (voice: VoiceEndedEvent) => void;
438
451
  onvoicejoined: (voiceParticipant: VoiceJoinedEvent) => void;
@@ -478,6 +491,7 @@ export declare class DefaultSocket implements Socket {
478
491
  onchannelpresence(channelPresence: ChannelPresenceEvent): void;
479
492
  onnotification(notification: Notification): void;
480
493
  onstatuspresence(statusPresence: StatusPresenceEvent): void;
494
+ onpinmessage(pin: LastPinMessageEvent): void;
481
495
  onvoiceended(voice: VoiceEndedEvent): void;
482
496
  onvoicestarted(voice: VoiceStartedEvent): void;
483
497
  onvoicejoined(voiceParticipant: VoiceJoinedEvent): void;
@@ -504,6 +518,7 @@ export declare class DefaultSocket implements Socket {
504
518
  writeMessageReaction(id: string, channel_id: string, mode: number, message_id: string, emoji: string, count: number, message_sender_id: string, action_delete: boolean): Promise<MessageReactionEvent>;
505
519
  writeMessageTyping(channel_id: string, mode: number): Promise<MessageTypingEvent>;
506
520
  writeLastSeenMessage(channel_id: string, mode: number, message_id: string, timestamp: string): Promise<LastSeenMessageEvent>;
521
+ writeLastPinMessage(channel_id: string, mode: number, message_id: string, timestamp: string): Promise<LastPinMessageEvent>;
507
522
  writeVoiceJoined(id: string, clanId: string, clanName: string, voiceChannelId: string, voiceChannelLabel: string, participant: string, lastScreenshot: string): Promise<VoiceJoinedEvent>;
508
523
  writeVoiceLeaved(id: string, clanId: string, voiceChannelId: string, voiceUserId: string): Promise<VoiceLeavedEvent>;
509
524
  private pingPong;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mezon-js",
3
- "version": "2.7.66",
3
+ "version": "2.7.68",
4
4
  "scripts": {
5
5
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
6
6
  },
package/socket.ts CHANGED
@@ -88,6 +88,18 @@ interface ChannelLeave {
88
88
  };
89
89
  }
90
90
 
91
+ /** Last seen message by user */
92
+ export interface LastPinMessageEvent {
93
+ /** The channel this message belongs to. */
94
+ channel_id:string;
95
+ // The mode
96
+ mode: number;
97
+ // The channel label
98
+ channel_label: string;
99
+ /** The unique ID of this message. */
100
+ message_id: string;
101
+ }
102
+
91
103
  /** Last seen message by user */
92
104
  export interface LastSeenMessageEvent {
93
105
  /** The channel this message belongs to. */
@@ -555,6 +567,9 @@ export interface Socket {
555
567
  /** Send last seen message */
556
568
  writeLastSeenMessage(channel_id: string, mode: number, message_id: string, timestamp: string) : Promise<LastSeenMessageEvent>;
557
569
 
570
+ /** Send last pin message */
571
+ writeLastPinMessage(channel_id: string, mode: number, message_id: string, timestamp: string) : Promise<LastPinMessageEvent>;
572
+
558
573
  /** send voice joined */
559
574
  writeVoiceJoined(id: string, clanId: string, clanName: string, voiceChannelId: string, voiceChannelLabel: string, participant: string, lastScreenshot: string) : Promise<VoiceJoinedEvent>;
560
575
 
@@ -599,6 +614,9 @@ export interface Socket {
599
614
  /** Receive channel presence updates. */
600
615
  onchannelpresence: (channelPresence: ChannelPresenceEvent) => void;
601
616
 
617
+ /** pin message event */
618
+ onpinmessage: (pin: LastPinMessageEvent) => void;
619
+
602
620
  // when someone start the voice room
603
621
  onvoicestarted: (voice: VoiceStartedEvent) => void;
604
622
 
@@ -750,6 +768,8 @@ export class DefaultSocket implements Socket {
750
768
  this.onmessagereaction(<MessageReactionEvent>message.message_reaction_event);
751
769
  } else if (message.channel_presence_event) {
752
770
  this.onchannelpresence(<ChannelPresenceEvent>message.channel_presence_event);
771
+ } else if (message.last_pin_message_event) {
772
+ this.onpinmessage(<LastPinMessageEvent>message.last_pin_message_event);
753
773
  } else {
754
774
  if (this.verbose && window && window.console) {
755
775
  console.log("Unrecognized message received: %o", message);
@@ -859,6 +879,12 @@ export class DefaultSocket implements Socket {
859
879
  }
860
880
  }
861
881
 
882
+ onpinmessage(pin: LastPinMessageEvent) {
883
+ if (this.verbose && window && window.console) {
884
+ console.log(pin);
885
+ }
886
+ }
887
+
862
888
  onvoiceended(voice: VoiceEndedEvent) {
863
889
  if (this.verbose && window && window.console) {
864
890
  console.log(voice);
@@ -1054,6 +1080,11 @@ export class DefaultSocket implements Socket {
1054
1080
  return response.last_seen_message_event
1055
1081
  }
1056
1082
 
1083
+ async writeLastPinMessage(channel_id: string, mode: number, message_id: string, timestamp: string) : Promise<LastPinMessageEvent> {
1084
+ const response = await this.send({last_pin_message_event: {channel_id: channel_id, mode: mode, message_id: message_id, timestamp: timestamp}});
1085
+ return response.last_pin_message_event
1086
+ }
1087
+
1057
1088
  async writeVoiceJoined(id: string, clanId: string, clanName: string, voiceChannelId: string, voiceChannelLabel: string, participant: string, lastScreenshot: string) : Promise<VoiceJoinedEvent> {
1058
1089
  const response = await this.send({voice_joined_event: {clan_id: clanId, clan_name: clanName, id: id, participant: participant, voice_channel_id: voiceChannelId, voice_channel_label: voiceChannelLabel, last_screenshot: lastScreenshot}});
1059
1090
  return response.voice_joined_event