stream-chat 8.36.0 → 8.38.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 +635 -133
- 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 +636 -132
- package/dist/browser.js.map +1 -1
- package/dist/index.es.js +635 -133
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +636 -132
- package/dist/index.js.map +1 -1
- package/dist/types/client.d.ts +42 -15
- 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/moderation.d.ts +107 -0
- package/dist/types/moderation.d.ts.map +1 -0
- package/dist/types/types.d.ts +139 -0
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +89 -36
- package/src/index.ts +1 -0
- package/src/moderation.ts +194 -0
- package/src/types.ts +186 -0
package/dist/browser.es.js
CHANGED
|
@@ -93,9 +93,9 @@ var decodeBase64 = function decodeBase64(s) {
|
|
|
93
93
|
|
|
94
94
|
var https = null;
|
|
95
95
|
|
|
96
|
-
function ownKeys$
|
|
96
|
+
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; }
|
|
97
97
|
|
|
98
|
-
function _objectSpread$
|
|
98
|
+
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; }
|
|
99
99
|
|
|
100
100
|
function _createForOfIteratorHelper$4(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$4(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function (_e) { function e(_x) { return _e.apply(this, arguments); } e.toString = function () { return _e.toString(); }; return e; }(function (e) { throw e; }), f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function (_e2) { function e(_x2) { return _e2.apply(this, arguments); } e.toString = function () { return _e2.toString(); }; return e; }(function (e) { didErr = true; err = e; }), f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
101
101
|
|
|
@@ -357,7 +357,7 @@ var axiosParamsSerializer = function axiosParamsSerializer(params) {
|
|
|
357
357
|
*/
|
|
358
358
|
|
|
359
359
|
function formatMessage(message) {
|
|
360
|
-
return _objectSpread$
|
|
360
|
+
return _objectSpread$9(_objectSpread$9({}, message), {}, {
|
|
361
361
|
/**
|
|
362
362
|
* @deprecated please use `html`
|
|
363
363
|
*/
|
|
@@ -456,9 +456,9 @@ function maybeGetReactionGroupsFallback(groups, counts, scores) {
|
|
|
456
456
|
return null;
|
|
457
457
|
}
|
|
458
458
|
|
|
459
|
-
function ownKeys$
|
|
459
|
+
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; }
|
|
460
460
|
|
|
461
|
-
function _objectSpread$
|
|
461
|
+
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; }
|
|
462
462
|
|
|
463
463
|
/**
|
|
464
464
|
* ChannelState - A container class for the channel state.
|
|
@@ -535,7 +535,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
535
535
|
if (!message) return;
|
|
536
536
|
if (message.poll_id !== pollVote.poll_id) return;
|
|
537
537
|
|
|
538
|
-
var updatedPoll = _objectSpread$
|
|
538
|
+
var updatedPoll = _objectSpread$8({}, poll);
|
|
539
539
|
|
|
540
540
|
var ownVotes = _toConsumableArray(((_message$poll = message.poll) === null || _message$poll === void 0 ? void 0 : _message$poll.own_votes) || []);
|
|
541
541
|
|
|
@@ -557,7 +557,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
557
557
|
|
|
558
558
|
updatedPoll.own_votes = ownVotes;
|
|
559
559
|
|
|
560
|
-
var newMessage = _objectSpread$
|
|
560
|
+
var newMessage = _objectSpread$8(_objectSpread$8({}, message), {}, {
|
|
561
561
|
poll: updatedPoll
|
|
562
562
|
});
|
|
563
563
|
|
|
@@ -572,7 +572,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
572
572
|
if (!message) return;
|
|
573
573
|
if (message.poll_id !== pollVote.poll_id) return;
|
|
574
574
|
|
|
575
|
-
var updatedPoll = _objectSpread$
|
|
575
|
+
var updatedPoll = _objectSpread$8({}, poll);
|
|
576
576
|
|
|
577
577
|
var ownVotes = _toConsumableArray(((_message$poll2 = message.poll) === null || _message$poll2 === void 0 ? void 0 : _message$poll2.own_votes) || []);
|
|
578
578
|
|
|
@@ -582,7 +582,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
582
582
|
|
|
583
583
|
updatedPoll.own_votes = ownVotes;
|
|
584
584
|
|
|
585
|
-
var newMessage = _objectSpread$
|
|
585
|
+
var newMessage = _objectSpread$8(_objectSpread$8({}, message), {}, {
|
|
586
586
|
poll: updatedPoll
|
|
587
587
|
});
|
|
588
588
|
|
|
@@ -597,7 +597,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
597
597
|
if (!message) return;
|
|
598
598
|
if (message.poll_id !== pollVote.poll_id) return;
|
|
599
599
|
|
|
600
|
-
var updatedPoll = _objectSpread$
|
|
600
|
+
var updatedPoll = _objectSpread$8({}, poll);
|
|
601
601
|
|
|
602
602
|
var ownVotes = _toConsumableArray(((_message$poll3 = message.poll) === null || _message$poll3 === void 0 ? void 0 : _message$poll3.own_votes) || []);
|
|
603
603
|
|
|
@@ -613,7 +613,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
613
613
|
|
|
614
614
|
updatedPoll.own_votes = ownVotes;
|
|
615
615
|
|
|
616
|
-
var newMessage = _objectSpread$
|
|
616
|
+
var newMessage = _objectSpread$8(_objectSpread$8({}, message), {}, {
|
|
617
617
|
poll: updatedPoll
|
|
618
618
|
});
|
|
619
619
|
|
|
@@ -627,11 +627,11 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
627
627
|
|
|
628
628
|
if (!message) return;
|
|
629
629
|
|
|
630
|
-
var updatedPoll = _objectSpread$
|
|
630
|
+
var updatedPoll = _objectSpread$8(_objectSpread$8({}, poll), {}, {
|
|
631
631
|
own_votes: _toConsumableArray(((_message$poll4 = message.poll) === null || _message$poll4 === void 0 ? void 0 : _message$poll4.own_votes) || [])
|
|
632
632
|
});
|
|
633
633
|
|
|
634
|
-
var newMessage = _objectSpread$
|
|
634
|
+
var newMessage = _objectSpread$8(_objectSpread$8({}, message), {}, {
|
|
635
635
|
poll: updatedPoll
|
|
636
636
|
});
|
|
637
637
|
|
|
@@ -646,7 +646,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
646
646
|
var m = messages[i];
|
|
647
647
|
|
|
648
648
|
if (((_m$user = m.user) === null || _m$user === void 0 ? void 0 : _m$user.id) === user.id) {
|
|
649
|
-
messages[i] = _objectSpread$
|
|
649
|
+
messages[i] = _objectSpread$8(_objectSpread$8({}, m), {}, {
|
|
650
650
|
user: user
|
|
651
651
|
});
|
|
652
652
|
}
|
|
@@ -701,7 +701,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
701
701
|
user: m.user
|
|
702
702
|
};
|
|
703
703
|
} else {
|
|
704
|
-
messages[i] = _objectSpread$
|
|
704
|
+
messages[i] = _objectSpread$8(_objectSpread$8({}, m), {}, {
|
|
705
705
|
type: 'deleted',
|
|
706
706
|
deleted_at: user.deleted_at
|
|
707
707
|
});
|
|
@@ -808,7 +808,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
808
808
|
}, {
|
|
809
809
|
key: "formatMessage",
|
|
810
810
|
value: function formatMessage(message) {
|
|
811
|
-
return _objectSpread$
|
|
811
|
+
return _objectSpread$8(_objectSpread$8({}, message), {}, {
|
|
812
812
|
/**
|
|
813
813
|
* @deprecated please use `html`
|
|
814
814
|
*/
|
|
@@ -1026,7 +1026,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
1026
1026
|
var parseMessage = function parseMessage(m) {
|
|
1027
1027
|
var _m$pinned_at, _m$updated_at;
|
|
1028
1028
|
|
|
1029
|
-
return _objectSpread$
|
|
1029
|
+
return _objectSpread$8(_objectSpread$8({}, m), {}, {
|
|
1030
1030
|
created_at: m.created_at.toISOString(),
|
|
1031
1031
|
pinned_at: (_m$pinned_at = m.pinned_at) === null || _m$pinned_at === void 0 ? void 0 : _m$pinned_at.toISOString(),
|
|
1032
1032
|
updated_at: (_m$updated_at = m.updated_at) === null || _m$updated_at === void 0 ? void 0 : _m$updated_at.toISOString()
|
|
@@ -1036,8 +1036,8 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
1036
1036
|
var update = function update(messages) {
|
|
1037
1037
|
var updatedMessages = messages.reduce(function (acc, msg) {
|
|
1038
1038
|
if (msg.quoted_message_id === message.id) {
|
|
1039
|
-
acc.push(_objectSpread$
|
|
1040
|
-
quoted_message: remove ? _objectSpread$
|
|
1039
|
+
acc.push(_objectSpread$8(_objectSpread$8({}, parseMessage(msg)), {}, {
|
|
1040
|
+
quoted_message: remove ? _objectSpread$8(_objectSpread$8({}, message), {}, {
|
|
1041
1041
|
attachments: []
|
|
1042
1042
|
}) : message
|
|
1043
1043
|
}));
|
|
@@ -1521,9 +1521,9 @@ function _unsupportedIterableToArray$3(o, minLen) { if (!o) return; if (typeof o
|
|
|
1521
1521
|
|
|
1522
1522
|
function _arrayLikeToArray$3(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; }
|
|
1523
1523
|
|
|
1524
|
-
function ownKeys$
|
|
1524
|
+
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; }
|
|
1525
1525
|
|
|
1526
|
-
function _objectSpread$
|
|
1526
|
+
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; }
|
|
1527
1527
|
|
|
1528
1528
|
/**
|
|
1529
1529
|
* Channel - The Channel class manages it's own state.
|
|
@@ -1596,7 +1596,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1596
1596
|
while (1) {
|
|
1597
1597
|
switch (_context.prev = _context.next) {
|
|
1598
1598
|
case 0:
|
|
1599
|
-
defaultOptions = _objectSpread$
|
|
1599
|
+
defaultOptions = _objectSpread$7(_objectSpread$7({}, options), {}, {
|
|
1600
1600
|
watch: false,
|
|
1601
1601
|
state: false,
|
|
1602
1602
|
presence: false
|
|
@@ -1668,7 +1668,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1668
1668
|
|
|
1669
1669
|
this.data = data; // this._data is used for the requests...
|
|
1670
1670
|
|
|
1671
|
-
this._data = _objectSpread$
|
|
1671
|
+
this._data = _objectSpread$7({}, data);
|
|
1672
1672
|
this.cid = "".concat(type, ":").concat(id);
|
|
1673
1673
|
this.listeners = {}; // perhaps the state variable should be private
|
|
1674
1674
|
|
|
@@ -1730,7 +1730,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1730
1730
|
switch (_context2.prev = _context2.next) {
|
|
1731
1731
|
case 0:
|
|
1732
1732
|
_context2.next = 2;
|
|
1733
|
-
return this.getClient().post(this._channelURL() + '/message', _objectSpread$
|
|
1733
|
+
return this.getClient().post(this._channelURL() + '/message', _objectSpread$7({
|
|
1734
1734
|
message: message
|
|
1735
1735
|
}, options));
|
|
1736
1736
|
|
|
@@ -1846,7 +1846,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1846
1846
|
|
|
1847
1847
|
case 3:
|
|
1848
1848
|
// Return a list of channels
|
|
1849
|
-
payload = _objectSpread$
|
|
1849
|
+
payload = _objectSpread$7(_objectSpread$7({
|
|
1850
1850
|
filter_conditions: {
|
|
1851
1851
|
cid: this.cid
|
|
1852
1852
|
}
|
|
@@ -1943,7 +1943,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1943
1943
|
|
|
1944
1944
|
_context5.next = 6;
|
|
1945
1945
|
return this.getClient().get(this.getClient().baseURL + '/members', {
|
|
1946
|
-
payload: _objectSpread$
|
|
1946
|
+
payload: _objectSpread$7({
|
|
1947
1947
|
type: type,
|
|
1948
1948
|
id: id,
|
|
1949
1949
|
members: members,
|
|
@@ -2004,7 +2004,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2004
2004
|
|
|
2005
2005
|
case 4:
|
|
2006
2006
|
_context6.next = 6;
|
|
2007
|
-
return this.getClient().post(this.getClient().baseURL + "/messages/".concat(messageID, "/reaction"), _objectSpread$
|
|
2007
|
+
return this.getClient().post(this.getClient().baseURL + "/messages/".concat(messageID, "/reaction"), _objectSpread$7({
|
|
2008
2008
|
reaction: reaction
|
|
2009
2009
|
}, options));
|
|
2010
2010
|
|
|
@@ -2085,7 +2085,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2085
2085
|
delete channelData[key];
|
|
2086
2086
|
});
|
|
2087
2087
|
_context7.next = 7;
|
|
2088
|
-
return this._update(_objectSpread$
|
|
2088
|
+
return this._update(_objectSpread$7({
|
|
2089
2089
|
message: updateMessage,
|
|
2090
2090
|
data: channelData
|
|
2091
2091
|
}, options));
|
|
@@ -2257,7 +2257,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2257
2257
|
case 0:
|
|
2258
2258
|
options = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {};
|
|
2259
2259
|
_context11.next = 3;
|
|
2260
|
-
return this.getClient().delete(this._channelURL(), _objectSpread$
|
|
2260
|
+
return this.getClient().delete(this._channelURL(), _objectSpread$7({}, options));
|
|
2261
2261
|
|
|
2262
2262
|
case 3:
|
|
2263
2263
|
return _context11.abrupt("return", _context11.sent);
|
|
@@ -2333,7 +2333,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2333
2333
|
case 0:
|
|
2334
2334
|
options = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {};
|
|
2335
2335
|
_context13.next = 3;
|
|
2336
|
-
return this._update(_objectSpread$
|
|
2336
|
+
return this._update(_objectSpread$7({
|
|
2337
2337
|
accept_invite: true
|
|
2338
2338
|
}, options));
|
|
2339
2339
|
|
|
@@ -2374,7 +2374,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2374
2374
|
case 0:
|
|
2375
2375
|
options = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {};
|
|
2376
2376
|
_context14.next = 3;
|
|
2377
|
-
return this._update(_objectSpread$
|
|
2377
|
+
return this._update(_objectSpread$7({
|
|
2378
2378
|
reject_invite: true
|
|
2379
2379
|
}, options));
|
|
2380
2380
|
|
|
@@ -2416,7 +2416,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2416
2416
|
case 0:
|
|
2417
2417
|
options = _args15.length > 2 && _args15[2] !== undefined ? _args15[2] : {};
|
|
2418
2418
|
_context15.next = 3;
|
|
2419
|
-
return this._update(_objectSpread$
|
|
2419
|
+
return this._update(_objectSpread$7({
|
|
2420
2420
|
add_members: members,
|
|
2421
2421
|
message: message
|
|
2422
2422
|
}, options));
|
|
@@ -2459,7 +2459,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2459
2459
|
case 0:
|
|
2460
2460
|
options = _args16.length > 2 && _args16[2] !== undefined ? _args16[2] : {};
|
|
2461
2461
|
_context16.next = 3;
|
|
2462
|
-
return this._update(_objectSpread$
|
|
2462
|
+
return this._update(_objectSpread$7({
|
|
2463
2463
|
add_moderators: members,
|
|
2464
2464
|
message: message
|
|
2465
2465
|
}, options));
|
|
@@ -2502,7 +2502,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2502
2502
|
case 0:
|
|
2503
2503
|
options = _args17.length > 2 && _args17[2] !== undefined ? _args17[2] : {};
|
|
2504
2504
|
_context17.next = 3;
|
|
2505
|
-
return this._update(_objectSpread$
|
|
2505
|
+
return this._update(_objectSpread$7({
|
|
2506
2506
|
assign_roles: roles,
|
|
2507
2507
|
message: message
|
|
2508
2508
|
}, options));
|
|
@@ -2545,7 +2545,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2545
2545
|
case 0:
|
|
2546
2546
|
options = _args18.length > 2 && _args18[2] !== undefined ? _args18[2] : {};
|
|
2547
2547
|
_context18.next = 3;
|
|
2548
|
-
return this._update(_objectSpread$
|
|
2548
|
+
return this._update(_objectSpread$7({
|
|
2549
2549
|
invites: members,
|
|
2550
2550
|
message: message
|
|
2551
2551
|
}, options));
|
|
@@ -2588,7 +2588,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2588
2588
|
case 0:
|
|
2589
2589
|
options = _args19.length > 2 && _args19[2] !== undefined ? _args19[2] : {};
|
|
2590
2590
|
_context19.next = 3;
|
|
2591
|
-
return this._update(_objectSpread$
|
|
2591
|
+
return this._update(_objectSpread$7({
|
|
2592
2592
|
remove_members: members,
|
|
2593
2593
|
message: message
|
|
2594
2594
|
}, options));
|
|
@@ -2631,7 +2631,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2631
2631
|
case 0:
|
|
2632
2632
|
options = _args20.length > 2 && _args20[2] !== undefined ? _args20[2] : {};
|
|
2633
2633
|
_context20.next = 3;
|
|
2634
|
-
return this._update(_objectSpread$
|
|
2634
|
+
return this._update(_objectSpread$7({
|
|
2635
2635
|
demote_moderators: members,
|
|
2636
2636
|
message: message
|
|
2637
2637
|
}, options));
|
|
@@ -2716,7 +2716,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2716
2716
|
case 0:
|
|
2717
2717
|
opts = _args22.length > 0 && _args22[0] !== undefined ? _args22[0] : {};
|
|
2718
2718
|
_context22.next = 3;
|
|
2719
|
-
return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$
|
|
2719
|
+
return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$7({
|
|
2720
2720
|
channel_cid: this.cid
|
|
2721
2721
|
}, opts));
|
|
2722
2722
|
|
|
@@ -2758,7 +2758,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2758
2758
|
case 0:
|
|
2759
2759
|
opts = _args23.length > 0 && _args23[0] !== undefined ? _args23[0] : {};
|
|
2760
2760
|
_context23.next = 3;
|
|
2761
|
-
return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$
|
|
2761
|
+
return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$7({
|
|
2762
2762
|
channel_cid: this.cid
|
|
2763
2763
|
}, opts));
|
|
2764
2764
|
|
|
@@ -2843,7 +2843,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2843
2843
|
|
|
2844
2844
|
this.lastTypingEvent = new Date();
|
|
2845
2845
|
_context24.next = 10;
|
|
2846
|
-
return this.sendEvent(_objectSpread$
|
|
2846
|
+
return this.sendEvent(_objectSpread$7({
|
|
2847
2847
|
type: 'typing.start',
|
|
2848
2848
|
parent_id: parent_id
|
|
2849
2849
|
}, options || {}));
|
|
@@ -2887,7 +2887,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2887
2887
|
this.lastTypingEvent = null;
|
|
2888
2888
|
this.isTyping = false;
|
|
2889
2889
|
_context25.next = 6;
|
|
2890
|
-
return this.sendEvent(_objectSpread$
|
|
2890
|
+
return this.sendEvent(_objectSpread$7({
|
|
2891
2891
|
type: 'typing.stop',
|
|
2892
2892
|
parent_id: parent_id
|
|
2893
2893
|
}, options || {}));
|
|
@@ -2974,7 +2974,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2974
2974
|
|
|
2975
2975
|
case 4:
|
|
2976
2976
|
_context26.next = 6;
|
|
2977
|
-
return this.getClient().post(this._channelURL() + '/read', _objectSpread$
|
|
2977
|
+
return this.getClient().post(this._channelURL() + '/read', _objectSpread$7({}, data));
|
|
2978
2978
|
|
|
2979
2979
|
case 6:
|
|
2980
2980
|
return _context26.abrupt("return", _context26.sent);
|
|
@@ -3021,7 +3021,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3021
3021
|
|
|
3022
3022
|
case 3:
|
|
3023
3023
|
_context27.next = 5;
|
|
3024
|
-
return this.getClient().post(this._channelURL() + '/unread', _objectSpread$
|
|
3024
|
+
return this.getClient().post(this._channelURL() + '/unread', _objectSpread$7({}, data));
|
|
3025
3025
|
|
|
3026
3026
|
case 5:
|
|
3027
3027
|
return _context27.abrupt("return", _context27.sent);
|
|
@@ -3089,7 +3089,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3089
3089
|
defaultOptions.watch = false;
|
|
3090
3090
|
}
|
|
3091
3091
|
|
|
3092
|
-
combined = _objectSpread$
|
|
3092
|
+
combined = _objectSpread$7(_objectSpread$7({}, defaultOptions), options);
|
|
3093
3093
|
_context28.next = 7;
|
|
3094
3094
|
return this.query(combined, 'latest');
|
|
3095
3095
|
|
|
@@ -3181,7 +3181,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3181
3181
|
case 0:
|
|
3182
3182
|
normalizedSort = sort ? normalizeQuerySort(sort) : undefined;
|
|
3183
3183
|
_context30.next = 3;
|
|
3184
|
-
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(parent_id, "/replies"), _objectSpread$
|
|
3184
|
+
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(parent_id, "/replies"), _objectSpread$7({
|
|
3185
3185
|
sort: normalizedSort
|
|
3186
3186
|
}, options));
|
|
3187
3187
|
|
|
@@ -3231,7 +3231,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3231
3231
|
sort = _args31.length > 1 && _args31[1] !== undefined ? _args31[1] : [];
|
|
3232
3232
|
_context31.next = 3;
|
|
3233
3233
|
return this.getClient().get(this.getClient().baseURL + "/channels/".concat(this.type, "/").concat(this.id, "/pinned_messages"), {
|
|
3234
|
-
payload: _objectSpread$
|
|
3234
|
+
payload: _objectSpread$7(_objectSpread$7({}, options), {}, {
|
|
3235
3235
|
sort: normalizeQuerySort(sort)
|
|
3236
3236
|
})
|
|
3237
3237
|
});
|
|
@@ -3265,7 +3265,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3265
3265
|
}, {
|
|
3266
3266
|
key: "getReactions",
|
|
3267
3267
|
value: function getReactions(message_id, options) {
|
|
3268
|
-
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(message_id, "/reactions"), _objectSpread$
|
|
3268
|
+
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(message_id, "/reactions"), _objectSpread$7({}, options));
|
|
3269
3269
|
}
|
|
3270
3270
|
/**
|
|
3271
3271
|
* getMessagesById - Retrieves a list of messages by ID
|
|
@@ -3413,7 +3413,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3413
3413
|
}
|
|
3414
3414
|
|
|
3415
3415
|
_context32.next = 7;
|
|
3416
|
-
return this.getClient().post(queryURL + '/query', _objectSpread$
|
|
3416
|
+
return this.getClient().post(queryURL + '/query', _objectSpread$7({
|
|
3417
3417
|
data: this._data,
|
|
3418
3418
|
state: true
|
|
3419
3419
|
}, options));
|
|
@@ -3502,7 +3502,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3502
3502
|
this._checkInitialized();
|
|
3503
3503
|
|
|
3504
3504
|
_context33.next = 3;
|
|
3505
|
-
return this.getClient().banUser(targetUserID, _objectSpread$
|
|
3505
|
+
return this.getClient().banUser(targetUserID, _objectSpread$7(_objectSpread$7({}, options), {}, {
|
|
3506
3506
|
type: this.type,
|
|
3507
3507
|
id: this.id
|
|
3508
3508
|
}));
|
|
@@ -3674,7 +3674,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3674
3674
|
this._checkInitialized();
|
|
3675
3675
|
|
|
3676
3676
|
_context37.next = 3;
|
|
3677
|
-
return this.getClient().shadowBan(targetUserID, _objectSpread$
|
|
3677
|
+
return this.getClient().shadowBan(targetUserID, _objectSpread$7(_objectSpread$7({}, options), {}, {
|
|
3678
3678
|
type: this.type,
|
|
3679
3679
|
id: this.id
|
|
3680
3680
|
}));
|
|
@@ -4128,7 +4128,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4128
4128
|
});
|
|
4129
4129
|
}
|
|
4130
4130
|
|
|
4131
|
-
channel.data = _objectSpread$
|
|
4131
|
+
channel.data = _objectSpread$7(_objectSpread$7({}, event.channel), {}, {
|
|
4132
4132
|
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,
|
|
4133
4133
|
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
|
|
4134
4134
|
});
|
|
@@ -4202,7 +4202,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4202
4202
|
break;
|
|
4203
4203
|
|
|
4204
4204
|
case 'channel.hidden':
|
|
4205
|
-
channel.data = _objectSpread$
|
|
4205
|
+
channel.data = _objectSpread$7(_objectSpread$7({}, channel.data), {}, {
|
|
4206
4206
|
hidden: true
|
|
4207
4207
|
});
|
|
4208
4208
|
|
|
@@ -4213,26 +4213,26 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4213
4213
|
break;
|
|
4214
4214
|
|
|
4215
4215
|
case 'channel.visible':
|
|
4216
|
-
channel.data = _objectSpread$
|
|
4216
|
+
channel.data = _objectSpread$7(_objectSpread$7({}, channel.data), {}, {
|
|
4217
4217
|
hidden: false
|
|
4218
4218
|
});
|
|
4219
4219
|
break;
|
|
4220
4220
|
|
|
4221
4221
|
case 'user.banned':
|
|
4222
4222
|
if (!((_event$user11 = event.user) !== null && _event$user11 !== void 0 && _event$user11.id)) break;
|
|
4223
|
-
channelState.members[event.user.id] = _objectSpread$
|
|
4223
|
+
channelState.members[event.user.id] = _objectSpread$7(_objectSpread$7({}, channelState.members[event.user.id] || {}), {}, {
|
|
4224
4224
|
shadow_banned: !!event.shadow,
|
|
4225
4225
|
banned: !event.shadow,
|
|
4226
|
-
user: _objectSpread$
|
|
4226
|
+
user: _objectSpread$7(_objectSpread$7({}, ((_channelState$members = channelState.members[event.user.id]) === null || _channelState$members === void 0 ? void 0 : _channelState$members.user) || {}), event.user)
|
|
4227
4227
|
});
|
|
4228
4228
|
break;
|
|
4229
4229
|
|
|
4230
4230
|
case 'user.unbanned':
|
|
4231
4231
|
if (!((_event$user12 = event.user) !== null && _event$user12 !== void 0 && _event$user12.id)) break;
|
|
4232
|
-
channelState.members[event.user.id] = _objectSpread$
|
|
4232
|
+
channelState.members[event.user.id] = _objectSpread$7(_objectSpread$7({}, channelState.members[event.user.id] || {}), {}, {
|
|
4233
4233
|
shadow_banned: false,
|
|
4234
4234
|
banned: false,
|
|
4235
|
-
user: _objectSpread$
|
|
4235
|
+
user: _objectSpread$7(_objectSpread$7({}, ((_channelState$members2 = channelState.members[event.user.id]) === null || _channelState$members2 === void 0 ? void 0 : _channelState$members2.user) || {}), event.user)
|
|
4236
4236
|
});
|
|
4237
4237
|
break;
|
|
4238
4238
|
} // any event can send over the online count
|
|
@@ -4486,9 +4486,9 @@ var ClientState = /*#__PURE__*/function () {
|
|
|
4486
4486
|
return ClientState;
|
|
4487
4487
|
}();
|
|
4488
4488
|
|
|
4489
|
-
function ownKeys$
|
|
4489
|
+
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; }
|
|
4490
4490
|
|
|
4491
|
-
function _objectSpread$
|
|
4491
|
+
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; }
|
|
4492
4492
|
var InsightMetrics = function InsightMetrics() {
|
|
4493
4493
|
_classCallCheck(this, InsightMetrics);
|
|
4494
4494
|
|
|
@@ -4567,7 +4567,7 @@ var postInsights = /*#__PURE__*/function () {
|
|
|
4567
4567
|
};
|
|
4568
4568
|
}();
|
|
4569
4569
|
function buildWsFatalInsight(connection, event) {
|
|
4570
|
-
return _objectSpread$
|
|
4570
|
+
return _objectSpread$6(_objectSpread$6({}, event), buildWsBaseInsight(connection));
|
|
4571
4571
|
}
|
|
4572
4572
|
|
|
4573
4573
|
function buildWsBaseInsight(connection) {
|
|
@@ -4600,9 +4600,9 @@ function buildWsSuccessAfterFailureInsight(connection) {
|
|
|
4600
4600
|
return buildWsBaseInsight(connection);
|
|
4601
4601
|
}
|
|
4602
4602
|
|
|
4603
|
-
function ownKeys$
|
|
4603
|
+
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; }
|
|
4604
4604
|
|
|
4605
|
-
function _objectSpread$
|
|
4605
|
+
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; }
|
|
4606
4606
|
|
|
4607
4607
|
// Type guards to check WebSocket error type
|
|
4608
4608
|
var isCloseEvent = function isCloseEvent(res) {
|
|
@@ -4966,7 +4966,7 @@ var StableWSConnection = /*#__PURE__*/function () {
|
|
|
4966
4966
|
value: function _log(msg) {
|
|
4967
4967
|
var extra = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
4968
4968
|
var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'info';
|
|
4969
|
-
this.client.logger(level, 'connection:' + msg, _objectSpread$
|
|
4969
|
+
this.client.logger(level, 'connection:' + msg, _objectSpread$5({
|
|
4970
4970
|
tags: ['connection']
|
|
4971
4971
|
}, extra));
|
|
4972
4972
|
}
|
|
@@ -5561,9 +5561,9 @@ var jwt = null;
|
|
|
5561
5561
|
|
|
5562
5562
|
var crypto$1 = null;
|
|
5563
5563
|
|
|
5564
|
-
function ownKeys$
|
|
5564
|
+
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; }
|
|
5565
5565
|
|
|
5566
|
-
function _objectSpread$
|
|
5566
|
+
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; }
|
|
5567
5567
|
|
|
5568
5568
|
/**
|
|
5569
5569
|
* Creates the JWT token that can be used for a UserSession
|
|
@@ -5584,7 +5584,7 @@ function JWTUserToken(apiSecret, userId) {
|
|
|
5584
5584
|
throw new TypeError('userId should be a string');
|
|
5585
5585
|
}
|
|
5586
5586
|
|
|
5587
|
-
var payload = _objectSpread$
|
|
5587
|
+
var payload = _objectSpread$4({
|
|
5588
5588
|
user_id: userId
|
|
5589
5589
|
}, extraData); // make sure we return a clear error when jwt is shimmed (ie. browser build)
|
|
5590
5590
|
|
|
@@ -5988,9 +5988,9 @@ function isErrorResponse(res) {
|
|
|
5988
5988
|
return !res.status || res.status < 200 || 300 <= res.status;
|
|
5989
5989
|
}
|
|
5990
5990
|
|
|
5991
|
-
function ownKeys$
|
|
5991
|
+
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; }
|
|
5992
5992
|
|
|
5993
|
-
function _objectSpread$
|
|
5993
|
+
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; }
|
|
5994
5994
|
var ConnectionState;
|
|
5995
5995
|
|
|
5996
5996
|
(function (ConnectionState) {
|
|
@@ -6053,7 +6053,7 @@ var WSConnectionFallback = /*#__PURE__*/function () {
|
|
|
6053
6053
|
_context.next = 4;
|
|
6054
6054
|
return _this.client.doAxiosRequest('get', _this.client.baseURL.replace(':3030', ':8900') + '/longpoll', // replace port if present for testing with local API
|
|
6055
6055
|
undefined, {
|
|
6056
|
-
config: _objectSpread$
|
|
6056
|
+
config: _objectSpread$3(_objectSpread$3({}, config), {}, {
|
|
6057
6057
|
cancelToken: (_this$cancelToken2 = _this.cancelToken) === null || _this$cancelToken2 === void 0 ? void 0 : _this$cancelToken2.token
|
|
6058
6058
|
}),
|
|
6059
6059
|
params: params
|
|
@@ -6331,7 +6331,7 @@ var WSConnectionFallback = /*#__PURE__*/function () {
|
|
|
6331
6331
|
value: function _log(msg) {
|
|
6332
6332
|
var extra = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
6333
6333
|
var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'info';
|
|
6334
|
-
this.client.logger(level, 'WSConnectionFallback:' + msg, _objectSpread$
|
|
6334
|
+
this.client.logger(level, 'WSConnectionFallback:' + msg, _objectSpread$3({
|
|
6335
6335
|
tags: ['connection_fallback', 'connection']
|
|
6336
6336
|
}, extra));
|
|
6337
6337
|
}
|
|
@@ -6913,9 +6913,9 @@ var VotingVisibility;
|
|
|
6913
6913
|
|
|
6914
6914
|
var _excluded$1 = ["parent_message_id", "parent_message", "latest_replies", "thread_participants", "reply_count", "channel", "read"];
|
|
6915
6915
|
|
|
6916
|
-
function ownKeys$
|
|
6916
|
+
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; }
|
|
6917
6917
|
|
|
6918
|
-
function _objectSpread$
|
|
6918
|
+
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; }
|
|
6919
6919
|
|
|
6920
6920
|
function _createForOfIteratorHelper$1(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$1(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
6921
6921
|
|
|
@@ -6972,7 +6972,7 @@ var Thread = /*#__PURE__*/function () {
|
|
|
6972
6972
|
try {
|
|
6973
6973
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
6974
6974
|
var r = _step.value;
|
|
6975
|
-
this.read[r.user.id] = _objectSpread$
|
|
6975
|
+
this.read[r.user.id] = _objectSpread$2(_objectSpread$2({}, r), {}, {
|
|
6976
6976
|
last_read: new Date(r.last_read)
|
|
6977
6977
|
});
|
|
6978
6978
|
}
|
|
@@ -7070,6 +7070,424 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7070
7070
|
return Thread;
|
|
7071
7071
|
}();
|
|
7072
7072
|
|
|
7073
|
+
function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
7074
|
+
|
|
7075
|
+
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
7076
|
+
var MODERATION_ENTITY_TYPES = {
|
|
7077
|
+
user: 'stream:user',
|
|
7078
|
+
message: 'stream:chat:v1:message'
|
|
7079
|
+
}; // Moderation class provides all the endpoints related to moderation v2.
|
|
7080
|
+
|
|
7081
|
+
var Moderation = /*#__PURE__*/function () {
|
|
7082
|
+
function Moderation(client) {
|
|
7083
|
+
_classCallCheck(this, Moderation);
|
|
7084
|
+
|
|
7085
|
+
_defineProperty(this, "client", void 0);
|
|
7086
|
+
|
|
7087
|
+
this.client = client;
|
|
7088
|
+
}
|
|
7089
|
+
/**
|
|
7090
|
+
* Flag a user
|
|
7091
|
+
*
|
|
7092
|
+
* @param {string} flaggedUserID User ID to be flagged
|
|
7093
|
+
* @param {string} reason Reason for flagging the user
|
|
7094
|
+
* @param {Object} options Additional options for flagging the user
|
|
7095
|
+
* @param {string} options.user_id (For server side usage) User ID of the user who is flagging the target user
|
|
7096
|
+
* @param {Object} options.custom Additional data to be stored with the flag
|
|
7097
|
+
* @returns
|
|
7098
|
+
*/
|
|
7099
|
+
|
|
7100
|
+
|
|
7101
|
+
_createClass(Moderation, [{
|
|
7102
|
+
key: "flagUser",
|
|
7103
|
+
value: function () {
|
|
7104
|
+
var _flagUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(flaggedUserID, reason) {
|
|
7105
|
+
var options,
|
|
7106
|
+
_args = arguments;
|
|
7107
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
7108
|
+
while (1) {
|
|
7109
|
+
switch (_context.prev = _context.next) {
|
|
7110
|
+
case 0:
|
|
7111
|
+
options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
|
|
7112
|
+
return _context.abrupt("return", this.flag(MODERATION_ENTITY_TYPES.user, flaggedUserID, '', reason, options));
|
|
7113
|
+
|
|
7114
|
+
case 2:
|
|
7115
|
+
case "end":
|
|
7116
|
+
return _context.stop();
|
|
7117
|
+
}
|
|
7118
|
+
}
|
|
7119
|
+
}, _callee, this);
|
|
7120
|
+
}));
|
|
7121
|
+
|
|
7122
|
+
function flagUser(_x, _x2) {
|
|
7123
|
+
return _flagUser.apply(this, arguments);
|
|
7124
|
+
}
|
|
7125
|
+
|
|
7126
|
+
return flagUser;
|
|
7127
|
+
}()
|
|
7128
|
+
/**
|
|
7129
|
+
* Flag a message
|
|
7130
|
+
*
|
|
7131
|
+
* @param {string} messageID Message ID to be flagged
|
|
7132
|
+
* @param {string} reason Reason for flagging the message
|
|
7133
|
+
* @param {Object} options Additional options for flagging the message
|
|
7134
|
+
* @param {string} options.user_id (For server side usage) User ID of the user who is flagging the target message
|
|
7135
|
+
* @param {Object} options.custom Additional data to be stored with the flag
|
|
7136
|
+
* @returns
|
|
7137
|
+
*/
|
|
7138
|
+
|
|
7139
|
+
}, {
|
|
7140
|
+
key: "flagMessage",
|
|
7141
|
+
value: function () {
|
|
7142
|
+
var _flagMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(messageID, reason) {
|
|
7143
|
+
var options,
|
|
7144
|
+
_args2 = arguments;
|
|
7145
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
7146
|
+
while (1) {
|
|
7147
|
+
switch (_context2.prev = _context2.next) {
|
|
7148
|
+
case 0:
|
|
7149
|
+
options = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {};
|
|
7150
|
+
return _context2.abrupt("return", this.flag(MODERATION_ENTITY_TYPES.message, messageID, '', reason, options));
|
|
7151
|
+
|
|
7152
|
+
case 2:
|
|
7153
|
+
case "end":
|
|
7154
|
+
return _context2.stop();
|
|
7155
|
+
}
|
|
7156
|
+
}
|
|
7157
|
+
}, _callee2, this);
|
|
7158
|
+
}));
|
|
7159
|
+
|
|
7160
|
+
function flagMessage(_x3, _x4) {
|
|
7161
|
+
return _flagMessage.apply(this, arguments);
|
|
7162
|
+
}
|
|
7163
|
+
|
|
7164
|
+
return flagMessage;
|
|
7165
|
+
}()
|
|
7166
|
+
/**
|
|
7167
|
+
* Flag a user
|
|
7168
|
+
*
|
|
7169
|
+
* @param {string} entityType Entity type to be flagged
|
|
7170
|
+
* @param {string} entityId Entity ID to be flagged
|
|
7171
|
+
* @param {string} entityCreatorID User ID of the entity creator
|
|
7172
|
+
* @param {string} reason Reason for flagging the entity
|
|
7173
|
+
* @param {Object} options Additional options for flagging the entity
|
|
7174
|
+
* @param {string} options.user_id (For server side usage) User ID of the user who is flagging the target entity
|
|
7175
|
+
* @param {Object} options.moderation_payload Content to be flagged e.g., { texts: ['text1', 'text2'], images: ['image1', 'image2']}
|
|
7176
|
+
* @param {Object} options.custom Additional data to be stored with the flag
|
|
7177
|
+
* @returns
|
|
7178
|
+
*/
|
|
7179
|
+
|
|
7180
|
+
}, {
|
|
7181
|
+
key: "flag",
|
|
7182
|
+
value: function () {
|
|
7183
|
+
var _flag = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(entityType, entityId, entityCreatorID, reason) {
|
|
7184
|
+
var options,
|
|
7185
|
+
_args3 = arguments;
|
|
7186
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
7187
|
+
while (1) {
|
|
7188
|
+
switch (_context3.prev = _context3.next) {
|
|
7189
|
+
case 0:
|
|
7190
|
+
options = _args3.length > 4 && _args3[4] !== undefined ? _args3[4] : {};
|
|
7191
|
+
_context3.next = 3;
|
|
7192
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/flag', _objectSpread$1({
|
|
7193
|
+
entity_type: entityType,
|
|
7194
|
+
entity_id: entityId,
|
|
7195
|
+
entity_creator_id: entityCreatorID,
|
|
7196
|
+
reason: reason
|
|
7197
|
+
}, options));
|
|
7198
|
+
|
|
7199
|
+
case 3:
|
|
7200
|
+
return _context3.abrupt("return", _context3.sent);
|
|
7201
|
+
|
|
7202
|
+
case 4:
|
|
7203
|
+
case "end":
|
|
7204
|
+
return _context3.stop();
|
|
7205
|
+
}
|
|
7206
|
+
}
|
|
7207
|
+
}, _callee3, this);
|
|
7208
|
+
}));
|
|
7209
|
+
|
|
7210
|
+
function flag(_x5, _x6, _x7, _x8) {
|
|
7211
|
+
return _flag.apply(this, arguments);
|
|
7212
|
+
}
|
|
7213
|
+
|
|
7214
|
+
return flag;
|
|
7215
|
+
}()
|
|
7216
|
+
/**
|
|
7217
|
+
* Mute a user
|
|
7218
|
+
* @param {string} targetID User ID to be muted
|
|
7219
|
+
* @param {Object} options Additional options for muting the user
|
|
7220
|
+
* @param {string} options.user_id (For server side usage) User ID of the user who is muting the target user
|
|
7221
|
+
* @param {number} options.timeout Timeout for the mute in minutes
|
|
7222
|
+
* @returns
|
|
7223
|
+
*/
|
|
7224
|
+
|
|
7225
|
+
}, {
|
|
7226
|
+
key: "muteUser",
|
|
7227
|
+
value: function () {
|
|
7228
|
+
var _muteUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(targetID) {
|
|
7229
|
+
var options,
|
|
7230
|
+
_args4 = arguments;
|
|
7231
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
7232
|
+
while (1) {
|
|
7233
|
+
switch (_context4.prev = _context4.next) {
|
|
7234
|
+
case 0:
|
|
7235
|
+
options = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
|
|
7236
|
+
_context4.next = 3;
|
|
7237
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/mute', _objectSpread$1({
|
|
7238
|
+
target_ids: [targetID]
|
|
7239
|
+
}, options));
|
|
7240
|
+
|
|
7241
|
+
case 3:
|
|
7242
|
+
return _context4.abrupt("return", _context4.sent);
|
|
7243
|
+
|
|
7244
|
+
case 4:
|
|
7245
|
+
case "end":
|
|
7246
|
+
return _context4.stop();
|
|
7247
|
+
}
|
|
7248
|
+
}
|
|
7249
|
+
}, _callee4, this);
|
|
7250
|
+
}));
|
|
7251
|
+
|
|
7252
|
+
function muteUser(_x9) {
|
|
7253
|
+
return _muteUser.apply(this, arguments);
|
|
7254
|
+
}
|
|
7255
|
+
|
|
7256
|
+
return muteUser;
|
|
7257
|
+
}()
|
|
7258
|
+
/**
|
|
7259
|
+
* Unmute a user
|
|
7260
|
+
* @param {string} targetID User ID to be unmuted
|
|
7261
|
+
* @param {Object} options Additional options for unmuting the user
|
|
7262
|
+
* @param {string} options.user_id (For server side usage) User ID of the user who is unmuting the target user
|
|
7263
|
+
* @returns
|
|
7264
|
+
*/
|
|
7265
|
+
|
|
7266
|
+
}, {
|
|
7267
|
+
key: "unmuteUser",
|
|
7268
|
+
value: function () {
|
|
7269
|
+
var _unmuteUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(targetID, options) {
|
|
7270
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
7271
|
+
while (1) {
|
|
7272
|
+
switch (_context5.prev = _context5.next) {
|
|
7273
|
+
case 0:
|
|
7274
|
+
_context5.next = 2;
|
|
7275
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/unmute', _objectSpread$1({
|
|
7276
|
+
target_ids: [targetID]
|
|
7277
|
+
}, options));
|
|
7278
|
+
|
|
7279
|
+
case 2:
|
|
7280
|
+
return _context5.abrupt("return", _context5.sent);
|
|
7281
|
+
|
|
7282
|
+
case 3:
|
|
7283
|
+
case "end":
|
|
7284
|
+
return _context5.stop();
|
|
7285
|
+
}
|
|
7286
|
+
}
|
|
7287
|
+
}, _callee5, this);
|
|
7288
|
+
}));
|
|
7289
|
+
|
|
7290
|
+
function unmuteUser(_x10, _x11) {
|
|
7291
|
+
return _unmuteUser.apply(this, arguments);
|
|
7292
|
+
}
|
|
7293
|
+
|
|
7294
|
+
return unmuteUser;
|
|
7295
|
+
}()
|
|
7296
|
+
/**
|
|
7297
|
+
* Get moderation report for a user
|
|
7298
|
+
* @param {string} userID User ID for which moderation report is to be fetched
|
|
7299
|
+
* @param {Object} options Additional options for fetching the moderation report
|
|
7300
|
+
* @param {boolean} options.create_user_if_not_exists Create user if not exists
|
|
7301
|
+
* @param {boolean} options.include_user_blocks Include user blocks
|
|
7302
|
+
* @param {boolean} options.include_user_mutes Include user mutes
|
|
7303
|
+
*/
|
|
7304
|
+
|
|
7305
|
+
}, {
|
|
7306
|
+
key: "getUserModerationReport",
|
|
7307
|
+
value: function () {
|
|
7308
|
+
var _getUserModerationReport = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(userID) {
|
|
7309
|
+
var options,
|
|
7310
|
+
_args6 = arguments;
|
|
7311
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
7312
|
+
while (1) {
|
|
7313
|
+
switch (_context6.prev = _context6.next) {
|
|
7314
|
+
case 0:
|
|
7315
|
+
options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
|
|
7316
|
+
_context6.next = 3;
|
|
7317
|
+
return this.client.get(this.client.baseURL + "/api/v2/moderation/user_report", _objectSpread$1({
|
|
7318
|
+
user_id: userID
|
|
7319
|
+
}, options));
|
|
7320
|
+
|
|
7321
|
+
case 3:
|
|
7322
|
+
return _context6.abrupt("return", _context6.sent);
|
|
7323
|
+
|
|
7324
|
+
case 4:
|
|
7325
|
+
case "end":
|
|
7326
|
+
return _context6.stop();
|
|
7327
|
+
}
|
|
7328
|
+
}
|
|
7329
|
+
}, _callee6, this);
|
|
7330
|
+
}));
|
|
7331
|
+
|
|
7332
|
+
function getUserModerationReport(_x12) {
|
|
7333
|
+
return _getUserModerationReport.apply(this, arguments);
|
|
7334
|
+
}
|
|
7335
|
+
|
|
7336
|
+
return getUserModerationReport;
|
|
7337
|
+
}()
|
|
7338
|
+
/**
|
|
7339
|
+
* Query review queue
|
|
7340
|
+
* @param {Object} filterConditions Filter conditions for querying review queue
|
|
7341
|
+
* @param {Object} sort Sort conditions for querying review queue
|
|
7342
|
+
* @param {Object} options Pagination options for querying review queue
|
|
7343
|
+
*/
|
|
7344
|
+
|
|
7345
|
+
}, {
|
|
7346
|
+
key: "queryReviewQueue",
|
|
7347
|
+
value: function () {
|
|
7348
|
+
var _queryReviewQueue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
7349
|
+
var filterConditions,
|
|
7350
|
+
sort,
|
|
7351
|
+
options,
|
|
7352
|
+
_args7 = arguments;
|
|
7353
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
7354
|
+
while (1) {
|
|
7355
|
+
switch (_context7.prev = _context7.next) {
|
|
7356
|
+
case 0:
|
|
7357
|
+
filterConditions = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {};
|
|
7358
|
+
sort = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : [];
|
|
7359
|
+
options = _args7.length > 2 && _args7[2] !== undefined ? _args7[2] : {};
|
|
7360
|
+
_context7.next = 5;
|
|
7361
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/review_queue', _objectSpread$1({
|
|
7362
|
+
filter: filterConditions,
|
|
7363
|
+
sort: normalizeQuerySort(sort)
|
|
7364
|
+
}, options));
|
|
7365
|
+
|
|
7366
|
+
case 5:
|
|
7367
|
+
return _context7.abrupt("return", _context7.sent);
|
|
7368
|
+
|
|
7369
|
+
case 6:
|
|
7370
|
+
case "end":
|
|
7371
|
+
return _context7.stop();
|
|
7372
|
+
}
|
|
7373
|
+
}
|
|
7374
|
+
}, _callee7, this);
|
|
7375
|
+
}));
|
|
7376
|
+
|
|
7377
|
+
function queryReviewQueue() {
|
|
7378
|
+
return _queryReviewQueue.apply(this, arguments);
|
|
7379
|
+
}
|
|
7380
|
+
|
|
7381
|
+
return queryReviewQueue;
|
|
7382
|
+
}()
|
|
7383
|
+
/**
|
|
7384
|
+
* Upsert moderation config
|
|
7385
|
+
* @param {Object} config Moderation config to be upserted
|
|
7386
|
+
*/
|
|
7387
|
+
|
|
7388
|
+
}, {
|
|
7389
|
+
key: "upsertConfig",
|
|
7390
|
+
value: function () {
|
|
7391
|
+
var _upsertConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
|
|
7392
|
+
var config,
|
|
7393
|
+
_args8 = arguments;
|
|
7394
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
7395
|
+
while (1) {
|
|
7396
|
+
switch (_context8.prev = _context8.next) {
|
|
7397
|
+
case 0:
|
|
7398
|
+
config = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
|
|
7399
|
+
_context8.next = 3;
|
|
7400
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/config', config);
|
|
7401
|
+
|
|
7402
|
+
case 3:
|
|
7403
|
+
return _context8.abrupt("return", _context8.sent);
|
|
7404
|
+
|
|
7405
|
+
case 4:
|
|
7406
|
+
case "end":
|
|
7407
|
+
return _context8.stop();
|
|
7408
|
+
}
|
|
7409
|
+
}
|
|
7410
|
+
}, _callee8, this);
|
|
7411
|
+
}));
|
|
7412
|
+
|
|
7413
|
+
function upsertConfig() {
|
|
7414
|
+
return _upsertConfig.apply(this, arguments);
|
|
7415
|
+
}
|
|
7416
|
+
|
|
7417
|
+
return upsertConfig;
|
|
7418
|
+
}()
|
|
7419
|
+
/**
|
|
7420
|
+
* Get moderation config
|
|
7421
|
+
* @param {string} key Key for which moderation config is to be fetched
|
|
7422
|
+
*/
|
|
7423
|
+
|
|
7424
|
+
}, {
|
|
7425
|
+
key: "getConfig",
|
|
7426
|
+
value: function () {
|
|
7427
|
+
var _getConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(key) {
|
|
7428
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
7429
|
+
while (1) {
|
|
7430
|
+
switch (_context9.prev = _context9.next) {
|
|
7431
|
+
case 0:
|
|
7432
|
+
_context9.next = 2;
|
|
7433
|
+
return this.client.get(this.client.baseURL + '/api/v2/moderation/config/' + key);
|
|
7434
|
+
|
|
7435
|
+
case 2:
|
|
7436
|
+
return _context9.abrupt("return", _context9.sent);
|
|
7437
|
+
|
|
7438
|
+
case 3:
|
|
7439
|
+
case "end":
|
|
7440
|
+
return _context9.stop();
|
|
7441
|
+
}
|
|
7442
|
+
}
|
|
7443
|
+
}, _callee9, this);
|
|
7444
|
+
}));
|
|
7445
|
+
|
|
7446
|
+
function getConfig(_x13) {
|
|
7447
|
+
return _getConfig.apply(this, arguments);
|
|
7448
|
+
}
|
|
7449
|
+
|
|
7450
|
+
return getConfig;
|
|
7451
|
+
}()
|
|
7452
|
+
}, {
|
|
7453
|
+
key: "submitAction",
|
|
7454
|
+
value: function () {
|
|
7455
|
+
var _submitAction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(actionType, itemID) {
|
|
7456
|
+
var options,
|
|
7457
|
+
_args10 = arguments;
|
|
7458
|
+
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
7459
|
+
while (1) {
|
|
7460
|
+
switch (_context10.prev = _context10.next) {
|
|
7461
|
+
case 0:
|
|
7462
|
+
options = _args10.length > 2 && _args10[2] !== undefined ? _args10[2] : {};
|
|
7463
|
+
_context10.next = 3;
|
|
7464
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/submit_action', _objectSpread$1({
|
|
7465
|
+
action_type: actionType,
|
|
7466
|
+
item_id: itemID
|
|
7467
|
+
}, options));
|
|
7468
|
+
|
|
7469
|
+
case 3:
|
|
7470
|
+
return _context10.abrupt("return", _context10.sent);
|
|
7471
|
+
|
|
7472
|
+
case 4:
|
|
7473
|
+
case "end":
|
|
7474
|
+
return _context10.stop();
|
|
7475
|
+
}
|
|
7476
|
+
}
|
|
7477
|
+
}, _callee10, this);
|
|
7478
|
+
}));
|
|
7479
|
+
|
|
7480
|
+
function submitAction(_x14, _x15) {
|
|
7481
|
+
return _submitAction.apply(this, arguments);
|
|
7482
|
+
}
|
|
7483
|
+
|
|
7484
|
+
return submitAction;
|
|
7485
|
+
}()
|
|
7486
|
+
}]);
|
|
7487
|
+
|
|
7488
|
+
return Moderation;
|
|
7489
|
+
}();
|
|
7490
|
+
|
|
7073
7491
|
var _excluded = ["created_at", "updated_at", "last_active", "online"],
|
|
7074
7492
|
_excluded2 = ["params", "headers"];
|
|
7075
7493
|
|
|
@@ -7122,6 +7540,8 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7122
7540
|
|
|
7123
7541
|
_defineProperty(this, "recoverStateOnReconnect", void 0);
|
|
7124
7542
|
|
|
7543
|
+
_defineProperty(this, "moderation", void 0);
|
|
7544
|
+
|
|
7125
7545
|
_defineProperty(this, "mutedChannels", void 0);
|
|
7126
7546
|
|
|
7127
7547
|
_defineProperty(this, "mutedUsers", void 0);
|
|
@@ -7883,7 +8303,8 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7883
8303
|
this.state = new ClientState(); // a list of channels to hide ws events from
|
|
7884
8304
|
|
|
7885
8305
|
this.mutedChannels = [];
|
|
7886
|
-
this.mutedUsers = [];
|
|
8306
|
+
this.mutedUsers = [];
|
|
8307
|
+
this.moderation = new Moderation(this); // set the secret
|
|
7887
8308
|
|
|
7888
8309
|
if (secretOrOptions && isString(secretOrOptions)) {
|
|
7889
8310
|
this.secret = secretOrOptions;
|
|
@@ -7911,11 +8332,11 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7911
8332
|
this.axiosInstance = axios.create(this.options);
|
|
7912
8333
|
this.setBaseURL(this.options.baseURL || 'https://chat.stream-io-api.com');
|
|
7913
8334
|
|
|
7914
|
-
if (typeof process !== 'undefined' && process.env.STREAM_LOCAL_TEST_RUN) {
|
|
8335
|
+
if (typeof process !== 'undefined' && 'env' in process && process.env.STREAM_LOCAL_TEST_RUN) {
|
|
7915
8336
|
this.setBaseURL('http://localhost:3030');
|
|
7916
8337
|
}
|
|
7917
8338
|
|
|
7918
|
-
if (typeof process !== 'undefined' && process.env.STREAM_LOCAL_TEST_HOST) {
|
|
8339
|
+
if (typeof process !== 'undefined' && 'env' in process && process.env.STREAM_LOCAL_TEST_HOST) {
|
|
7919
8340
|
this.setBaseURL('http://' + process.env.STREAM_LOCAL_TEST_HOST);
|
|
7920
8341
|
} // WS connection is initialized when setUser is called
|
|
7921
8342
|
|
|
@@ -11547,7 +11968,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11547
11968
|
}, {
|
|
11548
11969
|
key: "getUserAgent",
|
|
11549
11970
|
value: function getUserAgent() {
|
|
11550
|
-
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.
|
|
11971
|
+
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.38.0");
|
|
11551
11972
|
}
|
|
11552
11973
|
}, {
|
|
11553
11974
|
key: "setUserAgent",
|
|
@@ -12992,19 +13413,22 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12992
13413
|
/**
|
|
12993
13414
|
* Creates a poll
|
|
12994
13415
|
* @param params PollData The poll that will be created
|
|
13416
|
+
* @param userId string The user id (only serverside)
|
|
12995
13417
|
* @returns {APIResponse & CreatePollAPIResponse} The poll
|
|
12996
13418
|
*/
|
|
12997
13419
|
|
|
12998
13420
|
}, {
|
|
12999
13421
|
key: "createPoll",
|
|
13000
13422
|
value: function () {
|
|
13001
|
-
var _createPoll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee98(poll) {
|
|
13423
|
+
var _createPoll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee98(poll, userId) {
|
|
13002
13424
|
return _regeneratorRuntime.wrap(function _callee98$(_context98) {
|
|
13003
13425
|
while (1) {
|
|
13004
13426
|
switch (_context98.prev = _context98.next) {
|
|
13005
13427
|
case 0:
|
|
13006
13428
|
_context98.next = 2;
|
|
13007
|
-
return this.post(this.baseURL + "/polls", poll)
|
|
13429
|
+
return this.post(this.baseURL + "/polls", _objectSpread(_objectSpread({}, poll), userId ? {
|
|
13430
|
+
user_id: userId
|
|
13431
|
+
} : {}));
|
|
13008
13432
|
|
|
13009
13433
|
case 2:
|
|
13010
13434
|
return _context98.abrupt("return", _context98.sent);
|
|
@@ -13017,7 +13441,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13017
13441
|
}, _callee98, this);
|
|
13018
13442
|
}));
|
|
13019
13443
|
|
|
13020
|
-
function createPoll(_x136) {
|
|
13444
|
+
function createPoll(_x136, _x137) {
|
|
13021
13445
|
return _createPoll.apply(this, arguments);
|
|
13022
13446
|
}
|
|
13023
13447
|
|
|
@@ -13026,6 +13450,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13026
13450
|
/**
|
|
13027
13451
|
* Retrieves a poll
|
|
13028
13452
|
* @param id string The poll id
|
|
13453
|
+
* @param userId string The user id (only serverside)
|
|
13029
13454
|
* @returns {APIResponse & GetPollAPIResponse} The poll
|
|
13030
13455
|
*/
|
|
13031
13456
|
|
|
@@ -13038,9 +13463,9 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13038
13463
|
switch (_context99.prev = _context99.next) {
|
|
13039
13464
|
case 0:
|
|
13040
13465
|
_context99.next = 2;
|
|
13041
|
-
return this.get(this.baseURL + "/polls/".concat(id),
|
|
13466
|
+
return this.get(this.baseURL + "/polls/".concat(id), userId ? {
|
|
13042
13467
|
user_id: userId
|
|
13043
|
-
} : {})
|
|
13468
|
+
} : {});
|
|
13044
13469
|
|
|
13045
13470
|
case 2:
|
|
13046
13471
|
return _context99.abrupt("return", _context99.sent);
|
|
@@ -13053,7 +13478,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13053
13478
|
}, _callee99, this);
|
|
13054
13479
|
}));
|
|
13055
13480
|
|
|
13056
|
-
function getPoll(
|
|
13481
|
+
function getPoll(_x138, _x139) {
|
|
13057
13482
|
return _getPoll.apply(this, arguments);
|
|
13058
13483
|
}
|
|
13059
13484
|
|
|
@@ -13062,19 +13487,22 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13062
13487
|
/**
|
|
13063
13488
|
* Updates a poll
|
|
13064
13489
|
* @param poll PollData The poll that will be updated
|
|
13490
|
+
* @param userId string The user id (only serverside)
|
|
13065
13491
|
* @returns {APIResponse & PollResponse} The poll
|
|
13066
13492
|
*/
|
|
13067
13493
|
|
|
13068
13494
|
}, {
|
|
13069
13495
|
key: "updatePoll",
|
|
13070
13496
|
value: function () {
|
|
13071
|
-
var _updatePoll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee100(poll) {
|
|
13497
|
+
var _updatePoll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee100(poll, userId) {
|
|
13072
13498
|
return _regeneratorRuntime.wrap(function _callee100$(_context100) {
|
|
13073
13499
|
while (1) {
|
|
13074
13500
|
switch (_context100.prev = _context100.next) {
|
|
13075
13501
|
case 0:
|
|
13076
13502
|
_context100.next = 2;
|
|
13077
|
-
return this.put(this.baseURL + "/polls", poll)
|
|
13503
|
+
return this.put(this.baseURL + "/polls", _objectSpread(_objectSpread({}, poll), userId ? {
|
|
13504
|
+
user_id: userId
|
|
13505
|
+
} : {}));
|
|
13078
13506
|
|
|
13079
13507
|
case 2:
|
|
13080
13508
|
return _context100.abrupt("return", _context100.sent);
|
|
@@ -13087,7 +13515,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13087
13515
|
}, _callee100, this);
|
|
13088
13516
|
}));
|
|
13089
13517
|
|
|
13090
|
-
function updatePoll(
|
|
13518
|
+
function updatePoll(_x140, _x141) {
|
|
13091
13519
|
return _updatePoll.apply(this, arguments);
|
|
13092
13520
|
}
|
|
13093
13521
|
|
|
@@ -13097,6 +13525,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13097
13525
|
* Partially updates a poll
|
|
13098
13526
|
* @param id string The poll id
|
|
13099
13527
|
* @param {PartialPollUpdate<StreamChatGenerics>} partialPollObject which should contain id and any of "set" or "unset" params;
|
|
13528
|
+
* @param userId string The user id (only serverside)
|
|
13100
13529
|
* example: {id: "44f26af5-f2be-4fa7-9dac-71cf893781de", set:{field: value}, unset:["field2"]}
|
|
13101
13530
|
* @returns {APIResponse & UpdatePollAPIResponse} The poll
|
|
13102
13531
|
*/
|
|
@@ -13104,13 +13533,15 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13104
13533
|
}, {
|
|
13105
13534
|
key: "partialUpdatePoll",
|
|
13106
13535
|
value: function () {
|
|
13107
|
-
var _partialUpdatePoll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee101(id, partialPollObject) {
|
|
13536
|
+
var _partialUpdatePoll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee101(id, partialPollObject, userId) {
|
|
13108
13537
|
return _regeneratorRuntime.wrap(function _callee101$(_context101) {
|
|
13109
13538
|
while (1) {
|
|
13110
13539
|
switch (_context101.prev = _context101.next) {
|
|
13111
13540
|
case 0:
|
|
13112
13541
|
_context101.next = 2;
|
|
13113
|
-
return this.patch(this.baseURL + "/polls/".concat(id), partialPollObject)
|
|
13542
|
+
return this.patch(this.baseURL + "/polls/".concat(id), _objectSpread(_objectSpread({}, partialPollObject), userId ? {
|
|
13543
|
+
user_id: userId
|
|
13544
|
+
} : {}));
|
|
13114
13545
|
|
|
13115
13546
|
case 2:
|
|
13116
13547
|
return _context101.abrupt("return", _context101.sent);
|
|
@@ -13123,7 +13554,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13123
13554
|
}, _callee101, this);
|
|
13124
13555
|
}));
|
|
13125
13556
|
|
|
13126
|
-
function partialUpdatePoll(
|
|
13557
|
+
function partialUpdatePoll(_x142, _x143, _x144) {
|
|
13127
13558
|
return _partialUpdatePoll.apply(this, arguments);
|
|
13128
13559
|
}
|
|
13129
13560
|
|
|
@@ -13160,7 +13591,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13160
13591
|
}, _callee102, this);
|
|
13161
13592
|
}));
|
|
13162
13593
|
|
|
13163
|
-
function deletePoll(
|
|
13594
|
+
function deletePoll(_x145, _x146) {
|
|
13164
13595
|
return _deletePoll.apply(this, arguments);
|
|
13165
13596
|
}
|
|
13166
13597
|
|
|
@@ -13169,22 +13600,25 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13169
13600
|
/**
|
|
13170
13601
|
* Close a poll
|
|
13171
13602
|
* @param id string The poll id
|
|
13603
|
+
* @param userId string The user id (only serverside)
|
|
13172
13604
|
* @returns {APIResponse & UpdatePollAPIResponse} The poll
|
|
13173
13605
|
*/
|
|
13174
13606
|
|
|
13175
13607
|
}, {
|
|
13176
13608
|
key: "closePoll",
|
|
13177
13609
|
value: function () {
|
|
13178
|
-
var _closePoll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee103(id) {
|
|
13610
|
+
var _closePoll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee103(id, userId) {
|
|
13179
13611
|
return _regeneratorRuntime.wrap(function _callee103$(_context103) {
|
|
13180
13612
|
while (1) {
|
|
13181
13613
|
switch (_context103.prev = _context103.next) {
|
|
13182
13614
|
case 0:
|
|
13183
|
-
return _context103.abrupt("return", this.partialUpdatePoll(id, {
|
|
13615
|
+
return _context103.abrupt("return", this.partialUpdatePoll(id, _objectSpread({
|
|
13184
13616
|
set: {
|
|
13185
13617
|
is_closed: true
|
|
13186
13618
|
}
|
|
13187
|
-
}
|
|
13619
|
+
}, userId ? {
|
|
13620
|
+
user_id: userId
|
|
13621
|
+
} : {})));
|
|
13188
13622
|
|
|
13189
13623
|
case 1:
|
|
13190
13624
|
case "end":
|
|
@@ -13194,7 +13628,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13194
13628
|
}, _callee103, this);
|
|
13195
13629
|
}));
|
|
13196
13630
|
|
|
13197
|
-
function closePoll(
|
|
13631
|
+
function closePoll(_x147, _x148) {
|
|
13198
13632
|
return _closePoll.apply(this, arguments);
|
|
13199
13633
|
}
|
|
13200
13634
|
|
|
@@ -13204,19 +13638,22 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13204
13638
|
* Creates a poll option
|
|
13205
13639
|
* @param pollId string The poll id
|
|
13206
13640
|
* @param option PollOptionData The poll option that will be created
|
|
13641
|
+
* @param userId string The user id (only serverside)
|
|
13207
13642
|
* @returns {APIResponse & PollOptionResponse} The poll option
|
|
13208
13643
|
*/
|
|
13209
13644
|
|
|
13210
13645
|
}, {
|
|
13211
13646
|
key: "createPollOption",
|
|
13212
13647
|
value: function () {
|
|
13213
|
-
var _createPollOption = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee104(pollId, option) {
|
|
13648
|
+
var _createPollOption = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee104(pollId, option, userId) {
|
|
13214
13649
|
return _regeneratorRuntime.wrap(function _callee104$(_context104) {
|
|
13215
13650
|
while (1) {
|
|
13216
13651
|
switch (_context104.prev = _context104.next) {
|
|
13217
13652
|
case 0:
|
|
13218
13653
|
_context104.next = 2;
|
|
13219
|
-
return this.post(this.baseURL + "/polls/".concat(pollId, "/options"), option)
|
|
13654
|
+
return this.post(this.baseURL + "/polls/".concat(pollId, "/options"), _objectSpread(_objectSpread({}, option), userId ? {
|
|
13655
|
+
user_id: userId
|
|
13656
|
+
} : {}));
|
|
13220
13657
|
|
|
13221
13658
|
case 2:
|
|
13222
13659
|
return _context104.abrupt("return", _context104.sent);
|
|
@@ -13229,7 +13666,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13229
13666
|
}, _callee104, this);
|
|
13230
13667
|
}));
|
|
13231
13668
|
|
|
13232
|
-
function createPollOption(
|
|
13669
|
+
function createPollOption(_x149, _x150, _x151) {
|
|
13233
13670
|
return _createPollOption.apply(this, arguments);
|
|
13234
13671
|
}
|
|
13235
13672
|
|
|
@@ -13239,19 +13676,22 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13239
13676
|
* Retrieves a poll option
|
|
13240
13677
|
* @param pollId string The poll id
|
|
13241
13678
|
* @param optionId string The poll option id
|
|
13679
|
+
* @param userId string The user id (only serverside)
|
|
13242
13680
|
* @returns {APIResponse & PollOptionResponse} The poll option
|
|
13243
13681
|
*/
|
|
13244
13682
|
|
|
13245
13683
|
}, {
|
|
13246
13684
|
key: "getPollOption",
|
|
13247
13685
|
value: function () {
|
|
13248
|
-
var _getPollOption = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee105(pollId, optionId) {
|
|
13686
|
+
var _getPollOption = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee105(pollId, optionId, userId) {
|
|
13249
13687
|
return _regeneratorRuntime.wrap(function _callee105$(_context105) {
|
|
13250
13688
|
while (1) {
|
|
13251
13689
|
switch (_context105.prev = _context105.next) {
|
|
13252
13690
|
case 0:
|
|
13253
13691
|
_context105.next = 2;
|
|
13254
|
-
return this.get(this.baseURL + "/polls/".concat(pollId, "/options/").concat(optionId)
|
|
13692
|
+
return this.get(this.baseURL + "/polls/".concat(pollId, "/options/").concat(optionId), userId ? {
|
|
13693
|
+
user_id: userId
|
|
13694
|
+
} : {});
|
|
13255
13695
|
|
|
13256
13696
|
case 2:
|
|
13257
13697
|
return _context105.abrupt("return", _context105.sent);
|
|
@@ -13264,7 +13704,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13264
13704
|
}, _callee105, this);
|
|
13265
13705
|
}));
|
|
13266
13706
|
|
|
13267
|
-
function getPollOption(
|
|
13707
|
+
function getPollOption(_x152, _x153, _x154) {
|
|
13268
13708
|
return _getPollOption.apply(this, arguments);
|
|
13269
13709
|
}
|
|
13270
13710
|
|
|
@@ -13274,19 +13714,22 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13274
13714
|
* Updates a poll option
|
|
13275
13715
|
* @param pollId string The poll id
|
|
13276
13716
|
* @param option PollOptionData The poll option that will be updated
|
|
13717
|
+
* @param userId string The user id (only serverside)
|
|
13277
13718
|
* @returns
|
|
13278
13719
|
*/
|
|
13279
13720
|
|
|
13280
13721
|
}, {
|
|
13281
13722
|
key: "updatePollOption",
|
|
13282
13723
|
value: function () {
|
|
13283
|
-
var _updatePollOption = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee106(pollId, option) {
|
|
13724
|
+
var _updatePollOption = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee106(pollId, option, userId) {
|
|
13284
13725
|
return _regeneratorRuntime.wrap(function _callee106$(_context106) {
|
|
13285
13726
|
while (1) {
|
|
13286
13727
|
switch (_context106.prev = _context106.next) {
|
|
13287
13728
|
case 0:
|
|
13288
13729
|
_context106.next = 2;
|
|
13289
|
-
return this.put(this.baseURL + "/polls/".concat(pollId, "/options"), option)
|
|
13730
|
+
return this.put(this.baseURL + "/polls/".concat(pollId, "/options"), _objectSpread(_objectSpread({}, option), userId ? {
|
|
13731
|
+
user_id: userId
|
|
13732
|
+
} : {}));
|
|
13290
13733
|
|
|
13291
13734
|
case 2:
|
|
13292
13735
|
return _context106.abrupt("return", _context106.sent);
|
|
@@ -13299,7 +13742,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13299
13742
|
}, _callee106, this);
|
|
13300
13743
|
}));
|
|
13301
13744
|
|
|
13302
|
-
function updatePollOption(
|
|
13745
|
+
function updatePollOption(_x155, _x156, _x157) {
|
|
13303
13746
|
return _updatePollOption.apply(this, arguments);
|
|
13304
13747
|
}
|
|
13305
13748
|
|
|
@@ -13309,19 +13752,22 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13309
13752
|
* Delete a poll option
|
|
13310
13753
|
* @param pollId string The poll id
|
|
13311
13754
|
* @param optionId string The poll option id
|
|
13755
|
+
* @param userId string The user id (only serverside)
|
|
13312
13756
|
* @returns {APIResponse} The poll option
|
|
13313
13757
|
*/
|
|
13314
13758
|
|
|
13315
13759
|
}, {
|
|
13316
13760
|
key: "deletePollOption",
|
|
13317
13761
|
value: function () {
|
|
13318
|
-
var _deletePollOption = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee107(pollId, optionId) {
|
|
13762
|
+
var _deletePollOption = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee107(pollId, optionId, userId) {
|
|
13319
13763
|
return _regeneratorRuntime.wrap(function _callee107$(_context107) {
|
|
13320
13764
|
while (1) {
|
|
13321
13765
|
switch (_context107.prev = _context107.next) {
|
|
13322
13766
|
case 0:
|
|
13323
13767
|
_context107.next = 2;
|
|
13324
|
-
return this.delete(this.baseURL + "/polls/".concat(pollId, "/options/").concat(optionId)
|
|
13768
|
+
return this.delete(this.baseURL + "/polls/".concat(pollId, "/options/").concat(optionId), userId ? {
|
|
13769
|
+
user_id: userId
|
|
13770
|
+
} : {});
|
|
13325
13771
|
|
|
13326
13772
|
case 2:
|
|
13327
13773
|
return _context107.abrupt("return", _context107.sent);
|
|
@@ -13334,7 +13780,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13334
13780
|
}, _callee107, this);
|
|
13335
13781
|
}));
|
|
13336
13782
|
|
|
13337
|
-
function deletePollOption(
|
|
13783
|
+
function deletePollOption(_x158, _x159, _x160) {
|
|
13338
13784
|
return _deletePollOption.apply(this, arguments);
|
|
13339
13785
|
}
|
|
13340
13786
|
|
|
@@ -13345,29 +13791,29 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13345
13791
|
* @param messageId string The message id
|
|
13346
13792
|
* @param pollId string The poll id
|
|
13347
13793
|
* @param vote PollVoteData The vote that will be casted
|
|
13794
|
+
* @param userId string The user id (only serverside)
|
|
13348
13795
|
* @returns {APIResponse & CastVoteAPIResponse} The poll vote
|
|
13349
13796
|
*/
|
|
13350
13797
|
|
|
13351
13798
|
}, {
|
|
13352
13799
|
key: "castPollVote",
|
|
13353
13800
|
value: function () {
|
|
13354
|
-
var _castPollVote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee108(messageId, pollId, vote) {
|
|
13355
|
-
var options,
|
|
13356
|
-
_args108 = arguments;
|
|
13801
|
+
var _castPollVote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee108(messageId, pollId, vote, userId) {
|
|
13357
13802
|
return _regeneratorRuntime.wrap(function _callee108$(_context108) {
|
|
13358
13803
|
while (1) {
|
|
13359
13804
|
switch (_context108.prev = _context108.next) {
|
|
13360
13805
|
case 0:
|
|
13361
|
-
|
|
13362
|
-
_context108.next = 3;
|
|
13806
|
+
_context108.next = 2;
|
|
13363
13807
|
return this.post(this.baseURL + "/messages/".concat(messageId, "/polls/").concat(pollId, "/vote"), _objectSpread({
|
|
13364
13808
|
vote: vote
|
|
13365
|
-
},
|
|
13809
|
+
}, userId ? {
|
|
13810
|
+
user_id: userId
|
|
13811
|
+
} : {}));
|
|
13366
13812
|
|
|
13367
|
-
case
|
|
13813
|
+
case 2:
|
|
13368
13814
|
return _context108.abrupt("return", _context108.sent);
|
|
13369
13815
|
|
|
13370
|
-
case
|
|
13816
|
+
case 3:
|
|
13371
13817
|
case "end":
|
|
13372
13818
|
return _context108.stop();
|
|
13373
13819
|
}
|
|
@@ -13375,7 +13821,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13375
13821
|
}, _callee108, this);
|
|
13376
13822
|
}));
|
|
13377
13823
|
|
|
13378
|
-
function castPollVote(
|
|
13824
|
+
function castPollVote(_x161, _x162, _x163, _x164) {
|
|
13379
13825
|
return _castPollVote.apply(this, arguments);
|
|
13380
13826
|
}
|
|
13381
13827
|
|
|
@@ -13386,19 +13832,20 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13386
13832
|
* @param messageId string The message id
|
|
13387
13833
|
* @param pollId string The poll id
|
|
13388
13834
|
* @param answerText string The answer text
|
|
13835
|
+
* @param userId string The user id (only serverside)
|
|
13389
13836
|
*/
|
|
13390
13837
|
|
|
13391
13838
|
}, {
|
|
13392
13839
|
key: "addPollAnswer",
|
|
13393
13840
|
value: function () {
|
|
13394
|
-
var _addPollAnswer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee109(messageId, pollId, answerText) {
|
|
13841
|
+
var _addPollAnswer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee109(messageId, pollId, answerText, userId) {
|
|
13395
13842
|
return _regeneratorRuntime.wrap(function _callee109$(_context109) {
|
|
13396
13843
|
while (1) {
|
|
13397
13844
|
switch (_context109.prev = _context109.next) {
|
|
13398
13845
|
case 0:
|
|
13399
13846
|
return _context109.abrupt("return", this.castPollVote(messageId, pollId, {
|
|
13400
13847
|
answer_text: answerText
|
|
13401
|
-
}));
|
|
13848
|
+
}, userId));
|
|
13402
13849
|
|
|
13403
13850
|
case 1:
|
|
13404
13851
|
case "end":
|
|
@@ -13408,7 +13855,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13408
13855
|
}, _callee109, this);
|
|
13409
13856
|
}));
|
|
13410
13857
|
|
|
13411
|
-
function addPollAnswer(
|
|
13858
|
+
function addPollAnswer(_x165, _x166, _x167, _x168) {
|
|
13412
13859
|
return _addPollAnswer.apply(this, arguments);
|
|
13413
13860
|
}
|
|
13414
13861
|
|
|
@@ -13417,13 +13864,15 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13417
13864
|
}, {
|
|
13418
13865
|
key: "removePollVote",
|
|
13419
13866
|
value: function () {
|
|
13420
|
-
var _removePollVote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee110(messageId, pollId, voteId) {
|
|
13867
|
+
var _removePollVote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee110(messageId, pollId, voteId, userId) {
|
|
13421
13868
|
return _regeneratorRuntime.wrap(function _callee110$(_context110) {
|
|
13422
13869
|
while (1) {
|
|
13423
13870
|
switch (_context110.prev = _context110.next) {
|
|
13424
13871
|
case 0:
|
|
13425
13872
|
_context110.next = 2;
|
|
13426
|
-
return this.delete(this.baseURL + "/messages/".concat(messageId, "/polls/").concat(pollId, "/vote/").concat(voteId)
|
|
13873
|
+
return this.delete(this.baseURL + "/messages/".concat(messageId, "/polls/").concat(pollId, "/vote/").concat(voteId), _objectSpread({}, userId ? {
|
|
13874
|
+
user_id: userId
|
|
13875
|
+
} : {}));
|
|
13427
13876
|
|
|
13428
13877
|
case 2:
|
|
13429
13878
|
return _context110.abrupt("return", _context110.sent);
|
|
@@ -13436,7 +13885,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13436
13885
|
}, _callee110, this);
|
|
13437
13886
|
}));
|
|
13438
13887
|
|
|
13439
|
-
function removePollVote(
|
|
13888
|
+
function removePollVote(_x169, _x170, _x171, _x172) {
|
|
13440
13889
|
return _removePollVote.apply(this, arguments);
|
|
13441
13890
|
}
|
|
13442
13891
|
|
|
@@ -13447,6 +13896,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13447
13896
|
* @param filter
|
|
13448
13897
|
* @param sort
|
|
13449
13898
|
* @param options Option object, {limit: 10, offset:0}
|
|
13899
|
+
* @param userId string The user id (only serverside)
|
|
13450
13900
|
* @returns {APIResponse & QueryPollsResponse} The polls
|
|
13451
13901
|
*/
|
|
13452
13902
|
|
|
@@ -13457,6 +13907,8 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13457
13907
|
var filter,
|
|
13458
13908
|
sort,
|
|
13459
13909
|
options,
|
|
13910
|
+
userId,
|
|
13911
|
+
q,
|
|
13460
13912
|
_args111 = arguments;
|
|
13461
13913
|
return _regeneratorRuntime.wrap(function _callee111$(_context111) {
|
|
13462
13914
|
while (1) {
|
|
@@ -13465,16 +13917,18 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13465
13917
|
filter = _args111.length > 0 && _args111[0] !== undefined ? _args111[0] : {};
|
|
13466
13918
|
sort = _args111.length > 1 && _args111[1] !== undefined ? _args111[1] : [];
|
|
13467
13919
|
options = _args111.length > 2 && _args111[2] !== undefined ? _args111[2] : {};
|
|
13468
|
-
|
|
13469
|
-
|
|
13920
|
+
userId = _args111.length > 3 ? _args111[3] : undefined;
|
|
13921
|
+
q = userId ? "?user_id=".concat(userId) : '';
|
|
13922
|
+
_context111.next = 7;
|
|
13923
|
+
return this.post(this.baseURL + "/polls/query".concat(q), _objectSpread({
|
|
13470
13924
|
filter: filter,
|
|
13471
13925
|
sort: normalizeQuerySort(sort)
|
|
13472
13926
|
}, options));
|
|
13473
13927
|
|
|
13474
|
-
case
|
|
13928
|
+
case 7:
|
|
13475
13929
|
return _context111.abrupt("return", _context111.sent);
|
|
13476
13930
|
|
|
13477
|
-
case
|
|
13931
|
+
case 8:
|
|
13478
13932
|
case "end":
|
|
13479
13933
|
return _context111.stop();
|
|
13480
13934
|
}
|
|
@@ -13494,7 +13948,8 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13494
13948
|
* @param filter
|
|
13495
13949
|
* @param sort
|
|
13496
13950
|
* @param options Option object, {limit: 10, offset:0}
|
|
13497
|
-
|
|
13951
|
+
* @param userId string The user id (only serverside)
|
|
13952
|
+
* @returns {APIResponse & PollVotesAPIResponse} The poll votes
|
|
13498
13953
|
*/
|
|
13499
13954
|
|
|
13500
13955
|
}, {
|
|
@@ -13504,6 +13959,8 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13504
13959
|
var filter,
|
|
13505
13960
|
sort,
|
|
13506
13961
|
options,
|
|
13962
|
+
userId,
|
|
13963
|
+
q,
|
|
13507
13964
|
_args112 = arguments;
|
|
13508
13965
|
return _regeneratorRuntime.wrap(function _callee112$(_context112) {
|
|
13509
13966
|
while (1) {
|
|
@@ -13512,16 +13969,18 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13512
13969
|
filter = _args112.length > 1 && _args112[1] !== undefined ? _args112[1] : {};
|
|
13513
13970
|
sort = _args112.length > 2 && _args112[2] !== undefined ? _args112[2] : [];
|
|
13514
13971
|
options = _args112.length > 3 && _args112[3] !== undefined ? _args112[3] : {};
|
|
13515
|
-
|
|
13516
|
-
|
|
13972
|
+
userId = _args112.length > 4 ? _args112[4] : undefined;
|
|
13973
|
+
q = userId ? "?user_id=".concat(userId) : '';
|
|
13974
|
+
_context112.next = 7;
|
|
13975
|
+
return this.post(this.baseURL + "/polls/".concat(pollId, "/votes").concat(q), _objectSpread({
|
|
13517
13976
|
filter: filter,
|
|
13518
13977
|
sort: normalizeQuerySort(sort)
|
|
13519
13978
|
}, options));
|
|
13520
13979
|
|
|
13521
|
-
case
|
|
13980
|
+
case 7:
|
|
13522
13981
|
return _context112.abrupt("return", _context112.sent);
|
|
13523
13982
|
|
|
13524
|
-
case
|
|
13983
|
+
case 8:
|
|
13525
13984
|
case "end":
|
|
13526
13985
|
return _context112.stop();
|
|
13527
13986
|
}
|
|
@@ -13529,14 +13988,14 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13529
13988
|
}, _callee112, this);
|
|
13530
13989
|
}));
|
|
13531
13990
|
|
|
13532
|
-
function queryPollVotes(
|
|
13991
|
+
function queryPollVotes(_x173) {
|
|
13533
13992
|
return _queryPollVotes.apply(this, arguments);
|
|
13534
13993
|
}
|
|
13535
13994
|
|
|
13536
13995
|
return queryPollVotes;
|
|
13537
13996
|
}()
|
|
13538
13997
|
/**
|
|
13539
|
-
*
|
|
13998
|
+
* Query message history
|
|
13540
13999
|
* @param filter
|
|
13541
14000
|
* @param sort
|
|
13542
14001
|
* @param options Option object, {limit: 10}
|
|
@@ -13581,6 +14040,49 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13581
14040
|
|
|
13582
14041
|
return queryMessageHistory;
|
|
13583
14042
|
}()
|
|
14043
|
+
/**
|
|
14044
|
+
* updateFlags - reviews/unflags flagged message
|
|
14045
|
+
*
|
|
14046
|
+
* @param {string[]} message_ids list of message IDs
|
|
14047
|
+
* @param {string} options Option object in case user ID is set to review all the flagged messages by the user
|
|
14048
|
+
* @param {string} reviewed_by user ID who reviewed the flagged message
|
|
14049
|
+
* @returns {APIResponse}
|
|
14050
|
+
*/
|
|
14051
|
+
|
|
14052
|
+
}, {
|
|
14053
|
+
key: "updateFlags",
|
|
14054
|
+
value: function () {
|
|
14055
|
+
var _updateFlags = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee114(message_ids, reviewed_by) {
|
|
14056
|
+
var options,
|
|
14057
|
+
_args114 = arguments;
|
|
14058
|
+
return _regeneratorRuntime.wrap(function _callee114$(_context114) {
|
|
14059
|
+
while (1) {
|
|
14060
|
+
switch (_context114.prev = _context114.next) {
|
|
14061
|
+
case 0:
|
|
14062
|
+
options = _args114.length > 2 && _args114[2] !== undefined ? _args114[2] : {};
|
|
14063
|
+
_context114.next = 3;
|
|
14064
|
+
return this.post(this.baseURL + '/automod/v1/moderation/update_flags', _objectSpread({
|
|
14065
|
+
message_ids: message_ids,
|
|
14066
|
+
reviewed_by: reviewed_by
|
|
14067
|
+
}, options));
|
|
14068
|
+
|
|
14069
|
+
case 3:
|
|
14070
|
+
return _context114.abrupt("return", _context114.sent);
|
|
14071
|
+
|
|
14072
|
+
case 4:
|
|
14073
|
+
case "end":
|
|
14074
|
+
return _context114.stop();
|
|
14075
|
+
}
|
|
14076
|
+
}
|
|
14077
|
+
}, _callee114, this);
|
|
14078
|
+
}));
|
|
14079
|
+
|
|
14080
|
+
function updateFlags(_x174, _x175) {
|
|
14081
|
+
return _updateFlags.apply(this, arguments);
|
|
14082
|
+
}
|
|
14083
|
+
|
|
14084
|
+
return updateFlags;
|
|
14085
|
+
}()
|
|
13584
14086
|
}], [{
|
|
13585
14087
|
key: "getInstance",
|
|
13586
14088
|
value: function getInstance(key, secretOrOptions, options) {
|
|
@@ -13733,5 +14235,5 @@ var BuiltinPermissions = {
|
|
|
13733
14235
|
UseFrozenChannel: 'Send messages and reactions to frozen channels'
|
|
13734
14236
|
};
|
|
13735
14237
|
|
|
13736
|
-
export { Allow, AllowAll, AnyResource, AnyRole, BuiltinPermissions, BuiltinRoles, Campaign, Channel, ChannelState, CheckSignature, ClientState, Deny, DenyAll, DevToken, EVENT_MAP, ErrorFromResponse, InsightMetrics, JWTServerToken, JWTUserToken, MaxPriority, MinPriority, Permission, Segment, StableWSConnection, StreamChat, Thread, TokenManager, UserFromToken, VotingVisibility, buildWsFatalInsight, buildWsSuccessAfterFailureInsight, chatCodes, decodeBase64, encodeBase64, formatMessage, isOwnUser, logChatPromiseExecution, postInsights };
|
|
14238
|
+
export { Allow, AllowAll, AnyResource, AnyRole, BuiltinPermissions, BuiltinRoles, Campaign, Channel, ChannelState, CheckSignature, ClientState, Deny, DenyAll, DevToken, EVENT_MAP, ErrorFromResponse, InsightMetrics, JWTServerToken, JWTUserToken, MODERATION_ENTITY_TYPES, MaxPriority, MinPriority, Moderation, Permission, Segment, StableWSConnection, StreamChat, Thread, TokenManager, UserFromToken, VotingVisibility, buildWsFatalInsight, buildWsSuccessAfterFailureInsight, chatCodes, decodeBase64, encodeBase64, formatMessage, isOwnUser, logChatPromiseExecution, postInsights };
|
|
13737
14239
|
//# sourceMappingURL=browser.es.js.map
|