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/browser.es.js
CHANGED
|
@@ -299,9 +299,9 @@ var Campaign = /*#__PURE__*/function () {
|
|
|
299
299
|
|
|
300
300
|
var https = null;
|
|
301
301
|
|
|
302
|
-
function ownKeys$
|
|
302
|
+
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; }
|
|
303
303
|
|
|
304
|
-
function _objectSpread$
|
|
304
|
+
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; }
|
|
305
305
|
|
|
306
306
|
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; } } }; }
|
|
307
307
|
|
|
@@ -563,7 +563,7 @@ var axiosParamsSerializer = function axiosParamsSerializer(params) {
|
|
|
563
563
|
*/
|
|
564
564
|
|
|
565
565
|
function formatMessage(message) {
|
|
566
|
-
return _objectSpread$
|
|
566
|
+
return _objectSpread$d(_objectSpread$d({}, message), {}, {
|
|
567
567
|
/**
|
|
568
568
|
* @deprecated please use `html`
|
|
569
569
|
*/
|
|
@@ -706,25 +706,86 @@ function maybeGetReactionGroupsFallback(groups, counts, scores) {
|
|
|
706
706
|
}
|
|
707
707
|
|
|
708
708
|
return null;
|
|
709
|
-
} //
|
|
709
|
+
} // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
710
710
|
|
|
711
711
|
|
|
712
|
-
|
|
713
|
-
|
|
712
|
+
// works exactly the same as lodash.debounce
|
|
713
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
714
|
+
var debounce = function debounce(fn) {
|
|
715
|
+
var timeout = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
714
716
|
|
|
715
717
|
var _ref2 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
716
718
|
_ref2$leading = _ref2.leading,
|
|
717
|
-
leading = _ref2$leading === void 0 ?
|
|
719
|
+
leading = _ref2$leading === void 0 ? false : _ref2$leading,
|
|
718
720
|
_ref2$trailing = _ref2.trailing,
|
|
719
|
-
trailing = _ref2$trailing === void 0 ?
|
|
721
|
+
trailing = _ref2$trailing === void 0 ? true : _ref2$trailing;
|
|
720
722
|
|
|
721
723
|
var runningTimeout = null;
|
|
722
|
-
var
|
|
723
|
-
|
|
724
|
+
var argsForTrailingExecution = null;
|
|
725
|
+
var lastResult;
|
|
726
|
+
|
|
727
|
+
var debouncedFn = function debouncedFn() {
|
|
724
728
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
725
729
|
args[_key] = arguments[_key];
|
|
726
730
|
}
|
|
727
731
|
|
|
732
|
+
if (runningTimeout) {
|
|
733
|
+
clearTimeout(runningTimeout);
|
|
734
|
+
} else if (leading) {
|
|
735
|
+
lastResult = fn.apply(void 0, args);
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
if (trailing) argsForTrailingExecution = args;
|
|
739
|
+
|
|
740
|
+
var timeoutHandler = function timeoutHandler() {
|
|
741
|
+
if (argsForTrailingExecution) {
|
|
742
|
+
lastResult = fn.apply(void 0, _toConsumableArray(argsForTrailingExecution));
|
|
743
|
+
argsForTrailingExecution = null;
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
runningTimeout = null;
|
|
747
|
+
};
|
|
748
|
+
|
|
749
|
+
runningTimeout = setTimeout(timeoutHandler, timeout);
|
|
750
|
+
return lastResult;
|
|
751
|
+
};
|
|
752
|
+
|
|
753
|
+
debouncedFn.cancel = function () {
|
|
754
|
+
if (runningTimeout) clearTimeout(runningTimeout);
|
|
755
|
+
};
|
|
756
|
+
|
|
757
|
+
debouncedFn.flush = function () {
|
|
758
|
+
if (runningTimeout) {
|
|
759
|
+
clearTimeout(runningTimeout);
|
|
760
|
+
runningTimeout = null;
|
|
761
|
+
|
|
762
|
+
if (argsForTrailingExecution) {
|
|
763
|
+
lastResult = fn.apply(void 0, _toConsumableArray(argsForTrailingExecution));
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
return lastResult;
|
|
768
|
+
};
|
|
769
|
+
|
|
770
|
+
return debouncedFn;
|
|
771
|
+
}; // works exactly the same as lodash.throttle
|
|
772
|
+
|
|
773
|
+
var throttle = function throttle(fn) {
|
|
774
|
+
var timeout = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 200;
|
|
775
|
+
|
|
776
|
+
var _ref3 = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
|
|
777
|
+
_ref3$leading = _ref3.leading,
|
|
778
|
+
leading = _ref3$leading === void 0 ? true : _ref3$leading,
|
|
779
|
+
_ref3$trailing = _ref3.trailing,
|
|
780
|
+
trailing = _ref3$trailing === void 0 ? false : _ref3$trailing;
|
|
781
|
+
|
|
782
|
+
var runningTimeout = null;
|
|
783
|
+
var storedArgs = null;
|
|
784
|
+
return function () {
|
|
785
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
786
|
+
args[_key2] = arguments[_key2];
|
|
787
|
+
}
|
|
788
|
+
|
|
728
789
|
if (runningTimeout) {
|
|
729
790
|
if (trailing) storedArgs = args;
|
|
730
791
|
return;
|
|
@@ -773,13 +834,13 @@ function binarySearchByDateEqualOrNearestGreater(array, targetDate) {
|
|
|
773
834
|
return left;
|
|
774
835
|
}
|
|
775
836
|
|
|
776
|
-
var messagePaginationCreatedAtAround = function messagePaginationCreatedAtAround(
|
|
777
|
-
var parentSet =
|
|
778
|
-
requestedPageSize =
|
|
779
|
-
returnedPage =
|
|
780
|
-
messagePaginationOptions =
|
|
837
|
+
var messagePaginationCreatedAtAround = function messagePaginationCreatedAtAround(_ref4) {
|
|
838
|
+
var parentSet = _ref4.parentSet,
|
|
839
|
+
requestedPageSize = _ref4.requestedPageSize,
|
|
840
|
+
returnedPage = _ref4.returnedPage,
|
|
841
|
+
messagePaginationOptions = _ref4.messagePaginationOptions;
|
|
781
842
|
|
|
782
|
-
var newPagination = _objectSpread$
|
|
843
|
+
var newPagination = _objectSpread$d({}, parentSet.pagination);
|
|
783
844
|
|
|
784
845
|
if (!(messagePaginationOptions !== null && messagePaginationOptions !== void 0 && messagePaginationOptions.created_at_around)) return newPagination;
|
|
785
846
|
var hasPrev;
|
|
@@ -787,9 +848,9 @@ var messagePaginationCreatedAtAround = function messagePaginationCreatedAtAround
|
|
|
787
848
|
var updateHasPrev;
|
|
788
849
|
var updateHasNext;
|
|
789
850
|
var createdAtAroundDate = new Date(messagePaginationOptions.created_at_around);
|
|
790
|
-
var
|
|
791
|
-
firstPageMsg =
|
|
792
|
-
lastPageMsg =
|
|
851
|
+
var _ref5 = [returnedPage[0], returnedPage.slice(-1)[0]],
|
|
852
|
+
firstPageMsg = _ref5[0],
|
|
853
|
+
lastPageMsg = _ref5[1]; // expect ASC order (from oldest to newest)
|
|
793
854
|
|
|
794
855
|
var wholePageHasNewerMessages = !!(firstPageMsg !== null && firstPageMsg !== void 0 && firstPageMsg.created_at) && new Date(firstPageMsg.created_at) > createdAtAroundDate;
|
|
795
856
|
var wholePageHasOlderMessages = !!(lastPageMsg !== null && lastPageMsg !== void 0 && lastPageMsg.created_at) && new Date(lastPageMsg.created_at) < createdAtAroundDate;
|
|
@@ -836,25 +897,25 @@ var messagePaginationCreatedAtAround = function messagePaginationCreatedAtAround
|
|
|
836
897
|
return newPagination;
|
|
837
898
|
};
|
|
838
899
|
|
|
839
|
-
var messagePaginationIdAround = function messagePaginationIdAround(
|
|
900
|
+
var messagePaginationIdAround = function messagePaginationIdAround(_ref6) {
|
|
840
901
|
var _parentSet$messages$2, _parentSet$messages$s2;
|
|
841
902
|
|
|
842
|
-
var parentSet =
|
|
843
|
-
requestedPageSize =
|
|
844
|
-
returnedPage =
|
|
845
|
-
messagePaginationOptions =
|
|
903
|
+
var parentSet = _ref6.parentSet,
|
|
904
|
+
requestedPageSize = _ref6.requestedPageSize,
|
|
905
|
+
returnedPage = _ref6.returnedPage,
|
|
906
|
+
messagePaginationOptions = _ref6.messagePaginationOptions;
|
|
846
907
|
|
|
847
|
-
var newPagination = _objectSpread$
|
|
908
|
+
var newPagination = _objectSpread$d({}, parentSet.pagination);
|
|
848
909
|
|
|
849
|
-
var
|
|
850
|
-
id_around =
|
|
910
|
+
var _ref7 = messagePaginationOptions || {},
|
|
911
|
+
id_around = _ref7.id_around;
|
|
851
912
|
|
|
852
913
|
if (!id_around) return newPagination;
|
|
853
914
|
var hasPrev;
|
|
854
915
|
var hasNext;
|
|
855
|
-
var
|
|
856
|
-
firstPageMsg =
|
|
857
|
-
lastPageMsg =
|
|
916
|
+
var _ref8 = [returnedPage[0], returnedPage.slice(-1)[0]],
|
|
917
|
+
firstPageMsg = _ref8[0],
|
|
918
|
+
lastPageMsg = _ref8[1];
|
|
858
919
|
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),
|
|
859
920
|
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);
|
|
860
921
|
var updateHasPrev = firstPageMsgIsFirstInSet;
|
|
@@ -894,21 +955,21 @@ var messagePaginationIdAround = function messagePaginationIdAround(_ref5) {
|
|
|
894
955
|
return newPagination;
|
|
895
956
|
};
|
|
896
957
|
|
|
897
|
-
var messagePaginationLinear = function messagePaginationLinear(
|
|
958
|
+
var messagePaginationLinear = function messagePaginationLinear(_ref9) {
|
|
898
959
|
var _parentSet$messages$3, _parentSet$messages$s3;
|
|
899
960
|
|
|
900
|
-
var parentSet =
|
|
901
|
-
requestedPageSize =
|
|
902
|
-
returnedPage =
|
|
903
|
-
messagePaginationOptions =
|
|
961
|
+
var parentSet = _ref9.parentSet,
|
|
962
|
+
requestedPageSize = _ref9.requestedPageSize,
|
|
963
|
+
returnedPage = _ref9.returnedPage,
|
|
964
|
+
messagePaginationOptions = _ref9.messagePaginationOptions;
|
|
904
965
|
|
|
905
|
-
var newPagination = _objectSpread$
|
|
966
|
+
var newPagination = _objectSpread$d({}, parentSet.pagination);
|
|
906
967
|
|
|
907
968
|
var hasPrev;
|
|
908
969
|
var hasNext;
|
|
909
|
-
var
|
|
910
|
-
firstPageMsg =
|
|
911
|
-
lastPageMsg =
|
|
970
|
+
var _ref10 = [returnedPage[0], returnedPage.slice(-1)[0]],
|
|
971
|
+
firstPageMsg = _ref10[0],
|
|
972
|
+
lastPageMsg = _ref10[1];
|
|
912
973
|
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),
|
|
913
974
|
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);
|
|
914
975
|
var queriedNextMessages = messagePaginationOptions && (messagePaginationOptions.created_at_after_or_equal || messagePaginationOptions.created_at_after || messagePaginationOptions.id_gt || messagePaginationOptions.id_gte);
|
|
@@ -956,9 +1017,9 @@ var DEFAULT_MESSAGE_SET_PAGINATION = {
|
|
|
956
1017
|
hasPrev: false
|
|
957
1018
|
};
|
|
958
1019
|
|
|
959
|
-
function ownKeys$
|
|
1020
|
+
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; }
|
|
960
1021
|
|
|
961
|
-
function _objectSpread$
|
|
1022
|
+
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; }
|
|
962
1023
|
|
|
963
1024
|
/**
|
|
964
1025
|
* ChannelState - A container class for the channel state.
|
|
@@ -1039,7 +1100,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
1039
1100
|
var m = messages[i];
|
|
1040
1101
|
|
|
1041
1102
|
if (((_m$user = m.user) === null || _m$user === void 0 ? void 0 : _m$user.id) === user.id) {
|
|
1042
|
-
messages[i] = _objectSpread$
|
|
1103
|
+
messages[i] = _objectSpread$c(_objectSpread$c({}, m), {}, {
|
|
1043
1104
|
user: user
|
|
1044
1105
|
});
|
|
1045
1106
|
}
|
|
@@ -1094,7 +1155,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
1094
1155
|
user: m.user
|
|
1095
1156
|
};
|
|
1096
1157
|
} else {
|
|
1097
|
-
messages[i] = _objectSpread$
|
|
1158
|
+
messages[i] = _objectSpread$c(_objectSpread$c({}, m), {}, {
|
|
1098
1159
|
type: 'deleted',
|
|
1099
1160
|
deleted_at: user.deleted_at ? new Date(user.deleted_at) : null
|
|
1100
1161
|
});
|
|
@@ -1412,7 +1473,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
1412
1473
|
var parseMessage = function parseMessage(m) {
|
|
1413
1474
|
var _m$pinned_at, _m$updated_at;
|
|
1414
1475
|
|
|
1415
|
-
return _objectSpread$
|
|
1476
|
+
return _objectSpread$c(_objectSpread$c({}, m), {}, {
|
|
1416
1477
|
created_at: m.created_at.toISOString(),
|
|
1417
1478
|
pinned_at: (_m$pinned_at = m.pinned_at) === null || _m$pinned_at === void 0 ? void 0 : _m$pinned_at.toISOString(),
|
|
1418
1479
|
updated_at: (_m$updated_at = m.updated_at) === null || _m$updated_at === void 0 ? void 0 : _m$updated_at.toISOString()
|
|
@@ -1422,8 +1483,8 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
1422
1483
|
var update = function update(messages) {
|
|
1423
1484
|
var updatedMessages = messages.reduce(function (acc, msg) {
|
|
1424
1485
|
if (msg.quoted_message_id === message.id) {
|
|
1425
|
-
acc.push(_objectSpread$
|
|
1426
|
-
quoted_message: remove ? _objectSpread$
|
|
1486
|
+
acc.push(_objectSpread$c(_objectSpread$c({}, parseMessage(msg)), {}, {
|
|
1487
|
+
quoted_message: remove ? _objectSpread$c(_objectSpread$c({}, message), {}, {
|
|
1427
1488
|
attachments: []
|
|
1428
1489
|
}) : message
|
|
1429
1490
|
}));
|
|
@@ -1912,9 +1973,9 @@ function _unsupportedIterableToArray$4(o, minLen) { if (!o) return; if (typeof o
|
|
|
1912
1973
|
|
|
1913
1974
|
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; }
|
|
1914
1975
|
|
|
1915
|
-
function ownKeys$
|
|
1976
|
+
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; }
|
|
1916
1977
|
|
|
1917
|
-
function _objectSpread$
|
|
1978
|
+
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; }
|
|
1918
1979
|
/**
|
|
1919
1980
|
* Channel - The Channel class manages it's own state.
|
|
1920
1981
|
*/
|
|
@@ -1989,7 +2050,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1989
2050
|
while (1) {
|
|
1990
2051
|
switch (_context.prev = _context.next) {
|
|
1991
2052
|
case 0:
|
|
1992
|
-
defaultOptions = _objectSpread$
|
|
2053
|
+
defaultOptions = _objectSpread$b(_objectSpread$b({}, options), {}, {
|
|
1993
2054
|
watch: false,
|
|
1994
2055
|
state: false,
|
|
1995
2056
|
presence: false
|
|
@@ -2061,7 +2122,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2061
2122
|
|
|
2062
2123
|
this.data = data; // this._data is used for the requests...
|
|
2063
2124
|
|
|
2064
|
-
this._data = _objectSpread$
|
|
2125
|
+
this._data = _objectSpread$b({}, data);
|
|
2065
2126
|
this.cid = "".concat(type, ":").concat(id);
|
|
2066
2127
|
this.listeners = {}; // perhaps the state variable should be private
|
|
2067
2128
|
|
|
@@ -2123,7 +2184,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2123
2184
|
switch (_context2.prev = _context2.next) {
|
|
2124
2185
|
case 0:
|
|
2125
2186
|
_context2.next = 2;
|
|
2126
|
-
return this.getClient().post(this._channelURL() + '/message', _objectSpread$
|
|
2187
|
+
return this.getClient().post(this._channelURL() + '/message', _objectSpread$b({
|
|
2127
2188
|
message: message
|
|
2128
2189
|
}, options));
|
|
2129
2190
|
|
|
@@ -2239,7 +2300,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2239
2300
|
|
|
2240
2301
|
case 3:
|
|
2241
2302
|
// Return a list of channels
|
|
2242
|
-
payload = _objectSpread$
|
|
2303
|
+
payload = _objectSpread$b(_objectSpread$b({
|
|
2243
2304
|
filter_conditions: {
|
|
2244
2305
|
cid: this.cid
|
|
2245
2306
|
}
|
|
@@ -2336,7 +2397,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2336
2397
|
|
|
2337
2398
|
_context5.next = 6;
|
|
2338
2399
|
return this.getClient().get(this.getClient().baseURL + '/members', {
|
|
2339
|
-
payload: _objectSpread$
|
|
2400
|
+
payload: _objectSpread$b({
|
|
2340
2401
|
type: type,
|
|
2341
2402
|
id: id,
|
|
2342
2403
|
members: members,
|
|
@@ -2442,7 +2503,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2442
2503
|
|
|
2443
2504
|
case 4:
|
|
2444
2505
|
_context7.next = 6;
|
|
2445
|
-
return this.getClient().post(this.getClient().baseURL + "/messages/".concat(encodeURIComponent(messageID), "/reaction"), _objectSpread$
|
|
2506
|
+
return this.getClient().post(this.getClient().baseURL + "/messages/".concat(encodeURIComponent(messageID), "/reaction"), _objectSpread$b({
|
|
2446
2507
|
reaction: reaction
|
|
2447
2508
|
}, options));
|
|
2448
2509
|
|
|
@@ -2523,7 +2584,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2523
2584
|
delete channelData[key];
|
|
2524
2585
|
});
|
|
2525
2586
|
_context8.next = 7;
|
|
2526
|
-
return this._update(_objectSpread$
|
|
2587
|
+
return this._update(_objectSpread$b({
|
|
2527
2588
|
message: updateMessage,
|
|
2528
2589
|
data: channelData
|
|
2529
2590
|
}, options));
|
|
@@ -2695,7 +2756,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2695
2756
|
case 0:
|
|
2696
2757
|
options = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : {};
|
|
2697
2758
|
_context12.next = 3;
|
|
2698
|
-
return this.getClient().delete(this._channelURL(), _objectSpread$
|
|
2759
|
+
return this.getClient().delete(this._channelURL(), _objectSpread$b({}, options));
|
|
2699
2760
|
|
|
2700
2761
|
case 3:
|
|
2701
2762
|
return _context12.abrupt("return", _context12.sent);
|
|
@@ -2771,7 +2832,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2771
2832
|
case 0:
|
|
2772
2833
|
options = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {};
|
|
2773
2834
|
_context14.next = 3;
|
|
2774
|
-
return this._update(_objectSpread$
|
|
2835
|
+
return this._update(_objectSpread$b({
|
|
2775
2836
|
accept_invite: true
|
|
2776
2837
|
}, options));
|
|
2777
2838
|
|
|
@@ -2812,7 +2873,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2812
2873
|
case 0:
|
|
2813
2874
|
options = _args15.length > 0 && _args15[0] !== undefined ? _args15[0] : {};
|
|
2814
2875
|
_context15.next = 3;
|
|
2815
|
-
return this._update(_objectSpread$
|
|
2876
|
+
return this._update(_objectSpread$b({
|
|
2816
2877
|
reject_invite: true
|
|
2817
2878
|
}, options));
|
|
2818
2879
|
|
|
@@ -2854,7 +2915,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2854
2915
|
case 0:
|
|
2855
2916
|
options = _args16.length > 2 && _args16[2] !== undefined ? _args16[2] : {};
|
|
2856
2917
|
_context16.next = 3;
|
|
2857
|
-
return this._update(_objectSpread$
|
|
2918
|
+
return this._update(_objectSpread$b({
|
|
2858
2919
|
add_members: members,
|
|
2859
2920
|
message: message
|
|
2860
2921
|
}, options));
|
|
@@ -2897,7 +2958,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2897
2958
|
case 0:
|
|
2898
2959
|
options = _args17.length > 2 && _args17[2] !== undefined ? _args17[2] : {};
|
|
2899
2960
|
_context17.next = 3;
|
|
2900
|
-
return this._update(_objectSpread$
|
|
2961
|
+
return this._update(_objectSpread$b({
|
|
2901
2962
|
add_moderators: members,
|
|
2902
2963
|
message: message
|
|
2903
2964
|
}, options));
|
|
@@ -2940,7 +3001,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2940
3001
|
case 0:
|
|
2941
3002
|
options = _args18.length > 2 && _args18[2] !== undefined ? _args18[2] : {};
|
|
2942
3003
|
_context18.next = 3;
|
|
2943
|
-
return this._update(_objectSpread$
|
|
3004
|
+
return this._update(_objectSpread$b({
|
|
2944
3005
|
assign_roles: roles,
|
|
2945
3006
|
message: message
|
|
2946
3007
|
}, options));
|
|
@@ -2983,7 +3044,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2983
3044
|
case 0:
|
|
2984
3045
|
options = _args19.length > 2 && _args19[2] !== undefined ? _args19[2] : {};
|
|
2985
3046
|
_context19.next = 3;
|
|
2986
|
-
return this._update(_objectSpread$
|
|
3047
|
+
return this._update(_objectSpread$b({
|
|
2987
3048
|
invites: members,
|
|
2988
3049
|
message: message
|
|
2989
3050
|
}, options));
|
|
@@ -3026,7 +3087,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3026
3087
|
case 0:
|
|
3027
3088
|
options = _args20.length > 2 && _args20[2] !== undefined ? _args20[2] : {};
|
|
3028
3089
|
_context20.next = 3;
|
|
3029
|
-
return this._update(_objectSpread$
|
|
3090
|
+
return this._update(_objectSpread$b({
|
|
3030
3091
|
remove_members: members,
|
|
3031
3092
|
message: message
|
|
3032
3093
|
}, options));
|
|
@@ -3069,7 +3130,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3069
3130
|
case 0:
|
|
3070
3131
|
options = _args21.length > 2 && _args21[2] !== undefined ? _args21[2] : {};
|
|
3071
3132
|
_context21.next = 3;
|
|
3072
|
-
return this._update(_objectSpread$
|
|
3133
|
+
return this._update(_objectSpread$b({
|
|
3073
3134
|
demote_moderators: members,
|
|
3074
3135
|
message: message
|
|
3075
3136
|
}, options));
|
|
@@ -3154,7 +3215,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3154
3215
|
case 0:
|
|
3155
3216
|
opts = _args23.length > 0 && _args23[0] !== undefined ? _args23[0] : {};
|
|
3156
3217
|
_context23.next = 3;
|
|
3157
|
-
return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$
|
|
3218
|
+
return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$b({
|
|
3158
3219
|
channel_cid: this.cid
|
|
3159
3220
|
}, opts));
|
|
3160
3221
|
|
|
@@ -3196,7 +3257,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3196
3257
|
case 0:
|
|
3197
3258
|
opts = _args24.length > 0 && _args24[0] !== undefined ? _args24[0] : {};
|
|
3198
3259
|
_context24.next = 3;
|
|
3199
|
-
return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$
|
|
3260
|
+
return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$b({
|
|
3200
3261
|
channel_cid: this.cid
|
|
3201
3262
|
}, opts));
|
|
3202
3263
|
|
|
@@ -3533,7 +3594,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3533
3594
|
|
|
3534
3595
|
this.lastTypingEvent = new Date();
|
|
3535
3596
|
_context29.next = 10;
|
|
3536
|
-
return this.sendEvent(_objectSpread$
|
|
3597
|
+
return this.sendEvent(_objectSpread$b({
|
|
3537
3598
|
type: 'typing.start',
|
|
3538
3599
|
parent_id: parent_id
|
|
3539
3600
|
}, options || {}));
|
|
@@ -3573,7 +3634,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3573
3634
|
case 0:
|
|
3574
3635
|
options = _args30.length > 2 && _args30[2] !== undefined ? _args30[2] : {};
|
|
3575
3636
|
_context30.next = 3;
|
|
3576
|
-
return this.sendEvent(_objectSpread$
|
|
3637
|
+
return this.sendEvent(_objectSpread$b(_objectSpread$b({}, options), {}, {
|
|
3577
3638
|
type: 'ai_indicator.update',
|
|
3578
3639
|
message_id: messageId,
|
|
3579
3640
|
ai_state: state
|
|
@@ -3682,7 +3743,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3682
3743
|
this.lastTypingEvent = null;
|
|
3683
3744
|
this.isTyping = false;
|
|
3684
3745
|
_context33.next = 6;
|
|
3685
|
-
return this.sendEvent(_objectSpread$
|
|
3746
|
+
return this.sendEvent(_objectSpread$b({
|
|
3686
3747
|
type: 'typing.stop',
|
|
3687
3748
|
parent_id: parent_id
|
|
3688
3749
|
}, options || {}));
|
|
@@ -3769,7 +3830,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3769
3830
|
|
|
3770
3831
|
case 4:
|
|
3771
3832
|
_context34.next = 6;
|
|
3772
|
-
return this.getClient().post(this._channelURL() + '/read', _objectSpread$
|
|
3833
|
+
return this.getClient().post(this._channelURL() + '/read', _objectSpread$b({}, data));
|
|
3773
3834
|
|
|
3774
3835
|
case 6:
|
|
3775
3836
|
return _context34.abrupt("return", _context34.sent);
|
|
@@ -3816,7 +3877,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3816
3877
|
|
|
3817
3878
|
case 3:
|
|
3818
3879
|
_context35.next = 5;
|
|
3819
|
-
return this.getClient().post(this._channelURL() + '/unread', _objectSpread$
|
|
3880
|
+
return this.getClient().post(this._channelURL() + '/unread', _objectSpread$b({}, data));
|
|
3820
3881
|
|
|
3821
3882
|
case 5:
|
|
3822
3883
|
return _context35.abrupt("return", _context35.sent);
|
|
@@ -3884,7 +3945,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3884
3945
|
defaultOptions.watch = false;
|
|
3885
3946
|
}
|
|
3886
3947
|
|
|
3887
|
-
combined = _objectSpread$
|
|
3948
|
+
combined = _objectSpread$b(_objectSpread$b({}, defaultOptions), options);
|
|
3888
3949
|
_context36.next = 7;
|
|
3889
3950
|
return this.query(combined, 'latest');
|
|
3890
3951
|
|
|
@@ -3978,7 +4039,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3978
4039
|
case 0:
|
|
3979
4040
|
normalizedSort = sort ? normalizeQuerySort(sort) : undefined;
|
|
3980
4041
|
_context38.next = 3;
|
|
3981
|
-
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(encodeURIComponent(parent_id), "/replies"), _objectSpread$
|
|
4042
|
+
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(encodeURIComponent(parent_id), "/replies"), _objectSpread$b({
|
|
3982
4043
|
sort: normalizedSort
|
|
3983
4044
|
}, options));
|
|
3984
4045
|
|
|
@@ -4028,7 +4089,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4028
4089
|
sort = _args39.length > 1 && _args39[1] !== undefined ? _args39[1] : [];
|
|
4029
4090
|
_context39.next = 3;
|
|
4030
4091
|
return this.getClient().get(this._channelURL() + '/pinned_messages', {
|
|
4031
|
-
payload: _objectSpread$
|
|
4092
|
+
payload: _objectSpread$b(_objectSpread$b({}, options), {}, {
|
|
4032
4093
|
sort: normalizeQuerySort(sort)
|
|
4033
4094
|
})
|
|
4034
4095
|
});
|
|
@@ -4062,7 +4123,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4062
4123
|
}, {
|
|
4063
4124
|
key: "getReactions",
|
|
4064
4125
|
value: function getReactions(message_id, options) {
|
|
4065
|
-
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(encodeURIComponent(message_id), "/reactions"), _objectSpread$
|
|
4126
|
+
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(encodeURIComponent(message_id), "/reactions"), _objectSpread$b({}, options));
|
|
4066
4127
|
}
|
|
4067
4128
|
/**
|
|
4068
4129
|
* getMessagesById - Retrieves a list of messages by ID
|
|
@@ -4209,7 +4270,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4209
4270
|
}
|
|
4210
4271
|
|
|
4211
4272
|
_context40.next = 7;
|
|
4212
|
-
return this.getClient().post(queryURL + '/query', _objectSpread$
|
|
4273
|
+
return this.getClient().post(queryURL + '/query', _objectSpread$b({
|
|
4213
4274
|
data: this._data,
|
|
4214
4275
|
state: true
|
|
4215
4276
|
}, options));
|
|
@@ -4244,14 +4305,14 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4244
4305
|
|
|
4245
4306
|
|
|
4246
4307
|
_this$_initializeStat = this._initializeState(state, messageSetToAddToIfDoesNotExist), messageSet = _this$_initializeStat.messageSet;
|
|
4247
|
-
messageSet.pagination = _objectSpread$
|
|
4308
|
+
messageSet.pagination = _objectSpread$b(_objectSpread$b({}, messageSet.pagination), messageSetPagination({
|
|
4248
4309
|
parentSet: messageSet,
|
|
4249
4310
|
messagePaginationOptions: options === null || options === void 0 ? void 0 : options.messages,
|
|
4250
4311
|
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,
|
|
4251
4312
|
returnedPage: state.messages,
|
|
4252
4313
|
logger: this.getClient().logger
|
|
4253
4314
|
}));
|
|
4254
|
-
this.getClient().polls.hydratePollCache(
|
|
4315
|
+
this.getClient().polls.hydratePollCache(state.messages, true);
|
|
4255
4316
|
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();
|
|
4256
4317
|
this.data = state.channel;
|
|
4257
4318
|
this.offlineMode = false;
|
|
@@ -4306,7 +4367,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4306
4367
|
this._checkInitialized();
|
|
4307
4368
|
|
|
4308
4369
|
_context41.next = 3;
|
|
4309
|
-
return this.getClient().banUser(targetUserID, _objectSpread$
|
|
4370
|
+
return this.getClient().banUser(targetUserID, _objectSpread$b(_objectSpread$b({}, options), {}, {
|
|
4310
4371
|
type: this.type,
|
|
4311
4372
|
id: this.id
|
|
4312
4373
|
}));
|
|
@@ -4478,7 +4539,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4478
4539
|
this._checkInitialized();
|
|
4479
4540
|
|
|
4480
4541
|
_context45.next = 3;
|
|
4481
|
-
return this.getClient().shadowBan(targetUserID, _objectSpread$
|
|
4542
|
+
return this.getClient().shadowBan(targetUserID, _objectSpread$b(_objectSpread$b({}, options), {}, {
|
|
4482
4543
|
type: this.type,
|
|
4483
4544
|
id: this.id
|
|
4484
4545
|
}));
|
|
@@ -4883,7 +4944,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4883
4944
|
case 'member.added':
|
|
4884
4945
|
case 'member.updated':
|
|
4885
4946
|
if ((_event$member = event.member) !== null && _event$member !== void 0 && _event$member.user) {
|
|
4886
|
-
channelState.members = _objectSpread$
|
|
4947
|
+
channelState.members = _objectSpread$b(_objectSpread$b({}, channelState.members), {}, _defineProperty({}, event.member.user.id, event.member));
|
|
4887
4948
|
}
|
|
4888
4949
|
|
|
4889
4950
|
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) {
|
|
@@ -4894,7 +4955,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4894
4955
|
|
|
4895
4956
|
case 'member.removed':
|
|
4896
4957
|
if ((_event$user9 = event.user) !== null && _event$user9 !== void 0 && _event$user9.id) {
|
|
4897
|
-
var newMembers = _objectSpread$
|
|
4958
|
+
var newMembers = _objectSpread$b({}, channelState.members);
|
|
4898
4959
|
|
|
4899
4960
|
delete newMembers[event.user.id];
|
|
4900
4961
|
channelState.members = newMembers; // TODO?: unset membership
|
|
@@ -4939,7 +5000,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4939
5000
|
});
|
|
4940
5001
|
}
|
|
4941
5002
|
|
|
4942
|
-
channel.data = _objectSpread$
|
|
5003
|
+
channel.data = _objectSpread$b(_objectSpread$b({}, event.channel), {}, {
|
|
4943
5004
|
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,
|
|
4944
5005
|
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
|
|
4945
5006
|
});
|
|
@@ -4970,7 +5031,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4970
5031
|
break;
|
|
4971
5032
|
|
|
4972
5033
|
case 'channel.hidden':
|
|
4973
|
-
channel.data = _objectSpread$
|
|
5034
|
+
channel.data = _objectSpread$b(_objectSpread$b({}, channel.data), {}, {
|
|
4974
5035
|
hidden: true
|
|
4975
5036
|
});
|
|
4976
5037
|
|
|
@@ -4981,26 +5042,26 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4981
5042
|
break;
|
|
4982
5043
|
|
|
4983
5044
|
case 'channel.visible':
|
|
4984
|
-
channel.data = _objectSpread$
|
|
5045
|
+
channel.data = _objectSpread$b(_objectSpread$b({}, channel.data), {}, {
|
|
4985
5046
|
hidden: false
|
|
4986
5047
|
});
|
|
4987
5048
|
break;
|
|
4988
5049
|
|
|
4989
5050
|
case 'user.banned':
|
|
4990
5051
|
if (!((_event$user11 = event.user) !== null && _event$user11 !== void 0 && _event$user11.id)) break;
|
|
4991
|
-
channelState.members[event.user.id] = _objectSpread$
|
|
5052
|
+
channelState.members[event.user.id] = _objectSpread$b(_objectSpread$b({}, channelState.members[event.user.id] || {}), {}, {
|
|
4992
5053
|
shadow_banned: !!event.shadow,
|
|
4993
5054
|
banned: !event.shadow,
|
|
4994
|
-
user: _objectSpread$
|
|
5055
|
+
user: _objectSpread$b(_objectSpread$b({}, ((_channelState$members2 = channelState.members[event.user.id]) === null || _channelState$members2 === void 0 ? void 0 : _channelState$members2.user) || {}), event.user)
|
|
4995
5056
|
});
|
|
4996
5057
|
break;
|
|
4997
5058
|
|
|
4998
5059
|
case 'user.unbanned':
|
|
4999
5060
|
if (!((_event$user12 = event.user) !== null && _event$user12 !== void 0 && _event$user12.id)) break;
|
|
5000
|
-
channelState.members[event.user.id] = _objectSpread$
|
|
5061
|
+
channelState.members[event.user.id] = _objectSpread$b(_objectSpread$b({}, channelState.members[event.user.id] || {}), {}, {
|
|
5001
5062
|
shadow_banned: false,
|
|
5002
5063
|
banned: false,
|
|
5003
|
-
user: _objectSpread$
|
|
5064
|
+
user: _objectSpread$b(_objectSpread$b({}, ((_channelState$members3 = channelState.members[event.user.id]) === null || _channelState$members3 === void 0 ? void 0 : _channelState$members3.user) || {}), event.user)
|
|
5004
5065
|
});
|
|
5005
5066
|
break;
|
|
5006
5067
|
} // any event can send over the online count
|
|
@@ -5174,7 +5235,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
5174
5235
|
if (overrideCurrentState) {
|
|
5175
5236
|
this.state.members = newMembersById;
|
|
5176
5237
|
} else if (!overrideCurrentState && members.length) {
|
|
5177
|
-
this.state.members = _objectSpread$
|
|
5238
|
+
this.state.members = _objectSpread$b(_objectSpread$b({}, this.state.members), newMembersById);
|
|
5178
5239
|
}
|
|
5179
5240
|
}
|
|
5180
5241
|
}, {
|
|
@@ -5273,9 +5334,9 @@ var ClientState = /*#__PURE__*/function () {
|
|
|
5273
5334
|
return ClientState;
|
|
5274
5335
|
}();
|
|
5275
5336
|
|
|
5276
|
-
function ownKeys$
|
|
5337
|
+
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; }
|
|
5277
5338
|
|
|
5278
|
-
function _objectSpread$
|
|
5339
|
+
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; }
|
|
5279
5340
|
var InsightMetrics = function InsightMetrics() {
|
|
5280
5341
|
_classCallCheck(this, InsightMetrics);
|
|
5281
5342
|
|
|
@@ -5354,7 +5415,7 @@ var postInsights = /*#__PURE__*/function () {
|
|
|
5354
5415
|
};
|
|
5355
5416
|
}();
|
|
5356
5417
|
function buildWsFatalInsight(connection, event) {
|
|
5357
|
-
return _objectSpread$
|
|
5418
|
+
return _objectSpread$a(_objectSpread$a({}, event), buildWsBaseInsight(connection));
|
|
5358
5419
|
}
|
|
5359
5420
|
|
|
5360
5421
|
function buildWsBaseInsight(connection) {
|
|
@@ -5387,9 +5448,9 @@ function buildWsSuccessAfterFailureInsight(connection) {
|
|
|
5387
5448
|
return buildWsBaseInsight(connection);
|
|
5388
5449
|
}
|
|
5389
5450
|
|
|
5390
|
-
function ownKeys$
|
|
5451
|
+
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; }
|
|
5391
5452
|
|
|
5392
|
-
function _objectSpread$
|
|
5453
|
+
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; }
|
|
5393
5454
|
|
|
5394
5455
|
// Type guards to check WebSocket error type
|
|
5395
5456
|
var isCloseEvent = function isCloseEvent(res) {
|
|
@@ -5753,7 +5814,7 @@ var StableWSConnection = /*#__PURE__*/function () {
|
|
|
5753
5814
|
value: function _log(msg) {
|
|
5754
5815
|
var extra = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
5755
5816
|
var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'info';
|
|
5756
|
-
this.client.logger(level, 'connection:' + msg, _objectSpread$
|
|
5817
|
+
this.client.logger(level, 'connection:' + msg, _objectSpread$9({
|
|
5757
5818
|
tags: ['connection']
|
|
5758
5819
|
}, extra));
|
|
5759
5820
|
}
|
|
@@ -6348,9 +6409,9 @@ var jwt = null;
|
|
|
6348
6409
|
|
|
6349
6410
|
var crypto$1 = null;
|
|
6350
6411
|
|
|
6351
|
-
function ownKeys$
|
|
6412
|
+
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; }
|
|
6352
6413
|
|
|
6353
|
-
function _objectSpread$
|
|
6414
|
+
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; }
|
|
6354
6415
|
|
|
6355
6416
|
/**
|
|
6356
6417
|
* Creates the JWT token that can be used for a UserSession
|
|
@@ -6371,7 +6432,7 @@ function JWTUserToken(apiSecret, userId) {
|
|
|
6371
6432
|
throw new TypeError('userId should be a string');
|
|
6372
6433
|
}
|
|
6373
6434
|
|
|
6374
|
-
var payload = _objectSpread$
|
|
6435
|
+
var payload = _objectSpread$8({
|
|
6375
6436
|
user_id: userId
|
|
6376
6437
|
}, extraData); // make sure we return a clear error when jwt is shimmed (ie. browser build)
|
|
6377
6438
|
|
|
@@ -6777,9 +6838,9 @@ function isErrorResponse(res) {
|
|
|
6777
6838
|
return !res.status || res.status < 200 || 300 <= res.status;
|
|
6778
6839
|
}
|
|
6779
6840
|
|
|
6780
|
-
function ownKeys$
|
|
6841
|
+
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; }
|
|
6781
6842
|
|
|
6782
|
-
function _objectSpread$
|
|
6843
|
+
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; }
|
|
6783
6844
|
var ConnectionState;
|
|
6784
6845
|
|
|
6785
6846
|
(function (ConnectionState) {
|
|
@@ -6842,7 +6903,7 @@ var WSConnectionFallback = /*#__PURE__*/function () {
|
|
|
6842
6903
|
_context.next = 4;
|
|
6843
6904
|
return _this.client.doAxiosRequest('get', _this.client.baseURL.replace(':3030', ':8900') + '/longpoll', // replace port if present for testing with local API
|
|
6844
6905
|
undefined, {
|
|
6845
|
-
config: _objectSpread$
|
|
6906
|
+
config: _objectSpread$7(_objectSpread$7({}, config), {}, {
|
|
6846
6907
|
cancelToken: (_this$cancelToken2 = _this.cancelToken) === null || _this$cancelToken2 === void 0 ? void 0 : _this$cancelToken2.token
|
|
6847
6908
|
}),
|
|
6848
6909
|
params: params
|
|
@@ -7120,7 +7181,7 @@ var WSConnectionFallback = /*#__PURE__*/function () {
|
|
|
7120
7181
|
value: function _log(msg) {
|
|
7121
7182
|
var extra = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
7122
7183
|
var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'info';
|
|
7123
|
-
this.client.logger(level, 'WSConnectionFallback:' + msg, _objectSpread$
|
|
7184
|
+
this.client.logger(level, 'WSConnectionFallback:' + msg, _objectSpread$7({
|
|
7124
7185
|
tags: ['connection_fallback', 'connection']
|
|
7125
7186
|
}, extra));
|
|
7126
7187
|
}
|
|
@@ -7399,9 +7460,9 @@ var Segment = /*#__PURE__*/function () {
|
|
|
7399
7460
|
return Segment;
|
|
7400
7461
|
}();
|
|
7401
7462
|
|
|
7402
|
-
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); }; }
|
|
7463
|
+
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); }; }
|
|
7403
7464
|
|
|
7404
|
-
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; } }
|
|
7465
|
+
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; } }
|
|
7405
7466
|
|
|
7406
7467
|
/**
|
|
7407
7468
|
* Utility Types
|
|
@@ -7466,7 +7527,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
7466
7527
|
var ErrorFromResponse = /*#__PURE__*/function (_Error) {
|
|
7467
7528
|
_inherits(ErrorFromResponse, _Error);
|
|
7468
7529
|
|
|
7469
|
-
var _super = _createSuper(ErrorFromResponse);
|
|
7530
|
+
var _super = _createSuper$1(ErrorFromResponse);
|
|
7470
7531
|
|
|
7471
7532
|
function ErrorFromResponse() {
|
|
7472
7533
|
var _this;
|
|
@@ -7497,9 +7558,9 @@ var VotingVisibility;
|
|
|
7497
7558
|
VotingVisibility["public"] = "public";
|
|
7498
7559
|
})(VotingVisibility || (VotingVisibility = {}));
|
|
7499
7560
|
|
|
7500
|
-
function ownKeys$
|
|
7561
|
+
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; }
|
|
7501
7562
|
|
|
7502
|
-
function _objectSpread$
|
|
7563
|
+
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; }
|
|
7503
7564
|
|
|
7504
7565
|
function isPatch(value) {
|
|
7505
7566
|
return typeof value === 'function';
|
|
@@ -7529,7 +7590,7 @@ var StateStore = function StateStore(value) {
|
|
|
7529
7590
|
|
|
7530
7591
|
_defineProperty(this, "partialNext", function (partial) {
|
|
7531
7592
|
return _this.next(function (current) {
|
|
7532
|
-
return _objectSpread$
|
|
7593
|
+
return _objectSpread$6(_objectSpread$6({}, current), partial);
|
|
7533
7594
|
});
|
|
7534
7595
|
});
|
|
7535
7596
|
|
|
@@ -7579,11 +7640,11 @@ var StateStore = function StateStore(value) {
|
|
|
7579
7640
|
|
|
7580
7641
|
_defineProperty(StateStore, "logCount", 5);
|
|
7581
7642
|
|
|
7582
|
-
var _excluded$
|
|
7643
|
+
var _excluded$3 = ["limit", "sort"];
|
|
7583
7644
|
|
|
7584
|
-
function ownKeys$
|
|
7645
|
+
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; }
|
|
7585
7646
|
|
|
7586
|
-
function _objectSpread$
|
|
7647
|
+
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; }
|
|
7587
7648
|
var DEFAULT_PAGE_LIMIT = 50;
|
|
7588
7649
|
var DEFAULT_SORT = [{
|
|
7589
7650
|
created_at: -1
|
|
@@ -7868,14 +7929,14 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7868
7929
|
if (userId === ((_event$user2 = event.user) === null || _event$user2 === void 0 ? void 0 : _event$user2.id)) {
|
|
7869
7930
|
// The user who just sent a message to the thread has no unread messages
|
|
7870
7931
|
// in that thread
|
|
7871
|
-
nextUserRead = _objectSpread$
|
|
7932
|
+
nextUserRead = _objectSpread$5(_objectSpread$5({}, nextUserRead), {}, {
|
|
7872
7933
|
lastReadAt: event.created_at ? new Date(event.created_at) : new Date(),
|
|
7873
7934
|
user: event.user,
|
|
7874
7935
|
unreadMessageCount: 0
|
|
7875
7936
|
});
|
|
7876
7937
|
} else if (active && userId === _this.client.userID) ; else {
|
|
7877
7938
|
// Increment unread count for all users except the author of the new message
|
|
7878
|
-
nextUserRead = _objectSpread$
|
|
7939
|
+
nextUserRead = _objectSpread$5(_objectSpread$5({}, nextUserRead), {}, {
|
|
7879
7940
|
unreadMessageCount: userRead.unreadMessageCount + 1
|
|
7880
7941
|
});
|
|
7881
7942
|
}
|
|
@@ -7899,8 +7960,8 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7899
7960
|
var user = event.user;
|
|
7900
7961
|
|
|
7901
7962
|
_this.state.next(function (current) {
|
|
7902
|
-
return _objectSpread$
|
|
7903
|
-
read: _objectSpread$
|
|
7963
|
+
return _objectSpread$5(_objectSpread$5({}, current), {}, {
|
|
7964
|
+
read: _objectSpread$5(_objectSpread$5({}, current.read), {}, _defineProperty({}, userId, {
|
|
7904
7965
|
lastReadAt: new Date(createdAt),
|
|
7905
7966
|
user: user,
|
|
7906
7967
|
lastReadMessageId: event.last_read_message_id,
|
|
@@ -8013,7 +8074,7 @@ var Thread = /*#__PURE__*/function () {
|
|
|
8013
8074
|
}
|
|
8014
8075
|
|
|
8015
8076
|
_this.state.next(function (current) {
|
|
8016
|
-
return _objectSpread$
|
|
8077
|
+
return _objectSpread$5(_objectSpread$5({}, current), {}, {
|
|
8017
8078
|
replies: addToMessageList(current.replies, formattedMessage, timestampChanged)
|
|
8018
8079
|
});
|
|
8019
8080
|
});
|
|
@@ -8030,7 +8091,7 @@ var Thread = /*#__PURE__*/function () {
|
|
|
8030
8091
|
var _message$reply_count;
|
|
8031
8092
|
|
|
8032
8093
|
var formattedMessage = formatMessage(message);
|
|
8033
|
-
return _objectSpread$
|
|
8094
|
+
return _objectSpread$5(_objectSpread$5({}, current), {}, {
|
|
8034
8095
|
deletedAt: formattedMessage.deleted_at,
|
|
8035
8096
|
parentMessage: formattedMessage,
|
|
8036
8097
|
replyCount: (_message$reply_count = message.reply_count) !== null && _message$reply_count !== void 0 ? _message$reply_count : current.replyCount
|
|
@@ -8101,9 +8162,9 @@ var Thread = /*#__PURE__*/function () {
|
|
|
8101
8162
|
limit = _ref10$limit === void 0 ? DEFAULT_PAGE_LIMIT : _ref10$limit,
|
|
8102
8163
|
_ref10$sort = _ref10.sort,
|
|
8103
8164
|
sort = _ref10$sort === void 0 ? DEFAULT_SORT : _ref10$sort,
|
|
8104
|
-
otherOptions = _objectWithoutProperties(_ref10, _excluded$
|
|
8165
|
+
otherOptions = _objectWithoutProperties(_ref10, _excluded$3);
|
|
8105
8166
|
|
|
8106
|
-
return _this.channel.getReplies(_this.id, _objectSpread$
|
|
8167
|
+
return _this.channel.getReplies(_this.id, _objectSpread$5({
|
|
8107
8168
|
limit: limit
|
|
8108
8169
|
}, otherOptions), sort);
|
|
8109
8170
|
});
|
|
@@ -8147,12 +8208,12 @@ var Thread = /*#__PURE__*/function () {
|
|
|
8147
8208
|
limit = Math.abs(count);
|
|
8148
8209
|
|
|
8149
8210
|
_this.state.partialNext({
|
|
8150
|
-
pagination: _objectSpread$
|
|
8211
|
+
pagination: _objectSpread$5(_objectSpread$5({}, pagination), {}, _defineProperty({}, loadingKey, true))
|
|
8151
8212
|
});
|
|
8152
8213
|
|
|
8153
8214
|
_context3.prev = 7;
|
|
8154
8215
|
_context3.next = 10;
|
|
8155
|
-
return _this.queryReplies(_objectSpread$
|
|
8216
|
+
return _this.queryReplies(_objectSpread$5(_objectSpread$5({}, queryOptions), {}, {
|
|
8156
8217
|
limit: limit
|
|
8157
8218
|
}));
|
|
8158
8219
|
|
|
@@ -8174,9 +8235,9 @@ var Thread = /*#__PURE__*/function () {
|
|
|
8174
8235
|
(_nextReplies = nextReplies)[insertionMethodKey].apply(_nextReplies, _toConsumableArray(replies));
|
|
8175
8236
|
}
|
|
8176
8237
|
|
|
8177
|
-
return _objectSpread$
|
|
8238
|
+
return _objectSpread$5(_objectSpread$5({}, current), {}, {
|
|
8178
8239
|
replies: nextReplies,
|
|
8179
|
-
pagination: _objectSpread$
|
|
8240
|
+
pagination: _objectSpread$5(_objectSpread$5({}, current.pagination), {}, (_objectSpread4 = {}, _defineProperty(_objectSpread4, cursorKey, data.messages.length < limit ? null : maybeNextCursor), _defineProperty(_objectSpread4, loadingKey, false), _objectSpread4))
|
|
8180
8241
|
});
|
|
8181
8242
|
});
|
|
8182
8243
|
|
|
@@ -8190,8 +8251,8 @@ var Thread = /*#__PURE__*/function () {
|
|
|
8190
8251
|
_this.client.logger('error', _context3.t0.message);
|
|
8191
8252
|
|
|
8192
8253
|
_this.state.next(function (current) {
|
|
8193
|
-
return _objectSpread$
|
|
8194
|
-
pagination: _objectSpread$
|
|
8254
|
+
return _objectSpread$5(_objectSpread$5({}, current), {}, {
|
|
8255
|
+
pagination: _objectSpread$5(_objectSpread$5({}, current.pagination), {}, _defineProperty({}, loadingKey, false))
|
|
8195
8256
|
});
|
|
8196
8257
|
});
|
|
8197
8258
|
|
|
@@ -8304,9 +8365,9 @@ var ownUnreadCountSelector = function ownUnreadCountSelector(currentUserId) {
|
|
|
8304
8365
|
};
|
|
8305
8366
|
};
|
|
8306
8367
|
|
|
8307
|
-
function ownKeys$
|
|
8368
|
+
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; }
|
|
8308
8369
|
|
|
8309
|
-
function _objectSpread$
|
|
8370
|
+
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; }
|
|
8310
8371
|
var MODERATION_ENTITY_TYPES = {
|
|
8311
8372
|
user: 'stream:user',
|
|
8312
8373
|
message: 'stream:chat:v1:message'
|
|
@@ -8423,7 +8484,7 @@ var Moderation = /*#__PURE__*/function () {
|
|
|
8423
8484
|
case 0:
|
|
8424
8485
|
options = _args3.length > 4 && _args3[4] !== undefined ? _args3[4] : {};
|
|
8425
8486
|
_context3.next = 3;
|
|
8426
|
-
return this.client.post(this.client.baseURL + '/api/v2/moderation/flag', _objectSpread$
|
|
8487
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/flag', _objectSpread$4({
|
|
8427
8488
|
entity_type: entityType,
|
|
8428
8489
|
entity_id: entityId,
|
|
8429
8490
|
entity_creator_id: entityCreatorID,
|
|
@@ -8468,7 +8529,7 @@ var Moderation = /*#__PURE__*/function () {
|
|
|
8468
8529
|
case 0:
|
|
8469
8530
|
options = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
|
|
8470
8531
|
_context4.next = 3;
|
|
8471
|
-
return this.client.post(this.client.baseURL + '/api/v2/moderation/mute', _objectSpread$
|
|
8532
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/mute', _objectSpread$4({
|
|
8472
8533
|
target_ids: [targetID]
|
|
8473
8534
|
}, options));
|
|
8474
8535
|
|
|
@@ -8506,7 +8567,7 @@ var Moderation = /*#__PURE__*/function () {
|
|
|
8506
8567
|
switch (_context5.prev = _context5.next) {
|
|
8507
8568
|
case 0:
|
|
8508
8569
|
_context5.next = 2;
|
|
8509
|
-
return this.client.post(this.client.baseURL + '/api/v2/moderation/unmute', _objectSpread$
|
|
8570
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/unmute', _objectSpread$4({
|
|
8510
8571
|
target_ids: [targetID]
|
|
8511
8572
|
}, options));
|
|
8512
8573
|
|
|
@@ -8548,7 +8609,7 @@ var Moderation = /*#__PURE__*/function () {
|
|
|
8548
8609
|
case 0:
|
|
8549
8610
|
options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
|
|
8550
8611
|
_context6.next = 3;
|
|
8551
|
-
return this.client.get(this.client.baseURL + "/api/v2/moderation/user_report", _objectSpread$
|
|
8612
|
+
return this.client.get(this.client.baseURL + "/api/v2/moderation/user_report", _objectSpread$4({
|
|
8552
8613
|
user_id: userID
|
|
8553
8614
|
}, options));
|
|
8554
8615
|
|
|
@@ -8592,7 +8653,7 @@ var Moderation = /*#__PURE__*/function () {
|
|
|
8592
8653
|
sort = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : [];
|
|
8593
8654
|
options = _args7.length > 2 && _args7[2] !== undefined ? _args7[2] : {};
|
|
8594
8655
|
_context7.next = 5;
|
|
8595
|
-
return this.client.post(this.client.baseURL + '/api/v2/moderation/review_queue', _objectSpread$
|
|
8656
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/review_queue', _objectSpread$4({
|
|
8596
8657
|
filter: filterConditions,
|
|
8597
8658
|
sort: normalizeQuerySort(sort)
|
|
8598
8659
|
}, options));
|
|
@@ -8727,7 +8788,7 @@ var Moderation = /*#__PURE__*/function () {
|
|
|
8727
8788
|
case 0:
|
|
8728
8789
|
options = _args11.length > 2 && _args11[2] !== undefined ? _args11[2] : {};
|
|
8729
8790
|
_context11.next = 3;
|
|
8730
|
-
return this.client.post(this.client.baseURL + '/api/v2/moderation/configs', _objectSpread$
|
|
8791
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/configs', _objectSpread$4({
|
|
8731
8792
|
filter: filterConditions,
|
|
8732
8793
|
sort: sort
|
|
8733
8794
|
}, options));
|
|
@@ -8761,7 +8822,7 @@ var Moderation = /*#__PURE__*/function () {
|
|
|
8761
8822
|
case 0:
|
|
8762
8823
|
options = _args12.length > 2 && _args12[2] !== undefined ? _args12[2] : {};
|
|
8763
8824
|
_context12.next = 3;
|
|
8764
|
-
return this.client.post(this.client.baseURL + '/api/v2/moderation/submit_action', _objectSpread$
|
|
8825
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/submit_action', _objectSpread$4({
|
|
8765
8826
|
action_type: actionType,
|
|
8766
8827
|
item_id: itemID
|
|
8767
8828
|
}, options));
|
|
@@ -8925,9 +8986,9 @@ function _unsupportedIterableToArray$2(o, minLen) { if (!o) return; if (typeof o
|
|
|
8925
8986
|
|
|
8926
8987
|
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; }
|
|
8927
8988
|
|
|
8928
|
-
function ownKeys$
|
|
8989
|
+
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; }
|
|
8929
8990
|
|
|
8930
|
-
function _objectSpread$
|
|
8991
|
+
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; }
|
|
8931
8992
|
var DEFAULT_CONNECTION_RECOVERY_THROTTLE_DURATION = 1000;
|
|
8932
8993
|
var MAX_QUERY_THREADS_LIMIT = 25;
|
|
8933
8994
|
var THREAD_MANAGER_INITIAL_STATE = {
|
|
@@ -9108,7 +9169,7 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9108
9169
|
var unsubscribeConnectionDropped = _this.client.on('connection.changed', function (event) {
|
|
9109
9170
|
if (event.online === false) {
|
|
9110
9171
|
_this.state.next(function (current) {
|
|
9111
|
-
return current.lastConnectionDropAt ? current : _objectSpread$
|
|
9172
|
+
return current.lastConnectionDropAt ? current : _objectSpread$3(_objectSpread$3({}, current), {}, {
|
|
9112
9173
|
lastConnectionDropAt: new Date()
|
|
9113
9174
|
});
|
|
9114
9175
|
});
|
|
@@ -9195,8 +9256,8 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9195
9256
|
_context.prev = 7;
|
|
9196
9257
|
|
|
9197
9258
|
_this.state.next(function (current) {
|
|
9198
|
-
return _objectSpread$
|
|
9199
|
-
pagination: _objectSpread$
|
|
9259
|
+
return _objectSpread$3(_objectSpread$3({}, current), {}, {
|
|
9260
|
+
pagination: _objectSpread$3(_objectSpread$3({}, current.pagination), {}, {
|
|
9200
9261
|
isLoading: true
|
|
9201
9262
|
})
|
|
9202
9263
|
});
|
|
@@ -9238,11 +9299,11 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9238
9299
|
_this.state.next(function (current) {
|
|
9239
9300
|
var _response$next;
|
|
9240
9301
|
|
|
9241
|
-
return _objectSpread$
|
|
9302
|
+
return _objectSpread$3(_objectSpread$3({}, current), {}, {
|
|
9242
9303
|
threads: nextThreads,
|
|
9243
9304
|
unseenThreadIds: [],
|
|
9244
9305
|
isThreadOrderStale: false,
|
|
9245
|
-
pagination: _objectSpread$
|
|
9306
|
+
pagination: _objectSpread$3(_objectSpread$3({}, current.pagination), {}, {
|
|
9246
9307
|
isLoading: false,
|
|
9247
9308
|
nextCursor: (_response$next = response.next) !== null && _response$next !== void 0 ? _response$next : null
|
|
9248
9309
|
}),
|
|
@@ -9260,8 +9321,8 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9260
9321
|
_this.client.logger('error', _context.t0.message);
|
|
9261
9322
|
|
|
9262
9323
|
_this.state.next(function (current) {
|
|
9263
|
-
return _objectSpread$
|
|
9264
|
-
pagination: _objectSpread$
|
|
9324
|
+
return _objectSpread$3(_objectSpread$3({}, current), {}, {
|
|
9325
|
+
pagination: _objectSpread$3(_objectSpread$3({}, current.pagination), {}, {
|
|
9265
9326
|
isLoading: false
|
|
9266
9327
|
})
|
|
9267
9328
|
});
|
|
@@ -9277,7 +9338,7 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9277
9338
|
|
|
9278
9339
|
_defineProperty(this, "queryThreads", function () {
|
|
9279
9340
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9280
|
-
return _this.client.queryThreads(_objectSpread$
|
|
9341
|
+
return _this.client.queryThreads(_objectSpread$3({
|
|
9281
9342
|
limit: 25,
|
|
9282
9343
|
participant_limit: 10,
|
|
9283
9344
|
reply_limit: 10,
|
|
@@ -9310,13 +9371,13 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9310
9371
|
_context2.prev = 4;
|
|
9311
9372
|
|
|
9312
9373
|
_this.state.partialNext({
|
|
9313
|
-
pagination: _objectSpread$
|
|
9374
|
+
pagination: _objectSpread$3(_objectSpread$3({}, pagination), {}, {
|
|
9314
9375
|
isLoadingNext: true
|
|
9315
9376
|
})
|
|
9316
9377
|
});
|
|
9317
9378
|
|
|
9318
9379
|
_context2.next = 8;
|
|
9319
|
-
return _this.queryThreads(_objectSpread$
|
|
9380
|
+
return _this.queryThreads(_objectSpread$3(_objectSpread$3({}, options), {}, {
|
|
9320
9381
|
next: pagination.nextCursor
|
|
9321
9382
|
}));
|
|
9322
9383
|
|
|
@@ -9326,9 +9387,9 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9326
9387
|
_this.state.next(function (current) {
|
|
9327
9388
|
var _response$next2;
|
|
9328
9389
|
|
|
9329
|
-
return _objectSpread$
|
|
9390
|
+
return _objectSpread$3(_objectSpread$3({}, current), {}, {
|
|
9330
9391
|
threads: response.threads.length ? current.threads.concat(response.threads) : current.threads,
|
|
9331
|
-
pagination: _objectSpread$
|
|
9392
|
+
pagination: _objectSpread$3(_objectSpread$3({}, current.pagination), {}, {
|
|
9332
9393
|
nextCursor: (_response$next2 = response.next) !== null && _response$next2 !== void 0 ? _response$next2 : null,
|
|
9333
9394
|
isLoadingNext: false
|
|
9334
9395
|
})
|
|
@@ -9345,8 +9406,8 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9345
9406
|
_this.client.logger('error', _context2.t0.message);
|
|
9346
9407
|
|
|
9347
9408
|
_this.state.next(function (current) {
|
|
9348
|
-
return _objectSpread$
|
|
9349
|
-
pagination: _objectSpread$
|
|
9409
|
+
return _objectSpread$3(_objectSpread$3({}, current), {}, {
|
|
9410
|
+
pagination: _objectSpread$3(_objectSpread$3({}, current.pagination), {}, {
|
|
9350
9411
|
isLoadingNext: false
|
|
9351
9412
|
})
|
|
9352
9413
|
});
|
|
@@ -9391,12 +9452,12 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9391
9452
|
return ThreadManager;
|
|
9392
9453
|
}();
|
|
9393
9454
|
|
|
9394
|
-
var _excluded$
|
|
9455
|
+
var _excluded$2 = ["own_votes", "id"],
|
|
9395
9456
|
_excluded2$1 = ["id"];
|
|
9396
9457
|
|
|
9397
|
-
function ownKeys$
|
|
9458
|
+
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; }
|
|
9398
9459
|
|
|
9399
|
-
function _objectSpread$
|
|
9460
|
+
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; }
|
|
9400
9461
|
|
|
9401
9462
|
var isPollUpdatedEvent = function isPollUpdatedEvent(e) {
|
|
9402
9463
|
return e.type === 'poll.updated';
|
|
@@ -9444,7 +9505,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9444
9505
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
9445
9506
|
var own_votes = poll.own_votes;
|
|
9446
9507
|
poll.id;
|
|
9447
|
-
var pollResponseForState = _objectWithoutProperties(poll, _excluded$
|
|
9508
|
+
var pollResponseForState = _objectWithoutProperties(poll, _excluded$2);
|
|
9448
9509
|
|
|
9449
9510
|
var _ref2 = (_own_votes$reduce = own_votes === null || own_votes === void 0 ? void 0 : own_votes.reduce(function (acc, voteOrAnswer) {
|
|
9450
9511
|
if (isVoteAnswer(voteOrAnswer)) {
|
|
@@ -9462,7 +9523,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9462
9523
|
ownAnswer = _ref2.ownAnswer,
|
|
9463
9524
|
ownVotes = _ref2.ownVotes;
|
|
9464
9525
|
|
|
9465
|
-
return _objectSpread$
|
|
9526
|
+
return _objectSpread$2(_objectSpread$2({}, pollResponseForState), {}, {
|
|
9466
9527
|
lastActivityAt: new Date(),
|
|
9467
9528
|
maxVotedOptionIds: getMaxVotedOptionIds(pollResponseForState.vote_counts_by_option),
|
|
9468
9529
|
ownAnswer: ownAnswer,
|
|
@@ -9484,7 +9545,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9484
9545
|
pollData = _objectWithoutProperties(_extractPollData, _excluded2$1); // @ts-ignore
|
|
9485
9546
|
|
|
9486
9547
|
|
|
9487
|
-
_this.state.partialNext(_objectSpread$
|
|
9548
|
+
_this.state.partialNext(_objectSpread$2(_objectSpread$2({}, pollData), {}, {
|
|
9488
9549
|
lastActivityAt: new Date(event.created_at)
|
|
9489
9550
|
}));
|
|
9490
9551
|
});
|
|
@@ -9531,7 +9592,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9531
9592
|
|
|
9532
9593
|
var pollEnrichData = extractPollEnrichedData(event.poll); // @ts-ignore
|
|
9533
9594
|
|
|
9534
|
-
_this.state.partialNext(_objectSpread$
|
|
9595
|
+
_this.state.partialNext(_objectSpread$2(_objectSpread$2({}, pollEnrichData), {}, {
|
|
9535
9596
|
latest_answers: latestAnswers,
|
|
9536
9597
|
lastActivityAt: new Date(event.created_at),
|
|
9537
9598
|
ownAnswer: ownAnswer,
|
|
@@ -9596,7 +9657,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9596
9657
|
|
|
9597
9658
|
var pollEnrichData = extractPollEnrichedData(event.poll); // @ts-ignore
|
|
9598
9659
|
|
|
9599
|
-
_this.state.partialNext(_objectSpread$
|
|
9660
|
+
_this.state.partialNext(_objectSpread$2(_objectSpread$2({}, pollEnrichData), {}, {
|
|
9600
9661
|
latest_answers: latestAnswers,
|
|
9601
9662
|
lastActivityAt: new Date(event.created_at),
|
|
9602
9663
|
ownAnswer: ownAnswer,
|
|
@@ -9617,7 +9678,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9617
9678
|
|
|
9618
9679
|
var ownAnswer = currentState.ownAnswer;
|
|
9619
9680
|
|
|
9620
|
-
var ownVotesByOptionId = _objectSpread$
|
|
9681
|
+
var ownVotesByOptionId = _objectSpread$2({}, currentState.ownVotesByOptionId);
|
|
9621
9682
|
|
|
9622
9683
|
var maxVotedOptionIds = currentState.maxVotedOptionIds;
|
|
9623
9684
|
|
|
@@ -9639,7 +9700,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9639
9700
|
|
|
9640
9701
|
var pollEnrichData = extractPollEnrichedData(event.poll); // @ts-ignore
|
|
9641
9702
|
|
|
9642
|
-
_this.state.partialNext(_objectSpread$
|
|
9703
|
+
_this.state.partialNext(_objectSpread$2(_objectSpread$2({}, pollEnrichData), {}, {
|
|
9643
9704
|
latest_answers: latestAnswers,
|
|
9644
9705
|
lastActivityAt: new Date(event.created_at),
|
|
9645
9706
|
ownAnswer: ownAnswer,
|
|
@@ -9664,7 +9725,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9664
9725
|
poll = _yield$_this$client$g.poll;
|
|
9665
9726
|
|
|
9666
9727
|
// @ts-ignore
|
|
9667
|
-
_this.state.partialNext(_objectSpread$
|
|
9728
|
+
_this.state.partialNext(_objectSpread$2(_objectSpread$2({}, poll), {}, {
|
|
9668
9729
|
lastActivityAt: new Date()
|
|
9669
9730
|
}));
|
|
9670
9731
|
|
|
@@ -9690,7 +9751,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9690
9751
|
switch (_context2.prev = _context2.next) {
|
|
9691
9752
|
case 0:
|
|
9692
9753
|
_context2.next = 2;
|
|
9693
|
-
return _this.client.updatePoll(_objectSpread$
|
|
9754
|
+
return _this.client.updatePoll(_objectSpread$2(_objectSpread$2({}, data), {}, {
|
|
9694
9755
|
id: _this.id
|
|
9695
9756
|
}));
|
|
9696
9757
|
|
|
@@ -10401,7 +10462,7 @@ var PollManager = /*#__PURE__*/function () {
|
|
|
10401
10462
|
return PollManager;
|
|
10402
10463
|
}();
|
|
10403
10464
|
|
|
10404
|
-
var _excluded = ["created_at", "updated_at", "last_active", "online"],
|
|
10465
|
+
var _excluded$1 = ["created_at", "updated_at", "last_active", "online"],
|
|
10405
10466
|
_excluded2 = ["params", "headers"];
|
|
10406
10467
|
|
|
10407
10468
|
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; } } }; }
|
|
@@ -10410,9 +10471,9 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
10410
10471
|
|
|
10411
10472
|
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; }
|
|
10412
10473
|
|
|
10413
|
-
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; }
|
|
10474
|
+
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; }
|
|
10414
10475
|
|
|
10415
|
-
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; }
|
|
10476
|
+
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; }
|
|
10416
10477
|
|
|
10417
10478
|
function isString(x) {
|
|
10418
10479
|
return typeof x === 'string' || x instanceof String;
|
|
@@ -11012,9 +11073,9 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11012
11073
|
|
|
11013
11074
|
if (event.type === 'user.presence.changed' || event.type === 'user.updated') {
|
|
11014
11075
|
if (event.user.id === _this.userID) {
|
|
11015
|
-
var user = _objectSpread({}, _this.user || {});
|
|
11076
|
+
var user = _objectSpread$1({}, _this.user || {});
|
|
11016
11077
|
|
|
11017
|
-
var _user = _objectSpread({}, _this._user || {}); // Remove deleted properties from user objects.
|
|
11078
|
+
var _user = _objectSpread$1({}, _this._user || {}); // Remove deleted properties from user objects.
|
|
11018
11079
|
|
|
11019
11080
|
|
|
11020
11081
|
for (var _key2 in _this.user) {
|
|
@@ -11035,8 +11096,8 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11035
11096
|
} // @ts-expect-error
|
|
11036
11097
|
|
|
11037
11098
|
|
|
11038
|
-
_this._user = _objectSpread({}, _user);
|
|
11039
|
-
_this.user = _objectSpread(_objectSpread({}, user), event.user);
|
|
11099
|
+
_this._user = _objectSpread$1({}, _user);
|
|
11100
|
+
_this.user = _objectSpread$1(_objectSpread$1({}, user), event.user);
|
|
11040
11101
|
}
|
|
11041
11102
|
|
|
11042
11103
|
_this.state.updateUser(event.user);
|
|
@@ -11192,8 +11253,8 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11192
11253
|
var _channel6 = _this.activeChannels[cid];
|
|
11193
11254
|
|
|
11194
11255
|
if (Object.keys(custom).length > 0) {
|
|
11195
|
-
_channel6.data = _objectSpread(_objectSpread({}, _channel6.data), custom);
|
|
11196
|
-
_channel6._data = _objectSpread(_objectSpread({}, _channel6._data), custom);
|
|
11256
|
+
_channel6.data = _objectSpread$1(_objectSpread$1({}, _channel6.data), custom);
|
|
11257
|
+
_channel6._data = _objectSpread$1(_objectSpread$1({}, _channel6._data), custom);
|
|
11197
11258
|
}
|
|
11198
11259
|
|
|
11199
11260
|
return _channel6;
|
|
@@ -11252,7 +11313,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11252
11313
|
var inputOptions = _options ? _options : secretOrOptions && !isString(secretOrOptions) ? secretOrOptions : {};
|
|
11253
11314
|
this.browser = typeof inputOptions.browser !== 'undefined' ? inputOptions.browser : typeof window !== 'undefined';
|
|
11254
11315
|
this.node = !this.browser;
|
|
11255
|
-
this.options = _objectSpread({
|
|
11316
|
+
this.options = _objectSpread$1({
|
|
11256
11317
|
timeout: 3000,
|
|
11257
11318
|
withCredentials: false,
|
|
11258
11319
|
// making sure cookies are not sent
|
|
@@ -11407,7 +11468,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11407
11468
|
this.user = user;
|
|
11408
11469
|
this.userID = user.id; // this one is actually used for requests. This is a copy of current user provided to `connectUser` function.
|
|
11409
11470
|
|
|
11410
|
-
this._user = _objectSpread({}, user);
|
|
11471
|
+
this._user = _objectSpread$1({}, user);
|
|
11411
11472
|
}
|
|
11412
11473
|
/**
|
|
11413
11474
|
* Disconnects the websocket connection, without removing the user set on client.
|
|
@@ -11462,8 +11523,8 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11462
11523
|
apn_config = options.apn_config;
|
|
11463
11524
|
|
|
11464
11525
|
if (apn_config !== null && apn_config !== void 0 && apn_config.p12_cert) {
|
|
11465
|
-
options = _objectSpread(_objectSpread({}, options), {}, {
|
|
11466
|
-
apn_config: _objectSpread(_objectSpread({}, apn_config), {}, {
|
|
11526
|
+
options = _objectSpread$1(_objectSpread$1({}, options), {}, {
|
|
11527
|
+
apn_config: _objectSpread$1(_objectSpread$1({}, apn_config), {}, {
|
|
11467
11528
|
p12_cert: Buffer.from(apn_config.p12_cert).toString('base64')
|
|
11468
11529
|
})
|
|
11469
11530
|
});
|
|
@@ -11674,7 +11735,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11674
11735
|
case 0:
|
|
11675
11736
|
data = _args12.length > 1 && _args12[1] !== undefined ? _args12[1] : {};
|
|
11676
11737
|
_context12.next = 3;
|
|
11677
|
-
return this.post(this.baseURL + '/check_push', _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
11738
|
+
return this.post(this.baseURL + '/check_push', _objectSpread$1(_objectSpread$1(_objectSpread$1(_objectSpread$1(_objectSpread$1(_objectSpread$1(_objectSpread$1({
|
|
11678
11739
|
user_id: userID
|
|
11679
11740
|
}, data.messageID ? {
|
|
11680
11741
|
message_id: data.messageID
|
|
@@ -11839,7 +11900,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11839
11900
|
case 11:
|
|
11840
11901
|
this.anonymous = false; // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
11841
11902
|
|
|
11842
|
-
_response$user = response.user, _response$user.created_at, _response$user.updated_at, _response$user.last_active, _response$user.online, guestUser = _objectWithoutProperties(_response$user, _excluded);
|
|
11903
|
+
_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);
|
|
11843
11904
|
_context15.next = 15;
|
|
11844
11905
|
return this.connectUser(guestUser, response.access_token);
|
|
11845
11906
|
|
|
@@ -12323,7 +12384,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12323
12384
|
|
|
12324
12385
|
_context17.next = 8;
|
|
12325
12386
|
return this.get(this.baseURL + '/users', {
|
|
12326
|
-
payload: _objectSpread(_objectSpread({
|
|
12387
|
+
payload: _objectSpread$1(_objectSpread$1({
|
|
12327
12388
|
filter_conditions: filterConditions,
|
|
12328
12389
|
sort: normalizeQuerySort(sort)
|
|
12329
12390
|
}, defaultOptions), options)
|
|
@@ -12375,7 +12436,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12375
12436
|
options = _args18.length > 2 && _args18[2] !== undefined ? _args18[2] : {};
|
|
12376
12437
|
_context18.next = 5;
|
|
12377
12438
|
return this.get(this.baseURL + '/query_banned_users', {
|
|
12378
|
-
payload: _objectSpread({
|
|
12439
|
+
payload: _objectSpread$1({
|
|
12379
12440
|
filter_conditions: filterConditions,
|
|
12380
12441
|
sort: normalizeQuerySort(sort)
|
|
12381
12442
|
}, options)
|
|
@@ -12422,7 +12483,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12422
12483
|
options = _args19.length > 1 && _args19[1] !== undefined ? _args19[1] : {};
|
|
12423
12484
|
_context19.next = 4;
|
|
12424
12485
|
return this.get(this.baseURL + '/moderation/flags/message', {
|
|
12425
|
-
payload: _objectSpread({
|
|
12486
|
+
payload: _objectSpread$1({
|
|
12426
12487
|
filter_conditions: filterConditions
|
|
12427
12488
|
}, options)
|
|
12428
12489
|
});
|
|
@@ -12490,7 +12551,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12490
12551
|
} // Return a list of channels
|
|
12491
12552
|
|
|
12492
12553
|
|
|
12493
|
-
payload = _objectSpread(_objectSpread({
|
|
12554
|
+
payload = _objectSpread$1(_objectSpread$1({
|
|
12494
12555
|
filter_conditions: filterConditions,
|
|
12495
12556
|
sort: normalizeQuerySort(sort)
|
|
12496
12557
|
}, defaultOptions), options);
|
|
@@ -12551,7 +12612,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12551
12612
|
|
|
12552
12613
|
case 4:
|
|
12553
12614
|
// Return a list of channels
|
|
12554
|
-
payload = _objectSpread({
|
|
12615
|
+
payload = _objectSpread$1({
|
|
12555
12616
|
filter: filter,
|
|
12556
12617
|
sort: normalizeQuerySort(sort)
|
|
12557
12618
|
}, options);
|
|
@@ -12617,13 +12678,13 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12617
12678
|
}
|
|
12618
12679
|
|
|
12619
12680
|
if (updatedMessagesSet) {
|
|
12620
|
-
updatedMessagesSet.pagination = _objectSpread(_objectSpread({}, updatedMessagesSet.pagination), messageSetPagination({
|
|
12681
|
+
updatedMessagesSet.pagination = _objectSpread$1(_objectSpread$1({}, updatedMessagesSet.pagination), messageSetPagination({
|
|
12621
12682
|
parentSet: updatedMessagesSet,
|
|
12622
12683
|
requestedPageSize: (queryChannelsOptions === null || queryChannelsOptions === void 0 ? void 0 : queryChannelsOptions.message_limit) || DEFAULT_QUERY_CHANNELS_MESSAGE_LIST_PAGE_SIZE,
|
|
12623
12684
|
returnedPage: channelState.messages,
|
|
12624
12685
|
logger: this.logger
|
|
12625
12686
|
}));
|
|
12626
|
-
this.polls.hydratePollCache(
|
|
12687
|
+
this.polls.hydratePollCache(channelState.messages, true);
|
|
12627
12688
|
}
|
|
12628
12689
|
|
|
12629
12690
|
channels.push(c);
|
|
@@ -12667,7 +12728,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12667
12728
|
throw Error("Cannot specify offset with next");
|
|
12668
12729
|
|
|
12669
12730
|
case 3:
|
|
12670
|
-
payload = _objectSpread(_objectSpread({
|
|
12731
|
+
payload = _objectSpread$1(_objectSpread$1({
|
|
12671
12732
|
filter_conditions: filterConditions
|
|
12672
12733
|
}, options), {}, {
|
|
12673
12734
|
sort: options.sort ? normalizeQuerySort(options.sort) : undefined
|
|
@@ -12761,7 +12822,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12761
12822
|
switch (_context23.prev = _context23.next) {
|
|
12762
12823
|
case 0:
|
|
12763
12824
|
_context23.next = 2;
|
|
12764
|
-
return this.post(this.baseURL + '/devices', _objectSpread(_objectSpread({
|
|
12825
|
+
return this.post(this.baseURL + '/devices', _objectSpread$1(_objectSpread$1({
|
|
12765
12826
|
id: id,
|
|
12766
12827
|
push_provider: push_provider
|
|
12767
12828
|
}, userID != null ? {
|
|
@@ -12956,7 +13017,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12956
13017
|
switch (_context28.prev = _context28.next) {
|
|
12957
13018
|
case 0:
|
|
12958
13019
|
_context28.next = 2;
|
|
12959
|
-
return this.delete(this.baseURL + '/devices', _objectSpread({
|
|
13020
|
+
return this.delete(this.baseURL + '/devices', _objectSpread$1({
|
|
12960
13021
|
id: id
|
|
12961
13022
|
}, userID ? {
|
|
12962
13023
|
user_id: userID
|
|
@@ -13416,7 +13477,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13416
13477
|
switch (_context35.prev = _context35.next) {
|
|
13417
13478
|
case 0:
|
|
13418
13479
|
_context35.next = 2;
|
|
13419
|
-
return this.post(this.baseURL + "/users/".concat(encodeURIComponent(userID), "/reactivate"), _objectSpread({}, options));
|
|
13480
|
+
return this.post(this.baseURL + "/users/".concat(encodeURIComponent(userID), "/reactivate"), _objectSpread$1({}, options));
|
|
13420
13481
|
|
|
13421
13482
|
case 2:
|
|
13422
13483
|
return _context35.abrupt("return", _context35.sent);
|
|
@@ -13453,7 +13514,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13453
13514
|
switch (_context36.prev = _context36.next) {
|
|
13454
13515
|
case 0:
|
|
13455
13516
|
_context36.next = 2;
|
|
13456
|
-
return this.post(this.baseURL + "/users/reactivate", _objectSpread({
|
|
13517
|
+
return this.post(this.baseURL + "/users/reactivate", _objectSpread$1({
|
|
13457
13518
|
user_ids: user_ids
|
|
13458
13519
|
}, options));
|
|
13459
13520
|
|
|
@@ -13492,7 +13553,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13492
13553
|
switch (_context37.prev = _context37.next) {
|
|
13493
13554
|
case 0:
|
|
13494
13555
|
_context37.next = 2;
|
|
13495
|
-
return this.post(this.baseURL + "/users/".concat(encodeURIComponent(userID), "/deactivate"), _objectSpread({}, options));
|
|
13556
|
+
return this.post(this.baseURL + "/users/".concat(encodeURIComponent(userID), "/deactivate"), _objectSpread$1({}, options));
|
|
13496
13557
|
|
|
13497
13558
|
case 2:
|
|
13498
13559
|
return _context37.abrupt("return", _context37.sent);
|
|
@@ -13529,7 +13590,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13529
13590
|
switch (_context38.prev = _context38.next) {
|
|
13530
13591
|
case 0:
|
|
13531
13592
|
_context38.next = 2;
|
|
13532
|
-
return this.post(this.baseURL + "/users/deactivate", _objectSpread({
|
|
13593
|
+
return this.post(this.baseURL + "/users/deactivate", _objectSpread$1({
|
|
13533
13594
|
user_ids: user_ids
|
|
13534
13595
|
}, options));
|
|
13535
13596
|
|
|
@@ -13559,7 +13620,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13559
13620
|
switch (_context39.prev = _context39.next) {
|
|
13560
13621
|
case 0:
|
|
13561
13622
|
_context39.next = 2;
|
|
13562
|
-
return this.get(this.baseURL + "/users/".concat(encodeURIComponent(userID), "/export"), _objectSpread({}, options));
|
|
13623
|
+
return this.get(this.baseURL + "/users/".concat(encodeURIComponent(userID), "/export"), _objectSpread$1({}, options));
|
|
13563
13624
|
|
|
13564
13625
|
case 2:
|
|
13565
13626
|
return _context39.abrupt("return", _context39.sent);
|
|
@@ -13594,7 +13655,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13594
13655
|
switch (_context40.prev = _context40.next) {
|
|
13595
13656
|
case 0:
|
|
13596
13657
|
_context40.next = 2;
|
|
13597
|
-
return this.post(this.baseURL + '/moderation/ban', _objectSpread({
|
|
13658
|
+
return this.post(this.baseURL + '/moderation/ban', _objectSpread$1({
|
|
13598
13659
|
target_user_id: targetUserID
|
|
13599
13660
|
}, options));
|
|
13600
13661
|
|
|
@@ -13631,7 +13692,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13631
13692
|
switch (_context41.prev = _context41.next) {
|
|
13632
13693
|
case 0:
|
|
13633
13694
|
_context41.next = 2;
|
|
13634
|
-
return this.delete(this.baseURL + '/moderation/ban', _objectSpread({
|
|
13695
|
+
return this.delete(this.baseURL + '/moderation/ban', _objectSpread$1({
|
|
13635
13696
|
target_user_id: targetUserID
|
|
13636
13697
|
}, options));
|
|
13637
13698
|
|
|
@@ -13668,7 +13729,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13668
13729
|
switch (_context42.prev = _context42.next) {
|
|
13669
13730
|
case 0:
|
|
13670
13731
|
_context42.next = 2;
|
|
13671
|
-
return this.banUser(targetUserID, _objectSpread({
|
|
13732
|
+
return this.banUser(targetUserID, _objectSpread$1({
|
|
13672
13733
|
shadow: true
|
|
13673
13734
|
}, options));
|
|
13674
13735
|
|
|
@@ -13705,7 +13766,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13705
13766
|
switch (_context43.prev = _context43.next) {
|
|
13706
13767
|
case 0:
|
|
13707
13768
|
_context43.next = 2;
|
|
13708
|
-
return this.unbanUser(targetUserID, _objectSpread({
|
|
13769
|
+
return this.unbanUser(targetUserID, _objectSpread$1({
|
|
13709
13770
|
shadow: true
|
|
13710
13771
|
}, options));
|
|
13711
13772
|
|
|
@@ -13735,7 +13796,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13735
13796
|
switch (_context44.prev = _context44.next) {
|
|
13736
13797
|
case 0:
|
|
13737
13798
|
_context44.next = 2;
|
|
13738
|
-
return this.post(this.baseURL + '/users/block', _objectSpread({
|
|
13799
|
+
return this.post(this.baseURL + '/users/block', _objectSpread$1({
|
|
13739
13800
|
blocked_user_id: blockedUserID
|
|
13740
13801
|
}, user_id ? {
|
|
13741
13802
|
user_id: user_id
|
|
@@ -13767,7 +13828,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13767
13828
|
switch (_context45.prev = _context45.next) {
|
|
13768
13829
|
case 0:
|
|
13769
13830
|
_context45.next = 2;
|
|
13770
|
-
return this.get(this.baseURL + '/users/block', _objectSpread({}, user_id ? {
|
|
13831
|
+
return this.get(this.baseURL + '/users/block', _objectSpread$1({}, user_id ? {
|
|
13771
13832
|
user_id: user_id
|
|
13772
13833
|
} : {}));
|
|
13773
13834
|
|
|
@@ -13797,7 +13858,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13797
13858
|
switch (_context46.prev = _context46.next) {
|
|
13798
13859
|
case 0:
|
|
13799
13860
|
_context46.next = 2;
|
|
13800
|
-
return this.post(this.baseURL + '/users/unblock', _objectSpread({
|
|
13861
|
+
return this.post(this.baseURL + '/users/unblock', _objectSpread$1({
|
|
13801
13862
|
blocked_user_id: blockedUserID
|
|
13802
13863
|
}, userID ? {
|
|
13803
13864
|
user_id: userID
|
|
@@ -13840,7 +13901,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13840
13901
|
case 0:
|
|
13841
13902
|
options = _args47.length > 2 && _args47[2] !== undefined ? _args47[2] : {};
|
|
13842
13903
|
_context47.next = 3;
|
|
13843
|
-
return this.post(this.baseURL + '/moderation/mute', _objectSpread(_objectSpread({
|
|
13904
|
+
return this.post(this.baseURL + '/moderation/mute', _objectSpread$1(_objectSpread$1({
|
|
13844
13905
|
target_id: targetID
|
|
13845
13906
|
}, userID ? {
|
|
13846
13907
|
user_id: userID
|
|
@@ -13879,7 +13940,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13879
13940
|
switch (_context48.prev = _context48.next) {
|
|
13880
13941
|
case 0:
|
|
13881
13942
|
_context48.next = 2;
|
|
13882
|
-
return this.post(this.baseURL + '/moderation/unmute', _objectSpread({
|
|
13943
|
+
return this.post(this.baseURL + '/moderation/unmute', _objectSpread$1({
|
|
13883
13944
|
target_id: targetID
|
|
13884
13945
|
}, currentUserID ? {
|
|
13885
13946
|
user_id: currentUserID
|
|
@@ -13940,7 +14001,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13940
14001
|
case 0:
|
|
13941
14002
|
options = _args49.length > 1 && _args49[1] !== undefined ? _args49[1] : {};
|
|
13942
14003
|
_context49.next = 3;
|
|
13943
|
-
return this.post(this.baseURL + '/moderation/flag', _objectSpread({
|
|
14004
|
+
return this.post(this.baseURL + '/moderation/flag', _objectSpread$1({
|
|
13944
14005
|
target_message_id: targetMessageID
|
|
13945
14006
|
}, options));
|
|
13946
14007
|
|
|
@@ -13980,7 +14041,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13980
14041
|
case 0:
|
|
13981
14042
|
options = _args50.length > 1 && _args50[1] !== undefined ? _args50[1] : {};
|
|
13982
14043
|
_context50.next = 3;
|
|
13983
|
-
return this.post(this.baseURL + '/moderation/flag', _objectSpread({
|
|
14044
|
+
return this.post(this.baseURL + '/moderation/flag', _objectSpread$1({
|
|
13984
14045
|
target_user_id: targetID
|
|
13985
14046
|
}, options));
|
|
13986
14047
|
|
|
@@ -14020,7 +14081,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14020
14081
|
case 0:
|
|
14021
14082
|
options = _args51.length > 1 && _args51[1] !== undefined ? _args51[1] : {};
|
|
14022
14083
|
_context51.next = 3;
|
|
14023
|
-
return this.post(this.baseURL + '/moderation/unflag', _objectSpread({
|
|
14084
|
+
return this.post(this.baseURL + '/moderation/unflag', _objectSpread$1({
|
|
14024
14085
|
target_message_id: targetMessageID
|
|
14025
14086
|
}, options));
|
|
14026
14087
|
|
|
@@ -14060,7 +14121,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14060
14121
|
case 0:
|
|
14061
14122
|
options = _args52.length > 1 && _args52[1] !== undefined ? _args52[1] : {};
|
|
14062
14123
|
_context52.next = 3;
|
|
14063
|
-
return this.post(this.baseURL + '/moderation/unflag', _objectSpread({
|
|
14124
|
+
return this.post(this.baseURL + '/moderation/unflag', _objectSpread$1({
|
|
14064
14125
|
target_user_id: targetID
|
|
14065
14126
|
}, options));
|
|
14066
14127
|
|
|
@@ -14101,7 +14162,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14101
14162
|
case 0:
|
|
14102
14163
|
options = _args53.length > 1 && _args53[1] !== undefined ? _args53[1] : {};
|
|
14103
14164
|
_context53.next = 3;
|
|
14104
|
-
return this.post(this.baseURL + "/calls/".concat(encodeURIComponent(callID)), _objectSpread({}, options));
|
|
14165
|
+
return this.post(this.baseURL + "/calls/".concat(encodeURIComponent(callID)), _objectSpread$1({}, options));
|
|
14105
14166
|
|
|
14106
14167
|
case 3:
|
|
14107
14168
|
return _context53.abrupt("return", _context53.sent);
|
|
@@ -14148,7 +14209,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14148
14209
|
filterConditions = _args54.length > 0 && _args54[0] !== undefined ? _args54[0] : {};
|
|
14149
14210
|
options = _args54.length > 1 && _args54[1] !== undefined ? _args54[1] : {};
|
|
14150
14211
|
_context54.next = 4;
|
|
14151
|
-
return this.post(this.baseURL + '/moderation/flags', _objectSpread({
|
|
14212
|
+
return this.post(this.baseURL + '/moderation/flags', _objectSpread$1({
|
|
14152
14213
|
filter_conditions: filterConditions
|
|
14153
14214
|
}, options));
|
|
14154
14215
|
|
|
@@ -14197,7 +14258,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14197
14258
|
filterConditions = _args55.length > 0 && _args55[0] !== undefined ? _args55[0] : {};
|
|
14198
14259
|
options = _args55.length > 1 && _args55[1] !== undefined ? _args55[1] : {};
|
|
14199
14260
|
_context55.next = 4;
|
|
14200
|
-
return this.post(this.baseURL + '/moderation/reports', _objectSpread({
|
|
14261
|
+
return this.post(this.baseURL + '/moderation/reports', _objectSpread$1({
|
|
14201
14262
|
filter_conditions: filterConditions
|
|
14202
14263
|
}, options));
|
|
14203
14264
|
|
|
@@ -14245,7 +14306,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14245
14306
|
case 0:
|
|
14246
14307
|
options = _args56.length > 2 && _args56[2] !== undefined ? _args56[2] : {};
|
|
14247
14308
|
_context56.next = 3;
|
|
14248
|
-
return this.patch(this.baseURL + "/moderation/reports/".concat(encodeURIComponent(id)), _objectSpread({
|
|
14309
|
+
return this.patch(this.baseURL + "/moderation/reports/".concat(encodeURIComponent(id)), _objectSpread$1({
|
|
14249
14310
|
review_result: reviewResult
|
|
14250
14311
|
}, options));
|
|
14251
14312
|
|
|
@@ -14287,7 +14348,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14287
14348
|
case 0:
|
|
14288
14349
|
options = _args57.length > 1 && _args57[1] !== undefined ? _args57[1] : {};
|
|
14289
14350
|
_context57.next = 3;
|
|
14290
|
-
return this.post(this.baseURL + '/moderation/unblock_message', _objectSpread({
|
|
14351
|
+
return this.post(this.baseURL + '/moderation/unblock_message', _objectSpread$1({
|
|
14291
14352
|
target_message_id: targetMessageID
|
|
14292
14353
|
}, options));
|
|
14293
14354
|
|
|
@@ -14330,7 +14391,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14330
14391
|
case 0:
|
|
14331
14392
|
data = _args58.length > 0 && _args58[0] !== undefined ? _args58[0] : {};
|
|
14332
14393
|
_context58.next = 3;
|
|
14333
|
-
return this.post(this.baseURL + '/channels/read', _objectSpread({}, data));
|
|
14394
|
+
return this.post(this.baseURL + '/channels/read', _objectSpread$1({}, data));
|
|
14334
14395
|
|
|
14335
14396
|
case 3:
|
|
14336
14397
|
case "end":
|
|
@@ -14622,7 +14683,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14622
14683
|
}
|
|
14623
14684
|
|
|
14624
14685
|
_context61.next = 10;
|
|
14625
|
-
return this.post(this.baseURL + "/messages/".concat(encodeURIComponent(message.id)), _objectSpread({
|
|
14686
|
+
return this.post(this.baseURL + "/messages/".concat(encodeURIComponent(message.id)), _objectSpread$1({
|
|
14626
14687
|
message: clonedMessage
|
|
14627
14688
|
}, options));
|
|
14628
14689
|
|
|
@@ -14683,7 +14744,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14683
14744
|
}
|
|
14684
14745
|
|
|
14685
14746
|
_context62.next = 6;
|
|
14686
|
-
return this.put(this.baseURL + "/messages/".concat(encodeURIComponent(id)), _objectSpread(_objectSpread(_objectSpread({}, partialMessageObject), options), {}, {
|
|
14747
|
+
return this.put(this.baseURL + "/messages/".concat(encodeURIComponent(id)), _objectSpread$1(_objectSpread$1(_objectSpread$1({}, partialMessageObject), options), {}, {
|
|
14687
14748
|
user: user
|
|
14688
14749
|
}));
|
|
14689
14750
|
|
|
@@ -14793,7 +14854,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14793
14854
|
switch (_context65.prev = _context65.next) {
|
|
14794
14855
|
case 0:
|
|
14795
14856
|
_context65.next = 2;
|
|
14796
|
-
return this.get(this.baseURL + "/messages/".concat(encodeURIComponent(messageID)), _objectSpread({}, options));
|
|
14857
|
+
return this.get(this.baseURL + "/messages/".concat(encodeURIComponent(messageID)), _objectSpread$1({}, options));
|
|
14797
14858
|
|
|
14798
14859
|
case 2:
|
|
14799
14860
|
return _context65.abrupt("return", _context65.sent);
|
|
@@ -14839,7 +14900,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14839
14900
|
switch (_context66.prev = _context66.next) {
|
|
14840
14901
|
case 0:
|
|
14841
14902
|
options = _args66.length > 0 && _args66[0] !== undefined ? _args66[0] : {};
|
|
14842
|
-
optionsWithDefaults = _objectSpread({
|
|
14903
|
+
optionsWithDefaults = _objectSpread$1({
|
|
14843
14904
|
limit: 10,
|
|
14844
14905
|
participant_limit: 10,
|
|
14845
14906
|
reply_limit: 3,
|
|
@@ -14908,7 +14969,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14908
14969
|
throw Error('Please specify the messageId when calling getThread');
|
|
14909
14970
|
|
|
14910
14971
|
case 3:
|
|
14911
|
-
optionsWithDefaults = _objectSpread({
|
|
14972
|
+
optionsWithDefaults = _objectSpread$1({
|
|
14912
14973
|
participant_limit: 100,
|
|
14913
14974
|
reply_limit: 3,
|
|
14914
14975
|
watch: true
|
|
@@ -14967,7 +15028,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
14967
15028
|
// check for reserved fields from ThreadResponse type within partialThreadObject's set and unset.
|
|
14968
15029
|
// Throw error if any of the reserved field is found.
|
|
14969
15030
|
reservedThreadFields = ['created_at', 'id', 'last_message_at', 'type', 'updated_at', 'user', 'reply_count', 'participants', 'channel', 'custom'];
|
|
14970
|
-
_context68.t0 = _regeneratorRuntime.keys(_objectSpread(_objectSpread({}, partialThreadObject.set), partialThreadObject.unset));
|
|
15031
|
+
_context68.t0 = _regeneratorRuntime.keys(_objectSpread$1(_objectSpread$1({}, partialThreadObject.set), partialThreadObject.unset));
|
|
14971
15032
|
|
|
14972
15033
|
case 4:
|
|
14973
15034
|
if ((_context68.t1 = _context68.t0()).done) {
|
|
@@ -15012,7 +15073,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15012
15073
|
}, {
|
|
15013
15074
|
key: "getUserAgent",
|
|
15014
15075
|
value: function getUserAgent() {
|
|
15015
|
-
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.
|
|
15076
|
+
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.55.0");
|
|
15016
15077
|
}
|
|
15017
15078
|
}, {
|
|
15018
15079
|
key: "setUserAgent",
|
|
@@ -15047,7 +15108,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15047
15108
|
}
|
|
15048
15109
|
|
|
15049
15110
|
if (!((_options$headers = options.headers) !== null && _options$headers !== void 0 && _options$headers['x-client-request-id'])) {
|
|
15050
|
-
options.headers = _objectSpread(_objectSpread({}, options.headers), {}, {
|
|
15111
|
+
options.headers = _objectSpread$1(_objectSpread$1({}, options.headers), {}, {
|
|
15051
15112
|
'x-client-request-id': randomId()
|
|
15052
15113
|
});
|
|
15053
15114
|
}
|
|
@@ -15057,13 +15118,13 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15057
15118
|
axiosRequestConfigHeaders = _ref9.headers,
|
|
15058
15119
|
axiosRequestConfigRest = _objectWithoutProperties(_ref9, _excluded2);
|
|
15059
15120
|
|
|
15060
|
-
return _objectSpread(_objectSpread(_objectSpread({
|
|
15061
|
-
params: _objectSpread(_objectSpread({
|
|
15121
|
+
return _objectSpread$1(_objectSpread$1(_objectSpread$1({
|
|
15122
|
+
params: _objectSpread$1(_objectSpread$1({
|
|
15062
15123
|
user_id: this.userID,
|
|
15063
15124
|
connection_id: this._getConnectionID(),
|
|
15064
15125
|
api_key: this.key
|
|
15065
15126
|
}, options.params), axiosRequestConfigParams || {}),
|
|
15066
|
-
headers: _objectSpread(_objectSpread(_objectSpread({}, authorization), {}, {
|
|
15127
|
+
headers: _objectSpread$1(_objectSpread$1(_objectSpread$1({}, authorization), {}, {
|
|
15067
15128
|
'stream-auth-type': this.getAuthType(),
|
|
15068
15129
|
'X-Stream-Client': this.getUserAgent()
|
|
15069
15130
|
}, options.headers), axiosRequestConfigHeaders || {})
|
|
@@ -15133,7 +15194,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15133
15194
|
}, {
|
|
15134
15195
|
key: "createPermission",
|
|
15135
15196
|
value: function createPermission(permissionData) {
|
|
15136
|
-
return this.post("".concat(this.baseURL, "/permissions"), _objectSpread({}, permissionData));
|
|
15197
|
+
return this.post("".concat(this.baseURL, "/permissions"), _objectSpread$1({}, permissionData));
|
|
15137
15198
|
}
|
|
15138
15199
|
/** updatePermission - updates an existing custom permission
|
|
15139
15200
|
*
|
|
@@ -15145,7 +15206,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15145
15206
|
}, {
|
|
15146
15207
|
key: "updatePermission",
|
|
15147
15208
|
value: function updatePermission(id, permissionData) {
|
|
15148
|
-
return this.put("".concat(this.baseURL, "/permissions/").concat(encodeURIComponent(id)), _objectSpread({}, permissionData));
|
|
15209
|
+
return this.put("".concat(this.baseURL, "/permissions/").concat(encodeURIComponent(id)), _objectSpread$1({}, permissionData));
|
|
15149
15210
|
}
|
|
15150
15211
|
/** deletePermission - deletes a custom permission
|
|
15151
15212
|
*
|
|
@@ -15214,7 +15275,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15214
15275
|
key: "sync",
|
|
15215
15276
|
value: function sync(channel_cids, last_sync_at) {
|
|
15216
15277
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
15217
|
-
return this.post("".concat(this.baseURL, "/sync"), _objectSpread({
|
|
15278
|
+
return this.post("".concat(this.baseURL, "/sync"), _objectSpread$1({
|
|
15218
15279
|
channel_cids: channel_cids,
|
|
15219
15280
|
last_sync_at: last_sync_at
|
|
15220
15281
|
}, options));
|
|
@@ -15339,7 +15400,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15339
15400
|
value: function exportChannels(request) {
|
|
15340
15401
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
15341
15402
|
|
|
15342
|
-
var payload = _objectSpread({
|
|
15403
|
+
var payload = _objectSpread$1({
|
|
15343
15404
|
channels: request
|
|
15344
15405
|
}, options);
|
|
15345
15406
|
|
|
@@ -15407,7 +15468,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15407
15468
|
switch (_context70.prev = _context70.next) {
|
|
15408
15469
|
case 0:
|
|
15409
15470
|
this.validateServerSideAuth();
|
|
15410
|
-
body = _objectSpread({
|
|
15471
|
+
body = _objectSpread$1({
|
|
15411
15472
|
id: id,
|
|
15412
15473
|
type: type
|
|
15413
15474
|
}, data);
|
|
@@ -15610,7 +15671,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15610
15671
|
sort = _args76.length > 2 && _args76[2] !== undefined ? _args76[2] : [];
|
|
15611
15672
|
options = _args76.length > 3 && _args76[3] !== undefined ? _args76[3] : {};
|
|
15612
15673
|
this.validateServerSideAuth();
|
|
15613
|
-
return _context76.abrupt("return", this.post(this.baseURL + "/segments/".concat(encodeURIComponent(id), "/targets/query"), _objectSpread({
|
|
15674
|
+
return _context76.abrupt("return", this.post(this.baseURL + "/segments/".concat(encodeURIComponent(id), "/targets/query"), _objectSpread$1({
|
|
15614
15675
|
filter: filter || {},
|
|
15615
15676
|
sort: sort || []
|
|
15616
15677
|
}, options)));
|
|
@@ -15688,7 +15749,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15688
15749
|
case 0:
|
|
15689
15750
|
options = _args78.length > 2 && _args78[2] !== undefined ? _args78[2] : {};
|
|
15690
15751
|
this.validateServerSideAuth();
|
|
15691
|
-
return _context78.abrupt("return", this.post(this.baseURL + "/segments/query", _objectSpread({
|
|
15752
|
+
return _context78.abrupt("return", this.post(this.baseURL + "/segments/query", _objectSpread$1({
|
|
15692
15753
|
filter: filter,
|
|
15693
15754
|
sort: sort
|
|
15694
15755
|
}, options)));
|
|
@@ -15791,7 +15852,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15791
15852
|
switch (_context81.prev = _context81.next) {
|
|
15792
15853
|
case 0:
|
|
15793
15854
|
this.validateServerSideAuth();
|
|
15794
|
-
return _context81.abrupt("return", this.post(this.baseURL + "/campaigns", _objectSpread({}, params)));
|
|
15855
|
+
return _context81.abrupt("return", this.post(this.baseURL + "/campaigns", _objectSpread$1({}, params)));
|
|
15795
15856
|
|
|
15796
15857
|
case 2:
|
|
15797
15858
|
case "end":
|
|
@@ -15877,7 +15938,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15877
15938
|
case 0:
|
|
15878
15939
|
this.validateServerSideAuth();
|
|
15879
15940
|
_context84.next = 3;
|
|
15880
|
-
return this.post(this.baseURL + "/campaigns/query", _objectSpread({
|
|
15941
|
+
return this.post(this.baseURL + "/campaigns/query", _objectSpread$1({
|
|
15881
15942
|
filter: filter,
|
|
15882
15943
|
sort: sort
|
|
15883
15944
|
}, options || {}));
|
|
@@ -16085,7 +16146,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16085
16146
|
case 0:
|
|
16086
16147
|
options = _args90.length > 1 && _args90[1] !== undefined ? _args90[1] : {};
|
|
16087
16148
|
_context90.next = 3;
|
|
16088
|
-
return this.post(this.baseURL + "/channels/delete", _objectSpread({
|
|
16149
|
+
return this.post(this.baseURL + "/channels/delete", _objectSpread$1({
|
|
16089
16150
|
cids: cids
|
|
16090
16151
|
}, options));
|
|
16091
16152
|
|
|
@@ -16152,7 +16213,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16152
16213
|
|
|
16153
16214
|
case 7:
|
|
16154
16215
|
_context91.next = 9;
|
|
16155
|
-
return this.post(this.baseURL + "/users/delete", _objectSpread({
|
|
16216
|
+
return this.post(this.baseURL + "/users/delete", _objectSpread$1({
|
|
16156
16217
|
user_ids: user_ids
|
|
16157
16218
|
}, options));
|
|
16158
16219
|
|
|
@@ -16242,7 +16303,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16242
16303
|
mode: 'upsert'
|
|
16243
16304
|
};
|
|
16244
16305
|
_context93.next = 3;
|
|
16245
|
-
return this.post(this.baseURL + "/imports", _objectSpread({
|
|
16306
|
+
return this.post(this.baseURL + "/imports", _objectSpread$1({
|
|
16246
16307
|
path: path
|
|
16247
16308
|
}, options));
|
|
16248
16309
|
|
|
@@ -16521,7 +16582,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16521
16582
|
switch (_context100.prev = _context100.next) {
|
|
16522
16583
|
case 0:
|
|
16523
16584
|
_context100.next = 2;
|
|
16524
|
-
return this.post(this.baseURL + "/polls", _objectSpread(_objectSpread({}, poll), userId ? {
|
|
16585
|
+
return this.post(this.baseURL + "/polls", _objectSpread$1(_objectSpread$1({}, poll), userId ? {
|
|
16525
16586
|
user_id: userId
|
|
16526
16587
|
} : {}));
|
|
16527
16588
|
|
|
@@ -16595,7 +16656,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16595
16656
|
switch (_context102.prev = _context102.next) {
|
|
16596
16657
|
case 0:
|
|
16597
16658
|
_context102.next = 2;
|
|
16598
|
-
return this.put(this.baseURL + "/polls", _objectSpread(_objectSpread({}, poll), userId ? {
|
|
16659
|
+
return this.put(this.baseURL + "/polls", _objectSpread$1(_objectSpread$1({}, poll), userId ? {
|
|
16599
16660
|
user_id: userId
|
|
16600
16661
|
} : {}));
|
|
16601
16662
|
|
|
@@ -16634,7 +16695,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16634
16695
|
switch (_context103.prev = _context103.next) {
|
|
16635
16696
|
case 0:
|
|
16636
16697
|
_context103.next = 2;
|
|
16637
|
-
return this.patch(this.baseURL + "/polls/".concat(encodeURIComponent(id)), _objectSpread(_objectSpread({}, partialPollObject), userId ? {
|
|
16698
|
+
return this.patch(this.baseURL + "/polls/".concat(encodeURIComponent(id)), _objectSpread$1(_objectSpread$1({}, partialPollObject), userId ? {
|
|
16638
16699
|
user_id: userId
|
|
16639
16700
|
} : {}));
|
|
16640
16701
|
|
|
@@ -16671,7 +16732,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16671
16732
|
switch (_context104.prev = _context104.next) {
|
|
16672
16733
|
case 0:
|
|
16673
16734
|
_context104.next = 2;
|
|
16674
|
-
return this.delete(this.baseURL + "/polls/".concat(encodeURIComponent(id)), _objectSpread({}, userId ? {
|
|
16735
|
+
return this.delete(this.baseURL + "/polls/".concat(encodeURIComponent(id)), _objectSpread$1({}, userId ? {
|
|
16675
16736
|
user_id: userId
|
|
16676
16737
|
} : {}));
|
|
16677
16738
|
|
|
@@ -16744,7 +16805,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16744
16805
|
switch (_context106.prev = _context106.next) {
|
|
16745
16806
|
case 0:
|
|
16746
16807
|
_context106.next = 2;
|
|
16747
|
-
return this.post(this.baseURL + "/polls/".concat(encodeURIComponent(pollId), "/options"), _objectSpread(_objectSpread({}, option), userId ? {
|
|
16808
|
+
return this.post(this.baseURL + "/polls/".concat(encodeURIComponent(pollId), "/options"), _objectSpread$1(_objectSpread$1({}, option), userId ? {
|
|
16748
16809
|
user_id: userId
|
|
16749
16810
|
} : {}));
|
|
16750
16811
|
|
|
@@ -16820,7 +16881,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16820
16881
|
switch (_context108.prev = _context108.next) {
|
|
16821
16882
|
case 0:
|
|
16822
16883
|
_context108.next = 2;
|
|
16823
|
-
return this.put(this.baseURL + "/polls/".concat(encodeURIComponent(pollId), "/options"), _objectSpread(_objectSpread({}, option), userId ? {
|
|
16884
|
+
return this.put(this.baseURL + "/polls/".concat(encodeURIComponent(pollId), "/options"), _objectSpread$1(_objectSpread$1({}, option), userId ? {
|
|
16824
16885
|
user_id: userId
|
|
16825
16886
|
} : {}));
|
|
16826
16887
|
|
|
@@ -16897,7 +16958,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16897
16958
|
switch (_context110.prev = _context110.next) {
|
|
16898
16959
|
case 0:
|
|
16899
16960
|
_context110.next = 2;
|
|
16900
|
-
return this.post(this.baseURL + "/messages/".concat(encodeURIComponent(messageId), "/polls/").concat(encodeURIComponent(pollId), "/vote"), _objectSpread({
|
|
16961
|
+
return this.post(this.baseURL + "/messages/".concat(encodeURIComponent(messageId), "/polls/").concat(encodeURIComponent(pollId), "/vote"), _objectSpread$1({
|
|
16901
16962
|
vote: vote
|
|
16902
16963
|
}, userId ? {
|
|
16903
16964
|
user_id: userId
|
|
@@ -16963,7 +17024,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16963
17024
|
switch (_context112.prev = _context112.next) {
|
|
16964
17025
|
case 0:
|
|
16965
17026
|
_context112.next = 2;
|
|
16966
|
-
return this.delete(this.baseURL + "/messages/".concat(encodeURIComponent(messageId), "/polls/").concat(encodeURIComponent(pollId), "/vote/").concat(encodeURIComponent(voteId)), _objectSpread({}, userId ? {
|
|
17027
|
+
return this.delete(this.baseURL + "/messages/".concat(encodeURIComponent(messageId), "/polls/").concat(encodeURIComponent(pollId), "/vote/").concat(encodeURIComponent(voteId)), _objectSpread$1({}, userId ? {
|
|
16967
17028
|
user_id: userId
|
|
16968
17029
|
} : {}));
|
|
16969
17030
|
|
|
@@ -17013,7 +17074,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
17013
17074
|
userId = _args113.length > 3 ? _args113[3] : undefined;
|
|
17014
17075
|
q = userId ? "?user_id=".concat(userId) : '';
|
|
17015
17076
|
_context113.next = 7;
|
|
17016
|
-
return this.post(this.baseURL + "/polls/query".concat(q), _objectSpread({
|
|
17077
|
+
return this.post(this.baseURL + "/polls/query".concat(q), _objectSpread$1({
|
|
17017
17078
|
filter: filter,
|
|
17018
17079
|
sort: normalizeQuerySort(sort)
|
|
17019
17080
|
}, options));
|
|
@@ -17065,7 +17126,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
17065
17126
|
userId = _args114.length > 4 ? _args114[4] : undefined;
|
|
17066
17127
|
q = userId ? "?user_id=".concat(userId) : '';
|
|
17067
17128
|
_context114.next = 7;
|
|
17068
|
-
return this.post(this.baseURL + "/polls/".concat(encodeURIComponent(pollId), "/votes").concat(q), _objectSpread({
|
|
17129
|
+
return this.post(this.baseURL + "/polls/".concat(encodeURIComponent(pollId), "/votes").concat(q), _objectSpread$1({
|
|
17069
17130
|
filter: filter,
|
|
17070
17131
|
sort: normalizeQuerySort(sort)
|
|
17071
17132
|
}, options));
|
|
@@ -17117,8 +17178,8 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
17117
17178
|
userId = _args115.length > 4 ? _args115[4] : undefined;
|
|
17118
17179
|
q = userId ? "?user_id=".concat(userId) : '';
|
|
17119
17180
|
_context115.next = 7;
|
|
17120
|
-
return this.post(this.baseURL + "/polls/".concat(encodeURIComponent(pollId), "/votes").concat(q), _objectSpread({
|
|
17121
|
-
filter: _objectSpread(_objectSpread({}, filter), {}, {
|
|
17181
|
+
return this.post(this.baseURL + "/polls/".concat(encodeURIComponent(pollId), "/votes").concat(q), _objectSpread$1({
|
|
17182
|
+
filter: _objectSpread$1(_objectSpread$1({}, filter), {}, {
|
|
17122
17183
|
is_answer: true
|
|
17123
17184
|
}),
|
|
17124
17185
|
sort: normalizeQuerySort(sort)
|
|
@@ -17165,7 +17226,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
17165
17226
|
sort = _args116.length > 1 && _args116[1] !== undefined ? _args116[1] : [];
|
|
17166
17227
|
options = _args116.length > 2 && _args116[2] !== undefined ? _args116[2] : {};
|
|
17167
17228
|
_context116.next = 5;
|
|
17168
|
-
return this.post(this.baseURL + '/messages/history', _objectSpread({
|
|
17229
|
+
return this.post(this.baseURL + '/messages/history', _objectSpread$1({
|
|
17169
17230
|
filter: filter,
|
|
17170
17231
|
sort: normalizeQuerySort(sort)
|
|
17171
17232
|
}, options));
|
|
@@ -17208,7 +17269,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
17208
17269
|
case 0:
|
|
17209
17270
|
options = _args117.length > 2 && _args117[2] !== undefined ? _args117[2] : {};
|
|
17210
17271
|
_context117.next = 3;
|
|
17211
|
-
return this.post(this.baseURL + '/automod/v1/moderation/update_flags', _objectSpread({
|
|
17272
|
+
return this.post(this.baseURL + '/automod/v1/moderation/update_flags', _objectSpread$1({
|
|
17212
17273
|
message_ids: message_ids,
|
|
17213
17274
|
reviewed_by: reviewed_by
|
|
17214
17275
|
}, options));
|
|
@@ -17387,5 +17448,761 @@ var BuiltinPermissions = {
|
|
|
17387
17448
|
UseFrozenChannel: 'Send messages and reactions to frozen channels'
|
|
17388
17449
|
};
|
|
17389
17450
|
|
|
17390
|
-
|
|
17451
|
+
var _excluded = ["lastQueryError"];
|
|
17452
|
+
|
|
17453
|
+
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); }; }
|
|
17454
|
+
|
|
17455
|
+
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; } }
|
|
17456
|
+
|
|
17457
|
+
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; }
|
|
17458
|
+
|
|
17459
|
+
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; }
|
|
17460
|
+
var DEFAULT_SEARCH_SOURCE_OPTIONS = {
|
|
17461
|
+
debounceMs: 300,
|
|
17462
|
+
pageSize: 10
|
|
17463
|
+
};
|
|
17464
|
+
var BaseSearchSource = /*#__PURE__*/function () {
|
|
17465
|
+
function BaseSearchSource(options) {
|
|
17466
|
+
var _this = this;
|
|
17467
|
+
|
|
17468
|
+
_classCallCheck(this, BaseSearchSource);
|
|
17469
|
+
|
|
17470
|
+
_defineProperty(this, "state", void 0);
|
|
17471
|
+
|
|
17472
|
+
_defineProperty(this, "pageSize", void 0);
|
|
17473
|
+
|
|
17474
|
+
_defineProperty(this, "type", void 0);
|
|
17475
|
+
|
|
17476
|
+
_defineProperty(this, "searchDebounced", void 0);
|
|
17477
|
+
|
|
17478
|
+
_defineProperty(this, "setDebounceOptions", function (_ref) {
|
|
17479
|
+
var debounceMs = _ref.debounceMs;
|
|
17480
|
+
_this.searchDebounced = debounce(_this.executeQuery.bind(_this), debounceMs);
|
|
17481
|
+
});
|
|
17482
|
+
|
|
17483
|
+
_defineProperty(this, "activate", function () {
|
|
17484
|
+
if (_this.isActive) return;
|
|
17485
|
+
|
|
17486
|
+
_this.state.partialNext({
|
|
17487
|
+
isActive: true
|
|
17488
|
+
});
|
|
17489
|
+
});
|
|
17490
|
+
|
|
17491
|
+
_defineProperty(this, "deactivate", function () {
|
|
17492
|
+
if (!_this.isActive) return;
|
|
17493
|
+
|
|
17494
|
+
_this.state.partialNext({
|
|
17495
|
+
isActive: false
|
|
17496
|
+
});
|
|
17497
|
+
});
|
|
17498
|
+
|
|
17499
|
+
_defineProperty(this, "search", function (searchQuery) {
|
|
17500
|
+
_this.searchDebounced(searchQuery);
|
|
17501
|
+
});
|
|
17502
|
+
|
|
17503
|
+
var _DEFAULT_SEARCH_SOURC = _objectSpread(_objectSpread({}, DEFAULT_SEARCH_SOURCE_OPTIONS), options),
|
|
17504
|
+
_debounceMs = _DEFAULT_SEARCH_SOURC.debounceMs,
|
|
17505
|
+
pageSize = _DEFAULT_SEARCH_SOURC.pageSize;
|
|
17506
|
+
|
|
17507
|
+
this.pageSize = pageSize;
|
|
17508
|
+
this.state = new StateStore(this.initialState);
|
|
17509
|
+
this.setDebounceOptions({
|
|
17510
|
+
debounceMs: _debounceMs
|
|
17511
|
+
});
|
|
17512
|
+
}
|
|
17513
|
+
|
|
17514
|
+
_createClass(BaseSearchSource, [{
|
|
17515
|
+
key: "lastQueryError",
|
|
17516
|
+
get: function get() {
|
|
17517
|
+
return this.state.getLatestValue().lastQueryError;
|
|
17518
|
+
}
|
|
17519
|
+
}, {
|
|
17520
|
+
key: "hasNext",
|
|
17521
|
+
get: function get() {
|
|
17522
|
+
return this.state.getLatestValue().hasNext;
|
|
17523
|
+
}
|
|
17524
|
+
}, {
|
|
17525
|
+
key: "hasResults",
|
|
17526
|
+
get: function get() {
|
|
17527
|
+
return Array.isArray(this.state.getLatestValue().items);
|
|
17528
|
+
}
|
|
17529
|
+
}, {
|
|
17530
|
+
key: "isActive",
|
|
17531
|
+
get: function get() {
|
|
17532
|
+
return this.state.getLatestValue().isActive;
|
|
17533
|
+
}
|
|
17534
|
+
}, {
|
|
17535
|
+
key: "isLoading",
|
|
17536
|
+
get: function get() {
|
|
17537
|
+
return this.state.getLatestValue().isLoading;
|
|
17538
|
+
}
|
|
17539
|
+
}, {
|
|
17540
|
+
key: "initialState",
|
|
17541
|
+
get: function get() {
|
|
17542
|
+
return {
|
|
17543
|
+
hasNext: true,
|
|
17544
|
+
isActive: false,
|
|
17545
|
+
isLoading: false,
|
|
17546
|
+
items: undefined,
|
|
17547
|
+
lastQueryError: undefined,
|
|
17548
|
+
next: undefined,
|
|
17549
|
+
offset: 0,
|
|
17550
|
+
searchQuery: ''
|
|
17551
|
+
};
|
|
17552
|
+
}
|
|
17553
|
+
}, {
|
|
17554
|
+
key: "items",
|
|
17555
|
+
get: function get() {
|
|
17556
|
+
return this.state.getLatestValue().items;
|
|
17557
|
+
}
|
|
17558
|
+
}, {
|
|
17559
|
+
key: "next",
|
|
17560
|
+
get: function get() {
|
|
17561
|
+
return this.state.getLatestValue().next;
|
|
17562
|
+
}
|
|
17563
|
+
}, {
|
|
17564
|
+
key: "offset",
|
|
17565
|
+
get: function get() {
|
|
17566
|
+
return this.state.getLatestValue().offset;
|
|
17567
|
+
}
|
|
17568
|
+
}, {
|
|
17569
|
+
key: "searchQuery",
|
|
17570
|
+
get: function get() {
|
|
17571
|
+
return this.state.getLatestValue().searchQuery;
|
|
17572
|
+
}
|
|
17573
|
+
}, {
|
|
17574
|
+
key: "executeQuery",
|
|
17575
|
+
value: function () {
|
|
17576
|
+
var _executeQuery = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(newSearchString) {
|
|
17577
|
+
var hasNewSearchQuery, searchString, stateUpdate, results, _items, next, _this$offset;
|
|
17578
|
+
|
|
17579
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
17580
|
+
while (1) {
|
|
17581
|
+
switch (_context.prev = _context.next) {
|
|
17582
|
+
case 0:
|
|
17583
|
+
hasNewSearchQuery = typeof newSearchString !== 'undefined';
|
|
17584
|
+
searchString = newSearchString !== null && newSearchString !== void 0 ? newSearchString : this.searchQuery;
|
|
17585
|
+
|
|
17586
|
+
if (!(!this.isActive || this.isLoading || !this.hasNext && !hasNewSearchQuery || !searchString)) {
|
|
17587
|
+
_context.next = 4;
|
|
17588
|
+
break;
|
|
17589
|
+
}
|
|
17590
|
+
|
|
17591
|
+
return _context.abrupt("return");
|
|
17592
|
+
|
|
17593
|
+
case 4:
|
|
17594
|
+
if (hasNewSearchQuery) {
|
|
17595
|
+
this.state.next(_objectSpread(_objectSpread({}, this.initialState), {}, {
|
|
17596
|
+
isActive: this.isActive,
|
|
17597
|
+
isLoading: true,
|
|
17598
|
+
searchQuery: newSearchString !== null && newSearchString !== void 0 ? newSearchString : ''
|
|
17599
|
+
}));
|
|
17600
|
+
} else {
|
|
17601
|
+
this.state.partialNext({
|
|
17602
|
+
isLoading: true
|
|
17603
|
+
});
|
|
17604
|
+
}
|
|
17605
|
+
|
|
17606
|
+
stateUpdate = {};
|
|
17607
|
+
_context.prev = 6;
|
|
17608
|
+
_context.next = 9;
|
|
17609
|
+
return this.query(searchString);
|
|
17610
|
+
|
|
17611
|
+
case 9:
|
|
17612
|
+
results = _context.sent;
|
|
17613
|
+
|
|
17614
|
+
if (results) {
|
|
17615
|
+
_context.next = 12;
|
|
17616
|
+
break;
|
|
17617
|
+
}
|
|
17618
|
+
|
|
17619
|
+
return _context.abrupt("return");
|
|
17620
|
+
|
|
17621
|
+
case 12:
|
|
17622
|
+
_items = results.items, next = results.next;
|
|
17623
|
+
|
|
17624
|
+
if (next) {
|
|
17625
|
+
stateUpdate.next = next;
|
|
17626
|
+
stateUpdate.hasNext = !!next;
|
|
17627
|
+
} else {
|
|
17628
|
+
stateUpdate.offset = ((_this$offset = this.offset) !== null && _this$offset !== void 0 ? _this$offset : 0) + _items.length;
|
|
17629
|
+
stateUpdate.hasNext = _items.length === this.pageSize;
|
|
17630
|
+
}
|
|
17631
|
+
|
|
17632
|
+
_context.next = 16;
|
|
17633
|
+
return this.filterQueryResults(_items);
|
|
17634
|
+
|
|
17635
|
+
case 16:
|
|
17636
|
+
stateUpdate.items = _context.sent;
|
|
17637
|
+
_context.next = 22;
|
|
17638
|
+
break;
|
|
17639
|
+
|
|
17640
|
+
case 19:
|
|
17641
|
+
_context.prev = 19;
|
|
17642
|
+
_context.t0 = _context["catch"](6);
|
|
17643
|
+
stateUpdate.lastQueryError = _context.t0;
|
|
17644
|
+
|
|
17645
|
+
case 22:
|
|
17646
|
+
_context.prev = 22;
|
|
17647
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
17648
|
+
this.state.next(function (_ref2) {
|
|
17649
|
+
var _current$items;
|
|
17650
|
+
|
|
17651
|
+
_ref2.lastQueryError;
|
|
17652
|
+
var current = _objectWithoutProperties(_ref2, _excluded);
|
|
17653
|
+
|
|
17654
|
+
return _objectSpread(_objectSpread(_objectSpread({}, current), stateUpdate), {}, {
|
|
17655
|
+
isLoading: false,
|
|
17656
|
+
items: [].concat(_toConsumableArray((_current$items = current.items) !== null && _current$items !== void 0 ? _current$items : []), _toConsumableArray(stateUpdate.items || []))
|
|
17657
|
+
});
|
|
17658
|
+
});
|
|
17659
|
+
return _context.finish(22);
|
|
17660
|
+
|
|
17661
|
+
case 25:
|
|
17662
|
+
case "end":
|
|
17663
|
+
return _context.stop();
|
|
17664
|
+
}
|
|
17665
|
+
}
|
|
17666
|
+
}, _callee, this, [[6, 19, 22, 25]]);
|
|
17667
|
+
}));
|
|
17668
|
+
|
|
17669
|
+
function executeQuery(_x) {
|
|
17670
|
+
return _executeQuery.apply(this, arguments);
|
|
17671
|
+
}
|
|
17672
|
+
|
|
17673
|
+
return executeQuery;
|
|
17674
|
+
}()
|
|
17675
|
+
}, {
|
|
17676
|
+
key: "resetState",
|
|
17677
|
+
value: function resetState() {
|
|
17678
|
+
this.state.next(this.initialState);
|
|
17679
|
+
}
|
|
17680
|
+
}]);
|
|
17681
|
+
|
|
17682
|
+
return BaseSearchSource;
|
|
17683
|
+
}();
|
|
17684
|
+
var UserSearchSource = /*#__PURE__*/function (_BaseSearchSource) {
|
|
17685
|
+
_inherits(UserSearchSource, _BaseSearchSource);
|
|
17686
|
+
|
|
17687
|
+
var _super = _createSuper(UserSearchSource);
|
|
17688
|
+
|
|
17689
|
+
function UserSearchSource(client, options) {
|
|
17690
|
+
var _this2;
|
|
17691
|
+
|
|
17692
|
+
_classCallCheck(this, UserSearchSource);
|
|
17693
|
+
|
|
17694
|
+
_this2 = _super.call(this, options);
|
|
17695
|
+
|
|
17696
|
+
_defineProperty(_assertThisInitialized(_this2), "type", 'users');
|
|
17697
|
+
|
|
17698
|
+
_defineProperty(_assertThisInitialized(_this2), "client", void 0);
|
|
17699
|
+
|
|
17700
|
+
_defineProperty(_assertThisInitialized(_this2), "filters", void 0);
|
|
17701
|
+
|
|
17702
|
+
_defineProperty(_assertThisInitialized(_this2), "sort", void 0);
|
|
17703
|
+
|
|
17704
|
+
_defineProperty(_assertThisInitialized(_this2), "searchOptions", void 0);
|
|
17705
|
+
|
|
17706
|
+
_this2.client = client;
|
|
17707
|
+
return _this2;
|
|
17708
|
+
}
|
|
17709
|
+
|
|
17710
|
+
_createClass(UserSearchSource, [{
|
|
17711
|
+
key: "query",
|
|
17712
|
+
value: function () {
|
|
17713
|
+
var _query = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(searchQuery) {
|
|
17714
|
+
var filters, sort, options, _yield$this$client$qu, users;
|
|
17715
|
+
|
|
17716
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
17717
|
+
while (1) {
|
|
17718
|
+
switch (_context2.prev = _context2.next) {
|
|
17719
|
+
case 0:
|
|
17720
|
+
filters = _objectSpread({
|
|
17721
|
+
$or: [{
|
|
17722
|
+
id: {
|
|
17723
|
+
$autocomplete: searchQuery
|
|
17724
|
+
}
|
|
17725
|
+
}, {
|
|
17726
|
+
name: {
|
|
17727
|
+
$autocomplete: searchQuery
|
|
17728
|
+
}
|
|
17729
|
+
}]
|
|
17730
|
+
}, this.filters);
|
|
17731
|
+
sort = _objectSpread({
|
|
17732
|
+
id: 1
|
|
17733
|
+
}, this.sort);
|
|
17734
|
+
options = _objectSpread(_objectSpread({}, this.searchOptions), {}, {
|
|
17735
|
+
limit: this.pageSize,
|
|
17736
|
+
offset: this.offset
|
|
17737
|
+
});
|
|
17738
|
+
_context2.next = 5;
|
|
17739
|
+
return this.client.queryUsers(filters, sort, options);
|
|
17740
|
+
|
|
17741
|
+
case 5:
|
|
17742
|
+
_yield$this$client$qu = _context2.sent;
|
|
17743
|
+
users = _yield$this$client$qu.users;
|
|
17744
|
+
return _context2.abrupt("return", {
|
|
17745
|
+
items: users
|
|
17746
|
+
});
|
|
17747
|
+
|
|
17748
|
+
case 8:
|
|
17749
|
+
case "end":
|
|
17750
|
+
return _context2.stop();
|
|
17751
|
+
}
|
|
17752
|
+
}
|
|
17753
|
+
}, _callee2, this);
|
|
17754
|
+
}));
|
|
17755
|
+
|
|
17756
|
+
function query(_x2) {
|
|
17757
|
+
return _query.apply(this, arguments);
|
|
17758
|
+
}
|
|
17759
|
+
|
|
17760
|
+
return query;
|
|
17761
|
+
}()
|
|
17762
|
+
}, {
|
|
17763
|
+
key: "filterQueryResults",
|
|
17764
|
+
value: function filterQueryResults(items) {
|
|
17765
|
+
var _this3 = this;
|
|
17766
|
+
|
|
17767
|
+
return items.filter(function (u) {
|
|
17768
|
+
var _this3$client$user;
|
|
17769
|
+
|
|
17770
|
+
return u.id !== ((_this3$client$user = _this3.client.user) === null || _this3$client$user === void 0 ? void 0 : _this3$client$user.id);
|
|
17771
|
+
});
|
|
17772
|
+
}
|
|
17773
|
+
}]);
|
|
17774
|
+
|
|
17775
|
+
return UserSearchSource;
|
|
17776
|
+
}(BaseSearchSource);
|
|
17777
|
+
var ChannelSearchSource = /*#__PURE__*/function (_BaseSearchSource2) {
|
|
17778
|
+
_inherits(ChannelSearchSource, _BaseSearchSource2);
|
|
17779
|
+
|
|
17780
|
+
var _super2 = _createSuper(ChannelSearchSource);
|
|
17781
|
+
|
|
17782
|
+
function ChannelSearchSource(client, options) {
|
|
17783
|
+
var _this4;
|
|
17784
|
+
|
|
17785
|
+
_classCallCheck(this, ChannelSearchSource);
|
|
17786
|
+
|
|
17787
|
+
_this4 = _super2.call(this, options);
|
|
17788
|
+
|
|
17789
|
+
_defineProperty(_assertThisInitialized(_this4), "type", 'channels');
|
|
17790
|
+
|
|
17791
|
+
_defineProperty(_assertThisInitialized(_this4), "client", void 0);
|
|
17792
|
+
|
|
17793
|
+
_defineProperty(_assertThisInitialized(_this4), "filters", void 0);
|
|
17794
|
+
|
|
17795
|
+
_defineProperty(_assertThisInitialized(_this4), "sort", void 0);
|
|
17796
|
+
|
|
17797
|
+
_defineProperty(_assertThisInitialized(_this4), "searchOptions", void 0);
|
|
17798
|
+
|
|
17799
|
+
_this4.client = client;
|
|
17800
|
+
return _this4;
|
|
17801
|
+
}
|
|
17802
|
+
|
|
17803
|
+
_createClass(ChannelSearchSource, [{
|
|
17804
|
+
key: "query",
|
|
17805
|
+
value: function () {
|
|
17806
|
+
var _query2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(searchQuery) {
|
|
17807
|
+
var _this$sort;
|
|
17808
|
+
|
|
17809
|
+
var filters, sort, options, items;
|
|
17810
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
17811
|
+
while (1) {
|
|
17812
|
+
switch (_context3.prev = _context3.next) {
|
|
17813
|
+
case 0:
|
|
17814
|
+
filters = _objectSpread({
|
|
17815
|
+
members: {
|
|
17816
|
+
$in: [this.client.userID]
|
|
17817
|
+
},
|
|
17818
|
+
name: {
|
|
17819
|
+
$autocomplete: searchQuery
|
|
17820
|
+
}
|
|
17821
|
+
}, this.filters);
|
|
17822
|
+
sort = (_this$sort = this.sort) !== null && _this$sort !== void 0 ? _this$sort : {};
|
|
17823
|
+
options = _objectSpread(_objectSpread({}, this.searchOptions), {}, {
|
|
17824
|
+
limit: this.pageSize,
|
|
17825
|
+
offset: this.offset
|
|
17826
|
+
});
|
|
17827
|
+
_context3.next = 5;
|
|
17828
|
+
return this.client.queryChannels(filters, sort, options);
|
|
17829
|
+
|
|
17830
|
+
case 5:
|
|
17831
|
+
items = _context3.sent;
|
|
17832
|
+
return _context3.abrupt("return", {
|
|
17833
|
+
items: items
|
|
17834
|
+
});
|
|
17835
|
+
|
|
17836
|
+
case 7:
|
|
17837
|
+
case "end":
|
|
17838
|
+
return _context3.stop();
|
|
17839
|
+
}
|
|
17840
|
+
}
|
|
17841
|
+
}, _callee3, this);
|
|
17842
|
+
}));
|
|
17843
|
+
|
|
17844
|
+
function query(_x3) {
|
|
17845
|
+
return _query2.apply(this, arguments);
|
|
17846
|
+
}
|
|
17847
|
+
|
|
17848
|
+
return query;
|
|
17849
|
+
}()
|
|
17850
|
+
}, {
|
|
17851
|
+
key: "filterQueryResults",
|
|
17852
|
+
value: function filterQueryResults(items) {
|
|
17853
|
+
return items;
|
|
17854
|
+
}
|
|
17855
|
+
}]);
|
|
17856
|
+
|
|
17857
|
+
return ChannelSearchSource;
|
|
17858
|
+
}(BaseSearchSource);
|
|
17859
|
+
var MessageSearchSource = /*#__PURE__*/function (_BaseSearchSource3) {
|
|
17860
|
+
_inherits(MessageSearchSource, _BaseSearchSource3);
|
|
17861
|
+
|
|
17862
|
+
var _super3 = _createSuper(MessageSearchSource);
|
|
17863
|
+
|
|
17864
|
+
function MessageSearchSource(client, options) {
|
|
17865
|
+
var _this5;
|
|
17866
|
+
|
|
17867
|
+
_classCallCheck(this, MessageSearchSource);
|
|
17868
|
+
|
|
17869
|
+
_this5 = _super3.call(this, options);
|
|
17870
|
+
|
|
17871
|
+
_defineProperty(_assertThisInitialized(_this5), "type", 'messages');
|
|
17872
|
+
|
|
17873
|
+
_defineProperty(_assertThisInitialized(_this5), "client", void 0);
|
|
17874
|
+
|
|
17875
|
+
_defineProperty(_assertThisInitialized(_this5), "messageSearchChannelFilters", void 0);
|
|
17876
|
+
|
|
17877
|
+
_defineProperty(_assertThisInitialized(_this5), "messageSearchFilters", void 0);
|
|
17878
|
+
|
|
17879
|
+
_defineProperty(_assertThisInitialized(_this5), "messageSearchSort", void 0);
|
|
17880
|
+
|
|
17881
|
+
_defineProperty(_assertThisInitialized(_this5), "channelQueryFilters", void 0);
|
|
17882
|
+
|
|
17883
|
+
_defineProperty(_assertThisInitialized(_this5), "channelQuerySort", void 0);
|
|
17884
|
+
|
|
17885
|
+
_defineProperty(_assertThisInitialized(_this5), "channelQueryOptions", void 0);
|
|
17886
|
+
|
|
17887
|
+
_this5.client = client;
|
|
17888
|
+
return _this5;
|
|
17889
|
+
}
|
|
17890
|
+
|
|
17891
|
+
_createClass(MessageSearchSource, [{
|
|
17892
|
+
key: "query",
|
|
17893
|
+
value: function () {
|
|
17894
|
+
var _query3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(searchQuery) {
|
|
17895
|
+
var _this6 = this;
|
|
17896
|
+
|
|
17897
|
+
var channelFilters, messageFilters, sort, options, _yield$this$client$se, next, results, items, cids, allChannelsLoadedLocally;
|
|
17898
|
+
|
|
17899
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
17900
|
+
while (1) {
|
|
17901
|
+
switch (_context4.prev = _context4.next) {
|
|
17902
|
+
case 0:
|
|
17903
|
+
if (this.client.userID) {
|
|
17904
|
+
_context4.next = 2;
|
|
17905
|
+
break;
|
|
17906
|
+
}
|
|
17907
|
+
|
|
17908
|
+
return _context4.abrupt("return", {
|
|
17909
|
+
items: []
|
|
17910
|
+
});
|
|
17911
|
+
|
|
17912
|
+
case 2:
|
|
17913
|
+
channelFilters = _objectSpread({
|
|
17914
|
+
members: {
|
|
17915
|
+
$in: [this.client.userID]
|
|
17916
|
+
}
|
|
17917
|
+
}, this.messageSearchChannelFilters);
|
|
17918
|
+
messageFilters = _objectSpread({
|
|
17919
|
+
text: searchQuery,
|
|
17920
|
+
type: 'regular'
|
|
17921
|
+
}, this.messageSearchFilters);
|
|
17922
|
+
sort = _objectSpread({
|
|
17923
|
+
created_at: -1
|
|
17924
|
+
}, this.messageSearchSort);
|
|
17925
|
+
options = {
|
|
17926
|
+
limit: this.pageSize,
|
|
17927
|
+
next: this.next,
|
|
17928
|
+
sort: sort
|
|
17929
|
+
};
|
|
17930
|
+
_context4.next = 8;
|
|
17931
|
+
return this.client.search(channelFilters, messageFilters, options);
|
|
17932
|
+
|
|
17933
|
+
case 8:
|
|
17934
|
+
_yield$this$client$se = _context4.sent;
|
|
17935
|
+
next = _yield$this$client$se.next;
|
|
17936
|
+
results = _yield$this$client$se.results;
|
|
17937
|
+
items = results.map(function (_ref3) {
|
|
17938
|
+
var message = _ref3.message;
|
|
17939
|
+
return message;
|
|
17940
|
+
});
|
|
17941
|
+
cids = Array.from(items.reduce(function (acc, message) {
|
|
17942
|
+
if (message.cid && !_this6.client.activeChannels[message.cid]) acc.add(message.cid);
|
|
17943
|
+
return acc;
|
|
17944
|
+
}, new Set()) // keep the cids unique
|
|
17945
|
+
);
|
|
17946
|
+
allChannelsLoadedLocally = cids.length === 0;
|
|
17947
|
+
|
|
17948
|
+
if (allChannelsLoadedLocally) {
|
|
17949
|
+
_context4.next = 17;
|
|
17950
|
+
break;
|
|
17951
|
+
}
|
|
17952
|
+
|
|
17953
|
+
_context4.next = 17;
|
|
17954
|
+
return this.client.queryChannels(_objectSpread({
|
|
17955
|
+
cid: {
|
|
17956
|
+
$in: cids
|
|
17957
|
+
}
|
|
17958
|
+
}, this.channelQueryFilters), _objectSpread({
|
|
17959
|
+
last_message_at: -1
|
|
17960
|
+
}, this.channelQuerySort), this.channelQueryOptions);
|
|
17961
|
+
|
|
17962
|
+
case 17:
|
|
17963
|
+
return _context4.abrupt("return", {
|
|
17964
|
+
items: items,
|
|
17965
|
+
next: next
|
|
17966
|
+
});
|
|
17967
|
+
|
|
17968
|
+
case 18:
|
|
17969
|
+
case "end":
|
|
17970
|
+
return _context4.stop();
|
|
17971
|
+
}
|
|
17972
|
+
}
|
|
17973
|
+
}, _callee4, this);
|
|
17974
|
+
}));
|
|
17975
|
+
|
|
17976
|
+
function query(_x4) {
|
|
17977
|
+
return _query3.apply(this, arguments);
|
|
17978
|
+
}
|
|
17979
|
+
|
|
17980
|
+
return query;
|
|
17981
|
+
}()
|
|
17982
|
+
}, {
|
|
17983
|
+
key: "filterQueryResults",
|
|
17984
|
+
value: function filterQueryResults(items) {
|
|
17985
|
+
return items;
|
|
17986
|
+
}
|
|
17987
|
+
}]);
|
|
17988
|
+
|
|
17989
|
+
return MessageSearchSource;
|
|
17990
|
+
}(BaseSearchSource);
|
|
17991
|
+
var SearchController = /*#__PURE__*/function () {
|
|
17992
|
+
/**
|
|
17993
|
+
* Not intended for direct use by integrators, might be removed without notice resulting in
|
|
17994
|
+
* broken integrations.
|
|
17995
|
+
*/
|
|
17996
|
+
function SearchController() {
|
|
17997
|
+
var _this7 = this;
|
|
17998
|
+
|
|
17999
|
+
var _ref4 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
18000
|
+
config = _ref4.config,
|
|
18001
|
+
sources = _ref4.sources;
|
|
18002
|
+
|
|
18003
|
+
_classCallCheck(this, SearchController);
|
|
18004
|
+
|
|
18005
|
+
_defineProperty(this, "_internalState", void 0);
|
|
18006
|
+
|
|
18007
|
+
_defineProperty(this, "state", void 0);
|
|
18008
|
+
|
|
18009
|
+
_defineProperty(this, "config", void 0);
|
|
18010
|
+
|
|
18011
|
+
_defineProperty(this, "addSource", function (source) {
|
|
18012
|
+
_this7.state.partialNext({
|
|
18013
|
+
sources: [].concat(_toConsumableArray(_this7.sources), [source])
|
|
18014
|
+
});
|
|
18015
|
+
});
|
|
18016
|
+
|
|
18017
|
+
_defineProperty(this, "getSource", function (sourceType) {
|
|
18018
|
+
return _this7.sources.find(function (s) {
|
|
18019
|
+
return s.type === sourceType;
|
|
18020
|
+
});
|
|
18021
|
+
});
|
|
18022
|
+
|
|
18023
|
+
_defineProperty(this, "removeSource", function (sourceType) {
|
|
18024
|
+
var newSources = _this7.sources.filter(function (s) {
|
|
18025
|
+
return s.type !== sourceType;
|
|
18026
|
+
});
|
|
18027
|
+
|
|
18028
|
+
if (newSources.length === _this7.sources.length) return;
|
|
18029
|
+
|
|
18030
|
+
_this7.state.partialNext({
|
|
18031
|
+
sources: newSources
|
|
18032
|
+
});
|
|
18033
|
+
});
|
|
18034
|
+
|
|
18035
|
+
_defineProperty(this, "activateSource", function (sourceType) {
|
|
18036
|
+
var source = _this7.getSource(sourceType);
|
|
18037
|
+
|
|
18038
|
+
if (!source || source.isActive) return;
|
|
18039
|
+
|
|
18040
|
+
if (_this7.config.keepSingleActiveSource) {
|
|
18041
|
+
_this7.sources.forEach(function (s) {
|
|
18042
|
+
if (s.type !== sourceType) {
|
|
18043
|
+
s.deactivate();
|
|
18044
|
+
}
|
|
18045
|
+
});
|
|
18046
|
+
}
|
|
18047
|
+
|
|
18048
|
+
source.activate();
|
|
18049
|
+
|
|
18050
|
+
_this7.state.partialNext({
|
|
18051
|
+
sources: _toConsumableArray(_this7.sources)
|
|
18052
|
+
});
|
|
18053
|
+
});
|
|
18054
|
+
|
|
18055
|
+
_defineProperty(this, "deactivateSource", function (sourceType) {
|
|
18056
|
+
var source = _this7.getSource(sourceType);
|
|
18057
|
+
|
|
18058
|
+
if (!(source !== null && source !== void 0 && source.isActive)) return;
|
|
18059
|
+
if (_this7.activeSources.length === 1) return;
|
|
18060
|
+
source.deactivate();
|
|
18061
|
+
|
|
18062
|
+
_this7.state.partialNext({
|
|
18063
|
+
sources: _toConsumableArray(_this7.sources)
|
|
18064
|
+
});
|
|
18065
|
+
});
|
|
18066
|
+
|
|
18067
|
+
_defineProperty(this, "activate", function () {
|
|
18068
|
+
if (!_this7.activeSources.length) {
|
|
18069
|
+
var sourcesToActivate = _this7.config.keepSingleActiveSource ? _this7.sources.slice(0, 1) : _this7.sources;
|
|
18070
|
+
sourcesToActivate.forEach(function (s) {
|
|
18071
|
+
return s.activate();
|
|
18072
|
+
});
|
|
18073
|
+
}
|
|
18074
|
+
|
|
18075
|
+
if (_this7.isActive) return;
|
|
18076
|
+
|
|
18077
|
+
_this7.state.partialNext({
|
|
18078
|
+
isActive: true
|
|
18079
|
+
});
|
|
18080
|
+
});
|
|
18081
|
+
|
|
18082
|
+
_defineProperty(this, "search", /*#__PURE__*/function () {
|
|
18083
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(searchQuery) {
|
|
18084
|
+
var searchedSources;
|
|
18085
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
18086
|
+
while (1) {
|
|
18087
|
+
switch (_context5.prev = _context5.next) {
|
|
18088
|
+
case 0:
|
|
18089
|
+
searchedSources = _this7.activeSources;
|
|
18090
|
+
|
|
18091
|
+
_this7.state.partialNext({
|
|
18092
|
+
searchQuery: searchQuery
|
|
18093
|
+
});
|
|
18094
|
+
|
|
18095
|
+
_context5.next = 4;
|
|
18096
|
+
return Promise.all(searchedSources.map(function (source) {
|
|
18097
|
+
return source.search(searchQuery);
|
|
18098
|
+
}));
|
|
18099
|
+
|
|
18100
|
+
case 4:
|
|
18101
|
+
case "end":
|
|
18102
|
+
return _context5.stop();
|
|
18103
|
+
}
|
|
18104
|
+
}
|
|
18105
|
+
}, _callee5);
|
|
18106
|
+
}));
|
|
18107
|
+
|
|
18108
|
+
return function (_x5) {
|
|
18109
|
+
return _ref5.apply(this, arguments);
|
|
18110
|
+
};
|
|
18111
|
+
}());
|
|
18112
|
+
|
|
18113
|
+
_defineProperty(this, "cancelSearchQueries", function () {
|
|
18114
|
+
_this7.activeSources.forEach(function (s) {
|
|
18115
|
+
return s.searchDebounced.cancel();
|
|
18116
|
+
});
|
|
18117
|
+
});
|
|
18118
|
+
|
|
18119
|
+
_defineProperty(this, "clear", function () {
|
|
18120
|
+
_this7.cancelSearchQueries();
|
|
18121
|
+
|
|
18122
|
+
_this7.sources.forEach(function (source) {
|
|
18123
|
+
return source.state.next(_objectSpread(_objectSpread({}, source.initialState), {}, {
|
|
18124
|
+
isActive: source.isActive
|
|
18125
|
+
}));
|
|
18126
|
+
});
|
|
18127
|
+
|
|
18128
|
+
_this7.state.next(function (current) {
|
|
18129
|
+
return _objectSpread(_objectSpread({}, current), {}, {
|
|
18130
|
+
isActive: true,
|
|
18131
|
+
queriesInProgress: [],
|
|
18132
|
+
searchQuery: ''
|
|
18133
|
+
});
|
|
18134
|
+
});
|
|
18135
|
+
});
|
|
18136
|
+
|
|
18137
|
+
_defineProperty(this, "exit", function () {
|
|
18138
|
+
_this7.cancelSearchQueries();
|
|
18139
|
+
|
|
18140
|
+
_this7.sources.forEach(function (source) {
|
|
18141
|
+
return source.state.next(_objectSpread(_objectSpread({}, source.initialState), {}, {
|
|
18142
|
+
isActive: source.isActive
|
|
18143
|
+
}));
|
|
18144
|
+
});
|
|
18145
|
+
|
|
18146
|
+
_this7.state.next(function (current) {
|
|
18147
|
+
return _objectSpread(_objectSpread({}, current), {}, {
|
|
18148
|
+
isActive: false,
|
|
18149
|
+
queriesInProgress: [],
|
|
18150
|
+
searchQuery: ''
|
|
18151
|
+
});
|
|
18152
|
+
});
|
|
18153
|
+
});
|
|
18154
|
+
|
|
18155
|
+
this.state = new StateStore({
|
|
18156
|
+
isActive: false,
|
|
18157
|
+
searchQuery: '',
|
|
18158
|
+
sources: sources !== null && sources !== void 0 ? sources : []
|
|
18159
|
+
});
|
|
18160
|
+
this._internalState = new StateStore({});
|
|
18161
|
+
this.config = _objectSpread({
|
|
18162
|
+
keepSingleActiveSource: true
|
|
18163
|
+
}, config);
|
|
18164
|
+
}
|
|
18165
|
+
|
|
18166
|
+
_createClass(SearchController, [{
|
|
18167
|
+
key: "hasNext",
|
|
18168
|
+
get: function get() {
|
|
18169
|
+
return this.sources.some(function (source) {
|
|
18170
|
+
return source.hasNext;
|
|
18171
|
+
});
|
|
18172
|
+
}
|
|
18173
|
+
}, {
|
|
18174
|
+
key: "sources",
|
|
18175
|
+
get: function get() {
|
|
18176
|
+
return this.state.getLatestValue().sources;
|
|
18177
|
+
}
|
|
18178
|
+
}, {
|
|
18179
|
+
key: "activeSources",
|
|
18180
|
+
get: function get() {
|
|
18181
|
+
return this.state.getLatestValue().sources.filter(function (s) {
|
|
18182
|
+
return s.isActive;
|
|
18183
|
+
});
|
|
18184
|
+
}
|
|
18185
|
+
}, {
|
|
18186
|
+
key: "isActive",
|
|
18187
|
+
get: function get() {
|
|
18188
|
+
return this.state.getLatestValue().isActive;
|
|
18189
|
+
}
|
|
18190
|
+
}, {
|
|
18191
|
+
key: "searchQuery",
|
|
18192
|
+
get: function get() {
|
|
18193
|
+
return this.state.getLatestValue().searchQuery;
|
|
18194
|
+
}
|
|
18195
|
+
}, {
|
|
18196
|
+
key: "searchSourceTypes",
|
|
18197
|
+
get: function get() {
|
|
18198
|
+
return this.sources.map(function (s) {
|
|
18199
|
+
return s.type;
|
|
18200
|
+
});
|
|
18201
|
+
}
|
|
18202
|
+
}]);
|
|
18203
|
+
|
|
18204
|
+
return SearchController;
|
|
18205
|
+
}();
|
|
18206
|
+
|
|
18207
|
+
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 };
|
|
17391
18208
|
//# sourceMappingURL=browser.es.js.map
|