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