stream-chat 8.54.0 → 8.55.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/browser.es.js +1067 -250
- 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 +1071 -249
- package/dist/browser.js.map +1 -1
- package/dist/index.es.js +1067 -250
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1071 -249
- package/dist/index.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/poll_manager.d.ts +2 -2
- package/dist/types/poll_manager.d.ts.map +1 -1
- package/dist/types/search_controller.d.ts +174 -0
- package/dist/types/search_controller.d.ts.map +1 -0
- package/dist/types/types.d.ts +41 -0
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils.d.ts +28 -0
- package/dist/types/utils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/channel.ts +1 -1
- package/src/client.ts +1 -1
- package/src/index.ts +1 -0
- package/src/poll_manager.ts +5 -1
- package/src/search_controller.ts +489 -0
- package/src/types.ts +41 -0
- package/src/utils.ts +76 -0
package/dist/index.es.js
CHANGED
|
@@ -300,9 +300,9 @@ var Campaign = /*#__PURE__*/function () {
|
|
|
300
300
|
return Campaign;
|
|
301
301
|
}();
|
|
302
302
|
|
|
303
|
-
function ownKeys$
|
|
303
|
+
function ownKeys$d(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; }
|
|
304
304
|
|
|
305
|
-
function _objectSpread$
|
|
305
|
+
function _objectSpread$d(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$d(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$d(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
306
306
|
|
|
307
307
|
function _createForOfIteratorHelper$5(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$5(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function (_e) { function e(_x) { return _e.apply(this, arguments); } e.toString = function () { return _e.toString(); }; return e; }(function (e) { throw e; }), f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function (_e2) { function e(_x2) { return _e2.apply(this, arguments); } e.toString = function () { return _e2.toString(); }; return e; }(function (e) { didErr = true; err = e; }), f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
308
308
|
|
|
@@ -564,7 +564,7 @@ var axiosParamsSerializer = function axiosParamsSerializer(params) {
|
|
|
564
564
|
*/
|
|
565
565
|
|
|
566
566
|
function formatMessage(message) {
|
|
567
|
-
return _objectSpread$
|
|
567
|
+
return _objectSpread$d(_objectSpread$d({}, message), {}, {
|
|
568
568
|
/**
|
|
569
569
|
* @deprecated please use `html`
|
|
570
570
|
*/
|
|
@@ -707,25 +707,86 @@ function maybeGetReactionGroupsFallback(groups, counts, scores) {
|
|
|
707
707
|
}
|
|
708
708
|
|
|
709
709
|
return null;
|
|
710
|
-
} //
|
|
710
|
+
} // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
711
711
|
|
|
712
712
|
|
|
713
|
-
|
|
714
|
-
|
|
713
|
+
// works exactly the same as lodash.debounce
|
|
714
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
715
|
+
var debounce = function debounce(fn) {
|
|
716
|
+
var timeout = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
715
717
|
|
|
716
718
|
var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
717
719
|
_ref2$leading = _ref2.leading,
|
|
718
|
-
leading = _ref2$leading === void 0 ?
|
|
720
|
+
leading = _ref2$leading === void 0 ? false : _ref2$leading,
|
|
719
721
|
_ref2$trailing = _ref2.trailing,
|
|
720
|
-
trailing = _ref2$trailing === void 0 ?
|
|
722
|
+
trailing = _ref2$trailing === void 0 ? true : _ref2$trailing;
|
|
721
723
|
|
|
722
724
|
var runningTimeout = null;
|
|
723
|
-
var
|
|
724
|
-
|
|
725
|
+
var argsForTrailingExecution = null;
|
|
726
|
+
var lastResult;
|
|
727
|
+
|
|
728
|
+
var debouncedFn = function debouncedFn() {
|
|
725
729
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
726
730
|
args[_key] = arguments[_key];
|
|
727
731
|
}
|
|
728
732
|
|
|
733
|
+
if (runningTimeout) {
|
|
734
|
+
clearTimeout(runningTimeout);
|
|
735
|
+
} else if (leading) {
|
|
736
|
+
lastResult = fn.apply(void 0, args);
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
if (trailing) argsForTrailingExecution = args;
|
|
740
|
+
|
|
741
|
+
var timeoutHandler = function timeoutHandler() {
|
|
742
|
+
if (argsForTrailingExecution) {
|
|
743
|
+
lastResult = fn.apply(void 0, _toConsumableArray(argsForTrailingExecution));
|
|
744
|
+
argsForTrailingExecution = null;
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
runningTimeout = null;
|
|
748
|
+
};
|
|
749
|
+
|
|
750
|
+
runningTimeout = setTimeout(timeoutHandler, timeout);
|
|
751
|
+
return lastResult;
|
|
752
|
+
};
|
|
753
|
+
|
|
754
|
+
debouncedFn.cancel = function () {
|
|
755
|
+
if (runningTimeout) clearTimeout(runningTimeout);
|
|
756
|
+
};
|
|
757
|
+
|
|
758
|
+
debouncedFn.flush = function () {
|
|
759
|
+
if (runningTimeout) {
|
|
760
|
+
clearTimeout(runningTimeout);
|
|
761
|
+
runningTimeout = null;
|
|
762
|
+
|
|
763
|
+
if (argsForTrailingExecution) {
|
|
764
|
+
lastResult = fn.apply(void 0, _toConsumableArray(argsForTrailingExecution));
|
|
765
|
+
}
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
return lastResult;
|
|
769
|
+
};
|
|
770
|
+
|
|
771
|
+
return debouncedFn;
|
|
772
|
+
}; // works exactly the same as lodash.throttle
|
|
773
|
+
|
|
774
|
+
var throttle = function throttle(fn) {
|
|
775
|
+
var timeout = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200;
|
|
776
|
+
|
|
777
|
+
var _ref3 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
778
|
+
_ref3$leading = _ref3.leading,
|
|
779
|
+
leading = _ref3$leading === void 0 ? true : _ref3$leading,
|
|
780
|
+
_ref3$trailing = _ref3.trailing,
|
|
781
|
+
trailing = _ref3$trailing === void 0 ? false : _ref3$trailing;
|
|
782
|
+
|
|
783
|
+
var runningTimeout = null;
|
|
784
|
+
var storedArgs = null;
|
|
785
|
+
return function () {
|
|
786
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
787
|
+
args[_key2] = arguments[_key2];
|
|
788
|
+
}
|
|
789
|
+
|
|
729
790
|
if (runningTimeout) {
|
|
730
791
|
if (trailing) storedArgs = args;
|
|
731
792
|
return;
|
|
@@ -774,13 +835,13 @@ function binarySearchByDateEqualOrNearestGreater(array, targetDate) {
|
|
|
774
835
|
return left;
|
|
775
836
|
}
|
|
776
837
|
|
|
777
|
-
var messagePaginationCreatedAtAround = function messagePaginationCreatedAtAround(
|
|
778
|
-
var parentSet =
|
|
779
|
-
requestedPageSize =
|
|
780
|
-
returnedPage =
|
|
781
|
-
messagePaginationOptions =
|
|
838
|
+
var messagePaginationCreatedAtAround = function messagePaginationCreatedAtAround(_ref4) {
|
|
839
|
+
var parentSet = _ref4.parentSet,
|
|
840
|
+
requestedPageSize = _ref4.requestedPageSize,
|
|
841
|
+
returnedPage = _ref4.returnedPage,
|
|
842
|
+
messagePaginationOptions = _ref4.messagePaginationOptions;
|
|
782
843
|
|
|
783
|
-
var newPagination = _objectSpread$
|
|
844
|
+
var newPagination = _objectSpread$d({}, parentSet.pagination);
|
|
784
845
|
|
|
785
846
|
if (!(messagePaginationOptions !== null && messagePaginationOptions !== void 0 && messagePaginationOptions.created_at_around)) return newPagination;
|
|
786
847
|
var hasPrev;
|
|
@@ -788,9 +849,9 @@ var messagePaginationCreatedAtAround = function messagePaginationCreatedAtAround
|
|
|
788
849
|
var updateHasPrev;
|
|
789
850
|
var updateHasNext;
|
|
790
851
|
var createdAtAroundDate = new Date(messagePaginationOptions.created_at_around);
|
|
791
|
-
var
|
|
792
|
-
firstPageMsg =
|
|
793
|
-
lastPageMsg =
|
|
852
|
+
var _ref5 = [returnedPage[0], returnedPage.slice(-1)[0]],
|
|
853
|
+
firstPageMsg = _ref5[0],
|
|
854
|
+
lastPageMsg = _ref5[1]; // expect ASC order (from oldest to newest)
|
|
794
855
|
|
|
795
856
|
var wholePageHasNewerMessages = !!(firstPageMsg !== null && firstPageMsg !== void 0 && firstPageMsg.created_at) && new Date(firstPageMsg.created_at) > createdAtAroundDate;
|
|
796
857
|
var wholePageHasOlderMessages = !!(lastPageMsg !== null && lastPageMsg !== void 0 && lastPageMsg.created_at) && new Date(lastPageMsg.created_at) < createdAtAroundDate;
|
|
@@ -837,25 +898,25 @@ var messagePaginationCreatedAtAround = function messagePaginationCreatedAtAround
|
|
|
837
898
|
return newPagination;
|
|
838
899
|
};
|
|
839
900
|
|
|
840
|
-
var messagePaginationIdAround = function messagePaginationIdAround(
|
|
901
|
+
var messagePaginationIdAround = function messagePaginationIdAround(_ref6) {
|
|
841
902
|
var _parentSet$messages$2, _parentSet$messages$s2;
|
|
842
903
|
|
|
843
|
-
var parentSet =
|
|
844
|
-
requestedPageSize =
|
|
845
|
-
returnedPage =
|
|
846
|
-
messagePaginationOptions =
|
|
904
|
+
var parentSet = _ref6.parentSet,
|
|
905
|
+
requestedPageSize = _ref6.requestedPageSize,
|
|
906
|
+
returnedPage = _ref6.returnedPage,
|
|
907
|
+
messagePaginationOptions = _ref6.messagePaginationOptions;
|
|
847
908
|
|
|
848
|
-
var newPagination = _objectSpread$
|
|
909
|
+
var newPagination = _objectSpread$d({}, parentSet.pagination);
|
|
849
910
|
|
|
850
|
-
var
|
|
851
|
-
id_around =
|
|
911
|
+
var _ref7 = messagePaginationOptions || {},
|
|
912
|
+
id_around = _ref7.id_around;
|
|
852
913
|
|
|
853
914
|
if (!id_around) return newPagination;
|
|
854
915
|
var hasPrev;
|
|
855
916
|
var hasNext;
|
|
856
|
-
var
|
|
857
|
-
firstPageMsg =
|
|
858
|
-
lastPageMsg =
|
|
917
|
+
var _ref8 = [returnedPage[0], returnedPage.slice(-1)[0]],
|
|
918
|
+
firstPageMsg = _ref8[0],
|
|
919
|
+
lastPageMsg = _ref8[1];
|
|
859
920
|
var firstPageMsgIsFirstInSet = (firstPageMsg === null || firstPageMsg === void 0 ? void 0 : firstPageMsg.id) === ((_parentSet$messages$2 = parentSet.messages[0]) === null || _parentSet$messages$2 === void 0 ? void 0 : _parentSet$messages$2.id),
|
|
860
921
|
lastPageMsgIsLastInSet = (lastPageMsg === null || lastPageMsg === void 0 ? void 0 : lastPageMsg.id) === ((_parentSet$messages$s2 = parentSet.messages.slice(-1)[0]) === null || _parentSet$messages$s2 === void 0 ? void 0 : _parentSet$messages$s2.id);
|
|
861
922
|
var updateHasPrev = firstPageMsgIsFirstInSet;
|
|
@@ -895,21 +956,21 @@ var messagePaginationIdAround = function messagePaginationIdAround(_ref5) {
|
|
|
895
956
|
return newPagination;
|
|
896
957
|
};
|
|
897
958
|
|
|
898
|
-
var messagePaginationLinear = function messagePaginationLinear(
|
|
959
|
+
var messagePaginationLinear = function messagePaginationLinear(_ref9) {
|
|
899
960
|
var _parentSet$messages$3, _parentSet$messages$s3;
|
|
900
961
|
|
|
901
|
-
var parentSet =
|
|
902
|
-
requestedPageSize =
|
|
903
|
-
returnedPage =
|
|
904
|
-
messagePaginationOptions =
|
|
962
|
+
var parentSet = _ref9.parentSet,
|
|
963
|
+
requestedPageSize = _ref9.requestedPageSize,
|
|
964
|
+
returnedPage = _ref9.returnedPage,
|
|
965
|
+
messagePaginationOptions = _ref9.messagePaginationOptions;
|
|
905
966
|
|
|
906
|
-
var newPagination = _objectSpread$
|
|
967
|
+
var newPagination = _objectSpread$d({}, parentSet.pagination);
|
|
907
968
|
|
|
908
969
|
var hasPrev;
|
|
909
970
|
var hasNext;
|
|
910
|
-
var
|
|
911
|
-
firstPageMsg =
|
|
912
|
-
lastPageMsg =
|
|
971
|
+
var _ref10 = [returnedPage[0], returnedPage.slice(-1)[0]],
|
|
972
|
+
firstPageMsg = _ref10[0],
|
|
973
|
+
lastPageMsg = _ref10[1];
|
|
913
974
|
var firstPageMsgIsFirstInSet = (firstPageMsg === null || firstPageMsg === void 0 ? void 0 : firstPageMsg.id) && firstPageMsg.id === ((_parentSet$messages$3 = parentSet.messages[0]) === null || _parentSet$messages$3 === void 0 ? void 0 : _parentSet$messages$3.id),
|
|
914
975
|
lastPageMsgIsLastInSet = (lastPageMsg === null || lastPageMsg === void 0 ? void 0 : lastPageMsg.id) && lastPageMsg.id === ((_parentSet$messages$s3 = parentSet.messages.slice(-1)[0]) === null || _parentSet$messages$s3 === void 0 ? void 0 : _parentSet$messages$s3.id);
|
|
915
976
|
var queriedNextMessages = messagePaginationOptions && (messagePaginationOptions.created_at_after_or_equal || messagePaginationOptions.created_at_after || messagePaginationOptions.id_gt || messagePaginationOptions.id_gte);
|
|
@@ -957,9 +1018,9 @@ var DEFAULT_MESSAGE_SET_PAGINATION = {
|
|
|
957
1018
|
hasPrev: false
|
|
958
1019
|
};
|
|
959
1020
|
|
|
960
|
-
function ownKeys$
|
|
1021
|
+
function ownKeys$c(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; }
|
|
961
1022
|
|
|
962
|
-
function _objectSpread$
|
|
1023
|
+
function _objectSpread$c(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$c(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$c(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
963
1024
|
|
|
964
1025
|
/**
|
|
965
1026
|
* ChannelState - A container class for the channel state.
|
|
@@ -1040,7 +1101,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
1040
1101
|
var m = messages[i];
|
|
1041
1102
|
|
|
1042
1103
|
if (((_m$user = m.user) === null || _m$user === void 0 ? void 0 : _m$user.id) === user.id) {
|
|
1043
|
-
messages[i] = _objectSpread$
|
|
1104
|
+
messages[i] = _objectSpread$c(_objectSpread$c({}, m), {}, {
|
|
1044
1105
|
user: user
|
|
1045
1106
|
});
|
|
1046
1107
|
}
|
|
@@ -1095,7 +1156,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
1095
1156
|
user: m.user
|
|
1096
1157
|
};
|
|
1097
1158
|
} else {
|
|
1098
|
-
messages[i] = _objectSpread$
|
|
1159
|
+
messages[i] = _objectSpread$c(_objectSpread$c({}, m), {}, {
|
|
1099
1160
|
type: 'deleted',
|
|
1100
1161
|
deleted_at: user.deleted_at ? new Date(user.deleted_at) : null
|
|
1101
1162
|
});
|
|
@@ -1413,7 +1474,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
1413
1474
|
var parseMessage = function parseMessage(m) {
|
|
1414
1475
|
var _m$pinned_at, _m$updated_at;
|
|
1415
1476
|
|
|
1416
|
-
return _objectSpread$
|
|
1477
|
+
return _objectSpread$c(_objectSpread$c({}, m), {}, {
|
|
1417
1478
|
created_at: m.created_at.toISOString(),
|
|
1418
1479
|
pinned_at: (_m$pinned_at = m.pinned_at) === null || _m$pinned_at === void 0 ? void 0 : _m$pinned_at.toISOString(),
|
|
1419
1480
|
updated_at: (_m$updated_at = m.updated_at) === null || _m$updated_at === void 0 ? void 0 : _m$updated_at.toISOString()
|
|
@@ -1423,8 +1484,8 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
1423
1484
|
var update = function update(messages) {
|
|
1424
1485
|
var updatedMessages = messages.reduce(function (acc, msg) {
|
|
1425
1486
|
if (msg.quoted_message_id === message.id) {
|
|
1426
|
-
acc.push(_objectSpread$
|
|
1427
|
-
quoted_message: remove ? _objectSpread$
|
|
1487
|
+
acc.push(_objectSpread$c(_objectSpread$c({}, parseMessage(msg)), {}, {
|
|
1488
|
+
quoted_message: remove ? _objectSpread$c(_objectSpread$c({}, message), {}, {
|
|
1428
1489
|
attachments: []
|
|
1429
1490
|
}) : message
|
|
1430
1491
|
}));
|
|
@@ -1913,9 +1974,9 @@ function _unsupportedIterableToArray$4(o, minLen) { if (!o) return; if (typeof o
|
|
|
1913
1974
|
|
|
1914
1975
|
function _arrayLikeToArray$4(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
1915
1976
|
|
|
1916
|
-
function ownKeys$
|
|
1977
|
+
function ownKeys$b(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; }
|
|
1917
1978
|
|
|
1918
|
-
function _objectSpread$
|
|
1979
|
+
function _objectSpread$b(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$b(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$b(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
1919
1980
|
/**
|
|
1920
1981
|
* Channel - The Channel class manages it's own state.
|
|
1921
1982
|
*/
|
|
@@ -1990,7 +2051,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1990
2051
|
while (1) {
|
|
1991
2052
|
switch (_context.prev = _context.next) {
|
|
1992
2053
|
case 0:
|
|
1993
|
-
defaultOptions = _objectSpread$
|
|
2054
|
+
defaultOptions = _objectSpread$b(_objectSpread$b({}, options), {}, {
|
|
1994
2055
|
watch: false,
|
|
1995
2056
|
state: false,
|
|
1996
2057
|
presence: false
|
|
@@ -2062,7 +2123,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2062
2123
|
|
|
2063
2124
|
this.data = data; // this._data is used for the requests...
|
|
2064
2125
|
|
|
2065
|
-
this._data = _objectSpread$
|
|
2126
|
+
this._data = _objectSpread$b({}, data);
|
|
2066
2127
|
this.cid = "".concat(type, ":").concat(id);
|
|
2067
2128
|
this.listeners = {}; // perhaps the state variable should be private
|
|
2068
2129
|
|
|
@@ -2124,7 +2185,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2124
2185
|
switch (_context2.prev = _context2.next) {
|
|
2125
2186
|
case 0:
|
|
2126
2187
|
_context2.next = 2;
|
|
2127
|
-
return this.getClient().post(this._channelURL() + '/message', _objectSpread$
|
|
2188
|
+
return this.getClient().post(this._channelURL() + '/message', _objectSpread$b({
|
|
2128
2189
|
message: message
|
|
2129
2190
|
}, options));
|
|
2130
2191
|
|
|
@@ -2240,7 +2301,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2240
2301
|
|
|
2241
2302
|
case 3:
|
|
2242
2303
|
// Return a list of channels
|
|
2243
|
-
payload = _objectSpread$
|
|
2304
|
+
payload = _objectSpread$b(_objectSpread$b({
|
|
2244
2305
|
filter_conditions: {
|
|
2245
2306
|
cid: this.cid
|
|
2246
2307
|
}
|
|
@@ -2337,7 +2398,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2337
2398
|
|
|
2338
2399
|
_context5.next = 6;
|
|
2339
2400
|
return this.getClient().get(this.getClient().baseURL + '/members', {
|
|
2340
|
-
payload: _objectSpread$
|
|
2401
|
+
payload: _objectSpread$b({
|
|
2341
2402
|
type: type,
|
|
2342
2403
|
id: id,
|
|
2343
2404
|
members: members,
|
|
@@ -2443,7 +2504,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2443
2504
|
|
|
2444
2505
|
case 4:
|
|
2445
2506
|
_context7.next = 6;
|
|
2446
|
-
return this.getClient().post(this.getClient().baseURL + "/messages/".concat(encodeURIComponent(messageID), "/reaction"), _objectSpread$
|
|
2507
|
+
return this.getClient().post(this.getClient().baseURL + "/messages/".concat(encodeURIComponent(messageID), "/reaction"), _objectSpread$b({
|
|
2447
2508
|
reaction: reaction
|
|
2448
2509
|
}, options));
|
|
2449
2510
|
|
|
@@ -2524,7 +2585,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2524
2585
|
delete channelData[key];
|
|
2525
2586
|
});
|
|
2526
2587
|
_context8.next = 7;
|
|
2527
|
-
return this._update(_objectSpread$
|
|
2588
|
+
return this._update(_objectSpread$b({
|
|
2528
2589
|
message: updateMessage,
|
|
2529
2590
|
data: channelData
|
|
2530
2591
|
}, options));
|
|
@@ -2696,7 +2757,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2696
2757
|
case 0:
|
|
2697
2758
|
options = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : {};
|
|
2698
2759
|
_context12.next = 3;
|
|
2699
|
-
return this.getClient().delete(this._channelURL(), _objectSpread$
|
|
2760
|
+
return this.getClient().delete(this._channelURL(), _objectSpread$b({}, options));
|
|
2700
2761
|
|
|
2701
2762
|
case 3:
|
|
2702
2763
|
return _context12.abrupt("return", _context12.sent);
|
|
@@ -2772,7 +2833,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2772
2833
|
case 0:
|
|
2773
2834
|
options = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {};
|
|
2774
2835
|
_context14.next = 3;
|
|
2775
|
-
return this._update(_objectSpread$
|
|
2836
|
+
return this._update(_objectSpread$b({
|
|
2776
2837
|
accept_invite: true
|
|
2777
2838
|
}, options));
|
|
2778
2839
|
|
|
@@ -2813,7 +2874,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2813
2874
|
case 0:
|
|
2814
2875
|
options = _args15.length > 0 && _args15[0] !== undefined ? _args15[0] : {};
|
|
2815
2876
|
_context15.next = 3;
|
|
2816
|
-
return this._update(_objectSpread$
|
|
2877
|
+
return this._update(_objectSpread$b({
|
|
2817
2878
|
reject_invite: true
|
|
2818
2879
|
}, options));
|
|
2819
2880
|
|
|
@@ -2855,7 +2916,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2855
2916
|
case 0:
|
|
2856
2917
|
options = _args16.length > 2 && _args16[2] !== undefined ? _args16[2] : {};
|
|
2857
2918
|
_context16.next = 3;
|
|
2858
|
-
return this._update(_objectSpread$
|
|
2919
|
+
return this._update(_objectSpread$b({
|
|
2859
2920
|
add_members: members,
|
|
2860
2921
|
message: message
|
|
2861
2922
|
}, options));
|
|
@@ -2898,7 +2959,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2898
2959
|
case 0:
|
|
2899
2960
|
options = _args17.length > 2 && _args17[2] !== undefined ? _args17[2] : {};
|
|
2900
2961
|
_context17.next = 3;
|
|
2901
|
-
return this._update(_objectSpread$
|
|
2962
|
+
return this._update(_objectSpread$b({
|
|
2902
2963
|
add_moderators: members,
|
|
2903
2964
|
message: message
|
|
2904
2965
|
}, options));
|
|
@@ -2941,7 +3002,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2941
3002
|
case 0:
|
|
2942
3003
|
options = _args18.length > 2 && _args18[2] !== undefined ? _args18[2] : {};
|
|
2943
3004
|
_context18.next = 3;
|
|
2944
|
-
return this._update(_objectSpread$
|
|
3005
|
+
return this._update(_objectSpread$b({
|
|
2945
3006
|
assign_roles: roles,
|
|
2946
3007
|
message: message
|
|
2947
3008
|
}, options));
|
|
@@ -2984,7 +3045,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2984
3045
|
case 0:
|
|
2985
3046
|
options = _args19.length > 2 && _args19[2] !== undefined ? _args19[2] : {};
|
|
2986
3047
|
_context19.next = 3;
|
|
2987
|
-
return this._update(_objectSpread$
|
|
3048
|
+
return this._update(_objectSpread$b({
|
|
2988
3049
|
invites: members,
|
|
2989
3050
|
message: message
|
|
2990
3051
|
}, options));
|
|
@@ -3027,7 +3088,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3027
3088
|
case 0:
|
|
3028
3089
|
options = _args20.length > 2 && _args20[2] !== undefined ? _args20[2] : {};
|
|
3029
3090
|
_context20.next = 3;
|
|
3030
|
-
return this._update(_objectSpread$
|
|
3091
|
+
return this._update(_objectSpread$b({
|
|
3031
3092
|
remove_members: members,
|
|
3032
3093
|
message: message
|
|
3033
3094
|
}, options));
|
|
@@ -3070,7 +3131,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3070
3131
|
case 0:
|
|
3071
3132
|
options = _args21.length > 2 && _args21[2] !== undefined ? _args21[2] : {};
|
|
3072
3133
|
_context21.next = 3;
|
|
3073
|
-
return this._update(_objectSpread$
|
|
3134
|
+
return this._update(_objectSpread$b({
|
|
3074
3135
|
demote_moderators: members,
|
|
3075
3136
|
message: message
|
|
3076
3137
|
}, options));
|
|
@@ -3155,7 +3216,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3155
3216
|
case 0:
|
|
3156
3217
|
opts = _args23.length > 0 && _args23[0] !== undefined ? _args23[0] : {};
|
|
3157
3218
|
_context23.next = 3;
|
|
3158
|
-
return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$
|
|
3219
|
+
return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$b({
|
|
3159
3220
|
channel_cid: this.cid
|
|
3160
3221
|
}, opts));
|
|
3161
3222
|
|
|
@@ -3197,7 +3258,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3197
3258
|
case 0:
|
|
3198
3259
|
opts = _args24.length > 0 && _args24[0] !== undefined ? _args24[0] : {};
|
|
3199
3260
|
_context24.next = 3;
|
|
3200
|
-
return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$
|
|
3261
|
+
return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$b({
|
|
3201
3262
|
channel_cid: this.cid
|
|
3202
3263
|
}, opts));
|
|
3203
3264
|
|
|
@@ -3534,7 +3595,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3534
3595
|
|
|
3535
3596
|
this.lastTypingEvent = new Date();
|
|
3536
3597
|
_context29.next = 10;
|
|
3537
|
-
return this.sendEvent(_objectSpread$
|
|
3598
|
+
return this.sendEvent(_objectSpread$b({
|
|
3538
3599
|
type: 'typing.start',
|
|
3539
3600
|
parent_id: parent_id
|
|
3540
3601
|
}, options || {}));
|
|
@@ -3574,7 +3635,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3574
3635
|
case 0:
|
|
3575
3636
|
options = _args30.length > 2 && _args30[2] !== undefined ? _args30[2] : {};
|
|
3576
3637
|
_context30.next = 3;
|
|
3577
|
-
return this.sendEvent(_objectSpread$
|
|
3638
|
+
return this.sendEvent(_objectSpread$b(_objectSpread$b({}, options), {}, {
|
|
3578
3639
|
type: 'ai_indicator.update',
|
|
3579
3640
|
message_id: messageId,
|
|
3580
3641
|
ai_state: state
|
|
@@ -3683,7 +3744,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3683
3744
|
this.lastTypingEvent = null;
|
|
3684
3745
|
this.isTyping = false;
|
|
3685
3746
|
_context33.next = 6;
|
|
3686
|
-
return this.sendEvent(_objectSpread$
|
|
3747
|
+
return this.sendEvent(_objectSpread$b({
|
|
3687
3748
|
type: 'typing.stop',
|
|
3688
3749
|
parent_id: parent_id
|
|
3689
3750
|
}, options || {}));
|
|
@@ -3770,7 +3831,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3770
3831
|
|
|
3771
3832
|
case 4:
|
|
3772
3833
|
_context34.next = 6;
|
|
3773
|
-
return this.getClient().post(this._channelURL() + '/read', _objectSpread$
|
|
3834
|
+
return this.getClient().post(this._channelURL() + '/read', _objectSpread$b({}, data));
|
|
3774
3835
|
|
|
3775
3836
|
case 6:
|
|
3776
3837
|
return _context34.abrupt("return", _context34.sent);
|
|
@@ -3817,7 +3878,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3817
3878
|
|
|
3818
3879
|
case 3:
|
|
3819
3880
|
_context35.next = 5;
|
|
3820
|
-
return this.getClient().post(this._channelURL() + '/unread', _objectSpread$
|
|
3881
|
+
return this.getClient().post(this._channelURL() + '/unread', _objectSpread$b({}, data));
|
|
3821
3882
|
|
|
3822
3883
|
case 5:
|
|
3823
3884
|
return _context35.abrupt("return", _context35.sent);
|
|
@@ -3885,7 +3946,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3885
3946
|
defaultOptions.watch = false;
|
|
3886
3947
|
}
|
|
3887
3948
|
|
|
3888
|
-
combined = _objectSpread$
|
|
3949
|
+
combined = _objectSpread$b(_objectSpread$b({}, defaultOptions), options);
|
|
3889
3950
|
_context36.next = 7;
|
|
3890
3951
|
return this.query(combined, 'latest');
|
|
3891
3952
|
|
|
@@ -3979,7 +4040,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3979
4040
|
case 0:
|
|
3980
4041
|
normalizedSort = sort ? normalizeQuerySort(sort) : undefined;
|
|
3981
4042
|
_context38.next = 3;
|
|
3982
|
-
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(encodeURIComponent(parent_id), "/replies"), _objectSpread$
|
|
4043
|
+
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(encodeURIComponent(parent_id), "/replies"), _objectSpread$b({
|
|
3983
4044
|
sort: normalizedSort
|
|
3984
4045
|
}, options));
|
|
3985
4046
|
|
|
@@ -4029,7 +4090,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4029
4090
|
sort = _args39.length > 1 && _args39[1] !== undefined ? _args39[1] : [];
|
|
4030
4091
|
_context39.next = 3;
|
|
4031
4092
|
return this.getClient().get(this._channelURL() + '/pinned_messages', {
|
|
4032
|
-
payload: _objectSpread$
|
|
4093
|
+
payload: _objectSpread$b(_objectSpread$b({}, options), {}, {
|
|
4033
4094
|
sort: normalizeQuerySort(sort)
|
|
4034
4095
|
})
|
|
4035
4096
|
});
|
|
@@ -4063,7 +4124,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4063
4124
|
}, {
|
|
4064
4125
|
key: "getReactions",
|
|
4065
4126
|
value: function getReactions(message_id, options) {
|
|
4066
|
-
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(encodeURIComponent(message_id), "/reactions"), _objectSpread$
|
|
4127
|
+
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(encodeURIComponent(message_id), "/reactions"), _objectSpread$b({}, options));
|
|
4067
4128
|
}
|
|
4068
4129
|
/**
|
|
4069
4130
|
* getMessagesById - Retrieves a list of messages by ID
|
|
@@ -4210,7 +4271,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4210
4271
|
}
|
|
4211
4272
|
|
|
4212
4273
|
_context40.next = 7;
|
|
4213
|
-
return this.getClient().post(queryURL + '/query', _objectSpread$
|
|
4274
|
+
return this.getClient().post(queryURL + '/query', _objectSpread$b({
|
|
4214
4275
|
data: this._data,
|
|
4215
4276
|
state: true
|
|
4216
4277
|
}, options));
|
|
@@ -4245,14 +4306,14 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4245
4306
|
|
|
4246
4307
|
|
|
4247
4308
|
_this$_initializeStat = this._initializeState(state, messageSetToAddToIfDoesNotExist), messageSet = _this$_initializeStat.messageSet;
|
|
4248
|
-
messageSet.pagination = _objectSpread$
|
|
4309
|
+
messageSet.pagination = _objectSpread$b(_objectSpread$b({}, messageSet.pagination), messageSetPagination({
|
|
4249
4310
|
parentSet: messageSet,
|
|
4250
4311
|
messagePaginationOptions: options === null || options === void 0 ? void 0 : options.messages,
|
|
4251
4312
|
requestedPageSize: (_options$messages$lim = options === null || options === void 0 ? void 0 : (_options$messages = options.messages) === null || _options$messages === void 0 ? void 0 : _options$messages.limit) !== null && _options$messages$lim !== void 0 ? _options$messages$lim : DEFAULT_QUERY_CHANNEL_MESSAGE_LIST_PAGE_SIZE,
|
|
4252
4313
|
returnedPage: state.messages,
|
|
4253
4314
|
logger: this.getClient().logger
|
|
4254
4315
|
}));
|
|
4255
|
-
this.getClient().polls.hydratePollCache(
|
|
4316
|
+
this.getClient().polls.hydratePollCache(state.messages, true);
|
|
4256
4317
|
areCapabilitiesChanged = _toConsumableArray(state.channel.own_capabilities || []).sort().join() !== _toConsumableArray(Array.isArray((_this$data6 = this.data) === null || _this$data6 === void 0 ? void 0 : _this$data6.own_capabilities) ? (_this$data7 = this.data) === null || _this$data7 === void 0 ? void 0 : _this$data7.own_capabilities : []).sort().join();
|
|
4257
4318
|
this.data = state.channel;
|
|
4258
4319
|
this.offlineMode = false;
|
|
@@ -4307,7 +4368,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4307
4368
|
this._checkInitialized();
|
|
4308
4369
|
|
|
4309
4370
|
_context41.next = 3;
|
|
4310
|
-
return this.getClient().banUser(targetUserID, _objectSpread$
|
|
4371
|
+
return this.getClient().banUser(targetUserID, _objectSpread$b(_objectSpread$b({}, options), {}, {
|
|
4311
4372
|
type: this.type,
|
|
4312
4373
|
id: this.id
|
|
4313
4374
|
}));
|
|
@@ -4479,7 +4540,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4479
4540
|
this._checkInitialized();
|
|
4480
4541
|
|
|
4481
4542
|
_context45.next = 3;
|
|
4482
|
-
return this.getClient().shadowBan(targetUserID, _objectSpread$
|
|
4543
|
+
return this.getClient().shadowBan(targetUserID, _objectSpread$b(_objectSpread$b({}, options), {}, {
|
|
4483
4544
|
type: this.type,
|
|
4484
4545
|
id: this.id
|
|
4485
4546
|
}));
|
|
@@ -4884,7 +4945,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4884
4945
|
case 'member.added':
|
|
4885
4946
|
case 'member.updated':
|
|
4886
4947
|
if ((_event$member = event.member) !== null && _event$member !== void 0 && _event$member.user) {
|
|
4887
|
-
channelState.members = _objectSpread$
|
|
4948
|
+
channelState.members = _objectSpread$b(_objectSpread$b({}, channelState.members), {}, _defineProperty({}, event.member.user.id, event.member));
|
|
4888
4949
|
}
|
|
4889
4950
|
|
|
4890
4951
|
if (typeof ((_channelState$members = channelState.membership.user) === null || _channelState$members === void 0 ? void 0 : _channelState$members.id) === 'string' && typeof ((_event$member2 = event.member) === null || _event$member2 === void 0 ? void 0 : (_event$member2$user = _event$member2.user) === null || _event$member2$user === void 0 ? void 0 : _event$member2$user.id) === 'string' && event.member.user.id === channelState.membership.user.id) {
|
|
@@ -4895,7 +4956,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4895
4956
|
|
|
4896
4957
|
case 'member.removed':
|
|
4897
4958
|
if ((_event$user9 = event.user) !== null && _event$user9 !== void 0 && _event$user9.id) {
|
|
4898
|
-
var newMembers = _objectSpread$
|
|
4959
|
+
var newMembers = _objectSpread$b({}, channelState.members);
|
|
4899
4960
|
|
|
4900
4961
|
delete newMembers[event.user.id];
|
|
4901
4962
|
channelState.members = newMembers; // TODO?: unset membership
|
|
@@ -4940,7 +5001,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4940
5001
|
});
|
|
4941
5002
|
}
|
|
4942
5003
|
|
|
4943
|
-
channel.data = _objectSpread$
|
|
5004
|
+
channel.data = _objectSpread$b(_objectSpread$b({}, event.channel), {}, {
|
|
4944
5005
|
hidden: (_event$channel$hidden = (_event$channel3 = event.channel) === null || _event$channel3 === void 0 ? void 0 : _event$channel3.hidden) !== null && _event$channel$hidden !== void 0 ? _event$channel$hidden : (_channel$data2 = channel.data) === null || _channel$data2 === void 0 ? void 0 : _channel$data2.hidden,
|
|
4945
5006
|
own_capabilities: (_event$channel$own_ca = (_event$channel4 = event.channel) === null || _event$channel4 === void 0 ? void 0 : _event$channel4.own_capabilities) !== null && _event$channel$own_ca !== void 0 ? _event$channel$own_ca : (_channel$data3 = channel.data) === null || _channel$data3 === void 0 ? void 0 : _channel$data3.own_capabilities
|
|
4946
5007
|
});
|
|
@@ -4971,7 +5032,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4971
5032
|
break;
|
|
4972
5033
|
|
|
4973
5034
|
case 'channel.hidden':
|
|
4974
|
-
channel.data = _objectSpread$
|
|
5035
|
+
channel.data = _objectSpread$b(_objectSpread$b({}, channel.data), {}, {
|
|
4975
5036
|
hidden: true
|
|
4976
5037
|
});
|
|
4977
5038
|
|
|
@@ -4982,26 +5043,26 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4982
5043
|
break;
|
|
4983
5044
|
|
|
4984
5045
|
case 'channel.visible':
|
|
4985
|
-
channel.data = _objectSpread$
|
|
5046
|
+
channel.data = _objectSpread$b(_objectSpread$b({}, channel.data), {}, {
|
|
4986
5047
|
hidden: false
|
|
4987
5048
|
});
|
|
4988
5049
|
break;
|
|
4989
5050
|
|
|
4990
5051
|
case 'user.banned':
|
|
4991
5052
|
if (!((_event$user11 = event.user) !== null && _event$user11 !== void 0 && _event$user11.id)) break;
|
|
4992
|
-
channelState.members[event.user.id] = _objectSpread$
|
|
5053
|
+
channelState.members[event.user.id] = _objectSpread$b(_objectSpread$b({}, channelState.members[event.user.id] || {}), {}, {
|
|
4993
5054
|
shadow_banned: !!event.shadow,
|
|
4994
5055
|
banned: !event.shadow,
|
|
4995
|
-
user: _objectSpread$
|
|
5056
|
+
user: _objectSpread$b(_objectSpread$b({}, ((_channelState$members2 = channelState.members[event.user.id]) === null || _channelState$members2 === void 0 ? void 0 : _channelState$members2.user) || {}), event.user)
|
|
4996
5057
|
});
|
|
4997
5058
|
break;
|
|
4998
5059
|
|
|
4999
5060
|
case 'user.unbanned':
|
|
5000
5061
|
if (!((_event$user12 = event.user) !== null && _event$user12 !== void 0 && _event$user12.id)) break;
|
|
5001
|
-
channelState.members[event.user.id] = _objectSpread$
|
|
5062
|
+
channelState.members[event.user.id] = _objectSpread$b(_objectSpread$b({}, channelState.members[event.user.id] || {}), {}, {
|
|
5002
5063
|
shadow_banned: false,
|
|
5003
5064
|
banned: false,
|
|
5004
|
-
user: _objectSpread$
|
|
5065
|
+
user: _objectSpread$b(_objectSpread$b({}, ((_channelState$members3 = channelState.members[event.user.id]) === null || _channelState$members3 === void 0 ? void 0 : _channelState$members3.user) || {}), event.user)
|
|
5005
5066
|
});
|
|
5006
5067
|
break;
|
|
5007
5068
|
} // any event can send over the online count
|
|
@@ -5175,7 +5236,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
5175
5236
|
if (overrideCurrentState) {
|
|
5176
5237
|
this.state.members = newMembersById;
|
|
5177
5238
|
} else if (!overrideCurrentState && members.length) {
|
|
5178
|
-
this.state.members = _objectSpread$
|
|
5239
|
+
this.state.members = _objectSpread$b(_objectSpread$b({}, this.state.members), newMembersById);
|
|
5179
5240
|
}
|
|
5180
5241
|
}
|
|
5181
5242
|
}, {
|
|
@@ -5274,9 +5335,9 @@ var ClientState = /*#__PURE__*/function () {
|
|
|
5274
5335
|
return ClientState;
|
|
5275
5336
|
}();
|
|
5276
5337
|
|
|
5277
|
-
function ownKeys$
|
|
5338
|
+
function ownKeys$a(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; }
|
|
5278
5339
|
|
|
5279
|
-
function _objectSpread$
|
|
5340
|
+
function _objectSpread$a(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$a(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$a(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
5280
5341
|
var InsightMetrics = function InsightMetrics() {
|
|
5281
5342
|
_classCallCheck(this, InsightMetrics);
|
|
5282
5343
|
|
|
@@ -5355,7 +5416,7 @@ var postInsights = /*#__PURE__*/function () {
|
|
|
5355
5416
|
};
|
|
5356
5417
|
}();
|
|
5357
5418
|
function buildWsFatalInsight(connection, event) {
|
|
5358
|
-
return _objectSpread$
|
|
5419
|
+
return _objectSpread$a(_objectSpread$a({}, event), buildWsBaseInsight(connection));
|
|
5359
5420
|
}
|
|
5360
5421
|
|
|
5361
5422
|
function buildWsBaseInsight(connection) {
|
|
@@ -5388,9 +5449,9 @@ function buildWsSuccessAfterFailureInsight(connection) {
|
|
|
5388
5449
|
return buildWsBaseInsight(connection);
|
|
5389
5450
|
}
|
|
5390
5451
|
|
|
5391
|
-
function ownKeys$
|
|
5452
|
+
function ownKeys$9(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; }
|
|
5392
5453
|
|
|
5393
|
-
function _objectSpread$
|
|
5454
|
+
function _objectSpread$9(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$9(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$9(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
5394
5455
|
|
|
5395
5456
|
// Type guards to check WebSocket error type
|
|
5396
5457
|
var isCloseEvent = function isCloseEvent(res) {
|
|
@@ -5754,7 +5815,7 @@ var StableWSConnection = /*#__PURE__*/function () {
|
|
|
5754
5815
|
value: function _log(msg) {
|
|
5755
5816
|
var extra = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
5756
5817
|
var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'info';
|
|
5757
|
-
this.client.logger(level, 'connection:' + msg, _objectSpread$
|
|
5818
|
+
this.client.logger(level, 'connection:' + msg, _objectSpread$9({
|
|
5758
5819
|
tags: ['connection']
|
|
5759
5820
|
}, extra));
|
|
5760
5821
|
}
|
|
@@ -6345,9 +6406,9 @@ var StableWSConnection = /*#__PURE__*/function () {
|
|
|
6345
6406
|
return StableWSConnection;
|
|
6346
6407
|
}();
|
|
6347
6408
|
|
|
6348
|
-
function ownKeys$
|
|
6409
|
+
function ownKeys$8(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; }
|
|
6349
6410
|
|
|
6350
|
-
function _objectSpread$
|
|
6411
|
+
function _objectSpread$8(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$8(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$8(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
6351
6412
|
|
|
6352
6413
|
/**
|
|
6353
6414
|
* Creates the JWT token that can be used for a UserSession
|
|
@@ -6368,7 +6429,7 @@ function JWTUserToken(apiSecret, userId) {
|
|
|
6368
6429
|
throw new TypeError('userId should be a string');
|
|
6369
6430
|
}
|
|
6370
6431
|
|
|
6371
|
-
var payload = _objectSpread$
|
|
6432
|
+
var payload = _objectSpread$8({
|
|
6372
6433
|
user_id: userId
|
|
6373
6434
|
}, extraData); // make sure we return a clear error when jwt is shimmed (ie. browser build)
|
|
6374
6435
|
|
|
@@ -6780,9 +6841,9 @@ function isErrorResponse(res) {
|
|
|
6780
6841
|
return !res.status || res.status < 200 || 300 <= res.status;
|
|
6781
6842
|
}
|
|
6782
6843
|
|
|
6783
|
-
function ownKeys$
|
|
6844
|
+
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; }
|
|
6784
6845
|
|
|
6785
|
-
function _objectSpread$
|
|
6846
|
+
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; }
|
|
6786
6847
|
var ConnectionState;
|
|
6787
6848
|
|
|
6788
6849
|
(function (ConnectionState) {
|
|
@@ -6845,7 +6906,7 @@ var WSConnectionFallback = /*#__PURE__*/function () {
|
|
|
6845
6906
|
_context.next = 4;
|
|
6846
6907
|
return _this.client.doAxiosRequest('get', _this.client.baseURL.replace(':3030', ':8900') + '/longpoll', // replace port if present for testing with local API
|
|
6847
6908
|
undefined, {
|
|
6848
|
-
config: _objectSpread$
|
|
6909
|
+
config: _objectSpread$7(_objectSpread$7({}, config), {}, {
|
|
6849
6910
|
cancelToken: (_this$cancelToken2 = _this.cancelToken) === null || _this$cancelToken2 === void 0 ? void 0 : _this$cancelToken2.token
|
|
6850
6911
|
}),
|
|
6851
6912
|
params: params
|
|
@@ -7123,7 +7184,7 @@ var WSConnectionFallback = /*#__PURE__*/function () {
|
|
|
7123
7184
|
value: function _log(msg) {
|
|
7124
7185
|
var extra = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
7125
7186
|
var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'info';
|
|
7126
|
-
this.client.logger(level, 'WSConnectionFallback:' + msg, _objectSpread$
|
|
7187
|
+
this.client.logger(level, 'WSConnectionFallback:' + msg, _objectSpread$7({
|
|
7127
7188
|
tags: ['connection_fallback', 'connection']
|
|
7128
7189
|
}, extra));
|
|
7129
7190
|
}
|
|
@@ -7402,9 +7463,9 @@ var Segment = /*#__PURE__*/function () {
|
|
|
7402
7463
|
return Segment;
|
|
7403
7464
|
}();
|
|
7404
7465
|
|
|
7405
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
7466
|
+
function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
7406
7467
|
|
|
7407
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
7468
|
+
function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
7408
7469
|
|
|
7409
7470
|
/**
|
|
7410
7471
|
* Utility Types
|
|
@@ -7469,7 +7530,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
7469
7530
|
var ErrorFromResponse = /*#__PURE__*/function (_Error) {
|
|
7470
7531
|
_inherits(ErrorFromResponse, _Error);
|
|
7471
7532
|
|
|
7472
|
-
var _super = _createSuper(ErrorFromResponse);
|
|
7533
|
+
var _super = _createSuper$1(ErrorFromResponse);
|
|
7473
7534
|
|
|
7474
7535
|
function ErrorFromResponse() {
|
|
7475
7536
|
var _this;
|
|
@@ -7500,9 +7561,9 @@ var VotingVisibility;
|
|
|
7500
7561
|
VotingVisibility["public"] = "public";
|
|
7501
7562
|
})(VotingVisibility || (VotingVisibility = {}));
|
|
7502
7563
|
|
|
7503
|
-
function ownKeys$
|
|
7564
|
+
function ownKeys$6(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; }
|
|
7504
7565
|
|
|
7505
|
-
function _objectSpread$
|
|
7566
|
+
function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$6(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
7506
7567
|
|
|
7507
7568
|
function isPatch(value) {
|
|
7508
7569
|
return typeof value === 'function';
|
|
@@ -7532,7 +7593,7 @@ var StateStore = function StateStore(value) {
|
|
|
7532
7593
|
|
|
7533
7594
|
_defineProperty(this, "partialNext", function (partial) {
|
|
7534
7595
|
return _this.next(function (current) {
|
|
7535
|
-
return _objectSpread$
|
|
7596
|
+
return _objectSpread$6(_objectSpread$6({}, current), partial);
|
|
7536
7597
|
});
|
|
7537
7598
|
});
|
|
7538
7599
|
|
|
@@ -7582,11 +7643,11 @@ var StateStore = function StateStore(value) {
|
|
|
7582
7643
|
|
|
7583
7644
|
_defineProperty(StateStore, "logCount", 5);
|
|
7584
7645
|
|
|
7585
|
-
var _excluded$
|
|
7646
|
+
var _excluded$3 = ["limit", "sort"];
|
|
7586
7647
|
|
|
7587
|
-
function ownKeys$
|
|
7648
|
+
function ownKeys$5(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; }
|
|
7588
7649
|
|
|
7589
|
-
function _objectSpread$
|
|
7650
|
+
function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$5(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
7590
7651
|
var DEFAULT_PAGE_LIMIT = 50;
|
|
7591
7652
|
var DEFAULT_SORT = [{
|
|
7592
7653
|
created_at: -1
|
|
@@ -7871,14 +7932,14 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7871
7932
|
if (userId === ((_event$user2 = event.user) === null || _event$user2 === void 0 ? void 0 : _event$user2.id)) {
|
|
7872
7933
|
// The user who just sent a message to the thread has no unread messages
|
|
7873
7934
|
// in that thread
|
|
7874
|
-
nextUserRead = _objectSpread$
|
|
7935
|
+
nextUserRead = _objectSpread$5(_objectSpread$5({}, nextUserRead), {}, {
|
|
7875
7936
|
lastReadAt: event.created_at ? new Date(event.created_at) : new Date(),
|
|
7876
7937
|
user: event.user,
|
|
7877
7938
|
unreadMessageCount: 0
|
|
7878
7939
|
});
|
|
7879
7940
|
} else if (active && userId === _this.client.userID) ; else {
|
|
7880
7941
|
// Increment unread count for all users except the author of the new message
|
|
7881
|
-
nextUserRead = _objectSpread$
|
|
7942
|
+
nextUserRead = _objectSpread$5(_objectSpread$5({}, nextUserRead), {}, {
|
|
7882
7943
|
unreadMessageCount: userRead.unreadMessageCount + 1
|
|
7883
7944
|
});
|
|
7884
7945
|
}
|
|
@@ -7902,8 +7963,8 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7902
7963
|
var user = event.user;
|
|
7903
7964
|
|
|
7904
7965
|
_this.state.next(function (current) {
|
|
7905
|
-
return _objectSpread$
|
|
7906
|
-
read: _objectSpread$
|
|
7966
|
+
return _objectSpread$5(_objectSpread$5({}, current), {}, {
|
|
7967
|
+
read: _objectSpread$5(_objectSpread$5({}, current.read), {}, _defineProperty({}, userId, {
|
|
7907
7968
|
lastReadAt: new Date(createdAt),
|
|
7908
7969
|
user: user,
|
|
7909
7970
|
lastReadMessageId: event.last_read_message_id,
|
|
@@ -8016,7 +8077,7 @@ var Thread = /*#__PURE__*/function () {
|
|
|
8016
8077
|
}
|
|
8017
8078
|
|
|
8018
8079
|
_this.state.next(function (current) {
|
|
8019
|
-
return _objectSpread$
|
|
8080
|
+
return _objectSpread$5(_objectSpread$5({}, current), {}, {
|
|
8020
8081
|
replies: addToMessageList(current.replies, formattedMessage, timestampChanged)
|
|
8021
8082
|
});
|
|
8022
8083
|
});
|
|
@@ -8033,7 +8094,7 @@ var Thread = /*#__PURE__*/function () {
|
|
|
8033
8094
|
var _message$reply_count;
|
|
8034
8095
|
|
|
8035
8096
|
var formattedMessage = formatMessage(message);
|
|
8036
|
-
return _objectSpread$
|
|
8097
|
+
return _objectSpread$5(_objectSpread$5({}, current), {}, {
|
|
8037
8098
|
deletedAt: formattedMessage.deleted_at,
|
|
8038
8099
|
parentMessage: formattedMessage,
|
|
8039
8100
|
replyCount: (_message$reply_count = message.reply_count) !== null && _message$reply_count !== void 0 ? _message$reply_count : current.replyCount
|
|
@@ -8104,9 +8165,9 @@ var Thread = /*#__PURE__*/function () {
|
|
|
8104
8165
|
limit = _ref10$limit === void 0 ? DEFAULT_PAGE_LIMIT : _ref10$limit,
|
|
8105
8166
|
_ref10$sort = _ref10.sort,
|
|
8106
8167
|
sort = _ref10$sort === void 0 ? DEFAULT_SORT : _ref10$sort,
|
|
8107
|
-
otherOptions = _objectWithoutProperties(_ref10, _excluded$
|
|
8168
|
+
otherOptions = _objectWithoutProperties(_ref10, _excluded$3);
|
|
8108
8169
|
|
|
8109
|
-
return _this.channel.getReplies(_this.id, _objectSpread$
|
|
8170
|
+
return _this.channel.getReplies(_this.id, _objectSpread$5({
|
|
8110
8171
|
limit: limit
|
|
8111
8172
|
}, otherOptions), sort);
|
|
8112
8173
|
});
|
|
@@ -8150,12 +8211,12 @@ var Thread = /*#__PURE__*/function () {
|
|
|
8150
8211
|
limit = Math.abs(count);
|
|
8151
8212
|
|
|
8152
8213
|
_this.state.partialNext({
|
|
8153
|
-
pagination: _objectSpread$
|
|
8214
|
+
pagination: _objectSpread$5(_objectSpread$5({}, pagination), {}, _defineProperty({}, loadingKey, true))
|
|
8154
8215
|
});
|
|
8155
8216
|
|
|
8156
8217
|
_context3.prev = 7;
|
|
8157
8218
|
_context3.next = 10;
|
|
8158
|
-
return _this.queryReplies(_objectSpread$
|
|
8219
|
+
return _this.queryReplies(_objectSpread$5(_objectSpread$5({}, queryOptions), {}, {
|
|
8159
8220
|
limit: limit
|
|
8160
8221
|
}));
|
|
8161
8222
|
|
|
@@ -8177,9 +8238,9 @@ var Thread = /*#__PURE__*/function () {
|
|
|
8177
8238
|
(_nextReplies = nextReplies)[insertionMethodKey].apply(_nextReplies, _toConsumableArray(replies));
|
|
8178
8239
|
}
|
|
8179
8240
|
|
|
8180
|
-
return _objectSpread$
|
|
8241
|
+
return _objectSpread$5(_objectSpread$5({}, current), {}, {
|
|
8181
8242
|
replies: nextReplies,
|
|
8182
|
-
pagination: _objectSpread$
|
|
8243
|
+
pagination: _objectSpread$5(_objectSpread$5({}, current.pagination), {}, (_objectSpread4 = {}, _defineProperty(_objectSpread4, cursorKey, data.messages.length < limit ? null : maybeNextCursor), _defineProperty(_objectSpread4, loadingKey, false), _objectSpread4))
|
|
8183
8244
|
});
|
|
8184
8245
|
});
|
|
8185
8246
|
|
|
@@ -8193,8 +8254,8 @@ var Thread = /*#__PURE__*/function () {
|
|
|
8193
8254
|
_this.client.logger('error', _context3.t0.message);
|
|
8194
8255
|
|
|
8195
8256
|
_this.state.next(function (current) {
|
|
8196
|
-
return _objectSpread$
|
|
8197
|
-
pagination: _objectSpread$
|
|
8257
|
+
return _objectSpread$5(_objectSpread$5({}, current), {}, {
|
|
8258
|
+
pagination: _objectSpread$5(_objectSpread$5({}, current.pagination), {}, _defineProperty({}, loadingKey, false))
|
|
8198
8259
|
});
|
|
8199
8260
|
});
|
|
8200
8261
|
|
|
@@ -8307,9 +8368,9 @@ var ownUnreadCountSelector = function ownUnreadCountSelector(currentUserId) {
|
|
|
8307
8368
|
};
|
|
8308
8369
|
};
|
|
8309
8370
|
|
|
8310
|
-
function ownKeys$
|
|
8371
|
+
function ownKeys$4(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; }
|
|
8311
8372
|
|
|
8312
|
-
function _objectSpread$
|
|
8373
|
+
function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$4(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
8313
8374
|
var MODERATION_ENTITY_TYPES = {
|
|
8314
8375
|
user: 'stream:user',
|
|
8315
8376
|
message: 'stream:chat:v1:message'
|
|
@@ -8426,7 +8487,7 @@ var Moderation = /*#__PURE__*/function () {
|
|
|
8426
8487
|
case 0:
|
|
8427
8488
|
options = _args3.length > 4 && _args3[4] !== undefined ? _args3[4] : {};
|
|
8428
8489
|
_context3.next = 3;
|
|
8429
|
-
return this.client.post(this.client.baseURL + '/api/v2/moderation/flag', _objectSpread$
|
|
8490
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/flag', _objectSpread$4({
|
|
8430
8491
|
entity_type: entityType,
|
|
8431
8492
|
entity_id: entityId,
|
|
8432
8493
|
entity_creator_id: entityCreatorID,
|
|
@@ -8471,7 +8532,7 @@ var Moderation = /*#__PURE__*/function () {
|
|
|
8471
8532
|
case 0:
|
|
8472
8533
|
options = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
|
|
8473
8534
|
_context4.next = 3;
|
|
8474
|
-
return this.client.post(this.client.baseURL + '/api/v2/moderation/mute', _objectSpread$
|
|
8535
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/mute', _objectSpread$4({
|
|
8475
8536
|
target_ids: [targetID]
|
|
8476
8537
|
}, options));
|
|
8477
8538
|
|
|
@@ -8509,7 +8570,7 @@ var Moderation = /*#__PURE__*/function () {
|
|
|
8509
8570
|
switch (_context5.prev = _context5.next) {
|
|
8510
8571
|
case 0:
|
|
8511
8572
|
_context5.next = 2;
|
|
8512
|
-
return this.client.post(this.client.baseURL + '/api/v2/moderation/unmute', _objectSpread$
|
|
8573
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/unmute', _objectSpread$4({
|
|
8513
8574
|
target_ids: [targetID]
|
|
8514
8575
|
}, options));
|
|
8515
8576
|
|
|
@@ -8551,7 +8612,7 @@ var Moderation = /*#__PURE__*/function () {
|
|
|
8551
8612
|
case 0:
|
|
8552
8613
|
options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
|
|
8553
8614
|
_context6.next = 3;
|
|
8554
|
-
return this.client.get(this.client.baseURL + "/api/v2/moderation/user_report", _objectSpread$
|
|
8615
|
+
return this.client.get(this.client.baseURL + "/api/v2/moderation/user_report", _objectSpread$4({
|
|
8555
8616
|
user_id: userID
|
|
8556
8617
|
}, options));
|
|
8557
8618
|
|
|
@@ -8595,7 +8656,7 @@ var Moderation = /*#__PURE__*/function () {
|
|
|
8595
8656
|
sort = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : [];
|
|
8596
8657
|
options = _args7.length > 2 && _args7[2] !== undefined ? _args7[2] : {};
|
|
8597
8658
|
_context7.next = 5;
|
|
8598
|
-
return this.client.post(this.client.baseURL + '/api/v2/moderation/review_queue', _objectSpread$
|
|
8659
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/review_queue', _objectSpread$4({
|
|
8599
8660
|
filter: filterConditions,
|
|
8600
8661
|
sort: normalizeQuerySort(sort)
|
|
8601
8662
|
}, options));
|
|
@@ -8730,7 +8791,7 @@ var Moderation = /*#__PURE__*/function () {
|
|
|
8730
8791
|
case 0:
|
|
8731
8792
|
options = _args11.length > 2 && _args11[2] !== undefined ? _args11[2] : {};
|
|
8732
8793
|
_context11.next = 3;
|
|
8733
|
-
return this.client.post(this.client.baseURL + '/api/v2/moderation/configs', _objectSpread$
|
|
8794
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/configs', _objectSpread$4({
|
|
8734
8795
|
filter: filterConditions,
|
|
8735
8796
|
sort: sort
|
|
8736
8797
|
}, options));
|
|
@@ -8764,7 +8825,7 @@ var Moderation = /*#__PURE__*/function () {
|
|
|
8764
8825
|
case 0:
|
|
8765
8826
|
options = _args12.length > 2 && _args12[2] !== undefined ? _args12[2] : {};
|
|
8766
8827
|
_context12.next = 3;
|
|
8767
|
-
return this.client.post(this.client.baseURL + '/api/v2/moderation/submit_action', _objectSpread$
|
|
8828
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/submit_action', _objectSpread$4({
|
|
8768
8829
|
action_type: actionType,
|
|
8769
8830
|
item_id: itemID
|
|
8770
8831
|
}, options));
|
|
@@ -8928,9 +8989,9 @@ function _unsupportedIterableToArray$2(o, minLen) { if (!o) return; if (typeof o
|
|
|
8928
8989
|
|
|
8929
8990
|
function _arrayLikeToArray$2(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
8930
8991
|
|
|
8931
|
-
function ownKeys$
|
|
8992
|
+
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; }
|
|
8932
8993
|
|
|
8933
|
-
function _objectSpread$
|
|
8994
|
+
function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$3(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
8934
8995
|
var DEFAULT_CONNECTION_RECOVERY_THROTTLE_DURATION = 1000;
|
|
8935
8996
|
var MAX_QUERY_THREADS_LIMIT = 25;
|
|
8936
8997
|
var THREAD_MANAGER_INITIAL_STATE = {
|
|
@@ -9111,7 +9172,7 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9111
9172
|
var unsubscribeConnectionDropped = _this.client.on('connection.changed', function (event) {
|
|
9112
9173
|
if (event.online === false) {
|
|
9113
9174
|
_this.state.next(function (current) {
|
|
9114
|
-
return current.lastConnectionDropAt ? current : _objectSpread$
|
|
9175
|
+
return current.lastConnectionDropAt ? current : _objectSpread$3(_objectSpread$3({}, current), {}, {
|
|
9115
9176
|
lastConnectionDropAt: new Date()
|
|
9116
9177
|
});
|
|
9117
9178
|
});
|
|
@@ -9198,8 +9259,8 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9198
9259
|
_context.prev = 7;
|
|
9199
9260
|
|
|
9200
9261
|
_this.state.next(function (current) {
|
|
9201
|
-
return _objectSpread$
|
|
9202
|
-
pagination: _objectSpread$
|
|
9262
|
+
return _objectSpread$3(_objectSpread$3({}, current), {}, {
|
|
9263
|
+
pagination: _objectSpread$3(_objectSpread$3({}, current.pagination), {}, {
|
|
9203
9264
|
isLoading: true
|
|
9204
9265
|
})
|
|
9205
9266
|
});
|
|
@@ -9241,11 +9302,11 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9241
9302
|
_this.state.next(function (current) {
|
|
9242
9303
|
var _response$next;
|
|
9243
9304
|
|
|
9244
|
-
return _objectSpread$
|
|
9305
|
+
return _objectSpread$3(_objectSpread$3({}, current), {}, {
|
|
9245
9306
|
threads: nextThreads,
|
|
9246
9307
|
unseenThreadIds: [],
|
|
9247
9308
|
isThreadOrderStale: false,
|
|
9248
|
-
pagination: _objectSpread$
|
|
9309
|
+
pagination: _objectSpread$3(_objectSpread$3({}, current.pagination), {}, {
|
|
9249
9310
|
isLoading: false,
|
|
9250
9311
|
nextCursor: (_response$next = response.next) !== null && _response$next !== void 0 ? _response$next : null
|
|
9251
9312
|
}),
|
|
@@ -9263,8 +9324,8 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9263
9324
|
_this.client.logger('error', _context.t0.message);
|
|
9264
9325
|
|
|
9265
9326
|
_this.state.next(function (current) {
|
|
9266
|
-
return _objectSpread$
|
|
9267
|
-
pagination: _objectSpread$
|
|
9327
|
+
return _objectSpread$3(_objectSpread$3({}, current), {}, {
|
|
9328
|
+
pagination: _objectSpread$3(_objectSpread$3({}, current.pagination), {}, {
|
|
9268
9329
|
isLoading: false
|
|
9269
9330
|
})
|
|
9270
9331
|
});
|
|
@@ -9280,7 +9341,7 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9280
9341
|
|
|
9281
9342
|
_defineProperty(this, "queryThreads", function () {
|
|
9282
9343
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9283
|
-
return _this.client.queryThreads(_objectSpread$
|
|
9344
|
+
return _this.client.queryThreads(_objectSpread$3({
|
|
9284
9345
|
limit: 25,
|
|
9285
9346
|
participant_limit: 10,
|
|
9286
9347
|
reply_limit: 10,
|
|
@@ -9313,13 +9374,13 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9313
9374
|
_context2.prev = 4;
|
|
9314
9375
|
|
|
9315
9376
|
_this.state.partialNext({
|
|
9316
|
-
pagination: _objectSpread$
|
|
9377
|
+
pagination: _objectSpread$3(_objectSpread$3({}, pagination), {}, {
|
|
9317
9378
|
isLoadingNext: true
|
|
9318
9379
|
})
|
|
9319
9380
|
});
|
|
9320
9381
|
|
|
9321
9382
|
_context2.next = 8;
|
|
9322
|
-
return _this.queryThreads(_objectSpread$
|
|
9383
|
+
return _this.queryThreads(_objectSpread$3(_objectSpread$3({}, options), {}, {
|
|
9323
9384
|
next: pagination.nextCursor
|
|
9324
9385
|
}));
|
|
9325
9386
|
|
|
@@ -9329,9 +9390,9 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9329
9390
|
_this.state.next(function (current) {
|
|
9330
9391
|
var _response$next2;
|
|
9331
9392
|
|
|
9332
|
-
return _objectSpread$
|
|
9393
|
+
return _objectSpread$3(_objectSpread$3({}, current), {}, {
|
|
9333
9394
|
threads: response.threads.length ? current.threads.concat(response.threads) : current.threads,
|
|
9334
|
-
pagination: _objectSpread$
|
|
9395
|
+
pagination: _objectSpread$3(_objectSpread$3({}, current.pagination), {}, {
|
|
9335
9396
|
nextCursor: (_response$next2 = response.next) !== null && _response$next2 !== void 0 ? _response$next2 : null,
|
|
9336
9397
|
isLoadingNext: false
|
|
9337
9398
|
})
|
|
@@ -9348,8 +9409,8 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9348
9409
|
_this.client.logger('error', _context2.t0.message);
|
|
9349
9410
|
|
|
9350
9411
|
_this.state.next(function (current) {
|
|
9351
|
-
return _objectSpread$
|
|
9352
|
-
pagination: _objectSpread$
|
|
9412
|
+
return _objectSpread$3(_objectSpread$3({}, current), {}, {
|
|
9413
|
+
pagination: _objectSpread$3(_objectSpread$3({}, current.pagination), {}, {
|
|
9353
9414
|
isLoadingNext: false
|
|
9354
9415
|
})
|
|
9355
9416
|
});
|
|
@@ -9394,12 +9455,12 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9394
9455
|
return ThreadManager;
|
|
9395
9456
|
}();
|
|
9396
9457
|
|
|
9397
|
-
var _excluded$
|
|
9458
|
+
var _excluded$2 = ["own_votes", "id"],
|
|
9398
9459
|
_excluded2$1 = ["id"];
|
|
9399
9460
|
|
|
9400
|
-
function ownKeys$
|
|
9461
|
+
function ownKeys$2(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; }
|
|
9401
9462
|
|
|
9402
|
-
function _objectSpread$
|
|
9463
|
+
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$2(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
9403
9464
|
|
|
9404
9465
|
var isPollUpdatedEvent = function isPollUpdatedEvent(e) {
|
|
9405
9466
|
return e.type === 'poll.updated';
|
|
@@ -9447,7 +9508,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9447
9508
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
9448
9509
|
var own_votes = poll.own_votes;
|
|
9449
9510
|
poll.id;
|
|
9450
|
-
var pollResponseForState = _objectWithoutProperties(poll, _excluded$
|
|
9511
|
+
var pollResponseForState = _objectWithoutProperties(poll, _excluded$2);
|
|
9451
9512
|
|
|
9452
9513
|
var _ref2 = (_own_votes$reduce = own_votes === null || own_votes === void 0 ? void 0 : own_votes.reduce(function (acc, voteOrAnswer) {
|
|
9453
9514
|
if (isVoteAnswer(voteOrAnswer)) {
|
|
@@ -9465,7 +9526,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9465
9526
|
ownAnswer = _ref2.ownAnswer,
|
|
9466
9527
|
ownVotes = _ref2.ownVotes;
|
|
9467
9528
|
|
|
9468
|
-
return _objectSpread$
|
|
9529
|
+
return _objectSpread$2(_objectSpread$2({}, pollResponseForState), {}, {
|
|
9469
9530
|
lastActivityAt: new Date(),
|
|
9470
9531
|
maxVotedOptionIds: getMaxVotedOptionIds(pollResponseForState.vote_counts_by_option),
|
|
9471
9532
|
ownAnswer: ownAnswer,
|
|
@@ -9487,7 +9548,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9487
9548
|
pollData = _objectWithoutProperties(_extractPollData, _excluded2$1); // @ts-ignore
|
|
9488
9549
|
|
|
9489
9550
|
|
|
9490
|
-
_this.state.partialNext(_objectSpread$
|
|
9551
|
+
_this.state.partialNext(_objectSpread$2(_objectSpread$2({}, pollData), {}, {
|
|
9491
9552
|
lastActivityAt: new Date(event.created_at)
|
|
9492
9553
|
}));
|
|
9493
9554
|
});
|
|
@@ -9534,7 +9595,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9534
9595
|
|
|
9535
9596
|
var pollEnrichData = extractPollEnrichedData(event.poll); // @ts-ignore
|
|
9536
9597
|
|
|
9537
|
-
_this.state.partialNext(_objectSpread$
|
|
9598
|
+
_this.state.partialNext(_objectSpread$2(_objectSpread$2({}, pollEnrichData), {}, {
|
|
9538
9599
|
latest_answers: latestAnswers,
|
|
9539
9600
|
lastActivityAt: new Date(event.created_at),
|
|
9540
9601
|
ownAnswer: ownAnswer,
|
|
@@ -9599,7 +9660,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9599
9660
|
|
|
9600
9661
|
var pollEnrichData = extractPollEnrichedData(event.poll); // @ts-ignore
|
|
9601
9662
|
|
|
9602
|
-
_this.state.partialNext(_objectSpread$
|
|
9663
|
+
_this.state.partialNext(_objectSpread$2(_objectSpread$2({}, pollEnrichData), {}, {
|
|
9603
9664
|
latest_answers: latestAnswers,
|
|
9604
9665
|
lastActivityAt: new Date(event.created_at),
|
|
9605
9666
|
ownAnswer: ownAnswer,
|
|
@@ -9620,7 +9681,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9620
9681
|
|
|
9621
9682
|
var ownAnswer = currentState.ownAnswer;
|
|
9622
9683
|
|
|
9623
|
-
var ownVotesByOptionId = _objectSpread$
|
|
9684
|
+
var ownVotesByOptionId = _objectSpread$2({}, currentState.ownVotesByOptionId);
|
|
9624
9685
|
|
|
9625
9686
|
var maxVotedOptionIds = currentState.maxVotedOptionIds;
|
|
9626
9687
|
|
|
@@ -9642,7 +9703,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9642
9703
|
|
|
9643
9704
|
var pollEnrichData = extractPollEnrichedData(event.poll); // @ts-ignore
|
|
9644
9705
|
|
|
9645
|
-
_this.state.partialNext(_objectSpread$
|
|
9706
|
+
_this.state.partialNext(_objectSpread$2(_objectSpread$2({}, pollEnrichData), {}, {
|
|
9646
9707
|
latest_answers: latestAnswers,
|
|
9647
9708
|
lastActivityAt: new Date(event.created_at),
|
|
9648
9709
|
ownAnswer: ownAnswer,
|
|
@@ -9667,7 +9728,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9667
9728
|
poll = _yield$_this$client$g.poll;
|
|
9668
9729
|
|
|
9669
9730
|
// @ts-ignore
|
|
9670
|
-
_this.state.partialNext(_objectSpread$
|
|
9731
|
+
_this.state.partialNext(_objectSpread$2(_objectSpread$2({}, poll), {}, {
|
|
9671
9732
|
lastActivityAt: new Date()
|
|
9672
9733
|
}));
|
|
9673
9734
|
|
|
@@ -9693,7 +9754,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9693
9754
|
switch (_context2.prev = _context2.next) {
|
|
9694
9755
|
case 0:
|
|
9695
9756
|
_context2.next = 2;
|
|
9696
|
-
return _this.client.updatePoll(_objectSpread$
|
|
9757
|
+
return _this.client.updatePoll(_objectSpread$2(_objectSpread$2({}, data), {}, {
|
|
9697
9758
|
id: _this.id
|
|
9698
9759
|
}));
|
|
9699
9760
|
|
|
@@ -10404,7 +10465,7 @@ var PollManager = /*#__PURE__*/function () {
|
|
|
10404
10465
|
return PollManager;
|
|
10405
10466
|
}();
|
|
10406
10467
|
|
|
10407
|
-
var _excluded = ["created_at", "updated_at", "last_active", "online"],
|
|
10468
|
+
var _excluded$1 = ["created_at", "updated_at", "last_active", "online"],
|
|
10408
10469
|
_excluded2 = ["params", "headers"];
|
|
10409
10470
|
|
|
10410
10471
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
@@ -10413,9 +10474,9 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
10413
10474
|
|
|
10414
10475
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
10415
10476
|
|
|
10416
|
-
function ownKeys(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; }
|
|
10477
|
+
function ownKeys$1(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; }
|
|
10417
10478
|
|
|
10418
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
10479
|
+
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
10419
10480
|
|
|
10420
10481
|
function isString(x) {
|
|
10421
10482
|
return typeof x === 'string' || x instanceof String;
|
|
@@ -11015,9 +11076,9 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11015
11076
|
|
|
11016
11077
|
if (event.type === 'user.presence.changed' || event.type === 'user.updated') {
|
|
11017
11078
|
if (event.user.id === _this.userID) {
|
|
11018
|
-
var user = _objectSpread({}, _this.user || {});
|
|
11079
|
+
var user = _objectSpread$1({}, _this.user || {});
|
|
11019
11080
|
|
|
11020
|
-
var _user = _objectSpread({}, _this._user || {}); // Remove deleted properties from user objects.
|
|
11081
|
+
var _user = _objectSpread$1({}, _this._user || {}); // Remove deleted properties from user objects.
|
|
11021
11082
|
|
|
11022
11083
|
|
|
11023
11084
|
for (var _key2 in _this.user) {
|
|
@@ -11038,8 +11099,8 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11038
11099
|
} // @ts-expect-error
|
|
11039
11100
|
|
|
11040
11101
|
|
|
11041
|
-
_this._user = _objectSpread({}, _user);
|
|
11042
|
-
_this.user = _objectSpread(_objectSpread({}, user), event.user);
|
|
11102
|
+
_this._user = _objectSpread$1({}, _user);
|
|
11103
|
+
_this.user = _objectSpread$1(_objectSpread$1({}, user), event.user);
|
|
11043
11104
|
}
|
|
11044
11105
|
|
|
11045
11106
|
_this.state.updateUser(event.user);
|
|
@@ -11195,8 +11256,8 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11195
11256
|
var _channel6 = _this.activeChannels[cid];
|
|
11196
11257
|
|
|
11197
11258
|
if (Object.keys(custom).length > 0) {
|
|
11198
|
-
_channel6.data = _objectSpread(_objectSpread({}, _channel6.data), custom);
|
|
11199
|
-
_channel6._data = _objectSpread(_objectSpread({}, _channel6._data), custom);
|
|
11259
|
+
_channel6.data = _objectSpread$1(_objectSpread$1({}, _channel6.data), custom);
|
|
11260
|
+
_channel6._data = _objectSpread$1(_objectSpread$1({}, _channel6._data), custom);
|
|
11200
11261
|
}
|
|
11201
11262
|
|
|
11202
11263
|
return _channel6;
|
|
@@ -11255,7 +11316,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11255
11316
|
var inputOptions = _options ? _options : secretOrOptions && !isString(secretOrOptions) ? secretOrOptions : {};
|
|
11256
11317
|
this.browser = typeof inputOptions.browser !== 'undefined' ? inputOptions.browser : typeof window !== 'undefined';
|
|
11257
11318
|
this.node = !this.browser;
|
|
11258
|
-
this.options = _objectSpread({
|
|
11319
|
+
this.options = _objectSpread$1({
|
|
11259
11320
|
timeout: 3000,
|
|
11260
11321
|
withCredentials: false,
|
|
11261
11322
|
// making sure cookies are not sent
|
|
@@ -11410,7 +11471,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11410
11471
|
this.user = user;
|
|
11411
11472
|
this.userID = user.id; // this one is actually used for requests. This is a copy of current user provided to `connectUser` function.
|
|
11412
11473
|
|
|
11413
|
-
this._user = _objectSpread({}, user);
|
|
11474
|
+
this._user = _objectSpread$1({}, user);
|
|
11414
11475
|
}
|
|
11415
11476
|
/**
|
|
11416
11477
|
* Disconnects the websocket connection, without removing the user set on client.
|
|
@@ -11465,8 +11526,8 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11465
11526
|
apn_config = options.apn_config;
|
|
11466
11527
|
|
|
11467
11528
|
if (apn_config !== null && apn_config !== void 0 && apn_config.p12_cert) {
|
|
11468
|
-
options = _objectSpread(_objectSpread({}, options), {}, {
|
|
11469
|
-
apn_config: _objectSpread(_objectSpread({}, apn_config), {}, {
|
|
11529
|
+
options = _objectSpread$1(_objectSpread$1({}, options), {}, {
|
|
11530
|
+
apn_config: _objectSpread$1(_objectSpread$1({}, apn_config), {}, {
|
|
11470
11531
|
p12_cert: Buffer.from(apn_config.p12_cert).toString('base64')
|
|
11471
11532
|
})
|
|
11472
11533
|
});
|
|
@@ -11677,7 +11738,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11677
11738
|
case 0:
|
|
11678
11739
|
data = _args12.length > 1 && _args12[1] !== undefined ? _args12[1] : {};
|
|
11679
11740
|
_context12.next = 3;
|
|
11680
|
-
return this.post(this.baseURL + '/check_push', _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
11741
|
+
return this.post(this.baseURL + '/check_push', _objectSpread$1(_objectSpread$1(_objectSpread$1(_objectSpread$1(_objectSpread$1(_objectSpread$1(_objectSpread$1({
|
|
11681
11742
|
user_id: userID
|
|
11682
11743
|
}, data.messageID ? {
|
|
11683
11744
|
message_id: data.messageID
|
|
@@ -11842,7 +11903,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11842
11903
|
case 11:
|
|
11843
11904
|
this.anonymous = false; // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11844
11905
|
|
|
11845
|
-
_response$user = response.user, _response$user.created_at, _response$user.updated_at, _response$user.last_active, _response$user.online, guestUser = _objectWithoutProperties(_response$user, _excluded);
|
|
11906
|
+
_response$user = response.user, _response$user.created_at, _response$user.updated_at, _response$user.last_active, _response$user.online, guestUser = _objectWithoutProperties(_response$user, _excluded$1);
|
|
11846
11907
|
_context15.next = 15;
|
|
11847
11908
|
return this.connectUser(guestUser, response.access_token);
|
|
11848
11909
|
|
|
@@ -12326,7 +12387,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12326
12387
|
|
|
12327
12388
|
_context17.next = 8;
|
|
12328
12389
|
return this.get(this.baseURL + '/users', {
|
|
12329
|
-
payload: _objectSpread(_objectSpread({
|
|
12390
|
+
payload: _objectSpread$1(_objectSpread$1({
|
|
12330
12391
|
filter_conditions: filterConditions,
|
|
12331
12392
|
sort: normalizeQuerySort(sort)
|
|
12332
12393
|
}, defaultOptions), options)
|
|
@@ -12378,7 +12439,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12378
12439
|
options = _args18.length > 2 && _args18[2] !== undefined ? _args18[2] : {};
|
|
12379
12440
|
_context18.next = 5;
|
|
12380
12441
|
return this.get(this.baseURL + '/query_banned_users', {
|
|
12381
|
-
payload: _objectSpread({
|
|
12442
|
+
payload: _objectSpread$1({
|
|
12382
12443
|
filter_conditions: filterConditions,
|
|
12383
12444
|
sort: normalizeQuerySort(sort)
|
|
12384
12445
|
}, options)
|
|
@@ -12425,7 +12486,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12425
12486
|
options = _args19.length > 1 && _args19[1] !== undefined ? _args19[1] : {};
|
|
12426
12487
|
_context19.next = 4;
|
|
12427
12488
|
return this.get(this.baseURL + '/moderation/flags/message', {
|
|
12428
|
-
payload: _objectSpread({
|
|
12489
|
+
payload: _objectSpread$1({
|
|
12429
12490
|
filter_conditions: filterConditions
|
|
12430
12491
|
}, options)
|
|
12431
12492
|
});
|
|
@@ -12493,7 +12554,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12493
12554
|
} // Return a list of channels
|
|
12494
12555
|
|
|
12495
12556
|
|
|
12496
|
-
payload = _objectSpread(_objectSpread({
|
|
12557
|
+
payload = _objectSpread$1(_objectSpread$1({
|
|
12497
12558
|
filter_conditions: filterConditions,
|
|
12498
12559
|
sort: normalizeQuerySort(sort)
|
|
12499
12560
|
}, defaultOptions), options);
|
|
@@ -12554,7 +12615,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12554
12615
|
|
|
12555
12616
|
case 4:
|
|
12556
12617
|
// Return a list of channels
|
|
12557
|
-
payload = _objectSpread({
|
|
12618
|
+
payload = _objectSpread$1({
|
|
12558
12619
|
filter: filter,
|
|
12559
12620
|
sort: normalizeQuerySort(sort)
|
|
12560
12621
|
}, options);
|
|
@@ -12620,13 +12681,13 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12620
12681
|
}
|
|
12621
12682
|
|
|
12622
12683
|
if (updatedMessagesSet) {
|
|
12623
|
-
updatedMessagesSet.pagination = _objectSpread(_objectSpread({}, updatedMessagesSet.pagination), messageSetPagination({
|
|
12684
|
+
updatedMessagesSet.pagination = _objectSpread$1(_objectSpread$1({}, updatedMessagesSet.pagination), messageSetPagination({
|
|
12624
12685
|
parentSet: updatedMessagesSet,
|
|
12625
12686
|
requestedPageSize: (queryChannelsOptions === null || queryChannelsOptions === void 0 ? void 0 : queryChannelsOptions.message_limit) || DEFAULT_QUERY_CHANNELS_MESSAGE_LIST_PAGE_SIZE,
|
|
12626
12687
|
returnedPage: channelState.messages,
|
|
12627
12688
|
logger: this.logger
|
|
12628
12689
|
}));
|
|
12629
|
-
this.polls.hydratePollCache(
|
|
12690
|
+
this.polls.hydratePollCache(channelState.messages, true);
|
|
12630
12691
|
}
|
|
12631
12692
|
|
|
12632
12693
|
channels.push(c);
|
|
@@ -12670,7 +12731,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12670
12731
|
throw Error("Cannot specify offset with next");
|
|
12671
12732
|
|
|
12672
12733
|
case 3:
|
|
12673
|
-
payload = _objectSpread(_objectSpread({
|
|
12734
|
+
payload = _objectSpread$1(_objectSpread$1({
|
|
12674
12735
|
filter_conditions: filterConditions
|
|
12675
12736
|
}, options), {}, {
|
|
12676
12737
|
sort: options.sort ? normalizeQuerySort(options.sort) : undefined
|
|
@@ -12764,7 +12825,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12764
12825
|
switch (_context23.prev = _context23.next) {
|
|
12765
12826
|
case 0:
|
|
12766
12827
|
_context23.next = 2;
|
|
12767
|
-
return this.post(this.baseURL + '/devices', _objectSpread(_objectSpread({
|
|
12828
|
+
return this.post(this.baseURL + '/devices', _objectSpread$1(_objectSpread$1({
|
|
12768
12829
|
id: id,
|
|
12769
12830
|
push_provider: push_provider
|
|
12770
12831
|
}, userID != null ? {
|
|
@@ -12959,7 +13020,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12959
13020
|
switch (_context28.prev = _context28.next) {
|
|
12960
13021
|
case 0:
|
|
12961
13022
|
_context28.next = 2;
|
|
12962
|
-
return this.delete(this.baseURL + '/devices', _objectSpread({
|
|
13023
|
+
return this.delete(this.baseURL + '/devices', _objectSpread$1({
|
|
12963
13024
|
id: id
|
|
12964
13025
|
}, userID ? {
|
|
12965
13026
|
user_id: userID
|
|
@@ -13419,7 +13480,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13419
13480
|
switch (_context35.prev = _context35.next) {
|
|
13420
13481
|
case 0:
|
|
13421
13482
|
_context35.next = 2;
|
|
13422
|
-
return this.post(this.baseURL + "/users/".concat(encodeURIComponent(userID), "/reactivate"), _objectSpread({}, options));
|
|
13483
|
+
return this.post(this.baseURL + "/users/".concat(encodeURIComponent(userID), "/reactivate"), _objectSpread$1({}, options));
|
|
13423
13484
|
|
|
13424
13485
|
case 2:
|
|
13425
13486
|
return _context35.abrupt("return", _context35.sent);
|
|
@@ -13456,7 +13517,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13456
13517
|
switch (_context36.prev = _context36.next) {
|
|
13457
13518
|
case 0:
|
|
13458
13519
|
_context36.next = 2;
|
|
13459
|
-
return this.post(this.baseURL + "/users/reactivate", _objectSpread({
|
|
13520
|
+
return this.post(this.baseURL + "/users/reactivate", _objectSpread$1({
|
|
13460
13521
|
user_ids: user_ids
|
|
13461
13522
|
}, options));
|
|
13462
13523
|
|
|
@@ -13495,7 +13556,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13495
13556
|
switch (_context37.prev = _context37.next) {
|
|
13496
13557
|
case 0:
|
|
13497
13558
|
_context37.next = 2;
|
|
13498
|
-
return this.post(this.baseURL + "/users/".concat(encodeURIComponent(userID), "/deactivate"), _objectSpread({}, options));
|
|
13559
|
+
return this.post(this.baseURL + "/users/".concat(encodeURIComponent(userID), "/deactivate"), _objectSpread$1({}, options));
|
|
13499
13560
|
|
|
13500
13561
|
case 2:
|
|
13501
13562
|
return _context37.abrupt("return", _context37.sent);
|
|
@@ -13532,7 +13593,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13532
13593
|
switch (_context38.prev = _context38.next) {
|
|
13533
13594
|
case 0:
|
|
13534
13595
|
_context38.next = 2;
|
|
13535
|
-
return this.post(this.baseURL + "/users/deactivate", _objectSpread({
|
|
13596
|
+
return this.post(this.baseURL + "/users/deactivate", _objectSpread$1({
|
|
13536
13597
|
user_ids: user_ids
|
|
13537
13598
|
}, options));
|
|
13538
13599
|
|
|
@@ -13562,7 +13623,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13562
13623
|
switch (_context39.prev = _context39.next) {
|
|
13563
13624
|
case 0:
|
|
13564
13625
|
_context39.next = 2;
|
|
13565
|
-
return this.get(this.baseURL + "/users/".concat(encodeURIComponent(userID), "/export"), _objectSpread({}, options));
|
|
13626
|
+
return this.get(this.baseURL + "/users/".concat(encodeURIComponent(userID), "/export"), _objectSpread$1({}, options));
|
|
13566
13627
|
|
|
13567
13628
|
case 2:
|
|
13568
13629
|
return _context39.abrupt("return", _context39.sent);
|
|
@@ -13597,7 +13658,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13597
13658
|
switch (_context40.prev = _context40.next) {
|
|
13598
13659
|
case 0:
|
|
13599
13660
|
_context40.next = 2;
|
|
13600
|
-
return this.post(this.baseURL + '/moderation/ban', _objectSpread({
|
|
13661
|
+
return this.post(this.baseURL + '/moderation/ban', _objectSpread$1({
|
|
13601
13662
|
target_user_id: targetUserID
|
|
13602
13663
|
}, options));
|
|
13603
13664
|
|
|
@@ -13634,7 +13695,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13634
13695
|
switch (_context41.prev = _context41.next) {
|
|
13635
13696
|
case 0:
|
|
13636
13697
|
_context41.next = 2;
|
|
13637
|
-
return this.delete(this.baseURL + '/moderation/ban', _objectSpread({
|
|
13698
|
+
return this.delete(this.baseURL + '/moderation/ban', _objectSpread$1({
|
|
13638
13699
|
target_user_id: targetUserID
|
|
13639
13700
|
}, options));
|
|
13640
13701
|
|
|
@@ -13671,7 +13732,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13671
13732
|
switch (_context42.prev = _context42.next) {
|
|
13672
13733
|
case 0:
|
|
13673
13734
|
_context42.next = 2;
|
|
13674
|
-
return this.banUser(targetUserID, _objectSpread({
|
|
13735
|
+
return this.banUser(targetUserID, _objectSpread$1({
|
|
13675
13736
|
shadow: true
|
|
13676
13737
|
}, options));
|
|
13677
13738
|
|
|
@@ -13708,7 +13769,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13708
13769
|
switch (_context43.prev = _context43.next) {
|
|
13709
13770
|
case 0:
|
|
13710
13771
|
_context43.next = 2;
|
|
13711
|
-
return this.unbanUser(targetUserID, _objectSpread({
|
|
13772
|
+
return this.unbanUser(targetUserID, _objectSpread$1({
|
|
13712
13773
|
shadow: true
|
|
13713
13774
|
}, options));
|
|
13714
13775
|
|
|
@@ -13738,7 +13799,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13738
13799
|
switch (_context44.prev = _context44.next) {
|
|
13739
13800
|
case 0:
|
|
13740
13801
|
_context44.next = 2;
|
|
13741
|
-
return this.post(this.baseURL + '/users/block', _objectSpread({
|
|
13802
|
+
return this.post(this.baseURL + '/users/block', _objectSpread$1({
|
|
13742
13803
|
blocked_user_id: blockedUserID
|
|
13743
13804
|
}, user_id ? {
|
|
13744
13805
|
user_id: user_id
|
|
@@ -13770,7 +13831,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13770
13831
|
switch (_context45.prev = _context45.next) {
|
|
13771
13832
|
case 0:
|
|
13772
13833
|
_context45.next = 2;
|
|
13773
|
-
return this.get(this.baseURL + '/users/block', _objectSpread({}, user_id ? {
|
|
13834
|
+
return this.get(this.baseURL + '/users/block', _objectSpread$1({}, user_id ? {
|
|
13774
13835
|
user_id: user_id
|
|
13775
13836
|
} : {}));
|
|
13776
13837
|
|
|
@@ -13800,7 +13861,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13800
13861
|
switch (_context46.prev = _context46.next) {
|
|
13801
13862
|
case 0:
|
|
13802
13863
|
_context46.next = 2;
|
|
13803
|
-
return this.post(this.baseURL + '/users/unblock', _objectSpread({
|
|
13864
|
+
return this.post(this.baseURL + '/users/unblock', _objectSpread$1({
|
|
13804
13865
|
blocked_user_id: blockedUserID
|
|
13805
13866
|
}, userID ? {
|
|
13806
13867
|
user_id: userID
|
|
@@ -13843,7 +13904,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13843
13904
|
case 0:
|
|
13844
13905
|
options = _args47.length > 2 && _args47[2] !== undefined ? _args47[2] : {};
|
|
13845
13906
|
_context47.next = 3;
|
|
13846
|
-
return this.post(this.baseURL + '/moderation/mute', _objectSpread(_objectSpread({
|
|
13907
|
+
return this.post(this.baseURL + '/moderation/mute', _objectSpread$1(_objectSpread$1({
|
|
13847
13908
|
target_id: targetID
|
|
13848
13909
|
}, userID ? {
|
|
13849
13910
|
user_id: userID
|
|
@@ -13882,7 +13943,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13882
13943
|
switch (_context48.prev = _context48.next) {
|
|
13883
13944
|
case 0:
|
|
13884
13945
|
_context48.next = 2;
|
|
13885
|
-
return this.post(this.baseURL + '/moderation/unmute', _objectSpread({
|
|
13946
|
+
return this.post(this.baseURL + '/moderation/unmute', _objectSpread$1({
|
|
13886
13947
|
target_id: targetID
|
|
13887
13948
|
}, currentUserID ? {
|
|
13888
13949
|
user_id: currentUserID
|
|
@@ -13943,7 +14004,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13943
14004
|
case 0:
|
|
13944
14005
|
options = _args49.length > 1 && _args49[1] !== undefined ? _args49[1] : {};
|
|
13945
14006
|
_context49.next = 3;
|
|
13946
|
-
return this.post(this.baseURL + '/moderation/flag', _objectSpread({
|
|
14007
|
+
return this.post(this.baseURL + '/moderation/flag', _objectSpread$1({
|
|
13947
14008
|
target_message_id: targetMessageID
|
|
13948
14009
|
}, options));
|
|
13949
14010
|
|
|
@@ -13983,7 +14044,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13983
14044
|
case 0:
|
|
13984
14045
|
options = _args50.length > 1 && _args50[1] !== undefined ? _args50[1] : {};
|
|
13985
14046
|
_context50.next = 3;
|
|
13986
|
-
return this.post(this.baseURL + '/moderation/flag', _objectSpread({
|
|
14047
|
+
return this.post(this.baseURL + '/moderation/flag', _objectSpread$1({
|
|
13987
14048
|
target_user_id: targetID
|
|
13988
14049
|
}, options));
|
|
13989
14050
|
|
|
@@ -14023,7 +14084,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14023
14084
|
case 0:
|
|
14024
14085
|
options = _args51.length > 1 && _args51[1] !== undefined ? _args51[1] : {};
|
|
14025
14086
|
_context51.next = 3;
|
|
14026
|
-
return this.post(this.baseURL + '/moderation/unflag', _objectSpread({
|
|
14087
|
+
return this.post(this.baseURL + '/moderation/unflag', _objectSpread$1({
|
|
14027
14088
|
target_message_id: targetMessageID
|
|
14028
14089
|
}, options));
|
|
14029
14090
|
|
|
@@ -14063,7 +14124,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14063
14124
|
case 0:
|
|
14064
14125
|
options = _args52.length > 1 && _args52[1] !== undefined ? _args52[1] : {};
|
|
14065
14126
|
_context52.next = 3;
|
|
14066
|
-
return this.post(this.baseURL + '/moderation/unflag', _objectSpread({
|
|
14127
|
+
return this.post(this.baseURL + '/moderation/unflag', _objectSpread$1({
|
|
14067
14128
|
target_user_id: targetID
|
|
14068
14129
|
}, options));
|
|
14069
14130
|
|
|
@@ -14104,7 +14165,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14104
14165
|
case 0:
|
|
14105
14166
|
options = _args53.length > 1 && _args53[1] !== undefined ? _args53[1] : {};
|
|
14106
14167
|
_context53.next = 3;
|
|
14107
|
-
return this.post(this.baseURL + "/calls/".concat(encodeURIComponent(callID)), _objectSpread({}, options));
|
|
14168
|
+
return this.post(this.baseURL + "/calls/".concat(encodeURIComponent(callID)), _objectSpread$1({}, options));
|
|
14108
14169
|
|
|
14109
14170
|
case 3:
|
|
14110
14171
|
return _context53.abrupt("return", _context53.sent);
|
|
@@ -14151,7 +14212,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14151
14212
|
filterConditions = _args54.length > 0 && _args54[0] !== undefined ? _args54[0] : {};
|
|
14152
14213
|
options = _args54.length > 1 && _args54[1] !== undefined ? _args54[1] : {};
|
|
14153
14214
|
_context54.next = 4;
|
|
14154
|
-
return this.post(this.baseURL + '/moderation/flags', _objectSpread({
|
|
14215
|
+
return this.post(this.baseURL + '/moderation/flags', _objectSpread$1({
|
|
14155
14216
|
filter_conditions: filterConditions
|
|
14156
14217
|
}, options));
|
|
14157
14218
|
|
|
@@ -14200,7 +14261,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14200
14261
|
filterConditions = _args55.length > 0 && _args55[0] !== undefined ? _args55[0] : {};
|
|
14201
14262
|
options = _args55.length > 1 && _args55[1] !== undefined ? _args55[1] : {};
|
|
14202
14263
|
_context55.next = 4;
|
|
14203
|
-
return this.post(this.baseURL + '/moderation/reports', _objectSpread({
|
|
14264
|
+
return this.post(this.baseURL + '/moderation/reports', _objectSpread$1({
|
|
14204
14265
|
filter_conditions: filterConditions
|
|
14205
14266
|
}, options));
|
|
14206
14267
|
|
|
@@ -14248,7 +14309,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14248
14309
|
case 0:
|
|
14249
14310
|
options = _args56.length > 2 && _args56[2] !== undefined ? _args56[2] : {};
|
|
14250
14311
|
_context56.next = 3;
|
|
14251
|
-
return this.patch(this.baseURL + "/moderation/reports/".concat(encodeURIComponent(id)), _objectSpread({
|
|
14312
|
+
return this.patch(this.baseURL + "/moderation/reports/".concat(encodeURIComponent(id)), _objectSpread$1({
|
|
14252
14313
|
review_result: reviewResult
|
|
14253
14314
|
}, options));
|
|
14254
14315
|
|
|
@@ -14290,7 +14351,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14290
14351
|
case 0:
|
|
14291
14352
|
options = _args57.length > 1 && _args57[1] !== undefined ? _args57[1] : {};
|
|
14292
14353
|
_context57.next = 3;
|
|
14293
|
-
return this.post(this.baseURL + '/moderation/unblock_message', _objectSpread({
|
|
14354
|
+
return this.post(this.baseURL + '/moderation/unblock_message', _objectSpread$1({
|
|
14294
14355
|
target_message_id: targetMessageID
|
|
14295
14356
|
}, options));
|
|
14296
14357
|
|
|
@@ -14333,7 +14394,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14333
14394
|
case 0:
|
|
14334
14395
|
data = _args58.length > 0 && _args58[0] !== undefined ? _args58[0] : {};
|
|
14335
14396
|
_context58.next = 3;
|
|
14336
|
-
return this.post(this.baseURL + '/channels/read', _objectSpread({}, data));
|
|
14397
|
+
return this.post(this.baseURL + '/channels/read', _objectSpread$1({}, data));
|
|
14337
14398
|
|
|
14338
14399
|
case 3:
|
|
14339
14400
|
case "end":
|
|
@@ -14625,7 +14686,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14625
14686
|
}
|
|
14626
14687
|
|
|
14627
14688
|
_context61.next = 10;
|
|
14628
|
-
return this.post(this.baseURL + "/messages/".concat(encodeURIComponent(message.id)), _objectSpread({
|
|
14689
|
+
return this.post(this.baseURL + "/messages/".concat(encodeURIComponent(message.id)), _objectSpread$1({
|
|
14629
14690
|
message: clonedMessage
|
|
14630
14691
|
}, options));
|
|
14631
14692
|
|
|
@@ -14686,7 +14747,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14686
14747
|
}
|
|
14687
14748
|
|
|
14688
14749
|
_context62.next = 6;
|
|
14689
|
-
return this.put(this.baseURL + "/messages/".concat(encodeURIComponent(id)), _objectSpread(_objectSpread(_objectSpread({}, partialMessageObject), options), {}, {
|
|
14750
|
+
return this.put(this.baseURL + "/messages/".concat(encodeURIComponent(id)), _objectSpread$1(_objectSpread$1(_objectSpread$1({}, partialMessageObject), options), {}, {
|
|
14690
14751
|
user: user
|
|
14691
14752
|
}));
|
|
14692
14753
|
|
|
@@ -14796,7 +14857,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14796
14857
|
switch (_context65.prev = _context65.next) {
|
|
14797
14858
|
case 0:
|
|
14798
14859
|
_context65.next = 2;
|
|
14799
|
-
return this.get(this.baseURL + "/messages/".concat(encodeURIComponent(messageID)), _objectSpread({}, options));
|
|
14860
|
+
return this.get(this.baseURL + "/messages/".concat(encodeURIComponent(messageID)), _objectSpread$1({}, options));
|
|
14800
14861
|
|
|
14801
14862
|
case 2:
|
|
14802
14863
|
return _context65.abrupt("return", _context65.sent);
|
|
@@ -14842,7 +14903,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14842
14903
|
switch (_context66.prev = _context66.next) {
|
|
14843
14904
|
case 0:
|
|
14844
14905
|
options = _args66.length > 0 && _args66[0] !== undefined ? _args66[0] : {};
|
|
14845
|
-
optionsWithDefaults = _objectSpread({
|
|
14906
|
+
optionsWithDefaults = _objectSpread$1({
|
|
14846
14907
|
limit: 10,
|
|
14847
14908
|
participant_limit: 10,
|
|
14848
14909
|
reply_limit: 3,
|
|
@@ -14911,7 +14972,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14911
14972
|
throw Error('Please specify the messageId when calling getThread');
|
|
14912
14973
|
|
|
14913
14974
|
case 3:
|
|
14914
|
-
optionsWithDefaults = _objectSpread({
|
|
14975
|
+
optionsWithDefaults = _objectSpread$1({
|
|
14915
14976
|
participant_limit: 100,
|
|
14916
14977
|
reply_limit: 3,
|
|
14917
14978
|
watch: true
|
|
@@ -14970,7 +15031,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14970
15031
|
// check for reserved fields from ThreadResponse type within partialThreadObject's set and unset.
|
|
14971
15032
|
// Throw error if any of the reserved field is found.
|
|
14972
15033
|
reservedThreadFields = ['created_at', 'id', 'last_message_at', 'type', 'updated_at', 'user', 'reply_count', 'participants', 'channel', 'custom'];
|
|
14973
|
-
_context68.t0 = _regeneratorRuntime.keys(_objectSpread(_objectSpread({}, partialThreadObject.set), partialThreadObject.unset));
|
|
15034
|
+
_context68.t0 = _regeneratorRuntime.keys(_objectSpread$1(_objectSpread$1({}, partialThreadObject.set), partialThreadObject.unset));
|
|
14974
15035
|
|
|
14975
15036
|
case 4:
|
|
14976
15037
|
if ((_context68.t1 = _context68.t0()).done) {
|
|
@@ -15015,7 +15076,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15015
15076
|
}, {
|
|
15016
15077
|
key: "getUserAgent",
|
|
15017
15078
|
value: function getUserAgent() {
|
|
15018
|
-
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.
|
|
15079
|
+
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.55.0");
|
|
15019
15080
|
}
|
|
15020
15081
|
}, {
|
|
15021
15082
|
key: "setUserAgent",
|
|
@@ -15050,7 +15111,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15050
15111
|
}
|
|
15051
15112
|
|
|
15052
15113
|
if (!((_options$headers = options.headers) !== null && _options$headers !== void 0 && _options$headers['x-client-request-id'])) {
|
|
15053
|
-
options.headers = _objectSpread(_objectSpread({}, options.headers), {}, {
|
|
15114
|
+
options.headers = _objectSpread$1(_objectSpread$1({}, options.headers), {}, {
|
|
15054
15115
|
'x-client-request-id': randomId()
|
|
15055
15116
|
});
|
|
15056
15117
|
}
|
|
@@ -15060,13 +15121,13 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15060
15121
|
axiosRequestConfigHeaders = _ref9.headers,
|
|
15061
15122
|
axiosRequestConfigRest = _objectWithoutProperties(_ref9, _excluded2);
|
|
15062
15123
|
|
|
15063
|
-
return _objectSpread(_objectSpread(_objectSpread({
|
|
15064
|
-
params: _objectSpread(_objectSpread({
|
|
15124
|
+
return _objectSpread$1(_objectSpread$1(_objectSpread$1({
|
|
15125
|
+
params: _objectSpread$1(_objectSpread$1({
|
|
15065
15126
|
user_id: this.userID,
|
|
15066
15127
|
connection_id: this._getConnectionID(),
|
|
15067
15128
|
api_key: this.key
|
|
15068
15129
|
}, options.params), axiosRequestConfigParams || {}),
|
|
15069
|
-
headers: _objectSpread(_objectSpread(_objectSpread({}, authorization), {}, {
|
|
15130
|
+
headers: _objectSpread$1(_objectSpread$1(_objectSpread$1({}, authorization), {}, {
|
|
15070
15131
|
'stream-auth-type': this.getAuthType(),
|
|
15071
15132
|
'X-Stream-Client': this.getUserAgent()
|
|
15072
15133
|
}, options.headers), axiosRequestConfigHeaders || {})
|
|
@@ -15136,7 +15197,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15136
15197
|
}, {
|
|
15137
15198
|
key: "createPermission",
|
|
15138
15199
|
value: function createPermission(permissionData) {
|
|
15139
|
-
return this.post("".concat(this.baseURL, "/permissions"), _objectSpread({}, permissionData));
|
|
15200
|
+
return this.post("".concat(this.baseURL, "/permissions"), _objectSpread$1({}, permissionData));
|
|
15140
15201
|
}
|
|
15141
15202
|
/** updatePermission - updates an existing custom permission
|
|
15142
15203
|
*
|
|
@@ -15148,7 +15209,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15148
15209
|
}, {
|
|
15149
15210
|
key: "updatePermission",
|
|
15150
15211
|
value: function updatePermission(id, permissionData) {
|
|
15151
|
-
return this.put("".concat(this.baseURL, "/permissions/").concat(encodeURIComponent(id)), _objectSpread({}, permissionData));
|
|
15212
|
+
return this.put("".concat(this.baseURL, "/permissions/").concat(encodeURIComponent(id)), _objectSpread$1({}, permissionData));
|
|
15152
15213
|
}
|
|
15153
15214
|
/** deletePermission - deletes a custom permission
|
|
15154
15215
|
*
|
|
@@ -15217,7 +15278,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15217
15278
|
key: "sync",
|
|
15218
15279
|
value: function sync(channel_cids, last_sync_at) {
|
|
15219
15280
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
15220
|
-
return this.post("".concat(this.baseURL, "/sync"), _objectSpread({
|
|
15281
|
+
return this.post("".concat(this.baseURL, "/sync"), _objectSpread$1({
|
|
15221
15282
|
channel_cids: channel_cids,
|
|
15222
15283
|
last_sync_at: last_sync_at
|
|
15223
15284
|
}, options));
|
|
@@ -15342,7 +15403,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15342
15403
|
value: function exportChannels(request) {
|
|
15343
15404
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
15344
15405
|
|
|
15345
|
-
var payload = _objectSpread({
|
|
15406
|
+
var payload = _objectSpread$1({
|
|
15346
15407
|
channels: request
|
|
15347
15408
|
}, options);
|
|
15348
15409
|
|
|
@@ -15410,7 +15471,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15410
15471
|
switch (_context70.prev = _context70.next) {
|
|
15411
15472
|
case 0:
|
|
15412
15473
|
this.validateServerSideAuth();
|
|
15413
|
-
body = _objectSpread({
|
|
15474
|
+
body = _objectSpread$1({
|
|
15414
15475
|
id: id,
|
|
15415
15476
|
type: type
|
|
15416
15477
|
}, data);
|
|
@@ -15613,7 +15674,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15613
15674
|
sort = _args76.length > 2 && _args76[2] !== undefined ? _args76[2] : [];
|
|
15614
15675
|
options = _args76.length > 3 && _args76[3] !== undefined ? _args76[3] : {};
|
|
15615
15676
|
this.validateServerSideAuth();
|
|
15616
|
-
return _context76.abrupt("return", this.post(this.baseURL + "/segments/".concat(encodeURIComponent(id), "/targets/query"), _objectSpread({
|
|
15677
|
+
return _context76.abrupt("return", this.post(this.baseURL + "/segments/".concat(encodeURIComponent(id), "/targets/query"), _objectSpread$1({
|
|
15617
15678
|
filter: filter || {},
|
|
15618
15679
|
sort: sort || []
|
|
15619
15680
|
}, options)));
|
|
@@ -15691,7 +15752,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15691
15752
|
case 0:
|
|
15692
15753
|
options = _args78.length > 2 && _args78[2] !== undefined ? _args78[2] : {};
|
|
15693
15754
|
this.validateServerSideAuth();
|
|
15694
|
-
return _context78.abrupt("return", this.post(this.baseURL + "/segments/query", _objectSpread({
|
|
15755
|
+
return _context78.abrupt("return", this.post(this.baseURL + "/segments/query", _objectSpread$1({
|
|
15695
15756
|
filter: filter,
|
|
15696
15757
|
sort: sort
|
|
15697
15758
|
}, options)));
|
|
@@ -15794,7 +15855,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15794
15855
|
switch (_context81.prev = _context81.next) {
|
|
15795
15856
|
case 0:
|
|
15796
15857
|
this.validateServerSideAuth();
|
|
15797
|
-
return _context81.abrupt("return", this.post(this.baseURL + "/campaigns", _objectSpread({}, params)));
|
|
15858
|
+
return _context81.abrupt("return", this.post(this.baseURL + "/campaigns", _objectSpread$1({}, params)));
|
|
15798
15859
|
|
|
15799
15860
|
case 2:
|
|
15800
15861
|
case "end":
|
|
@@ -15880,7 +15941,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15880
15941
|
case 0:
|
|
15881
15942
|
this.validateServerSideAuth();
|
|
15882
15943
|
_context84.next = 3;
|
|
15883
|
-
return this.post(this.baseURL + "/campaigns/query", _objectSpread({
|
|
15944
|
+
return this.post(this.baseURL + "/campaigns/query", _objectSpread$1({
|
|
15884
15945
|
filter: filter,
|
|
15885
15946
|
sort: sort
|
|
15886
15947
|
}, options || {}));
|
|
@@ -16088,7 +16149,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16088
16149
|
case 0:
|
|
16089
16150
|
options = _args90.length > 1 && _args90[1] !== undefined ? _args90[1] : {};
|
|
16090
16151
|
_context90.next = 3;
|
|
16091
|
-
return this.post(this.baseURL + "/channels/delete", _objectSpread({
|
|
16152
|
+
return this.post(this.baseURL + "/channels/delete", _objectSpread$1({
|
|
16092
16153
|
cids: cids
|
|
16093
16154
|
}, options));
|
|
16094
16155
|
|
|
@@ -16155,7 +16216,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16155
16216
|
|
|
16156
16217
|
case 7:
|
|
16157
16218
|
_context91.next = 9;
|
|
16158
|
-
return this.post(this.baseURL + "/users/delete", _objectSpread({
|
|
16219
|
+
return this.post(this.baseURL + "/users/delete", _objectSpread$1({
|
|
16159
16220
|
user_ids: user_ids
|
|
16160
16221
|
}, options));
|
|
16161
16222
|
|
|
@@ -16245,7 +16306,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16245
16306
|
mode: 'upsert'
|
|
16246
16307
|
};
|
|
16247
16308
|
_context93.next = 3;
|
|
16248
|
-
return this.post(this.baseURL + "/imports", _objectSpread({
|
|
16309
|
+
return this.post(this.baseURL + "/imports", _objectSpread$1({
|
|
16249
16310
|
path: path
|
|
16250
16311
|
}, options));
|
|
16251
16312
|
|
|
@@ -16524,7 +16585,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16524
16585
|
switch (_context100.prev = _context100.next) {
|
|
16525
16586
|
case 0:
|
|
16526
16587
|
_context100.next = 2;
|
|
16527
|
-
return this.post(this.baseURL + "/polls", _objectSpread(_objectSpread({}, poll), userId ? {
|
|
16588
|
+
return this.post(this.baseURL + "/polls", _objectSpread$1(_objectSpread$1({}, poll), userId ? {
|
|
16528
16589
|
user_id: userId
|
|
16529
16590
|
} : {}));
|
|
16530
16591
|
|
|
@@ -16598,7 +16659,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16598
16659
|
switch (_context102.prev = _context102.next) {
|
|
16599
16660
|
case 0:
|
|
16600
16661
|
_context102.next = 2;
|
|
16601
|
-
return this.put(this.baseURL + "/polls", _objectSpread(_objectSpread({}, poll), userId ? {
|
|
16662
|
+
return this.put(this.baseURL + "/polls", _objectSpread$1(_objectSpread$1({}, poll), userId ? {
|
|
16602
16663
|
user_id: userId
|
|
16603
16664
|
} : {}));
|
|
16604
16665
|
|
|
@@ -16637,7 +16698,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16637
16698
|
switch (_context103.prev = _context103.next) {
|
|
16638
16699
|
case 0:
|
|
16639
16700
|
_context103.next = 2;
|
|
16640
|
-
return this.patch(this.baseURL + "/polls/".concat(encodeURIComponent(id)), _objectSpread(_objectSpread({}, partialPollObject), userId ? {
|
|
16701
|
+
return this.patch(this.baseURL + "/polls/".concat(encodeURIComponent(id)), _objectSpread$1(_objectSpread$1({}, partialPollObject), userId ? {
|
|
16641
16702
|
user_id: userId
|
|
16642
16703
|
} : {}));
|
|
16643
16704
|
|
|
@@ -16674,7 +16735,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16674
16735
|
switch (_context104.prev = _context104.next) {
|
|
16675
16736
|
case 0:
|
|
16676
16737
|
_context104.next = 2;
|
|
16677
|
-
return this.delete(this.baseURL + "/polls/".concat(encodeURIComponent(id)), _objectSpread({}, userId ? {
|
|
16738
|
+
return this.delete(this.baseURL + "/polls/".concat(encodeURIComponent(id)), _objectSpread$1({}, userId ? {
|
|
16678
16739
|
user_id: userId
|
|
16679
16740
|
} : {}));
|
|
16680
16741
|
|
|
@@ -16747,7 +16808,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16747
16808
|
switch (_context106.prev = _context106.next) {
|
|
16748
16809
|
case 0:
|
|
16749
16810
|
_context106.next = 2;
|
|
16750
|
-
return this.post(this.baseURL + "/polls/".concat(encodeURIComponent(pollId), "/options"), _objectSpread(_objectSpread({}, option), userId ? {
|
|
16811
|
+
return this.post(this.baseURL + "/polls/".concat(encodeURIComponent(pollId), "/options"), _objectSpread$1(_objectSpread$1({}, option), userId ? {
|
|
16751
16812
|
user_id: userId
|
|
16752
16813
|
} : {}));
|
|
16753
16814
|
|
|
@@ -16823,7 +16884,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16823
16884
|
switch (_context108.prev = _context108.next) {
|
|
16824
16885
|
case 0:
|
|
16825
16886
|
_context108.next = 2;
|
|
16826
|
-
return this.put(this.baseURL + "/polls/".concat(encodeURIComponent(pollId), "/options"), _objectSpread(_objectSpread({}, option), userId ? {
|
|
16887
|
+
return this.put(this.baseURL + "/polls/".concat(encodeURIComponent(pollId), "/options"), _objectSpread$1(_objectSpread$1({}, option), userId ? {
|
|
16827
16888
|
user_id: userId
|
|
16828
16889
|
} : {}));
|
|
16829
16890
|
|
|
@@ -16900,7 +16961,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16900
16961
|
switch (_context110.prev = _context110.next) {
|
|
16901
16962
|
case 0:
|
|
16902
16963
|
_context110.next = 2;
|
|
16903
|
-
return this.post(this.baseURL + "/messages/".concat(encodeURIComponent(messageId), "/polls/").concat(encodeURIComponent(pollId), "/vote"), _objectSpread({
|
|
16964
|
+
return this.post(this.baseURL + "/messages/".concat(encodeURIComponent(messageId), "/polls/").concat(encodeURIComponent(pollId), "/vote"), _objectSpread$1({
|
|
16904
16965
|
vote: vote
|
|
16905
16966
|
}, userId ? {
|
|
16906
16967
|
user_id: userId
|
|
@@ -16966,7 +17027,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16966
17027
|
switch (_context112.prev = _context112.next) {
|
|
16967
17028
|
case 0:
|
|
16968
17029
|
_context112.next = 2;
|
|
16969
|
-
return this.delete(this.baseURL + "/messages/".concat(encodeURIComponent(messageId), "/polls/").concat(encodeURIComponent(pollId), "/vote/").concat(encodeURIComponent(voteId)), _objectSpread({}, userId ? {
|
|
17030
|
+
return this.delete(this.baseURL + "/messages/".concat(encodeURIComponent(messageId), "/polls/").concat(encodeURIComponent(pollId), "/vote/").concat(encodeURIComponent(voteId)), _objectSpread$1({}, userId ? {
|
|
16970
17031
|
user_id: userId
|
|
16971
17032
|
} : {}));
|
|
16972
17033
|
|
|
@@ -17016,7 +17077,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
17016
17077
|
userId = _args113.length > 3 ? _args113[3] : undefined;
|
|
17017
17078
|
q = userId ? "?user_id=".concat(userId) : '';
|
|
17018
17079
|
_context113.next = 7;
|
|
17019
|
-
return this.post(this.baseURL + "/polls/query".concat(q), _objectSpread({
|
|
17080
|
+
return this.post(this.baseURL + "/polls/query".concat(q), _objectSpread$1({
|
|
17020
17081
|
filter: filter,
|
|
17021
17082
|
sort: normalizeQuerySort(sort)
|
|
17022
17083
|
}, options));
|
|
@@ -17068,7 +17129,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
17068
17129
|
userId = _args114.length > 4 ? _args114[4] : undefined;
|
|
17069
17130
|
q = userId ? "?user_id=".concat(userId) : '';
|
|
17070
17131
|
_context114.next = 7;
|
|
17071
|
-
return this.post(this.baseURL + "/polls/".concat(encodeURIComponent(pollId), "/votes").concat(q), _objectSpread({
|
|
17132
|
+
return this.post(this.baseURL + "/polls/".concat(encodeURIComponent(pollId), "/votes").concat(q), _objectSpread$1({
|
|
17072
17133
|
filter: filter,
|
|
17073
17134
|
sort: normalizeQuerySort(sort)
|
|
17074
17135
|
}, options));
|
|
@@ -17120,8 +17181,8 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
17120
17181
|
userId = _args115.length > 4 ? _args115[4] : undefined;
|
|
17121
17182
|
q = userId ? "?user_id=".concat(userId) : '';
|
|
17122
17183
|
_context115.next = 7;
|
|
17123
|
-
return this.post(this.baseURL + "/polls/".concat(encodeURIComponent(pollId), "/votes").concat(q), _objectSpread({
|
|
17124
|
-
filter: _objectSpread(_objectSpread({}, filter), {}, {
|
|
17184
|
+
return this.post(this.baseURL + "/polls/".concat(encodeURIComponent(pollId), "/votes").concat(q), _objectSpread$1({
|
|
17185
|
+
filter: _objectSpread$1(_objectSpread$1({}, filter), {}, {
|
|
17125
17186
|
is_answer: true
|
|
17126
17187
|
}),
|
|
17127
17188
|
sort: normalizeQuerySort(sort)
|
|
@@ -17168,7 +17229,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
17168
17229
|
sort = _args116.length > 1 && _args116[1] !== undefined ? _args116[1] : [];
|
|
17169
17230
|
options = _args116.length > 2 && _args116[2] !== undefined ? _args116[2] : {};
|
|
17170
17231
|
_context116.next = 5;
|
|
17171
|
-
return this.post(this.baseURL + '/messages/history', _objectSpread({
|
|
17232
|
+
return this.post(this.baseURL + '/messages/history', _objectSpread$1({
|
|
17172
17233
|
filter: filter,
|
|
17173
17234
|
sort: normalizeQuerySort(sort)
|
|
17174
17235
|
}, options));
|
|
@@ -17211,7 +17272,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
17211
17272
|
case 0:
|
|
17212
17273
|
options = _args117.length > 2 && _args117[2] !== undefined ? _args117[2] : {};
|
|
17213
17274
|
_context117.next = 3;
|
|
17214
|
-
return this.post(this.baseURL + '/automod/v1/moderation/update_flags', _objectSpread({
|
|
17275
|
+
return this.post(this.baseURL + '/automod/v1/moderation/update_flags', _objectSpread$1({
|
|
17215
17276
|
message_ids: message_ids,
|
|
17216
17277
|
reviewed_by: reviewed_by
|
|
17217
17278
|
}, options));
|
|
@@ -17390,5 +17451,761 @@ var BuiltinPermissions = {
|
|
|
17390
17451
|
UseFrozenChannel: 'Send messages and reactions to frozen channels'
|
|
17391
17452
|
};
|
|
17392
17453
|
|
|
17393
|
-
|
|
17454
|
+
var _excluded = ["lastQueryError"];
|
|
17455
|
+
|
|
17456
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
17457
|
+
|
|
17458
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
17459
|
+
|
|
17460
|
+
function ownKeys(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; }
|
|
17461
|
+
|
|
17462
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
17463
|
+
var DEFAULT_SEARCH_SOURCE_OPTIONS = {
|
|
17464
|
+
debounceMs: 300,
|
|
17465
|
+
pageSize: 10
|
|
17466
|
+
};
|
|
17467
|
+
var BaseSearchSource = /*#__PURE__*/function () {
|
|
17468
|
+
function BaseSearchSource(options) {
|
|
17469
|
+
var _this = this;
|
|
17470
|
+
|
|
17471
|
+
_classCallCheck(this, BaseSearchSource);
|
|
17472
|
+
|
|
17473
|
+
_defineProperty(this, "state", void 0);
|
|
17474
|
+
|
|
17475
|
+
_defineProperty(this, "pageSize", void 0);
|
|
17476
|
+
|
|
17477
|
+
_defineProperty(this, "type", void 0);
|
|
17478
|
+
|
|
17479
|
+
_defineProperty(this, "searchDebounced", void 0);
|
|
17480
|
+
|
|
17481
|
+
_defineProperty(this, "setDebounceOptions", function (_ref) {
|
|
17482
|
+
var debounceMs = _ref.debounceMs;
|
|
17483
|
+
_this.searchDebounced = debounce(_this.executeQuery.bind(_this), debounceMs);
|
|
17484
|
+
});
|
|
17485
|
+
|
|
17486
|
+
_defineProperty(this, "activate", function () {
|
|
17487
|
+
if (_this.isActive) return;
|
|
17488
|
+
|
|
17489
|
+
_this.state.partialNext({
|
|
17490
|
+
isActive: true
|
|
17491
|
+
});
|
|
17492
|
+
});
|
|
17493
|
+
|
|
17494
|
+
_defineProperty(this, "deactivate", function () {
|
|
17495
|
+
if (!_this.isActive) return;
|
|
17496
|
+
|
|
17497
|
+
_this.state.partialNext({
|
|
17498
|
+
isActive: false
|
|
17499
|
+
});
|
|
17500
|
+
});
|
|
17501
|
+
|
|
17502
|
+
_defineProperty(this, "search", function (searchQuery) {
|
|
17503
|
+
_this.searchDebounced(searchQuery);
|
|
17504
|
+
});
|
|
17505
|
+
|
|
17506
|
+
var _DEFAULT_SEARCH_SOURC = _objectSpread(_objectSpread({}, DEFAULT_SEARCH_SOURCE_OPTIONS), options),
|
|
17507
|
+
_debounceMs = _DEFAULT_SEARCH_SOURC.debounceMs,
|
|
17508
|
+
pageSize = _DEFAULT_SEARCH_SOURC.pageSize;
|
|
17509
|
+
|
|
17510
|
+
this.pageSize = pageSize;
|
|
17511
|
+
this.state = new StateStore(this.initialState);
|
|
17512
|
+
this.setDebounceOptions({
|
|
17513
|
+
debounceMs: _debounceMs
|
|
17514
|
+
});
|
|
17515
|
+
}
|
|
17516
|
+
|
|
17517
|
+
_createClass(BaseSearchSource, [{
|
|
17518
|
+
key: "lastQueryError",
|
|
17519
|
+
get: function get() {
|
|
17520
|
+
return this.state.getLatestValue().lastQueryError;
|
|
17521
|
+
}
|
|
17522
|
+
}, {
|
|
17523
|
+
key: "hasNext",
|
|
17524
|
+
get: function get() {
|
|
17525
|
+
return this.state.getLatestValue().hasNext;
|
|
17526
|
+
}
|
|
17527
|
+
}, {
|
|
17528
|
+
key: "hasResults",
|
|
17529
|
+
get: function get() {
|
|
17530
|
+
return Array.isArray(this.state.getLatestValue().items);
|
|
17531
|
+
}
|
|
17532
|
+
}, {
|
|
17533
|
+
key: "isActive",
|
|
17534
|
+
get: function get() {
|
|
17535
|
+
return this.state.getLatestValue().isActive;
|
|
17536
|
+
}
|
|
17537
|
+
}, {
|
|
17538
|
+
key: "isLoading",
|
|
17539
|
+
get: function get() {
|
|
17540
|
+
return this.state.getLatestValue().isLoading;
|
|
17541
|
+
}
|
|
17542
|
+
}, {
|
|
17543
|
+
key: "initialState",
|
|
17544
|
+
get: function get() {
|
|
17545
|
+
return {
|
|
17546
|
+
hasNext: true,
|
|
17547
|
+
isActive: false,
|
|
17548
|
+
isLoading: false,
|
|
17549
|
+
items: undefined,
|
|
17550
|
+
lastQueryError: undefined,
|
|
17551
|
+
next: undefined,
|
|
17552
|
+
offset: 0,
|
|
17553
|
+
searchQuery: ''
|
|
17554
|
+
};
|
|
17555
|
+
}
|
|
17556
|
+
}, {
|
|
17557
|
+
key: "items",
|
|
17558
|
+
get: function get() {
|
|
17559
|
+
return this.state.getLatestValue().items;
|
|
17560
|
+
}
|
|
17561
|
+
}, {
|
|
17562
|
+
key: "next",
|
|
17563
|
+
get: function get() {
|
|
17564
|
+
return this.state.getLatestValue().next;
|
|
17565
|
+
}
|
|
17566
|
+
}, {
|
|
17567
|
+
key: "offset",
|
|
17568
|
+
get: function get() {
|
|
17569
|
+
return this.state.getLatestValue().offset;
|
|
17570
|
+
}
|
|
17571
|
+
}, {
|
|
17572
|
+
key: "searchQuery",
|
|
17573
|
+
get: function get() {
|
|
17574
|
+
return this.state.getLatestValue().searchQuery;
|
|
17575
|
+
}
|
|
17576
|
+
}, {
|
|
17577
|
+
key: "executeQuery",
|
|
17578
|
+
value: function () {
|
|
17579
|
+
var _executeQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(newSearchString) {
|
|
17580
|
+
var hasNewSearchQuery, searchString, stateUpdate, results, _items, next, _this$offset;
|
|
17581
|
+
|
|
17582
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
17583
|
+
while (1) {
|
|
17584
|
+
switch (_context.prev = _context.next) {
|
|
17585
|
+
case 0:
|
|
17586
|
+
hasNewSearchQuery = typeof newSearchString !== 'undefined';
|
|
17587
|
+
searchString = newSearchString !== null && newSearchString !== void 0 ? newSearchString : this.searchQuery;
|
|
17588
|
+
|
|
17589
|
+
if (!(!this.isActive || this.isLoading || !this.hasNext && !hasNewSearchQuery || !searchString)) {
|
|
17590
|
+
_context.next = 4;
|
|
17591
|
+
break;
|
|
17592
|
+
}
|
|
17593
|
+
|
|
17594
|
+
return _context.abrupt("return");
|
|
17595
|
+
|
|
17596
|
+
case 4:
|
|
17597
|
+
if (hasNewSearchQuery) {
|
|
17598
|
+
this.state.next(_objectSpread(_objectSpread({}, this.initialState), {}, {
|
|
17599
|
+
isActive: this.isActive,
|
|
17600
|
+
isLoading: true,
|
|
17601
|
+
searchQuery: newSearchString !== null && newSearchString !== void 0 ? newSearchString : ''
|
|
17602
|
+
}));
|
|
17603
|
+
} else {
|
|
17604
|
+
this.state.partialNext({
|
|
17605
|
+
isLoading: true
|
|
17606
|
+
});
|
|
17607
|
+
}
|
|
17608
|
+
|
|
17609
|
+
stateUpdate = {};
|
|
17610
|
+
_context.prev = 6;
|
|
17611
|
+
_context.next = 9;
|
|
17612
|
+
return this.query(searchString);
|
|
17613
|
+
|
|
17614
|
+
case 9:
|
|
17615
|
+
results = _context.sent;
|
|
17616
|
+
|
|
17617
|
+
if (results) {
|
|
17618
|
+
_context.next = 12;
|
|
17619
|
+
break;
|
|
17620
|
+
}
|
|
17621
|
+
|
|
17622
|
+
return _context.abrupt("return");
|
|
17623
|
+
|
|
17624
|
+
case 12:
|
|
17625
|
+
_items = results.items, next = results.next;
|
|
17626
|
+
|
|
17627
|
+
if (next) {
|
|
17628
|
+
stateUpdate.next = next;
|
|
17629
|
+
stateUpdate.hasNext = !!next;
|
|
17630
|
+
} else {
|
|
17631
|
+
stateUpdate.offset = ((_this$offset = this.offset) !== null && _this$offset !== void 0 ? _this$offset : 0) + _items.length;
|
|
17632
|
+
stateUpdate.hasNext = _items.length === this.pageSize;
|
|
17633
|
+
}
|
|
17634
|
+
|
|
17635
|
+
_context.next = 16;
|
|
17636
|
+
return this.filterQueryResults(_items);
|
|
17637
|
+
|
|
17638
|
+
case 16:
|
|
17639
|
+
stateUpdate.items = _context.sent;
|
|
17640
|
+
_context.next = 22;
|
|
17641
|
+
break;
|
|
17642
|
+
|
|
17643
|
+
case 19:
|
|
17644
|
+
_context.prev = 19;
|
|
17645
|
+
_context.t0 = _context["catch"](6);
|
|
17646
|
+
stateUpdate.lastQueryError = _context.t0;
|
|
17647
|
+
|
|
17648
|
+
case 22:
|
|
17649
|
+
_context.prev = 22;
|
|
17650
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
17651
|
+
this.state.next(function (_ref2) {
|
|
17652
|
+
var _current$items;
|
|
17653
|
+
|
|
17654
|
+
_ref2.lastQueryError;
|
|
17655
|
+
var current = _objectWithoutProperties(_ref2, _excluded);
|
|
17656
|
+
|
|
17657
|
+
return _objectSpread(_objectSpread(_objectSpread({}, current), stateUpdate), {}, {
|
|
17658
|
+
isLoading: false,
|
|
17659
|
+
items: [].concat(_toConsumableArray((_current$items = current.items) !== null && _current$items !== void 0 ? _current$items : []), _toConsumableArray(stateUpdate.items || []))
|
|
17660
|
+
});
|
|
17661
|
+
});
|
|
17662
|
+
return _context.finish(22);
|
|
17663
|
+
|
|
17664
|
+
case 25:
|
|
17665
|
+
case "end":
|
|
17666
|
+
return _context.stop();
|
|
17667
|
+
}
|
|
17668
|
+
}
|
|
17669
|
+
}, _callee, this, [[6, 19, 22, 25]]);
|
|
17670
|
+
}));
|
|
17671
|
+
|
|
17672
|
+
function executeQuery(_x) {
|
|
17673
|
+
return _executeQuery.apply(this, arguments);
|
|
17674
|
+
}
|
|
17675
|
+
|
|
17676
|
+
return executeQuery;
|
|
17677
|
+
}()
|
|
17678
|
+
}, {
|
|
17679
|
+
key: "resetState",
|
|
17680
|
+
value: function resetState() {
|
|
17681
|
+
this.state.next(this.initialState);
|
|
17682
|
+
}
|
|
17683
|
+
}]);
|
|
17684
|
+
|
|
17685
|
+
return BaseSearchSource;
|
|
17686
|
+
}();
|
|
17687
|
+
var UserSearchSource = /*#__PURE__*/function (_BaseSearchSource) {
|
|
17688
|
+
_inherits(UserSearchSource, _BaseSearchSource);
|
|
17689
|
+
|
|
17690
|
+
var _super = _createSuper(UserSearchSource);
|
|
17691
|
+
|
|
17692
|
+
function UserSearchSource(client, options) {
|
|
17693
|
+
var _this2;
|
|
17694
|
+
|
|
17695
|
+
_classCallCheck(this, UserSearchSource);
|
|
17696
|
+
|
|
17697
|
+
_this2 = _super.call(this, options);
|
|
17698
|
+
|
|
17699
|
+
_defineProperty(_assertThisInitialized(_this2), "type", 'users');
|
|
17700
|
+
|
|
17701
|
+
_defineProperty(_assertThisInitialized(_this2), "client", void 0);
|
|
17702
|
+
|
|
17703
|
+
_defineProperty(_assertThisInitialized(_this2), "filters", void 0);
|
|
17704
|
+
|
|
17705
|
+
_defineProperty(_assertThisInitialized(_this2), "sort", void 0);
|
|
17706
|
+
|
|
17707
|
+
_defineProperty(_assertThisInitialized(_this2), "searchOptions", void 0);
|
|
17708
|
+
|
|
17709
|
+
_this2.client = client;
|
|
17710
|
+
return _this2;
|
|
17711
|
+
}
|
|
17712
|
+
|
|
17713
|
+
_createClass(UserSearchSource, [{
|
|
17714
|
+
key: "query",
|
|
17715
|
+
value: function () {
|
|
17716
|
+
var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(searchQuery) {
|
|
17717
|
+
var filters, sort, options, _yield$this$client$qu, users;
|
|
17718
|
+
|
|
17719
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
17720
|
+
while (1) {
|
|
17721
|
+
switch (_context2.prev = _context2.next) {
|
|
17722
|
+
case 0:
|
|
17723
|
+
filters = _objectSpread({
|
|
17724
|
+
$or: [{
|
|
17725
|
+
id: {
|
|
17726
|
+
$autocomplete: searchQuery
|
|
17727
|
+
}
|
|
17728
|
+
}, {
|
|
17729
|
+
name: {
|
|
17730
|
+
$autocomplete: searchQuery
|
|
17731
|
+
}
|
|
17732
|
+
}]
|
|
17733
|
+
}, this.filters);
|
|
17734
|
+
sort = _objectSpread({
|
|
17735
|
+
id: 1
|
|
17736
|
+
}, this.sort);
|
|
17737
|
+
options = _objectSpread(_objectSpread({}, this.searchOptions), {}, {
|
|
17738
|
+
limit: this.pageSize,
|
|
17739
|
+
offset: this.offset
|
|
17740
|
+
});
|
|
17741
|
+
_context2.next = 5;
|
|
17742
|
+
return this.client.queryUsers(filters, sort, options);
|
|
17743
|
+
|
|
17744
|
+
case 5:
|
|
17745
|
+
_yield$this$client$qu = _context2.sent;
|
|
17746
|
+
users = _yield$this$client$qu.users;
|
|
17747
|
+
return _context2.abrupt("return", {
|
|
17748
|
+
items: users
|
|
17749
|
+
});
|
|
17750
|
+
|
|
17751
|
+
case 8:
|
|
17752
|
+
case "end":
|
|
17753
|
+
return _context2.stop();
|
|
17754
|
+
}
|
|
17755
|
+
}
|
|
17756
|
+
}, _callee2, this);
|
|
17757
|
+
}));
|
|
17758
|
+
|
|
17759
|
+
function query(_x2) {
|
|
17760
|
+
return _query.apply(this, arguments);
|
|
17761
|
+
}
|
|
17762
|
+
|
|
17763
|
+
return query;
|
|
17764
|
+
}()
|
|
17765
|
+
}, {
|
|
17766
|
+
key: "filterQueryResults",
|
|
17767
|
+
value: function filterQueryResults(items) {
|
|
17768
|
+
var _this3 = this;
|
|
17769
|
+
|
|
17770
|
+
return items.filter(function (u) {
|
|
17771
|
+
var _this3$client$user;
|
|
17772
|
+
|
|
17773
|
+
return u.id !== ((_this3$client$user = _this3.client.user) === null || _this3$client$user === void 0 ? void 0 : _this3$client$user.id);
|
|
17774
|
+
});
|
|
17775
|
+
}
|
|
17776
|
+
}]);
|
|
17777
|
+
|
|
17778
|
+
return UserSearchSource;
|
|
17779
|
+
}(BaseSearchSource);
|
|
17780
|
+
var ChannelSearchSource = /*#__PURE__*/function (_BaseSearchSource2) {
|
|
17781
|
+
_inherits(ChannelSearchSource, _BaseSearchSource2);
|
|
17782
|
+
|
|
17783
|
+
var _super2 = _createSuper(ChannelSearchSource);
|
|
17784
|
+
|
|
17785
|
+
function ChannelSearchSource(client, options) {
|
|
17786
|
+
var _this4;
|
|
17787
|
+
|
|
17788
|
+
_classCallCheck(this, ChannelSearchSource);
|
|
17789
|
+
|
|
17790
|
+
_this4 = _super2.call(this, options);
|
|
17791
|
+
|
|
17792
|
+
_defineProperty(_assertThisInitialized(_this4), "type", 'channels');
|
|
17793
|
+
|
|
17794
|
+
_defineProperty(_assertThisInitialized(_this4), "client", void 0);
|
|
17795
|
+
|
|
17796
|
+
_defineProperty(_assertThisInitialized(_this4), "filters", void 0);
|
|
17797
|
+
|
|
17798
|
+
_defineProperty(_assertThisInitialized(_this4), "sort", void 0);
|
|
17799
|
+
|
|
17800
|
+
_defineProperty(_assertThisInitialized(_this4), "searchOptions", void 0);
|
|
17801
|
+
|
|
17802
|
+
_this4.client = client;
|
|
17803
|
+
return _this4;
|
|
17804
|
+
}
|
|
17805
|
+
|
|
17806
|
+
_createClass(ChannelSearchSource, [{
|
|
17807
|
+
key: "query",
|
|
17808
|
+
value: function () {
|
|
17809
|
+
var _query2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(searchQuery) {
|
|
17810
|
+
var _this$sort;
|
|
17811
|
+
|
|
17812
|
+
var filters, sort, options, items;
|
|
17813
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
17814
|
+
while (1) {
|
|
17815
|
+
switch (_context3.prev = _context3.next) {
|
|
17816
|
+
case 0:
|
|
17817
|
+
filters = _objectSpread({
|
|
17818
|
+
members: {
|
|
17819
|
+
$in: [this.client.userID]
|
|
17820
|
+
},
|
|
17821
|
+
name: {
|
|
17822
|
+
$autocomplete: searchQuery
|
|
17823
|
+
}
|
|
17824
|
+
}, this.filters);
|
|
17825
|
+
sort = (_this$sort = this.sort) !== null && _this$sort !== void 0 ? _this$sort : {};
|
|
17826
|
+
options = _objectSpread(_objectSpread({}, this.searchOptions), {}, {
|
|
17827
|
+
limit: this.pageSize,
|
|
17828
|
+
offset: this.offset
|
|
17829
|
+
});
|
|
17830
|
+
_context3.next = 5;
|
|
17831
|
+
return this.client.queryChannels(filters, sort, options);
|
|
17832
|
+
|
|
17833
|
+
case 5:
|
|
17834
|
+
items = _context3.sent;
|
|
17835
|
+
return _context3.abrupt("return", {
|
|
17836
|
+
items: items
|
|
17837
|
+
});
|
|
17838
|
+
|
|
17839
|
+
case 7:
|
|
17840
|
+
case "end":
|
|
17841
|
+
return _context3.stop();
|
|
17842
|
+
}
|
|
17843
|
+
}
|
|
17844
|
+
}, _callee3, this);
|
|
17845
|
+
}));
|
|
17846
|
+
|
|
17847
|
+
function query(_x3) {
|
|
17848
|
+
return _query2.apply(this, arguments);
|
|
17849
|
+
}
|
|
17850
|
+
|
|
17851
|
+
return query;
|
|
17852
|
+
}()
|
|
17853
|
+
}, {
|
|
17854
|
+
key: "filterQueryResults",
|
|
17855
|
+
value: function filterQueryResults(items) {
|
|
17856
|
+
return items;
|
|
17857
|
+
}
|
|
17858
|
+
}]);
|
|
17859
|
+
|
|
17860
|
+
return ChannelSearchSource;
|
|
17861
|
+
}(BaseSearchSource);
|
|
17862
|
+
var MessageSearchSource = /*#__PURE__*/function (_BaseSearchSource3) {
|
|
17863
|
+
_inherits(MessageSearchSource, _BaseSearchSource3);
|
|
17864
|
+
|
|
17865
|
+
var _super3 = _createSuper(MessageSearchSource);
|
|
17866
|
+
|
|
17867
|
+
function MessageSearchSource(client, options) {
|
|
17868
|
+
var _this5;
|
|
17869
|
+
|
|
17870
|
+
_classCallCheck(this, MessageSearchSource);
|
|
17871
|
+
|
|
17872
|
+
_this5 = _super3.call(this, options);
|
|
17873
|
+
|
|
17874
|
+
_defineProperty(_assertThisInitialized(_this5), "type", 'messages');
|
|
17875
|
+
|
|
17876
|
+
_defineProperty(_assertThisInitialized(_this5), "client", void 0);
|
|
17877
|
+
|
|
17878
|
+
_defineProperty(_assertThisInitialized(_this5), "messageSearchChannelFilters", void 0);
|
|
17879
|
+
|
|
17880
|
+
_defineProperty(_assertThisInitialized(_this5), "messageSearchFilters", void 0);
|
|
17881
|
+
|
|
17882
|
+
_defineProperty(_assertThisInitialized(_this5), "messageSearchSort", void 0);
|
|
17883
|
+
|
|
17884
|
+
_defineProperty(_assertThisInitialized(_this5), "channelQueryFilters", void 0);
|
|
17885
|
+
|
|
17886
|
+
_defineProperty(_assertThisInitialized(_this5), "channelQuerySort", void 0);
|
|
17887
|
+
|
|
17888
|
+
_defineProperty(_assertThisInitialized(_this5), "channelQueryOptions", void 0);
|
|
17889
|
+
|
|
17890
|
+
_this5.client = client;
|
|
17891
|
+
return _this5;
|
|
17892
|
+
}
|
|
17893
|
+
|
|
17894
|
+
_createClass(MessageSearchSource, [{
|
|
17895
|
+
key: "query",
|
|
17896
|
+
value: function () {
|
|
17897
|
+
var _query3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(searchQuery) {
|
|
17898
|
+
var _this6 = this;
|
|
17899
|
+
|
|
17900
|
+
var channelFilters, messageFilters, sort, options, _yield$this$client$se, next, results, items, cids, allChannelsLoadedLocally;
|
|
17901
|
+
|
|
17902
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
17903
|
+
while (1) {
|
|
17904
|
+
switch (_context4.prev = _context4.next) {
|
|
17905
|
+
case 0:
|
|
17906
|
+
if (this.client.userID) {
|
|
17907
|
+
_context4.next = 2;
|
|
17908
|
+
break;
|
|
17909
|
+
}
|
|
17910
|
+
|
|
17911
|
+
return _context4.abrupt("return", {
|
|
17912
|
+
items: []
|
|
17913
|
+
});
|
|
17914
|
+
|
|
17915
|
+
case 2:
|
|
17916
|
+
channelFilters = _objectSpread({
|
|
17917
|
+
members: {
|
|
17918
|
+
$in: [this.client.userID]
|
|
17919
|
+
}
|
|
17920
|
+
}, this.messageSearchChannelFilters);
|
|
17921
|
+
messageFilters = _objectSpread({
|
|
17922
|
+
text: searchQuery,
|
|
17923
|
+
type: 'regular'
|
|
17924
|
+
}, this.messageSearchFilters);
|
|
17925
|
+
sort = _objectSpread({
|
|
17926
|
+
created_at: -1
|
|
17927
|
+
}, this.messageSearchSort);
|
|
17928
|
+
options = {
|
|
17929
|
+
limit: this.pageSize,
|
|
17930
|
+
next: this.next,
|
|
17931
|
+
sort: sort
|
|
17932
|
+
};
|
|
17933
|
+
_context4.next = 8;
|
|
17934
|
+
return this.client.search(channelFilters, messageFilters, options);
|
|
17935
|
+
|
|
17936
|
+
case 8:
|
|
17937
|
+
_yield$this$client$se = _context4.sent;
|
|
17938
|
+
next = _yield$this$client$se.next;
|
|
17939
|
+
results = _yield$this$client$se.results;
|
|
17940
|
+
items = results.map(function (_ref3) {
|
|
17941
|
+
var message = _ref3.message;
|
|
17942
|
+
return message;
|
|
17943
|
+
});
|
|
17944
|
+
cids = Array.from(items.reduce(function (acc, message) {
|
|
17945
|
+
if (message.cid && !_this6.client.activeChannels[message.cid]) acc.add(message.cid);
|
|
17946
|
+
return acc;
|
|
17947
|
+
}, new Set()) // keep the cids unique
|
|
17948
|
+
);
|
|
17949
|
+
allChannelsLoadedLocally = cids.length === 0;
|
|
17950
|
+
|
|
17951
|
+
if (allChannelsLoadedLocally) {
|
|
17952
|
+
_context4.next = 17;
|
|
17953
|
+
break;
|
|
17954
|
+
}
|
|
17955
|
+
|
|
17956
|
+
_context4.next = 17;
|
|
17957
|
+
return this.client.queryChannels(_objectSpread({
|
|
17958
|
+
cid: {
|
|
17959
|
+
$in: cids
|
|
17960
|
+
}
|
|
17961
|
+
}, this.channelQueryFilters), _objectSpread({
|
|
17962
|
+
last_message_at: -1
|
|
17963
|
+
}, this.channelQuerySort), this.channelQueryOptions);
|
|
17964
|
+
|
|
17965
|
+
case 17:
|
|
17966
|
+
return _context4.abrupt("return", {
|
|
17967
|
+
items: items,
|
|
17968
|
+
next: next
|
|
17969
|
+
});
|
|
17970
|
+
|
|
17971
|
+
case 18:
|
|
17972
|
+
case "end":
|
|
17973
|
+
return _context4.stop();
|
|
17974
|
+
}
|
|
17975
|
+
}
|
|
17976
|
+
}, _callee4, this);
|
|
17977
|
+
}));
|
|
17978
|
+
|
|
17979
|
+
function query(_x4) {
|
|
17980
|
+
return _query3.apply(this, arguments);
|
|
17981
|
+
}
|
|
17982
|
+
|
|
17983
|
+
return query;
|
|
17984
|
+
}()
|
|
17985
|
+
}, {
|
|
17986
|
+
key: "filterQueryResults",
|
|
17987
|
+
value: function filterQueryResults(items) {
|
|
17988
|
+
return items;
|
|
17989
|
+
}
|
|
17990
|
+
}]);
|
|
17991
|
+
|
|
17992
|
+
return MessageSearchSource;
|
|
17993
|
+
}(BaseSearchSource);
|
|
17994
|
+
var SearchController = /*#__PURE__*/function () {
|
|
17995
|
+
/**
|
|
17996
|
+
* Not intended for direct use by integrators, might be removed without notice resulting in
|
|
17997
|
+
* broken integrations.
|
|
17998
|
+
*/
|
|
17999
|
+
function SearchController() {
|
|
18000
|
+
var _this7 = this;
|
|
18001
|
+
|
|
18002
|
+
var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
18003
|
+
config = _ref4.config,
|
|
18004
|
+
sources = _ref4.sources;
|
|
18005
|
+
|
|
18006
|
+
_classCallCheck(this, SearchController);
|
|
18007
|
+
|
|
18008
|
+
_defineProperty(this, "_internalState", void 0);
|
|
18009
|
+
|
|
18010
|
+
_defineProperty(this, "state", void 0);
|
|
18011
|
+
|
|
18012
|
+
_defineProperty(this, "config", void 0);
|
|
18013
|
+
|
|
18014
|
+
_defineProperty(this, "addSource", function (source) {
|
|
18015
|
+
_this7.state.partialNext({
|
|
18016
|
+
sources: [].concat(_toConsumableArray(_this7.sources), [source])
|
|
18017
|
+
});
|
|
18018
|
+
});
|
|
18019
|
+
|
|
18020
|
+
_defineProperty(this, "getSource", function (sourceType) {
|
|
18021
|
+
return _this7.sources.find(function (s) {
|
|
18022
|
+
return s.type === sourceType;
|
|
18023
|
+
});
|
|
18024
|
+
});
|
|
18025
|
+
|
|
18026
|
+
_defineProperty(this, "removeSource", function (sourceType) {
|
|
18027
|
+
var newSources = _this7.sources.filter(function (s) {
|
|
18028
|
+
return s.type !== sourceType;
|
|
18029
|
+
});
|
|
18030
|
+
|
|
18031
|
+
if (newSources.length === _this7.sources.length) return;
|
|
18032
|
+
|
|
18033
|
+
_this7.state.partialNext({
|
|
18034
|
+
sources: newSources
|
|
18035
|
+
});
|
|
18036
|
+
});
|
|
18037
|
+
|
|
18038
|
+
_defineProperty(this, "activateSource", function (sourceType) {
|
|
18039
|
+
var source = _this7.getSource(sourceType);
|
|
18040
|
+
|
|
18041
|
+
if (!source || source.isActive) return;
|
|
18042
|
+
|
|
18043
|
+
if (_this7.config.keepSingleActiveSource) {
|
|
18044
|
+
_this7.sources.forEach(function (s) {
|
|
18045
|
+
if (s.type !== sourceType) {
|
|
18046
|
+
s.deactivate();
|
|
18047
|
+
}
|
|
18048
|
+
});
|
|
18049
|
+
}
|
|
18050
|
+
|
|
18051
|
+
source.activate();
|
|
18052
|
+
|
|
18053
|
+
_this7.state.partialNext({
|
|
18054
|
+
sources: _toConsumableArray(_this7.sources)
|
|
18055
|
+
});
|
|
18056
|
+
});
|
|
18057
|
+
|
|
18058
|
+
_defineProperty(this, "deactivateSource", function (sourceType) {
|
|
18059
|
+
var source = _this7.getSource(sourceType);
|
|
18060
|
+
|
|
18061
|
+
if (!(source !== null && source !== void 0 && source.isActive)) return;
|
|
18062
|
+
if (_this7.activeSources.length === 1) return;
|
|
18063
|
+
source.deactivate();
|
|
18064
|
+
|
|
18065
|
+
_this7.state.partialNext({
|
|
18066
|
+
sources: _toConsumableArray(_this7.sources)
|
|
18067
|
+
});
|
|
18068
|
+
});
|
|
18069
|
+
|
|
18070
|
+
_defineProperty(this, "activate", function () {
|
|
18071
|
+
if (!_this7.activeSources.length) {
|
|
18072
|
+
var sourcesToActivate = _this7.config.keepSingleActiveSource ? _this7.sources.slice(0, 1) : _this7.sources;
|
|
18073
|
+
sourcesToActivate.forEach(function (s) {
|
|
18074
|
+
return s.activate();
|
|
18075
|
+
});
|
|
18076
|
+
}
|
|
18077
|
+
|
|
18078
|
+
if (_this7.isActive) return;
|
|
18079
|
+
|
|
18080
|
+
_this7.state.partialNext({
|
|
18081
|
+
isActive: true
|
|
18082
|
+
});
|
|
18083
|
+
});
|
|
18084
|
+
|
|
18085
|
+
_defineProperty(this, "search", /*#__PURE__*/function () {
|
|
18086
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(searchQuery) {
|
|
18087
|
+
var searchedSources;
|
|
18088
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
18089
|
+
while (1) {
|
|
18090
|
+
switch (_context5.prev = _context5.next) {
|
|
18091
|
+
case 0:
|
|
18092
|
+
searchedSources = _this7.activeSources;
|
|
18093
|
+
|
|
18094
|
+
_this7.state.partialNext({
|
|
18095
|
+
searchQuery: searchQuery
|
|
18096
|
+
});
|
|
18097
|
+
|
|
18098
|
+
_context5.next = 4;
|
|
18099
|
+
return Promise.all(searchedSources.map(function (source) {
|
|
18100
|
+
return source.search(searchQuery);
|
|
18101
|
+
}));
|
|
18102
|
+
|
|
18103
|
+
case 4:
|
|
18104
|
+
case "end":
|
|
18105
|
+
return _context5.stop();
|
|
18106
|
+
}
|
|
18107
|
+
}
|
|
18108
|
+
}, _callee5);
|
|
18109
|
+
}));
|
|
18110
|
+
|
|
18111
|
+
return function (_x5) {
|
|
18112
|
+
return _ref5.apply(this, arguments);
|
|
18113
|
+
};
|
|
18114
|
+
}());
|
|
18115
|
+
|
|
18116
|
+
_defineProperty(this, "cancelSearchQueries", function () {
|
|
18117
|
+
_this7.activeSources.forEach(function (s) {
|
|
18118
|
+
return s.searchDebounced.cancel();
|
|
18119
|
+
});
|
|
18120
|
+
});
|
|
18121
|
+
|
|
18122
|
+
_defineProperty(this, "clear", function () {
|
|
18123
|
+
_this7.cancelSearchQueries();
|
|
18124
|
+
|
|
18125
|
+
_this7.sources.forEach(function (source) {
|
|
18126
|
+
return source.state.next(_objectSpread(_objectSpread({}, source.initialState), {}, {
|
|
18127
|
+
isActive: source.isActive
|
|
18128
|
+
}));
|
|
18129
|
+
});
|
|
18130
|
+
|
|
18131
|
+
_this7.state.next(function (current) {
|
|
18132
|
+
return _objectSpread(_objectSpread({}, current), {}, {
|
|
18133
|
+
isActive: true,
|
|
18134
|
+
queriesInProgress: [],
|
|
18135
|
+
searchQuery: ''
|
|
18136
|
+
});
|
|
18137
|
+
});
|
|
18138
|
+
});
|
|
18139
|
+
|
|
18140
|
+
_defineProperty(this, "exit", function () {
|
|
18141
|
+
_this7.cancelSearchQueries();
|
|
18142
|
+
|
|
18143
|
+
_this7.sources.forEach(function (source) {
|
|
18144
|
+
return source.state.next(_objectSpread(_objectSpread({}, source.initialState), {}, {
|
|
18145
|
+
isActive: source.isActive
|
|
18146
|
+
}));
|
|
18147
|
+
});
|
|
18148
|
+
|
|
18149
|
+
_this7.state.next(function (current) {
|
|
18150
|
+
return _objectSpread(_objectSpread({}, current), {}, {
|
|
18151
|
+
isActive: false,
|
|
18152
|
+
queriesInProgress: [],
|
|
18153
|
+
searchQuery: ''
|
|
18154
|
+
});
|
|
18155
|
+
});
|
|
18156
|
+
});
|
|
18157
|
+
|
|
18158
|
+
this.state = new StateStore({
|
|
18159
|
+
isActive: false,
|
|
18160
|
+
searchQuery: '',
|
|
18161
|
+
sources: sources !== null && sources !== void 0 ? sources : []
|
|
18162
|
+
});
|
|
18163
|
+
this._internalState = new StateStore({});
|
|
18164
|
+
this.config = _objectSpread({
|
|
18165
|
+
keepSingleActiveSource: true
|
|
18166
|
+
}, config);
|
|
18167
|
+
}
|
|
18168
|
+
|
|
18169
|
+
_createClass(SearchController, [{
|
|
18170
|
+
key: "hasNext",
|
|
18171
|
+
get: function get() {
|
|
18172
|
+
return this.sources.some(function (source) {
|
|
18173
|
+
return source.hasNext;
|
|
18174
|
+
});
|
|
18175
|
+
}
|
|
18176
|
+
}, {
|
|
18177
|
+
key: "sources",
|
|
18178
|
+
get: function get() {
|
|
18179
|
+
return this.state.getLatestValue().sources;
|
|
18180
|
+
}
|
|
18181
|
+
}, {
|
|
18182
|
+
key: "activeSources",
|
|
18183
|
+
get: function get() {
|
|
18184
|
+
return this.state.getLatestValue().sources.filter(function (s) {
|
|
18185
|
+
return s.isActive;
|
|
18186
|
+
});
|
|
18187
|
+
}
|
|
18188
|
+
}, {
|
|
18189
|
+
key: "isActive",
|
|
18190
|
+
get: function get() {
|
|
18191
|
+
return this.state.getLatestValue().isActive;
|
|
18192
|
+
}
|
|
18193
|
+
}, {
|
|
18194
|
+
key: "searchQuery",
|
|
18195
|
+
get: function get() {
|
|
18196
|
+
return this.state.getLatestValue().searchQuery;
|
|
18197
|
+
}
|
|
18198
|
+
}, {
|
|
18199
|
+
key: "searchSourceTypes",
|
|
18200
|
+
get: function get() {
|
|
18201
|
+
return this.sources.map(function (s) {
|
|
18202
|
+
return s.type;
|
|
18203
|
+
});
|
|
18204
|
+
}
|
|
18205
|
+
}]);
|
|
18206
|
+
|
|
18207
|
+
return SearchController;
|
|
18208
|
+
}();
|
|
18209
|
+
|
|
18210
|
+
export { Allow, AllowAll, AnyResource, AnyRole, BaseSearchSource, BuiltinPermissions, BuiltinRoles, Campaign, Channel, ChannelSearchSource, ChannelState, CheckSignature, ClientState, Deny, DenyAll, DevToken, EVENT_MAP, ErrorFromResponse, InsightMetrics, JWTServerToken, JWTUserToken, MODERATION_ENTITY_TYPES, MaxPriority, MessageSearchSource, MinPriority, Moderation, Permission, Poll, PollManager, SearchController, Segment, StableWSConnection, StateStore, StreamChat, THREAD_MANAGER_INITIAL_STATE, Thread, ThreadManager, TokenManager, UserFromToken, UserSearchSource, VotingVisibility, buildWsFatalInsight, buildWsSuccessAfterFailureInsight, chatCodes, decodeBase64, encodeBase64, extractPollData, extractPollEnrichedData, formatMessage, isOwnUser, isVoteAnswer, logChatPromiseExecution, postInsights };
|
|
17394
18211
|
//# sourceMappingURL=index.es.js.map
|