ncloudchat 1.0.10 → 1.0.13

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/lib/CloudChat.js CHANGED
@@ -12,12 +12,12 @@ exports["default"] = void 0;
12
12
 
13
13
  require("core-js/modules/es6.array.map");
14
14
 
15
- var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
16
-
17
15
  require("core-js/modules/es6.regexp.split");
18
16
 
19
17
  require("core-js/modules/es6.function.bind");
20
18
 
19
+ var _stringify = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/json/stringify"));
20
+
21
21
  require("core-js/modules/es6.function.name");
22
22
 
23
23
  var _iterator = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/symbol/iterator"));
@@ -222,7 +222,6 @@ function () {
222
222
  };
223
223
 
224
224
  NCloudChat.prototype.getLang = function () {
225
- if (typeof navigator === 'undefined') return "en";
226
225
  return navigator.language;
227
226
  };
228
227
 
@@ -359,19 +358,65 @@ function () {
359
358
  _this.dp.dispatch("onDisconnected", reason);
360
359
  });
361
360
  this.socket.on("message", function (payload) {
362
- try {
363
- var message = JSON.parse(payload);
361
+ var message = JSON.parse(payload);
364
362
 
365
- _this.dp.dispatch("onMessageReceived", message.channel_id, message);
366
- } catch (e) {
367
- console.error(e);
368
- }
363
+ _this.dp.dispatch("onMessageReceived", message.channel_id, message);
369
364
  });
370
365
  this.socket.on("event", function (payload) {
371
366
  var message = JSON.parse(payload);
372
367
 
373
368
  _this.dp.dispatch("onEventReceived", message.channel_id, message);
374
369
  });
370
+ this.socket.on("start typing", function (payload) {
371
+ var data = JSON.parse(payload);
372
+
373
+ _this.dp.dispatch("onStartTyping", data);
374
+ });
375
+ this.socket.on("stop typing", function (payload) {
376
+ var data = JSON.parse(payload);
377
+
378
+ _this.dp.dispatch("onStopTyping", data);
379
+ });
380
+ this.socket.on("member added", function (payload) {
381
+ var data = JSON.parse(payload);
382
+
383
+ _this.dp.dispatch("onMemberAdded", data);
384
+ });
385
+ this.socket.on("member removed", function (payload) {
386
+ var data = JSON.parse(payload);
387
+
388
+ _this.dp.dispatch("onMemberRemoved", data);
389
+ });
390
+ this.socket.on("member updated", function (payload) {
391
+ var data = JSON.parse(payload);
392
+
393
+ _this.dp.dispatch("onMemberUpdated", data);
394
+ });
395
+ this.socket.on("message deleted", function (payload) {
396
+ var data = JSON.parse(payload);
397
+
398
+ _this.dp.dispatch("onMessageDeleted", data);
399
+ });
400
+ this.socket.on("message updated", function (payload) {
401
+ var data = JSON.parse(payload);
402
+
403
+ _this.dp.dispatch("onMessageUpdated", data);
404
+ });
405
+ this.socket.on("user banned", function (payload) {
406
+ var data = JSON.parse(payload);
407
+
408
+ _this.dp.dispatch("onUserBanned", data);
409
+ });
410
+ this.socket.on("user deleted", function (payload) {
411
+ var data = JSON.parse(payload);
412
+
413
+ _this.dp.dispatch("onUserDeleted", data);
414
+ });
415
+ this.socket.on("user updated", function (payload) {
416
+ var data = JSON.parse(payload);
417
+
418
+ _this.dp.dispatch("onUserUpdated", data);
419
+ });
375
420
  this.socket.on("result", function (payload) {
376
421
  var message = JSON.parse(payload);
377
422
 
@@ -390,11 +435,7 @@ function () {
390
435
  });
391
436
  };
392
437
 
393
- NCloudChat.prototype.subscribe = function (channel, language) {
394
- if (language === void 0) {
395
- language = 'en';
396
- }
397
-
438
+ NCloudChat.prototype.mute = function (channel) {
398
439
  return __awaiter(this, void 0, void 0, function () {
399
440
  var subscription, e_2;
400
441
  return __generator(this, function (_a) {
@@ -411,7 +452,9 @@ function () {
411
452
 
412
453
  return [4
413
454
  /*yield*/
414
- , (0, _mutations.createSubscription)(channel, language)];
455
+ , (0, _mutations.updateSubscription)(channel, null, (0, _stringify["default"])({
456
+ mute: true
457
+ }))];
415
458
 
416
459
  case 2:
417
460
  subscription = _a.sent();
@@ -433,9 +476,9 @@ function () {
433
476
  });
434
477
  };
435
478
 
436
- NCloudChat.prototype.unsubscribe = function (channel) {
479
+ NCloudChat.prototype.unmute = function (channel) {
437
480
  return __awaiter(this, void 0, void 0, function () {
438
- var user, subscription, e_3;
481
+ var subscription, e_3;
439
482
  return __generator(this, function (_a) {
440
483
  switch (_a.label) {
441
484
  case 0:
@@ -448,14 +491,15 @@ function () {
448
491
  case 1:
449
492
  _a.trys.push([1, 3,, 4]);
450
493
 
451
- user = _CoreManager["default"].get("USER");
452
- if (!user.id) throw Error("unauthorized");
453
494
  return [4
454
495
  /*yield*/
455
- , (0, _mutations.deleteSubscription)(channel)];
496
+ , (0, _mutations.updateSubscription)(channel, null, (0, _stringify["default"])({
497
+ mute: false
498
+ }))];
456
499
 
457
500
  case 2:
458
501
  subscription = _a.sent();
502
+ if (subscription) subscription.id = this.ObjectId(subscription.id);
459
503
  return [2
460
504
  /*return*/
461
505
  , subscription];
@@ -473,9 +517,13 @@ function () {
473
517
  });
474
518
  };
475
519
 
476
- NCloudChat.prototype.inviteMembers = function (channelId, memberIds) {
520
+ NCloudChat.prototype.subscribe = function (channel, option) {
521
+ if (option === void 0) {
522
+ option = null;
523
+ }
524
+
477
525
  return __awaiter(this, void 0, void 0, function () {
478
- var user, channel, e_4;
526
+ var subscription, e_4;
479
527
  return __generator(this, function (_a) {
480
528
  switch (_a.label) {
481
529
  case 0:
@@ -488,17 +536,16 @@ function () {
488
536
  case 1:
489
537
  _a.trys.push([1, 3,, 4]);
490
538
 
491
- user = _CoreManager["default"].get("USER");
492
- if (!user.id) throw Error("unauthorized");
493
539
  return [4
494
540
  /*yield*/
495
- , (0, _mutations.createInviteMember)(channelId, memberIds)];
541
+ , (0, _mutations.createSubscription)(channel, (0, _stringify["default"])(option))];
496
542
 
497
543
  case 2:
498
- channel = _a.sent();
544
+ subscription = _a.sent();
545
+ if (subscription) subscription.id = this.ObjectId(subscription.id);
499
546
  return [2
500
547
  /*return*/
501
- , channel];
548
+ , subscription];
502
549
 
503
550
  case 3:
504
551
  e_4 = _a.sent();
@@ -513,9 +560,47 @@ function () {
513
560
  });
514
561
  };
515
562
 
563
+ NCloudChat.prototype.unsubscribe = function (channel) {
564
+ return __awaiter(this, void 0, void 0, function () {
565
+ var subscription, e_5;
566
+ return __generator(this, function (_a) {
567
+ switch (_a.label) {
568
+ case 0:
569
+ if (!this.isConnected()) {
570
+ throw Error("You are not connected.");
571
+ }
572
+
573
+ _a.label = 1;
574
+
575
+ case 1:
576
+ _a.trys.push([1, 3,, 4]);
577
+
578
+ return [4
579
+ /*yield*/
580
+ , (0, _mutations.deleteSubscription)(channel)];
581
+
582
+ case 2:
583
+ subscription = _a.sent();
584
+ return [2
585
+ /*return*/
586
+ , subscription];
587
+
588
+ case 3:
589
+ e_5 = _a.sent();
590
+ throw e_5;
591
+
592
+ case 4:
593
+ return [2
594
+ /*return*/
595
+ , null];
596
+ }
597
+ });
598
+ });
599
+ };
600
+
516
601
  NCloudChat.prototype.translateMessage = function (channelId, source, target, message) {
517
602
  return __awaiter(this, void 0, void 0, function () {
518
- var user, result, e_5;
603
+ var user, result, e_6;
519
604
  return __generator(this, function (_a) {
520
605
  switch (_a.label) {
521
606
  case 0:
@@ -540,8 +625,8 @@ function () {
540
625
  , result];
541
626
 
542
627
  case 3:
543
- e_5 = _a.sent();
544
- throw Error(e_5.message);
628
+ e_6 = _a.sent();
629
+ throw Error(e_6.message);
545
630
 
546
631
  case 4:
547
632
  return [2
@@ -707,7 +792,7 @@ function () {
707
792
  }
708
793
 
709
794
  return __awaiter(this, void 0, void 0, function () {
710
- var entries, friends, e_6;
795
+ var entries, friends, e_7;
711
796
  return __generator(this, function (_a) {
712
797
  switch (_a.label) {
713
798
  case 0:
@@ -743,8 +828,8 @@ function () {
743
828
  , entries];
744
829
 
745
830
  case 3:
746
- e_6 = _a.sent();
747
- throw e_6;
831
+ e_7 = _a.sent();
832
+ throw e_7;
748
833
 
749
834
  case 4:
750
835
  return [2
@@ -765,7 +850,7 @@ function () {
765
850
  }
766
851
 
767
852
  return __awaiter(this, void 0, void 0, function () {
768
- var entries, members, e_7;
853
+ var entries, members, e_8;
769
854
 
770
855
  var _this = this;
771
856
 
@@ -804,8 +889,8 @@ function () {
804
889
  , entries];
805
890
 
806
891
  case 3:
807
- e_7 = _a.sent();
808
- throw e_7;
892
+ e_8 = _a.sent();
893
+ throw e_8;
809
894
 
810
895
  case 4:
811
896
  return [2
@@ -826,7 +911,7 @@ function () {
826
911
  }
827
912
 
828
913
  return __awaiter(this, void 0, void 0, function () {
829
- var entries, channels, e_8;
914
+ var entries, channels, e_9;
830
915
 
831
916
  var _this = this;
832
917
 
@@ -865,8 +950,8 @@ function () {
865
950
  , entries];
866
951
 
867
952
  case 3:
868
- e_8 = _a.sent();
869
- throw e_8;
953
+ e_9 = _a.sent();
954
+ throw e_9;
870
955
 
871
956
  case 4:
872
957
  return [2
@@ -879,7 +964,7 @@ function () {
879
964
 
880
965
  NCloudChat.prototype.requestFriend = function (friendId) {
881
966
  return __awaiter(this, void 0, void 0, function () {
882
- var e_9;
967
+ var e_10;
883
968
  return __generator(this, function (_a) {
884
969
  switch (_a.label) {
885
970
  case 0:
@@ -902,8 +987,8 @@ function () {
902
987
  , _a.sent()];
903
988
 
904
989
  case 3:
905
- e_9 = _a.sent();
906
- throw e_9;
990
+ e_10 = _a.sent();
991
+ throw e_10;
907
992
 
908
993
  case 4:
909
994
  return [2
@@ -916,7 +1001,7 @@ function () {
916
1001
 
917
1002
  NCloudChat.prototype.acceptFriend = function (friendId) {
918
1003
  return __awaiter(this, void 0, void 0, function () {
919
- var e_10;
1004
+ var e_11;
920
1005
  return __generator(this, function (_a) {
921
1006
  switch (_a.label) {
922
1007
  case 0:
@@ -939,8 +1024,8 @@ function () {
939
1024
  , _a.sent()];
940
1025
 
941
1026
  case 3:
942
- e_10 = _a.sent();
943
- throw e_10;
1027
+ e_11 = _a.sent();
1028
+ throw e_11;
944
1029
 
945
1030
  case 4:
946
1031
  return [2
@@ -953,7 +1038,7 @@ function () {
953
1038
 
954
1039
  NCloudChat.prototype.rejectFriend = function (friendId) {
955
1040
  return __awaiter(this, void 0, void 0, function () {
956
- var e_11;
1041
+ var e_12;
957
1042
  return __generator(this, function (_a) {
958
1043
  switch (_a.label) {
959
1044
  case 0:
@@ -976,8 +1061,8 @@ function () {
976
1061
  , _a.sent()];
977
1062
 
978
1063
  case 3:
979
- e_11 = _a.sent();
980
- throw e_11;
1064
+ e_12 = _a.sent();
1065
+ throw e_12;
981
1066
 
982
1067
  case 4:
983
1068
  return [2
@@ -990,7 +1075,7 @@ function () {
990
1075
 
991
1076
  NCloudChat.prototype.removeFriend = function (friendId) {
992
1077
  return __awaiter(this, void 0, void 0, function () {
993
- var e_12;
1078
+ var e_13;
994
1079
  return __generator(this, function (_a) {
995
1080
  switch (_a.label) {
996
1081
  case 0:
@@ -1013,8 +1098,8 @@ function () {
1013
1098
  , _a.sent()];
1014
1099
 
1015
1100
  case 3:
1016
- e_12 = _a.sent();
1017
- throw e_12;
1101
+ e_13 = _a.sent();
1102
+ throw e_13;
1018
1103
 
1019
1104
  case 4:
1020
1105
  return [2
@@ -1027,7 +1112,7 @@ function () {
1027
1112
 
1028
1113
  NCloudChat.prototype.countUnread = function (channelId) {
1029
1114
  return __awaiter(this, void 0, void 0, function () {
1030
- var e_13;
1115
+ var e_14;
1031
1116
  return __generator(this, function (_a) {
1032
1117
  switch (_a.label) {
1033
1118
  case 0:
@@ -1050,8 +1135,8 @@ function () {
1050
1135
  , _a.sent()];
1051
1136
 
1052
1137
  case 3:
1053
- e_13 = _a.sent();
1054
- throw e_13;
1138
+ e_14 = _a.sent();
1139
+ throw e_14;
1055
1140
 
1056
1141
  case 4:
1057
1142
  return [2
@@ -1064,7 +1149,7 @@ function () {
1064
1149
 
1065
1150
  NCloudChat.prototype.getSubscription = function (channelId, id) {
1066
1151
  return __awaiter(this, void 0, void 0, function () {
1067
- var e_14;
1152
+ var e_15;
1068
1153
  return __generator(this, function (_a) {
1069
1154
  switch (_a.label) {
1070
1155
  case 0:
@@ -1087,8 +1172,8 @@ function () {
1087
1172
  , _a.sent()];
1088
1173
 
1089
1174
  case 3:
1090
- e_14 = _a.sent();
1091
- throw e_14;
1175
+ e_15 = _a.sent();
1176
+ throw e_15;
1092
1177
 
1093
1178
  case 4:
1094
1179
  return [2
@@ -1101,7 +1186,7 @@ function () {
1101
1186
 
1102
1187
  NCloudChat.prototype.getChannel = function (channelId) {
1103
1188
  return __awaiter(this, void 0, void 0, function () {
1104
- var e_15;
1189
+ var e_16;
1105
1190
  return __generator(this, function (_a) {
1106
1191
  switch (_a.label) {
1107
1192
  case 0:
@@ -1124,8 +1209,8 @@ function () {
1124
1209
  , _a.sent()];
1125
1210
 
1126
1211
  case 3:
1127
- e_15 = _a.sent();
1128
- throw e_15;
1212
+ e_16 = _a.sent();
1213
+ throw e_16;
1129
1214
 
1130
1215
  case 4:
1131
1216
  return [2
@@ -1138,7 +1223,7 @@ function () {
1138
1223
 
1139
1224
  NCloudChat.prototype.getMessage = function (channelId, messageId) {
1140
1225
  return __awaiter(this, void 0, void 0, function () {
1141
- var entry, e_16;
1226
+ var entry, e_17;
1142
1227
  return __generator(this, function (_a) {
1143
1228
  switch (_a.label) {
1144
1229
  case 0:
@@ -1170,8 +1255,8 @@ function () {
1170
1255
  , null];
1171
1256
 
1172
1257
  case 3:
1173
- e_16 = _a.sent();
1174
- throw e_16;
1258
+ e_17 = _a.sent();
1259
+ throw e_17;
1175
1260
 
1176
1261
  case 4:
1177
1262
  return [2
@@ -1184,7 +1269,7 @@ function () {
1184
1269
 
1185
1270
  NCloudChat.prototype.getMessages = function (filter, sort, option) {
1186
1271
  return __awaiter(this, void 0, void 0, function () {
1187
- var entries, messages, e_17;
1272
+ var entries, messages, e_18;
1188
1273
 
1189
1274
  var _this = this;
1190
1275
 
@@ -1223,8 +1308,8 @@ function () {
1223
1308
  , entries];
1224
1309
 
1225
1310
  case 3:
1226
- e_17 = _a.sent();
1227
- throw e_17;
1311
+ e_18 = _a.sent();
1312
+ throw e_18;
1228
1313
 
1229
1314
  case 4:
1230
1315
  return [2
@@ -1237,7 +1322,7 @@ function () {
1237
1322
 
1238
1323
  NCloudChat.prototype.getSubscriptions = function (filter, sort, option) {
1239
1324
  return __awaiter(this, void 0, void 0, function () {
1240
- var entries, subscribes, e_18;
1325
+ var entries, subscribes, e_19;
1241
1326
 
1242
1327
  var _this = this;
1243
1328
 
@@ -1276,8 +1361,8 @@ function () {
1276
1361
  , entries];
1277
1362
 
1278
1363
  case 3:
1279
- e_18 = _a.sent();
1280
- throw e_18;
1364
+ e_19 = _a.sent();
1365
+ throw e_19;
1281
1366
 
1282
1367
  case 4:
1283
1368
  return [2
@@ -1290,7 +1375,7 @@ function () {
1290
1375
 
1291
1376
  NCloudChat.prototype.createChannel = function (channel) {
1292
1377
  return __awaiter(this, void 0, void 0, function () {
1293
- var e_19;
1378
+ var e_20;
1294
1379
  return __generator(this, function (_a) {
1295
1380
  switch (_a.label) {
1296
1381
  case 0:
@@ -1313,8 +1398,8 @@ function () {
1313
1398
  , _a.sent()];
1314
1399
 
1315
1400
  case 3:
1316
- e_19 = _a.sent();
1317
- throw e_19;
1401
+ e_20 = _a.sent();
1402
+ throw e_20;
1318
1403
 
1319
1404
  case 4:
1320
1405
  return [2
@@ -1327,7 +1412,7 @@ function () {
1327
1412
 
1328
1413
  NCloudChat.prototype.updateChannel = function (channelId, channel) {
1329
1414
  return __awaiter(this, void 0, void 0, function () {
1330
- var e_20;
1415
+ var e_21;
1331
1416
  return __generator(this, function (_a) {
1332
1417
  switch (_a.label) {
1333
1418
  case 0:
@@ -1350,8 +1435,8 @@ function () {
1350
1435
  , _a.sent()];
1351
1436
 
1352
1437
  case 3:
1353
- e_20 = _a.sent();
1354
- throw e_20;
1438
+ e_21 = _a.sent();
1439
+ throw e_21;
1355
1440
 
1356
1441
  case 4:
1357
1442
  return [2
@@ -1364,7 +1449,7 @@ function () {
1364
1449
 
1365
1450
  NCloudChat.prototype.deleteChannel = function (channelId) {
1366
1451
  return __awaiter(this, void 0, void 0, function () {
1367
- var e_21;
1452
+ var e_22;
1368
1453
  return __generator(this, function (_a) {
1369
1454
  switch (_a.label) {
1370
1455
  case 0:
@@ -1387,8 +1472,8 @@ function () {
1387
1472
  , _a.sent()];
1388
1473
 
1389
1474
  case 3:
1390
- e_21 = _a.sent();
1391
- throw e_21;
1475
+ e_22 = _a.sent();
1476
+ throw e_22;
1392
1477
 
1393
1478
  case 4:
1394
1479
  return [2
@@ -1399,9 +1484,13 @@ function () {
1399
1484
  });
1400
1485
  };
1401
1486
 
1402
- NCloudChat.prototype.markRead = function (channelId, mark) {
1487
+ NCloudChat.prototype.markRead = function (channelId, mark, option) {
1488
+ if (option === void 0) {
1489
+ option = null;
1490
+ }
1491
+
1403
1492
  return __awaiter(this, void 0, void 0, function () {
1404
- var e_22;
1493
+ var e_23;
1405
1494
  return __generator(this, function (_a) {
1406
1495
  switch (_a.label) {
1407
1496
  case 0:
@@ -1416,7 +1505,7 @@ function () {
1416
1505
 
1417
1506
  return [4
1418
1507
  /*yield*/
1419
- , (0, _mutations.updateSubscription)(channelId, mark)];
1508
+ , (0, _mutations.updateSubscription)(channelId, mark, (0, _stringify["default"])(option))];
1420
1509
 
1421
1510
  case 2:
1422
1511
  return [2
@@ -1424,8 +1513,8 @@ function () {
1424
1513
  , _a.sent()];
1425
1514
 
1426
1515
  case 3:
1427
- e_22 = _a.sent();
1428
- throw e_22;
1516
+ e_23 = _a.sent();
1517
+ throw e_23;
1429
1518
 
1430
1519
  case 4:
1431
1520
  return [2
@@ -1436,6 +1525,150 @@ function () {
1436
1525
  });
1437
1526
  };
1438
1527
 
1528
+ NCloudChat.prototype.addMembers = function (channelId, memberIds, options) {
1529
+ return __awaiter(this, void 0, void 0, function () {
1530
+ var input, e_24;
1531
+ return __generator(this, function (_a) {
1532
+ switch (_a.label) {
1533
+ case 0:
1534
+ if (!this.isConnected()) {
1535
+ throw Error("You are not connected.");
1536
+ }
1537
+
1538
+ _a.label = 1;
1539
+
1540
+ case 1:
1541
+ _a.trys.push([1, 3,, 4]);
1542
+
1543
+ input = {
1544
+ members: memberIds
1545
+ };
1546
+ return [4
1547
+ /*yield*/
1548
+ , (0, _mutations.addChannelMembers)(channelId, memberIds, options)];
1549
+
1550
+ case 2:
1551
+ return [2
1552
+ /*return*/
1553
+ , _a.sent()];
1554
+
1555
+ case 3:
1556
+ e_24 = _a.sent();
1557
+ throw e_24;
1558
+
1559
+ case 4:
1560
+ return [2
1561
+ /*return*/
1562
+ ];
1563
+ }
1564
+ });
1565
+ });
1566
+ };
1567
+
1568
+ NCloudChat.prototype.removeMembers = function (channelId, memberIds, options) {
1569
+ return __awaiter(this, void 0, void 0, function () {
1570
+ var e_25;
1571
+ return __generator(this, function (_a) {
1572
+ switch (_a.label) {
1573
+ case 0:
1574
+ if (!this.isConnected()) {
1575
+ throw Error("You are not connected.");
1576
+ }
1577
+
1578
+ _a.label = 1;
1579
+
1580
+ case 1:
1581
+ _a.trys.push([1, 4,, 5]);
1582
+
1583
+ return [4
1584
+ /*yield*/
1585
+ , (0, _mutations.removeChannelMembers)(channelId, memberIds, options)];
1586
+
1587
+ case 2:
1588
+ return [4
1589
+ /*yield*/
1590
+ , _a.sent()];
1591
+
1592
+ case 3:
1593
+ return [2
1594
+ /*return*/
1595
+ , _a.sent()];
1596
+
1597
+ case 4:
1598
+ e_25 = _a.sent();
1599
+ throw e_25;
1600
+
1601
+ case 5:
1602
+ return [2
1603
+ /*return*/
1604
+ ];
1605
+ }
1606
+ });
1607
+ });
1608
+ };
1609
+
1610
+ NCloudChat.prototype.startTyping = function (channelId, threadId) {
1611
+ if (threadId === void 0) {
1612
+ threadId = "";
1613
+ }
1614
+
1615
+ return __awaiter(this, void 0, void 0, function () {
1616
+ var data;
1617
+ return __generator(this, function (_a) {
1618
+ if (!this.isConnected()) {
1619
+ throw Error("You are not connected.");
1620
+ }
1621
+
1622
+ try {
1623
+ data = {
1624
+ channelId: channelId,
1625
+ threadId: threadId
1626
+ };
1627
+ return [2
1628
+ /*return*/
1629
+ , this.socket.emit("start typing", data)];
1630
+ } catch (e) {
1631
+ throw e;
1632
+ }
1633
+
1634
+ return [2
1635
+ /*return*/
1636
+ ];
1637
+ });
1638
+ });
1639
+ };
1640
+
1641
+ NCloudChat.prototype.stopTyping = function (channelId, threadId) {
1642
+ if (threadId === void 0) {
1643
+ threadId = "";
1644
+ }
1645
+
1646
+ return __awaiter(this, void 0, void 0, function () {
1647
+ var data;
1648
+ return __generator(this, function (_a) {
1649
+ if (!this.isConnected()) {
1650
+ throw Error("You are not connected.");
1651
+ }
1652
+
1653
+ try {
1654
+ data = {
1655
+ channelId: channelId,
1656
+ threadId: threadId
1657
+ };
1658
+ return [2
1659
+ /*return*/
1660
+ , this.socket.emit("stop typing", data)];
1661
+ } catch (e) {
1662
+ throw e;
1663
+ }
1664
+
1665
+ return [2
1666
+ /*return*/
1667
+ ];
1668
+ });
1669
+ });
1670
+ };
1671
+
1439
1672
  return NCloudChat;
1440
1673
  }();
1441
1674