stream-chat 5.2.0 → 5.6.0

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.
@@ -753,7 +753,8 @@ var EVENT_MAP = {
753
753
  'user.watching.stop': true,
754
754
  // local events
755
755
  'connection.changed': true,
756
- 'connection.recovered': true
756
+ 'connection.recovered': true,
757
+ 'transport.changed': true
757
758
  };
758
759
 
759
760
  var IS_VALID_EVENT_MAP_TYPE = _objectSpread$6(_objectSpread$6({}, EVENT_MAP), {}, {
@@ -1678,6 +1679,8 @@ var Channel = /*#__PURE__*/function () {
1678
1679
  /**
1679
1680
  * delete - Delete the channel. Messages are permanently removed.
1680
1681
  *
1682
+ * @param {boolean} [options.hard_delete] Defines if the channel is hard deleted or not
1683
+ *
1681
1684
  * @return {Promise<DeleteChannelAPIResponse<ChannelType, CommandType, UserType>>} The server response
1682
1685
  */
1683
1686
 
@@ -1685,17 +1688,20 @@ var Channel = /*#__PURE__*/function () {
1685
1688
  key: "delete",
1686
1689
  value: function () {
1687
1690
  var _delete2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee11() {
1691
+ var options,
1692
+ _args11 = arguments;
1688
1693
  return _regeneratorRuntime.wrap(function _callee11$(_context11) {
1689
1694
  while (1) {
1690
1695
  switch (_context11.prev = _context11.next) {
1691
1696
  case 0:
1692
- _context11.next = 2;
1693
- return this.getClient().delete(this._channelURL(), {});
1697
+ options = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {};
1698
+ _context11.next = 3;
1699
+ return this.getClient().delete(this._channelURL(), _objectSpread$5({}, options));
1694
1700
 
1695
- case 2:
1701
+ case 3:
1696
1702
  return _context11.abrupt("return", _context11.sent);
1697
1703
 
1698
- case 3:
1704
+ case 4:
1699
1705
  case "end":
1700
1706
  return _context11.stop();
1701
1707
  }
@@ -2682,6 +2688,7 @@ var Channel = /*#__PURE__*/function () {
2682
2688
 
2683
2689
  if (message.shadowed) return false;
2684
2690
  if (message.silent) return false;
2691
+ if (message.parent_id && !message.show_in_channel) return false;
2685
2692
  if (((_message$user = message.user) === null || _message$user === void 0 ? void 0 : _message$user.id) === this.getClient().userID) return false;
2686
2693
  if ((_message$user2 = message.user) !== null && _message$user2 !== void 0 && _message$user2.id && this.getClient().userMuteStatus(message.user.id)) return false;
2687
2694
  if (message.type === 'system') return false;
@@ -3193,7 +3200,8 @@ var Channel = /*#__PURE__*/function () {
3193
3200
  channelState.read[event.user.id] = {
3194
3201
  // because in client.ts the handleEvent call that flows to this sets this `event.received_at = new Date();`
3195
3202
  last_read: event.received_at,
3196
- user: event.user
3203
+ user: event.user,
3204
+ unread_messages: 0
3197
3205
  };
3198
3206
 
3199
3207
  if (((_event$user4 = event.user) === null || _event$user4 === void 0 ? void 0 : _event$user4.id) === ((_this$getClient$user = this.getClient().user) === null || _this$getClient$user === void 0 ? void 0 : _this$getClient$user.id)) {
@@ -3250,7 +3258,8 @@ var Channel = /*#__PURE__*/function () {
3250
3258
  channelState.unreadCount = 0;
3251
3259
  channelState.read[event.user.id] = {
3252
3260
  last_read: new Date(event.created_at),
3253
- user: event.user
3261
+ user: event.user,
3262
+ unread_messages: 0
3254
3263
  };
3255
3264
  } else if (this._countMessageAsUnread(event.message)) {
3256
3265
  channelState.unreadCount = channelState.unreadCount + 1;
@@ -3429,7 +3438,8 @@ var Channel = /*#__PURE__*/function () {
3429
3438
  if (user) {
3430
3439
  this.state.read[user.id] = {
3431
3440
  user: user,
3432
- last_read: last_read
3441
+ last_read: last_read,
3442
+ unread_messages: 0
3433
3443
  };
3434
3444
  }
3435
3445
  } // apply read state if part of the state
@@ -3441,16 +3451,17 @@ var Channel = /*#__PURE__*/function () {
3441
3451
 
3442
3452
  try {
3443
3453
  for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
3444
- var read = _step3.value;
3445
-
3446
- var parsedRead = _objectSpread$5(_objectSpread$5({}, read), {}, {
3447
- last_read: new Date(read.last_read)
3448
- });
3454
+ var _read$unread_messages;
3449
3455
 
3450
- this.state.read[read.user.id] = parsedRead;
3456
+ var read = _step3.value;
3457
+ this.state.read[read.user.id] = {
3458
+ last_read: new Date(read.last_read),
3459
+ unread_messages: (_read$unread_messages = read.unread_messages) !== null && _read$unread_messages !== void 0 ? _read$unread_messages : 0,
3460
+ user: read.user
3461
+ };
3451
3462
 
3452
- if (read.user.id === (user === null || user === void 0 ? void 0 : user.id) && typeof parsedRead.unread_messages === 'number') {
3453
- this.state.unreadCount = parsedRead.unread_messages;
3463
+ if (read.user.id === (user === null || user === void 0 ? void 0 : user.id)) {
3464
+ this.state.unreadCount = this.state.read[read.user.id].unread_messages;
3454
3465
  }
3455
3466
  }
3456
3467
  } catch (err) {
@@ -3802,6 +3813,12 @@ var StableWSConnection = /*#__PURE__*/function () {
3802
3813
 
3803
3814
  _defineProperty(this, "onmessage", function (wsID, event) {
3804
3815
  if (_this.wsID !== wsID) return;
3816
+
3817
+ _this._log('onmessage() - onmessage callback', {
3818
+ event: event,
3819
+ wsID: wsID
3820
+ });
3821
+
3805
3822
  var data = typeof event.data === 'string' ? JSON.parse(event.data) : null; // we wait till the first message before we consider the connection open..
3806
3823
  // the reason for this is that auth errors and similar errors trigger a ws.onopen and immediately
3807
3824
  // after that a ws.onclose..
@@ -3826,11 +3843,6 @@ var StableWSConnection = /*#__PURE__*/function () {
3826
3843
 
3827
3844
  _this.lastEvent = new Date();
3828
3845
 
3829
- _this._log('onmessage() - onmessage callback', {
3830
- event: event,
3831
- wsID: wsID
3832
- });
3833
-
3834
3846
  if (data && data.type === 'health.check') {
3835
3847
  _this.scheduleNextPing();
3836
3848
  }
@@ -4360,27 +4372,36 @@ var StableWSConnection = /*#__PURE__*/function () {
4360
4372
  this.requestID = randomId();
4361
4373
  this.client.insightMetrics.connectionStartTimestamp = new Date().getTime();
4362
4374
  _context5.prev = 5;
4363
- _context5.next = 8;
4375
+
4376
+ this._log("_connect() - waiting for token");
4377
+
4378
+ _context5.next = 9;
4364
4379
  return this.client.tokenManager.tokenReady();
4365
4380
 
4366
- case 8:
4381
+ case 9:
4367
4382
  this._setupConnectionPromise();
4368
4383
 
4369
4384
  wsURL = this._buildUrl();
4385
+
4386
+ this._log("_connect() - Connecting to ".concat(wsURL), {
4387
+ wsURL: wsURL,
4388
+ requestID: this.requestID
4389
+ });
4390
+
4370
4391
  this.ws = new WebSocket(wsURL);
4371
4392
  this.ws.onopen = this.onopen.bind(this, this.wsID);
4372
4393
  this.ws.onclose = this.onclose.bind(this, this.wsID);
4373
4394
  this.ws.onerror = this.onerror.bind(this, this.wsID);
4374
4395
  this.ws.onmessage = this.onmessage.bind(this, this.wsID);
4375
- _context5.next = 17;
4396
+ _context5.next = 19;
4376
4397
  return this.connectionOpen;
4377
4398
 
4378
- case 17:
4399
+ case 19:
4379
4400
  response = _context5.sent;
4380
4401
  this.isConnecting = false;
4381
4402
 
4382
4403
  if (!response) {
4383
- _context5.next = 23;
4404
+ _context5.next = 25;
4384
4405
  break;
4385
4406
  }
4386
4407
 
@@ -4393,12 +4414,12 @@ var StableWSConnection = /*#__PURE__*/function () {
4393
4414
 
4394
4415
  return _context5.abrupt("return", response);
4395
4416
 
4396
- case 23:
4397
- _context5.next = 30;
4417
+ case 25:
4418
+ _context5.next = 32;
4398
4419
  break;
4399
4420
 
4400
- case 25:
4401
- _context5.prev = 25;
4421
+ case 27:
4422
+ _context5.prev = 27;
4402
4423
  _context5.t0 = _context5["catch"](5);
4403
4424
  this.isConnecting = false;
4404
4425
 
@@ -4411,12 +4432,12 @@ var StableWSConnection = /*#__PURE__*/function () {
4411
4432
 
4412
4433
  throw _context5.t0;
4413
4434
 
4414
- case 30:
4435
+ case 32:
4415
4436
  case "end":
4416
4437
  return _context5.stop();
4417
4438
  }
4418
4439
  }
4419
- }, _callee5, this, [[5, 25]]);
4440
+ }, _callee5, this, [[5, 27]]);
4420
4441
  }));
4421
4442
 
4422
4443
  function _connect() {
@@ -5265,7 +5286,9 @@ var WSConnectionFallback = /*#__PURE__*/function () {
5265
5286
 
5266
5287
  _this._setState(ConnectionState.Connected);
5267
5288
 
5268
- _this.connectionID = event.connection_id;
5289
+ _this.connectionID = event.connection_id; // @ts-expect-error
5290
+
5291
+ _this.client.dispatchEvent(event);
5269
5292
 
5270
5293
  _this._poll();
5271
5294
 
@@ -5275,20 +5298,20 @@ var WSConnectionFallback = /*#__PURE__*/function () {
5275
5298
 
5276
5299
  return _context3.abrupt("return", event);
5277
5300
 
5278
- case 21:
5279
- _context3.prev = 21;
5301
+ case 22:
5302
+ _context3.prev = 22;
5280
5303
  _context3.t0 = _context3["catch"](9);
5281
5304
 
5282
5305
  _this._setState(ConnectionState.Closed);
5283
5306
 
5284
5307
  throw _context3.t0;
5285
5308
 
5286
- case 25:
5309
+ case 26:
5287
5310
  case "end":
5288
5311
  return _context3.stop();
5289
5312
  }
5290
5313
  }
5291
- }, _callee3, null, [[9, 21]]);
5314
+ }, _callee3, null, [[9, 22]]);
5292
5315
  })));
5293
5316
 
5294
5317
  _defineProperty(this, "isHealthy", function () {
@@ -6566,7 +6589,6 @@ var StreamChat = /*#__PURE__*/function () {
6566
6589
  apnTemplate: '{}', //if app doesn't have apn configured it will error
6567
6590
  firebaseTemplate: '{}', //if app doesn't have firebase configured it will error
6568
6591
  firebaseDataTemplate: '{}', //if app doesn't have firebase configured it will error
6569
- huaweiDataTemplate: '{}' //if app doesn't have huawei configured it will error
6570
6592
  skipDevices: true, // skip config/device checks and sending to real devices
6571
6593
  }
6572
6594
  */
@@ -6583,7 +6605,7 @@ var StreamChat = /*#__PURE__*/function () {
6583
6605
  case 0:
6584
6606
  data = _args12.length > 1 && _args12[1] !== undefined ? _args12[1] : {};
6585
6607
  _context12.next = 3;
6586
- return this.post(this.baseURL + '/check_push', _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
6608
+ return this.post(this.baseURL + '/check_push', _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
6587
6609
  user_id: userID
6588
6610
  }, data.messageID ? {
6589
6611
  message_id: data.messageID
@@ -6593,8 +6615,6 @@ var StreamChat = /*#__PURE__*/function () {
6593
6615
  firebase_template: data.firebaseTemplate
6594
6616
  } : {}), data.firebaseDataTemplate ? {
6595
6617
  firebase_data_template: data.firebaseDataTemplate
6596
- } : {}), data.huaweiDataTemplate ? {
6597
- huawei_data_template: data.huaweiDataTemplate
6598
6618
  } : {}), data.skipDevices ? {
6599
6619
  skip_devices: true
6600
6620
  } : {}));
@@ -8539,6 +8559,7 @@ var StreamChat = /*#__PURE__*/function () {
8539
8559
  * It is present for internal usage only.
8540
8560
  * This function can, and will, break and/or be removed at any point in time.
8541
8561
  *
8562
+ * @private
8542
8563
  * @param {FlagReportsFilters} filterConditions MongoDB style filter conditions
8543
8564
  * @param {FlagReportsPaginationOptions} options Option object, {limit: 10, offset:0}
8544
8565
  *
@@ -8587,6 +8608,7 @@ var StreamChat = /*#__PURE__*/function () {
8587
8608
  * It is present for internal usage only.
8588
8609
  * This function can, and will, break and/or be removed at any point in time.
8589
8610
  *
8611
+ * @private
8590
8612
  * @param {string} [id] flag report to review
8591
8613
  * @param {string} [reviewResult] flag report review result
8592
8614
  * @param {string} [options.user_id] currentUserID, only used with serverside auth
@@ -8627,6 +8649,52 @@ var StreamChat = /*#__PURE__*/function () {
8627
8649
 
8628
8650
  return _reviewFlagReport;
8629
8651
  }()
8652
+ /**
8653
+ * _unblockMessage - unblocks message blocked by automod
8654
+ *
8655
+ * Note: Do not use this.
8656
+ * It is present for internal usage only.
8657
+ * This function can, and will, break and/or be removed at any point in time.
8658
+ *
8659
+ * @private
8660
+ * @param {string} targetMessageID
8661
+ * @param {string} [options.user_id] currentUserID, only used with serverside auth
8662
+ * @returns {Promise<APIResponse>}
8663
+ */
8664
+
8665
+ }, {
8666
+ key: "_unblockMessage",
8667
+ value: function () {
8668
+ var _unblockMessage2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee44(targetMessageID) {
8669
+ var options,
8670
+ _args44 = arguments;
8671
+ return _regeneratorRuntime.wrap(function _callee44$(_context44) {
8672
+ while (1) {
8673
+ switch (_context44.prev = _context44.next) {
8674
+ case 0:
8675
+ options = _args44.length > 1 && _args44[1] !== undefined ? _args44[1] : {};
8676
+ _context44.next = 3;
8677
+ return this.post(this.baseURL + '/moderation/unblock_message', _objectSpread({
8678
+ target_message_id: targetMessageID
8679
+ }, options));
8680
+
8681
+ case 3:
8682
+ return _context44.abrupt("return", _context44.sent);
8683
+
8684
+ case 4:
8685
+ case "end":
8686
+ return _context44.stop();
8687
+ }
8688
+ }
8689
+ }, _callee44, this);
8690
+ }));
8691
+
8692
+ function _unblockMessage(_x56) {
8693
+ return _unblockMessage2.apply(this, arguments);
8694
+ }
8695
+
8696
+ return _unblockMessage;
8697
+ }()
8630
8698
  /**
8631
8699
  * @deprecated use markChannelsRead instead
8632
8700
  *
@@ -8648,23 +8716,23 @@ var StreamChat = /*#__PURE__*/function () {
8648
8716
  * @return {Promise<APIResponse>}
8649
8717
  */
8650
8718
  function () {
8651
- var _markChannelsRead = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee44() {
8719
+ var _markChannelsRead = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee45() {
8652
8720
  var data,
8653
- _args44 = arguments;
8654
- return _regeneratorRuntime.wrap(function _callee44$(_context44) {
8721
+ _args45 = arguments;
8722
+ return _regeneratorRuntime.wrap(function _callee45$(_context45) {
8655
8723
  while (1) {
8656
- switch (_context44.prev = _context44.next) {
8724
+ switch (_context45.prev = _context45.next) {
8657
8725
  case 0:
8658
- data = _args44.length > 0 && _args44[0] !== undefined ? _args44[0] : {};
8659
- _context44.next = 3;
8726
+ data = _args45.length > 0 && _args45[0] !== undefined ? _args45[0] : {};
8727
+ _context45.next = 3;
8660
8728
  return this.post(this.baseURL + '/channels/read', _objectSpread({}, data));
8661
8729
 
8662
8730
  case 3:
8663
8731
  case "end":
8664
- return _context44.stop();
8732
+ return _context45.stop();
8665
8733
  }
8666
8734
  }
8667
- }, _callee44, this);
8735
+ }, _callee45, this);
8668
8736
  }));
8669
8737
 
8670
8738
  function markChannelsRead() {
@@ -8739,28 +8807,28 @@ var StreamChat = /*#__PURE__*/function () {
8739
8807
  }, {
8740
8808
  key: "translateMessage",
8741
8809
  value: function () {
8742
- var _translateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee45(messageId, language) {
8743
- return _regeneratorRuntime.wrap(function _callee45$(_context45) {
8810
+ var _translateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee46(messageId, language) {
8811
+ return _regeneratorRuntime.wrap(function _callee46$(_context46) {
8744
8812
  while (1) {
8745
- switch (_context45.prev = _context45.next) {
8813
+ switch (_context46.prev = _context46.next) {
8746
8814
  case 0:
8747
- _context45.next = 2;
8815
+ _context46.next = 2;
8748
8816
  return this.post(this.baseURL + "/messages/".concat(messageId, "/translate"), {
8749
8817
  language: language
8750
8818
  });
8751
8819
 
8752
8820
  case 2:
8753
- return _context45.abrupt("return", _context45.sent);
8821
+ return _context46.abrupt("return", _context46.sent);
8754
8822
 
8755
8823
  case 3:
8756
8824
  case "end":
8757
- return _context45.stop();
8825
+ return _context46.stop();
8758
8826
  }
8759
8827
  }
8760
- }, _callee45, this);
8828
+ }, _callee46, this);
8761
8829
  }));
8762
8830
 
8763
- function translateMessage(_x56, _x57) {
8831
+ function translateMessage(_x57, _x58) {
8764
8832
  return _translateMessage.apply(this, arguments);
8765
8833
  }
8766
8834
 
@@ -8862,14 +8930,14 @@ var StreamChat = /*#__PURE__*/function () {
8862
8930
  }, {
8863
8931
  key: "updateMessage",
8864
8932
  value: function () {
8865
- var _updateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee46(message, userId, options) {
8933
+ var _updateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee47(message, userId, options) {
8866
8934
  var clonedMessage, reservedMessageFields;
8867
- return _regeneratorRuntime.wrap(function _callee46$(_context46) {
8935
+ return _regeneratorRuntime.wrap(function _callee47$(_context47) {
8868
8936
  while (1) {
8869
- switch (_context46.prev = _context46.next) {
8937
+ switch (_context47.prev = _context47.next) {
8870
8938
  case 0:
8871
8939
  if (message.id) {
8872
- _context46.next = 2;
8940
+ _context47.next = 2;
8873
8941
  break;
8874
8942
  }
8875
8943
 
@@ -8906,23 +8974,23 @@ var StreamChat = /*#__PURE__*/function () {
8906
8974
  });
8907
8975
  }
8908
8976
 
8909
- _context46.next = 10;
8977
+ _context47.next = 10;
8910
8978
  return this.post(this.baseURL + "/messages/".concat(message.id), _objectSpread({
8911
8979
  message: clonedMessage
8912
8980
  }, options));
8913
8981
 
8914
8982
  case 10:
8915
- return _context46.abrupt("return", _context46.sent);
8983
+ return _context47.abrupt("return", _context47.sent);
8916
8984
 
8917
8985
  case 11:
8918
8986
  case "end":
8919
- return _context46.stop();
8987
+ return _context47.stop();
8920
8988
  }
8921
8989
  }
8922
- }, _callee46, this);
8990
+ }, _callee47, this);
8923
8991
  }));
8924
8992
 
8925
- function updateMessage(_x58, _x59, _x60) {
8993
+ function updateMessage(_x59, _x60, _x61) {
8926
8994
  return _updateMessage.apply(this, arguments);
8927
8995
  }
8928
8996
 
@@ -8945,14 +9013,14 @@ var StreamChat = /*#__PURE__*/function () {
8945
9013
  }, {
8946
9014
  key: "partialUpdateMessage",
8947
9015
  value: function () {
8948
- var _partialUpdateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee47(id, partialMessageObject, userId, options) {
9016
+ var _partialUpdateMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee48(id, partialMessageObject, userId, options) {
8949
9017
  var user;
8950
- return _regeneratorRuntime.wrap(function _callee47$(_context47) {
9018
+ return _regeneratorRuntime.wrap(function _callee48$(_context48) {
8951
9019
  while (1) {
8952
- switch (_context47.prev = _context47.next) {
9020
+ switch (_context48.prev = _context48.next) {
8953
9021
  case 0:
8954
9022
  if (id) {
8955
- _context47.next = 2;
9023
+ _context48.next = 2;
8956
9024
  break;
8957
9025
  }
8958
9026
 
@@ -8967,23 +9035,23 @@ var StreamChat = /*#__PURE__*/function () {
8967
9035
  };
8968
9036
  }
8969
9037
 
8970
- _context47.next = 6;
9038
+ _context48.next = 6;
8971
9039
  return this.put(this.baseURL + "/messages/".concat(id), _objectSpread(_objectSpread(_objectSpread({}, partialMessageObject), options), {}, {
8972
9040
  user: user
8973
9041
  }));
8974
9042
 
8975
9043
  case 6:
8976
- return _context47.abrupt("return", _context47.sent);
9044
+ return _context48.abrupt("return", _context48.sent);
8977
9045
 
8978
9046
  case 7:
8979
9047
  case "end":
8980
- return _context47.stop();
9048
+ return _context48.stop();
8981
9049
  }
8982
9050
  }
8983
- }, _callee47, this);
9051
+ }, _callee48, this);
8984
9052
  }));
8985
9053
 
8986
- function partialUpdateMessage(_x61, _x62, _x63, _x64) {
9054
+ function partialUpdateMessage(_x62, _x63, _x64, _x65) {
8987
9055
  return _partialUpdateMessage.apply(this, arguments);
8988
9056
  }
8989
9057
 
@@ -8992,11 +9060,11 @@ var StreamChat = /*#__PURE__*/function () {
8992
9060
  }, {
8993
9061
  key: "deleteMessage",
8994
9062
  value: function () {
8995
- var _deleteMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee48(messageID, hardDelete) {
9063
+ var _deleteMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee49(messageID, hardDelete) {
8996
9064
  var params;
8997
- return _regeneratorRuntime.wrap(function _callee48$(_context48) {
9065
+ return _regeneratorRuntime.wrap(function _callee49$(_context49) {
8998
9066
  while (1) {
8999
- switch (_context48.prev = _context48.next) {
9067
+ switch (_context49.prev = _context49.next) {
9000
9068
  case 0:
9001
9069
  params = {};
9002
9070
 
@@ -9006,21 +9074,21 @@ var StreamChat = /*#__PURE__*/function () {
9006
9074
  };
9007
9075
  }
9008
9076
 
9009
- _context48.next = 4;
9077
+ _context49.next = 4;
9010
9078
  return this.delete(this.baseURL + "/messages/".concat(messageID), params);
9011
9079
 
9012
9080
  case 4:
9013
- return _context48.abrupt("return", _context48.sent);
9081
+ return _context49.abrupt("return", _context49.sent);
9014
9082
 
9015
9083
  case 5:
9016
9084
  case "end":
9017
- return _context48.stop();
9085
+ return _context49.stop();
9018
9086
  }
9019
9087
  }
9020
- }, _callee48, this);
9088
+ }, _callee49, this);
9021
9089
  }));
9022
9090
 
9023
- function deleteMessage(_x65, _x66) {
9091
+ function deleteMessage(_x66, _x67) {
9024
9092
  return _deleteMessage.apply(this, arguments);
9025
9093
  }
9026
9094
 
@@ -9029,26 +9097,26 @@ var StreamChat = /*#__PURE__*/function () {
9029
9097
  }, {
9030
9098
  key: "getMessage",
9031
9099
  value: function () {
9032
- var _getMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee49(messageID) {
9033
- return _regeneratorRuntime.wrap(function _callee49$(_context49) {
9100
+ var _getMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee50(messageID) {
9101
+ return _regeneratorRuntime.wrap(function _callee50$(_context50) {
9034
9102
  while (1) {
9035
- switch (_context49.prev = _context49.next) {
9103
+ switch (_context50.prev = _context50.next) {
9036
9104
  case 0:
9037
- _context49.next = 2;
9105
+ _context50.next = 2;
9038
9106
  return this.get(this.baseURL + "/messages/".concat(messageID));
9039
9107
 
9040
9108
  case 2:
9041
- return _context49.abrupt("return", _context49.sent);
9109
+ return _context50.abrupt("return", _context50.sent);
9042
9110
 
9043
9111
  case 3:
9044
9112
  case "end":
9045
- return _context49.stop();
9113
+ return _context50.stop();
9046
9114
  }
9047
9115
  }
9048
- }, _callee49, this);
9116
+ }, _callee50, this);
9049
9117
  }));
9050
9118
 
9051
- function getMessage(_x67) {
9119
+ function getMessage(_x68) {
9052
9120
  return _getMessage.apply(this, arguments);
9053
9121
  }
9054
9122
 
@@ -9057,7 +9125,7 @@ var StreamChat = /*#__PURE__*/function () {
9057
9125
  }, {
9058
9126
  key: "getUserAgent",
9059
9127
  value: function getUserAgent() {
9060
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "5.2.0");
9128
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "5.6.0");
9061
9129
  }
9062
9130
  }, {
9063
9131
  key: "setUserAgent",
@@ -9252,28 +9320,28 @@ var StreamChat = /*#__PURE__*/function () {
9252
9320
  }, {
9253
9321
  key: "sendUserCustomEvent",
9254
9322
  value: function () {
9255
- var _sendUserCustomEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee50(targetUserID, event) {
9256
- return _regeneratorRuntime.wrap(function _callee50$(_context50) {
9323
+ var _sendUserCustomEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee51(targetUserID, event) {
9324
+ return _regeneratorRuntime.wrap(function _callee51$(_context51) {
9257
9325
  while (1) {
9258
- switch (_context50.prev = _context50.next) {
9326
+ switch (_context51.prev = _context51.next) {
9259
9327
  case 0:
9260
- _context50.next = 2;
9328
+ _context51.next = 2;
9261
9329
  return this.post("".concat(this.baseURL, "/users/").concat(targetUserID, "/event"), {
9262
9330
  event: event
9263
9331
  });
9264
9332
 
9265
9333
  case 2:
9266
- return _context50.abrupt("return", _context50.sent);
9334
+ return _context51.abrupt("return", _context51.sent);
9267
9335
 
9268
9336
  case 3:
9269
9337
  case "end":
9270
- return _context50.stop();
9338
+ return _context51.stop();
9271
9339
  }
9272
9340
  }
9273
- }, _callee50, this);
9341
+ }, _callee51, this);
9274
9342
  }));
9275
9343
 
9276
- function sendUserCustomEvent(_x68, _x69) {
9344
+ function sendUserCustomEvent(_x69, _x70) {
9277
9345
  return _sendUserCustomEvent.apply(this, arguments);
9278
9346
  }
9279
9347
 
@@ -9341,32 +9409,32 @@ var StreamChat = /*#__PURE__*/function () {
9341
9409
  }, {
9342
9410
  key: "createSegment",
9343
9411
  value: function () {
9344
- var _createSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee51(params) {
9412
+ var _createSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee52(params) {
9345
9413
  var _yield$this$post, segment;
9346
9414
 
9347
- return _regeneratorRuntime.wrap(function _callee51$(_context51) {
9415
+ return _regeneratorRuntime.wrap(function _callee52$(_context52) {
9348
9416
  while (1) {
9349
- switch (_context51.prev = _context51.next) {
9417
+ switch (_context52.prev = _context52.next) {
9350
9418
  case 0:
9351
- _context51.next = 2;
9419
+ _context52.next = 2;
9352
9420
  return this.post(this.baseURL + "/segments", {
9353
9421
  segment: params
9354
9422
  });
9355
9423
 
9356
9424
  case 2:
9357
- _yield$this$post = _context51.sent;
9425
+ _yield$this$post = _context52.sent;
9358
9426
  segment = _yield$this$post.segment;
9359
- return _context51.abrupt("return", segment);
9427
+ return _context52.abrupt("return", segment);
9360
9428
 
9361
9429
  case 5:
9362
9430
  case "end":
9363
- return _context51.stop();
9431
+ return _context52.stop();
9364
9432
  }
9365
9433
  }
9366
- }, _callee51, this);
9434
+ }, _callee52, this);
9367
9435
  }));
9368
9436
 
9369
- function createSegment(_x70) {
9437
+ function createSegment(_x71) {
9370
9438
  return _createSegment.apply(this, arguments);
9371
9439
  }
9372
9440
 
@@ -9383,30 +9451,30 @@ var StreamChat = /*#__PURE__*/function () {
9383
9451
  }, {
9384
9452
  key: "getSegment",
9385
9453
  value: function () {
9386
- var _getSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee52(id) {
9454
+ var _getSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee53(id) {
9387
9455
  var _yield$this$get, segment;
9388
9456
 
9389
- return _regeneratorRuntime.wrap(function _callee52$(_context52) {
9457
+ return _regeneratorRuntime.wrap(function _callee53$(_context53) {
9390
9458
  while (1) {
9391
- switch (_context52.prev = _context52.next) {
9459
+ switch (_context53.prev = _context53.next) {
9392
9460
  case 0:
9393
- _context52.next = 2;
9461
+ _context53.next = 2;
9394
9462
  return this.get(this.baseURL + "/segments/".concat(id));
9395
9463
 
9396
9464
  case 2:
9397
- _yield$this$get = _context52.sent;
9465
+ _yield$this$get = _context53.sent;
9398
9466
  segment = _yield$this$get.segment;
9399
- return _context52.abrupt("return", segment);
9467
+ return _context53.abrupt("return", segment);
9400
9468
 
9401
9469
  case 5:
9402
9470
  case "end":
9403
- return _context52.stop();
9471
+ return _context53.stop();
9404
9472
  }
9405
9473
  }
9406
- }, _callee52, this);
9474
+ }, _callee53, this);
9407
9475
  }));
9408
9476
 
9409
- function getSegment(_x71) {
9477
+ function getSegment(_x72) {
9410
9478
  return _getSegment.apply(this, arguments);
9411
9479
  }
9412
9480
 
@@ -9422,30 +9490,30 @@ var StreamChat = /*#__PURE__*/function () {
9422
9490
  }, {
9423
9491
  key: "listSegments",
9424
9492
  value: function () {
9425
- var _listSegments = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee53(options) {
9493
+ var _listSegments = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee54(options) {
9426
9494
  var _yield$this$get2, segments;
9427
9495
 
9428
- return _regeneratorRuntime.wrap(function _callee53$(_context53) {
9496
+ return _regeneratorRuntime.wrap(function _callee54$(_context54) {
9429
9497
  while (1) {
9430
- switch (_context53.prev = _context53.next) {
9498
+ switch (_context54.prev = _context54.next) {
9431
9499
  case 0:
9432
- _context53.next = 2;
9500
+ _context54.next = 2;
9433
9501
  return this.get(this.baseURL + "/segments", options);
9434
9502
 
9435
9503
  case 2:
9436
- _yield$this$get2 = _context53.sent;
9504
+ _yield$this$get2 = _context54.sent;
9437
9505
  segments = _yield$this$get2.segments;
9438
- return _context53.abrupt("return", segments);
9506
+ return _context54.abrupt("return", segments);
9439
9507
 
9440
9508
  case 5:
9441
9509
  case "end":
9442
- return _context53.stop();
9510
+ return _context54.stop();
9443
9511
  }
9444
9512
  }
9445
- }, _callee53, this);
9513
+ }, _callee54, this);
9446
9514
  }));
9447
9515
 
9448
- function listSegments(_x72) {
9516
+ function listSegments(_x73) {
9449
9517
  return _listSegments.apply(this, arguments);
9450
9518
  }
9451
9519
 
@@ -9463,32 +9531,32 @@ var StreamChat = /*#__PURE__*/function () {
9463
9531
  }, {
9464
9532
  key: "updateSegment",
9465
9533
  value: function () {
9466
- var _updateSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee54(id, params) {
9534
+ var _updateSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee55(id, params) {
9467
9535
  var _yield$this$put, segment;
9468
9536
 
9469
- return _regeneratorRuntime.wrap(function _callee54$(_context54) {
9537
+ return _regeneratorRuntime.wrap(function _callee55$(_context55) {
9470
9538
  while (1) {
9471
- switch (_context54.prev = _context54.next) {
9539
+ switch (_context55.prev = _context55.next) {
9472
9540
  case 0:
9473
- _context54.next = 2;
9541
+ _context55.next = 2;
9474
9542
  return this.put(this.baseURL + "/segments/".concat(id), {
9475
9543
  segment: params
9476
9544
  });
9477
9545
 
9478
9546
  case 2:
9479
- _yield$this$put = _context54.sent;
9547
+ _yield$this$put = _context55.sent;
9480
9548
  segment = _yield$this$put.segment;
9481
- return _context54.abrupt("return", segment);
9549
+ return _context55.abrupt("return", segment);
9482
9550
 
9483
9551
  case 5:
9484
9552
  case "end":
9485
- return _context54.stop();
9553
+ return _context55.stop();
9486
9554
  }
9487
9555
  }
9488
- }, _callee54, this);
9556
+ }, _callee55, this);
9489
9557
  }));
9490
9558
 
9491
- function updateSegment(_x73, _x74) {
9559
+ function updateSegment(_x74, _x75) {
9492
9560
  return _updateSegment.apply(this, arguments);
9493
9561
  }
9494
9562
 
@@ -9505,22 +9573,22 @@ var StreamChat = /*#__PURE__*/function () {
9505
9573
  }, {
9506
9574
  key: "deleteSegment",
9507
9575
  value: function () {
9508
- var _deleteSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee55(id) {
9509
- return _regeneratorRuntime.wrap(function _callee55$(_context55) {
9576
+ var _deleteSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee56(id) {
9577
+ return _regeneratorRuntime.wrap(function _callee56$(_context56) {
9510
9578
  while (1) {
9511
- switch (_context55.prev = _context55.next) {
9579
+ switch (_context56.prev = _context56.next) {
9512
9580
  case 0:
9513
- return _context55.abrupt("return", this.delete(this.baseURL + "/segments/".concat(id)));
9581
+ return _context56.abrupt("return", this.delete(this.baseURL + "/segments/".concat(id)));
9514
9582
 
9515
9583
  case 1:
9516
9584
  case "end":
9517
- return _context55.stop();
9585
+ return _context56.stop();
9518
9586
  }
9519
9587
  }
9520
- }, _callee55, this);
9588
+ }, _callee56, this);
9521
9589
  }));
9522
9590
 
9523
- function deleteSegment(_x75) {
9591
+ function deleteSegment(_x76) {
9524
9592
  return _deleteSegment.apply(this, arguments);
9525
9593
  }
9526
9594
 
@@ -9537,32 +9605,32 @@ var StreamChat = /*#__PURE__*/function () {
9537
9605
  }, {
9538
9606
  key: "createCampaign",
9539
9607
  value: function () {
9540
- var _createCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee56(params) {
9608
+ var _createCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee57(params) {
9541
9609
  var _yield$this$post2, campaign;
9542
9610
 
9543
- return _regeneratorRuntime.wrap(function _callee56$(_context56) {
9611
+ return _regeneratorRuntime.wrap(function _callee57$(_context57) {
9544
9612
  while (1) {
9545
- switch (_context56.prev = _context56.next) {
9613
+ switch (_context57.prev = _context57.next) {
9546
9614
  case 0:
9547
- _context56.next = 2;
9615
+ _context57.next = 2;
9548
9616
  return this.post(this.baseURL + "/campaigns", {
9549
9617
  campaign: params
9550
9618
  });
9551
9619
 
9552
9620
  case 2:
9553
- _yield$this$post2 = _context56.sent;
9621
+ _yield$this$post2 = _context57.sent;
9554
9622
  campaign = _yield$this$post2.campaign;
9555
- return _context56.abrupt("return", campaign);
9623
+ return _context57.abrupt("return", campaign);
9556
9624
 
9557
9625
  case 5:
9558
9626
  case "end":
9559
- return _context56.stop();
9627
+ return _context57.stop();
9560
9628
  }
9561
9629
  }
9562
- }, _callee56, this);
9630
+ }, _callee57, this);
9563
9631
  }));
9564
9632
 
9565
- function createCampaign(_x76) {
9633
+ function createCampaign(_x77) {
9566
9634
  return _createCampaign.apply(this, arguments);
9567
9635
  }
9568
9636
 
@@ -9579,30 +9647,30 @@ var StreamChat = /*#__PURE__*/function () {
9579
9647
  }, {
9580
9648
  key: "getCampaign",
9581
9649
  value: function () {
9582
- var _getCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee57(id) {
9650
+ var _getCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee58(id) {
9583
9651
  var _yield$this$get3, campaign;
9584
9652
 
9585
- return _regeneratorRuntime.wrap(function _callee57$(_context57) {
9653
+ return _regeneratorRuntime.wrap(function _callee58$(_context58) {
9586
9654
  while (1) {
9587
- switch (_context57.prev = _context57.next) {
9655
+ switch (_context58.prev = _context58.next) {
9588
9656
  case 0:
9589
- _context57.next = 2;
9657
+ _context58.next = 2;
9590
9658
  return this.get(this.baseURL + "/campaigns/".concat(id));
9591
9659
 
9592
9660
  case 2:
9593
- _yield$this$get3 = _context57.sent;
9661
+ _yield$this$get3 = _context58.sent;
9594
9662
  campaign = _yield$this$get3.campaign;
9595
- return _context57.abrupt("return", campaign);
9663
+ return _context58.abrupt("return", campaign);
9596
9664
 
9597
9665
  case 5:
9598
9666
  case "end":
9599
- return _context57.stop();
9667
+ return _context58.stop();
9600
9668
  }
9601
9669
  }
9602
- }, _callee57, this);
9670
+ }, _callee58, this);
9603
9671
  }));
9604
9672
 
9605
- function getCampaign(_x77) {
9673
+ function getCampaign(_x78) {
9606
9674
  return _getCampaign.apply(this, arguments);
9607
9675
  }
9608
9676
 
@@ -9618,30 +9686,30 @@ var StreamChat = /*#__PURE__*/function () {
9618
9686
  }, {
9619
9687
  key: "listCampaigns",
9620
9688
  value: function () {
9621
- var _listCampaigns = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee58(options) {
9689
+ var _listCampaigns = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee59(options) {
9622
9690
  var _yield$this$get4, campaigns;
9623
9691
 
9624
- return _regeneratorRuntime.wrap(function _callee58$(_context58) {
9692
+ return _regeneratorRuntime.wrap(function _callee59$(_context59) {
9625
9693
  while (1) {
9626
- switch (_context58.prev = _context58.next) {
9694
+ switch (_context59.prev = _context59.next) {
9627
9695
  case 0:
9628
- _context58.next = 2;
9696
+ _context59.next = 2;
9629
9697
  return this.get(this.baseURL + "/campaigns", options);
9630
9698
 
9631
9699
  case 2:
9632
- _yield$this$get4 = _context58.sent;
9700
+ _yield$this$get4 = _context59.sent;
9633
9701
  campaigns = _yield$this$get4.campaigns;
9634
- return _context58.abrupt("return", campaigns);
9702
+ return _context59.abrupt("return", campaigns);
9635
9703
 
9636
9704
  case 5:
9637
9705
  case "end":
9638
- return _context58.stop();
9706
+ return _context59.stop();
9639
9707
  }
9640
9708
  }
9641
- }, _callee58, this);
9709
+ }, _callee59, this);
9642
9710
  }));
9643
9711
 
9644
- function listCampaigns(_x78) {
9712
+ function listCampaigns(_x79) {
9645
9713
  return _listCampaigns.apply(this, arguments);
9646
9714
  }
9647
9715
 
@@ -9659,32 +9727,32 @@ var StreamChat = /*#__PURE__*/function () {
9659
9727
  }, {
9660
9728
  key: "updateCampaign",
9661
9729
  value: function () {
9662
- var _updateCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee59(id, params) {
9730
+ var _updateCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee60(id, params) {
9663
9731
  var _yield$this$put2, campaign;
9664
9732
 
9665
- return _regeneratorRuntime.wrap(function _callee59$(_context59) {
9733
+ return _regeneratorRuntime.wrap(function _callee60$(_context60) {
9666
9734
  while (1) {
9667
- switch (_context59.prev = _context59.next) {
9735
+ switch (_context60.prev = _context60.next) {
9668
9736
  case 0:
9669
- _context59.next = 2;
9737
+ _context60.next = 2;
9670
9738
  return this.put(this.baseURL + "/campaigns/".concat(id), {
9671
9739
  campaign: params
9672
9740
  });
9673
9741
 
9674
9742
  case 2:
9675
- _yield$this$put2 = _context59.sent;
9743
+ _yield$this$put2 = _context60.sent;
9676
9744
  campaign = _yield$this$put2.campaign;
9677
- return _context59.abrupt("return", campaign);
9745
+ return _context60.abrupt("return", campaign);
9678
9746
 
9679
9747
  case 5:
9680
9748
  case "end":
9681
- return _context59.stop();
9749
+ return _context60.stop();
9682
9750
  }
9683
9751
  }
9684
- }, _callee59, this);
9752
+ }, _callee60, this);
9685
9753
  }));
9686
9754
 
9687
- function updateCampaign(_x79, _x80) {
9755
+ function updateCampaign(_x80, _x81) {
9688
9756
  return _updateCampaign.apply(this, arguments);
9689
9757
  }
9690
9758
 
@@ -9701,22 +9769,22 @@ var StreamChat = /*#__PURE__*/function () {
9701
9769
  }, {
9702
9770
  key: "deleteCampaign",
9703
9771
  value: function () {
9704
- var _deleteCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee60(id) {
9705
- return _regeneratorRuntime.wrap(function _callee60$(_context60) {
9772
+ var _deleteCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee61(id) {
9773
+ return _regeneratorRuntime.wrap(function _callee61$(_context61) {
9706
9774
  while (1) {
9707
- switch (_context60.prev = _context60.next) {
9775
+ switch (_context61.prev = _context61.next) {
9708
9776
  case 0:
9709
- return _context60.abrupt("return", this.delete(this.baseURL + "/campaigns/".concat(id)));
9777
+ return _context61.abrupt("return", this.delete(this.baseURL + "/campaigns/".concat(id)));
9710
9778
 
9711
9779
  case 1:
9712
9780
  case "end":
9713
- return _context60.stop();
9781
+ return _context61.stop();
9714
9782
  }
9715
9783
  }
9716
- }, _callee60, this);
9784
+ }, _callee61, this);
9717
9785
  }));
9718
9786
 
9719
- function deleteCampaign(_x81) {
9787
+ function deleteCampaign(_x82) {
9720
9788
  return _deleteCampaign.apply(this, arguments);
9721
9789
  }
9722
9790
 
@@ -9734,33 +9802,33 @@ var StreamChat = /*#__PURE__*/function () {
9734
9802
  }, {
9735
9803
  key: "scheduleCampaign",
9736
9804
  value: function () {
9737
- var _scheduleCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee61(id, params) {
9805
+ var _scheduleCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee62(id, params) {
9738
9806
  var sendAt, _yield$this$patch, campaign;
9739
9807
 
9740
- return _regeneratorRuntime.wrap(function _callee61$(_context61) {
9808
+ return _regeneratorRuntime.wrap(function _callee62$(_context62) {
9741
9809
  while (1) {
9742
- switch (_context61.prev = _context61.next) {
9810
+ switch (_context62.prev = _context62.next) {
9743
9811
  case 0:
9744
9812
  sendAt = params.sendAt;
9745
- _context61.next = 3;
9813
+ _context62.next = 3;
9746
9814
  return this.patch(this.baseURL + "/campaigns/".concat(id, "/schedule"), {
9747
9815
  send_at: sendAt
9748
9816
  });
9749
9817
 
9750
9818
  case 3:
9751
- _yield$this$patch = _context61.sent;
9819
+ _yield$this$patch = _context62.sent;
9752
9820
  campaign = _yield$this$patch.campaign;
9753
- return _context61.abrupt("return", campaign);
9821
+ return _context62.abrupt("return", campaign);
9754
9822
 
9755
9823
  case 6:
9756
9824
  case "end":
9757
- return _context61.stop();
9825
+ return _context62.stop();
9758
9826
  }
9759
9827
  }
9760
- }, _callee61, this);
9828
+ }, _callee62, this);
9761
9829
  }));
9762
9830
 
9763
- function scheduleCampaign(_x82, _x83) {
9831
+ function scheduleCampaign(_x83, _x84) {
9764
9832
  return _scheduleCampaign.apply(this, arguments);
9765
9833
  }
9766
9834
 
@@ -9777,30 +9845,30 @@ var StreamChat = /*#__PURE__*/function () {
9777
9845
  }, {
9778
9846
  key: "stopCampaign",
9779
9847
  value: function () {
9780
- var _stopCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee62(id) {
9848
+ var _stopCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee63(id) {
9781
9849
  var _yield$this$patch2, campaign;
9782
9850
 
9783
- return _regeneratorRuntime.wrap(function _callee62$(_context62) {
9851
+ return _regeneratorRuntime.wrap(function _callee63$(_context63) {
9784
9852
  while (1) {
9785
- switch (_context62.prev = _context62.next) {
9853
+ switch (_context63.prev = _context63.next) {
9786
9854
  case 0:
9787
- _context62.next = 2;
9855
+ _context63.next = 2;
9788
9856
  return this.patch(this.baseURL + "/campaigns/".concat(id, "/stop"));
9789
9857
 
9790
9858
  case 2:
9791
- _yield$this$patch2 = _context62.sent;
9859
+ _yield$this$patch2 = _context63.sent;
9792
9860
  campaign = _yield$this$patch2.campaign;
9793
- return _context62.abrupt("return", campaign);
9861
+ return _context63.abrupt("return", campaign);
9794
9862
 
9795
9863
  case 5:
9796
9864
  case "end":
9797
- return _context62.stop();
9865
+ return _context63.stop();
9798
9866
  }
9799
9867
  }
9800
- }, _callee62, this);
9868
+ }, _callee63, this);
9801
9869
  }));
9802
9870
 
9803
- function stopCampaign(_x84) {
9871
+ function stopCampaign(_x85) {
9804
9872
  return _stopCampaign.apply(this, arguments);
9805
9873
  }
9806
9874
 
@@ -9817,30 +9885,30 @@ var StreamChat = /*#__PURE__*/function () {
9817
9885
  }, {
9818
9886
  key: "resumeCampaign",
9819
9887
  value: function () {
9820
- var _resumeCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee63(id) {
9888
+ var _resumeCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee64(id) {
9821
9889
  var _yield$this$patch3, campaign;
9822
9890
 
9823
- return _regeneratorRuntime.wrap(function _callee63$(_context63) {
9891
+ return _regeneratorRuntime.wrap(function _callee64$(_context64) {
9824
9892
  while (1) {
9825
- switch (_context63.prev = _context63.next) {
9893
+ switch (_context64.prev = _context64.next) {
9826
9894
  case 0:
9827
- _context63.next = 2;
9895
+ _context64.next = 2;
9828
9896
  return this.patch(this.baseURL + "/campaigns/".concat(id, "/resume"));
9829
9897
 
9830
9898
  case 2:
9831
- _yield$this$patch3 = _context63.sent;
9899
+ _yield$this$patch3 = _context64.sent;
9832
9900
  campaign = _yield$this$patch3.campaign;
9833
- return _context63.abrupt("return", campaign);
9901
+ return _context64.abrupt("return", campaign);
9834
9902
 
9835
9903
  case 5:
9836
9904
  case "end":
9837
- return _context63.stop();
9905
+ return _context64.stop();
9838
9906
  }
9839
9907
  }
9840
- }, _callee63, this);
9908
+ }, _callee64, this);
9841
9909
  }));
9842
9910
 
9843
- function resumeCampaign(_x85) {
9911
+ function resumeCampaign(_x86) {
9844
9912
  return _resumeCampaign.apply(this, arguments);
9845
9913
  }
9846
9914
 
@@ -9857,33 +9925,33 @@ var StreamChat = /*#__PURE__*/function () {
9857
9925
  }, {
9858
9926
  key: "testCampaign",
9859
9927
  value: function () {
9860
- var _testCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee64(id, params) {
9928
+ var _testCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee65(id, params) {
9861
9929
  var users, _yield$this$post3, campaign;
9862
9930
 
9863
- return _regeneratorRuntime.wrap(function _callee64$(_context64) {
9931
+ return _regeneratorRuntime.wrap(function _callee65$(_context65) {
9864
9932
  while (1) {
9865
- switch (_context64.prev = _context64.next) {
9933
+ switch (_context65.prev = _context65.next) {
9866
9934
  case 0:
9867
9935
  users = params.users;
9868
- _context64.next = 3;
9936
+ _context65.next = 3;
9869
9937
  return this.post(this.baseURL + "/campaigns/".concat(id, "/test"), {
9870
9938
  users: users
9871
9939
  });
9872
9940
 
9873
9941
  case 3:
9874
- _yield$this$post3 = _context64.sent;
9942
+ _yield$this$post3 = _context65.sent;
9875
9943
  campaign = _yield$this$post3.campaign;
9876
- return _context64.abrupt("return", campaign);
9944
+ return _context65.abrupt("return", campaign);
9877
9945
 
9878
9946
  case 6:
9879
9947
  case "end":
9880
- return _context64.stop();
9948
+ return _context65.stop();
9881
9949
  }
9882
9950
  }
9883
- }, _callee64, this);
9951
+ }, _callee65, this);
9884
9952
  }));
9885
9953
 
9886
- function testCampaign(_x86, _x87) {
9954
+ function testCampaign(_x87, _x88) {
9887
9955
  return _testCampaign.apply(this, arguments);
9888
9956
  }
9889
9957
 
@@ -9899,24 +9967,24 @@ var StreamChat = /*#__PURE__*/function () {
9899
9967
  }, {
9900
9968
  key: "enrichURL",
9901
9969
  value: function () {
9902
- var _enrichURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee65(url) {
9903
- return _regeneratorRuntime.wrap(function _callee65$(_context65) {
9970
+ var _enrichURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee66(url) {
9971
+ return _regeneratorRuntime.wrap(function _callee66$(_context66) {
9904
9972
  while (1) {
9905
- switch (_context65.prev = _context65.next) {
9973
+ switch (_context66.prev = _context66.next) {
9906
9974
  case 0:
9907
- return _context65.abrupt("return", this.get(this.baseURL + "/og", {
9975
+ return _context66.abrupt("return", this.get(this.baseURL + "/og", {
9908
9976
  url: url
9909
9977
  }));
9910
9978
 
9911
9979
  case 1:
9912
9980
  case "end":
9913
- return _context65.stop();
9981
+ return _context66.stop();
9914
9982
  }
9915
9983
  }
9916
- }, _callee65, this);
9984
+ }, _callee66, this);
9917
9985
  }));
9918
9986
 
9919
- function enrichURL(_x88) {
9987
+ function enrichURL(_x89) {
9920
9988
  return _enrichURL.apply(this, arguments);
9921
9989
  }
9922
9990
 
@@ -9933,22 +10001,22 @@ var StreamChat = /*#__PURE__*/function () {
9933
10001
  }, {
9934
10002
  key: "getTask",
9935
10003
  value: function () {
9936
- var _getTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee66(id) {
9937
- return _regeneratorRuntime.wrap(function _callee66$(_context66) {
10004
+ var _getTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee67(id) {
10005
+ return _regeneratorRuntime.wrap(function _callee67$(_context67) {
9938
10006
  while (1) {
9939
- switch (_context66.prev = _context66.next) {
10007
+ switch (_context67.prev = _context67.next) {
9940
10008
  case 0:
9941
- return _context66.abrupt("return", this.get("".concat(this.baseURL, "/tasks/").concat(id)));
10009
+ return _context67.abrupt("return", this.get("".concat(this.baseURL, "/tasks/").concat(id)));
9942
10010
 
9943
10011
  case 1:
9944
10012
  case "end":
9945
- return _context66.stop();
10013
+ return _context67.stop();
9946
10014
  }
9947
10015
  }
9948
- }, _callee66, this);
10016
+ }, _callee67, this);
9949
10017
  }));
9950
10018
 
9951
- function getTask(_x89) {
10019
+ function getTask(_x90) {
9952
10020
  return _getTask.apply(this, arguments);
9953
10021
  }
9954
10022
 
@@ -9966,31 +10034,31 @@ var StreamChat = /*#__PURE__*/function () {
9966
10034
  }, {
9967
10035
  key: "deleteChannels",
9968
10036
  value: function () {
9969
- var _deleteChannels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee67(cids) {
10037
+ var _deleteChannels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee68(cids) {
9970
10038
  var options,
9971
- _args67 = arguments;
9972
- return _regeneratorRuntime.wrap(function _callee67$(_context67) {
10039
+ _args68 = arguments;
10040
+ return _regeneratorRuntime.wrap(function _callee68$(_context68) {
9973
10041
  while (1) {
9974
- switch (_context67.prev = _context67.next) {
10042
+ switch (_context68.prev = _context68.next) {
9975
10043
  case 0:
9976
- options = _args67.length > 1 && _args67[1] !== undefined ? _args67[1] : {};
9977
- _context67.next = 3;
10044
+ options = _args68.length > 1 && _args68[1] !== undefined ? _args68[1] : {};
10045
+ _context68.next = 3;
9978
10046
  return this.post(this.baseURL + "/channels/delete", _objectSpread({
9979
10047
  cids: cids
9980
10048
  }, options));
9981
10049
 
9982
10050
  case 3:
9983
- return _context67.abrupt("return", _context67.sent);
10051
+ return _context68.abrupt("return", _context68.sent);
9984
10052
 
9985
10053
  case 4:
9986
10054
  case "end":
9987
- return _context67.stop();
10055
+ return _context68.stop();
9988
10056
  }
9989
10057
  }
9990
- }, _callee67, this);
10058
+ }, _callee68, this);
9991
10059
  }));
9992
10060
 
9993
- function deleteChannels(_x90) {
10061
+ function deleteChannels(_x91) {
9994
10062
  return _deleteChannels.apply(this, arguments);
9995
10063
  }
9996
10064
 
@@ -10008,13 +10076,13 @@ var StreamChat = /*#__PURE__*/function () {
10008
10076
  }, {
10009
10077
  key: "deleteUsers",
10010
10078
  value: function () {
10011
- var _deleteUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee68(user_ids, options) {
10012
- return _regeneratorRuntime.wrap(function _callee68$(_context68) {
10079
+ var _deleteUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee69(user_ids, options) {
10080
+ return _regeneratorRuntime.wrap(function _callee69$(_context69) {
10013
10081
  while (1) {
10014
- switch (_context68.prev = _context68.next) {
10082
+ switch (_context69.prev = _context69.next) {
10015
10083
  case 0:
10016
10084
  if (!((options === null || options === void 0 ? void 0 : options.user) !== 'soft' && (options === null || options === void 0 ? void 0 : options.user) !== 'hard')) {
10017
- _context68.next = 2;
10085
+ _context69.next = 2;
10018
10086
  break;
10019
10087
  }
10020
10088
 
@@ -10022,7 +10090,7 @@ var StreamChat = /*#__PURE__*/function () {
10022
10090
 
10023
10091
  case 2:
10024
10092
  if (!(options.messages !== undefined && options.messages !== 'soft' && options.messages !== 'hard')) {
10025
- _context68.next = 4;
10093
+ _context69.next = 4;
10026
10094
  break;
10027
10095
  }
10028
10096
 
@@ -10030,35 +10098,160 @@ var StreamChat = /*#__PURE__*/function () {
10030
10098
 
10031
10099
  case 4:
10032
10100
  if (!(options.conversations !== undefined && options.conversations !== 'soft' && options.conversations !== 'hard')) {
10033
- _context68.next = 6;
10101
+ _context69.next = 6;
10034
10102
  break;
10035
10103
  }
10036
10104
 
10037
10105
  throw new Error('Invalid delete user options. conversations must be one of [soft hard]');
10038
10106
 
10039
10107
  case 6:
10040
- _context68.next = 8;
10108
+ _context69.next = 8;
10041
10109
  return this.post(this.baseURL + "/users/delete", _objectSpread({
10042
10110
  user_ids: user_ids
10043
10111
  }, options));
10044
10112
 
10045
10113
  case 8:
10046
- return _context68.abrupt("return", _context68.sent);
10114
+ return _context69.abrupt("return", _context69.sent);
10047
10115
 
10048
10116
  case 9:
10049
10117
  case "end":
10050
- return _context68.stop();
10118
+ return _context69.stop();
10051
10119
  }
10052
10120
  }
10053
- }, _callee68, this);
10121
+ }, _callee69, this);
10054
10122
  }));
10055
10123
 
10056
- function deleteUsers(_x91, _x92) {
10124
+ function deleteUsers(_x92, _x93) {
10057
10125
  return _deleteUsers.apply(this, arguments);
10058
10126
  }
10059
10127
 
10060
10128
  return deleteUsers;
10061
10129
  }()
10130
+ /**
10131
+ * _createImport - Create an Import Task.
10132
+ *
10133
+ * Note: Do not use this.
10134
+ * It is present for internal usage only.
10135
+ * This function can, and will, break and/or be removed at any point in time.
10136
+ *
10137
+ * @private
10138
+ * @param {string} filename filename of uploaded data
10139
+ *
10140
+ * @return {APIResponse & CreateImportResponse} An ImportTask
10141
+ */
10142
+
10143
+ }, {
10144
+ key: "_createImport",
10145
+ value: function () {
10146
+ var _createImport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee70(filename) {
10147
+ return _regeneratorRuntime.wrap(function _callee70$(_context70) {
10148
+ while (1) {
10149
+ switch (_context70.prev = _context70.next) {
10150
+ case 0:
10151
+ _context70.next = 2;
10152
+ return this.post(this.baseURL + "/imports", {
10153
+ filename: filename
10154
+ });
10155
+
10156
+ case 2:
10157
+ return _context70.abrupt("return", _context70.sent);
10158
+
10159
+ case 3:
10160
+ case "end":
10161
+ return _context70.stop();
10162
+ }
10163
+ }
10164
+ }, _callee70, this);
10165
+ }));
10166
+
10167
+ function _createImport(_x94) {
10168
+ return _createImport2.apply(this, arguments);
10169
+ }
10170
+
10171
+ return _createImport;
10172
+ }()
10173
+ /**
10174
+ * _getImport - Get an Import Task.
10175
+ *
10176
+ * Note: Do not use this.
10177
+ * It is present for internal usage only.
10178
+ * This function can, and will, break and/or be removed at any point in time.
10179
+ *
10180
+ * @private
10181
+ * @param {string} id id of Import Task
10182
+ *
10183
+ * @return {APIResponse & GetImportResponse} An ImportTask
10184
+ */
10185
+
10186
+ }, {
10187
+ key: "_getImport",
10188
+ value: function () {
10189
+ var _getImport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee71(id) {
10190
+ return _regeneratorRuntime.wrap(function _callee71$(_context71) {
10191
+ while (1) {
10192
+ switch (_context71.prev = _context71.next) {
10193
+ case 0:
10194
+ _context71.next = 2;
10195
+ return this.get(this.baseURL + "/imports/".concat(id));
10196
+
10197
+ case 2:
10198
+ return _context71.abrupt("return", _context71.sent);
10199
+
10200
+ case 3:
10201
+ case "end":
10202
+ return _context71.stop();
10203
+ }
10204
+ }
10205
+ }, _callee71, this);
10206
+ }));
10207
+
10208
+ function _getImport(_x95) {
10209
+ return _getImport2.apply(this, arguments);
10210
+ }
10211
+
10212
+ return _getImport;
10213
+ }()
10214
+ /**
10215
+ * _listImports - Lists Import Tasks.
10216
+ *
10217
+ * Note: Do not use this.
10218
+ * It is present for internal usage only.
10219
+ * This function can, and will, break and/or be removed at any point in time.
10220
+ *
10221
+ * @private
10222
+ * @param {ListImportsPaginationOptions} options pagination options
10223
+ *
10224
+ * @return {APIResponse & ListImportsResponse} An ImportTask
10225
+ */
10226
+
10227
+ }, {
10228
+ key: "_listImports",
10229
+ value: function () {
10230
+ var _listImports2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee72(options) {
10231
+ return _regeneratorRuntime.wrap(function _callee72$(_context72) {
10232
+ while (1) {
10233
+ switch (_context72.prev = _context72.next) {
10234
+ case 0:
10235
+ _context72.next = 2;
10236
+ return this.get(this.baseURL + "/imports", options);
10237
+
10238
+ case 2:
10239
+ return _context72.abrupt("return", _context72.sent);
10240
+
10241
+ case 3:
10242
+ case "end":
10243
+ return _context72.stop();
10244
+ }
10245
+ }
10246
+ }, _callee72, this);
10247
+ }));
10248
+
10249
+ function _listImports(_x96) {
10250
+ return _listImports2.apply(this, arguments);
10251
+ }
10252
+
10253
+ return _listImports;
10254
+ }()
10062
10255
  }], [{
10063
10256
  key: "getInstance",
10064
10257
  value: function getInstance(key, secretOrOptions, options) {