mezon-js 2.9.62 → 2.9.63

Sign up to get free protection for your applications and to get access to all the features.
@@ -6555,6 +6555,8 @@ var _DefaultSocket = class _DefaultSocket {
6555
6555
  this.onpermissionchanged(message.permission_changed_event);
6556
6556
  } else if (message.token_sent_event) {
6557
6557
  this.ontokensent(message.token_sent_event);
6558
+ } else if (message.message_button_clicked) {
6559
+ this.handleMessageButtonClick(message.message_button_clicked);
6558
6560
  } else {
6559
6561
  if (this.verbose && window && window.console) {
6560
6562
  console.log("Unrecognized message received: %o", message);
@@ -6827,6 +6829,11 @@ var _DefaultSocket = class _DefaultSocket {
6827
6829
  console.log(tokenSentEvent);
6828
6830
  }
6829
6831
  }
6832
+ handleMessageButtonClick(messageButtonClicked) {
6833
+ if (this.verbose && window && window.console) {
6834
+ console.log(messageButtonClicked);
6835
+ }
6836
+ }
6830
6837
  send(message, sendTimeout = _DefaultSocket.DefaultSendTimeoutMs) {
6831
6838
  const untypedMessage = message;
6832
6839
  return new Promise((resolve, reject) => {
@@ -6526,6 +6526,8 @@ var _DefaultSocket = class _DefaultSocket {
6526
6526
  this.onpermissionchanged(message.permission_changed_event);
6527
6527
  } else if (message.token_sent_event) {
6528
6528
  this.ontokensent(message.token_sent_event);
6529
+ } else if (message.message_button_clicked) {
6530
+ this.handleMessageButtonClick(message.message_button_clicked);
6529
6531
  } else {
6530
6532
  if (this.verbose && window && window.console) {
6531
6533
  console.log("Unrecognized message received: %o", message);
@@ -6798,6 +6800,11 @@ var _DefaultSocket = class _DefaultSocket {
6798
6800
  console.log(tokenSentEvent);
6799
6801
  }
6800
6802
  }
6803
+ handleMessageButtonClick(messageButtonClicked) {
6804
+ if (this.verbose && window && window.console) {
6805
+ console.log(messageButtonClicked);
6806
+ }
6807
+ }
6801
6808
  send(message, sendTimeout = _DefaultSocket.DefaultSendTimeoutMs) {
6802
6809
  const untypedMessage = message;
6803
6810
  return new Promise((resolve, reject) => {
package/dist/socket.d.ts CHANGED
@@ -578,6 +578,13 @@ export interface TokenSentEvent {
578
578
  receiver_id: string;
579
579
  amount: number;
580
580
  }
581
+ export interface MessageButtonClicked {
582
+ message_id: string;
583
+ channel_id: string;
584
+ button_id: string;
585
+ sender_id: string;
586
+ user_id: string;
587
+ }
581
588
  /** A socket connection to Mezon server. */
582
589
  export interface Socket {
583
590
  /** Connection is Open */
@@ -680,6 +687,7 @@ export interface Socket {
680
687
  setHeartbeatTimeoutMs(ms: number): void;
681
688
  getHeartbeatTimeoutMs(): number;
682
689
  checkDuplicateName(name: string, condition_id: string, type: number): Promise<CheckNameExistedEvent>;
690
+ handleMessageButtonClick: (message_button_clicked: MessageButtonClicked) => void;
683
691
  oneventcreated: (clan_event_created: ApiCreateEventRequest) => void;
684
692
  oncoffeegiven: (give_coffee_event: ApiGiveCoffeeEvent) => void;
685
693
  oneventemoji: (event_emoji: EventEmoji) => void;
@@ -764,6 +772,7 @@ export declare class DefaultSocket implements Socket {
764
772
  onpermissionset(permission_set_event: PermissionSet): void;
765
773
  onpermissionchanged(permission_changed_event: PermissionChangedEvent): void;
766
774
  ontokensent(tokenSentEvent: TokenSentEvent): void;
775
+ handleMessageButtonClick(messageButtonClicked: MessageButtonClicked): void;
767
776
  send(message: ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate | CustomStatusEvent | ChannelMessageRemove | MessageTypingEvent | LastSeenMessageEvent | Rpc | StatusFollow | StatusUnfollow | StatusUpdate | Ping, sendTimeout?: number): Promise<any>;
768
777
  followUsers(userIds: string[]): Promise<Status>;
769
778
  joinClanChat(clan_id: string): Promise<ClanJoin>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mezon-js",
3
3
 
4
- "version": "2.9.62",
4
+ "version": "2.9.63",
5
5
 
6
6
  "scripts": {
7
7
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
package/socket.ts CHANGED
@@ -14,10 +14,10 @@
14
14
  * limitations under the License.
15
15
  */
16
16
 
17
- import { ApiChannelMessageHeader, ApiCreateEventRequest, ApiGiveCoffeeEvent, ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiNotification, ApiPermissionUpdate, ApiRole, ApiRpc} from "./api.gen";
18
- import {Session} from "./session";
19
- import {ChannelMessage, Notification} from "./client";
20
- import {WebSocketAdapter, WebSocketAdapterText} from "./web_socket_adapter"
17
+ import { ApiChannelMessageHeader, ApiCreateEventRequest, ApiGiveCoffeeEvent, ApiMessageAttachment, ApiMessageMention, ApiMessageReaction, ApiMessageRef, ApiNotification, ApiPermissionUpdate, ApiRole, ApiRpc } from "./api.gen";
18
+ import { Session } from "./session";
19
+ import { ChannelMessage, Notification } from "./client";
20
+ import { WebSocketAdapter, WebSocketAdapterText } from "./web_socket_adapter";
21
21
 
22
22
  /** Stores function references for resolve/reject with a DOM Promise. */
23
23
  interface PromiseExecutor {
@@ -809,6 +809,13 @@ export interface TokenSentEvent {
809
809
  // amount of token
810
810
  amount: number;
811
811
  }
812
+ export interface MessageButtonClicked {
813
+ message_id: string;
814
+ channel_id: string;
815
+ button_id : string;
816
+ sender_id : string;
817
+ user_id : string;
818
+ }
812
819
 
813
820
  /** A socket connection to Mezon server. */
814
821
  export interface Socket {
@@ -985,6 +992,8 @@ export interface Socket {
985
992
 
986
993
  checkDuplicateName(name: string, condition_id: string, type: number): Promise<CheckNameExistedEvent>;
987
994
 
995
+ handleMessageButtonClick: (message_button_clicked: MessageButtonClicked) => void;
996
+
988
997
  oneventcreated: (clan_event_created: ApiCreateEventRequest) => void;
989
998
 
990
999
  oncoffeegiven: (give_coffee_event: ApiGiveCoffeeEvent) => void;
@@ -1211,6 +1220,8 @@ export class DefaultSocket implements Socket {
1211
1220
  this.onpermissionchanged(<PermissionChangedEvent>message.permission_changed_event);
1212
1221
  } else if (message.token_sent_event) {
1213
1222
  this.ontokensent(<TokenSentEvent>message.token_sent_event);
1223
+ } else if (message.message_button_clicked){
1224
+ this.handleMessageButtonClick(<MessageButtonClicked>message.message_button_clicked)
1214
1225
  } else {
1215
1226
  if (this.verbose && window && window.console) {
1216
1227
  console.log("Unrecognized message received: %o", message);
@@ -1537,6 +1548,12 @@ export class DefaultSocket implements Socket {
1537
1548
  }
1538
1549
  }
1539
1550
 
1551
+ handleMessageButtonClick(messageButtonClicked: MessageButtonClicked) {
1552
+ if (this.verbose && window && window.console) {
1553
+ console.log(messageButtonClicked);
1554
+ }
1555
+ }
1556
+
1540
1557
  send(message: ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate | CustomStatusEvent |
1541
1558
  ChannelMessageRemove | MessageTypingEvent | LastSeenMessageEvent | Rpc | StatusFollow | StatusUnfollow | StatusUpdate | Ping, sendTimeout = DefaultSocket.DefaultSendTimeoutMs): Promise<any> {
1542
1559
  const untypedMessage = message as any;