stream-chat 8.55.0 → 8.56.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 +1140 -154
- 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 +1144 -153
- package/dist/browser.js.map +1 -1
- package/dist/index.es.js +1140 -154
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1144 -153
- package/dist/index.js.map +1 -1
- package/dist/types/channel.d.ts.map +1 -1
- package/dist/types/channel_manager.d.ts +111 -0
- package/dist/types/channel_manager.d.ts.map +1 -0
- package/dist/types/client.d.ts +65 -2
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/insights.d.ts +2 -2
- package/dist/types/store.d.ts +3 -1
- package/dist/types/store.d.ts.map +1 -1
- package/dist/types/types.d.ts +11 -0
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/utils.d.ts +90 -1
- package/dist/types/utils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/channel.ts +6 -7
- package/src/channel_manager.ts +581 -0
- package/src/client.ts +27 -3
- package/src/index.ts +1 -0
- package/src/store.ts +4 -3
- package/src/types.ts +12 -0
- package/src/utils.ts +280 -0
package/dist/browser.es.js
CHANGED
|
@@ -299,11 +299,11 @@ var Campaign = /*#__PURE__*/function () {
|
|
|
299
299
|
|
|
300
300
|
var https = null;
|
|
301
301
|
|
|
302
|
-
function ownKeys$
|
|
302
|
+
function ownKeys$e(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$e(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$e(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$e(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
305
305
|
|
|
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(
|
|
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(_x2) { 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(_x3) { 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
|
|
|
308
308
|
function _unsupportedIterableToArray$5(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$5(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$5(o, minLen); }
|
|
309
309
|
|
|
@@ -563,7 +563,7 @@ var axiosParamsSerializer = function axiosParamsSerializer(params) {
|
|
|
563
563
|
*/
|
|
564
564
|
|
|
565
565
|
function formatMessage(message) {
|
|
566
|
-
return _objectSpread$
|
|
566
|
+
return _objectSpread$e(_objectSpread$e({}, message), {}, {
|
|
567
567
|
/**
|
|
568
568
|
* @deprecated please use `html`
|
|
569
569
|
*/
|
|
@@ -840,7 +840,7 @@ var messagePaginationCreatedAtAround = function messagePaginationCreatedAtAround
|
|
|
840
840
|
returnedPage = _ref4.returnedPage,
|
|
841
841
|
messagePaginationOptions = _ref4.messagePaginationOptions;
|
|
842
842
|
|
|
843
|
-
var newPagination = _objectSpread$
|
|
843
|
+
var newPagination = _objectSpread$e({}, parentSet.pagination);
|
|
844
844
|
|
|
845
845
|
if (!(messagePaginationOptions !== null && messagePaginationOptions !== void 0 && messagePaginationOptions.created_at_around)) return newPagination;
|
|
846
846
|
var hasPrev;
|
|
@@ -905,7 +905,7 @@ var messagePaginationIdAround = function messagePaginationIdAround(_ref6) {
|
|
|
905
905
|
returnedPage = _ref6.returnedPage,
|
|
906
906
|
messagePaginationOptions = _ref6.messagePaginationOptions;
|
|
907
907
|
|
|
908
|
-
var newPagination = _objectSpread$
|
|
908
|
+
var newPagination = _objectSpread$e({}, parentSet.pagination);
|
|
909
909
|
|
|
910
910
|
var _ref7 = messagePaginationOptions || {},
|
|
911
911
|
id_around = _ref7.id_around;
|
|
@@ -963,7 +963,7 @@ var messagePaginationLinear = function messagePaginationLinear(_ref9) {
|
|
|
963
963
|
returnedPage = _ref9.returnedPage,
|
|
964
964
|
messagePaginationOptions = _ref9.messagePaginationOptions;
|
|
965
965
|
|
|
966
|
-
var newPagination = _objectSpread$
|
|
966
|
+
var newPagination = _objectSpread$e({}, parentSet.pagination);
|
|
967
967
|
|
|
968
968
|
var hasPrev;
|
|
969
969
|
var hasNext;
|
|
@@ -1009,6 +1009,294 @@ var messageSetPagination = function messageSetPagination(params) {
|
|
|
1009
1009
|
return messagePaginationLinear(params);
|
|
1010
1010
|
}
|
|
1011
1011
|
};
|
|
1012
|
+
/**
|
|
1013
|
+
* A utility object used to prevent duplicate invocation of channel.watch() to be triggered when
|
|
1014
|
+
* 'notification.message_new' and 'notification.added_to_channel' events arrive at the same time.
|
|
1015
|
+
*/
|
|
1016
|
+
|
|
1017
|
+
var WATCH_QUERY_IN_PROGRESS_FOR_CHANNEL = {};
|
|
1018
|
+
|
|
1019
|
+
/**
|
|
1020
|
+
* Calls channel.watch() if it was not already recently called. Waits for watch promise to resolve even if it was invoked previously.
|
|
1021
|
+
* If the channel is not passed as a property, it will get it either by its channel.cid or by its members list and do the same.
|
|
1022
|
+
* @param client
|
|
1023
|
+
* @param members
|
|
1024
|
+
* @param options
|
|
1025
|
+
* @param type
|
|
1026
|
+
* @param id
|
|
1027
|
+
* @param channel
|
|
1028
|
+
*/
|
|
1029
|
+
var getAndWatchChannel = /*#__PURE__*/function () {
|
|
1030
|
+
var _ref12 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref11) {
|
|
1031
|
+
var channel, client, id, members, options, type, channelToWatch, originalCid, queryPromise;
|
|
1032
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
1033
|
+
while (1) {
|
|
1034
|
+
switch (_context.prev = _context.next) {
|
|
1035
|
+
case 0:
|
|
1036
|
+
channel = _ref11.channel, client = _ref11.client, id = _ref11.id, members = _ref11.members, options = _ref11.options, type = _ref11.type;
|
|
1037
|
+
|
|
1038
|
+
if (!(!channel && !type)) {
|
|
1039
|
+
_context.next = 3;
|
|
1040
|
+
break;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
throw new Error('Channel or channel type have to be provided to query a channel.');
|
|
1044
|
+
|
|
1045
|
+
case 3:
|
|
1046
|
+
// unfortunately typescript is not able to infer that if (!channel && !type) === false, then channel or type has to be truthy
|
|
1047
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
1048
|
+
channelToWatch = channel || client.channel(type, id, {
|
|
1049
|
+
members: members
|
|
1050
|
+
}); // need to keep as with call to channel.watch the id can be changed from undefined to an actual ID generated server-side
|
|
1051
|
+
|
|
1052
|
+
originalCid = channelToWatch.id ? channelToWatch.cid : members && members.length ? generateChannelTempCid(channelToWatch.type, members) : undefined;
|
|
1053
|
+
|
|
1054
|
+
if (originalCid) {
|
|
1055
|
+
_context.next = 7;
|
|
1056
|
+
break;
|
|
1057
|
+
}
|
|
1058
|
+
|
|
1059
|
+
throw new Error('Channel ID or channel members array have to be provided to query a channel.');
|
|
1060
|
+
|
|
1061
|
+
case 7:
|
|
1062
|
+
queryPromise = WATCH_QUERY_IN_PROGRESS_FOR_CHANNEL[originalCid];
|
|
1063
|
+
|
|
1064
|
+
if (!queryPromise) {
|
|
1065
|
+
_context.next = 13;
|
|
1066
|
+
break;
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
_context.next = 11;
|
|
1070
|
+
return queryPromise;
|
|
1071
|
+
|
|
1072
|
+
case 11:
|
|
1073
|
+
_context.next = 20;
|
|
1074
|
+
break;
|
|
1075
|
+
|
|
1076
|
+
case 13:
|
|
1077
|
+
_context.prev = 13;
|
|
1078
|
+
WATCH_QUERY_IN_PROGRESS_FOR_CHANNEL[originalCid] = channelToWatch.watch(options);
|
|
1079
|
+
_context.next = 17;
|
|
1080
|
+
return WATCH_QUERY_IN_PROGRESS_FOR_CHANNEL[originalCid];
|
|
1081
|
+
|
|
1082
|
+
case 17:
|
|
1083
|
+
_context.prev = 17;
|
|
1084
|
+
delete WATCH_QUERY_IN_PROGRESS_FOR_CHANNEL[originalCid];
|
|
1085
|
+
return _context.finish(17);
|
|
1086
|
+
|
|
1087
|
+
case 20:
|
|
1088
|
+
return _context.abrupt("return", channelToWatch);
|
|
1089
|
+
|
|
1090
|
+
case 21:
|
|
1091
|
+
case "end":
|
|
1092
|
+
return _context.stop();
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
}, _callee, null, [[13,, 17, 20]]);
|
|
1096
|
+
}));
|
|
1097
|
+
|
|
1098
|
+
return function getAndWatchChannel(_x) {
|
|
1099
|
+
return _ref12.apply(this, arguments);
|
|
1100
|
+
};
|
|
1101
|
+
}();
|
|
1102
|
+
/**
|
|
1103
|
+
* Generates a temporary channel.cid for channels created without ID, as they need to be referenced
|
|
1104
|
+
* by an identifier until the back-end generates the final ID. The cid is generated by its member IDs
|
|
1105
|
+
* which are sorted and can be recreated the same every time given the same arguments.
|
|
1106
|
+
* @param channelType
|
|
1107
|
+
* @param members
|
|
1108
|
+
*/
|
|
1109
|
+
|
|
1110
|
+
var generateChannelTempCid = function generateChannelTempCid(channelType, members) {
|
|
1111
|
+
if (!members) return;
|
|
1112
|
+
|
|
1113
|
+
var membersStr = _toConsumableArray(members).sort().join(',');
|
|
1114
|
+
|
|
1115
|
+
if (!membersStr) return;
|
|
1116
|
+
return "".concat(channelType, ":!members-").concat(membersStr);
|
|
1117
|
+
};
|
|
1118
|
+
/**
|
|
1119
|
+
* Checks if a channel is pinned or not. Will return true only if channel.state.membership.pinned_at exists.
|
|
1120
|
+
* @param channel
|
|
1121
|
+
*/
|
|
1122
|
+
|
|
1123
|
+
var isChannelPinned = function isChannelPinned(channel) {
|
|
1124
|
+
if (!channel) return false;
|
|
1125
|
+
var member = channel.state.membership;
|
|
1126
|
+
return !!(member !== null && member !== void 0 && member.pinned_at);
|
|
1127
|
+
};
|
|
1128
|
+
/**
|
|
1129
|
+
* Checks if a channel is archived or not. Will return true only if channel.state.membership.archived_at exists.
|
|
1130
|
+
* @param channel
|
|
1131
|
+
*/
|
|
1132
|
+
|
|
1133
|
+
var isChannelArchived = function isChannelArchived(channel) {
|
|
1134
|
+
if (!channel) return false;
|
|
1135
|
+
var member = channel.state.membership;
|
|
1136
|
+
return !!(member !== null && member !== void 0 && member.archived_at);
|
|
1137
|
+
};
|
|
1138
|
+
/**
|
|
1139
|
+
* A utility that tells us whether we should consider archived channels or not based
|
|
1140
|
+
* on filters. Will return true only if filters.archived exists and is a boolean value.
|
|
1141
|
+
* @param filters
|
|
1142
|
+
*/
|
|
1143
|
+
|
|
1144
|
+
var shouldConsiderArchivedChannels = function shouldConsiderArchivedChannels(filters) {
|
|
1145
|
+
if (!filters) return false;
|
|
1146
|
+
return typeof filters.archived === 'boolean';
|
|
1147
|
+
};
|
|
1148
|
+
/**
|
|
1149
|
+
* Extracts the value of the sort parameter at a given index, for a targeted key. Can
|
|
1150
|
+
* handle both array and object versions of sort. Will return null if the index/key
|
|
1151
|
+
* combination does not exist.
|
|
1152
|
+
* @param atIndex - the index at which we'll examine the sort value, if it's an array one
|
|
1153
|
+
* @param sort - the sort value - both array and object notations are accepted
|
|
1154
|
+
* @param targetKey - the target key which needs to exist for the sort at a certain index
|
|
1155
|
+
*/
|
|
1156
|
+
|
|
1157
|
+
var extractSortValue = function extractSortValue(_ref13) {
|
|
1158
|
+
var _option$targetKey, _option;
|
|
1159
|
+
|
|
1160
|
+
var atIndex = _ref13.atIndex,
|
|
1161
|
+
sort = _ref13.sort,
|
|
1162
|
+
targetKey = _ref13.targetKey;
|
|
1163
|
+
if (!sort) return null;
|
|
1164
|
+
var option = null;
|
|
1165
|
+
|
|
1166
|
+
if (Array.isArray(sort)) {
|
|
1167
|
+
var _sort$atIndex;
|
|
1168
|
+
|
|
1169
|
+
option = (_sort$atIndex = sort[atIndex]) !== null && _sort$atIndex !== void 0 ? _sort$atIndex : null;
|
|
1170
|
+
} else {
|
|
1171
|
+
var index = 0;
|
|
1172
|
+
|
|
1173
|
+
for (var _key3 in sort) {
|
|
1174
|
+
if (index !== atIndex) {
|
|
1175
|
+
index++;
|
|
1176
|
+
continue;
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
if (_key3 !== targetKey) {
|
|
1180
|
+
return null;
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
option = sort;
|
|
1184
|
+
break;
|
|
1185
|
+
}
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
return (_option$targetKey = (_option = option) === null || _option === void 0 ? void 0 : _option[targetKey]) !== null && _option$targetKey !== void 0 ? _option$targetKey : null;
|
|
1189
|
+
};
|
|
1190
|
+
/**
|
|
1191
|
+
* Returns true only if `{ pinned_at: -1 }` or `{ pinned_at: 1 }` option is first within the `sort` array.
|
|
1192
|
+
*/
|
|
1193
|
+
|
|
1194
|
+
var shouldConsiderPinnedChannels = function shouldConsiderPinnedChannels(sort) {
|
|
1195
|
+
var value = findPinnedAtSortOrder({
|
|
1196
|
+
sort: sort
|
|
1197
|
+
});
|
|
1198
|
+
if (typeof value !== 'number') return false;
|
|
1199
|
+
return Math.abs(value) === 1;
|
|
1200
|
+
};
|
|
1201
|
+
/**
|
|
1202
|
+
* Checks whether the sort value of type object contains a pinned_at value or if
|
|
1203
|
+
* an array sort value type has the first value be an object containing pinned_at.
|
|
1204
|
+
* @param sort
|
|
1205
|
+
*/
|
|
1206
|
+
|
|
1207
|
+
var findPinnedAtSortOrder = function findPinnedAtSortOrder(_ref14) {
|
|
1208
|
+
var sort = _ref14.sort;
|
|
1209
|
+
return extractSortValue({
|
|
1210
|
+
atIndex: 0,
|
|
1211
|
+
sort: sort,
|
|
1212
|
+
targetKey: 'pinned_at'
|
|
1213
|
+
});
|
|
1214
|
+
};
|
|
1215
|
+
/**
|
|
1216
|
+
* Finds the index of the last consecutively pinned channel, starting from the start of the
|
|
1217
|
+
* array. Will not consider any pinned channels after the contiguous subsequence at the
|
|
1218
|
+
* start of the array.
|
|
1219
|
+
* @param channels
|
|
1220
|
+
*/
|
|
1221
|
+
|
|
1222
|
+
var findLastPinnedChannelIndex = function findLastPinnedChannelIndex(_ref15) {
|
|
1223
|
+
var channels = _ref15.channels;
|
|
1224
|
+
var lastPinnedChannelIndex = null;
|
|
1225
|
+
|
|
1226
|
+
var _iterator2 = _createForOfIteratorHelper$5(channels),
|
|
1227
|
+
_step2;
|
|
1228
|
+
|
|
1229
|
+
try {
|
|
1230
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
1231
|
+
var channel = _step2.value;
|
|
1232
|
+
if (!isChannelPinned(channel)) break;
|
|
1233
|
+
|
|
1234
|
+
if (typeof lastPinnedChannelIndex === 'number') {
|
|
1235
|
+
lastPinnedChannelIndex++;
|
|
1236
|
+
} else {
|
|
1237
|
+
lastPinnedChannelIndex = 0;
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
} catch (err) {
|
|
1241
|
+
_iterator2.e(err);
|
|
1242
|
+
} finally {
|
|
1243
|
+
_iterator2.f();
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
return lastPinnedChannelIndex;
|
|
1247
|
+
};
|
|
1248
|
+
/**
|
|
1249
|
+
* A utility used to move a channel towards the beginning of a list of channels (promote it to a higher position). It
|
|
1250
|
+
* considers pinned channels in the process if needed and makes sure to only update the list reference if the list
|
|
1251
|
+
* should actually change. It will try to move the channel as high as it can within the list.
|
|
1252
|
+
* @param channels - the list of channels we want to modify
|
|
1253
|
+
* @param channelToMove - the channel we want to promote
|
|
1254
|
+
* @param channelToMoveIndexWithinChannels - optionally, the index of the channel we want to move if we know it (will skip a manual check)
|
|
1255
|
+
* @param sort - the sort value used to check for pinned channels
|
|
1256
|
+
*/
|
|
1257
|
+
|
|
1258
|
+
var promoteChannel = function promoteChannel(_ref16) {
|
|
1259
|
+
var channels = _ref16.channels,
|
|
1260
|
+
channelToMove = _ref16.channelToMove,
|
|
1261
|
+
channelToMoveIndexWithinChannels = _ref16.channelToMoveIndexWithinChannels,
|
|
1262
|
+
sort = _ref16.sort;
|
|
1263
|
+
// get index of channel to move up
|
|
1264
|
+
var targetChannelIndex = channelToMoveIndexWithinChannels !== null && channelToMoveIndexWithinChannels !== void 0 ? channelToMoveIndexWithinChannels : channels.findIndex(function (channel) {
|
|
1265
|
+
return channel.cid === channelToMove.cid;
|
|
1266
|
+
});
|
|
1267
|
+
var targetChannelExistsWithinList = targetChannelIndex >= 0;
|
|
1268
|
+
var targetChannelAlreadyAtTheTop = targetChannelIndex === 0; // pinned channels should not move within the list based on recent activity, channels which
|
|
1269
|
+
// receive messages and are not pinned should move upwards but only under the last pinned channel
|
|
1270
|
+
// in the list
|
|
1271
|
+
|
|
1272
|
+
var considerPinnedChannels = shouldConsiderPinnedChannels(sort);
|
|
1273
|
+
var isTargetChannelPinned = isChannelPinned(channelToMove);
|
|
1274
|
+
|
|
1275
|
+
if (targetChannelAlreadyAtTheTop || considerPinnedChannels && isTargetChannelPinned) {
|
|
1276
|
+
return channels;
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
var newChannels = _toConsumableArray(channels); // target channel index is known, remove it from the list
|
|
1280
|
+
|
|
1281
|
+
|
|
1282
|
+
if (targetChannelExistsWithinList) {
|
|
1283
|
+
newChannels.splice(targetChannelIndex, 1);
|
|
1284
|
+
} // as position of pinned channels has to stay unchanged, we need to
|
|
1285
|
+
// find last pinned channel in the list to move the target channel after
|
|
1286
|
+
|
|
1287
|
+
|
|
1288
|
+
var lastPinnedChannelIndex = null;
|
|
1289
|
+
|
|
1290
|
+
if (considerPinnedChannels) {
|
|
1291
|
+
lastPinnedChannelIndex = findLastPinnedChannelIndex({
|
|
1292
|
+
channels: newChannels
|
|
1293
|
+
});
|
|
1294
|
+
} // re-insert it at the new place (to specific index if pinned channels are considered)
|
|
1295
|
+
|
|
1296
|
+
|
|
1297
|
+
newChannels.splice(typeof lastPinnedChannelIndex === 'number' ? lastPinnedChannelIndex + 1 : 0, 0, channelToMove);
|
|
1298
|
+
return newChannels;
|
|
1299
|
+
};
|
|
1012
1300
|
|
|
1013
1301
|
var DEFAULT_QUERY_CHANNELS_MESSAGE_LIST_PAGE_SIZE = 25;
|
|
1014
1302
|
var DEFAULT_QUERY_CHANNEL_MESSAGE_LIST_PAGE_SIZE = 100;
|
|
@@ -1017,9 +1305,9 @@ var DEFAULT_MESSAGE_SET_PAGINATION = {
|
|
|
1017
1305
|
hasPrev: false
|
|
1018
1306
|
};
|
|
1019
1307
|
|
|
1020
|
-
function ownKeys$
|
|
1308
|
+
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; }
|
|
1021
1309
|
|
|
1022
|
-
function _objectSpread$
|
|
1310
|
+
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; }
|
|
1023
1311
|
|
|
1024
1312
|
/**
|
|
1025
1313
|
* ChannelState - A container class for the channel state.
|
|
@@ -1100,7 +1388,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
1100
1388
|
var m = messages[i];
|
|
1101
1389
|
|
|
1102
1390
|
if (((_m$user = m.user) === null || _m$user === void 0 ? void 0 : _m$user.id) === user.id) {
|
|
1103
|
-
messages[i] = _objectSpread$
|
|
1391
|
+
messages[i] = _objectSpread$d(_objectSpread$d({}, m), {}, {
|
|
1104
1392
|
user: user
|
|
1105
1393
|
});
|
|
1106
1394
|
}
|
|
@@ -1155,7 +1443,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
1155
1443
|
user: m.user
|
|
1156
1444
|
};
|
|
1157
1445
|
} else {
|
|
1158
|
-
messages[i] = _objectSpread$
|
|
1446
|
+
messages[i] = _objectSpread$d(_objectSpread$d({}, m), {}, {
|
|
1159
1447
|
type: 'deleted',
|
|
1160
1448
|
deleted_at: user.deleted_at ? new Date(user.deleted_at) : null
|
|
1161
1449
|
});
|
|
@@ -1473,7 +1761,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
1473
1761
|
var parseMessage = function parseMessage(m) {
|
|
1474
1762
|
var _m$pinned_at, _m$updated_at;
|
|
1475
1763
|
|
|
1476
|
-
return _objectSpread$
|
|
1764
|
+
return _objectSpread$d(_objectSpread$d({}, m), {}, {
|
|
1477
1765
|
created_at: m.created_at.toISOString(),
|
|
1478
1766
|
pinned_at: (_m$pinned_at = m.pinned_at) === null || _m$pinned_at === void 0 ? void 0 : _m$pinned_at.toISOString(),
|
|
1479
1767
|
updated_at: (_m$updated_at = m.updated_at) === null || _m$updated_at === void 0 ? void 0 : _m$updated_at.toISOString()
|
|
@@ -1483,8 +1771,8 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
1483
1771
|
var update = function update(messages) {
|
|
1484
1772
|
var updatedMessages = messages.reduce(function (acc, msg) {
|
|
1485
1773
|
if (msg.quoted_message_id === message.id) {
|
|
1486
|
-
acc.push(_objectSpread$
|
|
1487
|
-
quoted_message: remove ? _objectSpread$
|
|
1774
|
+
acc.push(_objectSpread$d(_objectSpread$d({}, parseMessage(msg)), {}, {
|
|
1775
|
+
quoted_message: remove ? _objectSpread$d(_objectSpread$d({}, message), {}, {
|
|
1488
1776
|
attachments: []
|
|
1489
1777
|
}) : message
|
|
1490
1778
|
}));
|
|
@@ -1973,9 +2261,9 @@ function _unsupportedIterableToArray$4(o, minLen) { if (!o) return; if (typeof o
|
|
|
1973
2261
|
|
|
1974
2262
|
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; }
|
|
1975
2263
|
|
|
1976
|
-
function ownKeys$
|
|
2264
|
+
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; }
|
|
1977
2265
|
|
|
1978
|
-
function _objectSpread$
|
|
2266
|
+
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; }
|
|
1979
2267
|
/**
|
|
1980
2268
|
* Channel - The Channel class manages it's own state.
|
|
1981
2269
|
*/
|
|
@@ -2050,7 +2338,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2050
2338
|
while (1) {
|
|
2051
2339
|
switch (_context.prev = _context.next) {
|
|
2052
2340
|
case 0:
|
|
2053
|
-
defaultOptions = _objectSpread$
|
|
2341
|
+
defaultOptions = _objectSpread$c(_objectSpread$c({}, options), {}, {
|
|
2054
2342
|
watch: false,
|
|
2055
2343
|
state: false,
|
|
2056
2344
|
presence: false
|
|
@@ -2122,7 +2410,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2122
2410
|
|
|
2123
2411
|
this.data = data; // this._data is used for the requests...
|
|
2124
2412
|
|
|
2125
|
-
this._data = _objectSpread$
|
|
2413
|
+
this._data = _objectSpread$c({}, data);
|
|
2126
2414
|
this.cid = "".concat(type, ":").concat(id);
|
|
2127
2415
|
this.listeners = {}; // perhaps the state variable should be private
|
|
2128
2416
|
|
|
@@ -2184,7 +2472,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2184
2472
|
switch (_context2.prev = _context2.next) {
|
|
2185
2473
|
case 0:
|
|
2186
2474
|
_context2.next = 2;
|
|
2187
|
-
return this.getClient().post(this._channelURL() + '/message', _objectSpread$
|
|
2475
|
+
return this.getClient().post(this._channelURL() + '/message', _objectSpread$c({
|
|
2188
2476
|
message: message
|
|
2189
2477
|
}, options));
|
|
2190
2478
|
|
|
@@ -2300,7 +2588,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2300
2588
|
|
|
2301
2589
|
case 3:
|
|
2302
2590
|
// Return a list of channels
|
|
2303
|
-
payload = _objectSpread$
|
|
2591
|
+
payload = _objectSpread$c(_objectSpread$c({
|
|
2304
2592
|
filter_conditions: {
|
|
2305
2593
|
cid: this.cid
|
|
2306
2594
|
}
|
|
@@ -2397,7 +2685,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2397
2685
|
|
|
2398
2686
|
_context5.next = 6;
|
|
2399
2687
|
return this.getClient().get(this.getClient().baseURL + '/members', {
|
|
2400
|
-
payload: _objectSpread$
|
|
2688
|
+
payload: _objectSpread$c({
|
|
2401
2689
|
type: type,
|
|
2402
2690
|
id: id,
|
|
2403
2691
|
members: members,
|
|
@@ -2503,7 +2791,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2503
2791
|
|
|
2504
2792
|
case 4:
|
|
2505
2793
|
_context7.next = 6;
|
|
2506
|
-
return this.getClient().post(this.getClient().baseURL + "/messages/".concat(encodeURIComponent(messageID), "/reaction"), _objectSpread$
|
|
2794
|
+
return this.getClient().post(this.getClient().baseURL + "/messages/".concat(encodeURIComponent(messageID), "/reaction"), _objectSpread$c({
|
|
2507
2795
|
reaction: reaction
|
|
2508
2796
|
}, options));
|
|
2509
2797
|
|
|
@@ -2584,7 +2872,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2584
2872
|
delete channelData[key];
|
|
2585
2873
|
});
|
|
2586
2874
|
_context8.next = 7;
|
|
2587
|
-
return this._update(_objectSpread$
|
|
2875
|
+
return this._update(_objectSpread$c({
|
|
2588
2876
|
message: updateMessage,
|
|
2589
2877
|
data: channelData
|
|
2590
2878
|
}, options));
|
|
@@ -2756,7 +3044,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2756
3044
|
case 0:
|
|
2757
3045
|
options = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : {};
|
|
2758
3046
|
_context12.next = 3;
|
|
2759
|
-
return this.getClient().delete(this._channelURL(), _objectSpread$
|
|
3047
|
+
return this.getClient().delete(this._channelURL(), _objectSpread$c({}, options));
|
|
2760
3048
|
|
|
2761
3049
|
case 3:
|
|
2762
3050
|
return _context12.abrupt("return", _context12.sent);
|
|
@@ -2832,7 +3120,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2832
3120
|
case 0:
|
|
2833
3121
|
options = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {};
|
|
2834
3122
|
_context14.next = 3;
|
|
2835
|
-
return this._update(_objectSpread$
|
|
3123
|
+
return this._update(_objectSpread$c({
|
|
2836
3124
|
accept_invite: true
|
|
2837
3125
|
}, options));
|
|
2838
3126
|
|
|
@@ -2873,7 +3161,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2873
3161
|
case 0:
|
|
2874
3162
|
options = _args15.length > 0 && _args15[0] !== undefined ? _args15[0] : {};
|
|
2875
3163
|
_context15.next = 3;
|
|
2876
|
-
return this._update(_objectSpread$
|
|
3164
|
+
return this._update(_objectSpread$c({
|
|
2877
3165
|
reject_invite: true
|
|
2878
3166
|
}, options));
|
|
2879
3167
|
|
|
@@ -2915,7 +3203,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2915
3203
|
case 0:
|
|
2916
3204
|
options = _args16.length > 2 && _args16[2] !== undefined ? _args16[2] : {};
|
|
2917
3205
|
_context16.next = 3;
|
|
2918
|
-
return this._update(_objectSpread$
|
|
3206
|
+
return this._update(_objectSpread$c({
|
|
2919
3207
|
add_members: members,
|
|
2920
3208
|
message: message
|
|
2921
3209
|
}, options));
|
|
@@ -2958,7 +3246,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2958
3246
|
case 0:
|
|
2959
3247
|
options = _args17.length > 2 && _args17[2] !== undefined ? _args17[2] : {};
|
|
2960
3248
|
_context17.next = 3;
|
|
2961
|
-
return this._update(_objectSpread$
|
|
3249
|
+
return this._update(_objectSpread$c({
|
|
2962
3250
|
add_moderators: members,
|
|
2963
3251
|
message: message
|
|
2964
3252
|
}, options));
|
|
@@ -3001,7 +3289,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3001
3289
|
case 0:
|
|
3002
3290
|
options = _args18.length > 2 && _args18[2] !== undefined ? _args18[2] : {};
|
|
3003
3291
|
_context18.next = 3;
|
|
3004
|
-
return this._update(_objectSpread$
|
|
3292
|
+
return this._update(_objectSpread$c({
|
|
3005
3293
|
assign_roles: roles,
|
|
3006
3294
|
message: message
|
|
3007
3295
|
}, options));
|
|
@@ -3044,7 +3332,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3044
3332
|
case 0:
|
|
3045
3333
|
options = _args19.length > 2 && _args19[2] !== undefined ? _args19[2] : {};
|
|
3046
3334
|
_context19.next = 3;
|
|
3047
|
-
return this._update(_objectSpread$
|
|
3335
|
+
return this._update(_objectSpread$c({
|
|
3048
3336
|
invites: members,
|
|
3049
3337
|
message: message
|
|
3050
3338
|
}, options));
|
|
@@ -3087,7 +3375,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3087
3375
|
case 0:
|
|
3088
3376
|
options = _args20.length > 2 && _args20[2] !== undefined ? _args20[2] : {};
|
|
3089
3377
|
_context20.next = 3;
|
|
3090
|
-
return this._update(_objectSpread$
|
|
3378
|
+
return this._update(_objectSpread$c({
|
|
3091
3379
|
remove_members: members,
|
|
3092
3380
|
message: message
|
|
3093
3381
|
}, options));
|
|
@@ -3130,7 +3418,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3130
3418
|
case 0:
|
|
3131
3419
|
options = _args21.length > 2 && _args21[2] !== undefined ? _args21[2] : {};
|
|
3132
3420
|
_context21.next = 3;
|
|
3133
|
-
return this._update(_objectSpread$
|
|
3421
|
+
return this._update(_objectSpread$c({
|
|
3134
3422
|
demote_moderators: members,
|
|
3135
3423
|
message: message
|
|
3136
3424
|
}, options));
|
|
@@ -3215,7 +3503,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3215
3503
|
case 0:
|
|
3216
3504
|
opts = _args23.length > 0 && _args23[0] !== undefined ? _args23[0] : {};
|
|
3217
3505
|
_context23.next = 3;
|
|
3218
|
-
return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$
|
|
3506
|
+
return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$c({
|
|
3219
3507
|
channel_cid: this.cid
|
|
3220
3508
|
}, opts));
|
|
3221
3509
|
|
|
@@ -3257,7 +3545,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3257
3545
|
case 0:
|
|
3258
3546
|
opts = _args24.length > 0 && _args24[0] !== undefined ? _args24[0] : {};
|
|
3259
3547
|
_context24.next = 3;
|
|
3260
|
-
return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$
|
|
3548
|
+
return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$c({
|
|
3261
3549
|
channel_cid: this.cid
|
|
3262
3550
|
}, opts));
|
|
3263
3551
|
|
|
@@ -3594,7 +3882,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3594
3882
|
|
|
3595
3883
|
this.lastTypingEvent = new Date();
|
|
3596
3884
|
_context29.next = 10;
|
|
3597
|
-
return this.sendEvent(_objectSpread$
|
|
3885
|
+
return this.sendEvent(_objectSpread$c({
|
|
3598
3886
|
type: 'typing.start',
|
|
3599
3887
|
parent_id: parent_id
|
|
3600
3888
|
}, options || {}));
|
|
@@ -3634,7 +3922,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3634
3922
|
case 0:
|
|
3635
3923
|
options = _args30.length > 2 && _args30[2] !== undefined ? _args30[2] : {};
|
|
3636
3924
|
_context30.next = 3;
|
|
3637
|
-
return this.sendEvent(_objectSpread$
|
|
3925
|
+
return this.sendEvent(_objectSpread$c(_objectSpread$c({}, options), {}, {
|
|
3638
3926
|
type: 'ai_indicator.update',
|
|
3639
3927
|
message_id: messageId,
|
|
3640
3928
|
ai_state: state
|
|
@@ -3743,7 +4031,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3743
4031
|
this.lastTypingEvent = null;
|
|
3744
4032
|
this.isTyping = false;
|
|
3745
4033
|
_context33.next = 6;
|
|
3746
|
-
return this.sendEvent(_objectSpread$
|
|
4034
|
+
return this.sendEvent(_objectSpread$c({
|
|
3747
4035
|
type: 'typing.stop',
|
|
3748
4036
|
parent_id: parent_id
|
|
3749
4037
|
}, options || {}));
|
|
@@ -3830,7 +4118,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3830
4118
|
|
|
3831
4119
|
case 4:
|
|
3832
4120
|
_context34.next = 6;
|
|
3833
|
-
return this.getClient().post(this._channelURL() + '/read', _objectSpread$
|
|
4121
|
+
return this.getClient().post(this._channelURL() + '/read', _objectSpread$c({}, data));
|
|
3834
4122
|
|
|
3835
4123
|
case 6:
|
|
3836
4124
|
return _context34.abrupt("return", _context34.sent);
|
|
@@ -3877,7 +4165,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3877
4165
|
|
|
3878
4166
|
case 3:
|
|
3879
4167
|
_context35.next = 5;
|
|
3880
|
-
return this.getClient().post(this._channelURL() + '/unread', _objectSpread$
|
|
4168
|
+
return this.getClient().post(this._channelURL() + '/unread', _objectSpread$c({}, data));
|
|
3881
4169
|
|
|
3882
4170
|
case 5:
|
|
3883
4171
|
return _context35.abrupt("return", _context35.sent);
|
|
@@ -3945,7 +4233,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3945
4233
|
defaultOptions.watch = false;
|
|
3946
4234
|
}
|
|
3947
4235
|
|
|
3948
|
-
combined = _objectSpread$
|
|
4236
|
+
combined = _objectSpread$c(_objectSpread$c({}, defaultOptions), options);
|
|
3949
4237
|
_context36.next = 7;
|
|
3950
4238
|
return this.query(combined, 'latest');
|
|
3951
4239
|
|
|
@@ -4039,7 +4327,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4039
4327
|
case 0:
|
|
4040
4328
|
normalizedSort = sort ? normalizeQuerySort(sort) : undefined;
|
|
4041
4329
|
_context38.next = 3;
|
|
4042
|
-
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(encodeURIComponent(parent_id), "/replies"), _objectSpread$
|
|
4330
|
+
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(encodeURIComponent(parent_id), "/replies"), _objectSpread$c({
|
|
4043
4331
|
sort: normalizedSort
|
|
4044
4332
|
}, options));
|
|
4045
4333
|
|
|
@@ -4089,7 +4377,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4089
4377
|
sort = _args39.length > 1 && _args39[1] !== undefined ? _args39[1] : [];
|
|
4090
4378
|
_context39.next = 3;
|
|
4091
4379
|
return this.getClient().get(this._channelURL() + '/pinned_messages', {
|
|
4092
|
-
payload: _objectSpread$
|
|
4380
|
+
payload: _objectSpread$c(_objectSpread$c({}, options), {}, {
|
|
4093
4381
|
sort: normalizeQuerySort(sort)
|
|
4094
4382
|
})
|
|
4095
4383
|
});
|
|
@@ -4123,7 +4411,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4123
4411
|
}, {
|
|
4124
4412
|
key: "getReactions",
|
|
4125
4413
|
value: function getReactions(message_id, options) {
|
|
4126
|
-
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(encodeURIComponent(message_id), "/reactions"), _objectSpread$
|
|
4414
|
+
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(encodeURIComponent(message_id), "/reactions"), _objectSpread$c({}, options));
|
|
4127
4415
|
}
|
|
4128
4416
|
/**
|
|
4129
4417
|
* getMessagesById - Retrieves a list of messages by ID
|
|
@@ -4247,7 +4535,6 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4247
4535
|
var messageSetToAddToIfDoesNotExist,
|
|
4248
4536
|
queryURL,
|
|
4249
4537
|
state,
|
|
4250
|
-
membersStr,
|
|
4251
4538
|
tempChannelCid,
|
|
4252
4539
|
_this$_initializeStat,
|
|
4253
4540
|
messageSet,
|
|
@@ -4270,7 +4557,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4270
4557
|
}
|
|
4271
4558
|
|
|
4272
4559
|
_context40.next = 7;
|
|
4273
|
-
return this.getClient().post(queryURL + '/query', _objectSpread$
|
|
4560
|
+
return this.getClient().post(queryURL + '/query', _objectSpread$c({
|
|
4274
4561
|
data: this._data,
|
|
4275
4562
|
state: true
|
|
4276
4563
|
}, options));
|
|
@@ -4283,14 +4570,13 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4283
4570
|
this.id = state.channel.id;
|
|
4284
4571
|
this.cid = state.channel.cid; // set the channel as active...
|
|
4285
4572
|
|
|
4286
|
-
|
|
4573
|
+
tempChannelCid = generateChannelTempCid(this.type, state.members.map(function (member) {
|
|
4287
4574
|
var _member$user;
|
|
4288
4575
|
|
|
4289
|
-
return member.user_id || ((_member$user = member.user) === null || _member$user === void 0 ? void 0 : _member$user.id);
|
|
4290
|
-
})
|
|
4291
|
-
tempChannelCid = "".concat(this.type, ":!members-").concat(membersStr);
|
|
4576
|
+
return member.user_id || ((_member$user = member.user) === null || _member$user === void 0 ? void 0 : _member$user.id) || '';
|
|
4577
|
+
}));
|
|
4292
4578
|
|
|
4293
|
-
if (tempChannelCid in this.getClient().activeChannels) {
|
|
4579
|
+
if (tempChannelCid && tempChannelCid in this.getClient().activeChannels) {
|
|
4294
4580
|
// This gets set in `client.channel()` function, when channel is created
|
|
4295
4581
|
// using members, not id.
|
|
4296
4582
|
delete this.getClient().activeChannels[tempChannelCid];
|
|
@@ -4305,7 +4591,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4305
4591
|
|
|
4306
4592
|
|
|
4307
4593
|
_this$_initializeStat = this._initializeState(state, messageSetToAddToIfDoesNotExist), messageSet = _this$_initializeStat.messageSet;
|
|
4308
|
-
messageSet.pagination = _objectSpread$
|
|
4594
|
+
messageSet.pagination = _objectSpread$c(_objectSpread$c({}, messageSet.pagination), messageSetPagination({
|
|
4309
4595
|
parentSet: messageSet,
|
|
4310
4596
|
messagePaginationOptions: options === null || options === void 0 ? void 0 : options.messages,
|
|
4311
4597
|
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,
|
|
@@ -4367,7 +4653,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4367
4653
|
this._checkInitialized();
|
|
4368
4654
|
|
|
4369
4655
|
_context41.next = 3;
|
|
4370
|
-
return this.getClient().banUser(targetUserID, _objectSpread$
|
|
4656
|
+
return this.getClient().banUser(targetUserID, _objectSpread$c(_objectSpread$c({}, options), {}, {
|
|
4371
4657
|
type: this.type,
|
|
4372
4658
|
id: this.id
|
|
4373
4659
|
}));
|
|
@@ -4539,7 +4825,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4539
4825
|
this._checkInitialized();
|
|
4540
4826
|
|
|
4541
4827
|
_context45.next = 3;
|
|
4542
|
-
return this.getClient().shadowBan(targetUserID, _objectSpread$
|
|
4828
|
+
return this.getClient().shadowBan(targetUserID, _objectSpread$c(_objectSpread$c({}, options), {}, {
|
|
4543
4829
|
type: this.type,
|
|
4544
4830
|
id: this.id
|
|
4545
4831
|
}));
|
|
@@ -4944,7 +5230,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4944
5230
|
case 'member.added':
|
|
4945
5231
|
case 'member.updated':
|
|
4946
5232
|
if ((_event$member = event.member) !== null && _event$member !== void 0 && _event$member.user) {
|
|
4947
|
-
channelState.members = _objectSpread$
|
|
5233
|
+
channelState.members = _objectSpread$c(_objectSpread$c({}, channelState.members), {}, _defineProperty({}, event.member.user.id, event.member));
|
|
4948
5234
|
}
|
|
4949
5235
|
|
|
4950
5236
|
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) {
|
|
@@ -4955,7 +5241,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4955
5241
|
|
|
4956
5242
|
case 'member.removed':
|
|
4957
5243
|
if ((_event$user9 = event.user) !== null && _event$user9 !== void 0 && _event$user9.id) {
|
|
4958
|
-
var newMembers = _objectSpread$
|
|
5244
|
+
var newMembers = _objectSpread$c({}, channelState.members);
|
|
4959
5245
|
|
|
4960
5246
|
delete newMembers[event.user.id];
|
|
4961
5247
|
channelState.members = newMembers; // TODO?: unset membership
|
|
@@ -5000,7 +5286,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
5000
5286
|
});
|
|
5001
5287
|
}
|
|
5002
5288
|
|
|
5003
|
-
channel.data = _objectSpread$
|
|
5289
|
+
channel.data = _objectSpread$c(_objectSpread$c({}, event.channel), {}, {
|
|
5004
5290
|
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,
|
|
5005
5291
|
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
|
|
5006
5292
|
});
|
|
@@ -5031,7 +5317,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
5031
5317
|
break;
|
|
5032
5318
|
|
|
5033
5319
|
case 'channel.hidden':
|
|
5034
|
-
channel.data = _objectSpread$
|
|
5320
|
+
channel.data = _objectSpread$c(_objectSpread$c({}, channel.data), {}, {
|
|
5035
5321
|
hidden: true
|
|
5036
5322
|
});
|
|
5037
5323
|
|
|
@@ -5042,26 +5328,26 @@ var Channel = /*#__PURE__*/function () {
|
|
|
5042
5328
|
break;
|
|
5043
5329
|
|
|
5044
5330
|
case 'channel.visible':
|
|
5045
|
-
channel.data = _objectSpread$
|
|
5331
|
+
channel.data = _objectSpread$c(_objectSpread$c({}, channel.data), {}, {
|
|
5046
5332
|
hidden: false
|
|
5047
5333
|
});
|
|
5048
5334
|
break;
|
|
5049
5335
|
|
|
5050
5336
|
case 'user.banned':
|
|
5051
5337
|
if (!((_event$user11 = event.user) !== null && _event$user11 !== void 0 && _event$user11.id)) break;
|
|
5052
|
-
channelState.members[event.user.id] = _objectSpread$
|
|
5338
|
+
channelState.members[event.user.id] = _objectSpread$c(_objectSpread$c({}, channelState.members[event.user.id] || {}), {}, {
|
|
5053
5339
|
shadow_banned: !!event.shadow,
|
|
5054
5340
|
banned: !event.shadow,
|
|
5055
|
-
user: _objectSpread$
|
|
5341
|
+
user: _objectSpread$c(_objectSpread$c({}, ((_channelState$members2 = channelState.members[event.user.id]) === null || _channelState$members2 === void 0 ? void 0 : _channelState$members2.user) || {}), event.user)
|
|
5056
5342
|
});
|
|
5057
5343
|
break;
|
|
5058
5344
|
|
|
5059
5345
|
case 'user.unbanned':
|
|
5060
5346
|
if (!((_event$user12 = event.user) !== null && _event$user12 !== void 0 && _event$user12.id)) break;
|
|
5061
|
-
channelState.members[event.user.id] = _objectSpread$
|
|
5347
|
+
channelState.members[event.user.id] = _objectSpread$c(_objectSpread$c({}, channelState.members[event.user.id] || {}), {}, {
|
|
5062
5348
|
shadow_banned: false,
|
|
5063
5349
|
banned: false,
|
|
5064
|
-
user: _objectSpread$
|
|
5350
|
+
user: _objectSpread$c(_objectSpread$c({}, ((_channelState$members3 = channelState.members[event.user.id]) === null || _channelState$members3 === void 0 ? void 0 : _channelState$members3.user) || {}), event.user)
|
|
5065
5351
|
});
|
|
5066
5352
|
break;
|
|
5067
5353
|
} // any event can send over the online count
|
|
@@ -5235,7 +5521,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
5235
5521
|
if (overrideCurrentState) {
|
|
5236
5522
|
this.state.members = newMembersById;
|
|
5237
5523
|
} else if (!overrideCurrentState && members.length) {
|
|
5238
|
-
this.state.members = _objectSpread$
|
|
5524
|
+
this.state.members = _objectSpread$c(_objectSpread$c({}, this.state.members), newMembersById);
|
|
5239
5525
|
}
|
|
5240
5526
|
}
|
|
5241
5527
|
}, {
|
|
@@ -5334,9 +5620,9 @@ var ClientState = /*#__PURE__*/function () {
|
|
|
5334
5620
|
return ClientState;
|
|
5335
5621
|
}();
|
|
5336
5622
|
|
|
5337
|
-
function ownKeys$
|
|
5623
|
+
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; }
|
|
5338
5624
|
|
|
5339
|
-
function _objectSpread$
|
|
5625
|
+
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; }
|
|
5340
5626
|
var InsightMetrics = function InsightMetrics() {
|
|
5341
5627
|
_classCallCheck(this, InsightMetrics);
|
|
5342
5628
|
|
|
@@ -5415,7 +5701,7 @@ var postInsights = /*#__PURE__*/function () {
|
|
|
5415
5701
|
};
|
|
5416
5702
|
}();
|
|
5417
5703
|
function buildWsFatalInsight(connection, event) {
|
|
5418
|
-
return _objectSpread$
|
|
5704
|
+
return _objectSpread$b(_objectSpread$b({}, event), buildWsBaseInsight(connection));
|
|
5419
5705
|
}
|
|
5420
5706
|
|
|
5421
5707
|
function buildWsBaseInsight(connection) {
|
|
@@ -5448,9 +5734,9 @@ function buildWsSuccessAfterFailureInsight(connection) {
|
|
|
5448
5734
|
return buildWsBaseInsight(connection);
|
|
5449
5735
|
}
|
|
5450
5736
|
|
|
5451
|
-
function ownKeys$
|
|
5737
|
+
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; }
|
|
5452
5738
|
|
|
5453
|
-
function _objectSpread$
|
|
5739
|
+
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; }
|
|
5454
5740
|
|
|
5455
5741
|
// Type guards to check WebSocket error type
|
|
5456
5742
|
var isCloseEvent = function isCloseEvent(res) {
|
|
@@ -5814,7 +6100,7 @@ var StableWSConnection = /*#__PURE__*/function () {
|
|
|
5814
6100
|
value: function _log(msg) {
|
|
5815
6101
|
var extra = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
5816
6102
|
var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'info';
|
|
5817
|
-
this.client.logger(level, 'connection:' + msg, _objectSpread$
|
|
6103
|
+
this.client.logger(level, 'connection:' + msg, _objectSpread$a({
|
|
5818
6104
|
tags: ['connection']
|
|
5819
6105
|
}, extra));
|
|
5820
6106
|
}
|
|
@@ -6409,9 +6695,9 @@ var jwt = null;
|
|
|
6409
6695
|
|
|
6410
6696
|
var crypto$1 = null;
|
|
6411
6697
|
|
|
6412
|
-
function ownKeys$
|
|
6698
|
+
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; }
|
|
6413
6699
|
|
|
6414
|
-
function _objectSpread$
|
|
6700
|
+
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; }
|
|
6415
6701
|
|
|
6416
6702
|
/**
|
|
6417
6703
|
* Creates the JWT token that can be used for a UserSession
|
|
@@ -6432,7 +6718,7 @@ function JWTUserToken(apiSecret, userId) {
|
|
|
6432
6718
|
throw new TypeError('userId should be a string');
|
|
6433
6719
|
}
|
|
6434
6720
|
|
|
6435
|
-
var payload = _objectSpread$
|
|
6721
|
+
var payload = _objectSpread$9({
|
|
6436
6722
|
user_id: userId
|
|
6437
6723
|
}, extraData); // make sure we return a clear error when jwt is shimmed (ie. browser build)
|
|
6438
6724
|
|
|
@@ -6838,9 +7124,9 @@ function isErrorResponse(res) {
|
|
|
6838
7124
|
return !res.status || res.status < 200 || 300 <= res.status;
|
|
6839
7125
|
}
|
|
6840
7126
|
|
|
6841
|
-
function ownKeys$
|
|
7127
|
+
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; }
|
|
6842
7128
|
|
|
6843
|
-
function _objectSpread$
|
|
7129
|
+
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; }
|
|
6844
7130
|
var ConnectionState;
|
|
6845
7131
|
|
|
6846
7132
|
(function (ConnectionState) {
|
|
@@ -6903,7 +7189,7 @@ var WSConnectionFallback = /*#__PURE__*/function () {
|
|
|
6903
7189
|
_context.next = 4;
|
|
6904
7190
|
return _this.client.doAxiosRequest('get', _this.client.baseURL.replace(':3030', ':8900') + '/longpoll', // replace port if present for testing with local API
|
|
6905
7191
|
undefined, {
|
|
6906
|
-
config: _objectSpread$
|
|
7192
|
+
config: _objectSpread$8(_objectSpread$8({}, config), {}, {
|
|
6907
7193
|
cancelToken: (_this$cancelToken2 = _this.cancelToken) === null || _this$cancelToken2 === void 0 ? void 0 : _this$cancelToken2.token
|
|
6908
7194
|
}),
|
|
6909
7195
|
params: params
|
|
@@ -7181,7 +7467,7 @@ var WSConnectionFallback = /*#__PURE__*/function () {
|
|
|
7181
7467
|
value: function _log(msg) {
|
|
7182
7468
|
var extra = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
7183
7469
|
var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'info';
|
|
7184
|
-
this.client.logger(level, 'WSConnectionFallback:' + msg, _objectSpread$
|
|
7470
|
+
this.client.logger(level, 'WSConnectionFallback:' + msg, _objectSpread$8({
|
|
7185
7471
|
tags: ['connection_fallback', 'connection']
|
|
7186
7472
|
}, extra));
|
|
7187
7473
|
}
|
|
@@ -7558,14 +7844,13 @@ var VotingVisibility;
|
|
|
7558
7844
|
VotingVisibility["public"] = "public";
|
|
7559
7845
|
})(VotingVisibility || (VotingVisibility = {}));
|
|
7560
7846
|
|
|
7561
|
-
function ownKeys$
|
|
7847
|
+
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; }
|
|
7562
7848
|
|
|
7563
|
-
function _objectSpread$
|
|
7849
|
+
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; }
|
|
7564
7850
|
|
|
7565
|
-
function isPatch(value) {
|
|
7851
|
+
var isPatch = function isPatch(value) {
|
|
7566
7852
|
return typeof value === 'function';
|
|
7567
|
-
}
|
|
7568
|
-
|
|
7853
|
+
};
|
|
7569
7854
|
var StateStore = function StateStore(value) {
|
|
7570
7855
|
var _this = this;
|
|
7571
7856
|
|
|
@@ -7590,7 +7875,7 @@ var StateStore = function StateStore(value) {
|
|
|
7590
7875
|
|
|
7591
7876
|
_defineProperty(this, "partialNext", function (partial) {
|
|
7592
7877
|
return _this.next(function (current) {
|
|
7593
|
-
return _objectSpread$
|
|
7878
|
+
return _objectSpread$7(_objectSpread$7({}, current), partial);
|
|
7594
7879
|
});
|
|
7595
7880
|
});
|
|
7596
7881
|
|
|
@@ -7642,9 +7927,9 @@ _defineProperty(StateStore, "logCount", 5);
|
|
|
7642
7927
|
|
|
7643
7928
|
var _excluded$3 = ["limit", "sort"];
|
|
7644
7929
|
|
|
7645
|
-
function ownKeys$
|
|
7930
|
+
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; }
|
|
7646
7931
|
|
|
7647
|
-
function _objectSpread$
|
|
7932
|
+
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; }
|
|
7648
7933
|
var DEFAULT_PAGE_LIMIT = 50;
|
|
7649
7934
|
var DEFAULT_SORT = [{
|
|
7650
7935
|
created_at: -1
|
|
@@ -7929,14 +8214,14 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7929
8214
|
if (userId === ((_event$user2 = event.user) === null || _event$user2 === void 0 ? void 0 : _event$user2.id)) {
|
|
7930
8215
|
// The user who just sent a message to the thread has no unread messages
|
|
7931
8216
|
// in that thread
|
|
7932
|
-
nextUserRead = _objectSpread$
|
|
8217
|
+
nextUserRead = _objectSpread$6(_objectSpread$6({}, nextUserRead), {}, {
|
|
7933
8218
|
lastReadAt: event.created_at ? new Date(event.created_at) : new Date(),
|
|
7934
8219
|
user: event.user,
|
|
7935
8220
|
unreadMessageCount: 0
|
|
7936
8221
|
});
|
|
7937
8222
|
} else if (active && userId === _this.client.userID) ; else {
|
|
7938
8223
|
// Increment unread count for all users except the author of the new message
|
|
7939
|
-
nextUserRead = _objectSpread$
|
|
8224
|
+
nextUserRead = _objectSpread$6(_objectSpread$6({}, nextUserRead), {}, {
|
|
7940
8225
|
unreadMessageCount: userRead.unreadMessageCount + 1
|
|
7941
8226
|
});
|
|
7942
8227
|
}
|
|
@@ -7960,8 +8245,8 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7960
8245
|
var user = event.user;
|
|
7961
8246
|
|
|
7962
8247
|
_this.state.next(function (current) {
|
|
7963
|
-
return _objectSpread$
|
|
7964
|
-
read: _objectSpread$
|
|
8248
|
+
return _objectSpread$6(_objectSpread$6({}, current), {}, {
|
|
8249
|
+
read: _objectSpread$6(_objectSpread$6({}, current.read), {}, _defineProperty({}, userId, {
|
|
7965
8250
|
lastReadAt: new Date(createdAt),
|
|
7966
8251
|
user: user,
|
|
7967
8252
|
lastReadMessageId: event.last_read_message_id,
|
|
@@ -8074,7 +8359,7 @@ var Thread = /*#__PURE__*/function () {
|
|
|
8074
8359
|
}
|
|
8075
8360
|
|
|
8076
8361
|
_this.state.next(function (current) {
|
|
8077
|
-
return _objectSpread$
|
|
8362
|
+
return _objectSpread$6(_objectSpread$6({}, current), {}, {
|
|
8078
8363
|
replies: addToMessageList(current.replies, formattedMessage, timestampChanged)
|
|
8079
8364
|
});
|
|
8080
8365
|
});
|
|
@@ -8091,7 +8376,7 @@ var Thread = /*#__PURE__*/function () {
|
|
|
8091
8376
|
var _message$reply_count;
|
|
8092
8377
|
|
|
8093
8378
|
var formattedMessage = formatMessage(message);
|
|
8094
|
-
return _objectSpread$
|
|
8379
|
+
return _objectSpread$6(_objectSpread$6({}, current), {}, {
|
|
8095
8380
|
deletedAt: formattedMessage.deleted_at,
|
|
8096
8381
|
parentMessage: formattedMessage,
|
|
8097
8382
|
replyCount: (_message$reply_count = message.reply_count) !== null && _message$reply_count !== void 0 ? _message$reply_count : current.replyCount
|
|
@@ -8164,7 +8449,7 @@ var Thread = /*#__PURE__*/function () {
|
|
|
8164
8449
|
sort = _ref10$sort === void 0 ? DEFAULT_SORT : _ref10$sort,
|
|
8165
8450
|
otherOptions = _objectWithoutProperties(_ref10, _excluded$3);
|
|
8166
8451
|
|
|
8167
|
-
return _this.channel.getReplies(_this.id, _objectSpread$
|
|
8452
|
+
return _this.channel.getReplies(_this.id, _objectSpread$6({
|
|
8168
8453
|
limit: limit
|
|
8169
8454
|
}, otherOptions), sort);
|
|
8170
8455
|
});
|
|
@@ -8208,12 +8493,12 @@ var Thread = /*#__PURE__*/function () {
|
|
|
8208
8493
|
limit = Math.abs(count);
|
|
8209
8494
|
|
|
8210
8495
|
_this.state.partialNext({
|
|
8211
|
-
pagination: _objectSpread$
|
|
8496
|
+
pagination: _objectSpread$6(_objectSpread$6({}, pagination), {}, _defineProperty({}, loadingKey, true))
|
|
8212
8497
|
});
|
|
8213
8498
|
|
|
8214
8499
|
_context3.prev = 7;
|
|
8215
8500
|
_context3.next = 10;
|
|
8216
|
-
return _this.queryReplies(_objectSpread$
|
|
8501
|
+
return _this.queryReplies(_objectSpread$6(_objectSpread$6({}, queryOptions), {}, {
|
|
8217
8502
|
limit: limit
|
|
8218
8503
|
}));
|
|
8219
8504
|
|
|
@@ -8235,9 +8520,9 @@ var Thread = /*#__PURE__*/function () {
|
|
|
8235
8520
|
(_nextReplies = nextReplies)[insertionMethodKey].apply(_nextReplies, _toConsumableArray(replies));
|
|
8236
8521
|
}
|
|
8237
8522
|
|
|
8238
|
-
return _objectSpread$
|
|
8523
|
+
return _objectSpread$6(_objectSpread$6({}, current), {}, {
|
|
8239
8524
|
replies: nextReplies,
|
|
8240
|
-
pagination: _objectSpread$
|
|
8525
|
+
pagination: _objectSpread$6(_objectSpread$6({}, current.pagination), {}, (_objectSpread4 = {}, _defineProperty(_objectSpread4, cursorKey, data.messages.length < limit ? null : maybeNextCursor), _defineProperty(_objectSpread4, loadingKey, false), _objectSpread4))
|
|
8241
8526
|
});
|
|
8242
8527
|
});
|
|
8243
8528
|
|
|
@@ -8251,8 +8536,8 @@ var Thread = /*#__PURE__*/function () {
|
|
|
8251
8536
|
_this.client.logger('error', _context3.t0.message);
|
|
8252
8537
|
|
|
8253
8538
|
_this.state.next(function (current) {
|
|
8254
|
-
return _objectSpread$
|
|
8255
|
-
pagination: _objectSpread$
|
|
8539
|
+
return _objectSpread$6(_objectSpread$6({}, current), {}, {
|
|
8540
|
+
pagination: _objectSpread$6(_objectSpread$6({}, current.pagination), {}, _defineProperty({}, loadingKey, false))
|
|
8256
8541
|
});
|
|
8257
8542
|
});
|
|
8258
8543
|
|
|
@@ -8365,9 +8650,9 @@ var ownUnreadCountSelector = function ownUnreadCountSelector(currentUserId) {
|
|
|
8365
8650
|
};
|
|
8366
8651
|
};
|
|
8367
8652
|
|
|
8368
|
-
function ownKeys$
|
|
8653
|
+
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; }
|
|
8369
8654
|
|
|
8370
|
-
function _objectSpread$
|
|
8655
|
+
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; }
|
|
8371
8656
|
var MODERATION_ENTITY_TYPES = {
|
|
8372
8657
|
user: 'stream:user',
|
|
8373
8658
|
message: 'stream:chat:v1:message'
|
|
@@ -8484,7 +8769,7 @@ var Moderation = /*#__PURE__*/function () {
|
|
|
8484
8769
|
case 0:
|
|
8485
8770
|
options = _args3.length > 4 && _args3[4] !== undefined ? _args3[4] : {};
|
|
8486
8771
|
_context3.next = 3;
|
|
8487
|
-
return this.client.post(this.client.baseURL + '/api/v2/moderation/flag', _objectSpread$
|
|
8772
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/flag', _objectSpread$5({
|
|
8488
8773
|
entity_type: entityType,
|
|
8489
8774
|
entity_id: entityId,
|
|
8490
8775
|
entity_creator_id: entityCreatorID,
|
|
@@ -8529,7 +8814,7 @@ var Moderation = /*#__PURE__*/function () {
|
|
|
8529
8814
|
case 0:
|
|
8530
8815
|
options = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
|
|
8531
8816
|
_context4.next = 3;
|
|
8532
|
-
return this.client.post(this.client.baseURL + '/api/v2/moderation/mute', _objectSpread$
|
|
8817
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/mute', _objectSpread$5({
|
|
8533
8818
|
target_ids: [targetID]
|
|
8534
8819
|
}, options));
|
|
8535
8820
|
|
|
@@ -8567,7 +8852,7 @@ var Moderation = /*#__PURE__*/function () {
|
|
|
8567
8852
|
switch (_context5.prev = _context5.next) {
|
|
8568
8853
|
case 0:
|
|
8569
8854
|
_context5.next = 2;
|
|
8570
|
-
return this.client.post(this.client.baseURL + '/api/v2/moderation/unmute', _objectSpread$
|
|
8855
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/unmute', _objectSpread$5({
|
|
8571
8856
|
target_ids: [targetID]
|
|
8572
8857
|
}, options));
|
|
8573
8858
|
|
|
@@ -8609,7 +8894,7 @@ var Moderation = /*#__PURE__*/function () {
|
|
|
8609
8894
|
case 0:
|
|
8610
8895
|
options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
|
|
8611
8896
|
_context6.next = 3;
|
|
8612
|
-
return this.client.get(this.client.baseURL + "/api/v2/moderation/user_report", _objectSpread$
|
|
8897
|
+
return this.client.get(this.client.baseURL + "/api/v2/moderation/user_report", _objectSpread$5({
|
|
8613
8898
|
user_id: userID
|
|
8614
8899
|
}, options));
|
|
8615
8900
|
|
|
@@ -8653,7 +8938,7 @@ var Moderation = /*#__PURE__*/function () {
|
|
|
8653
8938
|
sort = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : [];
|
|
8654
8939
|
options = _args7.length > 2 && _args7[2] !== undefined ? _args7[2] : {};
|
|
8655
8940
|
_context7.next = 5;
|
|
8656
|
-
return this.client.post(this.client.baseURL + '/api/v2/moderation/review_queue', _objectSpread$
|
|
8941
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/review_queue', _objectSpread$5({
|
|
8657
8942
|
filter: filterConditions,
|
|
8658
8943
|
sort: normalizeQuerySort(sort)
|
|
8659
8944
|
}, options));
|
|
@@ -8788,7 +9073,7 @@ var Moderation = /*#__PURE__*/function () {
|
|
|
8788
9073
|
case 0:
|
|
8789
9074
|
options = _args11.length > 2 && _args11[2] !== undefined ? _args11[2] : {};
|
|
8790
9075
|
_context11.next = 3;
|
|
8791
|
-
return this.client.post(this.client.baseURL + '/api/v2/moderation/configs', _objectSpread$
|
|
9076
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/configs', _objectSpread$5({
|
|
8792
9077
|
filter: filterConditions,
|
|
8793
9078
|
sort: sort
|
|
8794
9079
|
}, options));
|
|
@@ -8822,7 +9107,7 @@ var Moderation = /*#__PURE__*/function () {
|
|
|
8822
9107
|
case 0:
|
|
8823
9108
|
options = _args12.length > 2 && _args12[2] !== undefined ? _args12[2] : {};
|
|
8824
9109
|
_context12.next = 3;
|
|
8825
|
-
return this.client.post(this.client.baseURL + '/api/v2/moderation/submit_action', _objectSpread$
|
|
9110
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/submit_action', _objectSpread$5({
|
|
8826
9111
|
action_type: actionType,
|
|
8827
9112
|
item_id: itemID
|
|
8828
9113
|
}, options));
|
|
@@ -8986,9 +9271,9 @@ function _unsupportedIterableToArray$2(o, minLen) { if (!o) return; if (typeof o
|
|
|
8986
9271
|
|
|
8987
9272
|
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; }
|
|
8988
9273
|
|
|
8989
|
-
function ownKeys$
|
|
9274
|
+
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; }
|
|
8990
9275
|
|
|
8991
|
-
function _objectSpread$
|
|
9276
|
+
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; }
|
|
8992
9277
|
var DEFAULT_CONNECTION_RECOVERY_THROTTLE_DURATION = 1000;
|
|
8993
9278
|
var MAX_QUERY_THREADS_LIMIT = 25;
|
|
8994
9279
|
var THREAD_MANAGER_INITIAL_STATE = {
|
|
@@ -9169,7 +9454,7 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9169
9454
|
var unsubscribeConnectionDropped = _this.client.on('connection.changed', function (event) {
|
|
9170
9455
|
if (event.online === false) {
|
|
9171
9456
|
_this.state.next(function (current) {
|
|
9172
|
-
return current.lastConnectionDropAt ? current : _objectSpread$
|
|
9457
|
+
return current.lastConnectionDropAt ? current : _objectSpread$4(_objectSpread$4({}, current), {}, {
|
|
9173
9458
|
lastConnectionDropAt: new Date()
|
|
9174
9459
|
});
|
|
9175
9460
|
});
|
|
@@ -9256,8 +9541,8 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9256
9541
|
_context.prev = 7;
|
|
9257
9542
|
|
|
9258
9543
|
_this.state.next(function (current) {
|
|
9259
|
-
return _objectSpread$
|
|
9260
|
-
pagination: _objectSpread$
|
|
9544
|
+
return _objectSpread$4(_objectSpread$4({}, current), {}, {
|
|
9545
|
+
pagination: _objectSpread$4(_objectSpread$4({}, current.pagination), {}, {
|
|
9261
9546
|
isLoading: true
|
|
9262
9547
|
})
|
|
9263
9548
|
});
|
|
@@ -9299,11 +9584,11 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9299
9584
|
_this.state.next(function (current) {
|
|
9300
9585
|
var _response$next;
|
|
9301
9586
|
|
|
9302
|
-
return _objectSpread$
|
|
9587
|
+
return _objectSpread$4(_objectSpread$4({}, current), {}, {
|
|
9303
9588
|
threads: nextThreads,
|
|
9304
9589
|
unseenThreadIds: [],
|
|
9305
9590
|
isThreadOrderStale: false,
|
|
9306
|
-
pagination: _objectSpread$
|
|
9591
|
+
pagination: _objectSpread$4(_objectSpread$4({}, current.pagination), {}, {
|
|
9307
9592
|
isLoading: false,
|
|
9308
9593
|
nextCursor: (_response$next = response.next) !== null && _response$next !== void 0 ? _response$next : null
|
|
9309
9594
|
}),
|
|
@@ -9321,8 +9606,8 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9321
9606
|
_this.client.logger('error', _context.t0.message);
|
|
9322
9607
|
|
|
9323
9608
|
_this.state.next(function (current) {
|
|
9324
|
-
return _objectSpread$
|
|
9325
|
-
pagination: _objectSpread$
|
|
9609
|
+
return _objectSpread$4(_objectSpread$4({}, current), {}, {
|
|
9610
|
+
pagination: _objectSpread$4(_objectSpread$4({}, current.pagination), {}, {
|
|
9326
9611
|
isLoading: false
|
|
9327
9612
|
})
|
|
9328
9613
|
});
|
|
@@ -9338,7 +9623,7 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9338
9623
|
|
|
9339
9624
|
_defineProperty(this, "queryThreads", function () {
|
|
9340
9625
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9341
|
-
return _this.client.queryThreads(_objectSpread$
|
|
9626
|
+
return _this.client.queryThreads(_objectSpread$4({
|
|
9342
9627
|
limit: 25,
|
|
9343
9628
|
participant_limit: 10,
|
|
9344
9629
|
reply_limit: 10,
|
|
@@ -9371,13 +9656,13 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9371
9656
|
_context2.prev = 4;
|
|
9372
9657
|
|
|
9373
9658
|
_this.state.partialNext({
|
|
9374
|
-
pagination: _objectSpread$
|
|
9659
|
+
pagination: _objectSpread$4(_objectSpread$4({}, pagination), {}, {
|
|
9375
9660
|
isLoadingNext: true
|
|
9376
9661
|
})
|
|
9377
9662
|
});
|
|
9378
9663
|
|
|
9379
9664
|
_context2.next = 8;
|
|
9380
|
-
return _this.queryThreads(_objectSpread$
|
|
9665
|
+
return _this.queryThreads(_objectSpread$4(_objectSpread$4({}, options), {}, {
|
|
9381
9666
|
next: pagination.nextCursor
|
|
9382
9667
|
}));
|
|
9383
9668
|
|
|
@@ -9387,9 +9672,9 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9387
9672
|
_this.state.next(function (current) {
|
|
9388
9673
|
var _response$next2;
|
|
9389
9674
|
|
|
9390
|
-
return _objectSpread$
|
|
9675
|
+
return _objectSpread$4(_objectSpread$4({}, current), {}, {
|
|
9391
9676
|
threads: response.threads.length ? current.threads.concat(response.threads) : current.threads,
|
|
9392
|
-
pagination: _objectSpread$
|
|
9677
|
+
pagination: _objectSpread$4(_objectSpread$4({}, current.pagination), {}, {
|
|
9393
9678
|
nextCursor: (_response$next2 = response.next) !== null && _response$next2 !== void 0 ? _response$next2 : null,
|
|
9394
9679
|
isLoadingNext: false
|
|
9395
9680
|
})
|
|
@@ -9406,8 +9691,8 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9406
9691
|
_this.client.logger('error', _context2.t0.message);
|
|
9407
9692
|
|
|
9408
9693
|
_this.state.next(function (current) {
|
|
9409
|
-
return _objectSpread$
|
|
9410
|
-
pagination: _objectSpread$
|
|
9694
|
+
return _objectSpread$4(_objectSpread$4({}, current), {}, {
|
|
9695
|
+
pagination: _objectSpread$4(_objectSpread$4({}, current.pagination), {}, {
|
|
9411
9696
|
isLoadingNext: false
|
|
9412
9697
|
})
|
|
9413
9698
|
});
|
|
@@ -9455,9 +9740,9 @@ var ThreadManager = /*#__PURE__*/function () {
|
|
|
9455
9740
|
var _excluded$2 = ["own_votes", "id"],
|
|
9456
9741
|
_excluded2$1 = ["id"];
|
|
9457
9742
|
|
|
9458
|
-
function ownKeys$
|
|
9743
|
+
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; }
|
|
9459
9744
|
|
|
9460
|
-
function _objectSpread$
|
|
9745
|
+
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; }
|
|
9461
9746
|
|
|
9462
9747
|
var isPollUpdatedEvent = function isPollUpdatedEvent(e) {
|
|
9463
9748
|
return e.type === 'poll.updated';
|
|
@@ -9523,7 +9808,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9523
9808
|
ownAnswer = _ref2.ownAnswer,
|
|
9524
9809
|
ownVotes = _ref2.ownVotes;
|
|
9525
9810
|
|
|
9526
|
-
return _objectSpread$
|
|
9811
|
+
return _objectSpread$3(_objectSpread$3({}, pollResponseForState), {}, {
|
|
9527
9812
|
lastActivityAt: new Date(),
|
|
9528
9813
|
maxVotedOptionIds: getMaxVotedOptionIds(pollResponseForState.vote_counts_by_option),
|
|
9529
9814
|
ownAnswer: ownAnswer,
|
|
@@ -9545,7 +9830,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9545
9830
|
pollData = _objectWithoutProperties(_extractPollData, _excluded2$1); // @ts-ignore
|
|
9546
9831
|
|
|
9547
9832
|
|
|
9548
|
-
_this.state.partialNext(_objectSpread$
|
|
9833
|
+
_this.state.partialNext(_objectSpread$3(_objectSpread$3({}, pollData), {}, {
|
|
9549
9834
|
lastActivityAt: new Date(event.created_at)
|
|
9550
9835
|
}));
|
|
9551
9836
|
});
|
|
@@ -9592,7 +9877,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9592
9877
|
|
|
9593
9878
|
var pollEnrichData = extractPollEnrichedData(event.poll); // @ts-ignore
|
|
9594
9879
|
|
|
9595
|
-
_this.state.partialNext(_objectSpread$
|
|
9880
|
+
_this.state.partialNext(_objectSpread$3(_objectSpread$3({}, pollEnrichData), {}, {
|
|
9596
9881
|
latest_answers: latestAnswers,
|
|
9597
9882
|
lastActivityAt: new Date(event.created_at),
|
|
9598
9883
|
ownAnswer: ownAnswer,
|
|
@@ -9657,7 +9942,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9657
9942
|
|
|
9658
9943
|
var pollEnrichData = extractPollEnrichedData(event.poll); // @ts-ignore
|
|
9659
9944
|
|
|
9660
|
-
_this.state.partialNext(_objectSpread$
|
|
9945
|
+
_this.state.partialNext(_objectSpread$3(_objectSpread$3({}, pollEnrichData), {}, {
|
|
9661
9946
|
latest_answers: latestAnswers,
|
|
9662
9947
|
lastActivityAt: new Date(event.created_at),
|
|
9663
9948
|
ownAnswer: ownAnswer,
|
|
@@ -9678,7 +9963,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9678
9963
|
|
|
9679
9964
|
var ownAnswer = currentState.ownAnswer;
|
|
9680
9965
|
|
|
9681
|
-
var ownVotesByOptionId = _objectSpread$
|
|
9966
|
+
var ownVotesByOptionId = _objectSpread$3({}, currentState.ownVotesByOptionId);
|
|
9682
9967
|
|
|
9683
9968
|
var maxVotedOptionIds = currentState.maxVotedOptionIds;
|
|
9684
9969
|
|
|
@@ -9700,7 +9985,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9700
9985
|
|
|
9701
9986
|
var pollEnrichData = extractPollEnrichedData(event.poll); // @ts-ignore
|
|
9702
9987
|
|
|
9703
|
-
_this.state.partialNext(_objectSpread$
|
|
9988
|
+
_this.state.partialNext(_objectSpread$3(_objectSpread$3({}, pollEnrichData), {}, {
|
|
9704
9989
|
latest_answers: latestAnswers,
|
|
9705
9990
|
lastActivityAt: new Date(event.created_at),
|
|
9706
9991
|
ownAnswer: ownAnswer,
|
|
@@ -9725,7 +10010,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9725
10010
|
poll = _yield$_this$client$g.poll;
|
|
9726
10011
|
|
|
9727
10012
|
// @ts-ignore
|
|
9728
|
-
_this.state.partialNext(_objectSpread$
|
|
10013
|
+
_this.state.partialNext(_objectSpread$3(_objectSpread$3({}, poll), {}, {
|
|
9729
10014
|
lastActivityAt: new Date()
|
|
9730
10015
|
}));
|
|
9731
10016
|
|
|
@@ -9751,7 +10036,7 @@ var Poll = /*#__PURE__*/function () {
|
|
|
9751
10036
|
switch (_context2.prev = _context2.next) {
|
|
9752
10037
|
case 0:
|
|
9753
10038
|
_context2.next = 2;
|
|
9754
|
-
return _this.client.updatePoll(_objectSpread$
|
|
10039
|
+
return _this.client.updatePoll(_objectSpread$3(_objectSpread$3({}, data), {}, {
|
|
9755
10040
|
id: _this.id
|
|
9756
10041
|
}));
|
|
9757
10042
|
|
|
@@ -10462,6 +10747,689 @@ var PollManager = /*#__PURE__*/function () {
|
|
|
10462
10747
|
return PollManager;
|
|
10463
10748
|
}();
|
|
10464
10749
|
|
|
10750
|
+
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; }
|
|
10751
|
+
|
|
10752
|
+
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; }
|
|
10753
|
+
var channelManagerEventToHandlerMapping = {
|
|
10754
|
+
'channel.deleted': 'channelDeletedHandler',
|
|
10755
|
+
'channel.hidden': 'channelHiddenHandler',
|
|
10756
|
+
'channel.truncated': 'channelTruncatedHandler',
|
|
10757
|
+
'channel.visible': 'channelVisibleHandler',
|
|
10758
|
+
'message.new': 'newMessageHandler',
|
|
10759
|
+
'member.updated': 'memberUpdatedHandler',
|
|
10760
|
+
'notification.added_to_channel': 'notificationAddedToChannelHandler',
|
|
10761
|
+
'notification.message_new': 'notificationNewMessageHandler',
|
|
10762
|
+
'notification.removed_from_channel': 'notificationRemovedFromChannelHandler'
|
|
10763
|
+
};
|
|
10764
|
+
var DEFAULT_CHANNEL_MANAGER_OPTIONS = {
|
|
10765
|
+
abortInFlightQuery: false,
|
|
10766
|
+
allowNotLoadedChannelPromotionForEvent: {
|
|
10767
|
+
'channel.visible': true,
|
|
10768
|
+
'message.new': true,
|
|
10769
|
+
'notification.added_to_channel': true,
|
|
10770
|
+
'notification.message_new': true
|
|
10771
|
+
},
|
|
10772
|
+
lockChannelOrder: false
|
|
10773
|
+
};
|
|
10774
|
+
var DEFAULT_CHANNEL_MANAGER_PAGINATION_OPTIONS = {
|
|
10775
|
+
limit: 10,
|
|
10776
|
+
offset: 0
|
|
10777
|
+
};
|
|
10778
|
+
/**
|
|
10779
|
+
* A class that manages a list of channels and changes it based on configuration and WS events. The
|
|
10780
|
+
* list of channels is reactive as well as the pagination and it can be subscribed to for state updates.
|
|
10781
|
+
*
|
|
10782
|
+
* @internal
|
|
10783
|
+
*/
|
|
10784
|
+
|
|
10785
|
+
var ChannelManager = function ChannelManager(_ref) {
|
|
10786
|
+
var _this = this;
|
|
10787
|
+
|
|
10788
|
+
var client = _ref.client,
|
|
10789
|
+
_ref$eventHandlerOver = _ref.eventHandlerOverrides,
|
|
10790
|
+
_eventHandlerOverrides = _ref$eventHandlerOver === void 0 ? {} : _ref$eventHandlerOver,
|
|
10791
|
+
_ref$options = _ref.options,
|
|
10792
|
+
_options = _ref$options === void 0 ? {} : _ref$options;
|
|
10793
|
+
|
|
10794
|
+
_classCallCheck(this, ChannelManager);
|
|
10795
|
+
|
|
10796
|
+
_defineProperty(this, "state", void 0);
|
|
10797
|
+
|
|
10798
|
+
_defineProperty(this, "client", void 0);
|
|
10799
|
+
|
|
10800
|
+
_defineProperty(this, "unsubscribeFunctions", new Set());
|
|
10801
|
+
|
|
10802
|
+
_defineProperty(this, "eventHandlers", new Map());
|
|
10803
|
+
|
|
10804
|
+
_defineProperty(this, "eventHandlerOverrides", new Map());
|
|
10805
|
+
|
|
10806
|
+
_defineProperty(this, "options", {});
|
|
10807
|
+
|
|
10808
|
+
_defineProperty(this, "stateOptions", {});
|
|
10809
|
+
|
|
10810
|
+
_defineProperty(this, "setChannels", function (valueOrFactory) {
|
|
10811
|
+
_this.state.next(function (current) {
|
|
10812
|
+
var currentChannels = current.channels;
|
|
10813
|
+
var newChannels = isPatch(valueOrFactory) ? valueOrFactory(currentChannels) : valueOrFactory; // If the references between the two values are the same, just return the
|
|
10814
|
+
// current state; otherwise trigger a state change.
|
|
10815
|
+
|
|
10816
|
+
if (currentChannels === newChannels) {
|
|
10817
|
+
return current;
|
|
10818
|
+
}
|
|
10819
|
+
|
|
10820
|
+
return _objectSpread$2(_objectSpread$2({}, current), {}, {
|
|
10821
|
+
channels: newChannels
|
|
10822
|
+
});
|
|
10823
|
+
});
|
|
10824
|
+
});
|
|
10825
|
+
|
|
10826
|
+
_defineProperty(this, "setEventHandlerOverrides", function () {
|
|
10827
|
+
var eventHandlerOverrides = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
10828
|
+
var truthyEventHandlerOverrides = Object.entries(eventHandlerOverrides).reduce(function (acc, _ref2) {
|
|
10829
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
10830
|
+
key = _ref3[0],
|
|
10831
|
+
value = _ref3[1];
|
|
10832
|
+
|
|
10833
|
+
if (value) {
|
|
10834
|
+
acc[key] = value;
|
|
10835
|
+
}
|
|
10836
|
+
|
|
10837
|
+
return acc;
|
|
10838
|
+
}, {});
|
|
10839
|
+
_this.eventHandlerOverrides = new Map(Object.entries(truthyEventHandlerOverrides));
|
|
10840
|
+
});
|
|
10841
|
+
|
|
10842
|
+
_defineProperty(this, "setOptions", function () {
|
|
10843
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
10844
|
+
_this.options = _objectSpread$2(_objectSpread$2({}, DEFAULT_CHANNEL_MANAGER_OPTIONS), options);
|
|
10845
|
+
});
|
|
10846
|
+
|
|
10847
|
+
_defineProperty(this, "queryChannels", /*#__PURE__*/function () {
|
|
10848
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(filters) {
|
|
10849
|
+
var sort,
|
|
10850
|
+
options,
|
|
10851
|
+
stateOptions,
|
|
10852
|
+
_DEFAULT_CHANNEL_MANA,
|
|
10853
|
+
offset,
|
|
10854
|
+
limit,
|
|
10855
|
+
_this$state$getLatest,
|
|
10856
|
+
isLoading,
|
|
10857
|
+
_channels$length,
|
|
10858
|
+
_channels$length2,
|
|
10859
|
+
channels,
|
|
10860
|
+
newOffset,
|
|
10861
|
+
newOptions,
|
|
10862
|
+
_this$state$getLatest2,
|
|
10863
|
+
pagination,
|
|
10864
|
+
_args = arguments;
|
|
10865
|
+
|
|
10866
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
10867
|
+
while (1) {
|
|
10868
|
+
switch (_context.prev = _context.next) {
|
|
10869
|
+
case 0:
|
|
10870
|
+
sort = _args.length > 1 && _args[1] !== undefined ? _args[1] : [];
|
|
10871
|
+
options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
|
|
10872
|
+
stateOptions = _args.length > 3 && _args[3] !== undefined ? _args[3] : {};
|
|
10873
|
+
_DEFAULT_CHANNEL_MANA = _objectSpread$2(_objectSpread$2({}, DEFAULT_CHANNEL_MANAGER_PAGINATION_OPTIONS), options), offset = _DEFAULT_CHANNEL_MANA.offset, limit = _DEFAULT_CHANNEL_MANA.limit;
|
|
10874
|
+
_this$state$getLatest = _this.state.getLatestValue(), isLoading = _this$state$getLatest.pagination.isLoading;
|
|
10875
|
+
|
|
10876
|
+
if (!(isLoading && !_this.options.abortInFlightQuery)) {
|
|
10877
|
+
_context.next = 7;
|
|
10878
|
+
break;
|
|
10879
|
+
}
|
|
10880
|
+
|
|
10881
|
+
return _context.abrupt("return");
|
|
10882
|
+
|
|
10883
|
+
case 7:
|
|
10884
|
+
_context.prev = 7;
|
|
10885
|
+
_this.stateOptions = stateOptions;
|
|
10886
|
+
|
|
10887
|
+
_this.state.next(function (currentState) {
|
|
10888
|
+
return _objectSpread$2(_objectSpread$2({}, currentState), {}, {
|
|
10889
|
+
pagination: _objectSpread$2(_objectSpread$2({}, currentState.pagination), {}, {
|
|
10890
|
+
isLoading: true,
|
|
10891
|
+
isLoadingNext: false,
|
|
10892
|
+
filters: filters,
|
|
10893
|
+
sort: sort,
|
|
10894
|
+
options: options
|
|
10895
|
+
})
|
|
10896
|
+
});
|
|
10897
|
+
});
|
|
10898
|
+
|
|
10899
|
+
_context.next = 12;
|
|
10900
|
+
return _this.client.queryChannels(filters, sort, options, stateOptions);
|
|
10901
|
+
|
|
10902
|
+
case 12:
|
|
10903
|
+
channels = _context.sent;
|
|
10904
|
+
newOffset = offset + ((_channels$length = channels === null || channels === void 0 ? void 0 : channels.length) !== null && _channels$length !== void 0 ? _channels$length : 0);
|
|
10905
|
+
newOptions = _objectSpread$2(_objectSpread$2({}, options), {}, {
|
|
10906
|
+
offset: newOffset
|
|
10907
|
+
});
|
|
10908
|
+
_this$state$getLatest2 = _this.state.getLatestValue(), pagination = _this$state$getLatest2.pagination;
|
|
10909
|
+
|
|
10910
|
+
_this.state.partialNext({
|
|
10911
|
+
channels: channels,
|
|
10912
|
+
pagination: _objectSpread$2(_objectSpread$2({}, pagination), {}, {
|
|
10913
|
+
hasNext: ((_channels$length2 = channels === null || channels === void 0 ? void 0 : channels.length) !== null && _channels$length2 !== void 0 ? _channels$length2 : 0) >= limit,
|
|
10914
|
+
isLoading: false,
|
|
10915
|
+
options: newOptions
|
|
10916
|
+
}),
|
|
10917
|
+
initialized: true
|
|
10918
|
+
});
|
|
10919
|
+
|
|
10920
|
+
_context.next = 24;
|
|
10921
|
+
break;
|
|
10922
|
+
|
|
10923
|
+
case 19:
|
|
10924
|
+
_context.prev = 19;
|
|
10925
|
+
_context.t0 = _context["catch"](7);
|
|
10926
|
+
|
|
10927
|
+
_this.client.logger('error', _context.t0.message);
|
|
10928
|
+
|
|
10929
|
+
_this.state.next(function (currentState) {
|
|
10930
|
+
return _objectSpread$2(_objectSpread$2({}, currentState), {}, {
|
|
10931
|
+
pagination: _objectSpread$2(_objectSpread$2({}, currentState.pagination), {}, {
|
|
10932
|
+
isLoading: false
|
|
10933
|
+
})
|
|
10934
|
+
});
|
|
10935
|
+
});
|
|
10936
|
+
|
|
10937
|
+
throw _context.t0;
|
|
10938
|
+
|
|
10939
|
+
case 24:
|
|
10940
|
+
case "end":
|
|
10941
|
+
return _context.stop();
|
|
10942
|
+
}
|
|
10943
|
+
}
|
|
10944
|
+
}, _callee, null, [[7, 19]]);
|
|
10945
|
+
}));
|
|
10946
|
+
|
|
10947
|
+
return function (_x) {
|
|
10948
|
+
return _ref4.apply(this, arguments);
|
|
10949
|
+
};
|
|
10950
|
+
}());
|
|
10951
|
+
|
|
10952
|
+
_defineProperty(this, "loadNext", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
10953
|
+
var _this$state$getLatest3, pagination, channels, initialized, filters, sort, options, isLoadingNext, hasNext, _nextChannels$length, _nextChannels$length2, _DEFAULT_CHANNEL_MANA2, offset, limit, nextChannels, newOffset, newOptions;
|
|
10954
|
+
|
|
10955
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
10956
|
+
while (1) {
|
|
10957
|
+
switch (_context2.prev = _context2.next) {
|
|
10958
|
+
case 0:
|
|
10959
|
+
_this$state$getLatest3 = _this.state.getLatestValue(), pagination = _this$state$getLatest3.pagination, channels = _this$state$getLatest3.channels, initialized = _this$state$getLatest3.initialized;
|
|
10960
|
+
filters = pagination.filters, sort = pagination.sort, options = pagination.options, isLoadingNext = pagination.isLoadingNext, hasNext = pagination.hasNext;
|
|
10961
|
+
|
|
10962
|
+
if (!(!initialized || isLoadingNext || !hasNext)) {
|
|
10963
|
+
_context2.next = 4;
|
|
10964
|
+
break;
|
|
10965
|
+
}
|
|
10966
|
+
|
|
10967
|
+
return _context2.abrupt("return");
|
|
10968
|
+
|
|
10969
|
+
case 4:
|
|
10970
|
+
_context2.prev = 4;
|
|
10971
|
+
_DEFAULT_CHANNEL_MANA2 = _objectSpread$2(_objectSpread$2({}, DEFAULT_CHANNEL_MANAGER_PAGINATION_OPTIONS), options), offset = _DEFAULT_CHANNEL_MANA2.offset, limit = _DEFAULT_CHANNEL_MANA2.limit;
|
|
10972
|
+
|
|
10973
|
+
_this.state.partialNext({
|
|
10974
|
+
pagination: _objectSpread$2(_objectSpread$2({}, pagination), {}, {
|
|
10975
|
+
isLoading: false,
|
|
10976
|
+
isLoadingNext: true
|
|
10977
|
+
})
|
|
10978
|
+
});
|
|
10979
|
+
|
|
10980
|
+
_context2.next = 9;
|
|
10981
|
+
return _this.client.queryChannels(filters, sort, options, _this.stateOptions);
|
|
10982
|
+
|
|
10983
|
+
case 9:
|
|
10984
|
+
nextChannels = _context2.sent;
|
|
10985
|
+
newOffset = offset + ((_nextChannels$length = nextChannels === null || nextChannels === void 0 ? void 0 : nextChannels.length) !== null && _nextChannels$length !== void 0 ? _nextChannels$length : 0);
|
|
10986
|
+
newOptions = _objectSpread$2(_objectSpread$2({}, options), {}, {
|
|
10987
|
+
offset: newOffset
|
|
10988
|
+
});
|
|
10989
|
+
|
|
10990
|
+
_this.state.partialNext({
|
|
10991
|
+
channels: [].concat(_toConsumableArray(channels || []), _toConsumableArray(nextChannels)),
|
|
10992
|
+
pagination: _objectSpread$2(_objectSpread$2({}, pagination), {}, {
|
|
10993
|
+
hasNext: ((_nextChannels$length2 = nextChannels === null || nextChannels === void 0 ? void 0 : nextChannels.length) !== null && _nextChannels$length2 !== void 0 ? _nextChannels$length2 : 0) >= limit,
|
|
10994
|
+
isLoading: false,
|
|
10995
|
+
isLoadingNext: false,
|
|
10996
|
+
options: newOptions
|
|
10997
|
+
})
|
|
10998
|
+
});
|
|
10999
|
+
|
|
11000
|
+
_context2.next = 20;
|
|
11001
|
+
break;
|
|
11002
|
+
|
|
11003
|
+
case 15:
|
|
11004
|
+
_context2.prev = 15;
|
|
11005
|
+
_context2.t0 = _context2["catch"](4);
|
|
11006
|
+
|
|
11007
|
+
_this.client.logger('error', _context2.t0.message);
|
|
11008
|
+
|
|
11009
|
+
_this.state.next(function (currentState) {
|
|
11010
|
+
return _objectSpread$2(_objectSpread$2({}, currentState), {}, {
|
|
11011
|
+
pagination: _objectSpread$2(_objectSpread$2({}, currentState.pagination), {}, {
|
|
11012
|
+
isLoadingNext: false
|
|
11013
|
+
})
|
|
11014
|
+
});
|
|
11015
|
+
});
|
|
11016
|
+
|
|
11017
|
+
throw _context2.t0;
|
|
11018
|
+
|
|
11019
|
+
case 20:
|
|
11020
|
+
case "end":
|
|
11021
|
+
return _context2.stop();
|
|
11022
|
+
}
|
|
11023
|
+
}
|
|
11024
|
+
}, _callee2, null, [[4, 15]]);
|
|
11025
|
+
})));
|
|
11026
|
+
|
|
11027
|
+
_defineProperty(this, "notificationAddedToChannelHandler", /*#__PURE__*/function () {
|
|
11028
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(event) {
|
|
11029
|
+
var _event$channel, _this$options$allowNo;
|
|
11030
|
+
|
|
11031
|
+
var _ref7, id, type, members, channel, _this$state$getLatest4, pagination, channels, _ref9, sort;
|
|
11032
|
+
|
|
11033
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
11034
|
+
while (1) {
|
|
11035
|
+
switch (_context3.prev = _context3.next) {
|
|
11036
|
+
case 0:
|
|
11037
|
+
_ref7 = (_event$channel = event === null || event === void 0 ? void 0 : event.channel) !== null && _event$channel !== void 0 ? _event$channel : {}, id = _ref7.id, type = _ref7.type, members = _ref7.members;
|
|
11038
|
+
|
|
11039
|
+
if (!(!type || !((_this$options$allowNo = _this.options.allowNotLoadedChannelPromotionForEvent) !== null && _this$options$allowNo !== void 0 && _this$options$allowNo['notification.added_to_channel']))) {
|
|
11040
|
+
_context3.next = 3;
|
|
11041
|
+
break;
|
|
11042
|
+
}
|
|
11043
|
+
|
|
11044
|
+
return _context3.abrupt("return");
|
|
11045
|
+
|
|
11046
|
+
case 3:
|
|
11047
|
+
_context3.next = 5;
|
|
11048
|
+
return getAndWatchChannel({
|
|
11049
|
+
client: _this.client,
|
|
11050
|
+
id: id,
|
|
11051
|
+
members: members === null || members === void 0 ? void 0 : members.reduce(function (acc, _ref8) {
|
|
11052
|
+
var user = _ref8.user,
|
|
11053
|
+
user_id = _ref8.user_id;
|
|
11054
|
+
var userId = user_id || (user === null || user === void 0 ? void 0 : user.id);
|
|
11055
|
+
|
|
11056
|
+
if (userId) {
|
|
11057
|
+
acc.push(userId);
|
|
11058
|
+
}
|
|
11059
|
+
|
|
11060
|
+
return acc;
|
|
11061
|
+
}, []),
|
|
11062
|
+
type: type
|
|
11063
|
+
});
|
|
11064
|
+
|
|
11065
|
+
case 5:
|
|
11066
|
+
channel = _context3.sent;
|
|
11067
|
+
_this$state$getLatest4 = _this.state.getLatestValue(), pagination = _this$state$getLatest4.pagination, channels = _this$state$getLatest4.channels;
|
|
11068
|
+
|
|
11069
|
+
if (channels) {
|
|
11070
|
+
_context3.next = 9;
|
|
11071
|
+
break;
|
|
11072
|
+
}
|
|
11073
|
+
|
|
11074
|
+
return _context3.abrupt("return");
|
|
11075
|
+
|
|
11076
|
+
case 9:
|
|
11077
|
+
_ref9 = pagination !== null && pagination !== void 0 ? pagination : {}, sort = _ref9.sort;
|
|
11078
|
+
|
|
11079
|
+
_this.setChannels(promoteChannel({
|
|
11080
|
+
channels: channels,
|
|
11081
|
+
channelToMove: channel,
|
|
11082
|
+
sort: sort
|
|
11083
|
+
}));
|
|
11084
|
+
|
|
11085
|
+
case 11:
|
|
11086
|
+
case "end":
|
|
11087
|
+
return _context3.stop();
|
|
11088
|
+
}
|
|
11089
|
+
}
|
|
11090
|
+
}, _callee3);
|
|
11091
|
+
}));
|
|
11092
|
+
|
|
11093
|
+
return function (_x2) {
|
|
11094
|
+
return _ref6.apply(this, arguments);
|
|
11095
|
+
};
|
|
11096
|
+
}());
|
|
11097
|
+
|
|
11098
|
+
_defineProperty(this, "channelDeletedHandler", function (event) {
|
|
11099
|
+
var _this$state$getLatest5 = _this.state.getLatestValue(),
|
|
11100
|
+
channels = _this$state$getLatest5.channels;
|
|
11101
|
+
|
|
11102
|
+
if (!channels) {
|
|
11103
|
+
return;
|
|
11104
|
+
}
|
|
11105
|
+
|
|
11106
|
+
var newChannels = _toConsumableArray(channels);
|
|
11107
|
+
|
|
11108
|
+
var channelIndex = newChannels.findIndex(function (channel) {
|
|
11109
|
+
var _event$channel2;
|
|
11110
|
+
|
|
11111
|
+
return channel.cid === (event.cid || ((_event$channel2 = event.channel) === null || _event$channel2 === void 0 ? void 0 : _event$channel2.cid));
|
|
11112
|
+
});
|
|
11113
|
+
|
|
11114
|
+
if (channelIndex < 0) {
|
|
11115
|
+
return;
|
|
11116
|
+
}
|
|
11117
|
+
|
|
11118
|
+
newChannels.splice(channelIndex, 1);
|
|
11119
|
+
|
|
11120
|
+
_this.setChannels(newChannels);
|
|
11121
|
+
});
|
|
11122
|
+
|
|
11123
|
+
_defineProperty(this, "channelHiddenHandler", this.channelDeletedHandler);
|
|
11124
|
+
|
|
11125
|
+
_defineProperty(this, "newMessageHandler", function (event) {
|
|
11126
|
+
var _this$options$allowNo2;
|
|
11127
|
+
|
|
11128
|
+
var _this$state$getLatest6 = _this.state.getLatestValue(),
|
|
11129
|
+
pagination = _this$state$getLatest6.pagination,
|
|
11130
|
+
channels = _this$state$getLatest6.channels;
|
|
11131
|
+
|
|
11132
|
+
if (!channels) {
|
|
11133
|
+
return;
|
|
11134
|
+
}
|
|
11135
|
+
|
|
11136
|
+
var _ref10 = pagination !== null && pagination !== void 0 ? pagination : {},
|
|
11137
|
+
filters = _ref10.filters,
|
|
11138
|
+
sort = _ref10.sort;
|
|
11139
|
+
|
|
11140
|
+
var channelType = event.channel_type;
|
|
11141
|
+
var channelId = event.channel_id;
|
|
11142
|
+
|
|
11143
|
+
if (!channelType || !channelId) {
|
|
11144
|
+
return;
|
|
11145
|
+
}
|
|
11146
|
+
|
|
11147
|
+
var targetChannel = _this.client.channel(channelType, channelId);
|
|
11148
|
+
|
|
11149
|
+
var targetChannelIndex = channels.indexOf(targetChannel);
|
|
11150
|
+
var targetChannelExistsWithinList = targetChannelIndex >= 0;
|
|
11151
|
+
var isTargetChannelPinned = isChannelPinned(targetChannel);
|
|
11152
|
+
var isTargetChannelArchived = isChannelArchived(targetChannel);
|
|
11153
|
+
var considerArchivedChannels = shouldConsiderArchivedChannels(filters);
|
|
11154
|
+
var considerPinnedChannels = shouldConsiderPinnedChannels(sort);
|
|
11155
|
+
|
|
11156
|
+
if ( // filter is defined, target channel is archived and filter option is set to false
|
|
11157
|
+
considerArchivedChannels && isTargetChannelArchived && !filters.archived || // filter is defined, target channel isn't archived and filter option is set to true
|
|
11158
|
+
considerArchivedChannels && !isTargetChannelArchived && filters.archived || // sort option is defined, target channel is pinned
|
|
11159
|
+
considerPinnedChannels && isTargetChannelPinned || // list order is locked
|
|
11160
|
+
_this.options.lockChannelOrder || // target channel is not within the loaded list and loading from cache is disallowed
|
|
11161
|
+
!targetChannelExistsWithinList && !((_this$options$allowNo2 = _this.options.allowNotLoadedChannelPromotionForEvent) !== null && _this$options$allowNo2 !== void 0 && _this$options$allowNo2['message.new'])) {
|
|
11162
|
+
return;
|
|
11163
|
+
}
|
|
11164
|
+
|
|
11165
|
+
_this.setChannels(promoteChannel({
|
|
11166
|
+
channels: channels,
|
|
11167
|
+
channelToMove: targetChannel,
|
|
11168
|
+
channelToMoveIndexWithinChannels: targetChannelIndex,
|
|
11169
|
+
sort: sort
|
|
11170
|
+
}));
|
|
11171
|
+
});
|
|
11172
|
+
|
|
11173
|
+
_defineProperty(this, "notificationNewMessageHandler", /*#__PURE__*/function () {
|
|
11174
|
+
var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(event) {
|
|
11175
|
+
var _event$channel3, _this$options$allowNo3;
|
|
11176
|
+
|
|
11177
|
+
var _ref12, id, type, _this$state$getLatest7, channels, pagination, _ref13, filters, sort, channel, considerArchivedChannels, isTargetChannelArchived;
|
|
11178
|
+
|
|
11179
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
11180
|
+
while (1) {
|
|
11181
|
+
switch (_context4.prev = _context4.next) {
|
|
11182
|
+
case 0:
|
|
11183
|
+
_ref12 = (_event$channel3 = event === null || event === void 0 ? void 0 : event.channel) !== null && _event$channel3 !== void 0 ? _event$channel3 : {}, id = _ref12.id, type = _ref12.type;
|
|
11184
|
+
_this$state$getLatest7 = _this.state.getLatestValue(), channels = _this$state$getLatest7.channels, pagination = _this$state$getLatest7.pagination;
|
|
11185
|
+
_ref13 = pagination !== null && pagination !== void 0 ? pagination : {}, filters = _ref13.filters, sort = _ref13.sort;
|
|
11186
|
+
|
|
11187
|
+
if (!(!channels || !id || !type)) {
|
|
11188
|
+
_context4.next = 5;
|
|
11189
|
+
break;
|
|
11190
|
+
}
|
|
11191
|
+
|
|
11192
|
+
return _context4.abrupt("return");
|
|
11193
|
+
|
|
11194
|
+
case 5:
|
|
11195
|
+
_context4.next = 7;
|
|
11196
|
+
return getAndWatchChannel({
|
|
11197
|
+
client: _this.client,
|
|
11198
|
+
id: id,
|
|
11199
|
+
type: type
|
|
11200
|
+
});
|
|
11201
|
+
|
|
11202
|
+
case 7:
|
|
11203
|
+
channel = _context4.sent;
|
|
11204
|
+
considerArchivedChannels = shouldConsiderArchivedChannels(filters);
|
|
11205
|
+
isTargetChannelArchived = isChannelArchived(channel);
|
|
11206
|
+
|
|
11207
|
+
if (!(considerArchivedChannels && isTargetChannelArchived && !filters.archived || considerArchivedChannels && !isTargetChannelArchived && filters.archived || !((_this$options$allowNo3 = _this.options.allowNotLoadedChannelPromotionForEvent) !== null && _this$options$allowNo3 !== void 0 && _this$options$allowNo3['notification.message_new']))) {
|
|
11208
|
+
_context4.next = 12;
|
|
11209
|
+
break;
|
|
11210
|
+
}
|
|
11211
|
+
|
|
11212
|
+
return _context4.abrupt("return");
|
|
11213
|
+
|
|
11214
|
+
case 12:
|
|
11215
|
+
_this.setChannels(promoteChannel({
|
|
11216
|
+
channels: channels,
|
|
11217
|
+
channelToMove: channel,
|
|
11218
|
+
sort: sort
|
|
11219
|
+
}));
|
|
11220
|
+
|
|
11221
|
+
case 13:
|
|
11222
|
+
case "end":
|
|
11223
|
+
return _context4.stop();
|
|
11224
|
+
}
|
|
11225
|
+
}
|
|
11226
|
+
}, _callee4);
|
|
11227
|
+
}));
|
|
11228
|
+
|
|
11229
|
+
return function (_x3) {
|
|
11230
|
+
return _ref11.apply(this, arguments);
|
|
11231
|
+
};
|
|
11232
|
+
}());
|
|
11233
|
+
|
|
11234
|
+
_defineProperty(this, "channelVisibleHandler", /*#__PURE__*/function () {
|
|
11235
|
+
var _ref14 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(event) {
|
|
11236
|
+
var _this$options$allowNo4;
|
|
11237
|
+
|
|
11238
|
+
var _this$state$getLatest8, channels, pagination, _ref15, sort, filters, channelType, channelId, channel, considerArchivedChannels, isTargetChannelArchived;
|
|
11239
|
+
|
|
11240
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
11241
|
+
while (1) {
|
|
11242
|
+
switch (_context5.prev = _context5.next) {
|
|
11243
|
+
case 0:
|
|
11244
|
+
_this$state$getLatest8 = _this.state.getLatestValue(), channels = _this$state$getLatest8.channels, pagination = _this$state$getLatest8.pagination;
|
|
11245
|
+
_ref15 = pagination !== null && pagination !== void 0 ? pagination : {}, sort = _ref15.sort, filters = _ref15.filters;
|
|
11246
|
+
channelType = event.channel_type, channelId = event.channel_id;
|
|
11247
|
+
|
|
11248
|
+
if (!(!channels || !channelType || !channelId)) {
|
|
11249
|
+
_context5.next = 5;
|
|
11250
|
+
break;
|
|
11251
|
+
}
|
|
11252
|
+
|
|
11253
|
+
return _context5.abrupt("return");
|
|
11254
|
+
|
|
11255
|
+
case 5:
|
|
11256
|
+
_context5.next = 7;
|
|
11257
|
+
return getAndWatchChannel({
|
|
11258
|
+
client: _this.client,
|
|
11259
|
+
id: event.channel_id,
|
|
11260
|
+
type: event.channel_type
|
|
11261
|
+
});
|
|
11262
|
+
|
|
11263
|
+
case 7:
|
|
11264
|
+
channel = _context5.sent;
|
|
11265
|
+
considerArchivedChannels = shouldConsiderArchivedChannels(filters);
|
|
11266
|
+
isTargetChannelArchived = isChannelArchived(channel);
|
|
11267
|
+
|
|
11268
|
+
if (!(considerArchivedChannels && isTargetChannelArchived && !filters.archived || considerArchivedChannels && !isTargetChannelArchived && filters.archived || !((_this$options$allowNo4 = _this.options.allowNotLoadedChannelPromotionForEvent) !== null && _this$options$allowNo4 !== void 0 && _this$options$allowNo4['channel.visible']))) {
|
|
11269
|
+
_context5.next = 12;
|
|
11270
|
+
break;
|
|
11271
|
+
}
|
|
11272
|
+
|
|
11273
|
+
return _context5.abrupt("return");
|
|
11274
|
+
|
|
11275
|
+
case 12:
|
|
11276
|
+
_this.setChannels(promoteChannel({
|
|
11277
|
+
channels: channels,
|
|
11278
|
+
channelToMove: channel,
|
|
11279
|
+
sort: sort
|
|
11280
|
+
}));
|
|
11281
|
+
|
|
11282
|
+
case 13:
|
|
11283
|
+
case "end":
|
|
11284
|
+
return _context5.stop();
|
|
11285
|
+
}
|
|
11286
|
+
}
|
|
11287
|
+
}, _callee5);
|
|
11288
|
+
}));
|
|
11289
|
+
|
|
11290
|
+
return function (_x4) {
|
|
11291
|
+
return _ref14.apply(this, arguments);
|
|
11292
|
+
};
|
|
11293
|
+
}());
|
|
11294
|
+
|
|
11295
|
+
_defineProperty(this, "notificationRemovedFromChannelHandler", this.channelDeletedHandler);
|
|
11296
|
+
|
|
11297
|
+
_defineProperty(this, "memberUpdatedHandler", function (event) {
|
|
11298
|
+
var _event$member;
|
|
11299
|
+
|
|
11300
|
+
var _this$state$getLatest9 = _this.state.getLatestValue(),
|
|
11301
|
+
pagination = _this$state$getLatest9.pagination,
|
|
11302
|
+
channels = _this$state$getLatest9.channels;
|
|
11303
|
+
|
|
11304
|
+
var filters = pagination.filters,
|
|
11305
|
+
sort = pagination.sort;
|
|
11306
|
+
|
|
11307
|
+
if (!((_event$member = event.member) !== null && _event$member !== void 0 && _event$member.user) || event.member.user.id !== _this.client.userID || !event.channel_type || !event.channel_id) {
|
|
11308
|
+
return;
|
|
11309
|
+
}
|
|
11310
|
+
|
|
11311
|
+
var channelType = event.channel_type;
|
|
11312
|
+
var channelId = event.channel_id;
|
|
11313
|
+
var considerPinnedChannels = shouldConsiderPinnedChannels(sort);
|
|
11314
|
+
var considerArchivedChannels = shouldConsiderArchivedChannels(filters);
|
|
11315
|
+
var pinnedAtSort = extractSortValue({
|
|
11316
|
+
atIndex: 0,
|
|
11317
|
+
sort: sort,
|
|
11318
|
+
targetKey: 'pinned_at'
|
|
11319
|
+
});
|
|
11320
|
+
|
|
11321
|
+
if (!channels || !considerPinnedChannels && !considerArchivedChannels || _this.options.lockChannelOrder) {
|
|
11322
|
+
return;
|
|
11323
|
+
}
|
|
11324
|
+
|
|
11325
|
+
var targetChannel = _this.client.channel(channelType, channelId); // assumes that channel instances are not changing
|
|
11326
|
+
|
|
11327
|
+
|
|
11328
|
+
var targetChannelIndex = channels.indexOf(targetChannel);
|
|
11329
|
+
var targetChannelExistsWithinList = targetChannelIndex >= 0;
|
|
11330
|
+
var isTargetChannelPinned = isChannelPinned(targetChannel);
|
|
11331
|
+
var isTargetChannelArchived = isChannelArchived(targetChannel);
|
|
11332
|
+
|
|
11333
|
+
var newChannels = _toConsumableArray(channels);
|
|
11334
|
+
|
|
11335
|
+
if (targetChannelExistsWithinList) {
|
|
11336
|
+
newChannels.splice(targetChannelIndex, 1);
|
|
11337
|
+
} // handle archiving (remove channel)
|
|
11338
|
+
|
|
11339
|
+
|
|
11340
|
+
if ( // When archived filter true, and channel is unarchived
|
|
11341
|
+
considerArchivedChannels && !isTargetChannelArchived && filters !== null && filters !== void 0 && filters.archived || // When archived filter false, and channel is archived
|
|
11342
|
+
considerArchivedChannels && isTargetChannelArchived && !(filters !== null && filters !== void 0 && filters.archived)) {
|
|
11343
|
+
_this.setChannels(newChannels);
|
|
11344
|
+
|
|
11345
|
+
return;
|
|
11346
|
+
} // handle pinning
|
|
11347
|
+
|
|
11348
|
+
|
|
11349
|
+
var lastPinnedChannelIndex = null;
|
|
11350
|
+
|
|
11351
|
+
if (pinnedAtSort === 1 || pinnedAtSort === -1 && !isTargetChannelPinned) {
|
|
11352
|
+
lastPinnedChannelIndex = findLastPinnedChannelIndex({
|
|
11353
|
+
channels: newChannels
|
|
11354
|
+
});
|
|
11355
|
+
}
|
|
11356
|
+
|
|
11357
|
+
var newTargetChannelIndex = typeof lastPinnedChannelIndex === 'number' ? lastPinnedChannelIndex + 1 : 0; // skip state update if the position of the channel does not change
|
|
11358
|
+
|
|
11359
|
+
if (channels[newTargetChannelIndex] === targetChannel) {
|
|
11360
|
+
return;
|
|
11361
|
+
}
|
|
11362
|
+
|
|
11363
|
+
newChannels.splice(newTargetChannelIndex, 0, targetChannel);
|
|
11364
|
+
|
|
11365
|
+
_this.setChannels(newChannels);
|
|
11366
|
+
});
|
|
11367
|
+
|
|
11368
|
+
_defineProperty(this, "subscriptionOrOverride", function (event) {
|
|
11369
|
+
var handlerName = channelManagerEventToHandlerMapping[event.type];
|
|
11370
|
+
|
|
11371
|
+
var defaultEventHandler = _this.eventHandlers.get(handlerName);
|
|
11372
|
+
|
|
11373
|
+
var eventHandlerOverride = _this.eventHandlerOverrides.get(handlerName);
|
|
11374
|
+
|
|
11375
|
+
if (eventHandlerOverride && typeof eventHandlerOverride === 'function') {
|
|
11376
|
+
eventHandlerOverride(_this.setChannels, event);
|
|
11377
|
+
return;
|
|
11378
|
+
}
|
|
11379
|
+
|
|
11380
|
+
if (defaultEventHandler && typeof defaultEventHandler === 'function') {
|
|
11381
|
+
defaultEventHandler(event);
|
|
11382
|
+
}
|
|
11383
|
+
});
|
|
11384
|
+
|
|
11385
|
+
_defineProperty(this, "registerSubscriptions", function () {
|
|
11386
|
+
if (_this.unsubscribeFunctions.size) {
|
|
11387
|
+
// Already listening for events and changes
|
|
11388
|
+
return;
|
|
11389
|
+
}
|
|
11390
|
+
|
|
11391
|
+
for (var _i = 0, _Object$keys = Object.keys(channelManagerEventToHandlerMapping); _i < _Object$keys.length; _i++) {
|
|
11392
|
+
var eventType = _Object$keys[_i];
|
|
11393
|
+
|
|
11394
|
+
_this.unsubscribeFunctions.add(_this.client.on(eventType, _this.subscriptionOrOverride).unsubscribe);
|
|
11395
|
+
}
|
|
11396
|
+
});
|
|
11397
|
+
|
|
11398
|
+
_defineProperty(this, "unregisterSubscriptions", function () {
|
|
11399
|
+
_this.unsubscribeFunctions.forEach(function (cleanupFunction) {
|
|
11400
|
+
return cleanupFunction();
|
|
11401
|
+
});
|
|
11402
|
+
|
|
11403
|
+
_this.unsubscribeFunctions.clear();
|
|
11404
|
+
});
|
|
11405
|
+
|
|
11406
|
+
this.client = client;
|
|
11407
|
+
this.state = new StateStore({
|
|
11408
|
+
channels: [],
|
|
11409
|
+
pagination: {
|
|
11410
|
+
isLoading: false,
|
|
11411
|
+
isLoadingNext: false,
|
|
11412
|
+
hasNext: false,
|
|
11413
|
+
filters: {},
|
|
11414
|
+
sort: {},
|
|
11415
|
+
options: DEFAULT_CHANNEL_MANAGER_PAGINATION_OPTIONS
|
|
11416
|
+
},
|
|
11417
|
+
initialized: false
|
|
11418
|
+
});
|
|
11419
|
+
this.setEventHandlerOverrides(_eventHandlerOverrides);
|
|
11420
|
+
this.setOptions(_options);
|
|
11421
|
+
this.eventHandlers = new Map(Object.entries({
|
|
11422
|
+
channelDeletedHandler: this.channelDeletedHandler,
|
|
11423
|
+
channelHiddenHandler: this.channelHiddenHandler,
|
|
11424
|
+
channelVisibleHandler: this.channelVisibleHandler,
|
|
11425
|
+
memberUpdatedHandler: this.memberUpdatedHandler,
|
|
11426
|
+
newMessageHandler: this.newMessageHandler,
|
|
11427
|
+
notificationAddedToChannelHandler: this.notificationAddedToChannelHandler,
|
|
11428
|
+
notificationNewMessageHandler: this.notificationNewMessageHandler,
|
|
11429
|
+
notificationRemovedFromChannelHandler: this.notificationRemovedFromChannelHandler
|
|
11430
|
+
}));
|
|
11431
|
+
};
|
|
11432
|
+
|
|
10465
11433
|
var _excluded$1 = ["created_at", "updated_at", "last_active", "online"],
|
|
10466
11434
|
_excluded2 = ["params", "headers"];
|
|
10467
11435
|
|
|
@@ -10689,6 +11657,18 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10689
11657
|
};
|
|
10690
11658
|
}());
|
|
10691
11659
|
|
|
11660
|
+
_defineProperty(this, "createChannelManager", function (_ref3) {
|
|
11661
|
+
var _ref3$eventHandlerOve = _ref3.eventHandlerOverrides,
|
|
11662
|
+
eventHandlerOverrides = _ref3$eventHandlerOve === void 0 ? {} : _ref3$eventHandlerOve,
|
|
11663
|
+
_ref3$options = _ref3.options,
|
|
11664
|
+
options = _ref3$options === void 0 ? {} : _ref3$options;
|
|
11665
|
+
return new ChannelManager({
|
|
11666
|
+
client: _this,
|
|
11667
|
+
eventHandlerOverrides: eventHandlerOverrides,
|
|
11668
|
+
options: options
|
|
11669
|
+
});
|
|
11670
|
+
});
|
|
11671
|
+
|
|
10692
11672
|
_defineProperty(this, "openConnection", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
10693
11673
|
var _this$wsConnection3, _this$wsConnection4, _this$wsFallback3;
|
|
10694
11674
|
|
|
@@ -10758,7 +11738,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10758
11738
|
});
|
|
10759
11739
|
|
|
10760
11740
|
_defineProperty(this, "disconnectUser", /*#__PURE__*/function () {
|
|
10761
|
-
var
|
|
11741
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(timeout) {
|
|
10762
11742
|
var closePromise, _i, _Object$values, _channel;
|
|
10763
11743
|
|
|
10764
11744
|
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
@@ -10806,7 +11786,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10806
11786
|
}));
|
|
10807
11787
|
|
|
10808
11788
|
return function (_x4) {
|
|
10809
|
-
return
|
|
11789
|
+
return _ref5.apply(this, arguments);
|
|
10810
11790
|
};
|
|
10811
11791
|
}());
|
|
10812
11792
|
|
|
@@ -10834,7 +11814,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10834
11814
|
_defineProperty(this, "setAnonymousUser", this.connectAnonymousUser);
|
|
10835
11815
|
|
|
10836
11816
|
_defineProperty(this, "doAxiosRequest", /*#__PURE__*/function () {
|
|
10837
|
-
var
|
|
11817
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(type, url, data) {
|
|
10838
11818
|
var options,
|
|
10839
11819
|
requestConfig,
|
|
10840
11820
|
response,
|
|
@@ -10975,7 +11955,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
10975
11955
|
}));
|
|
10976
11956
|
|
|
10977
11957
|
return function (_x5, _x6, _x7) {
|
|
10978
|
-
return
|
|
11958
|
+
return _ref6.apply(this, arguments);
|
|
10979
11959
|
};
|
|
10980
11960
|
}());
|
|
10981
11961
|
|
|
@@ -11196,13 +12176,19 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11196
12176
|
})));
|
|
11197
12177
|
|
|
11198
12178
|
_defineProperty(this, "getChannelByMembers", function (channelType, custom) {
|
|
12179
|
+
var _custom$members;
|
|
12180
|
+
|
|
11199
12181
|
// Check if the channel already exists.
|
|
11200
12182
|
// Only allow 1 channel object per cid
|
|
11201
|
-
var
|
|
12183
|
+
var memberIds = ((_custom$members = custom.members) !== null && _custom$members !== void 0 ? _custom$members : []).map(function (member) {
|
|
12184
|
+
var _member$user_id;
|
|
11202
12185
|
|
|
11203
|
-
|
|
12186
|
+
return typeof member === 'string' ? member : (_member$user_id = member.user_id) !== null && _member$user_id !== void 0 ? _member$user_id : '';
|
|
12187
|
+
});
|
|
12188
|
+
var membersStr = memberIds.sort().join(',');
|
|
12189
|
+
var tempCid = generateChannelTempCid(channelType, memberIds);
|
|
11204
12190
|
|
|
11205
|
-
if (!
|
|
12191
|
+
if (!tempCid) {
|
|
11206
12192
|
throw Error('Please specify atleast one member when creating unique conversation');
|
|
11207
12193
|
} // channel could exist in `activeChannels` list with either one of the following two keys:
|
|
11208
12194
|
// 1. cid - Which gets set on channel only after calling channel.query or channel.watch or channel.create
|
|
@@ -13052,13 +14038,13 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13052
14038
|
key: "getRateLimits",
|
|
13053
14039
|
value: function () {
|
|
13054
14040
|
var _getRateLimits = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee29(params) {
|
|
13055
|
-
var
|
|
14041
|
+
var _ref8, serverSide, web, android, ios, endpoints;
|
|
13056
14042
|
|
|
13057
14043
|
return _regeneratorRuntime.wrap(function _callee29$(_context29) {
|
|
13058
14044
|
while (1) {
|
|
13059
14045
|
switch (_context29.prev = _context29.next) {
|
|
13060
14046
|
case 0:
|
|
13061
|
-
|
|
14047
|
+
_ref8 = params || {}, serverSide = _ref8.serverSide, web = _ref8.web, android = _ref8.android, ios = _ref8.ios, endpoints = _ref8.endpoints;
|
|
13062
14048
|
return _context29.abrupt("return", this.get(this.baseURL + '/rate_limits', {
|
|
13063
14049
|
server_side: serverSide,
|
|
13064
14050
|
web: web,
|
|
@@ -13083,9 +14069,9 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13083
14069
|
}()
|
|
13084
14070
|
}, {
|
|
13085
14071
|
key: "_addChannelConfig",
|
|
13086
|
-
value: function _addChannelConfig(
|
|
13087
|
-
var cid =
|
|
13088
|
-
config =
|
|
14072
|
+
value: function _addChannelConfig(_ref9) {
|
|
14073
|
+
var cid = _ref9.cid,
|
|
14074
|
+
config = _ref9.config;
|
|
13089
14075
|
|
|
13090
14076
|
if (this._cacheEnabled()) {
|
|
13091
14077
|
this.configs[cid] = config;
|
|
@@ -13109,7 +14095,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13109
14095
|
}, {
|
|
13110
14096
|
key: "channel",
|
|
13111
14097
|
value: function channel(channelType, channelIDOrCustom) {
|
|
13112
|
-
var _custom$
|
|
14098
|
+
var _custom$members2;
|
|
13113
14099
|
|
|
13114
14100
|
var custom = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
13115
14101
|
|
|
@@ -13127,7 +14113,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13127
14113
|
} // // support channel("messaging", undefined, {options})
|
|
13128
14114
|
|
|
13129
14115
|
|
|
13130
|
-
if (!channelIDOrCustom && _typeof(custom) === 'object' && (_custom$
|
|
14116
|
+
if (!channelIDOrCustom && _typeof(custom) === 'object' && (_custom$members2 = custom.members) !== null && _custom$members2 !== void 0 && _custom$members2.length) {
|
|
13131
14117
|
return this.getChannelByMembers(channelType, custom);
|
|
13132
14118
|
} // support channel("messaging", null, {options})
|
|
13133
14119
|
// support channel("messaging", undefined, {options})
|
|
@@ -15073,7 +16059,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15073
16059
|
}, {
|
|
15074
16060
|
key: "getUserAgent",
|
|
15075
16061
|
value: function getUserAgent() {
|
|
15076
|
-
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.
|
|
16062
|
+
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.56.0");
|
|
15077
16063
|
}
|
|
15078
16064
|
}, {
|
|
15079
16065
|
key: "setUserAgent",
|
|
@@ -15113,10 +16099,10 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
15113
16099
|
});
|
|
15114
16100
|
}
|
|
15115
16101
|
|
|
15116
|
-
var
|
|
15117
|
-
axiosRequestConfigParams =
|
|
15118
|
-
axiosRequestConfigHeaders =
|
|
15119
|
-
axiosRequestConfigRest = _objectWithoutProperties(
|
|
16102
|
+
var _ref10 = this.options.axiosRequestConfig || {},
|
|
16103
|
+
axiosRequestConfigParams = _ref10.params,
|
|
16104
|
+
axiosRequestConfigHeaders = _ref10.headers,
|
|
16105
|
+
axiosRequestConfigRest = _objectWithoutProperties(_ref10, _excluded2);
|
|
15120
16106
|
|
|
15121
16107
|
return _objectSpread$1(_objectSpread$1(_objectSpread$1({
|
|
15122
16108
|
params: _objectSpread$1(_objectSpread$1({
|
|
@@ -16459,13 +17445,13 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
16459
17445
|
}, {
|
|
16460
17446
|
key: "deletePushProvider",
|
|
16461
17447
|
value: function () {
|
|
16462
|
-
var _deletePushProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee97(
|
|
17448
|
+
var _deletePushProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee97(_ref11) {
|
|
16463
17449
|
var type, name;
|
|
16464
17450
|
return _regeneratorRuntime.wrap(function _callee97$(_context97) {
|
|
16465
17451
|
while (1) {
|
|
16466
17452
|
switch (_context97.prev = _context97.next) {
|
|
16467
17453
|
case 0:
|
|
16468
|
-
type =
|
|
17454
|
+
type = _ref11.type, name = _ref11.name;
|
|
16469
17455
|
_context97.next = 3;
|
|
16470
17456
|
return this.delete(this.baseURL + "/push_providers/".concat(encodeURIComponent(type), "/").concat(encodeURIComponent(name)));
|
|
16471
17457
|
|
|
@@ -18204,5 +19190,5 @@ var SearchController = /*#__PURE__*/function () {
|
|
|
18204
19190
|
return SearchController;
|
|
18205
19191
|
}();
|
|
18206
19192
|
|
|
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 };
|
|
19193
|
+
export { Allow, AllowAll, AnyResource, AnyRole, BaseSearchSource, BuiltinPermissions, BuiltinRoles, Campaign, Channel, ChannelManager, ChannelSearchSource, ChannelState, CheckSignature, ClientState, DEFAULT_CHANNEL_MANAGER_OPTIONS, DEFAULT_CHANNEL_MANAGER_PAGINATION_OPTIONS, 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, channelManagerEventToHandlerMapping, chatCodes, decodeBase64, encodeBase64, extractPollData, extractPollEnrichedData, formatMessage, isOwnUser, isPatch, isVoteAnswer, logChatPromiseExecution, postInsights };
|
|
18208
19194
|
//# sourceMappingURL=browser.es.js.map
|