mezon-js 2.9.62 → 2.9.64
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/api.gen.ts +2 -0
- package/client.ts +1 -1
- package/dist/api.gen.d.ts +1 -0
- package/dist/client.d.ts +1 -1
- package/dist/mezon-js.cjs.js +14 -0
- package/dist/mezon-js.esm.mjs +14 -0
- package/dist/socket.d.ts +16 -0
- package/package.json +1 -1
- package/socket.ts +40 -4
package/api.gen.ts
CHANGED
package/client.ts
CHANGED
|
@@ -2885,7 +2885,7 @@ export class Client {
|
|
|
2885
2885
|
/** Set default notification category*/
|
|
2886
2886
|
async setNotificationCategory(
|
|
2887
2887
|
session: Session,
|
|
2888
|
-
request:
|
|
2888
|
+
request: ApiSetNotificationRequest
|
|
2889
2889
|
): Promise<boolean> {
|
|
2890
2890
|
if (
|
|
2891
2891
|
this.autoRefreshSession &&
|
package/dist/api.gen.d.ts
CHANGED
package/dist/client.d.ts
CHANGED
|
@@ -520,7 +520,7 @@ export declare class Client {
|
|
|
520
520
|
/** update channel private*/
|
|
521
521
|
updateChannelPrivate(session: Session, request: ApiChangeChannelPrivateRequest): Promise<boolean>;
|
|
522
522
|
/** Set default notification category*/
|
|
523
|
-
setNotificationCategory(session: Session, request:
|
|
523
|
+
setNotificationCategory(session: Session, request: ApiSetNotificationRequest): Promise<boolean>;
|
|
524
524
|
deleteNotificationCategory(session: Session, category_id: string): Promise<boolean>;
|
|
525
525
|
deleteNotificationChannel(session: Session, channel_id: string): Promise<boolean>;
|
|
526
526
|
/** */
|
package/dist/mezon-js.cjs.js
CHANGED
|
@@ -6553,8 +6553,12 @@ var _DefaultSocket = class _DefaultSocket {
|
|
|
6553
6553
|
this.onpermissionset(message.permission_set_event);
|
|
6554
6554
|
} else if (message.permission_changed_event) {
|
|
6555
6555
|
this.onpermissionchanged(message.permission_changed_event);
|
|
6556
|
+
} else if (message.unmute_event) {
|
|
6557
|
+
this.onunmuteevent(message.unmute_event);
|
|
6556
6558
|
} else if (message.token_sent_event) {
|
|
6557
6559
|
this.ontokensent(message.token_sent_event);
|
|
6560
|
+
} else if (message.message_button_clicked) {
|
|
6561
|
+
this.handleMessageButtonClick(message.message_button_clicked);
|
|
6558
6562
|
} else {
|
|
6559
6563
|
if (this.verbose && window && window.console) {
|
|
6560
6564
|
console.log("Unrecognized message received: %o", message);
|
|
@@ -6822,11 +6826,21 @@ var _DefaultSocket = class _DefaultSocket {
|
|
|
6822
6826
|
console.log(permission_changed_event);
|
|
6823
6827
|
}
|
|
6824
6828
|
}
|
|
6829
|
+
onunmuteevent(unmute_event) {
|
|
6830
|
+
if (this.verbose && window && window.console) {
|
|
6831
|
+
console.log(unmute_event);
|
|
6832
|
+
}
|
|
6833
|
+
}
|
|
6825
6834
|
ontokensent(tokenSentEvent) {
|
|
6826
6835
|
if (this.verbose && window && window.console) {
|
|
6827
6836
|
console.log(tokenSentEvent);
|
|
6828
6837
|
}
|
|
6829
6838
|
}
|
|
6839
|
+
handleMessageButtonClick(messageButtonClicked) {
|
|
6840
|
+
if (this.verbose && window && window.console) {
|
|
6841
|
+
console.log(messageButtonClicked);
|
|
6842
|
+
}
|
|
6843
|
+
}
|
|
6830
6844
|
send(message, sendTimeout = _DefaultSocket.DefaultSendTimeoutMs) {
|
|
6831
6845
|
const untypedMessage = message;
|
|
6832
6846
|
return new Promise((resolve, reject) => {
|
package/dist/mezon-js.esm.mjs
CHANGED
|
@@ -6524,8 +6524,12 @@ var _DefaultSocket = class _DefaultSocket {
|
|
|
6524
6524
|
this.onpermissionset(message.permission_set_event);
|
|
6525
6525
|
} else if (message.permission_changed_event) {
|
|
6526
6526
|
this.onpermissionchanged(message.permission_changed_event);
|
|
6527
|
+
} else if (message.unmute_event) {
|
|
6528
|
+
this.onunmuteevent(message.unmute_event);
|
|
6527
6529
|
} else if (message.token_sent_event) {
|
|
6528
6530
|
this.ontokensent(message.token_sent_event);
|
|
6531
|
+
} else if (message.message_button_clicked) {
|
|
6532
|
+
this.handleMessageButtonClick(message.message_button_clicked);
|
|
6529
6533
|
} else {
|
|
6530
6534
|
if (this.verbose && window && window.console) {
|
|
6531
6535
|
console.log("Unrecognized message received: %o", message);
|
|
@@ -6793,11 +6797,21 @@ var _DefaultSocket = class _DefaultSocket {
|
|
|
6793
6797
|
console.log(permission_changed_event);
|
|
6794
6798
|
}
|
|
6795
6799
|
}
|
|
6800
|
+
onunmuteevent(unmute_event) {
|
|
6801
|
+
if (this.verbose && window && window.console) {
|
|
6802
|
+
console.log(unmute_event);
|
|
6803
|
+
}
|
|
6804
|
+
}
|
|
6796
6805
|
ontokensent(tokenSentEvent) {
|
|
6797
6806
|
if (this.verbose && window && window.console) {
|
|
6798
6807
|
console.log(tokenSentEvent);
|
|
6799
6808
|
}
|
|
6800
6809
|
}
|
|
6810
|
+
handleMessageButtonClick(messageButtonClicked) {
|
|
6811
|
+
if (this.verbose && window && window.console) {
|
|
6812
|
+
console.log(messageButtonClicked);
|
|
6813
|
+
}
|
|
6814
|
+
}
|
|
6801
6815
|
send(message, sendTimeout = _DefaultSocket.DefaultSendTimeoutMs) {
|
|
6802
6816
|
const untypedMessage = message;
|
|
6803
6817
|
return new Promise((resolve, reject) => {
|
package/dist/socket.d.ts
CHANGED
|
@@ -128,6 +128,11 @@ export interface LastPinMessageEvent {
|
|
|
128
128
|
operation: number;
|
|
129
129
|
is_public: boolean;
|
|
130
130
|
}
|
|
131
|
+
export interface UnmuteEvent {
|
|
132
|
+
channel_id: string;
|
|
133
|
+
category_id: string;
|
|
134
|
+
clan_id: string;
|
|
135
|
+
}
|
|
131
136
|
/** Last seen message by user */
|
|
132
137
|
export interface LastSeenMessageEvent {
|
|
133
138
|
clan_id: string;
|
|
@@ -578,6 +583,13 @@ export interface TokenSentEvent {
|
|
|
578
583
|
receiver_id: string;
|
|
579
584
|
amount: number;
|
|
580
585
|
}
|
|
586
|
+
export interface MessageButtonClicked {
|
|
587
|
+
message_id: string;
|
|
588
|
+
channel_id: string;
|
|
589
|
+
button_id: string;
|
|
590
|
+
sender_id: string;
|
|
591
|
+
user_id: string;
|
|
592
|
+
}
|
|
581
593
|
/** A socket connection to Mezon server. */
|
|
582
594
|
export interface Socket {
|
|
583
595
|
/** Connection is Open */
|
|
@@ -680,6 +692,7 @@ export interface Socket {
|
|
|
680
692
|
setHeartbeatTimeoutMs(ms: number): void;
|
|
681
693
|
getHeartbeatTimeoutMs(): number;
|
|
682
694
|
checkDuplicateName(name: string, condition_id: string, type: number): Promise<CheckNameExistedEvent>;
|
|
695
|
+
handleMessageButtonClick: (message_button_clicked: MessageButtonClicked) => void;
|
|
683
696
|
oneventcreated: (clan_event_created: ApiCreateEventRequest) => void;
|
|
684
697
|
oncoffeegiven: (give_coffee_event: ApiGiveCoffeeEvent) => void;
|
|
685
698
|
oneventemoji: (event_emoji: EventEmoji) => void;
|
|
@@ -690,6 +703,7 @@ export interface Socket {
|
|
|
690
703
|
onstreamingchannelleaved: (streaming_leaved_event: StreamingLeavedEvent) => void;
|
|
691
704
|
onpermissionset: (permission_set_event: PermissionSet) => void;
|
|
692
705
|
onpermissionchanged: (permission_changed_event: PermissionChangedEvent) => void;
|
|
706
|
+
onunmuteevent: (unmute_event: UnmuteEvent) => void;
|
|
693
707
|
ontokensent: (token: TokenSentEvent) => void;
|
|
694
708
|
}
|
|
695
709
|
/** Reports an error received from a socket message. */
|
|
@@ -763,7 +777,9 @@ export declare class DefaultSocket implements Socket {
|
|
|
763
777
|
onstreamingchannelleaved(streaming_leaved_event: StreamingLeavedEvent): void;
|
|
764
778
|
onpermissionset(permission_set_event: PermissionSet): void;
|
|
765
779
|
onpermissionchanged(permission_changed_event: PermissionChangedEvent): void;
|
|
780
|
+
onunmuteevent(unmute_event: UnmuteEvent): void;
|
|
766
781
|
ontokensent(tokenSentEvent: TokenSentEvent): void;
|
|
782
|
+
handleMessageButtonClick(messageButtonClicked: MessageButtonClicked): void;
|
|
767
783
|
send(message: ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate | CustomStatusEvent | ChannelMessageRemove | MessageTypingEvent | LastSeenMessageEvent | Rpc | StatusFollow | StatusUnfollow | StatusUpdate | Ping, sendTimeout?: number): Promise<any>;
|
|
768
784
|
followUsers(userIds: string[]): Promise<Status>;
|
|
769
785
|
joinClanChat(clan_id: string): Promise<ClanJoin>;
|
package/package.json
CHANGED
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 {
|
|
@@ -170,6 +170,15 @@ export interface LastPinMessageEvent {
|
|
|
170
170
|
is_public: boolean;
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
+
export interface UnmuteEvent {
|
|
174
|
+
// channel id
|
|
175
|
+
channel_id: string;
|
|
176
|
+
// category_id
|
|
177
|
+
category_id: string;
|
|
178
|
+
// clan_id
|
|
179
|
+
clan_id: string;
|
|
180
|
+
}
|
|
181
|
+
|
|
173
182
|
/** Last seen message by user */
|
|
174
183
|
export interface LastSeenMessageEvent {
|
|
175
184
|
// The clan id
|
|
@@ -809,6 +818,13 @@ export interface TokenSentEvent {
|
|
|
809
818
|
// amount of token
|
|
810
819
|
amount: number;
|
|
811
820
|
}
|
|
821
|
+
export interface MessageButtonClicked {
|
|
822
|
+
message_id: string;
|
|
823
|
+
channel_id: string;
|
|
824
|
+
button_id : string;
|
|
825
|
+
sender_id : string;
|
|
826
|
+
user_id : string;
|
|
827
|
+
}
|
|
812
828
|
|
|
813
829
|
/** A socket connection to Mezon server. */
|
|
814
830
|
export interface Socket {
|
|
@@ -985,6 +1001,8 @@ export interface Socket {
|
|
|
985
1001
|
|
|
986
1002
|
checkDuplicateName(name: string, condition_id: string, type: number): Promise<CheckNameExistedEvent>;
|
|
987
1003
|
|
|
1004
|
+
handleMessageButtonClick: (message_button_clicked: MessageButtonClicked) => void;
|
|
1005
|
+
|
|
988
1006
|
oneventcreated: (clan_event_created: ApiCreateEventRequest) => void;
|
|
989
1007
|
|
|
990
1008
|
oncoffeegiven: (give_coffee_event: ApiGiveCoffeeEvent) => void;
|
|
@@ -1005,6 +1023,8 @@ export interface Socket {
|
|
|
1005
1023
|
|
|
1006
1024
|
onpermissionchanged: (permission_changed_event: PermissionChangedEvent) => void;
|
|
1007
1025
|
|
|
1026
|
+
onunmuteevent: (unmute_event: UnmuteEvent) => void;
|
|
1027
|
+
|
|
1008
1028
|
ontokensent: (token: TokenSentEvent) => void;
|
|
1009
1029
|
}
|
|
1010
1030
|
|
|
@@ -1209,8 +1229,12 @@ export class DefaultSocket implements Socket {
|
|
|
1209
1229
|
this.onpermissionset(<PermissionSet>message.permission_set_event);
|
|
1210
1230
|
} else if(message.permission_changed_event){
|
|
1211
1231
|
this.onpermissionchanged(<PermissionChangedEvent>message.permission_changed_event);
|
|
1232
|
+
} else if(message.unmute_event){
|
|
1233
|
+
this.onunmuteevent(<UnmuteEvent>message.unmute_event);
|
|
1212
1234
|
} else if (message.token_sent_event) {
|
|
1213
1235
|
this.ontokensent(<TokenSentEvent>message.token_sent_event);
|
|
1236
|
+
} else if (message.message_button_clicked){
|
|
1237
|
+
this.handleMessageButtonClick(<MessageButtonClicked>message.message_button_clicked)
|
|
1214
1238
|
} else {
|
|
1215
1239
|
if (this.verbose && window && window.console) {
|
|
1216
1240
|
console.log("Unrecognized message received: %o", message);
|
|
@@ -1531,12 +1555,24 @@ export class DefaultSocket implements Socket {
|
|
|
1531
1555
|
}
|
|
1532
1556
|
}
|
|
1533
1557
|
|
|
1558
|
+
onunmuteevent(unmute_event: UnmuteEvent){
|
|
1559
|
+
if (this.verbose && window && window.console) {
|
|
1560
|
+
console.log(unmute_event);
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1534
1564
|
ontokensent(tokenSentEvent: TokenSentEvent) {
|
|
1535
1565
|
if (this.verbose && window && window.console) {
|
|
1536
1566
|
console.log(tokenSentEvent);
|
|
1537
1567
|
}
|
|
1538
1568
|
}
|
|
1539
1569
|
|
|
1570
|
+
handleMessageButtonClick(messageButtonClicked: MessageButtonClicked) {
|
|
1571
|
+
if (this.verbose && window && window.console) {
|
|
1572
|
+
console.log(messageButtonClicked);
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1540
1576
|
send(message: ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate | CustomStatusEvent |
|
|
1541
1577
|
ChannelMessageRemove | MessageTypingEvent | LastSeenMessageEvent | Rpc | StatusFollow | StatusUnfollow | StatusUpdate | Ping, sendTimeout = DefaultSocket.DefaultSendTimeoutMs): Promise<any> {
|
|
1542
1578
|
const untypedMessage = message as any;
|