mezon-js 2.9.83 → 2.9.85
Sign up to get free protection for your applications and to get access to all the features.
- package/api.gen.ts +16 -0
- package/client.ts +69 -61
- package/dist/api.gen.d.ts +8 -0
- package/dist/client.d.ts +5 -1
- package/dist/mezon-js.cjs.js +57 -6
- package/dist/mezon-js.esm.mjs +57 -6
- package/dist/socket.d.ts +19 -2
- package/package.json +1 -1
- package/socket.ts +113 -22
package/api.gen.ts
CHANGED
@@ -133,12 +133,18 @@ export enum ApiAppRole {
|
|
133
133
|
|
134
134
|
/** Update fields in a given channel. */
|
135
135
|
export interface MezonUpdateChannelDescBody {
|
136
|
+
//
|
137
|
+
age_restricted?: number;
|
136
138
|
//
|
137
139
|
app_url?: string;
|
138
140
|
//
|
139
141
|
category_id?: string;
|
140
142
|
//
|
141
143
|
channel_label?: string;
|
144
|
+
//
|
145
|
+
e2ee?: number;
|
146
|
+
//
|
147
|
+
topic?: string;
|
142
148
|
}
|
143
149
|
|
144
150
|
/** */
|
@@ -683,6 +689,8 @@ export interface ApiChannelDescription {
|
|
683
689
|
//
|
684
690
|
active?: number;
|
685
691
|
//
|
692
|
+
age_restricted?: number;
|
693
|
+
//
|
686
694
|
app_url?: string;
|
687
695
|
//
|
688
696
|
category_id?: string;
|
@@ -709,6 +717,8 @@ export interface ApiChannelDescription {
|
|
709
717
|
//
|
710
718
|
creator_name?: string;
|
711
719
|
//
|
720
|
+
e2ee?: number;
|
721
|
+
//
|
712
722
|
is_mute?: boolean;
|
713
723
|
//
|
714
724
|
last_pin_message?: string;
|
@@ -724,6 +734,8 @@ export interface ApiChannelDescription {
|
|
724
734
|
parrent_id?: string;
|
725
735
|
//
|
726
736
|
is_online?: Array<boolean>;
|
737
|
+
//
|
738
|
+
topic?: string;
|
727
739
|
//The channel type.
|
728
740
|
type?: number;
|
729
741
|
//
|
@@ -2177,6 +2189,8 @@ export interface ApiUpdateAccountRequest {
|
|
2177
2189
|
about_me?: string;
|
2178
2190
|
//A URL for an avatar image.
|
2179
2191
|
avatar_url?: string;
|
2192
|
+
//
|
2193
|
+
dob?: string;
|
2180
2194
|
//The display name of the user.
|
2181
2195
|
display_name?: string;
|
2182
2196
|
//The language expected to be a tag which follows the BCP-47 spec.
|
@@ -2258,6 +2272,8 @@ export interface ApiUser {
|
|
2258
2272
|
apple_id?: string;
|
2259
2273
|
//A URL for an avatar image.
|
2260
2274
|
avatar_url?: string;
|
2275
|
+
//
|
2276
|
+
dob?: string;
|
2261
2277
|
//The UNIX time (for gRPC clients) or ISO string (for REST clients) when the user was created.
|
2262
2278
|
create_time?: string;
|
2263
2279
|
//The display name of the user.
|
package/client.ts
CHANGED
@@ -191,9 +191,10 @@ export enum NotificationType {
|
|
191
191
|
}
|
192
192
|
|
193
193
|
export enum WebrtcSignalingType {
|
194
|
-
WEBRTC_SDP_OFFER
|
195
|
-
WEBRTC_SDP_ANSWER
|
196
|
-
WEBRTC_ICE_CANDIDATE = 3
|
194
|
+
WEBRTC_SDP_OFFER = 1,
|
195
|
+
WEBRTC_SDP_ANSWER = 2,
|
196
|
+
WEBRTC_ICE_CANDIDATE = 3,
|
197
|
+
WEBRTC_SDP_QUIT = 4,
|
197
198
|
}
|
198
199
|
|
199
200
|
/** Response for an RPC function executed on the server. */
|
@@ -446,6 +447,12 @@ export interface ApiUpdateChannelDescRequest {
|
|
446
447
|
category_id: string | undefined;
|
447
448
|
/** The app url of channel */
|
448
449
|
app_url: string | undefined;
|
450
|
+
//
|
451
|
+
e2ee?: number;
|
452
|
+
//
|
453
|
+
topic?: string;
|
454
|
+
//
|
455
|
+
age_restricted?: number;
|
449
456
|
}
|
450
457
|
|
451
458
|
/** Add users to a channel. */
|
@@ -3201,7 +3208,11 @@ export class Client {
|
|
3201
3208
|
}
|
3202
3209
|
|
3203
3210
|
//**disabled webhook by id */
|
3204
|
-
async deleteWebhookById(
|
3211
|
+
async deleteWebhookById(
|
3212
|
+
session: Session,
|
3213
|
+
id: string,
|
3214
|
+
request: MezonDeleteWebhookByIdBody
|
3215
|
+
) {
|
3205
3216
|
if (
|
3206
3217
|
this.autoRefreshSession &&
|
3207
3218
|
session.refresh_token &&
|
@@ -4239,9 +4250,7 @@ export class Client {
|
|
4239
4250
|
});
|
4240
4251
|
}
|
4241
4252
|
/** List activity */
|
4242
|
-
async listActivity(
|
4243
|
-
session: Session
|
4244
|
-
): Promise<ApiListUserActivity> {
|
4253
|
+
async listActivity(session: Session): Promise<ApiListUserActivity> {
|
4245
4254
|
if (
|
4246
4255
|
this.autoRefreshSession &&
|
4247
4256
|
session.refresh_token &&
|
@@ -4250,11 +4259,9 @@ export class Client {
|
|
4250
4259
|
await this.sessionRefresh(session);
|
4251
4260
|
}
|
4252
4261
|
|
4253
|
-
return this.apiClient
|
4254
|
-
|
4255
|
-
|
4256
|
-
return response;
|
4257
|
-
});
|
4262
|
+
return this.apiClient.listActivity(session.token).then((response: any) => {
|
4263
|
+
return response;
|
4264
|
+
});
|
4258
4265
|
}
|
4259
4266
|
|
4260
4267
|
async createActiviy(
|
@@ -4285,26 +4292,26 @@ export class Client {
|
|
4285
4292
|
const response = {
|
4286
4293
|
login_id: apiSession.login_id,
|
4287
4294
|
create_time_second: apiSession.create_time_second,
|
4288
|
-
|
4289
|
-
|
4290
|
-
return response
|
4295
|
+
};
|
4296
|
+
return response;
|
4291
4297
|
}
|
4292
4298
|
|
4293
|
-
async checkLoginRequest(
|
4299
|
+
async checkLoginRequest(
|
4300
|
+
requet: ApiConfirmLoginRequest
|
4301
|
+
): Promise<Session | null> {
|
4294
4302
|
const apiSession = await this.apiClient.checkLoginRequest(
|
4295
4303
|
this.serverkey,
|
4296
4304
|
"",
|
4297
4305
|
requet
|
4298
4306
|
);
|
4299
4307
|
if (!apiSession?.token) {
|
4300
|
-
return null
|
4308
|
+
return null;
|
4301
4309
|
}
|
4302
4310
|
return new Session(
|
4303
4311
|
apiSession.token || "",
|
4304
4312
|
apiSession.refresh_token || "",
|
4305
4313
|
apiSession.created || false
|
4306
4314
|
);
|
4307
|
-
|
4308
4315
|
}
|
4309
4316
|
|
4310
4317
|
async confirmLogin(
|
@@ -4326,9 +4333,10 @@ export class Client {
|
|
4326
4333
|
});
|
4327
4334
|
}
|
4328
4335
|
|
4329
|
-
async getChanEncryptionMethod(
|
4336
|
+
async getChanEncryptionMethod(
|
4337
|
+
session: Session,
|
4330
4338
|
channelId: string
|
4331
|
-
)
|
4339
|
+
): Promise<ApiChanEncryptionMethod> {
|
4332
4340
|
if (
|
4333
4341
|
this.autoRefreshSession &&
|
4334
4342
|
session.refresh_token &&
|
@@ -4344,27 +4352,30 @@ export class Client {
|
|
4344
4352
|
});
|
4345
4353
|
}
|
4346
4354
|
|
4347
|
-
async setChanEncryptionMethod(
|
4355
|
+
async setChanEncryptionMethod(
|
4356
|
+
session: Session,
|
4348
4357
|
channelId: string,
|
4349
|
-
method: string
|
4350
|
-
|
4351
|
-
|
4352
|
-
|
4353
|
-
|
4354
|
-
)
|
4355
|
-
|
4356
|
-
|
4357
|
-
|
4358
|
-
return this.apiClient
|
4359
|
-
.setChanEncryptionMethod(session.token, channelId, { method: method })
|
4360
|
-
.then((response: any) => {
|
4361
|
-
return response;
|
4362
|
-
});
|
4358
|
+
method: string
|
4359
|
+
): Promise<any> {
|
4360
|
+
if (
|
4361
|
+
this.autoRefreshSession &&
|
4362
|
+
session.refresh_token &&
|
4363
|
+
session.isexpired((Date.now() + this.expiredTimespanMs) / 1000)
|
4364
|
+
) {
|
4365
|
+
await this.sessionRefresh(session);
|
4363
4366
|
}
|
4364
4367
|
|
4365
|
-
|
4368
|
+
return this.apiClient
|
4369
|
+
.setChanEncryptionMethod(session.token, channelId, { method: method })
|
4370
|
+
.then((response: any) => {
|
4371
|
+
return response;
|
4372
|
+
});
|
4373
|
+
}
|
4374
|
+
|
4375
|
+
async getPubKeys(
|
4376
|
+
session: Session,
|
4366
4377
|
userIds: Array<string>
|
4367
|
-
)
|
4378
|
+
): Promise<ApiGetPubKeysResponse> {
|
4368
4379
|
if (
|
4369
4380
|
this.autoRefreshSession &&
|
4370
4381
|
session.refresh_token &&
|
@@ -4380,9 +4391,10 @@ export class Client {
|
|
4380
4391
|
});
|
4381
4392
|
}
|
4382
4393
|
|
4383
|
-
async pushPubKey(
|
4394
|
+
async pushPubKey(
|
4395
|
+
session: Session,
|
4384
4396
|
PK: ApiPubKey
|
4385
|
-
)
|
4397
|
+
): Promise<ApiGetPubKeysResponse> {
|
4386
4398
|
if (
|
4387
4399
|
this.autoRefreshSession &&
|
4388
4400
|
session.refresh_token &&
|
@@ -4398,7 +4410,7 @@ export class Client {
|
|
4398
4410
|
});
|
4399
4411
|
}
|
4400
4412
|
|
4401
|
-
async getKeyServer(session: Session)
|
4413
|
+
async getKeyServer(session: Session): Promise<ApiGetKeyServerResp> {
|
4402
4414
|
if (
|
4403
4415
|
this.autoRefreshSession &&
|
4404
4416
|
session.refresh_token &&
|
@@ -4416,12 +4428,12 @@ export class Client {
|
|
4416
4428
|
|
4417
4429
|
async listAuditLog(
|
4418
4430
|
session: Session,
|
4419
|
-
actionLog?:string,
|
4420
|
-
userId?:string,
|
4421
|
-
clanId?:string,
|
4422
|
-
page?:number,
|
4423
|
-
pageSize?:number
|
4424
|
-
)
|
4431
|
+
actionLog?: string,
|
4432
|
+
userId?: string,
|
4433
|
+
clanId?: string,
|
4434
|
+
page?: number,
|
4435
|
+
pageSize?: number
|
4436
|
+
): Promise<MezonapiListAuditLog> {
|
4425
4437
|
if (
|
4426
4438
|
this.autoRefreshSession &&
|
4427
4439
|
session.refresh_token &&
|
@@ -4438,12 +4450,12 @@ export class Client {
|
|
4438
4450
|
}
|
4439
4451
|
|
4440
4452
|
async listOnboarding(
|
4441
|
-
session: Session,
|
4442
|
-
clanId?:string,
|
4443
|
-
guideType?:number,
|
4444
|
-
limit?:number,
|
4445
|
-
page?:number
|
4446
|
-
)
|
4453
|
+
session: Session,
|
4454
|
+
clanId?: string,
|
4455
|
+
guideType?: number,
|
4456
|
+
limit?: number,
|
4457
|
+
page?: number
|
4458
|
+
): Promise<ApiListOnboardingResponse> {
|
4447
4459
|
if (
|
4448
4460
|
this.autoRefreshSession &&
|
4449
4461
|
session.refresh_token &&
|
@@ -4462,7 +4474,7 @@ export class Client {
|
|
4462
4474
|
async getOnboardingDetail(
|
4463
4475
|
session: Session,
|
4464
4476
|
id: string,
|
4465
|
-
clanId?: string
|
4477
|
+
clanId?: string
|
4466
4478
|
): Promise<ApiOnboardingItem> {
|
4467
4479
|
if (
|
4468
4480
|
this.autoRefreshSession &&
|
@@ -4520,8 +4532,8 @@ export class Client {
|
|
4520
4532
|
|
4521
4533
|
async deleteOnboarding(
|
4522
4534
|
session: Session,
|
4523
|
-
id:string,
|
4524
|
-
clanId?:string
|
4535
|
+
id: string,
|
4536
|
+
clanId?: string
|
4525
4537
|
): Promise<any> {
|
4526
4538
|
if (
|
4527
4539
|
this.autoRefreshSession &&
|
@@ -4557,7 +4569,7 @@ export class Client {
|
|
4557
4569
|
return Promise.resolve(response);
|
4558
4570
|
});
|
4559
4571
|
}
|
4560
|
-
|
4572
|
+
|
4561
4573
|
//**list webhook belong to the clan */
|
4562
4574
|
async listClanWebhook(
|
4563
4575
|
session: Session,
|
@@ -4579,11 +4591,7 @@ export class Client {
|
|
4579
4591
|
}
|
4580
4592
|
|
4581
4593
|
//**disabled webhook by id */
|
4582
|
-
async deleteClanWebhookById(
|
4583
|
-
session: Session,
|
4584
|
-
id: string,
|
4585
|
-
clan_id: string
|
4586
|
-
) {
|
4594
|
+
async deleteClanWebhookById(session: Session, id: string, clan_id: string) {
|
4587
4595
|
if (
|
4588
4596
|
this.autoRefreshSession &&
|
4589
4597
|
session.refresh_token &&
|
package/dist/api.gen.d.ts
CHANGED
@@ -79,9 +79,12 @@ export declare enum ApiAppRole {
|
|
79
79
|
}
|
80
80
|
/** Update fields in a given channel. */
|
81
81
|
export interface MezonUpdateChannelDescBody {
|
82
|
+
age_restricted?: number;
|
82
83
|
app_url?: string;
|
83
84
|
category_id?: string;
|
84
85
|
channel_label?: string;
|
86
|
+
e2ee?: number;
|
87
|
+
topic?: string;
|
85
88
|
}
|
86
89
|
/** */
|
87
90
|
export interface MezonUpdateClanDescBody {
|
@@ -401,6 +404,7 @@ export interface ApiChannelDescList {
|
|
401
404
|
/** */
|
402
405
|
export interface ApiChannelDescription {
|
403
406
|
active?: number;
|
407
|
+
age_restricted?: number;
|
404
408
|
app_url?: string;
|
405
409
|
category_id?: string;
|
406
410
|
category_name?: string;
|
@@ -414,6 +418,7 @@ export interface ApiChannelDescription {
|
|
414
418
|
create_time_seconds?: number;
|
415
419
|
creator_id?: string;
|
416
420
|
creator_name?: string;
|
421
|
+
e2ee?: number;
|
417
422
|
is_mute?: boolean;
|
418
423
|
last_pin_message?: string;
|
419
424
|
last_seen_message?: ApiChannelMessageHeader;
|
@@ -422,6 +427,7 @@ export interface ApiChannelDescription {
|
|
422
427
|
meeting_uri?: string;
|
423
428
|
parrent_id?: string;
|
424
429
|
is_online?: Array<boolean>;
|
430
|
+
topic?: string;
|
425
431
|
type?: number;
|
426
432
|
update_time_seconds?: number;
|
427
433
|
user_id?: Array<string>;
|
@@ -1267,6 +1273,7 @@ export interface ApiTokenSentEvent {
|
|
1267
1273
|
export interface ApiUpdateAccountRequest {
|
1268
1274
|
about_me?: string;
|
1269
1275
|
avatar_url?: string;
|
1276
|
+
dob?: string;
|
1270
1277
|
display_name?: string;
|
1271
1278
|
lang_tag?: string;
|
1272
1279
|
location?: string;
|
@@ -1315,6 +1322,7 @@ export interface ApiUser {
|
|
1315
1322
|
about_me?: string;
|
1316
1323
|
apple_id?: string;
|
1317
1324
|
avatar_url?: string;
|
1325
|
+
dob?: string;
|
1318
1326
|
create_time?: string;
|
1319
1327
|
display_name?: string;
|
1320
1328
|
edge_count?: number;
|
package/dist/client.d.ts
CHANGED
@@ -43,7 +43,8 @@ export declare enum NotificationType {
|
|
43
43
|
export declare enum WebrtcSignalingType {
|
44
44
|
WEBRTC_SDP_OFFER = 1,
|
45
45
|
WEBRTC_SDP_ANSWER = 2,
|
46
|
-
WEBRTC_ICE_CANDIDATE = 3
|
46
|
+
WEBRTC_ICE_CANDIDATE = 3,
|
47
|
+
WEBRTC_SDP_QUIT = 4
|
47
48
|
}
|
48
49
|
/** Response for an RPC function executed on the server. */
|
49
50
|
export interface RpcResponse {
|
@@ -251,6 +252,9 @@ export interface ApiUpdateChannelDescRequest {
|
|
251
252
|
category_id: string | undefined;
|
252
253
|
/** The app url of channel */
|
253
254
|
app_url: string | undefined;
|
255
|
+
e2ee?: number;
|
256
|
+
topic?: string;
|
257
|
+
age_restricted?: number;
|
254
258
|
}
|
255
259
|
/** Add users to a channel. */
|
256
260
|
export interface ApiAddChannelUsersRequest {
|
package/dist/mezon-js.cjs.js
CHANGED
@@ -7047,9 +7047,17 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7047
7047
|
} else if (message.token_sent_event) {
|
7048
7048
|
this.ontokensent(message.token_sent_event);
|
7049
7049
|
} else if (message.message_button_clicked) {
|
7050
|
-
this.onmessagebuttonclicked(
|
7050
|
+
this.onmessagebuttonclicked(
|
7051
|
+
message.message_button_clicked
|
7052
|
+
);
|
7053
|
+
} else if (message.dropdown_box_selected) {
|
7054
|
+
this.onmessagedropdownboxselected(
|
7055
|
+
message.dropdown_box_selected
|
7056
|
+
);
|
7051
7057
|
} else if (message.webrtc_signaling_fwd) {
|
7052
|
-
this.onwebrtcsignalingfwd(
|
7058
|
+
this.onwebrtcsignalingfwd(
|
7059
|
+
message.webrtc_signaling_fwd
|
7060
|
+
);
|
7053
7061
|
} else if (message.list_activity) {
|
7054
7062
|
this.onactivityupdated(message.list_activity);
|
7055
7063
|
} else if (message.join_ptt_channel) {
|
@@ -7338,6 +7346,11 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7338
7346
|
console.log(messageButtonClicked);
|
7339
7347
|
}
|
7340
7348
|
}
|
7349
|
+
onmessagedropdownboxselected(msg) {
|
7350
|
+
if (this.verbose && window && window.console) {
|
7351
|
+
console.log(msg);
|
7352
|
+
}
|
7353
|
+
}
|
7341
7354
|
onwebrtcsignalingfwd(event) {
|
7342
7355
|
if (this.verbose && window && window.console) {
|
7343
7356
|
console.log(event);
|
@@ -7607,15 +7620,42 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7607
7620
|
forwardWebrtcSignaling(receiver_id, data_type, json_data, channel_id, caller_id) {
|
7608
7621
|
return __async(this, null, function* () {
|
7609
7622
|
const response = yield this.send({
|
7610
|
-
webrtc_signaling_fwd: {
|
7623
|
+
webrtc_signaling_fwd: {
|
7624
|
+
receiver_id,
|
7625
|
+
data_type,
|
7626
|
+
json_data,
|
7627
|
+
channel_id,
|
7628
|
+
caller_id
|
7629
|
+
}
|
7611
7630
|
});
|
7612
7631
|
return response.webrtc_signaling_fwd;
|
7613
7632
|
});
|
7614
7633
|
}
|
7634
|
+
handleDropdownBoxSelected(message_id, channel_id, selectbox_id, sender_id, user_id, value) {
|
7635
|
+
return __async(this, null, function* () {
|
7636
|
+
const response = yield this.send({
|
7637
|
+
message_button_clicked: {
|
7638
|
+
message_id,
|
7639
|
+
channel_id,
|
7640
|
+
selectbox_id,
|
7641
|
+
sender_id,
|
7642
|
+
user_id,
|
7643
|
+
value
|
7644
|
+
}
|
7645
|
+
});
|
7646
|
+
return response.dropdown_box_selected;
|
7647
|
+
});
|
7648
|
+
}
|
7615
7649
|
handleMessageButtonClick(message_id, channel_id, button_id, sender_id, user_id) {
|
7616
7650
|
return __async(this, null, function* () {
|
7617
7651
|
const response = yield this.send({
|
7618
|
-
message_button_clicked: {
|
7652
|
+
message_button_clicked: {
|
7653
|
+
message_id,
|
7654
|
+
channel_id,
|
7655
|
+
button_id,
|
7656
|
+
sender_id,
|
7657
|
+
user_id
|
7658
|
+
}
|
7619
7659
|
});
|
7620
7660
|
return response.webrtc_signaling_fwd;
|
7621
7661
|
});
|
@@ -7623,7 +7663,12 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7623
7663
|
joinPTTChannel(channelId, dataType, jsonData) {
|
7624
7664
|
return __async(this, null, function* () {
|
7625
7665
|
const response = yield this.send({
|
7626
|
-
join_ptt_channel: {
|
7666
|
+
join_ptt_channel: {
|
7667
|
+
channel_id: channelId,
|
7668
|
+
data_type: dataType,
|
7669
|
+
json_data: jsonData,
|
7670
|
+
receiver_id: ""
|
7671
|
+
}
|
7627
7672
|
});
|
7628
7673
|
return response.join_ptt_channel;
|
7629
7674
|
});
|
@@ -7631,7 +7676,12 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7631
7676
|
talkPTTChannel(channelId, dataType, jsonData, state) {
|
7632
7677
|
return __async(this, null, function* () {
|
7633
7678
|
const response = yield this.send({
|
7634
|
-
talk_ptt_channel: {
|
7679
|
+
talk_ptt_channel: {
|
7680
|
+
channel_id: channelId,
|
7681
|
+
data_type: dataType,
|
7682
|
+
json_data: jsonData,
|
7683
|
+
state
|
7684
|
+
}
|
7635
7685
|
});
|
7636
7686
|
return response.talk_ptt_channel;
|
7637
7687
|
});
|
@@ -7698,6 +7748,7 @@ var WebrtcSignalingType = /* @__PURE__ */ ((WebrtcSignalingType2) => {
|
|
7698
7748
|
WebrtcSignalingType2[WebrtcSignalingType2["WEBRTC_SDP_OFFER"] = 1] = "WEBRTC_SDP_OFFER";
|
7699
7749
|
WebrtcSignalingType2[WebrtcSignalingType2["WEBRTC_SDP_ANSWER"] = 2] = "WEBRTC_SDP_ANSWER";
|
7700
7750
|
WebrtcSignalingType2[WebrtcSignalingType2["WEBRTC_ICE_CANDIDATE"] = 3] = "WEBRTC_ICE_CANDIDATE";
|
7751
|
+
WebrtcSignalingType2[WebrtcSignalingType2["WEBRTC_SDP_QUIT"] = 4] = "WEBRTC_SDP_QUIT";
|
7701
7752
|
return WebrtcSignalingType2;
|
7702
7753
|
})(WebrtcSignalingType || {});
|
7703
7754
|
var Client = class {
|
package/dist/mezon-js.esm.mjs
CHANGED
@@ -7017,9 +7017,17 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7017
7017
|
} else if (message.token_sent_event) {
|
7018
7018
|
this.ontokensent(message.token_sent_event);
|
7019
7019
|
} else if (message.message_button_clicked) {
|
7020
|
-
this.onmessagebuttonclicked(
|
7020
|
+
this.onmessagebuttonclicked(
|
7021
|
+
message.message_button_clicked
|
7022
|
+
);
|
7023
|
+
} else if (message.dropdown_box_selected) {
|
7024
|
+
this.onmessagedropdownboxselected(
|
7025
|
+
message.dropdown_box_selected
|
7026
|
+
);
|
7021
7027
|
} else if (message.webrtc_signaling_fwd) {
|
7022
|
-
this.onwebrtcsignalingfwd(
|
7028
|
+
this.onwebrtcsignalingfwd(
|
7029
|
+
message.webrtc_signaling_fwd
|
7030
|
+
);
|
7023
7031
|
} else if (message.list_activity) {
|
7024
7032
|
this.onactivityupdated(message.list_activity);
|
7025
7033
|
} else if (message.join_ptt_channel) {
|
@@ -7308,6 +7316,11 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7308
7316
|
console.log(messageButtonClicked);
|
7309
7317
|
}
|
7310
7318
|
}
|
7319
|
+
onmessagedropdownboxselected(msg) {
|
7320
|
+
if (this.verbose && window && window.console) {
|
7321
|
+
console.log(msg);
|
7322
|
+
}
|
7323
|
+
}
|
7311
7324
|
onwebrtcsignalingfwd(event) {
|
7312
7325
|
if (this.verbose && window && window.console) {
|
7313
7326
|
console.log(event);
|
@@ -7577,15 +7590,42 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7577
7590
|
forwardWebrtcSignaling(receiver_id, data_type, json_data, channel_id, caller_id) {
|
7578
7591
|
return __async(this, null, function* () {
|
7579
7592
|
const response = yield this.send({
|
7580
|
-
webrtc_signaling_fwd: {
|
7593
|
+
webrtc_signaling_fwd: {
|
7594
|
+
receiver_id,
|
7595
|
+
data_type,
|
7596
|
+
json_data,
|
7597
|
+
channel_id,
|
7598
|
+
caller_id
|
7599
|
+
}
|
7581
7600
|
});
|
7582
7601
|
return response.webrtc_signaling_fwd;
|
7583
7602
|
});
|
7584
7603
|
}
|
7604
|
+
handleDropdownBoxSelected(message_id, channel_id, selectbox_id, sender_id, user_id, value) {
|
7605
|
+
return __async(this, null, function* () {
|
7606
|
+
const response = yield this.send({
|
7607
|
+
message_button_clicked: {
|
7608
|
+
message_id,
|
7609
|
+
channel_id,
|
7610
|
+
selectbox_id,
|
7611
|
+
sender_id,
|
7612
|
+
user_id,
|
7613
|
+
value
|
7614
|
+
}
|
7615
|
+
});
|
7616
|
+
return response.dropdown_box_selected;
|
7617
|
+
});
|
7618
|
+
}
|
7585
7619
|
handleMessageButtonClick(message_id, channel_id, button_id, sender_id, user_id) {
|
7586
7620
|
return __async(this, null, function* () {
|
7587
7621
|
const response = yield this.send({
|
7588
|
-
message_button_clicked: {
|
7622
|
+
message_button_clicked: {
|
7623
|
+
message_id,
|
7624
|
+
channel_id,
|
7625
|
+
button_id,
|
7626
|
+
sender_id,
|
7627
|
+
user_id
|
7628
|
+
}
|
7589
7629
|
});
|
7590
7630
|
return response.webrtc_signaling_fwd;
|
7591
7631
|
});
|
@@ -7593,7 +7633,12 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7593
7633
|
joinPTTChannel(channelId, dataType, jsonData) {
|
7594
7634
|
return __async(this, null, function* () {
|
7595
7635
|
const response = yield this.send({
|
7596
|
-
join_ptt_channel: {
|
7636
|
+
join_ptt_channel: {
|
7637
|
+
channel_id: channelId,
|
7638
|
+
data_type: dataType,
|
7639
|
+
json_data: jsonData,
|
7640
|
+
receiver_id: ""
|
7641
|
+
}
|
7597
7642
|
});
|
7598
7643
|
return response.join_ptt_channel;
|
7599
7644
|
});
|
@@ -7601,7 +7646,12 @@ var _DefaultSocket = class _DefaultSocket {
|
|
7601
7646
|
talkPTTChannel(channelId, dataType, jsonData, state) {
|
7602
7647
|
return __async(this, null, function* () {
|
7603
7648
|
const response = yield this.send({
|
7604
|
-
talk_ptt_channel: {
|
7649
|
+
talk_ptt_channel: {
|
7650
|
+
channel_id: channelId,
|
7651
|
+
data_type: dataType,
|
7652
|
+
json_data: jsonData,
|
7653
|
+
state
|
7654
|
+
}
|
7605
7655
|
});
|
7606
7656
|
return response.talk_ptt_channel;
|
7607
7657
|
});
|
@@ -7668,6 +7718,7 @@ var WebrtcSignalingType = /* @__PURE__ */ ((WebrtcSignalingType2) => {
|
|
7668
7718
|
WebrtcSignalingType2[WebrtcSignalingType2["WEBRTC_SDP_OFFER"] = 1] = "WEBRTC_SDP_OFFER";
|
7669
7719
|
WebrtcSignalingType2[WebrtcSignalingType2["WEBRTC_SDP_ANSWER"] = 2] = "WEBRTC_SDP_ANSWER";
|
7670
7720
|
WebrtcSignalingType2[WebrtcSignalingType2["WEBRTC_ICE_CANDIDATE"] = 3] = "WEBRTC_ICE_CANDIDATE";
|
7721
|
+
WebrtcSignalingType2[WebrtcSignalingType2["WEBRTC_SDP_QUIT"] = 4] = "WEBRTC_SDP_QUIT";
|
7671
7722
|
return WebrtcSignalingType2;
|
7672
7723
|
})(WebrtcSignalingType || {});
|
7673
7724
|
var Client = class {
|
package/dist/socket.d.ts
CHANGED
@@ -577,6 +577,14 @@ export interface PermissionChangedEvent {
|
|
577
577
|
user_id: string;
|
578
578
|
channel_id: string;
|
579
579
|
}
|
580
|
+
export interface DropdownBoxSelected {
|
581
|
+
message_id: string;
|
582
|
+
channel_id: string;
|
583
|
+
selectbox_id: string;
|
584
|
+
sender_id: string;
|
585
|
+
user_id: string;
|
586
|
+
value: Array<string>;
|
587
|
+
}
|
580
588
|
export interface MessageButtonClicked {
|
581
589
|
message_id: string;
|
582
590
|
channel_id: string;
|
@@ -592,9 +600,14 @@ export interface WebrtcSignalingFwd {
|
|
592
600
|
caller_id: string;
|
593
601
|
}
|
594
602
|
export interface JoinPTTChannel {
|
603
|
+
/** channel id */
|
595
604
|
channel_id: string;
|
605
|
+
/** type offer, answer or candidate */
|
596
606
|
data_type: number;
|
607
|
+
/** offer */
|
597
608
|
json_data: string;
|
609
|
+
/** receiver id */
|
610
|
+
receiver_id: string;
|
598
611
|
}
|
599
612
|
export interface TalkPTTChannel {
|
600
613
|
channel_id: string;
|
@@ -708,8 +721,10 @@ export interface Socket {
|
|
708
721
|
getHeartbeatTimeoutMs(): number;
|
709
722
|
checkDuplicateName(name: string, condition_id: string, type: number): Promise<CheckNameExistedEvent>;
|
710
723
|
handleMessageButtonClick: (message_id: string, channel_id: string, button_id: string, sender_id: string, user_id: string) => Promise<MessageButtonClicked>;
|
711
|
-
|
724
|
+
handleDropdownBoxSelected: (message_id: string, channel_id: string, selectbox_id: string, sender_id: string, user_id: string, value: Array<string>) => Promise<DropdownBoxSelected>;
|
712
725
|
forwardWebrtcSignaling: (receiverId: string, dataType: number, jsonData: string, channelId: string, caller_id: string) => Promise<WebrtcSignalingFwd>;
|
726
|
+
onmessagebuttonclicked: (event: MessageButtonClicked) => void;
|
727
|
+
onmessagedropdownboxselected: (event: DropdownBoxSelected) => void;
|
713
728
|
onwebrtcsignalingfwd: (event: WebrtcSignalingFwd) => void;
|
714
729
|
oneventcreated: (clan_event_created: ApiCreateEventRequest) => void;
|
715
730
|
oncoffeegiven: (give_coffee_event: ApiGiveCoffeeEvent) => void;
|
@@ -801,11 +816,12 @@ export declare class DefaultSocket implements Socket {
|
|
801
816
|
onunmuteevent(unmute_event: UnmuteEvent): void;
|
802
817
|
ontokensent(tokenSentEvent: ApiTokenSentEvent): void;
|
803
818
|
onmessagebuttonclicked(messageButtonClicked: MessageButtonClicked): void;
|
819
|
+
onmessagedropdownboxselected(msg: DropdownBoxSelected): void;
|
804
820
|
onwebrtcsignalingfwd(event: WebrtcSignalingFwd): void;
|
805
821
|
onactivityupdated(list_activity: ListActivity): void;
|
806
822
|
onjoinpttchannel(join_ptt_channel: JoinPTTChannel): void;
|
807
823
|
ontalkpttchannel(talk_ptt_channel: TalkPTTChannel): void;
|
808
|
-
send(message: ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate | CustomStatusEvent | ChannelMessageRemove | MessageTypingEvent | LastSeenMessageEvent | Rpc | StatusFollow | StatusUnfollow | StatusUpdate | Ping | WebrtcSignalingFwd | MessageButtonClicked | JoinPTTChannel | TalkPTTChannel, sendTimeout?: number): Promise<any>;
|
824
|
+
send(message: ChannelJoin | ChannelLeave | ChannelMessageSend | ChannelMessageUpdate | CustomStatusEvent | ChannelMessageRemove | MessageTypingEvent | LastSeenMessageEvent | Rpc | StatusFollow | StatusUnfollow | StatusUpdate | Ping | WebrtcSignalingFwd | MessageButtonClicked | DropdownBoxSelected | JoinPTTChannel | TalkPTTChannel, sendTimeout?: number): Promise<any>;
|
809
825
|
followUsers(userIds: string[]): Promise<Status>;
|
810
826
|
joinClanChat(clan_id: string): Promise<ClanJoin>;
|
811
827
|
joinChat(clan_id: string, channel_id: string, channel_type: number, is_public: boolean): Promise<Channel>;
|
@@ -825,6 +841,7 @@ export declare class DefaultSocket implements Socket {
|
|
825
841
|
writeCustomStatus(clan_id: string, status: string): Promise<CustomStatusEvent>;
|
826
842
|
checkDuplicateName(name: string, condition_id: string, type: number): Promise<CheckNameExistedEvent>;
|
827
843
|
forwardWebrtcSignaling(receiver_id: string, data_type: number, json_data: string, channel_id: string, caller_id: string): Promise<WebrtcSignalingFwd>;
|
844
|
+
handleDropdownBoxSelected(message_id: string, channel_id: string, selectbox_id: string, sender_id: string, user_id: string, value: Array<string>): Promise<DropdownBoxSelected>;
|
828
845
|
handleMessageButtonClick(message_id: string, channel_id: string, button_id: string, sender_id: string, user_id: string): Promise<MessageButtonClicked>;
|
829
846
|
joinPTTChannel(channelId: string, dataType: number, jsonData: string): Promise<JoinPTTChannel>;
|
830
847
|
talkPTTChannel(channelId: string, dataType: number, jsonData: string, state: number): Promise<TalkPTTChannel>;
|
package/package.json
CHANGED
package/socket.ts
CHANGED
@@ -820,6 +820,15 @@ export interface PermissionChangedEvent {
|
|
820
820
|
channel_id: string;
|
821
821
|
}
|
822
822
|
|
823
|
+
export interface DropdownBoxSelected {
|
824
|
+
message_id: string;
|
825
|
+
channel_id: string;
|
826
|
+
selectbox_id: string;
|
827
|
+
sender_id: string;
|
828
|
+
user_id: string;
|
829
|
+
value: Array<string>;
|
830
|
+
}
|
831
|
+
|
823
832
|
export interface MessageButtonClicked {
|
824
833
|
message_id: string;
|
825
834
|
channel_id: string;
|
@@ -837,12 +846,14 @@ export interface WebrtcSignalingFwd {
|
|
837
846
|
}
|
838
847
|
|
839
848
|
export interface JoinPTTChannel {
|
840
|
-
|
849
|
+
/** channel id */
|
841
850
|
channel_id: string;
|
842
|
-
|
851
|
+
/** type offer, answer or candidate */
|
843
852
|
data_type: number;
|
844
|
-
|
853
|
+
/** offer */
|
845
854
|
json_data: string;
|
855
|
+
/** receiver id */
|
856
|
+
receiver_id: string;
|
846
857
|
}
|
847
858
|
|
848
859
|
export interface TalkPTTChannel {
|
@@ -1140,15 +1151,35 @@ export interface Socket {
|
|
1140
1151
|
type: number
|
1141
1152
|
): Promise<CheckNameExistedEvent>;
|
1142
1153
|
|
1143
|
-
handleMessageButtonClick: (
|
1154
|
+
handleMessageButtonClick: (
|
1155
|
+
message_id: string,
|
1144
1156
|
channel_id: string,
|
1145
1157
|
button_id: string,
|
1146
1158
|
sender_id: string,
|
1147
|
-
user_id: string
|
1159
|
+
user_id: string
|
1160
|
+
) => Promise<MessageButtonClicked>;
|
1148
1161
|
|
1162
|
+
handleDropdownBoxSelected: (
|
1163
|
+
message_id: string,
|
1164
|
+
channel_id: string,
|
1165
|
+
selectbox_id: string,
|
1166
|
+
sender_id: string,
|
1167
|
+
user_id: string,
|
1168
|
+
value: Array<string>
|
1169
|
+
) => Promise<DropdownBoxSelected>;
|
1170
|
+
|
1171
|
+
forwardWebrtcSignaling: (
|
1172
|
+
receiverId: string,
|
1173
|
+
dataType: number,
|
1174
|
+
jsonData: string,
|
1175
|
+
channelId: string,
|
1176
|
+
caller_id: string
|
1177
|
+
) => Promise<WebrtcSignalingFwd>;
|
1178
|
+
|
1179
|
+
|
1149
1180
|
onmessagebuttonclicked: (event: MessageButtonClicked) => void;
|
1150
1181
|
|
1151
|
-
|
1182
|
+
onmessagedropdownboxselected: (event: DropdownBoxSelected) => void;
|
1152
1183
|
|
1153
1184
|
onwebrtcsignalingfwd: (event: WebrtcSignalingFwd) => void;
|
1154
1185
|
|
@@ -1182,7 +1213,7 @@ export interface Socket {
|
|
1182
1213
|
|
1183
1214
|
onunmuteevent: (unmute_event: UnmuteEvent) => void;
|
1184
1215
|
|
1185
|
-
ontokensent: (token: ApiTokenSentEvent) => void;
|
1216
|
+
ontokensent: (token: ApiTokenSentEvent) => void;
|
1186
1217
|
|
1187
1218
|
onactivityupdated: (list_activity: ListActivity) => void;
|
1188
1219
|
|
@@ -1440,14 +1471,22 @@ export class DefaultSocket implements Socket {
|
|
1440
1471
|
} else if (message.token_sent_event) {
|
1441
1472
|
this.ontokensent(<ApiTokenSentEvent>message.token_sent_event);
|
1442
1473
|
} else if (message.message_button_clicked) {
|
1443
|
-
this.onmessagebuttonclicked(
|
1474
|
+
this.onmessagebuttonclicked(
|
1475
|
+
<MessageButtonClicked>message.message_button_clicked
|
1476
|
+
);
|
1477
|
+
} else if (message.dropdown_box_selected) {
|
1478
|
+
this.onmessagedropdownboxselected(
|
1479
|
+
<DropdownBoxSelected>message.dropdown_box_selected
|
1480
|
+
);
|
1444
1481
|
} else if (message.webrtc_signaling_fwd) {
|
1445
|
-
this.onwebrtcsignalingfwd(
|
1446
|
-
|
1482
|
+
this.onwebrtcsignalingfwd(
|
1483
|
+
<WebrtcSignalingFwd>message.webrtc_signaling_fwd
|
1484
|
+
);
|
1485
|
+
} else if (message.list_activity) {
|
1447
1486
|
this.onactivityupdated(<ListActivity>message.list_activity);
|
1448
|
-
} else if (message.join_ptt_channel){
|
1487
|
+
} else if (message.join_ptt_channel) {
|
1449
1488
|
this.onjoinpttchannel(<JoinPTTChannel>message.join_ptt_channel);
|
1450
|
-
} else if (message.talk_ptt_channel){
|
1489
|
+
} else if (message.talk_ptt_channel) {
|
1451
1490
|
this.ontalkpttchannel(<TalkPTTChannel>message.talk_ptt_channel);
|
1452
1491
|
} else {
|
1453
1492
|
if (this.verbose && window && window.console) {
|
@@ -1786,6 +1825,12 @@ export class DefaultSocket implements Socket {
|
|
1786
1825
|
}
|
1787
1826
|
}
|
1788
1827
|
|
1828
|
+
onmessagedropdownboxselected(msg: DropdownBoxSelected) {
|
1829
|
+
if (this.verbose && window && window.console) {
|
1830
|
+
console.log(msg);
|
1831
|
+
}
|
1832
|
+
}
|
1833
|
+
|
1789
1834
|
onwebrtcsignalingfwd(event: WebrtcSignalingFwd) {
|
1790
1835
|
if (this.verbose && window && window.console) {
|
1791
1836
|
console.log(event);
|
@@ -1826,6 +1871,7 @@ export class DefaultSocket implements Socket {
|
|
1826
1871
|
| Ping
|
1827
1872
|
| WebrtcSignalingFwd
|
1828
1873
|
| MessageButtonClicked
|
1874
|
+
| DropdownBoxSelected
|
1829
1875
|
| JoinPTTChannel
|
1830
1876
|
| TalkPTTChannel,
|
1831
1877
|
sendTimeout = DefaultSocket.DefaultSendTimeoutMs
|
@@ -2162,25 +2208,60 @@ export class DefaultSocket implements Socket {
|
|
2162
2208
|
}
|
2163
2209
|
|
2164
2210
|
async forwardWebrtcSignaling(
|
2165
|
-
receiver_id: string,
|
2166
|
-
data_type: number,
|
2211
|
+
receiver_id: string,
|
2212
|
+
data_type: number,
|
2167
2213
|
json_data: string,
|
2168
|
-
channel_id: string,
|
2169
|
-
caller_id: string
|
2214
|
+
channel_id: string,
|
2215
|
+
caller_id: string
|
2216
|
+
): Promise<WebrtcSignalingFwd> {
|
2170
2217
|
const response = await this.send({
|
2171
|
-
webrtc_signaling_fwd: {
|
2218
|
+
webrtc_signaling_fwd: {
|
2219
|
+
receiver_id: receiver_id,
|
2220
|
+
data_type: data_type,
|
2221
|
+
json_data: json_data,
|
2222
|
+
channel_id: channel_id,
|
2223
|
+
caller_id: caller_id,
|
2224
|
+
},
|
2172
2225
|
});
|
2173
2226
|
return response.webrtc_signaling_fwd;
|
2174
2227
|
}
|
2175
2228
|
|
2176
|
-
async
|
2229
|
+
async handleDropdownBoxSelected(
|
2230
|
+
message_id: string,
|
2231
|
+
channel_id: string,
|
2232
|
+
selectbox_id: string,
|
2233
|
+
sender_id: string,
|
2234
|
+
user_id: string,
|
2235
|
+
value: Array<string>
|
2236
|
+
): Promise<DropdownBoxSelected> {
|
2237
|
+
const response = await this.send({
|
2238
|
+
message_button_clicked: {
|
2239
|
+
message_id: message_id,
|
2240
|
+
channel_id: channel_id,
|
2241
|
+
selectbox_id: selectbox_id,
|
2242
|
+
sender_id: sender_id,
|
2243
|
+
user_id: user_id,
|
2244
|
+
value: value
|
2245
|
+
},
|
2246
|
+
});
|
2247
|
+
return response.dropdown_box_selected;
|
2248
|
+
}
|
2249
|
+
|
2250
|
+
async handleMessageButtonClick(
|
2177
2251
|
message_id: string,
|
2178
2252
|
channel_id: string,
|
2179
2253
|
button_id: string,
|
2180
2254
|
sender_id: string,
|
2181
|
-
user_id: string
|
2255
|
+
user_id: string
|
2256
|
+
): Promise<MessageButtonClicked> {
|
2182
2257
|
const response = await this.send({
|
2183
|
-
message_button_clicked: {
|
2258
|
+
message_button_clicked: {
|
2259
|
+
message_id: message_id,
|
2260
|
+
channel_id: channel_id,
|
2261
|
+
button_id: button_id,
|
2262
|
+
sender_id: sender_id,
|
2263
|
+
user_id: user_id,
|
2264
|
+
},
|
2184
2265
|
});
|
2185
2266
|
return response.webrtc_signaling_fwd;
|
2186
2267
|
}
|
@@ -2191,7 +2272,12 @@ export class DefaultSocket implements Socket {
|
|
2191
2272
|
jsonData: string
|
2192
2273
|
): Promise<JoinPTTChannel> {
|
2193
2274
|
const response = await this.send({
|
2194
|
-
join_ptt_channel: {
|
2275
|
+
join_ptt_channel: {
|
2276
|
+
channel_id: channelId,
|
2277
|
+
data_type: dataType,
|
2278
|
+
json_data: jsonData,
|
2279
|
+
receiver_id: "",
|
2280
|
+
},
|
2195
2281
|
});
|
2196
2282
|
return response.join_ptt_channel;
|
2197
2283
|
}
|
@@ -2203,7 +2289,12 @@ export class DefaultSocket implements Socket {
|
|
2203
2289
|
state: number
|
2204
2290
|
): Promise<TalkPTTChannel> {
|
2205
2291
|
const response = await this.send({
|
2206
|
-
talk_ptt_channel: {
|
2292
|
+
talk_ptt_channel: {
|
2293
|
+
channel_id: channelId,
|
2294
|
+
data_type: dataType,
|
2295
|
+
json_data: jsonData,
|
2296
|
+
state: state,
|
2297
|
+
},
|
2207
2298
|
});
|
2208
2299
|
return response.talk_ptt_channel;
|
2209
2300
|
}
|