stream-chat 8.37.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 +593 -134
- 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 +594 -133
- package/dist/browser.js.map +1 -1
- package/dist/index.es.js +593 -134
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +594 -133
- package/dist/index.js.map +1 -1
- package/dist/types/client.d.ts +31 -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 +73 -36
- package/src/index.ts +1 -0
- package/src/moderation.ts +194 -0
- package/src/types.ts +186 -0
package/dist/index.es.js
CHANGED
|
@@ -94,9 +94,9 @@ var decodeBase64 = function decodeBase64(s) {
|
|
|
94
94
|
return r;
|
|
95
95
|
};
|
|
96
96
|
|
|
97
|
-
function ownKeys$
|
|
97
|
+
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; }
|
|
98
98
|
|
|
99
|
-
function _objectSpread$
|
|
99
|
+
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; }
|
|
100
100
|
|
|
101
101
|
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; } } }; }
|
|
102
102
|
|
|
@@ -358,7 +358,7 @@ var axiosParamsSerializer = function axiosParamsSerializer(params) {
|
|
|
358
358
|
*/
|
|
359
359
|
|
|
360
360
|
function formatMessage(message) {
|
|
361
|
-
return _objectSpread$
|
|
361
|
+
return _objectSpread$9(_objectSpread$9({}, message), {}, {
|
|
362
362
|
/**
|
|
363
363
|
* @deprecated please use `html`
|
|
364
364
|
*/
|
|
@@ -457,9 +457,9 @@ function maybeGetReactionGroupsFallback(groups, counts, scores) {
|
|
|
457
457
|
return null;
|
|
458
458
|
}
|
|
459
459
|
|
|
460
|
-
function ownKeys$
|
|
460
|
+
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; }
|
|
461
461
|
|
|
462
|
-
function _objectSpread$
|
|
462
|
+
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; }
|
|
463
463
|
|
|
464
464
|
/**
|
|
465
465
|
* ChannelState - A container class for the channel state.
|
|
@@ -536,7 +536,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
536
536
|
if (!message) return;
|
|
537
537
|
if (message.poll_id !== pollVote.poll_id) return;
|
|
538
538
|
|
|
539
|
-
var updatedPoll = _objectSpread$
|
|
539
|
+
var updatedPoll = _objectSpread$8({}, poll);
|
|
540
540
|
|
|
541
541
|
var ownVotes = _toConsumableArray(((_message$poll = message.poll) === null || _message$poll === void 0 ? void 0 : _message$poll.own_votes) || []);
|
|
542
542
|
|
|
@@ -558,7 +558,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
558
558
|
|
|
559
559
|
updatedPoll.own_votes = ownVotes;
|
|
560
560
|
|
|
561
|
-
var newMessage = _objectSpread$
|
|
561
|
+
var newMessage = _objectSpread$8(_objectSpread$8({}, message), {}, {
|
|
562
562
|
poll: updatedPoll
|
|
563
563
|
});
|
|
564
564
|
|
|
@@ -573,7 +573,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
573
573
|
if (!message) return;
|
|
574
574
|
if (message.poll_id !== pollVote.poll_id) return;
|
|
575
575
|
|
|
576
|
-
var updatedPoll = _objectSpread$
|
|
576
|
+
var updatedPoll = _objectSpread$8({}, poll);
|
|
577
577
|
|
|
578
578
|
var ownVotes = _toConsumableArray(((_message$poll2 = message.poll) === null || _message$poll2 === void 0 ? void 0 : _message$poll2.own_votes) || []);
|
|
579
579
|
|
|
@@ -583,7 +583,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
583
583
|
|
|
584
584
|
updatedPoll.own_votes = ownVotes;
|
|
585
585
|
|
|
586
|
-
var newMessage = _objectSpread$
|
|
586
|
+
var newMessage = _objectSpread$8(_objectSpread$8({}, message), {}, {
|
|
587
587
|
poll: updatedPoll
|
|
588
588
|
});
|
|
589
589
|
|
|
@@ -598,7 +598,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
598
598
|
if (!message) return;
|
|
599
599
|
if (message.poll_id !== pollVote.poll_id) return;
|
|
600
600
|
|
|
601
|
-
var updatedPoll = _objectSpread$
|
|
601
|
+
var updatedPoll = _objectSpread$8({}, poll);
|
|
602
602
|
|
|
603
603
|
var ownVotes = _toConsumableArray(((_message$poll3 = message.poll) === null || _message$poll3 === void 0 ? void 0 : _message$poll3.own_votes) || []);
|
|
604
604
|
|
|
@@ -614,7 +614,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
614
614
|
|
|
615
615
|
updatedPoll.own_votes = ownVotes;
|
|
616
616
|
|
|
617
|
-
var newMessage = _objectSpread$
|
|
617
|
+
var newMessage = _objectSpread$8(_objectSpread$8({}, message), {}, {
|
|
618
618
|
poll: updatedPoll
|
|
619
619
|
});
|
|
620
620
|
|
|
@@ -628,11 +628,11 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
628
628
|
|
|
629
629
|
if (!message) return;
|
|
630
630
|
|
|
631
|
-
var updatedPoll = _objectSpread$
|
|
631
|
+
var updatedPoll = _objectSpread$8(_objectSpread$8({}, poll), {}, {
|
|
632
632
|
own_votes: _toConsumableArray(((_message$poll4 = message.poll) === null || _message$poll4 === void 0 ? void 0 : _message$poll4.own_votes) || [])
|
|
633
633
|
});
|
|
634
634
|
|
|
635
|
-
var newMessage = _objectSpread$
|
|
635
|
+
var newMessage = _objectSpread$8(_objectSpread$8({}, message), {}, {
|
|
636
636
|
poll: updatedPoll
|
|
637
637
|
});
|
|
638
638
|
|
|
@@ -647,7 +647,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
647
647
|
var m = messages[i];
|
|
648
648
|
|
|
649
649
|
if (((_m$user = m.user) === null || _m$user === void 0 ? void 0 : _m$user.id) === user.id) {
|
|
650
|
-
messages[i] = _objectSpread$
|
|
650
|
+
messages[i] = _objectSpread$8(_objectSpread$8({}, m), {}, {
|
|
651
651
|
user: user
|
|
652
652
|
});
|
|
653
653
|
}
|
|
@@ -702,7 +702,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
702
702
|
user: m.user
|
|
703
703
|
};
|
|
704
704
|
} else {
|
|
705
|
-
messages[i] = _objectSpread$
|
|
705
|
+
messages[i] = _objectSpread$8(_objectSpread$8({}, m), {}, {
|
|
706
706
|
type: 'deleted',
|
|
707
707
|
deleted_at: user.deleted_at
|
|
708
708
|
});
|
|
@@ -809,7 +809,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
809
809
|
}, {
|
|
810
810
|
key: "formatMessage",
|
|
811
811
|
value: function formatMessage(message) {
|
|
812
|
-
return _objectSpread$
|
|
812
|
+
return _objectSpread$8(_objectSpread$8({}, message), {}, {
|
|
813
813
|
/**
|
|
814
814
|
* @deprecated please use `html`
|
|
815
815
|
*/
|
|
@@ -1027,7 +1027,7 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
1027
1027
|
var parseMessage = function parseMessage(m) {
|
|
1028
1028
|
var _m$pinned_at, _m$updated_at;
|
|
1029
1029
|
|
|
1030
|
-
return _objectSpread$
|
|
1030
|
+
return _objectSpread$8(_objectSpread$8({}, m), {}, {
|
|
1031
1031
|
created_at: m.created_at.toISOString(),
|
|
1032
1032
|
pinned_at: (_m$pinned_at = m.pinned_at) === null || _m$pinned_at === void 0 ? void 0 : _m$pinned_at.toISOString(),
|
|
1033
1033
|
updated_at: (_m$updated_at = m.updated_at) === null || _m$updated_at === void 0 ? void 0 : _m$updated_at.toISOString()
|
|
@@ -1037,8 +1037,8 @@ var ChannelState = /*#__PURE__*/function () {
|
|
|
1037
1037
|
var update = function update(messages) {
|
|
1038
1038
|
var updatedMessages = messages.reduce(function (acc, msg) {
|
|
1039
1039
|
if (msg.quoted_message_id === message.id) {
|
|
1040
|
-
acc.push(_objectSpread$
|
|
1041
|
-
quoted_message: remove ? _objectSpread$
|
|
1040
|
+
acc.push(_objectSpread$8(_objectSpread$8({}, parseMessage(msg)), {}, {
|
|
1041
|
+
quoted_message: remove ? _objectSpread$8(_objectSpread$8({}, message), {}, {
|
|
1042
1042
|
attachments: []
|
|
1043
1043
|
}) : message
|
|
1044
1044
|
}));
|
|
@@ -1522,9 +1522,9 @@ function _unsupportedIterableToArray$3(o, minLen) { if (!o) return; if (typeof o
|
|
|
1522
1522
|
|
|
1523
1523
|
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; }
|
|
1524
1524
|
|
|
1525
|
-
function ownKeys$
|
|
1525
|
+
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; }
|
|
1526
1526
|
|
|
1527
|
-
function _objectSpread$
|
|
1527
|
+
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; }
|
|
1528
1528
|
|
|
1529
1529
|
/**
|
|
1530
1530
|
* Channel - The Channel class manages it's own state.
|
|
@@ -1597,7 +1597,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1597
1597
|
while (1) {
|
|
1598
1598
|
switch (_context.prev = _context.next) {
|
|
1599
1599
|
case 0:
|
|
1600
|
-
defaultOptions = _objectSpread$
|
|
1600
|
+
defaultOptions = _objectSpread$7(_objectSpread$7({}, options), {}, {
|
|
1601
1601
|
watch: false,
|
|
1602
1602
|
state: false,
|
|
1603
1603
|
presence: false
|
|
@@ -1669,7 +1669,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1669
1669
|
|
|
1670
1670
|
this.data = data; // this._data is used for the requests...
|
|
1671
1671
|
|
|
1672
|
-
this._data = _objectSpread$
|
|
1672
|
+
this._data = _objectSpread$7({}, data);
|
|
1673
1673
|
this.cid = "".concat(type, ":").concat(id);
|
|
1674
1674
|
this.listeners = {}; // perhaps the state variable should be private
|
|
1675
1675
|
|
|
@@ -1731,7 +1731,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1731
1731
|
switch (_context2.prev = _context2.next) {
|
|
1732
1732
|
case 0:
|
|
1733
1733
|
_context2.next = 2;
|
|
1734
|
-
return this.getClient().post(this._channelURL() + '/message', _objectSpread$
|
|
1734
|
+
return this.getClient().post(this._channelURL() + '/message', _objectSpread$7({
|
|
1735
1735
|
message: message
|
|
1736
1736
|
}, options));
|
|
1737
1737
|
|
|
@@ -1847,7 +1847,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1847
1847
|
|
|
1848
1848
|
case 3:
|
|
1849
1849
|
// Return a list of channels
|
|
1850
|
-
payload = _objectSpread$
|
|
1850
|
+
payload = _objectSpread$7(_objectSpread$7({
|
|
1851
1851
|
filter_conditions: {
|
|
1852
1852
|
cid: this.cid
|
|
1853
1853
|
}
|
|
@@ -1944,7 +1944,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
1944
1944
|
|
|
1945
1945
|
_context5.next = 6;
|
|
1946
1946
|
return this.getClient().get(this.getClient().baseURL + '/members', {
|
|
1947
|
-
payload: _objectSpread$
|
|
1947
|
+
payload: _objectSpread$7({
|
|
1948
1948
|
type: type,
|
|
1949
1949
|
id: id,
|
|
1950
1950
|
members: members,
|
|
@@ -2005,7 +2005,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2005
2005
|
|
|
2006
2006
|
case 4:
|
|
2007
2007
|
_context6.next = 6;
|
|
2008
|
-
return this.getClient().post(this.getClient().baseURL + "/messages/".concat(messageID, "/reaction"), _objectSpread$
|
|
2008
|
+
return this.getClient().post(this.getClient().baseURL + "/messages/".concat(messageID, "/reaction"), _objectSpread$7({
|
|
2009
2009
|
reaction: reaction
|
|
2010
2010
|
}, options));
|
|
2011
2011
|
|
|
@@ -2086,7 +2086,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2086
2086
|
delete channelData[key];
|
|
2087
2087
|
});
|
|
2088
2088
|
_context7.next = 7;
|
|
2089
|
-
return this._update(_objectSpread$
|
|
2089
|
+
return this._update(_objectSpread$7({
|
|
2090
2090
|
message: updateMessage,
|
|
2091
2091
|
data: channelData
|
|
2092
2092
|
}, options));
|
|
@@ -2258,7 +2258,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2258
2258
|
case 0:
|
|
2259
2259
|
options = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : {};
|
|
2260
2260
|
_context11.next = 3;
|
|
2261
|
-
return this.getClient().delete(this._channelURL(), _objectSpread$
|
|
2261
|
+
return this.getClient().delete(this._channelURL(), _objectSpread$7({}, options));
|
|
2262
2262
|
|
|
2263
2263
|
case 3:
|
|
2264
2264
|
return _context11.abrupt("return", _context11.sent);
|
|
@@ -2334,7 +2334,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2334
2334
|
case 0:
|
|
2335
2335
|
options = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : {};
|
|
2336
2336
|
_context13.next = 3;
|
|
2337
|
-
return this._update(_objectSpread$
|
|
2337
|
+
return this._update(_objectSpread$7({
|
|
2338
2338
|
accept_invite: true
|
|
2339
2339
|
}, options));
|
|
2340
2340
|
|
|
@@ -2375,7 +2375,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2375
2375
|
case 0:
|
|
2376
2376
|
options = _args14.length > 0 && _args14[0] !== undefined ? _args14[0] : {};
|
|
2377
2377
|
_context14.next = 3;
|
|
2378
|
-
return this._update(_objectSpread$
|
|
2378
|
+
return this._update(_objectSpread$7({
|
|
2379
2379
|
reject_invite: true
|
|
2380
2380
|
}, options));
|
|
2381
2381
|
|
|
@@ -2417,7 +2417,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2417
2417
|
case 0:
|
|
2418
2418
|
options = _args15.length > 2 && _args15[2] !== undefined ? _args15[2] : {};
|
|
2419
2419
|
_context15.next = 3;
|
|
2420
|
-
return this._update(_objectSpread$
|
|
2420
|
+
return this._update(_objectSpread$7({
|
|
2421
2421
|
add_members: members,
|
|
2422
2422
|
message: message
|
|
2423
2423
|
}, options));
|
|
@@ -2460,7 +2460,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2460
2460
|
case 0:
|
|
2461
2461
|
options = _args16.length > 2 && _args16[2] !== undefined ? _args16[2] : {};
|
|
2462
2462
|
_context16.next = 3;
|
|
2463
|
-
return this._update(_objectSpread$
|
|
2463
|
+
return this._update(_objectSpread$7({
|
|
2464
2464
|
add_moderators: members,
|
|
2465
2465
|
message: message
|
|
2466
2466
|
}, options));
|
|
@@ -2503,7 +2503,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2503
2503
|
case 0:
|
|
2504
2504
|
options = _args17.length > 2 && _args17[2] !== undefined ? _args17[2] : {};
|
|
2505
2505
|
_context17.next = 3;
|
|
2506
|
-
return this._update(_objectSpread$
|
|
2506
|
+
return this._update(_objectSpread$7({
|
|
2507
2507
|
assign_roles: roles,
|
|
2508
2508
|
message: message
|
|
2509
2509
|
}, options));
|
|
@@ -2546,7 +2546,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2546
2546
|
case 0:
|
|
2547
2547
|
options = _args18.length > 2 && _args18[2] !== undefined ? _args18[2] : {};
|
|
2548
2548
|
_context18.next = 3;
|
|
2549
|
-
return this._update(_objectSpread$
|
|
2549
|
+
return this._update(_objectSpread$7({
|
|
2550
2550
|
invites: members,
|
|
2551
2551
|
message: message
|
|
2552
2552
|
}, options));
|
|
@@ -2589,7 +2589,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2589
2589
|
case 0:
|
|
2590
2590
|
options = _args19.length > 2 && _args19[2] !== undefined ? _args19[2] : {};
|
|
2591
2591
|
_context19.next = 3;
|
|
2592
|
-
return this._update(_objectSpread$
|
|
2592
|
+
return this._update(_objectSpread$7({
|
|
2593
2593
|
remove_members: members,
|
|
2594
2594
|
message: message
|
|
2595
2595
|
}, options));
|
|
@@ -2632,7 +2632,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2632
2632
|
case 0:
|
|
2633
2633
|
options = _args20.length > 2 && _args20[2] !== undefined ? _args20[2] : {};
|
|
2634
2634
|
_context20.next = 3;
|
|
2635
|
-
return this._update(_objectSpread$
|
|
2635
|
+
return this._update(_objectSpread$7({
|
|
2636
2636
|
demote_moderators: members,
|
|
2637
2637
|
message: message
|
|
2638
2638
|
}, options));
|
|
@@ -2717,7 +2717,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2717
2717
|
case 0:
|
|
2718
2718
|
opts = _args22.length > 0 && _args22[0] !== undefined ? _args22[0] : {};
|
|
2719
2719
|
_context22.next = 3;
|
|
2720
|
-
return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$
|
|
2720
|
+
return this.getClient().post(this.getClient().baseURL + '/moderation/mute/channel', _objectSpread$7({
|
|
2721
2721
|
channel_cid: this.cid
|
|
2722
2722
|
}, opts));
|
|
2723
2723
|
|
|
@@ -2759,7 +2759,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2759
2759
|
case 0:
|
|
2760
2760
|
opts = _args23.length > 0 && _args23[0] !== undefined ? _args23[0] : {};
|
|
2761
2761
|
_context23.next = 3;
|
|
2762
|
-
return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$
|
|
2762
|
+
return this.getClient().post(this.getClient().baseURL + '/moderation/unmute/channel', _objectSpread$7({
|
|
2763
2763
|
channel_cid: this.cid
|
|
2764
2764
|
}, opts));
|
|
2765
2765
|
|
|
@@ -2844,7 +2844,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2844
2844
|
|
|
2845
2845
|
this.lastTypingEvent = new Date();
|
|
2846
2846
|
_context24.next = 10;
|
|
2847
|
-
return this.sendEvent(_objectSpread$
|
|
2847
|
+
return this.sendEvent(_objectSpread$7({
|
|
2848
2848
|
type: 'typing.start',
|
|
2849
2849
|
parent_id: parent_id
|
|
2850
2850
|
}, options || {}));
|
|
@@ -2888,7 +2888,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2888
2888
|
this.lastTypingEvent = null;
|
|
2889
2889
|
this.isTyping = false;
|
|
2890
2890
|
_context25.next = 6;
|
|
2891
|
-
return this.sendEvent(_objectSpread$
|
|
2891
|
+
return this.sendEvent(_objectSpread$7({
|
|
2892
2892
|
type: 'typing.stop',
|
|
2893
2893
|
parent_id: parent_id
|
|
2894
2894
|
}, options || {}));
|
|
@@ -2975,7 +2975,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
2975
2975
|
|
|
2976
2976
|
case 4:
|
|
2977
2977
|
_context26.next = 6;
|
|
2978
|
-
return this.getClient().post(this._channelURL() + '/read', _objectSpread$
|
|
2978
|
+
return this.getClient().post(this._channelURL() + '/read', _objectSpread$7({}, data));
|
|
2979
2979
|
|
|
2980
2980
|
case 6:
|
|
2981
2981
|
return _context26.abrupt("return", _context26.sent);
|
|
@@ -3022,7 +3022,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3022
3022
|
|
|
3023
3023
|
case 3:
|
|
3024
3024
|
_context27.next = 5;
|
|
3025
|
-
return this.getClient().post(this._channelURL() + '/unread', _objectSpread$
|
|
3025
|
+
return this.getClient().post(this._channelURL() + '/unread', _objectSpread$7({}, data));
|
|
3026
3026
|
|
|
3027
3027
|
case 5:
|
|
3028
3028
|
return _context27.abrupt("return", _context27.sent);
|
|
@@ -3090,7 +3090,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3090
3090
|
defaultOptions.watch = false;
|
|
3091
3091
|
}
|
|
3092
3092
|
|
|
3093
|
-
combined = _objectSpread$
|
|
3093
|
+
combined = _objectSpread$7(_objectSpread$7({}, defaultOptions), options);
|
|
3094
3094
|
_context28.next = 7;
|
|
3095
3095
|
return this.query(combined, 'latest');
|
|
3096
3096
|
|
|
@@ -3182,7 +3182,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3182
3182
|
case 0:
|
|
3183
3183
|
normalizedSort = sort ? normalizeQuerySort(sort) : undefined;
|
|
3184
3184
|
_context30.next = 3;
|
|
3185
|
-
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(parent_id, "/replies"), _objectSpread$
|
|
3185
|
+
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(parent_id, "/replies"), _objectSpread$7({
|
|
3186
3186
|
sort: normalizedSort
|
|
3187
3187
|
}, options));
|
|
3188
3188
|
|
|
@@ -3232,7 +3232,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3232
3232
|
sort = _args31.length > 1 && _args31[1] !== undefined ? _args31[1] : [];
|
|
3233
3233
|
_context31.next = 3;
|
|
3234
3234
|
return this.getClient().get(this.getClient().baseURL + "/channels/".concat(this.type, "/").concat(this.id, "/pinned_messages"), {
|
|
3235
|
-
payload: _objectSpread$
|
|
3235
|
+
payload: _objectSpread$7(_objectSpread$7({}, options), {}, {
|
|
3236
3236
|
sort: normalizeQuerySort(sort)
|
|
3237
3237
|
})
|
|
3238
3238
|
});
|
|
@@ -3266,7 +3266,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3266
3266
|
}, {
|
|
3267
3267
|
key: "getReactions",
|
|
3268
3268
|
value: function getReactions(message_id, options) {
|
|
3269
|
-
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(message_id, "/reactions"), _objectSpread$
|
|
3269
|
+
return this.getClient().get(this.getClient().baseURL + "/messages/".concat(message_id, "/reactions"), _objectSpread$7({}, options));
|
|
3270
3270
|
}
|
|
3271
3271
|
/**
|
|
3272
3272
|
* getMessagesById - Retrieves a list of messages by ID
|
|
@@ -3414,7 +3414,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3414
3414
|
}
|
|
3415
3415
|
|
|
3416
3416
|
_context32.next = 7;
|
|
3417
|
-
return this.getClient().post(queryURL + '/query', _objectSpread$
|
|
3417
|
+
return this.getClient().post(queryURL + '/query', _objectSpread$7({
|
|
3418
3418
|
data: this._data,
|
|
3419
3419
|
state: true
|
|
3420
3420
|
}, options));
|
|
@@ -3503,7 +3503,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3503
3503
|
this._checkInitialized();
|
|
3504
3504
|
|
|
3505
3505
|
_context33.next = 3;
|
|
3506
|
-
return this.getClient().banUser(targetUserID, _objectSpread$
|
|
3506
|
+
return this.getClient().banUser(targetUserID, _objectSpread$7(_objectSpread$7({}, options), {}, {
|
|
3507
3507
|
type: this.type,
|
|
3508
3508
|
id: this.id
|
|
3509
3509
|
}));
|
|
@@ -3675,7 +3675,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
3675
3675
|
this._checkInitialized();
|
|
3676
3676
|
|
|
3677
3677
|
_context37.next = 3;
|
|
3678
|
-
return this.getClient().shadowBan(targetUserID, _objectSpread$
|
|
3678
|
+
return this.getClient().shadowBan(targetUserID, _objectSpread$7(_objectSpread$7({}, options), {}, {
|
|
3679
3679
|
type: this.type,
|
|
3680
3680
|
id: this.id
|
|
3681
3681
|
}));
|
|
@@ -4129,7 +4129,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4129
4129
|
});
|
|
4130
4130
|
}
|
|
4131
4131
|
|
|
4132
|
-
channel.data = _objectSpread$
|
|
4132
|
+
channel.data = _objectSpread$7(_objectSpread$7({}, event.channel), {}, {
|
|
4133
4133
|
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,
|
|
4134
4134
|
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
|
|
4135
4135
|
});
|
|
@@ -4203,7 +4203,7 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4203
4203
|
break;
|
|
4204
4204
|
|
|
4205
4205
|
case 'channel.hidden':
|
|
4206
|
-
channel.data = _objectSpread$
|
|
4206
|
+
channel.data = _objectSpread$7(_objectSpread$7({}, channel.data), {}, {
|
|
4207
4207
|
hidden: true
|
|
4208
4208
|
});
|
|
4209
4209
|
|
|
@@ -4214,26 +4214,26 @@ var Channel = /*#__PURE__*/function () {
|
|
|
4214
4214
|
break;
|
|
4215
4215
|
|
|
4216
4216
|
case 'channel.visible':
|
|
4217
|
-
channel.data = _objectSpread$
|
|
4217
|
+
channel.data = _objectSpread$7(_objectSpread$7({}, channel.data), {}, {
|
|
4218
4218
|
hidden: false
|
|
4219
4219
|
});
|
|
4220
4220
|
break;
|
|
4221
4221
|
|
|
4222
4222
|
case 'user.banned':
|
|
4223
4223
|
if (!((_event$user11 = event.user) !== null && _event$user11 !== void 0 && _event$user11.id)) break;
|
|
4224
|
-
channelState.members[event.user.id] = _objectSpread$
|
|
4224
|
+
channelState.members[event.user.id] = _objectSpread$7(_objectSpread$7({}, channelState.members[event.user.id] || {}), {}, {
|
|
4225
4225
|
shadow_banned: !!event.shadow,
|
|
4226
4226
|
banned: !event.shadow,
|
|
4227
|
-
user: _objectSpread$
|
|
4227
|
+
user: _objectSpread$7(_objectSpread$7({}, ((_channelState$members = channelState.members[event.user.id]) === null || _channelState$members === void 0 ? void 0 : _channelState$members.user) || {}), event.user)
|
|
4228
4228
|
});
|
|
4229
4229
|
break;
|
|
4230
4230
|
|
|
4231
4231
|
case 'user.unbanned':
|
|
4232
4232
|
if (!((_event$user12 = event.user) !== null && _event$user12 !== void 0 && _event$user12.id)) break;
|
|
4233
|
-
channelState.members[event.user.id] = _objectSpread$
|
|
4233
|
+
channelState.members[event.user.id] = _objectSpread$7(_objectSpread$7({}, channelState.members[event.user.id] || {}), {}, {
|
|
4234
4234
|
shadow_banned: false,
|
|
4235
4235
|
banned: false,
|
|
4236
|
-
user: _objectSpread$
|
|
4236
|
+
user: _objectSpread$7(_objectSpread$7({}, ((_channelState$members2 = channelState.members[event.user.id]) === null || _channelState$members2 === void 0 ? void 0 : _channelState$members2.user) || {}), event.user)
|
|
4237
4237
|
});
|
|
4238
4238
|
break;
|
|
4239
4239
|
} // any event can send over the online count
|
|
@@ -4487,9 +4487,9 @@ var ClientState = /*#__PURE__*/function () {
|
|
|
4487
4487
|
return ClientState;
|
|
4488
4488
|
}();
|
|
4489
4489
|
|
|
4490
|
-
function ownKeys$
|
|
4490
|
+
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; }
|
|
4491
4491
|
|
|
4492
|
-
function _objectSpread$
|
|
4492
|
+
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; }
|
|
4493
4493
|
var InsightMetrics = function InsightMetrics() {
|
|
4494
4494
|
_classCallCheck(this, InsightMetrics);
|
|
4495
4495
|
|
|
@@ -4568,7 +4568,7 @@ var postInsights = /*#__PURE__*/function () {
|
|
|
4568
4568
|
};
|
|
4569
4569
|
}();
|
|
4570
4570
|
function buildWsFatalInsight(connection, event) {
|
|
4571
|
-
return _objectSpread$
|
|
4571
|
+
return _objectSpread$6(_objectSpread$6({}, event), buildWsBaseInsight(connection));
|
|
4572
4572
|
}
|
|
4573
4573
|
|
|
4574
4574
|
function buildWsBaseInsight(connection) {
|
|
@@ -4601,9 +4601,9 @@ function buildWsSuccessAfterFailureInsight(connection) {
|
|
|
4601
4601
|
return buildWsBaseInsight(connection);
|
|
4602
4602
|
}
|
|
4603
4603
|
|
|
4604
|
-
function ownKeys$
|
|
4604
|
+
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; }
|
|
4605
4605
|
|
|
4606
|
-
function _objectSpread$
|
|
4606
|
+
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; }
|
|
4607
4607
|
|
|
4608
4608
|
// Type guards to check WebSocket error type
|
|
4609
4609
|
var isCloseEvent = function isCloseEvent(res) {
|
|
@@ -4967,7 +4967,7 @@ var StableWSConnection = /*#__PURE__*/function () {
|
|
|
4967
4967
|
value: function _log(msg) {
|
|
4968
4968
|
var extra = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
4969
4969
|
var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'info';
|
|
4970
|
-
this.client.logger(level, 'connection:' + msg, _objectSpread$
|
|
4970
|
+
this.client.logger(level, 'connection:' + msg, _objectSpread$5({
|
|
4971
4971
|
tags: ['connection']
|
|
4972
4972
|
}, extra));
|
|
4973
4973
|
}
|
|
@@ -5558,9 +5558,9 @@ var StableWSConnection = /*#__PURE__*/function () {
|
|
|
5558
5558
|
return StableWSConnection;
|
|
5559
5559
|
}();
|
|
5560
5560
|
|
|
5561
|
-
function ownKeys$
|
|
5561
|
+
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; }
|
|
5562
5562
|
|
|
5563
|
-
function _objectSpread$
|
|
5563
|
+
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; }
|
|
5564
5564
|
|
|
5565
5565
|
/**
|
|
5566
5566
|
* Creates the JWT token that can be used for a UserSession
|
|
@@ -5581,7 +5581,7 @@ function JWTUserToken(apiSecret, userId) {
|
|
|
5581
5581
|
throw new TypeError('userId should be a string');
|
|
5582
5582
|
}
|
|
5583
5583
|
|
|
5584
|
-
var payload = _objectSpread$
|
|
5584
|
+
var payload = _objectSpread$4({
|
|
5585
5585
|
user_id: userId
|
|
5586
5586
|
}, extraData); // make sure we return a clear error when jwt is shimmed (ie. browser build)
|
|
5587
5587
|
|
|
@@ -5991,9 +5991,9 @@ function isErrorResponse(res) {
|
|
|
5991
5991
|
return !res.status || res.status < 200 || 300 <= res.status;
|
|
5992
5992
|
}
|
|
5993
5993
|
|
|
5994
|
-
function ownKeys$
|
|
5994
|
+
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; }
|
|
5995
5995
|
|
|
5996
|
-
function _objectSpread$
|
|
5996
|
+
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; }
|
|
5997
5997
|
var ConnectionState;
|
|
5998
5998
|
|
|
5999
5999
|
(function (ConnectionState) {
|
|
@@ -6056,7 +6056,7 @@ var WSConnectionFallback = /*#__PURE__*/function () {
|
|
|
6056
6056
|
_context.next = 4;
|
|
6057
6057
|
return _this.client.doAxiosRequest('get', _this.client.baseURL.replace(':3030', ':8900') + '/longpoll', // replace port if present for testing with local API
|
|
6058
6058
|
undefined, {
|
|
6059
|
-
config: _objectSpread$
|
|
6059
|
+
config: _objectSpread$3(_objectSpread$3({}, config), {}, {
|
|
6060
6060
|
cancelToken: (_this$cancelToken2 = _this.cancelToken) === null || _this$cancelToken2 === void 0 ? void 0 : _this$cancelToken2.token
|
|
6061
6061
|
}),
|
|
6062
6062
|
params: params
|
|
@@ -6334,7 +6334,7 @@ var WSConnectionFallback = /*#__PURE__*/function () {
|
|
|
6334
6334
|
value: function _log(msg) {
|
|
6335
6335
|
var extra = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
6336
6336
|
var level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'info';
|
|
6337
|
-
this.client.logger(level, 'WSConnectionFallback:' + msg, _objectSpread$
|
|
6337
|
+
this.client.logger(level, 'WSConnectionFallback:' + msg, _objectSpread$3({
|
|
6338
6338
|
tags: ['connection_fallback', 'connection']
|
|
6339
6339
|
}, extra));
|
|
6340
6340
|
}
|
|
@@ -6916,9 +6916,9 @@ var VotingVisibility;
|
|
|
6916
6916
|
|
|
6917
6917
|
var _excluded$1 = ["parent_message_id", "parent_message", "latest_replies", "thread_participants", "reply_count", "channel", "read"];
|
|
6918
6918
|
|
|
6919
|
-
function ownKeys$
|
|
6919
|
+
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; }
|
|
6920
6920
|
|
|
6921
|
-
function _objectSpread$
|
|
6921
|
+
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; }
|
|
6922
6922
|
|
|
6923
6923
|
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; } } }; }
|
|
6924
6924
|
|
|
@@ -6975,7 +6975,7 @@ var Thread = /*#__PURE__*/function () {
|
|
|
6975
6975
|
try {
|
|
6976
6976
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
6977
6977
|
var r = _step.value;
|
|
6978
|
-
this.read[r.user.id] = _objectSpread$
|
|
6978
|
+
this.read[r.user.id] = _objectSpread$2(_objectSpread$2({}, r), {}, {
|
|
6979
6979
|
last_read: new Date(r.last_read)
|
|
6980
6980
|
});
|
|
6981
6981
|
}
|
|
@@ -7073,6 +7073,424 @@ var Thread = /*#__PURE__*/function () {
|
|
|
7073
7073
|
return Thread;
|
|
7074
7074
|
}();
|
|
7075
7075
|
|
|
7076
|
+
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; }
|
|
7077
|
+
|
|
7078
|
+
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; }
|
|
7079
|
+
var MODERATION_ENTITY_TYPES = {
|
|
7080
|
+
user: 'stream:user',
|
|
7081
|
+
message: 'stream:chat:v1:message'
|
|
7082
|
+
}; // Moderation class provides all the endpoints related to moderation v2.
|
|
7083
|
+
|
|
7084
|
+
var Moderation = /*#__PURE__*/function () {
|
|
7085
|
+
function Moderation(client) {
|
|
7086
|
+
_classCallCheck(this, Moderation);
|
|
7087
|
+
|
|
7088
|
+
_defineProperty(this, "client", void 0);
|
|
7089
|
+
|
|
7090
|
+
this.client = client;
|
|
7091
|
+
}
|
|
7092
|
+
/**
|
|
7093
|
+
* Flag a user
|
|
7094
|
+
*
|
|
7095
|
+
* @param {string} flaggedUserID User ID to be flagged
|
|
7096
|
+
* @param {string} reason Reason for flagging the user
|
|
7097
|
+
* @param {Object} options Additional options for flagging the user
|
|
7098
|
+
* @param {string} options.user_id (For server side usage) User ID of the user who is flagging the target user
|
|
7099
|
+
* @param {Object} options.custom Additional data to be stored with the flag
|
|
7100
|
+
* @returns
|
|
7101
|
+
*/
|
|
7102
|
+
|
|
7103
|
+
|
|
7104
|
+
_createClass(Moderation, [{
|
|
7105
|
+
key: "flagUser",
|
|
7106
|
+
value: function () {
|
|
7107
|
+
var _flagUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(flaggedUserID, reason) {
|
|
7108
|
+
var options,
|
|
7109
|
+
_args = arguments;
|
|
7110
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
7111
|
+
while (1) {
|
|
7112
|
+
switch (_context.prev = _context.next) {
|
|
7113
|
+
case 0:
|
|
7114
|
+
options = _args.length > 2 && _args[2] !== undefined ? _args[2] : {};
|
|
7115
|
+
return _context.abrupt("return", this.flag(MODERATION_ENTITY_TYPES.user, flaggedUserID, '', reason, options));
|
|
7116
|
+
|
|
7117
|
+
case 2:
|
|
7118
|
+
case "end":
|
|
7119
|
+
return _context.stop();
|
|
7120
|
+
}
|
|
7121
|
+
}
|
|
7122
|
+
}, _callee, this);
|
|
7123
|
+
}));
|
|
7124
|
+
|
|
7125
|
+
function flagUser(_x, _x2) {
|
|
7126
|
+
return _flagUser.apply(this, arguments);
|
|
7127
|
+
}
|
|
7128
|
+
|
|
7129
|
+
return flagUser;
|
|
7130
|
+
}()
|
|
7131
|
+
/**
|
|
7132
|
+
* Flag a message
|
|
7133
|
+
*
|
|
7134
|
+
* @param {string} messageID Message ID to be flagged
|
|
7135
|
+
* @param {string} reason Reason for flagging the message
|
|
7136
|
+
* @param {Object} options Additional options for flagging the message
|
|
7137
|
+
* @param {string} options.user_id (For server side usage) User ID of the user who is flagging the target message
|
|
7138
|
+
* @param {Object} options.custom Additional data to be stored with the flag
|
|
7139
|
+
* @returns
|
|
7140
|
+
*/
|
|
7141
|
+
|
|
7142
|
+
}, {
|
|
7143
|
+
key: "flagMessage",
|
|
7144
|
+
value: function () {
|
|
7145
|
+
var _flagMessage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(messageID, reason) {
|
|
7146
|
+
var options,
|
|
7147
|
+
_args2 = arguments;
|
|
7148
|
+
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
7149
|
+
while (1) {
|
|
7150
|
+
switch (_context2.prev = _context2.next) {
|
|
7151
|
+
case 0:
|
|
7152
|
+
options = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : {};
|
|
7153
|
+
return _context2.abrupt("return", this.flag(MODERATION_ENTITY_TYPES.message, messageID, '', reason, options));
|
|
7154
|
+
|
|
7155
|
+
case 2:
|
|
7156
|
+
case "end":
|
|
7157
|
+
return _context2.stop();
|
|
7158
|
+
}
|
|
7159
|
+
}
|
|
7160
|
+
}, _callee2, this);
|
|
7161
|
+
}));
|
|
7162
|
+
|
|
7163
|
+
function flagMessage(_x3, _x4) {
|
|
7164
|
+
return _flagMessage.apply(this, arguments);
|
|
7165
|
+
}
|
|
7166
|
+
|
|
7167
|
+
return flagMessage;
|
|
7168
|
+
}()
|
|
7169
|
+
/**
|
|
7170
|
+
* Flag a user
|
|
7171
|
+
*
|
|
7172
|
+
* @param {string} entityType Entity type to be flagged
|
|
7173
|
+
* @param {string} entityId Entity ID to be flagged
|
|
7174
|
+
* @param {string} entityCreatorID User ID of the entity creator
|
|
7175
|
+
* @param {string} reason Reason for flagging the entity
|
|
7176
|
+
* @param {Object} options Additional options for flagging the entity
|
|
7177
|
+
* @param {string} options.user_id (For server side usage) User ID of the user who is flagging the target entity
|
|
7178
|
+
* @param {Object} options.moderation_payload Content to be flagged e.g., { texts: ['text1', 'text2'], images: ['image1', 'image2']}
|
|
7179
|
+
* @param {Object} options.custom Additional data to be stored with the flag
|
|
7180
|
+
* @returns
|
|
7181
|
+
*/
|
|
7182
|
+
|
|
7183
|
+
}, {
|
|
7184
|
+
key: "flag",
|
|
7185
|
+
value: function () {
|
|
7186
|
+
var _flag = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(entityType, entityId, entityCreatorID, reason) {
|
|
7187
|
+
var options,
|
|
7188
|
+
_args3 = arguments;
|
|
7189
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
7190
|
+
while (1) {
|
|
7191
|
+
switch (_context3.prev = _context3.next) {
|
|
7192
|
+
case 0:
|
|
7193
|
+
options = _args3.length > 4 && _args3[4] !== undefined ? _args3[4] : {};
|
|
7194
|
+
_context3.next = 3;
|
|
7195
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/flag', _objectSpread$1({
|
|
7196
|
+
entity_type: entityType,
|
|
7197
|
+
entity_id: entityId,
|
|
7198
|
+
entity_creator_id: entityCreatorID,
|
|
7199
|
+
reason: reason
|
|
7200
|
+
}, options));
|
|
7201
|
+
|
|
7202
|
+
case 3:
|
|
7203
|
+
return _context3.abrupt("return", _context3.sent);
|
|
7204
|
+
|
|
7205
|
+
case 4:
|
|
7206
|
+
case "end":
|
|
7207
|
+
return _context3.stop();
|
|
7208
|
+
}
|
|
7209
|
+
}
|
|
7210
|
+
}, _callee3, this);
|
|
7211
|
+
}));
|
|
7212
|
+
|
|
7213
|
+
function flag(_x5, _x6, _x7, _x8) {
|
|
7214
|
+
return _flag.apply(this, arguments);
|
|
7215
|
+
}
|
|
7216
|
+
|
|
7217
|
+
return flag;
|
|
7218
|
+
}()
|
|
7219
|
+
/**
|
|
7220
|
+
* Mute a user
|
|
7221
|
+
* @param {string} targetID User ID to be muted
|
|
7222
|
+
* @param {Object} options Additional options for muting the user
|
|
7223
|
+
* @param {string} options.user_id (For server side usage) User ID of the user who is muting the target user
|
|
7224
|
+
* @param {number} options.timeout Timeout for the mute in minutes
|
|
7225
|
+
* @returns
|
|
7226
|
+
*/
|
|
7227
|
+
|
|
7228
|
+
}, {
|
|
7229
|
+
key: "muteUser",
|
|
7230
|
+
value: function () {
|
|
7231
|
+
var _muteUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4(targetID) {
|
|
7232
|
+
var options,
|
|
7233
|
+
_args4 = arguments;
|
|
7234
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
7235
|
+
while (1) {
|
|
7236
|
+
switch (_context4.prev = _context4.next) {
|
|
7237
|
+
case 0:
|
|
7238
|
+
options = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : {};
|
|
7239
|
+
_context4.next = 3;
|
|
7240
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/mute', _objectSpread$1({
|
|
7241
|
+
target_ids: [targetID]
|
|
7242
|
+
}, options));
|
|
7243
|
+
|
|
7244
|
+
case 3:
|
|
7245
|
+
return _context4.abrupt("return", _context4.sent);
|
|
7246
|
+
|
|
7247
|
+
case 4:
|
|
7248
|
+
case "end":
|
|
7249
|
+
return _context4.stop();
|
|
7250
|
+
}
|
|
7251
|
+
}
|
|
7252
|
+
}, _callee4, this);
|
|
7253
|
+
}));
|
|
7254
|
+
|
|
7255
|
+
function muteUser(_x9) {
|
|
7256
|
+
return _muteUser.apply(this, arguments);
|
|
7257
|
+
}
|
|
7258
|
+
|
|
7259
|
+
return muteUser;
|
|
7260
|
+
}()
|
|
7261
|
+
/**
|
|
7262
|
+
* Unmute a user
|
|
7263
|
+
* @param {string} targetID User ID to be unmuted
|
|
7264
|
+
* @param {Object} options Additional options for unmuting the user
|
|
7265
|
+
* @param {string} options.user_id (For server side usage) User ID of the user who is unmuting the target user
|
|
7266
|
+
* @returns
|
|
7267
|
+
*/
|
|
7268
|
+
|
|
7269
|
+
}, {
|
|
7270
|
+
key: "unmuteUser",
|
|
7271
|
+
value: function () {
|
|
7272
|
+
var _unmuteUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(targetID, options) {
|
|
7273
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
7274
|
+
while (1) {
|
|
7275
|
+
switch (_context5.prev = _context5.next) {
|
|
7276
|
+
case 0:
|
|
7277
|
+
_context5.next = 2;
|
|
7278
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/unmute', _objectSpread$1({
|
|
7279
|
+
target_ids: [targetID]
|
|
7280
|
+
}, options));
|
|
7281
|
+
|
|
7282
|
+
case 2:
|
|
7283
|
+
return _context5.abrupt("return", _context5.sent);
|
|
7284
|
+
|
|
7285
|
+
case 3:
|
|
7286
|
+
case "end":
|
|
7287
|
+
return _context5.stop();
|
|
7288
|
+
}
|
|
7289
|
+
}
|
|
7290
|
+
}, _callee5, this);
|
|
7291
|
+
}));
|
|
7292
|
+
|
|
7293
|
+
function unmuteUser(_x10, _x11) {
|
|
7294
|
+
return _unmuteUser.apply(this, arguments);
|
|
7295
|
+
}
|
|
7296
|
+
|
|
7297
|
+
return unmuteUser;
|
|
7298
|
+
}()
|
|
7299
|
+
/**
|
|
7300
|
+
* Get moderation report for a user
|
|
7301
|
+
* @param {string} userID User ID for which moderation report is to be fetched
|
|
7302
|
+
* @param {Object} options Additional options for fetching the moderation report
|
|
7303
|
+
* @param {boolean} options.create_user_if_not_exists Create user if not exists
|
|
7304
|
+
* @param {boolean} options.include_user_blocks Include user blocks
|
|
7305
|
+
* @param {boolean} options.include_user_mutes Include user mutes
|
|
7306
|
+
*/
|
|
7307
|
+
|
|
7308
|
+
}, {
|
|
7309
|
+
key: "getUserModerationReport",
|
|
7310
|
+
value: function () {
|
|
7311
|
+
var _getUserModerationReport = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee6(userID) {
|
|
7312
|
+
var options,
|
|
7313
|
+
_args6 = arguments;
|
|
7314
|
+
return _regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
7315
|
+
while (1) {
|
|
7316
|
+
switch (_context6.prev = _context6.next) {
|
|
7317
|
+
case 0:
|
|
7318
|
+
options = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : {};
|
|
7319
|
+
_context6.next = 3;
|
|
7320
|
+
return this.client.get(this.client.baseURL + "/api/v2/moderation/user_report", _objectSpread$1({
|
|
7321
|
+
user_id: userID
|
|
7322
|
+
}, options));
|
|
7323
|
+
|
|
7324
|
+
case 3:
|
|
7325
|
+
return _context6.abrupt("return", _context6.sent);
|
|
7326
|
+
|
|
7327
|
+
case 4:
|
|
7328
|
+
case "end":
|
|
7329
|
+
return _context6.stop();
|
|
7330
|
+
}
|
|
7331
|
+
}
|
|
7332
|
+
}, _callee6, this);
|
|
7333
|
+
}));
|
|
7334
|
+
|
|
7335
|
+
function getUserModerationReport(_x12) {
|
|
7336
|
+
return _getUserModerationReport.apply(this, arguments);
|
|
7337
|
+
}
|
|
7338
|
+
|
|
7339
|
+
return getUserModerationReport;
|
|
7340
|
+
}()
|
|
7341
|
+
/**
|
|
7342
|
+
* Query review queue
|
|
7343
|
+
* @param {Object} filterConditions Filter conditions for querying review queue
|
|
7344
|
+
* @param {Object} sort Sort conditions for querying review queue
|
|
7345
|
+
* @param {Object} options Pagination options for querying review queue
|
|
7346
|
+
*/
|
|
7347
|
+
|
|
7348
|
+
}, {
|
|
7349
|
+
key: "queryReviewQueue",
|
|
7350
|
+
value: function () {
|
|
7351
|
+
var _queryReviewQueue = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7() {
|
|
7352
|
+
var filterConditions,
|
|
7353
|
+
sort,
|
|
7354
|
+
options,
|
|
7355
|
+
_args7 = arguments;
|
|
7356
|
+
return _regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
7357
|
+
while (1) {
|
|
7358
|
+
switch (_context7.prev = _context7.next) {
|
|
7359
|
+
case 0:
|
|
7360
|
+
filterConditions = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : {};
|
|
7361
|
+
sort = _args7.length > 1 && _args7[1] !== undefined ? _args7[1] : [];
|
|
7362
|
+
options = _args7.length > 2 && _args7[2] !== undefined ? _args7[2] : {};
|
|
7363
|
+
_context7.next = 5;
|
|
7364
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/review_queue', _objectSpread$1({
|
|
7365
|
+
filter: filterConditions,
|
|
7366
|
+
sort: normalizeQuerySort(sort)
|
|
7367
|
+
}, options));
|
|
7368
|
+
|
|
7369
|
+
case 5:
|
|
7370
|
+
return _context7.abrupt("return", _context7.sent);
|
|
7371
|
+
|
|
7372
|
+
case 6:
|
|
7373
|
+
case "end":
|
|
7374
|
+
return _context7.stop();
|
|
7375
|
+
}
|
|
7376
|
+
}
|
|
7377
|
+
}, _callee7, this);
|
|
7378
|
+
}));
|
|
7379
|
+
|
|
7380
|
+
function queryReviewQueue() {
|
|
7381
|
+
return _queryReviewQueue.apply(this, arguments);
|
|
7382
|
+
}
|
|
7383
|
+
|
|
7384
|
+
return queryReviewQueue;
|
|
7385
|
+
}()
|
|
7386
|
+
/**
|
|
7387
|
+
* Upsert moderation config
|
|
7388
|
+
* @param {Object} config Moderation config to be upserted
|
|
7389
|
+
*/
|
|
7390
|
+
|
|
7391
|
+
}, {
|
|
7392
|
+
key: "upsertConfig",
|
|
7393
|
+
value: function () {
|
|
7394
|
+
var _upsertConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {
|
|
7395
|
+
var config,
|
|
7396
|
+
_args8 = arguments;
|
|
7397
|
+
return _regeneratorRuntime.wrap(function _callee8$(_context8) {
|
|
7398
|
+
while (1) {
|
|
7399
|
+
switch (_context8.prev = _context8.next) {
|
|
7400
|
+
case 0:
|
|
7401
|
+
config = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : {};
|
|
7402
|
+
_context8.next = 3;
|
|
7403
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/config', config);
|
|
7404
|
+
|
|
7405
|
+
case 3:
|
|
7406
|
+
return _context8.abrupt("return", _context8.sent);
|
|
7407
|
+
|
|
7408
|
+
case 4:
|
|
7409
|
+
case "end":
|
|
7410
|
+
return _context8.stop();
|
|
7411
|
+
}
|
|
7412
|
+
}
|
|
7413
|
+
}, _callee8, this);
|
|
7414
|
+
}));
|
|
7415
|
+
|
|
7416
|
+
function upsertConfig() {
|
|
7417
|
+
return _upsertConfig.apply(this, arguments);
|
|
7418
|
+
}
|
|
7419
|
+
|
|
7420
|
+
return upsertConfig;
|
|
7421
|
+
}()
|
|
7422
|
+
/**
|
|
7423
|
+
* Get moderation config
|
|
7424
|
+
* @param {string} key Key for which moderation config is to be fetched
|
|
7425
|
+
*/
|
|
7426
|
+
|
|
7427
|
+
}, {
|
|
7428
|
+
key: "getConfig",
|
|
7429
|
+
value: function () {
|
|
7430
|
+
var _getConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9(key) {
|
|
7431
|
+
return _regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
7432
|
+
while (1) {
|
|
7433
|
+
switch (_context9.prev = _context9.next) {
|
|
7434
|
+
case 0:
|
|
7435
|
+
_context9.next = 2;
|
|
7436
|
+
return this.client.get(this.client.baseURL + '/api/v2/moderation/config/' + key);
|
|
7437
|
+
|
|
7438
|
+
case 2:
|
|
7439
|
+
return _context9.abrupt("return", _context9.sent);
|
|
7440
|
+
|
|
7441
|
+
case 3:
|
|
7442
|
+
case "end":
|
|
7443
|
+
return _context9.stop();
|
|
7444
|
+
}
|
|
7445
|
+
}
|
|
7446
|
+
}, _callee9, this);
|
|
7447
|
+
}));
|
|
7448
|
+
|
|
7449
|
+
function getConfig(_x13) {
|
|
7450
|
+
return _getConfig.apply(this, arguments);
|
|
7451
|
+
}
|
|
7452
|
+
|
|
7453
|
+
return getConfig;
|
|
7454
|
+
}()
|
|
7455
|
+
}, {
|
|
7456
|
+
key: "submitAction",
|
|
7457
|
+
value: function () {
|
|
7458
|
+
var _submitAction = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(actionType, itemID) {
|
|
7459
|
+
var options,
|
|
7460
|
+
_args10 = arguments;
|
|
7461
|
+
return _regeneratorRuntime.wrap(function _callee10$(_context10) {
|
|
7462
|
+
while (1) {
|
|
7463
|
+
switch (_context10.prev = _context10.next) {
|
|
7464
|
+
case 0:
|
|
7465
|
+
options = _args10.length > 2 && _args10[2] !== undefined ? _args10[2] : {};
|
|
7466
|
+
_context10.next = 3;
|
|
7467
|
+
return this.client.post(this.client.baseURL + '/api/v2/moderation/submit_action', _objectSpread$1({
|
|
7468
|
+
action_type: actionType,
|
|
7469
|
+
item_id: itemID
|
|
7470
|
+
}, options));
|
|
7471
|
+
|
|
7472
|
+
case 3:
|
|
7473
|
+
return _context10.abrupt("return", _context10.sent);
|
|
7474
|
+
|
|
7475
|
+
case 4:
|
|
7476
|
+
case "end":
|
|
7477
|
+
return _context10.stop();
|
|
7478
|
+
}
|
|
7479
|
+
}
|
|
7480
|
+
}, _callee10, this);
|
|
7481
|
+
}));
|
|
7482
|
+
|
|
7483
|
+
function submitAction(_x14, _x15) {
|
|
7484
|
+
return _submitAction.apply(this, arguments);
|
|
7485
|
+
}
|
|
7486
|
+
|
|
7487
|
+
return submitAction;
|
|
7488
|
+
}()
|
|
7489
|
+
}]);
|
|
7490
|
+
|
|
7491
|
+
return Moderation;
|
|
7492
|
+
}();
|
|
7493
|
+
|
|
7076
7494
|
var _excluded = ["created_at", "updated_at", "last_active", "online"],
|
|
7077
7495
|
_excluded2 = ["params", "headers"];
|
|
7078
7496
|
|
|
@@ -7125,6 +7543,8 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7125
7543
|
|
|
7126
7544
|
_defineProperty(this, "recoverStateOnReconnect", void 0);
|
|
7127
7545
|
|
|
7546
|
+
_defineProperty(this, "moderation", void 0);
|
|
7547
|
+
|
|
7128
7548
|
_defineProperty(this, "mutedChannels", void 0);
|
|
7129
7549
|
|
|
7130
7550
|
_defineProperty(this, "mutedUsers", void 0);
|
|
@@ -7886,7 +8306,8 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7886
8306
|
this.state = new ClientState(); // a list of channels to hide ws events from
|
|
7887
8307
|
|
|
7888
8308
|
this.mutedChannels = [];
|
|
7889
|
-
this.mutedUsers = [];
|
|
8309
|
+
this.mutedUsers = [];
|
|
8310
|
+
this.moderation = new Moderation(this); // set the secret
|
|
7890
8311
|
|
|
7891
8312
|
if (secretOrOptions && isString(secretOrOptions)) {
|
|
7892
8313
|
this.secret = secretOrOptions;
|
|
@@ -7914,11 +8335,11 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
7914
8335
|
this.axiosInstance = axios.create(this.options);
|
|
7915
8336
|
this.setBaseURL(this.options.baseURL || 'https://chat.stream-io-api.com');
|
|
7916
8337
|
|
|
7917
|
-
if (typeof process !== 'undefined' && process.env.STREAM_LOCAL_TEST_RUN) {
|
|
8338
|
+
if (typeof process !== 'undefined' && 'env' in process && process.env.STREAM_LOCAL_TEST_RUN) {
|
|
7918
8339
|
this.setBaseURL('http://localhost:3030');
|
|
7919
8340
|
}
|
|
7920
8341
|
|
|
7921
|
-
if (typeof process !== 'undefined' && process.env.STREAM_LOCAL_TEST_HOST) {
|
|
8342
|
+
if (typeof process !== 'undefined' && 'env' in process && process.env.STREAM_LOCAL_TEST_HOST) {
|
|
7922
8343
|
this.setBaseURL('http://' + process.env.STREAM_LOCAL_TEST_HOST);
|
|
7923
8344
|
} // WS connection is initialized when setUser is called
|
|
7924
8345
|
|
|
@@ -11550,7 +11971,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
11550
11971
|
}, {
|
|
11551
11972
|
key: "getUserAgent",
|
|
11552
11973
|
value: function getUserAgent() {
|
|
11553
|
-
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.
|
|
11974
|
+
return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "8.38.0");
|
|
11554
11975
|
}
|
|
11555
11976
|
}, {
|
|
11556
11977
|
key: "setUserAgent",
|
|
@@ -12995,19 +13416,22 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
12995
13416
|
/**
|
|
12996
13417
|
* Creates a poll
|
|
12997
13418
|
* @param params PollData The poll that will be created
|
|
13419
|
+
* @param userId string The user id (only serverside)
|
|
12998
13420
|
* @returns {APIResponse & CreatePollAPIResponse} The poll
|
|
12999
13421
|
*/
|
|
13000
13422
|
|
|
13001
13423
|
}, {
|
|
13002
13424
|
key: "createPoll",
|
|
13003
13425
|
value: function () {
|
|
13004
|
-
var _createPoll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee98(poll) {
|
|
13426
|
+
var _createPoll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee98(poll, userId) {
|
|
13005
13427
|
return _regeneratorRuntime.wrap(function _callee98$(_context98) {
|
|
13006
13428
|
while (1) {
|
|
13007
13429
|
switch (_context98.prev = _context98.next) {
|
|
13008
13430
|
case 0:
|
|
13009
13431
|
_context98.next = 2;
|
|
13010
|
-
return this.post(this.baseURL + "/polls", poll)
|
|
13432
|
+
return this.post(this.baseURL + "/polls", _objectSpread(_objectSpread({}, poll), userId ? {
|
|
13433
|
+
user_id: userId
|
|
13434
|
+
} : {}));
|
|
13011
13435
|
|
|
13012
13436
|
case 2:
|
|
13013
13437
|
return _context98.abrupt("return", _context98.sent);
|
|
@@ -13020,7 +13444,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13020
13444
|
}, _callee98, this);
|
|
13021
13445
|
}));
|
|
13022
13446
|
|
|
13023
|
-
function createPoll(_x136) {
|
|
13447
|
+
function createPoll(_x136, _x137) {
|
|
13024
13448
|
return _createPoll.apply(this, arguments);
|
|
13025
13449
|
}
|
|
13026
13450
|
|
|
@@ -13029,6 +13453,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13029
13453
|
/**
|
|
13030
13454
|
* Retrieves a poll
|
|
13031
13455
|
* @param id string The poll id
|
|
13456
|
+
* @param userId string The user id (only serverside)
|
|
13032
13457
|
* @returns {APIResponse & GetPollAPIResponse} The poll
|
|
13033
13458
|
*/
|
|
13034
13459
|
|
|
@@ -13041,9 +13466,9 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13041
13466
|
switch (_context99.prev = _context99.next) {
|
|
13042
13467
|
case 0:
|
|
13043
13468
|
_context99.next = 2;
|
|
13044
|
-
return this.get(this.baseURL + "/polls/".concat(id),
|
|
13469
|
+
return this.get(this.baseURL + "/polls/".concat(id), userId ? {
|
|
13045
13470
|
user_id: userId
|
|
13046
|
-
} : {})
|
|
13471
|
+
} : {});
|
|
13047
13472
|
|
|
13048
13473
|
case 2:
|
|
13049
13474
|
return _context99.abrupt("return", _context99.sent);
|
|
@@ -13056,7 +13481,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13056
13481
|
}, _callee99, this);
|
|
13057
13482
|
}));
|
|
13058
13483
|
|
|
13059
|
-
function getPoll(
|
|
13484
|
+
function getPoll(_x138, _x139) {
|
|
13060
13485
|
return _getPoll.apply(this, arguments);
|
|
13061
13486
|
}
|
|
13062
13487
|
|
|
@@ -13065,19 +13490,22 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13065
13490
|
/**
|
|
13066
13491
|
* Updates a poll
|
|
13067
13492
|
* @param poll PollData The poll that will be updated
|
|
13493
|
+
* @param userId string The user id (only serverside)
|
|
13068
13494
|
* @returns {APIResponse & PollResponse} The poll
|
|
13069
13495
|
*/
|
|
13070
13496
|
|
|
13071
13497
|
}, {
|
|
13072
13498
|
key: "updatePoll",
|
|
13073
13499
|
value: function () {
|
|
13074
|
-
var _updatePoll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee100(poll) {
|
|
13500
|
+
var _updatePoll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee100(poll, userId) {
|
|
13075
13501
|
return _regeneratorRuntime.wrap(function _callee100$(_context100) {
|
|
13076
13502
|
while (1) {
|
|
13077
13503
|
switch (_context100.prev = _context100.next) {
|
|
13078
13504
|
case 0:
|
|
13079
13505
|
_context100.next = 2;
|
|
13080
|
-
return this.put(this.baseURL + "/polls", poll)
|
|
13506
|
+
return this.put(this.baseURL + "/polls", _objectSpread(_objectSpread({}, poll), userId ? {
|
|
13507
|
+
user_id: userId
|
|
13508
|
+
} : {}));
|
|
13081
13509
|
|
|
13082
13510
|
case 2:
|
|
13083
13511
|
return _context100.abrupt("return", _context100.sent);
|
|
@@ -13090,7 +13518,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13090
13518
|
}, _callee100, this);
|
|
13091
13519
|
}));
|
|
13092
13520
|
|
|
13093
|
-
function updatePoll(
|
|
13521
|
+
function updatePoll(_x140, _x141) {
|
|
13094
13522
|
return _updatePoll.apply(this, arguments);
|
|
13095
13523
|
}
|
|
13096
13524
|
|
|
@@ -13100,6 +13528,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13100
13528
|
* Partially updates a poll
|
|
13101
13529
|
* @param id string The poll id
|
|
13102
13530
|
* @param {PartialPollUpdate<StreamChatGenerics>} partialPollObject which should contain id and any of "set" or "unset" params;
|
|
13531
|
+
* @param userId string The user id (only serverside)
|
|
13103
13532
|
* example: {id: "44f26af5-f2be-4fa7-9dac-71cf893781de", set:{field: value}, unset:["field2"]}
|
|
13104
13533
|
* @returns {APIResponse & UpdatePollAPIResponse} The poll
|
|
13105
13534
|
*/
|
|
@@ -13107,13 +13536,15 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13107
13536
|
}, {
|
|
13108
13537
|
key: "partialUpdatePoll",
|
|
13109
13538
|
value: function () {
|
|
13110
|
-
var _partialUpdatePoll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee101(id, partialPollObject) {
|
|
13539
|
+
var _partialUpdatePoll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee101(id, partialPollObject, userId) {
|
|
13111
13540
|
return _regeneratorRuntime.wrap(function _callee101$(_context101) {
|
|
13112
13541
|
while (1) {
|
|
13113
13542
|
switch (_context101.prev = _context101.next) {
|
|
13114
13543
|
case 0:
|
|
13115
13544
|
_context101.next = 2;
|
|
13116
|
-
return this.patch(this.baseURL + "/polls/".concat(id), partialPollObject)
|
|
13545
|
+
return this.patch(this.baseURL + "/polls/".concat(id), _objectSpread(_objectSpread({}, partialPollObject), userId ? {
|
|
13546
|
+
user_id: userId
|
|
13547
|
+
} : {}));
|
|
13117
13548
|
|
|
13118
13549
|
case 2:
|
|
13119
13550
|
return _context101.abrupt("return", _context101.sent);
|
|
@@ -13126,7 +13557,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13126
13557
|
}, _callee101, this);
|
|
13127
13558
|
}));
|
|
13128
13559
|
|
|
13129
|
-
function partialUpdatePoll(
|
|
13560
|
+
function partialUpdatePoll(_x142, _x143, _x144) {
|
|
13130
13561
|
return _partialUpdatePoll.apply(this, arguments);
|
|
13131
13562
|
}
|
|
13132
13563
|
|
|
@@ -13163,7 +13594,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13163
13594
|
}, _callee102, this);
|
|
13164
13595
|
}));
|
|
13165
13596
|
|
|
13166
|
-
function deletePoll(
|
|
13597
|
+
function deletePoll(_x145, _x146) {
|
|
13167
13598
|
return _deletePoll.apply(this, arguments);
|
|
13168
13599
|
}
|
|
13169
13600
|
|
|
@@ -13172,22 +13603,25 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13172
13603
|
/**
|
|
13173
13604
|
* Close a poll
|
|
13174
13605
|
* @param id string The poll id
|
|
13606
|
+
* @param userId string The user id (only serverside)
|
|
13175
13607
|
* @returns {APIResponse & UpdatePollAPIResponse} The poll
|
|
13176
13608
|
*/
|
|
13177
13609
|
|
|
13178
13610
|
}, {
|
|
13179
13611
|
key: "closePoll",
|
|
13180
13612
|
value: function () {
|
|
13181
|
-
var _closePoll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee103(id) {
|
|
13613
|
+
var _closePoll = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee103(id, userId) {
|
|
13182
13614
|
return _regeneratorRuntime.wrap(function _callee103$(_context103) {
|
|
13183
13615
|
while (1) {
|
|
13184
13616
|
switch (_context103.prev = _context103.next) {
|
|
13185
13617
|
case 0:
|
|
13186
|
-
return _context103.abrupt("return", this.partialUpdatePoll(id, {
|
|
13618
|
+
return _context103.abrupt("return", this.partialUpdatePoll(id, _objectSpread({
|
|
13187
13619
|
set: {
|
|
13188
13620
|
is_closed: true
|
|
13189
13621
|
}
|
|
13190
|
-
}
|
|
13622
|
+
}, userId ? {
|
|
13623
|
+
user_id: userId
|
|
13624
|
+
} : {})));
|
|
13191
13625
|
|
|
13192
13626
|
case 1:
|
|
13193
13627
|
case "end":
|
|
@@ -13197,7 +13631,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13197
13631
|
}, _callee103, this);
|
|
13198
13632
|
}));
|
|
13199
13633
|
|
|
13200
|
-
function closePoll(
|
|
13634
|
+
function closePoll(_x147, _x148) {
|
|
13201
13635
|
return _closePoll.apply(this, arguments);
|
|
13202
13636
|
}
|
|
13203
13637
|
|
|
@@ -13207,19 +13641,22 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13207
13641
|
* Creates a poll option
|
|
13208
13642
|
* @param pollId string The poll id
|
|
13209
13643
|
* @param option PollOptionData The poll option that will be created
|
|
13644
|
+
* @param userId string The user id (only serverside)
|
|
13210
13645
|
* @returns {APIResponse & PollOptionResponse} The poll option
|
|
13211
13646
|
*/
|
|
13212
13647
|
|
|
13213
13648
|
}, {
|
|
13214
13649
|
key: "createPollOption",
|
|
13215
13650
|
value: function () {
|
|
13216
|
-
var _createPollOption = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee104(pollId, option) {
|
|
13651
|
+
var _createPollOption = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee104(pollId, option, userId) {
|
|
13217
13652
|
return _regeneratorRuntime.wrap(function _callee104$(_context104) {
|
|
13218
13653
|
while (1) {
|
|
13219
13654
|
switch (_context104.prev = _context104.next) {
|
|
13220
13655
|
case 0:
|
|
13221
13656
|
_context104.next = 2;
|
|
13222
|
-
return this.post(this.baseURL + "/polls/".concat(pollId, "/options"), option)
|
|
13657
|
+
return this.post(this.baseURL + "/polls/".concat(pollId, "/options"), _objectSpread(_objectSpread({}, option), userId ? {
|
|
13658
|
+
user_id: userId
|
|
13659
|
+
} : {}));
|
|
13223
13660
|
|
|
13224
13661
|
case 2:
|
|
13225
13662
|
return _context104.abrupt("return", _context104.sent);
|
|
@@ -13232,7 +13669,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13232
13669
|
}, _callee104, this);
|
|
13233
13670
|
}));
|
|
13234
13671
|
|
|
13235
|
-
function createPollOption(
|
|
13672
|
+
function createPollOption(_x149, _x150, _x151) {
|
|
13236
13673
|
return _createPollOption.apply(this, arguments);
|
|
13237
13674
|
}
|
|
13238
13675
|
|
|
@@ -13242,19 +13679,22 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13242
13679
|
* Retrieves a poll option
|
|
13243
13680
|
* @param pollId string The poll id
|
|
13244
13681
|
* @param optionId string The poll option id
|
|
13682
|
+
* @param userId string The user id (only serverside)
|
|
13245
13683
|
* @returns {APIResponse & PollOptionResponse} The poll option
|
|
13246
13684
|
*/
|
|
13247
13685
|
|
|
13248
13686
|
}, {
|
|
13249
13687
|
key: "getPollOption",
|
|
13250
13688
|
value: function () {
|
|
13251
|
-
var _getPollOption = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee105(pollId, optionId) {
|
|
13689
|
+
var _getPollOption = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee105(pollId, optionId, userId) {
|
|
13252
13690
|
return _regeneratorRuntime.wrap(function _callee105$(_context105) {
|
|
13253
13691
|
while (1) {
|
|
13254
13692
|
switch (_context105.prev = _context105.next) {
|
|
13255
13693
|
case 0:
|
|
13256
13694
|
_context105.next = 2;
|
|
13257
|
-
return this.get(this.baseURL + "/polls/".concat(pollId, "/options/").concat(optionId)
|
|
13695
|
+
return this.get(this.baseURL + "/polls/".concat(pollId, "/options/").concat(optionId), userId ? {
|
|
13696
|
+
user_id: userId
|
|
13697
|
+
} : {});
|
|
13258
13698
|
|
|
13259
13699
|
case 2:
|
|
13260
13700
|
return _context105.abrupt("return", _context105.sent);
|
|
@@ -13267,7 +13707,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13267
13707
|
}, _callee105, this);
|
|
13268
13708
|
}));
|
|
13269
13709
|
|
|
13270
|
-
function getPollOption(
|
|
13710
|
+
function getPollOption(_x152, _x153, _x154) {
|
|
13271
13711
|
return _getPollOption.apply(this, arguments);
|
|
13272
13712
|
}
|
|
13273
13713
|
|
|
@@ -13277,19 +13717,22 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13277
13717
|
* Updates a poll option
|
|
13278
13718
|
* @param pollId string The poll id
|
|
13279
13719
|
* @param option PollOptionData The poll option that will be updated
|
|
13720
|
+
* @param userId string The user id (only serverside)
|
|
13280
13721
|
* @returns
|
|
13281
13722
|
*/
|
|
13282
13723
|
|
|
13283
13724
|
}, {
|
|
13284
13725
|
key: "updatePollOption",
|
|
13285
13726
|
value: function () {
|
|
13286
|
-
var _updatePollOption = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee106(pollId, option) {
|
|
13727
|
+
var _updatePollOption = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee106(pollId, option, userId) {
|
|
13287
13728
|
return _regeneratorRuntime.wrap(function _callee106$(_context106) {
|
|
13288
13729
|
while (1) {
|
|
13289
13730
|
switch (_context106.prev = _context106.next) {
|
|
13290
13731
|
case 0:
|
|
13291
13732
|
_context106.next = 2;
|
|
13292
|
-
return this.put(this.baseURL + "/polls/".concat(pollId, "/options"), option)
|
|
13733
|
+
return this.put(this.baseURL + "/polls/".concat(pollId, "/options"), _objectSpread(_objectSpread({}, option), userId ? {
|
|
13734
|
+
user_id: userId
|
|
13735
|
+
} : {}));
|
|
13293
13736
|
|
|
13294
13737
|
case 2:
|
|
13295
13738
|
return _context106.abrupt("return", _context106.sent);
|
|
@@ -13302,7 +13745,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13302
13745
|
}, _callee106, this);
|
|
13303
13746
|
}));
|
|
13304
13747
|
|
|
13305
|
-
function updatePollOption(
|
|
13748
|
+
function updatePollOption(_x155, _x156, _x157) {
|
|
13306
13749
|
return _updatePollOption.apply(this, arguments);
|
|
13307
13750
|
}
|
|
13308
13751
|
|
|
@@ -13312,19 +13755,22 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13312
13755
|
* Delete a poll option
|
|
13313
13756
|
* @param pollId string The poll id
|
|
13314
13757
|
* @param optionId string The poll option id
|
|
13758
|
+
* @param userId string The user id (only serverside)
|
|
13315
13759
|
* @returns {APIResponse} The poll option
|
|
13316
13760
|
*/
|
|
13317
13761
|
|
|
13318
13762
|
}, {
|
|
13319
13763
|
key: "deletePollOption",
|
|
13320
13764
|
value: function () {
|
|
13321
|
-
var _deletePollOption = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee107(pollId, optionId) {
|
|
13765
|
+
var _deletePollOption = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee107(pollId, optionId, userId) {
|
|
13322
13766
|
return _regeneratorRuntime.wrap(function _callee107$(_context107) {
|
|
13323
13767
|
while (1) {
|
|
13324
13768
|
switch (_context107.prev = _context107.next) {
|
|
13325
13769
|
case 0:
|
|
13326
13770
|
_context107.next = 2;
|
|
13327
|
-
return this.delete(this.baseURL + "/polls/".concat(pollId, "/options/").concat(optionId)
|
|
13771
|
+
return this.delete(this.baseURL + "/polls/".concat(pollId, "/options/").concat(optionId), userId ? {
|
|
13772
|
+
user_id: userId
|
|
13773
|
+
} : {});
|
|
13328
13774
|
|
|
13329
13775
|
case 2:
|
|
13330
13776
|
return _context107.abrupt("return", _context107.sent);
|
|
@@ -13337,7 +13783,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13337
13783
|
}, _callee107, this);
|
|
13338
13784
|
}));
|
|
13339
13785
|
|
|
13340
|
-
function deletePollOption(
|
|
13786
|
+
function deletePollOption(_x158, _x159, _x160) {
|
|
13341
13787
|
return _deletePollOption.apply(this, arguments);
|
|
13342
13788
|
}
|
|
13343
13789
|
|
|
@@ -13348,29 +13794,29 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13348
13794
|
* @param messageId string The message id
|
|
13349
13795
|
* @param pollId string The poll id
|
|
13350
13796
|
* @param vote PollVoteData The vote that will be casted
|
|
13797
|
+
* @param userId string The user id (only serverside)
|
|
13351
13798
|
* @returns {APIResponse & CastVoteAPIResponse} The poll vote
|
|
13352
13799
|
*/
|
|
13353
13800
|
|
|
13354
13801
|
}, {
|
|
13355
13802
|
key: "castPollVote",
|
|
13356
13803
|
value: function () {
|
|
13357
|
-
var _castPollVote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee108(messageId, pollId, vote) {
|
|
13358
|
-
var options,
|
|
13359
|
-
_args108 = arguments;
|
|
13804
|
+
var _castPollVote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee108(messageId, pollId, vote, userId) {
|
|
13360
13805
|
return _regeneratorRuntime.wrap(function _callee108$(_context108) {
|
|
13361
13806
|
while (1) {
|
|
13362
13807
|
switch (_context108.prev = _context108.next) {
|
|
13363
13808
|
case 0:
|
|
13364
|
-
|
|
13365
|
-
_context108.next = 3;
|
|
13809
|
+
_context108.next = 2;
|
|
13366
13810
|
return this.post(this.baseURL + "/messages/".concat(messageId, "/polls/").concat(pollId, "/vote"), _objectSpread({
|
|
13367
13811
|
vote: vote
|
|
13368
|
-
},
|
|
13812
|
+
}, userId ? {
|
|
13813
|
+
user_id: userId
|
|
13814
|
+
} : {}));
|
|
13369
13815
|
|
|
13370
|
-
case
|
|
13816
|
+
case 2:
|
|
13371
13817
|
return _context108.abrupt("return", _context108.sent);
|
|
13372
13818
|
|
|
13373
|
-
case
|
|
13819
|
+
case 3:
|
|
13374
13820
|
case "end":
|
|
13375
13821
|
return _context108.stop();
|
|
13376
13822
|
}
|
|
@@ -13378,7 +13824,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13378
13824
|
}, _callee108, this);
|
|
13379
13825
|
}));
|
|
13380
13826
|
|
|
13381
|
-
function castPollVote(
|
|
13827
|
+
function castPollVote(_x161, _x162, _x163, _x164) {
|
|
13382
13828
|
return _castPollVote.apply(this, arguments);
|
|
13383
13829
|
}
|
|
13384
13830
|
|
|
@@ -13389,19 +13835,20 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13389
13835
|
* @param messageId string The message id
|
|
13390
13836
|
* @param pollId string The poll id
|
|
13391
13837
|
* @param answerText string The answer text
|
|
13838
|
+
* @param userId string The user id (only serverside)
|
|
13392
13839
|
*/
|
|
13393
13840
|
|
|
13394
13841
|
}, {
|
|
13395
13842
|
key: "addPollAnswer",
|
|
13396
13843
|
value: function () {
|
|
13397
|
-
var _addPollAnswer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee109(messageId, pollId, answerText) {
|
|
13844
|
+
var _addPollAnswer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee109(messageId, pollId, answerText, userId) {
|
|
13398
13845
|
return _regeneratorRuntime.wrap(function _callee109$(_context109) {
|
|
13399
13846
|
while (1) {
|
|
13400
13847
|
switch (_context109.prev = _context109.next) {
|
|
13401
13848
|
case 0:
|
|
13402
13849
|
return _context109.abrupt("return", this.castPollVote(messageId, pollId, {
|
|
13403
13850
|
answer_text: answerText
|
|
13404
|
-
}));
|
|
13851
|
+
}, userId));
|
|
13405
13852
|
|
|
13406
13853
|
case 1:
|
|
13407
13854
|
case "end":
|
|
@@ -13411,7 +13858,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13411
13858
|
}, _callee109, this);
|
|
13412
13859
|
}));
|
|
13413
13860
|
|
|
13414
|
-
function addPollAnswer(
|
|
13861
|
+
function addPollAnswer(_x165, _x166, _x167, _x168) {
|
|
13415
13862
|
return _addPollAnswer.apply(this, arguments);
|
|
13416
13863
|
}
|
|
13417
13864
|
|
|
@@ -13420,13 +13867,15 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13420
13867
|
}, {
|
|
13421
13868
|
key: "removePollVote",
|
|
13422
13869
|
value: function () {
|
|
13423
|
-
var _removePollVote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee110(messageId, pollId, voteId) {
|
|
13870
|
+
var _removePollVote = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee110(messageId, pollId, voteId, userId) {
|
|
13424
13871
|
return _regeneratorRuntime.wrap(function _callee110$(_context110) {
|
|
13425
13872
|
while (1) {
|
|
13426
13873
|
switch (_context110.prev = _context110.next) {
|
|
13427
13874
|
case 0:
|
|
13428
13875
|
_context110.next = 2;
|
|
13429
|
-
return this.delete(this.baseURL + "/messages/".concat(messageId, "/polls/").concat(pollId, "/vote/").concat(voteId)
|
|
13876
|
+
return this.delete(this.baseURL + "/messages/".concat(messageId, "/polls/").concat(pollId, "/vote/").concat(voteId), _objectSpread({}, userId ? {
|
|
13877
|
+
user_id: userId
|
|
13878
|
+
} : {}));
|
|
13430
13879
|
|
|
13431
13880
|
case 2:
|
|
13432
13881
|
return _context110.abrupt("return", _context110.sent);
|
|
@@ -13439,7 +13888,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13439
13888
|
}, _callee110, this);
|
|
13440
13889
|
}));
|
|
13441
13890
|
|
|
13442
|
-
function removePollVote(
|
|
13891
|
+
function removePollVote(_x169, _x170, _x171, _x172) {
|
|
13443
13892
|
return _removePollVote.apply(this, arguments);
|
|
13444
13893
|
}
|
|
13445
13894
|
|
|
@@ -13450,6 +13899,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13450
13899
|
* @param filter
|
|
13451
13900
|
* @param sort
|
|
13452
13901
|
* @param options Option object, {limit: 10, offset:0}
|
|
13902
|
+
* @param userId string The user id (only serverside)
|
|
13453
13903
|
* @returns {APIResponse & QueryPollsResponse} The polls
|
|
13454
13904
|
*/
|
|
13455
13905
|
|
|
@@ -13460,6 +13910,8 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13460
13910
|
var filter,
|
|
13461
13911
|
sort,
|
|
13462
13912
|
options,
|
|
13913
|
+
userId,
|
|
13914
|
+
q,
|
|
13463
13915
|
_args111 = arguments;
|
|
13464
13916
|
return _regeneratorRuntime.wrap(function _callee111$(_context111) {
|
|
13465
13917
|
while (1) {
|
|
@@ -13468,16 +13920,18 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13468
13920
|
filter = _args111.length > 0 && _args111[0] !== undefined ? _args111[0] : {};
|
|
13469
13921
|
sort = _args111.length > 1 && _args111[1] !== undefined ? _args111[1] : [];
|
|
13470
13922
|
options = _args111.length > 2 && _args111[2] !== undefined ? _args111[2] : {};
|
|
13471
|
-
|
|
13472
|
-
|
|
13923
|
+
userId = _args111.length > 3 ? _args111[3] : undefined;
|
|
13924
|
+
q = userId ? "?user_id=".concat(userId) : '';
|
|
13925
|
+
_context111.next = 7;
|
|
13926
|
+
return this.post(this.baseURL + "/polls/query".concat(q), _objectSpread({
|
|
13473
13927
|
filter: filter,
|
|
13474
13928
|
sort: normalizeQuerySort(sort)
|
|
13475
13929
|
}, options));
|
|
13476
13930
|
|
|
13477
|
-
case
|
|
13931
|
+
case 7:
|
|
13478
13932
|
return _context111.abrupt("return", _context111.sent);
|
|
13479
13933
|
|
|
13480
|
-
case
|
|
13934
|
+
case 8:
|
|
13481
13935
|
case "end":
|
|
13482
13936
|
return _context111.stop();
|
|
13483
13937
|
}
|
|
@@ -13497,7 +13951,8 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13497
13951
|
* @param filter
|
|
13498
13952
|
* @param sort
|
|
13499
13953
|
* @param options Option object, {limit: 10, offset:0}
|
|
13500
|
-
|
|
13954
|
+
* @param userId string The user id (only serverside)
|
|
13955
|
+
* @returns {APIResponse & PollVotesAPIResponse} The poll votes
|
|
13501
13956
|
*/
|
|
13502
13957
|
|
|
13503
13958
|
}, {
|
|
@@ -13507,6 +13962,8 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13507
13962
|
var filter,
|
|
13508
13963
|
sort,
|
|
13509
13964
|
options,
|
|
13965
|
+
userId,
|
|
13966
|
+
q,
|
|
13510
13967
|
_args112 = arguments;
|
|
13511
13968
|
return _regeneratorRuntime.wrap(function _callee112$(_context112) {
|
|
13512
13969
|
while (1) {
|
|
@@ -13515,16 +13972,18 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13515
13972
|
filter = _args112.length > 1 && _args112[1] !== undefined ? _args112[1] : {};
|
|
13516
13973
|
sort = _args112.length > 2 && _args112[2] !== undefined ? _args112[2] : [];
|
|
13517
13974
|
options = _args112.length > 3 && _args112[3] !== undefined ? _args112[3] : {};
|
|
13518
|
-
|
|
13519
|
-
|
|
13975
|
+
userId = _args112.length > 4 ? _args112[4] : undefined;
|
|
13976
|
+
q = userId ? "?user_id=".concat(userId) : '';
|
|
13977
|
+
_context112.next = 7;
|
|
13978
|
+
return this.post(this.baseURL + "/polls/".concat(pollId, "/votes").concat(q), _objectSpread({
|
|
13520
13979
|
filter: filter,
|
|
13521
13980
|
sort: normalizeQuerySort(sort)
|
|
13522
13981
|
}, options));
|
|
13523
13982
|
|
|
13524
|
-
case
|
|
13983
|
+
case 7:
|
|
13525
13984
|
return _context112.abrupt("return", _context112.sent);
|
|
13526
13985
|
|
|
13527
|
-
case
|
|
13986
|
+
case 8:
|
|
13528
13987
|
case "end":
|
|
13529
13988
|
return _context112.stop();
|
|
13530
13989
|
}
|
|
@@ -13532,14 +13991,14 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13532
13991
|
}, _callee112, this);
|
|
13533
13992
|
}));
|
|
13534
13993
|
|
|
13535
|
-
function queryPollVotes(
|
|
13994
|
+
function queryPollVotes(_x173) {
|
|
13536
13995
|
return _queryPollVotes.apply(this, arguments);
|
|
13537
13996
|
}
|
|
13538
13997
|
|
|
13539
13998
|
return queryPollVotes;
|
|
13540
13999
|
}()
|
|
13541
14000
|
/**
|
|
13542
|
-
*
|
|
14001
|
+
* Query message history
|
|
13543
14002
|
* @param filter
|
|
13544
14003
|
* @param sort
|
|
13545
14004
|
* @param options Option object, {limit: 10}
|
|
@@ -13621,7 +14080,7 @@ var StreamChat = /*#__PURE__*/function () {
|
|
|
13621
14080
|
}, _callee114, this);
|
|
13622
14081
|
}));
|
|
13623
14082
|
|
|
13624
|
-
function updateFlags(
|
|
14083
|
+
function updateFlags(_x174, _x175) {
|
|
13625
14084
|
return _updateFlags.apply(this, arguments);
|
|
13626
14085
|
}
|
|
13627
14086
|
|
|
@@ -13779,5 +14238,5 @@ var BuiltinPermissions = {
|
|
|
13779
14238
|
UseFrozenChannel: 'Send messages and reactions to frozen channels'
|
|
13780
14239
|
};
|
|
13781
14240
|
|
|
13782
|
-
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 };
|
|
14241
|
+
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 };
|
|
13783
14242
|
//# sourceMappingURL=index.es.js.map
|