stream-chat 8.18.0 → 8.18.2

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.
@@ -159,6 +159,7 @@ function isOwnUserBaseProperty(property) {
159
159
  total_unread_count: true,
160
160
  unread_channels: true,
161
161
  unread_count: true,
162
+ unread_threads: true,
162
163
  invisible: true,
163
164
  roles: true
164
165
  };
@@ -6238,28 +6239,17 @@ var Campaign = /*#__PURE__*/function () {
6238
6239
  return _delete;
6239
6240
  }()
6240
6241
  }, {
6241
- key: "schedule",
6242
+ key: "stop",
6242
6243
  value: function () {
6243
- var _schedule = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(params) {
6244
- var scheduledFor, _yield$this$client$pa, campaign;
6245
-
6244
+ var _stop = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5() {
6246
6245
  return _regeneratorRuntime.wrap(function _callee5$(_context5) {
6247
6246
  while (1) {
6248
6247
  switch (_context5.prev = _context5.next) {
6249
6248
  case 0:
6250
6249
  this.verifyCampaignId();
6251
- scheduledFor = params.scheduledFor;
6252
- _context5.next = 4;
6253
- return this.client.patch(this.client.baseURL + "/campaigns/".concat(this.id, "/schedule"), {
6254
- scheduled_for: scheduledFor
6255
- });
6256
-
6257
- case 4:
6258
- _yield$this$client$pa = _context5.sent;
6259
- campaign = _yield$this$client$pa.campaign;
6260
- return _context5.abrupt("return", campaign);
6250
+ return _context5.abrupt("return", this.client.patch(this.client.baseURL + "/campaigns/".concat(this.id, "/stop")));
6261
6251
 
6262
- case 7:
6252
+ case 2:
6263
6253
  case "end":
6264
6254
  return _context5.stop();
6265
6255
  }
@@ -6267,104 +6257,29 @@ var Campaign = /*#__PURE__*/function () {
6267
6257
  }, _callee5, this);
6268
6258
  }));
6269
6259
 
6270
- function schedule(_x3) {
6271
- return _schedule.apply(this, arguments);
6272
- }
6273
-
6274
- return schedule;
6275
- }()
6276
- }, {
6277
- key: "stop",
6278
- value: function () {
6279
- var _stop = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
6280
- return _regeneratorRuntime.wrap(function _callee6$(_context6) {
6281
- while (1) {
6282
- switch (_context6.prev = _context6.next) {
6283
- case 0:
6284
- this.verifyCampaignId();
6285
- return _context6.abrupt("return", this.client.patch(this.client.baseURL + "/campaigns/".concat(this.id, "/stop")));
6286
-
6287
- case 2:
6288
- case "end":
6289
- return _context6.stop();
6290
- }
6291
- }
6292
- }, _callee6, this);
6293
- }));
6294
-
6295
6260
  function stop() {
6296
6261
  return _stop.apply(this, arguments);
6297
6262
  }
6298
6263
 
6299
6264
  return stop;
6300
6265
  }()
6301
- }, {
6302
- key: "pause",
6303
- value: function () {
6304
- var _pause = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
6305
- return _regeneratorRuntime.wrap(function _callee7$(_context7) {
6306
- while (1) {
6307
- switch (_context7.prev = _context7.next) {
6308
- case 0:
6309
- this.verifyCampaignId();
6310
- return _context7.abrupt("return", this.client.patch(this.client.baseURL + "/campaigns/".concat(this.id, "/pause")));
6311
-
6312
- case 2:
6313
- case "end":
6314
- return _context7.stop();
6315
- }
6316
- }
6317
- }, _callee7, this);
6318
- }));
6319
-
6320
- function pause() {
6321
- return _pause.apply(this, arguments);
6322
- }
6323
-
6324
- return pause;
6325
- }()
6326
- }, {
6327
- key: "resume",
6328
- value: function () {
6329
- var _resume = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
6330
- return _regeneratorRuntime.wrap(function _callee8$(_context8) {
6331
- while (1) {
6332
- switch (_context8.prev = _context8.next) {
6333
- case 0:
6334
- this.verifyCampaignId();
6335
- return _context8.abrupt("return", this.client.patch(this.client.baseURL + "/campaigns/".concat(this.id, "/resume")));
6336
-
6337
- case 2:
6338
- case "end":
6339
- return _context8.stop();
6340
- }
6341
- }
6342
- }, _callee8, this);
6343
- }));
6344
-
6345
- function resume() {
6346
- return _resume.apply(this, arguments);
6347
- }
6348
-
6349
- return resume;
6350
- }()
6351
6266
  }, {
6352
6267
  key: "get",
6353
6268
  value: function () {
6354
- var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {
6355
- return _regeneratorRuntime.wrap(function _callee9$(_context9) {
6269
+ var _get = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6() {
6270
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
6356
6271
  while (1) {
6357
- switch (_context9.prev = _context9.next) {
6272
+ switch (_context6.prev = _context6.next) {
6358
6273
  case 0:
6359
6274
  this.verifyCampaignId();
6360
- return _context9.abrupt("return", this.client.getCampaign(this.id));
6275
+ return _context6.abrupt("return", this.client.getCampaign(this.id));
6361
6276
 
6362
6277
  case 2:
6363
6278
  case "end":
6364
- return _context9.stop();
6279
+ return _context6.stop();
6365
6280
  }
6366
6281
  }
6367
- }, _callee9, this);
6282
+ }, _callee6, this);
6368
6283
  }));
6369
6284
 
6370
6285
  function get() {
@@ -6751,20 +6666,22 @@ var Thread = /*#__PURE__*/function () {
6751
6666
  this._channel = client.channel(t.channel.type, t.channel.id);
6752
6667
  this._client = client;
6753
6668
 
6754
- var _iterator = _createForOfIteratorHelper$1(t.read),
6755
- _step;
6669
+ if (t.read) {
6670
+ var _iterator = _createForOfIteratorHelper$1(t.read),
6671
+ _step;
6756
6672
 
6757
- try {
6758
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
6759
- var r = _step.value;
6760
- this.read[r.user.id] = _objectSpread$1(_objectSpread$1({}, r), {}, {
6761
- last_read: new Date(r.last_read)
6762
- });
6673
+ try {
6674
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
6675
+ var r = _step.value;
6676
+ this.read[r.user.id] = _objectSpread$1(_objectSpread$1({}, r), {}, {
6677
+ last_read: new Date(r.last_read)
6678
+ });
6679
+ }
6680
+ } catch (err) {
6681
+ _iterator.e(err);
6682
+ } finally {
6683
+ _iterator.f();
6763
6684
  }
6764
- } catch (err) {
6765
- _iterator.e(err);
6766
- } finally {
6767
- _iterator.f();
6768
6685
  }
6769
6686
  }
6770
6687
 
@@ -6773,10 +6690,20 @@ var Thread = /*#__PURE__*/function () {
6773
6690
  value: function getClient() {
6774
6691
  return this._client;
6775
6692
  }
6693
+ /**
6694
+ * addReply - Adds or updates a latestReplies to the thread
6695
+ *
6696
+ * @param {MessageResponse<StreamChatGenerics>} message reply message to be added.
6697
+ */
6698
+
6776
6699
  }, {
6777
6700
  key: "addReply",
6778
6701
  value: function addReply(message) {
6779
- this.latestReplies = addToMessageList(this.latestReplies, formatMessage(message));
6702
+ if (message.parent_id !== this.message.id) {
6703
+ throw new Error('Message does not belong to this thread');
6704
+ }
6705
+
6706
+ this.latestReplies = addToMessageList(this.latestReplies, formatMessage(message), true);
6780
6707
  }
6781
6708
  }, {
6782
6709
  key: "updateReply",
@@ -6802,6 +6729,7 @@ var Thread = /*#__PURE__*/function () {
6802
6729
 
6803
6730
  if (message.parent_id && message.parent_id === this.message.id) {
6804
6731
  this.updateReply(message);
6732
+ return;
6805
6733
  }
6806
6734
 
6807
6735
  if (!message.parent_id && message.id === this.message.id) {
@@ -11142,7 +11070,7 @@ var StreamChat = /*#__PURE__*/function () {
11142
11070
  }, {
11143
11071
  key: "getUserAgent",
11144
11072
  value: function getUserAgent() {
11145
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.18.0");
11073
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.18.2");
11146
11074
  }
11147
11075
  }, {
11148
11076
  key: "setUserAgent",