mezon-js 2.12.21 → 2.12.23

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.
@@ -6961,9 +6961,7 @@ var _DefaultSocket = class _DefaultSocket {
6961
6961
  this.onerror(evt);
6962
6962
  };
6963
6963
  this.adapter.onMessage = (message) => __async(this, null, function* () {
6964
- if (this.verbose && window && window.console) {
6965
- console.log("Response: %o", JSON.stringify(message));
6966
- }
6964
+ console.log("Response: %o", JSON.stringify(message));
6967
6965
  if (!message.cid) {
6968
6966
  if (message.notifications) {
6969
6967
  message.notifications.notifications.forEach((n) => {
@@ -7108,6 +7106,10 @@ var _DefaultSocket = class _DefaultSocket {
7108
7106
  this.onmessagedropdownboxselected(
7109
7107
  message.dropdown_box_selected
7110
7108
  );
7109
+ } else if (message.mark_as_read) {
7110
+ this.onmarkasread(
7111
+ message.mark_as_read
7112
+ );
7111
7113
  } else if (message.voice_reaction_send) {
7112
7114
  this.onvoicereactionmessage(
7113
7115
  message.voice_reaction_send
@@ -7455,6 +7457,11 @@ var _DefaultSocket = class _DefaultSocket {
7455
7457
  console.log(msg);
7456
7458
  }
7457
7459
  }
7460
+ onmarkasread(event) {
7461
+ if (this.verbose && window && window.console) {
7462
+ console.log(event);
7463
+ }
7464
+ }
7458
7465
  onvoicereactionmessage(event) {
7459
7466
  if (this.verbose && window && window.console) {
7460
7467
  console.log(event);
@@ -7803,20 +7810,6 @@ var _DefaultSocket = class _DefaultSocket {
7803
7810
  return response.webrtc_signaling_fwd;
7804
7811
  });
7805
7812
  }
7806
- forwardSFUSignaling(user_id, data_type, json_data, channel_id, clan_id) {
7807
- return __async(this, null, function* () {
7808
- const response = yield this.send({
7809
- sfu_signaling_fwd: {
7810
- user_id,
7811
- data_type,
7812
- json_data,
7813
- channel_id,
7814
- clan_id
7815
- }
7816
- });
7817
- return response.sfu_signaling_fwd;
7818
- });
7819
- }
7820
7813
  makeCallPush(receiver_id, json_data, channel_id, caller_id) {
7821
7814
  return __async(this, null, function* () {
7822
7815
  const response = yield this.send({
@@ -6927,9 +6927,7 @@ var _DefaultSocket = class _DefaultSocket {
6927
6927
  this.onerror(evt);
6928
6928
  };
6929
6929
  this.adapter.onMessage = (message) => __async(this, null, function* () {
6930
- if (this.verbose && window && window.console) {
6931
- console.log("Response: %o", JSON.stringify(message));
6932
- }
6930
+ console.log("Response: %o", JSON.stringify(message));
6933
6931
  if (!message.cid) {
6934
6932
  if (message.notifications) {
6935
6933
  message.notifications.notifications.forEach((n) => {
@@ -7074,6 +7072,10 @@ var _DefaultSocket = class _DefaultSocket {
7074
7072
  this.onmessagedropdownboxselected(
7075
7073
  message.dropdown_box_selected
7076
7074
  );
7075
+ } else if (message.mark_as_read) {
7076
+ this.onmarkasread(
7077
+ message.mark_as_read
7078
+ );
7077
7079
  } else if (message.voice_reaction_send) {
7078
7080
  this.onvoicereactionmessage(
7079
7081
  message.voice_reaction_send
@@ -7421,6 +7423,11 @@ var _DefaultSocket = class _DefaultSocket {
7421
7423
  console.log(msg);
7422
7424
  }
7423
7425
  }
7426
+ onmarkasread(event) {
7427
+ if (this.verbose && window && window.console) {
7428
+ console.log(event);
7429
+ }
7430
+ }
7424
7431
  onvoicereactionmessage(event) {
7425
7432
  if (this.verbose && window && window.console) {
7426
7433
  console.log(event);
@@ -7769,20 +7776,6 @@ var _DefaultSocket = class _DefaultSocket {
7769
7776
  return response.webrtc_signaling_fwd;
7770
7777
  });
7771
7778
  }
7772
- forwardSFUSignaling(user_id, data_type, json_data, channel_id, clan_id) {
7773
- return __async(this, null, function* () {
7774
- const response = yield this.send({
7775
- sfu_signaling_fwd: {
7776
- user_id,
7777
- data_type,
7778
- json_data,
7779
- channel_id,
7780
- clan_id
7781
- }
7782
- });
7783
- return response.sfu_signaling_fwd;
7784
- });
7785
- }
7786
7779
  makeCallPush(receiver_id, json_data, channel_id, caller_id) {
7787
7780
  return __async(this, null, function* () {
7788
7781
  const response = yield this.send({
package/dist/socket.d.ts CHANGED
@@ -733,6 +733,11 @@ export interface VoiceReactionSend {
733
733
  channel_id: string;
734
734
  sender_id: string;
735
735
  }
736
+ export interface MarkAsRead {
737
+ channel_id: string;
738
+ category_id: string;
739
+ clan_id: string;
740
+ }
736
741
  export interface WebrtcSignalingFwd {
737
742
  receiver_id: string;
738
743
  data_type: number;
@@ -740,13 +745,6 @@ export interface WebrtcSignalingFwd {
740
745
  channel_id: string;
741
746
  caller_id: string;
742
747
  }
743
- export interface SFUSignalingFwd {
744
- data_type: number;
745
- json_data: string;
746
- channel_id: string;
747
- clan_id: string;
748
- user_id: string;
749
- }
750
748
  export interface ListActivity {
751
749
  acts: ApiUserActivity[];
752
750
  }
@@ -829,7 +827,6 @@ export interface Socket {
829
827
  handleDropdownBoxSelected: (message_id: string, channel_id: string, selectbox_id: string, sender_id: string, user_id: string, value: Array<string>) => Promise<DropdownBoxSelected>;
830
828
  writeVoiceReaction: (emojis: Array<string>, channel_id: string) => Promise<VoiceReactionSend>;
831
829
  forwardWebrtcSignaling: (receiverId: string, dataType: number, jsonData: string, channelId: string, caller_id: string) => Promise<WebrtcSignalingFwd>;
832
- forwardSFUSignaling: (user_id: string, data_type: number, json_data: string, channel_id: string, clan_id: string) => Promise<SFUSignalingFwd>;
833
830
  makeCallPush: (receiverId: string, jsonData: string, channelId: string, caller_id: string) => Promise<IncomingCallPush>;
834
831
  writeChannelAppEvent: (clan_id: string, channel_id: string, action: number) => Promise<ChannelAppEvent>;
835
832
  /** Handle disconnect events received from the socket. */
@@ -897,6 +894,7 @@ export interface Socket {
897
894
  onmessagedropdownboxselected: (event: DropdownBoxSelected) => void;
898
895
  onwebrtcsignalingfwd: (event: WebrtcSignalingFwd) => void;
899
896
  onvoicereactionmessage: (event: VoiceReactionSend) => void;
897
+ onmarkasread: (event: MarkAsRead) => void;
900
898
  oneventcreated: (clan_event_created: ApiCreateEventRequest) => void;
901
899
  oncoffeegiven: (give_coffee_event: ApiGiveCoffeeEvent) => void;
902
900
  oneventemoji: (event_emoji: EventEmoji) => void;
@@ -1002,6 +1000,7 @@ export declare class DefaultSocket implements Socket {
1002
1000
  ontokensent(tokenSentEvent: ApiTokenSentEvent): void;
1003
1001
  onmessagebuttonclicked(messageButtonClicked: MessageButtonClicked): void;
1004
1002
  onmessagedropdownboxselected(msg: DropdownBoxSelected): void;
1003
+ onmarkasread(event: MarkAsRead): void;
1005
1004
  onvoicereactionmessage(event: VoiceReactionSend): void;
1006
1005
  onwebrtcsignalingfwd(event: WebrtcSignalingFwd): void;
1007
1006
  onactivityupdated(list_activity: ListActivity): void;
@@ -1032,7 +1031,6 @@ export declare class DefaultSocket implements Socket {
1032
1031
  checkDuplicateName(name: string, condition_id: string, type: number): Promise<CheckNameExistedEvent>;
1033
1032
  writeVoiceReaction(emojis: Array<string>, channel_id: string): Promise<VoiceReactionSend>;
1034
1033
  forwardWebrtcSignaling(receiver_id: string, data_type: number, json_data: string, channel_id: string, caller_id: string): Promise<WebrtcSignalingFwd>;
1035
- forwardSFUSignaling(user_id: string, data_type: number, json_data: string, channel_id: string, clan_id: string): Promise<SFUSignalingFwd>;
1036
1034
  makeCallPush(receiver_id: string, json_data: string, channel_id: string, caller_id: string): Promise<IncomingCallPush>;
1037
1035
  handleDropdownBoxSelected(message_id: string, channel_id: string, selectbox_id: string, sender_id: string, user_id: string, value: Array<string>): Promise<DropdownBoxSelected>;
1038
1036
  handleMessageButtonClick(message_id: string, channel_id: string, button_id: string, sender_id: string, user_id: string, extra_data: string): Promise<MessageButtonClicked>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mezon-js",
3
3
 
4
- "version": "2.12.21",
4
+ "version": "2.12.23",
5
5
 
6
6
  "scripts": {
7
7
  "build": "npx tsc && npx rollup -c --bundleConfigAsCjs && node build.mjs"
package/socket.ts CHANGED
@@ -1049,20 +1049,21 @@ export interface VoiceReactionSend {
1049
1049
  sender_id: string;
1050
1050
  }
1051
1051
 
1052
- export interface WebrtcSignalingFwd {
1053
- receiver_id: string;
1054
- data_type: number;
1055
- json_data: string;
1052
+ export interface MarkAsRead {
1053
+ // channel id
1056
1054
  channel_id: string;
1057
- caller_id: string;
1055
+ // category_id
1056
+ category_id: string;
1057
+ // clan id
1058
+ clan_id: string;
1058
1059
  }
1059
1060
 
1060
- export interface SFUSignalingFwd {
1061
+ export interface WebrtcSignalingFwd {
1062
+ receiver_id: string;
1061
1063
  data_type: number;
1062
1064
  json_data: string;
1063
1065
  channel_id: string;
1064
- clan_id: string;
1065
- user_id: string;
1066
+ caller_id: string;
1066
1067
  }
1067
1068
 
1068
1069
  export interface ListActivity {
@@ -1393,14 +1394,6 @@ export interface Socket {
1393
1394
  caller_id: string
1394
1395
  ) => Promise<WebrtcSignalingFwd>;
1395
1396
 
1396
- forwardSFUSignaling: (
1397
- user_id: string,
1398
- data_type: number,
1399
- json_data: string,
1400
- channel_id: string,
1401
- clan_id: string
1402
- ) => Promise<SFUSignalingFwd>;
1403
-
1404
1397
  makeCallPush: (
1405
1398
  receiverId: string,
1406
1399
  jsonData: string,
@@ -1535,6 +1528,8 @@ export interface Socket {
1535
1528
 
1536
1529
  onvoicereactionmessage: (event: VoiceReactionSend) => void;
1537
1530
 
1531
+ onmarkasread: (event: MarkAsRead) => void;
1532
+
1538
1533
  oneventcreated: (clan_event_created: ApiCreateEventRequest) => void;
1539
1534
 
1540
1535
  oncoffeegiven: (give_coffee_event: ApiGiveCoffeeEvent) => void;
@@ -1658,9 +1653,9 @@ export class DefaultSocket implements Socket {
1658
1653
  };
1659
1654
 
1660
1655
  this.adapter.onMessage = async (message: any) => {
1661
- if (this.verbose && window && window.console) {
1656
+ //if (this.verbose && window && window.console) {
1662
1657
  console.log("Response: %o", JSON.stringify(message));
1663
- }
1658
+ //}
1664
1659
  /** Inbound message from server. */
1665
1660
  if (!message.cid) {
1666
1661
  if (message.notifications) {
@@ -1806,6 +1801,10 @@ export class DefaultSocket implements Socket {
1806
1801
  this.onmessagedropdownboxselected(
1807
1802
  <DropdownBoxSelected>message.dropdown_box_selected
1808
1803
  );
1804
+ } else if (message.mark_as_read) {
1805
+ this.onmarkasread(
1806
+ <MarkAsRead>message.mark_as_read
1807
+ );
1809
1808
  } else if (message.voice_reaction_send) {
1810
1809
  this.onvoicereactionmessage(
1811
1810
  <VoiceReactionSend>message.voice_reaction_send
@@ -2217,6 +2216,12 @@ export class DefaultSocket implements Socket {
2217
2216
  }
2218
2217
  }
2219
2218
 
2219
+ onmarkasread(event: MarkAsRead) {
2220
+ if (this.verbose && window && window.console) {
2221
+ console.log(event);
2222
+ }
2223
+ }
2224
+
2220
2225
  onvoicereactionmessage(event: VoiceReactionSend) {
2221
2226
  if (this.verbose && window && window.console) {
2222
2227
  console.log(event);
@@ -2708,25 +2713,6 @@ export class DefaultSocket implements Socket {
2708
2713
  return response.webrtc_signaling_fwd;
2709
2714
  }
2710
2715
 
2711
- async forwardSFUSignaling(
2712
- user_id: string,
2713
- data_type: number,
2714
- json_data: string,
2715
- channel_id: string,
2716
- clan_id: string
2717
- ): Promise<SFUSignalingFwd> {
2718
- const response = await this.send({
2719
- sfu_signaling_fwd: {
2720
- user_id: user_id,
2721
- data_type: data_type,
2722
- json_data: json_data,
2723
- channel_id: channel_id,
2724
- clan_id: clan_id,
2725
- },
2726
- });
2727
- return response.sfu_signaling_fwd;
2728
- }
2729
-
2730
2716
  async makeCallPush(
2731
2717
  receiver_id: string,
2732
2718
  json_data: string,