stream-chat 8.40.9 → 8.41.1
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/browser.es.js +72 -58
- package/dist/browser.es.js.map +1 -1
- package/dist/browser.full-bundle.min.js +1 -1
- package/dist/browser.full-bundle.min.js.map +1 -1
- package/dist/browser.js +72 -58
- package/dist/browser.js.map +1 -1
- package/dist/index.es.js +72 -58
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +72 -58
- package/dist/index.js.map +1 -1
- package/dist/types/store.d.ts +2 -1
- package/dist/types/store.d.ts.map +1 -1
- package/dist/types/thread.d.ts.map +1 -1
- package/dist/types/types.d.ts +1 -0
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/store.ts +22 -2
- package/src/thread.ts +7 -4
- package/src/thread_manager.ts +5 -5
- package/src/types.ts +1 -0
package/dist/browser.es.js
CHANGED
|
@@ -7308,12 +7308,21 @@ var StateStore = function StateStore(value) {
|
|
|
7308
7308
|
var selectedValues;
|
|
7309
7309
|
|
|
7310
7310
|
var wrappedHandler = function wrappedHandler(nextValue) {
|
|
7311
|
-
var _selectedValues$some, _selectedValues;
|
|
7312
|
-
|
|
7313
7311
|
var newlySelectedValues = selector(nextValue);
|
|
7314
|
-
var hasUpdatedValues =
|
|
7315
|
-
|
|
7316
|
-
|
|
7312
|
+
var hasUpdatedValues = !selectedValues;
|
|
7313
|
+
|
|
7314
|
+
if (Array.isArray(newlySelectedValues) && StateStore.logCount > 0) {
|
|
7315
|
+
console.warn('[StreamChat]: The API of our StateStore has changed. Instead of returning an array in the selector, please return a named object of properties.');
|
|
7316
|
+
StateStore.logCount--;
|
|
7317
|
+
}
|
|
7318
|
+
|
|
7319
|
+
for (var key in selectedValues) {
|
|
7320
|
+
// @ts-ignore TODO: remove array support (Readonly<unknown[]>)
|
|
7321
|
+
if (selectedValues[key] === newlySelectedValues[key]) continue;
|
|
7322
|
+
hasUpdatedValues = true;
|
|
7323
|
+
break;
|
|
7324
|
+
}
|
|
7325
|
+
|
|
7317
7326
|
if (!hasUpdatedValues) return;
|
|
7318
7327
|
var oldSelectedValues = selectedValues;
|
|
7319
7328
|
selectedValues = newlySelectedValues;
|
|
@@ -7324,6 +7333,8 @@ var StateStore = function StateStore(value) {
|
|
|
7324
7333
|
});
|
|
7325
7334
|
};
|
|
7326
7335
|
|
|
7336
|
+
_defineProperty(StateStore, "logCount", 5);
|
|
7337
|
+
|
|
7327
7338
|
var _excluded$1 = ["limit", "sort"];
|
|
7328
7339
|
|
|
7329
7340
|
function ownKeys$3(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; }
|
|
@@ -7472,12 +7483,13 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7472
7483
|
|
|
7473
7484
|
_defineProperty(this, "subscribeMarkActiveThreadRead", function () {
|
|
7474
7485
|
return _this.state.subscribeWithSelector(function (nextValue) {
|
|
7475
|
-
return
|
|
7486
|
+
return {
|
|
7487
|
+
active: nextValue.active,
|
|
7488
|
+
unreadMessageCount: ownUnreadCountSelector(_this.client.userID)(nextValue)
|
|
7489
|
+
};
|
|
7476
7490
|
}, function (_ref3) {
|
|
7477
|
-
var
|
|
7478
|
-
|
|
7479
|
-
unreadMessageCount = _ref4[1];
|
|
7480
|
-
|
|
7491
|
+
var active = _ref3.active,
|
|
7492
|
+
unreadMessageCount = _ref3.unreadMessageCount;
|
|
7481
7493
|
if (!active || !unreadMessageCount) return;
|
|
7482
7494
|
|
|
7483
7495
|
_this.throttledMarkAsRead();
|
|
@@ -7486,11 +7498,13 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7486
7498
|
|
|
7487
7499
|
_defineProperty(this, "subscribeReloadActiveStaleThread", function () {
|
|
7488
7500
|
return _this.state.subscribeWithSelector(function (nextValue) {
|
|
7489
|
-
return
|
|
7490
|
-
|
|
7491
|
-
|
|
7492
|
-
|
|
7493
|
-
|
|
7501
|
+
return {
|
|
7502
|
+
active: nextValue.active,
|
|
7503
|
+
isStateStale: nextValue.isStateStale
|
|
7504
|
+
};
|
|
7505
|
+
}, function (_ref4) {
|
|
7506
|
+
var active = _ref4.active,
|
|
7507
|
+
isStateStale = _ref4.isStateStale;
|
|
7494
7508
|
|
|
7495
7509
|
if (active && isStateStale) {
|
|
7496
7510
|
_this.reload();
|
|
@@ -7647,10 +7661,10 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7647
7661
|
_this.unsubscribeFunctions.clear();
|
|
7648
7662
|
});
|
|
7649
7663
|
|
|
7650
|
-
_defineProperty(this, "deleteReplyLocally", function (
|
|
7664
|
+
_defineProperty(this, "deleteReplyLocally", function (_ref5) {
|
|
7651
7665
|
var _replies$index, _replies;
|
|
7652
7666
|
|
|
7653
|
-
var message =
|
|
7667
|
+
var message = _ref5.message;
|
|
7654
7668
|
|
|
7655
7669
|
var _this$state$getLatest3 = _this.state.getLatestValue(),
|
|
7656
7670
|
replies = _this$state$getLatest3.replies;
|
|
@@ -7678,10 +7692,10 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7678
7692
|
});
|
|
7679
7693
|
});
|
|
7680
7694
|
|
|
7681
|
-
_defineProperty(this, "upsertReplyLocally", function (
|
|
7682
|
-
var message =
|
|
7683
|
-
|
|
7684
|
-
timestampChanged =
|
|
7695
|
+
_defineProperty(this, "upsertReplyLocally", function (_ref6) {
|
|
7696
|
+
var message = _ref6.message,
|
|
7697
|
+
_ref6$timestampChange = _ref6.timestampChanged,
|
|
7698
|
+
timestampChanged = _ref6$timestampChange === void 0 ? false : _ref6$timestampChange;
|
|
7685
7699
|
|
|
7686
7700
|
if (message.parent_id !== _this.id) {
|
|
7687
7701
|
throw new Error('Reply does not belong to this thread');
|
|
@@ -7703,8 +7717,8 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7703
7717
|
});
|
|
7704
7718
|
});
|
|
7705
7719
|
|
|
7706
|
-
_defineProperty(this, "updateParentMessageLocally", function (
|
|
7707
|
-
var message =
|
|
7720
|
+
_defineProperty(this, "updateParentMessageLocally", function (_ref7) {
|
|
7721
|
+
var message = _ref7.message;
|
|
7708
7722
|
|
|
7709
7723
|
if (message.id !== _this.id) {
|
|
7710
7724
|
throw new Error('Message does not belong to this thread');
|
|
@@ -7737,8 +7751,8 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7737
7751
|
});
|
|
7738
7752
|
|
|
7739
7753
|
_defineProperty(this, "markAsRead", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
7740
|
-
var
|
|
7741
|
-
|
|
7754
|
+
var _ref9,
|
|
7755
|
+
_ref9$force,
|
|
7742
7756
|
force,
|
|
7743
7757
|
_args2 = arguments;
|
|
7744
7758
|
|
|
@@ -7746,7 +7760,7 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7746
7760
|
while (1) {
|
|
7747
7761
|
switch (_context2.prev = _context2.next) {
|
|
7748
7762
|
case 0:
|
|
7749
|
-
|
|
7763
|
+
_ref9 = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {}, _ref9$force = _ref9.force, force = _ref9$force === void 0 ? false : _ref9$force;
|
|
7750
7764
|
|
|
7751
7765
|
if (!(_this.ownUnreadCount === 0 && !force)) {
|
|
7752
7766
|
_context2.next = 3;
|
|
@@ -7779,13 +7793,13 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7779
7793
|
}));
|
|
7780
7794
|
|
|
7781
7795
|
_defineProperty(this, "queryReplies", function () {
|
|
7782
|
-
var
|
|
7796
|
+
var _ref10 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7783
7797
|
|
|
7784
|
-
var
|
|
7785
|
-
limit =
|
|
7786
|
-
|
|
7787
|
-
sort =
|
|
7788
|
-
otherOptions = _objectWithoutProperties(
|
|
7798
|
+
var _ref10$limit = _ref10.limit,
|
|
7799
|
+
limit = _ref10$limit === void 0 ? DEFAULT_PAGE_LIMIT : _ref10$limit,
|
|
7800
|
+
_ref10$sort = _ref10.sort,
|
|
7801
|
+
sort = _ref10$sort === void 0 ? DEFAULT_SORT : _ref10$sort,
|
|
7802
|
+
otherOptions = _objectWithoutProperties(_ref10, _excluded$1);
|
|
7789
7803
|
|
|
7790
7804
|
return _this.channel.getReplies(_this.id, _objectSpread$3({
|
|
7791
7805
|
limit: limit
|
|
@@ -7793,31 +7807,31 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7793
7807
|
});
|
|
7794
7808
|
|
|
7795
7809
|
_defineProperty(this, "loadNextPage", function () {
|
|
7796
|
-
var
|
|
7797
|
-
|
|
7798
|
-
limit =
|
|
7810
|
+
var _ref11 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
7811
|
+
_ref11$limit = _ref11.limit,
|
|
7812
|
+
limit = _ref11$limit === void 0 ? DEFAULT_PAGE_LIMIT : _ref11$limit;
|
|
7799
7813
|
|
|
7800
7814
|
return _this.loadPage(limit);
|
|
7801
7815
|
});
|
|
7802
7816
|
|
|
7803
7817
|
_defineProperty(this, "loadPrevPage", function () {
|
|
7804
|
-
var
|
|
7805
|
-
|
|
7806
|
-
limit =
|
|
7818
|
+
var _ref12 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
7819
|
+
_ref12$limit = _ref12.limit,
|
|
7820
|
+
limit = _ref12$limit === void 0 ? DEFAULT_PAGE_LIMIT : _ref12$limit;
|
|
7807
7821
|
|
|
7808
7822
|
return _this.loadPage(-limit);
|
|
7809
7823
|
});
|
|
7810
7824
|
|
|
7811
7825
|
_defineProperty(this, "loadPage", /*#__PURE__*/function () {
|
|
7812
|
-
var
|
|
7813
|
-
var _this$state$getLatest4, pagination,
|
|
7826
|
+
var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(count) {
|
|
7827
|
+
var _this$state$getLatest4, pagination, _ref14, _ref15, loadingKey, cursorKey, insertionMethodKey, queryOptions, limit, _replies$at$id, _replies$at, data, replies, maybeNextCursor;
|
|
7814
7828
|
|
|
7815
7829
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
7816
7830
|
while (1) {
|
|
7817
7831
|
switch (_context3.prev = _context3.next) {
|
|
7818
7832
|
case 0:
|
|
7819
7833
|
_this$state$getLatest4 = _this.state.getLatestValue(), pagination = _this$state$getLatest4.pagination;
|
|
7820
|
-
|
|
7834
|
+
_ref14 = count > 0 ? ['isLoadingNext', 'nextCursor', 'push'] : ['isLoadingPrev', 'prevCursor', 'unshift'], _ref15 = _slicedToArray(_ref14, 3), loadingKey = _ref15[0], cursorKey = _ref15[1], insertionMethodKey = _ref15[2];
|
|
7821
7835
|
|
|
7822
7836
|
if (!(pagination[loadingKey] || pagination[cursorKey] === null)) {
|
|
7823
7837
|
_context3.next = 4;
|
|
@@ -7888,7 +7902,7 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7888
7902
|
}));
|
|
7889
7903
|
|
|
7890
7904
|
return function (_x) {
|
|
7891
|
-
return
|
|
7905
|
+
return _ref13.apply(this, arguments);
|
|
7892
7906
|
};
|
|
7893
7907
|
}());
|
|
7894
7908
|
|
|
@@ -8486,15 +8500,15 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
8486
8500
|
|
|
8487
8501
|
_defineProperty(this, "subscribeManageThreadSubscriptions", function () {
|
|
8488
8502
|
return _this.state.subscribeWithSelector(function (nextValue) {
|
|
8489
|
-
return
|
|
8503
|
+
return {
|
|
8504
|
+
threads: nextValue.threads
|
|
8505
|
+
};
|
|
8490
8506
|
}, function (_ref5, prev) {
|
|
8491
|
-
var
|
|
8492
|
-
nextThreads = _ref6[0];
|
|
8507
|
+
var nextThreads = _ref5.threads;
|
|
8493
8508
|
|
|
8494
|
-
var
|
|
8495
|
-
|
|
8496
|
-
|
|
8497
|
-
prevThreads = _ref8$ === void 0 ? [] : _ref8$; // Thread instance was removed if there's no thread with the given id at all,
|
|
8509
|
+
var _ref6 = prev !== null && prev !== void 0 ? prev : {},
|
|
8510
|
+
_ref6$threads = _ref6.threads,
|
|
8511
|
+
prevThreads = _ref6$threads === void 0 ? [] : _ref6$threads; // Thread instance was removed if there's no thread with the given id at all,
|
|
8498
8512
|
// or it was replaced with a new instance
|
|
8499
8513
|
|
|
8500
8514
|
|
|
@@ -8512,11 +8526,11 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
8512
8526
|
|
|
8513
8527
|
_defineProperty(this, "subscribeReloadOnActivation", function () {
|
|
8514
8528
|
return _this.state.subscribeWithSelector(function (nextValue) {
|
|
8515
|
-
return
|
|
8516
|
-
|
|
8517
|
-
|
|
8518
|
-
|
|
8519
|
-
|
|
8529
|
+
return {
|
|
8530
|
+
active: nextValue.active
|
|
8531
|
+
};
|
|
8532
|
+
}, function (_ref7) {
|
|
8533
|
+
var active = _ref7.active;
|
|
8520
8534
|
if (active) _this.reload();
|
|
8521
8535
|
});
|
|
8522
8536
|
});
|
|
@@ -8591,8 +8605,8 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
8591
8605
|
});
|
|
8592
8606
|
|
|
8593
8607
|
_defineProperty(this, "reload", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
8594
|
-
var
|
|
8595
|
-
|
|
8608
|
+
var _ref9,
|
|
8609
|
+
_ref9$force,
|
|
8596
8610
|
force,
|
|
8597
8611
|
_this$state$getLatest3,
|
|
8598
8612
|
threads,
|
|
@@ -8614,7 +8628,7 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
8614
8628
|
while (1) {
|
|
8615
8629
|
switch (_context.prev = _context.next) {
|
|
8616
8630
|
case 0:
|
|
8617
|
-
|
|
8631
|
+
_ref9 = _args.length > 0 && _args[0] !== undefined ? _args[0] : {}, _ref9$force = _ref9.force, force = _ref9$force === void 0 ? false : _ref9$force;
|
|
8618
8632
|
_this$state$getLatest3 = _this.state.getLatestValue(), threads = _this$state$getLatest3.threads, unseenThreadIds = _this$state$getLatest3.unseenThreadIds, isThreadOrderStale = _this$state$getLatest3.isThreadOrderStale, pagination = _this$state$getLatest3.pagination, ready = _this$state$getLatest3.ready;
|
|
8619
8633
|
|
|
8620
8634
|
if (!pagination.isLoading) {
|
|
@@ -13341,7 +13355,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13341
13355
|
}, {
|
|
13342
13356
|
key: "getUserAgent",
|
|
13343
13357
|
value: function getUserAgent() {
|
|
13344
|
-
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.
|
|
13358
|
+
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.41.1");
|
|
13345
13359
|
}
|
|
13346
13360
|
}, {
|
|
13347
13361
|
key: "setUserAgent",
|