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/index.js
CHANGED
|
@@ -7339,12 +7339,21 @@ var StateStore = function StateStore(value) {
|
|
|
7339
7339
|
var selectedValues;
|
|
7340
7340
|
|
|
7341
7341
|
var wrappedHandler = function wrappedHandler(nextValue) {
|
|
7342
|
-
var _selectedValues$some, _selectedValues;
|
|
7343
|
-
|
|
7344
7342
|
var newlySelectedValues = selector(nextValue);
|
|
7345
|
-
var hasUpdatedValues =
|
|
7346
|
-
|
|
7347
|
-
|
|
7343
|
+
var hasUpdatedValues = !selectedValues;
|
|
7344
|
+
|
|
7345
|
+
if (Array.isArray(newlySelectedValues) && StateStore.logCount > 0) {
|
|
7346
|
+
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.');
|
|
7347
|
+
StateStore.logCount--;
|
|
7348
|
+
}
|
|
7349
|
+
|
|
7350
|
+
for (var key in selectedValues) {
|
|
7351
|
+
// @ts-ignore TODO: remove array support (Readonly<unknown[]>)
|
|
7352
|
+
if (selectedValues[key] === newlySelectedValues[key]) continue;
|
|
7353
|
+
hasUpdatedValues = true;
|
|
7354
|
+
break;
|
|
7355
|
+
}
|
|
7356
|
+
|
|
7348
7357
|
if (!hasUpdatedValues) return;
|
|
7349
7358
|
var oldSelectedValues = selectedValues;
|
|
7350
7359
|
selectedValues = newlySelectedValues;
|
|
@@ -7355,6 +7364,8 @@ var StateStore = function StateStore(value) {
|
|
|
7355
7364
|
});
|
|
7356
7365
|
};
|
|
7357
7366
|
|
|
7367
|
+
_defineProperty__default['default'](StateStore, "logCount", 5);
|
|
7368
|
+
|
|
7358
7369
|
var _excluded$1 = ["limit", "sort"];
|
|
7359
7370
|
|
|
7360
7371
|
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; }
|
|
@@ -7503,12 +7514,13 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7503
7514
|
|
|
7504
7515
|
_defineProperty__default['default'](this, "subscribeMarkActiveThreadRead", function () {
|
|
7505
7516
|
return _this.state.subscribeWithSelector(function (nextValue) {
|
|
7506
|
-
return
|
|
7517
|
+
return {
|
|
7518
|
+
active: nextValue.active,
|
|
7519
|
+
unreadMessageCount: ownUnreadCountSelector(_this.client.userID)(nextValue)
|
|
7520
|
+
};
|
|
7507
7521
|
}, function (_ref3) {
|
|
7508
|
-
var
|
|
7509
|
-
|
|
7510
|
-
unreadMessageCount = _ref4[1];
|
|
7511
|
-
|
|
7522
|
+
var active = _ref3.active,
|
|
7523
|
+
unreadMessageCount = _ref3.unreadMessageCount;
|
|
7512
7524
|
if (!active || !unreadMessageCount) return;
|
|
7513
7525
|
|
|
7514
7526
|
_this.throttledMarkAsRead();
|
|
@@ -7517,11 +7529,13 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7517
7529
|
|
|
7518
7530
|
_defineProperty__default['default'](this, "subscribeReloadActiveStaleThread", function () {
|
|
7519
7531
|
return _this.state.subscribeWithSelector(function (nextValue) {
|
|
7520
|
-
return
|
|
7521
|
-
|
|
7522
|
-
|
|
7523
|
-
|
|
7524
|
-
|
|
7532
|
+
return {
|
|
7533
|
+
active: nextValue.active,
|
|
7534
|
+
isStateStale: nextValue.isStateStale
|
|
7535
|
+
};
|
|
7536
|
+
}, function (_ref4) {
|
|
7537
|
+
var active = _ref4.active,
|
|
7538
|
+
isStateStale = _ref4.isStateStale;
|
|
7525
7539
|
|
|
7526
7540
|
if (active && isStateStale) {
|
|
7527
7541
|
_this.reload();
|
|
@@ -7678,10 +7692,10 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7678
7692
|
_this.unsubscribeFunctions.clear();
|
|
7679
7693
|
});
|
|
7680
7694
|
|
|
7681
|
-
_defineProperty__default['default'](this, "deleteReplyLocally", function (
|
|
7695
|
+
_defineProperty__default['default'](this, "deleteReplyLocally", function (_ref5) {
|
|
7682
7696
|
var _replies$index, _replies;
|
|
7683
7697
|
|
|
7684
|
-
var message =
|
|
7698
|
+
var message = _ref5.message;
|
|
7685
7699
|
|
|
7686
7700
|
var _this$state$getLatest3 = _this.state.getLatestValue(),
|
|
7687
7701
|
replies = _this$state$getLatest3.replies;
|
|
@@ -7709,10 +7723,10 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7709
7723
|
});
|
|
7710
7724
|
});
|
|
7711
7725
|
|
|
7712
|
-
_defineProperty__default['default'](this, "upsertReplyLocally", function (
|
|
7713
|
-
var message =
|
|
7714
|
-
|
|
7715
|
-
timestampChanged =
|
|
7726
|
+
_defineProperty__default['default'](this, "upsertReplyLocally", function (_ref6) {
|
|
7727
|
+
var message = _ref6.message,
|
|
7728
|
+
_ref6$timestampChange = _ref6.timestampChanged,
|
|
7729
|
+
timestampChanged = _ref6$timestampChange === void 0 ? false : _ref6$timestampChange;
|
|
7716
7730
|
|
|
7717
7731
|
if (message.parent_id !== _this.id) {
|
|
7718
7732
|
throw new Error('Reply does not belong to this thread');
|
|
@@ -7734,8 +7748,8 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7734
7748
|
});
|
|
7735
7749
|
});
|
|
7736
7750
|
|
|
7737
|
-
_defineProperty__default['default'](this, "updateParentMessageLocally", function (
|
|
7738
|
-
var message =
|
|
7751
|
+
_defineProperty__default['default'](this, "updateParentMessageLocally", function (_ref7) {
|
|
7752
|
+
var message = _ref7.message;
|
|
7739
7753
|
|
|
7740
7754
|
if (message.id !== _this.id) {
|
|
7741
7755
|
throw new Error('Message does not belong to this thread');
|
|
@@ -7768,8 +7782,8 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7768
7782
|
});
|
|
7769
7783
|
|
|
7770
7784
|
_defineProperty__default['default'](this, "markAsRead", /*#__PURE__*/_asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2() {
|
|
7771
|
-
var
|
|
7772
|
-
|
|
7785
|
+
var _ref9,
|
|
7786
|
+
_ref9$force,
|
|
7773
7787
|
force,
|
|
7774
7788
|
_args2 = arguments;
|
|
7775
7789
|
|
|
@@ -7777,7 +7791,7 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7777
7791
|
while (1) {
|
|
7778
7792
|
switch (_context2.prev = _context2.next) {
|
|
7779
7793
|
case 0:
|
|
7780
|
-
|
|
7794
|
+
_ref9 = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {}, _ref9$force = _ref9.force, force = _ref9$force === void 0 ? false : _ref9$force;
|
|
7781
7795
|
|
|
7782
7796
|
if (!(_this.ownUnreadCount === 0 && !force)) {
|
|
7783
7797
|
_context2.next = 3;
|
|
@@ -7810,13 +7824,13 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7810
7824
|
}));
|
|
7811
7825
|
|
|
7812
7826
|
_defineProperty__default['default'](this, "queryReplies", function () {
|
|
7813
|
-
var
|
|
7827
|
+
var _ref10 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7814
7828
|
|
|
7815
|
-
var
|
|
7816
|
-
limit =
|
|
7817
|
-
|
|
7818
|
-
sort =
|
|
7819
|
-
otherOptions = _objectWithoutProperties__default['default'](
|
|
7829
|
+
var _ref10$limit = _ref10.limit,
|
|
7830
|
+
limit = _ref10$limit === void 0 ? DEFAULT_PAGE_LIMIT : _ref10$limit,
|
|
7831
|
+
_ref10$sort = _ref10.sort,
|
|
7832
|
+
sort = _ref10$sort === void 0 ? DEFAULT_SORT : _ref10$sort,
|
|
7833
|
+
otherOptions = _objectWithoutProperties__default['default'](_ref10, _excluded$1);
|
|
7820
7834
|
|
|
7821
7835
|
return _this.channel.getReplies(_this.id, _objectSpread$3({
|
|
7822
7836
|
limit: limit
|
|
@@ -7824,31 +7838,31 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7824
7838
|
});
|
|
7825
7839
|
|
|
7826
7840
|
_defineProperty__default['default'](this, "loadNextPage", function () {
|
|
7827
|
-
var
|
|
7828
|
-
|
|
7829
|
-
limit =
|
|
7841
|
+
var _ref11 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
7842
|
+
_ref11$limit = _ref11.limit,
|
|
7843
|
+
limit = _ref11$limit === void 0 ? DEFAULT_PAGE_LIMIT : _ref11$limit;
|
|
7830
7844
|
|
|
7831
7845
|
return _this.loadPage(limit);
|
|
7832
7846
|
});
|
|
7833
7847
|
|
|
7834
7848
|
_defineProperty__default['default'](this, "loadPrevPage", function () {
|
|
7835
|
-
var
|
|
7836
|
-
|
|
7837
|
-
limit =
|
|
7849
|
+
var _ref12 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
7850
|
+
_ref12$limit = _ref12.limit,
|
|
7851
|
+
limit = _ref12$limit === void 0 ? DEFAULT_PAGE_LIMIT : _ref12$limit;
|
|
7838
7852
|
|
|
7839
7853
|
return _this.loadPage(-limit);
|
|
7840
7854
|
});
|
|
7841
7855
|
|
|
7842
7856
|
_defineProperty__default['default'](this, "loadPage", /*#__PURE__*/function () {
|
|
7843
|
-
var
|
|
7844
|
-
var _this$state$getLatest4, pagination,
|
|
7857
|
+
var _ref13 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee3(count) {
|
|
7858
|
+
var _this$state$getLatest4, pagination, _ref14, _ref15, loadingKey, cursorKey, insertionMethodKey, queryOptions, limit, _replies$at$id, _replies$at, data, replies, maybeNextCursor;
|
|
7845
7859
|
|
|
7846
7860
|
return _regeneratorRuntime__default['default'].wrap(function _callee3$(_context3) {
|
|
7847
7861
|
while (1) {
|
|
7848
7862
|
switch (_context3.prev = _context3.next) {
|
|
7849
7863
|
case 0:
|
|
7850
7864
|
_this$state$getLatest4 = _this.state.getLatestValue(), pagination = _this$state$getLatest4.pagination;
|
|
7851
|
-
|
|
7865
|
+
_ref14 = count > 0 ? ['isLoadingNext', 'nextCursor', 'push'] : ['isLoadingPrev', 'prevCursor', 'unshift'], _ref15 = _slicedToArray__default['default'](_ref14, 3), loadingKey = _ref15[0], cursorKey = _ref15[1], insertionMethodKey = _ref15[2];
|
|
7852
7866
|
|
|
7853
7867
|
if (!(pagination[loadingKey] || pagination[cursorKey] === null)) {
|
|
7854
7868
|
_context3.next = 4;
|
|
@@ -7919,7 +7933,7 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7919
7933
|
}));
|
|
7920
7934
|
|
|
7921
7935
|
return function (_x) {
|
|
7922
|
-
return
|
|
7936
|
+
return _ref13.apply(this, arguments);
|
|
7923
7937
|
};
|
|
7924
7938
|
}());
|
|
7925
7939
|
|
|
@@ -8517,15 +8531,15 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
8517
8531
|
|
|
8518
8532
|
_defineProperty__default['default'](this, "subscribeManageThreadSubscriptions", function () {
|
|
8519
8533
|
return _this.state.subscribeWithSelector(function (nextValue) {
|
|
8520
|
-
return
|
|
8534
|
+
return {
|
|
8535
|
+
threads: nextValue.threads
|
|
8536
|
+
};
|
|
8521
8537
|
}, function (_ref5, prev) {
|
|
8522
|
-
var
|
|
8523
|
-
nextThreads = _ref6[0];
|
|
8538
|
+
var nextThreads = _ref5.threads;
|
|
8524
8539
|
|
|
8525
|
-
var
|
|
8526
|
-
|
|
8527
|
-
|
|
8528
|
-
prevThreads = _ref8$ === void 0 ? [] : _ref8$; // Thread instance was removed if there's no thread with the given id at all,
|
|
8540
|
+
var _ref6 = prev !== null && prev !== void 0 ? prev : {},
|
|
8541
|
+
_ref6$threads = _ref6.threads,
|
|
8542
|
+
prevThreads = _ref6$threads === void 0 ? [] : _ref6$threads; // Thread instance was removed if there's no thread with the given id at all,
|
|
8529
8543
|
// or it was replaced with a new instance
|
|
8530
8544
|
|
|
8531
8545
|
|
|
@@ -8543,11 +8557,11 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
8543
8557
|
|
|
8544
8558
|
_defineProperty__default['default'](this, "subscribeReloadOnActivation", function () {
|
|
8545
8559
|
return _this.state.subscribeWithSelector(function (nextValue) {
|
|
8546
|
-
return
|
|
8547
|
-
|
|
8548
|
-
|
|
8549
|
-
|
|
8550
|
-
|
|
8560
|
+
return {
|
|
8561
|
+
active: nextValue.active
|
|
8562
|
+
};
|
|
8563
|
+
}, function (_ref7) {
|
|
8564
|
+
var active = _ref7.active;
|
|
8551
8565
|
if (active) _this.reload();
|
|
8552
8566
|
});
|
|
8553
8567
|
});
|
|
@@ -8622,8 +8636,8 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
8622
8636
|
});
|
|
8623
8637
|
|
|
8624
8638
|
_defineProperty__default['default'](this, "reload", /*#__PURE__*/_asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee() {
|
|
8625
|
-
var
|
|
8626
|
-
|
|
8639
|
+
var _ref9,
|
|
8640
|
+
_ref9$force,
|
|
8627
8641
|
force,
|
|
8628
8642
|
_this$state$getLatest3,
|
|
8629
8643
|
threads,
|
|
@@ -8645,7 +8659,7 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
8645
8659
|
while (1) {
|
|
8646
8660
|
switch (_context.prev = _context.next) {
|
|
8647
8661
|
case 0:
|
|
8648
|
-
|
|
8662
|
+
_ref9 = _args.length > 0 && _args[0] !== undefined ? _args[0] : {}, _ref9$force = _ref9.force, force = _ref9$force === void 0 ? false : _ref9$force;
|
|
8649
8663
|
_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;
|
|
8650
8664
|
|
|
8651
8665
|
if (!pagination.isLoading) {
|
|
@@ -13372,7 +13386,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13372
13386
|
}, {
|
|
13373
13387
|
key: "getUserAgent",
|
|
13374
13388
|
value: function getUserAgent() {
|
|
13375
|
-
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.
|
|
13389
|
+
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.41.1");
|
|
13376
13390
|
}
|
|
13377
13391
|
}, {
|
|
13378
13392
|
key: "setUserAgent",
|