stream-chat 8.27.0 → 8.29.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
@@ -366,7 +366,8 @@ function formatMessage(message) {
366
366
  pinned_at: message.pinned_at ? new Date(message.pinned_at) : null,
367
367
  created_at: message.created_at ? new Date(message.created_at) : new Date(),
368
368
  updated_at: message.updated_at ? new Date(message.updated_at) : new Date(),
369
- status: message.status || 'received'
369
+ status: message.status || 'received',
370
+ reaction_groups: maybeGetReactionGroupsFallback(message.reaction_groups, message.reaction_counts, message.reaction_scores)
370
371
  });
371
372
  }
372
373
  function addToMessageList(messages, message) {
@@ -433,6 +434,28 @@ function addToMessageList(messages, message) {
433
434
  return _toConsumableArray(messageArr);
434
435
  }
435
436
 
437
+ function maybeGetReactionGroupsFallback(groups, counts, scores) {
438
+ if (groups) {
439
+ return groups;
440
+ }
441
+
442
+ if (counts && scores) {
443
+ var fallback = {};
444
+
445
+ for (var _i2 = 0, _Object$keys = Object.keys(counts); _i2 < _Object$keys.length; _i2++) {
446
+ var type = _Object$keys[_i2];
447
+ fallback[type] = {
448
+ count: counts[type],
449
+ sum_scores: scores[type]
450
+ };
451
+ }
452
+
453
+ return fallback;
454
+ }
455
+
456
+ return null;
457
+ }
458
+
436
459
  function ownKeys$7(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
437
460
 
438
461
  function _objectSpread$7(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$7(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$7(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
@@ -3124,16 +3147,19 @@ var Channel = /*#__PURE__*/function () {
3124
3147
  }, {
3125
3148
  key: "getReplies",
3126
3149
  value: function () {
3127
- var _getReplies = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee30(parent_id, options) {
3128
- var data;
3150
+ var _getReplies = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee30(parent_id, options, sort) {
3151
+ var normalizedSort, data;
3129
3152
  return _regeneratorRuntime.wrap(function _callee30$(_context30) {
3130
3153
  while (1) {
3131
3154
  switch (_context30.prev = _context30.next) {
3132
3155
  case 0:
3133
- _context30.next = 2;
3134
- return this.getClient().get(this.getClient().baseURL + "/messages/".concat(parent_id, "/replies"), _objectSpread$6({}, options));
3156
+ normalizedSort = sort ? normalizeQuerySort(sort) : undefined;
3157
+ _context30.next = 3;
3158
+ return this.getClient().get(this.getClient().baseURL + "/messages/".concat(parent_id, "/replies"), _objectSpread$6({
3159
+ sort: normalizedSort
3160
+ }, options));
3135
3161
 
3136
- case 2:
3162
+ case 3:
3137
3163
  data = _context30.sent;
3138
3164
 
3139
3165
  // add any messages to our thread state
@@ -3143,7 +3169,7 @@ var Channel = /*#__PURE__*/function () {
3143
3169
 
3144
3170
  return _context30.abrupt("return", data);
3145
3171
 
3146
- case 5:
3172
+ case 6:
3147
3173
  case "end":
3148
3174
  return _context30.stop();
3149
3175
  }
@@ -3151,7 +3177,7 @@ var Channel = /*#__PURE__*/function () {
3151
3177
  }, _callee30, this);
3152
3178
  }));
3153
3179
 
3154
- function getReplies(_x31, _x32) {
3180
+ function getReplies(_x31, _x32, _x33) {
3155
3181
  return _getReplies.apply(this, arguments);
3156
3182
  }
3157
3183
 
@@ -3195,7 +3221,7 @@ var Channel = /*#__PURE__*/function () {
3195
3221
  }, _callee31, this);
3196
3222
  }));
3197
3223
 
3198
- function getPinnedMessages(_x33) {
3224
+ function getPinnedMessages(_x34) {
3199
3225
  return _getPinnedMessages.apply(this, arguments);
3200
3226
  }
3201
3227
 
@@ -3425,7 +3451,7 @@ var Channel = /*#__PURE__*/function () {
3425
3451
  }, _callee32, this);
3426
3452
  }));
3427
3453
 
3428
- function query(_x34) {
3454
+ function query(_x35) {
3429
3455
  return _query.apply(this, arguments);
3430
3456
  }
3431
3457
 
@@ -3466,7 +3492,7 @@ var Channel = /*#__PURE__*/function () {
3466
3492
  }, _callee33, this);
3467
3493
  }));
3468
3494
 
3469
- function banUser(_x35, _x36) {
3495
+ function banUser(_x36, _x37) {
3470
3496
  return _banUser.apply(this, arguments);
3471
3497
  }
3472
3498
 
@@ -3597,7 +3623,7 @@ var Channel = /*#__PURE__*/function () {
3597
3623
  }, _callee36, this);
3598
3624
  }));
3599
3625
 
3600
- function unbanUser(_x37) {
3626
+ function unbanUser(_x38) {
3601
3627
  return _unbanUser.apply(this, arguments);
3602
3628
  }
3603
3629
 
@@ -3638,7 +3664,7 @@ var Channel = /*#__PURE__*/function () {
3638
3664
  }, _callee37, this);
3639
3665
  }));
3640
3666
 
3641
- function shadowBan(_x38, _x39) {
3667
+ function shadowBan(_x39, _x40) {
3642
3668
  return _shadowBan.apply(this, arguments);
3643
3669
  }
3644
3670
 
@@ -3678,7 +3704,7 @@ var Channel = /*#__PURE__*/function () {
3678
3704
  }, _callee38, this);
3679
3705
  }));
3680
3706
 
3681
- function removeShadowBan(_x40) {
3707
+ function removeShadowBan(_x41) {
3682
3708
  return _removeShadowBan.apply(this, arguments);
3683
3709
  }
3684
3710
 
@@ -3713,7 +3739,7 @@ var Channel = /*#__PURE__*/function () {
3713
3739
  }, _callee39, this);
3714
3740
  }));
3715
3741
 
3716
- function createCall(_x41) {
3742
+ function createCall(_x42) {
3717
3743
  return _createCall.apply(this, arguments);
3718
3744
  }
3719
3745
 
@@ -3748,7 +3774,7 @@ var Channel = /*#__PURE__*/function () {
3748
3774
  }, _callee40, this);
3749
3775
  }));
3750
3776
 
3751
- function vote(_x42, _x43, _x44) {
3777
+ function vote(_x43, _x44, _x45) {
3752
3778
  return _vote2.apply(this, arguments);
3753
3779
  }
3754
3780
 
@@ -3776,7 +3802,7 @@ var Channel = /*#__PURE__*/function () {
3776
3802
  }, _callee41, this);
3777
3803
  }));
3778
3804
 
3779
- function removeVote(_x45, _x46, _x47) {
3805
+ function removeVote(_x46, _x47, _x48) {
3780
3806
  return _removeVote.apply(this, arguments);
3781
3807
  }
3782
3808
 
@@ -11395,7 +11421,7 @@ var StreamChat = /*#__PURE__*/function () {
11395
11421
  }, {
11396
11422
  key: "getUserAgent",
11397
11423
  value: function getUserAgent() {
11398
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.27.0");
11424
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.29.0");
11399
11425
  }
11400
11426
  }, {
11401
11427
  key: "setUserAgent",