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.js
CHANGED
|
@@ -7333,12 +7333,21 @@ var StateStore = function StateStore(value) {
|
|
|
7333
7333
|
var selectedValues;
|
|
7334
7334
|
|
|
7335
7335
|
var wrappedHandler = function wrappedHandler(nextValue) {
|
|
7336
|
-
var _selectedValues$some, _selectedValues;
|
|
7337
|
-
|
|
7338
7336
|
var newlySelectedValues = selector(nextValue);
|
|
7339
|
-
var hasUpdatedValues =
|
|
7340
|
-
|
|
7341
|
-
|
|
7337
|
+
var hasUpdatedValues = !selectedValues;
|
|
7338
|
+
|
|
7339
|
+
if (Array.isArray(newlySelectedValues) && StateStore.logCount > 0) {
|
|
7340
|
+
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.');
|
|
7341
|
+
StateStore.logCount--;
|
|
7342
|
+
}
|
|
7343
|
+
|
|
7344
|
+
for (var key in selectedValues) {
|
|
7345
|
+
// @ts-ignore TODO: remove array support (Readonly<unknown[]>)
|
|
7346
|
+
if (selectedValues[key] === newlySelectedValues[key]) continue;
|
|
7347
|
+
hasUpdatedValues = true;
|
|
7348
|
+
break;
|
|
7349
|
+
}
|
|
7350
|
+
|
|
7342
7351
|
if (!hasUpdatedValues) return;
|
|
7343
7352
|
var oldSelectedValues = selectedValues;
|
|
7344
7353
|
selectedValues = newlySelectedValues;
|
|
@@ -7349,6 +7358,8 @@ var StateStore = function StateStore(value) {
|
|
|
7349
7358
|
});
|
|
7350
7359
|
};
|
|
7351
7360
|
|
|
7361
|
+
_defineProperty__default['default'](StateStore, "logCount", 5);
|
|
7362
|
+
|
|
7352
7363
|
var _excluded$1 = ["limit", "sort"];
|
|
7353
7364
|
|
|
7354
7365
|
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; }
|
|
@@ -7497,12 +7508,13 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7497
7508
|
|
|
7498
7509
|
_defineProperty__default['default'](this, "subscribeMarkActiveThreadRead", function () {
|
|
7499
7510
|
return _this.state.subscribeWithSelector(function (nextValue) {
|
|
7500
|
-
return
|
|
7511
|
+
return {
|
|
7512
|
+
active: nextValue.active,
|
|
7513
|
+
unreadMessageCount: ownUnreadCountSelector(_this.client.userID)(nextValue)
|
|
7514
|
+
};
|
|
7501
7515
|
}, function (_ref3) {
|
|
7502
|
-
var
|
|
7503
|
-
|
|
7504
|
-
unreadMessageCount = _ref4[1];
|
|
7505
|
-
|
|
7516
|
+
var active = _ref3.active,
|
|
7517
|
+
unreadMessageCount = _ref3.unreadMessageCount;
|
|
7506
7518
|
if (!active || !unreadMessageCount) return;
|
|
7507
7519
|
|
|
7508
7520
|
_this.throttledMarkAsRead();
|
|
@@ -7511,11 +7523,13 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7511
7523
|
|
|
7512
7524
|
_defineProperty__default['default'](this, "subscribeReloadActiveStaleThread", function () {
|
|
7513
7525
|
return _this.state.subscribeWithSelector(function (nextValue) {
|
|
7514
|
-
return
|
|
7515
|
-
|
|
7516
|
-
|
|
7517
|
-
|
|
7518
|
-
|
|
7526
|
+
return {
|
|
7527
|
+
active: nextValue.active,
|
|
7528
|
+
isStateStale: nextValue.isStateStale
|
|
7529
|
+
};
|
|
7530
|
+
}, function (_ref4) {
|
|
7531
|
+
var active = _ref4.active,
|
|
7532
|
+
isStateStale = _ref4.isStateStale;
|
|
7519
7533
|
|
|
7520
7534
|
if (active && isStateStale) {
|
|
7521
7535
|
_this.reload();
|
|
@@ -7672,10 +7686,10 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7672
7686
|
_this.unsubscribeFunctions.clear();
|
|
7673
7687
|
});
|
|
7674
7688
|
|
|
7675
|
-
_defineProperty__default['default'](this, "deleteReplyLocally", function (
|
|
7689
|
+
_defineProperty__default['default'](this, "deleteReplyLocally", function (_ref5) {
|
|
7676
7690
|
var _replies$index, _replies;
|
|
7677
7691
|
|
|
7678
|
-
var message =
|
|
7692
|
+
var message = _ref5.message;
|
|
7679
7693
|
|
|
7680
7694
|
var _this$state$getLatest3 = _this.state.getLatestValue(),
|
|
7681
7695
|
replies = _this$state$getLatest3.replies;
|
|
@@ -7703,10 +7717,10 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7703
7717
|
});
|
|
7704
7718
|
});
|
|
7705
7719
|
|
|
7706
|
-
_defineProperty__default['default'](this, "upsertReplyLocally", function (
|
|
7707
|
-
var message =
|
|
7708
|
-
|
|
7709
|
-
timestampChanged =
|
|
7720
|
+
_defineProperty__default['default'](this, "upsertReplyLocally", function (_ref6) {
|
|
7721
|
+
var message = _ref6.message,
|
|
7722
|
+
_ref6$timestampChange = _ref6.timestampChanged,
|
|
7723
|
+
timestampChanged = _ref6$timestampChange === void 0 ? false : _ref6$timestampChange;
|
|
7710
7724
|
|
|
7711
7725
|
if (message.parent_id !== _this.id) {
|
|
7712
7726
|
throw new Error('Reply does not belong to this thread');
|
|
@@ -7728,8 +7742,8 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7728
7742
|
});
|
|
7729
7743
|
});
|
|
7730
7744
|
|
|
7731
|
-
_defineProperty__default['default'](this, "updateParentMessageLocally", function (
|
|
7732
|
-
var message =
|
|
7745
|
+
_defineProperty__default['default'](this, "updateParentMessageLocally", function (_ref7) {
|
|
7746
|
+
var message = _ref7.message;
|
|
7733
7747
|
|
|
7734
7748
|
if (message.id !== _this.id) {
|
|
7735
7749
|
throw new Error('Message does not belong to this thread');
|
|
@@ -7762,8 +7776,8 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7762
7776
|
});
|
|
7763
7777
|
|
|
7764
7778
|
_defineProperty__default['default'](this, "markAsRead", /*#__PURE__*/_asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee2() {
|
|
7765
|
-
var
|
|
7766
|
-
|
|
7779
|
+
var _ref9,
|
|
7780
|
+
_ref9$force,
|
|
7767
7781
|
force,
|
|
7768
7782
|
_args2 = arguments;
|
|
7769
7783
|
|
|
@@ -7771,7 +7785,7 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7771
7785
|
while (1) {
|
|
7772
7786
|
switch (_context2.prev = _context2.next) {
|
|
7773
7787
|
case 0:
|
|
7774
|
-
|
|
7788
|
+
_ref9 = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : {}, _ref9$force = _ref9.force, force = _ref9$force === void 0 ? false : _ref9$force;
|
|
7775
7789
|
|
|
7776
7790
|
if (!(_this.ownUnreadCount === 0 && !force)) {
|
|
7777
7791
|
_context2.next = 3;
|
|
@@ -7804,13 +7818,13 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7804
7818
|
}));
|
|
7805
7819
|
|
|
7806
7820
|
_defineProperty__default['default'](this, "queryReplies", function () {
|
|
7807
|
-
var
|
|
7821
|
+
var _ref10 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
7808
7822
|
|
|
7809
|
-
var
|
|
7810
|
-
limit =
|
|
7811
|
-
|
|
7812
|
-
sort =
|
|
7813
|
-
otherOptions = _objectWithoutProperties__default['default'](
|
|
7823
|
+
var _ref10$limit = _ref10.limit,
|
|
7824
|
+
limit = _ref10$limit === void 0 ? DEFAULT_PAGE_LIMIT : _ref10$limit,
|
|
7825
|
+
_ref10$sort = _ref10.sort,
|
|
7826
|
+
sort = _ref10$sort === void 0 ? DEFAULT_SORT : _ref10$sort,
|
|
7827
|
+
otherOptions = _objectWithoutProperties__default['default'](_ref10, _excluded$1);
|
|
7814
7828
|
|
|
7815
7829
|
return _this.channel.getReplies(_this.id, _objectSpread$3({
|
|
7816
7830
|
limit: limit
|
|
@@ -7818,31 +7832,31 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7818
7832
|
});
|
|
7819
7833
|
|
|
7820
7834
|
_defineProperty__default['default'](this, "loadNextPage", function () {
|
|
7821
|
-
var
|
|
7822
|
-
|
|
7823
|
-
limit =
|
|
7835
|
+
var _ref11 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
7836
|
+
_ref11$limit = _ref11.limit,
|
|
7837
|
+
limit = _ref11$limit === void 0 ? DEFAULT_PAGE_LIMIT : _ref11$limit;
|
|
7824
7838
|
|
|
7825
7839
|
return _this.loadPage(limit);
|
|
7826
7840
|
});
|
|
7827
7841
|
|
|
7828
7842
|
_defineProperty__default['default'](this, "loadPrevPage", function () {
|
|
7829
|
-
var
|
|
7830
|
-
|
|
7831
|
-
limit =
|
|
7843
|
+
var _ref12 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
7844
|
+
_ref12$limit = _ref12.limit,
|
|
7845
|
+
limit = _ref12$limit === void 0 ? DEFAULT_PAGE_LIMIT : _ref12$limit;
|
|
7832
7846
|
|
|
7833
7847
|
return _this.loadPage(-limit);
|
|
7834
7848
|
});
|
|
7835
7849
|
|
|
7836
7850
|
_defineProperty__default['default'](this, "loadPage", /*#__PURE__*/function () {
|
|
7837
|
-
var
|
|
7838
|
-
var _this$state$getLatest4, pagination,
|
|
7851
|
+
var _ref13 = _asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee3(count) {
|
|
7852
|
+
var _this$state$getLatest4, pagination, _ref14, _ref15, loadingKey, cursorKey, insertionMethodKey, queryOptions, limit, _replies$at$id, _replies$at, data, replies, maybeNextCursor;
|
|
7839
7853
|
|
|
7840
7854
|
return _regeneratorRuntime__default['default'].wrap(function _callee3$(_context3) {
|
|
7841
7855
|
while (1) {
|
|
7842
7856
|
switch (_context3.prev = _context3.next) {
|
|
7843
7857
|
case 0:
|
|
7844
7858
|
_this$state$getLatest4 = _this.state.getLatestValue(), pagination = _this$state$getLatest4.pagination;
|
|
7845
|
-
|
|
7859
|
+
_ref14 = count > 0 ? ['isLoadingNext', 'nextCursor', 'push'] : ['isLoadingPrev', 'prevCursor', 'unshift'], _ref15 = _slicedToArray__default['default'](_ref14, 3), loadingKey = _ref15[0], cursorKey = _ref15[1], insertionMethodKey = _ref15[2];
|
|
7846
7860
|
|
|
7847
7861
|
if (!(pagination[loadingKey] || pagination[cursorKey] === null)) {
|
|
7848
7862
|
_context3.next = 4;
|
|
@@ -7913,7 +7927,7 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7913
7927
|
}));
|
|
7914
7928
|
|
|
7915
7929
|
return function (_x) {
|
|
7916
|
-
return
|
|
7930
|
+
return _ref13.apply(this, arguments);
|
|
7917
7931
|
};
|
|
7918
7932
|
}());
|
|
7919
7933
|
|
|
@@ -8511,15 +8525,15 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
8511
8525
|
|
|
8512
8526
|
_defineProperty__default['default'](this, "subscribeManageThreadSubscriptions", function () {
|
|
8513
8527
|
return _this.state.subscribeWithSelector(function (nextValue) {
|
|
8514
|
-
return
|
|
8528
|
+
return {
|
|
8529
|
+
threads: nextValue.threads
|
|
8530
|
+
};
|
|
8515
8531
|
}, function (_ref5, prev) {
|
|
8516
|
-
var
|
|
8517
|
-
nextThreads = _ref6[0];
|
|
8532
|
+
var nextThreads = _ref5.threads;
|
|
8518
8533
|
|
|
8519
|
-
var
|
|
8520
|
-
|
|
8521
|
-
|
|
8522
|
-
prevThreads = _ref8$ === void 0 ? [] : _ref8$; // Thread instance was removed if there's no thread with the given id at all,
|
|
8534
|
+
var _ref6 = prev !== null && prev !== void 0 ? prev : {},
|
|
8535
|
+
_ref6$threads = _ref6.threads,
|
|
8536
|
+
prevThreads = _ref6$threads === void 0 ? [] : _ref6$threads; // Thread instance was removed if there's no thread with the given id at all,
|
|
8523
8537
|
// or it was replaced with a new instance
|
|
8524
8538
|
|
|
8525
8539
|
|
|
@@ -8537,11 +8551,11 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
8537
8551
|
|
|
8538
8552
|
_defineProperty__default['default'](this, "subscribeReloadOnActivation", function () {
|
|
8539
8553
|
return _this.state.subscribeWithSelector(function (nextValue) {
|
|
8540
|
-
return
|
|
8541
|
-
|
|
8542
|
-
|
|
8543
|
-
|
|
8544
|
-
|
|
8554
|
+
return {
|
|
8555
|
+
active: nextValue.active
|
|
8556
|
+
};
|
|
8557
|
+
}, function (_ref7) {
|
|
8558
|
+
var active = _ref7.active;
|
|
8545
8559
|
if (active) _this.reload();
|
|
8546
8560
|
});
|
|
8547
8561
|
});
|
|
@@ -8616,8 +8630,8 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
8616
8630
|
});
|
|
8617
8631
|
|
|
8618
8632
|
_defineProperty__default['default'](this, "reload", /*#__PURE__*/_asyncToGenerator__default['default']( /*#__PURE__*/_regeneratorRuntime__default['default'].mark(function _callee() {
|
|
8619
|
-
var
|
|
8620
|
-
|
|
8633
|
+
var _ref9,
|
|
8634
|
+
_ref9$force,
|
|
8621
8635
|
force,
|
|
8622
8636
|
_this$state$getLatest3,
|
|
8623
8637
|
threads,
|
|
@@ -8639,7 +8653,7 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
8639
8653
|
while (1) {
|
|
8640
8654
|
switch (_context.prev = _context.next) {
|
|
8641
8655
|
case 0:
|
|
8642
|
-
|
|
8656
|
+
_ref9 = _args.length > 0 && _args[0] !== undefined ? _args[0] : {}, _ref9$force = _ref9.force, force = _ref9$force === void 0 ? false : _ref9$force;
|
|
8643
8657
|
_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;
|
|
8644
8658
|
|
|
8645
8659
|
if (!pagination.isLoading) {
|
|
@@ -13366,7 +13380,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13366
13380
|
}, {
|
|
13367
13381
|
key: "getUserAgent",
|
|
13368
13382
|
value: function getUserAgent() {
|
|
13369
|
-
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.
|
|
13383
|
+
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.41.1");
|
|
13370
13384
|
}
|
|
13371
13385
|
}, {
|
|
13372
13386
|
key: "setUserAgent",
|