stream-chat 7.0.0-offline-support.3 → 7.1.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.
@@ -93,9 +93,9 @@ var decodeBase64 = function decodeBase64(s) {
93
93
 
94
94
  var https = null;
95
95
 
96
- 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; }
96
+ 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; }
97
97
 
98
- 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; }
98
+ 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; }
99
99
 
100
100
  /**
101
101
  * ChannelState - A container class for the channel state.
@@ -130,6 +130,8 @@ var ChannelState = /*#__PURE__*/function () {
130
130
 
131
131
  _defineProperty(this, "pinnedMessages", void 0);
132
132
 
133
+ _defineProperty(this, "pending_messages", void 0);
134
+
133
135
  _defineProperty(this, "threads", void 0);
134
136
 
135
137
  _defineProperty(this, "mutedUsers", void 0);
@@ -170,7 +172,7 @@ var ChannelState = /*#__PURE__*/function () {
170
172
  var m = messages[i];
171
173
 
172
174
  if (((_m$user = m.user) === null || _m$user === void 0 ? void 0 : _m$user.id) === user.id) {
173
- messages[i] = _objectSpread$7(_objectSpread$7({}, m), {}, {
175
+ messages[i] = _objectSpread$6(_objectSpread$6({}, m), {}, {
174
176
  user: user
175
177
  });
176
178
  }
@@ -225,7 +227,7 @@ var ChannelState = /*#__PURE__*/function () {
225
227
  user: m.user
226
228
  };
227
229
  } else {
228
- messages[i] = _objectSpread$7(_objectSpread$7({}, m), {}, {
230
+ messages[i] = _objectSpread$6(_objectSpread$6({}, m), {}, {
229
231
  type: 'deleted',
230
232
  deleted_at: user.deleted_at
231
233
  });
@@ -250,6 +252,7 @@ var ChannelState = /*#__PURE__*/function () {
250
252
  this.read = {};
251
253
  this.initMessages();
252
254
  this.pinnedMessages = [];
255
+ this.pending_messages = [];
253
256
  this.threads = {}; // a list of users to hide messages from
254
257
 
255
258
  this.mutedUsers = [];
@@ -331,7 +334,7 @@ var ChannelState = /*#__PURE__*/function () {
331
334
  }, {
332
335
  key: "formatMessage",
333
336
  value: function formatMessage(message) {
334
- return _objectSpread$7(_objectSpread$7({}, message), {}, {
337
+ return _objectSpread$6(_objectSpread$6({}, message), {}, {
335
338
  /**
336
339
  * @deprecated please use `html`
337
340
  */
@@ -549,7 +552,7 @@ var ChannelState = /*#__PURE__*/function () {
549
552
  var parseMessage = function parseMessage(m) {
550
553
  var _m$pinned_at, _m$updated_at;
551
554
 
552
- return _objectSpread$7(_objectSpread$7({}, m), {}, {
555
+ return _objectSpread$6(_objectSpread$6({}, m), {}, {
553
556
  created_at: m.created_at.toString(),
554
557
  pinned_at: (_m$pinned_at = m.pinned_at) === null || _m$pinned_at === void 0 ? void 0 : _m$pinned_at.toString(),
555
558
  updated_at: (_m$updated_at = m.updated_at) === null || _m$updated_at === void 0 ? void 0 : _m$updated_at.toString()
@@ -560,8 +563,8 @@ var ChannelState = /*#__PURE__*/function () {
560
563
  var updatedMessages = set.messages.filter(function (msg) {
561
564
  return msg.quoted_message_id === message.id;
562
565
  }).map(parseMessage).map(function (msg) {
563
- return _objectSpread$7(_objectSpread$7({}, msg), {}, {
564
- quoted_message: _objectSpread$7(_objectSpread$7({}, message), {}, {
566
+ return _objectSpread$6(_objectSpread$6({}, msg), {}, {
567
+ quoted_message: _objectSpread$6(_objectSpread$6({}, message), {}, {
565
568
  attachments: []
566
569
  })
567
570
  });
@@ -810,40 +813,46 @@ var ChannelState = /*#__PURE__*/function () {
810
813
  var _loadMessageIntoState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(messageId, parentMessageId) {
811
814
  var _this$threads$parentM;
812
815
 
813
- var messageSetIndex, switchedToMessageSet, loadedMessageThread, messageIdToFind;
816
+ var limit,
817
+ messageSetIndex,
818
+ switchedToMessageSet,
819
+ loadedMessageThread,
820
+ messageIdToFind,
821
+ _args = arguments;
814
822
  return _regeneratorRuntime.wrap(function _callee$(_context) {
815
823
  while (1) {
816
824
  switch (_context.prev = _context.next) {
817
825
  case 0:
826
+ limit = _args.length > 2 && _args[2] !== undefined ? _args[2] : 25;
818
827
  switchedToMessageSet = false;
819
828
  loadedMessageThread = false;
820
829
  messageIdToFind = parentMessageId || messageId;
821
830
 
822
831
  if (!(messageId === 'latest')) {
823
- _context.next = 9;
832
+ _context.next = 10;
824
833
  break;
825
834
  }
826
835
 
827
836
  if (!(this.messages === this.latestMessages)) {
828
- _context.next = 6;
837
+ _context.next = 7;
829
838
  break;
830
839
  }
831
840
 
832
841
  return _context.abrupt("return");
833
842
 
834
- case 6:
843
+ case 7:
835
844
  messageSetIndex = this.messageSets.findIndex(function (s) {
836
845
  return s.isLatest;
837
846
  });
838
- _context.next = 10;
847
+ _context.next = 11;
839
848
  break;
840
849
 
841
- case 9:
850
+ case 10:
842
851
  messageSetIndex = this.findMessageSetIndex({
843
852
  id: messageIdToFind
844
853
  });
845
854
 
846
- case 10:
855
+ case 11:
847
856
  if (messageSetIndex !== -1) {
848
857
  this.switchToMessageSet(messageSetIndex);
849
858
  switchedToMessageSet = true;
@@ -854,39 +863,39 @@ var ChannelState = /*#__PURE__*/function () {
854
863
  }));
855
864
 
856
865
  if (!(switchedToMessageSet && loadedMessageThread)) {
857
- _context.next = 14;
866
+ _context.next = 15;
858
867
  break;
859
868
  }
860
869
 
861
870
  return _context.abrupt("return");
862
871
 
863
- case 14:
872
+ case 15:
864
873
  if (switchedToMessageSet) {
865
- _context.next = 17;
874
+ _context.next = 18;
866
875
  break;
867
876
  }
868
877
 
869
- _context.next = 17;
878
+ _context.next = 18;
870
879
  return this._channel.query({
871
880
  messages: {
872
881
  id_around: messageIdToFind,
873
- limit: 25
882
+ limit: limit
874
883
  }
875
884
  }, 'new');
876
885
 
877
- case 17:
886
+ case 18:
878
887
  if (!(!loadedMessageThread && parentMessageId)) {
879
- _context.next = 20;
888
+ _context.next = 21;
880
889
  break;
881
890
  }
882
891
 
883
- _context.next = 20;
892
+ _context.next = 21;
884
893
  return this._channel.getReplies(parentMessageId, {
885
894
  id_around: messageId,
886
- limit: 25
895
+ limit: limit
887
896
  });
888
897
 
889
- case 20:
898
+ case 21:
890
899
  messageSetIndex = this.findMessageSetIndex({
891
900
  id: messageIdToFind
892
901
  });
@@ -895,7 +904,7 @@ var ChannelState = /*#__PURE__*/function () {
895
904
  this.switchToMessageSet(messageSetIndex);
896
905
  }
897
906
 
898
- case 22:
907
+ case 23:
899
908
  case "end":
900
909
  return _context.stop();
901
910
  }
@@ -1070,67 +1079,6 @@ var ChannelState = /*#__PURE__*/function () {
1070
1079
  return ChannelState;
1071
1080
  }();
1072
1081
 
1073
- 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; }
1074
-
1075
- 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; }
1076
-
1077
- var EVENT_MAP = {
1078
- 'channel.created': true,
1079
- 'channel.deleted': true,
1080
- 'channel.hidden': true,
1081
- 'channel.kicked': true,
1082
- 'channel.muted': true,
1083
- 'channel.truncated': true,
1084
- 'channel.unmuted': true,
1085
- 'channel.updated': true,
1086
- 'channel.visible': true,
1087
- 'health.check': true,
1088
- 'member.added': true,
1089
- 'member.removed': true,
1090
- 'member.updated': true,
1091
- 'message.deleted': true,
1092
- 'message.new': true,
1093
- 'message.read': true,
1094
- 'message.updated': true,
1095
- 'notification.added_to_channel': true,
1096
- 'notification.channel_deleted': true,
1097
- 'notification.channel_mutes_updated': true,
1098
- 'notification.channel_truncated': true,
1099
- 'notification.invite_accepted': true,
1100
- 'notification.invite_rejected': true,
1101
- 'notification.invited': true,
1102
- 'notification.mark_read': true,
1103
- 'notification.message_new': true,
1104
- 'notification.mutes_updated': true,
1105
- 'notification.removed_from_channel': true,
1106
- 'reaction.deleted': true,
1107
- 'reaction.new': true,
1108
- 'reaction.updated': true,
1109
- 'typing.start': true,
1110
- 'typing.stop': true,
1111
- 'user.banned': true,
1112
- 'user.deleted': true,
1113
- 'user.presence.changed': true,
1114
- 'user.unbanned': true,
1115
- 'user.unread_message_reminder': true,
1116
- 'user.updated': true,
1117
- 'user.watching.start': true,
1118
- 'user.watching.stop': true,
1119
- // local events
1120
- 'channels.queried': true,
1121
- 'connection.changed': true,
1122
- 'connection.recovered': true,
1123
- 'transport.changed': true
1124
- };
1125
-
1126
- var IS_VALID_EVENT_MAP_TYPE = _objectSpread$6(_objectSpread$6({}, EVENT_MAP), {}, {
1127
- all: true
1128
- });
1129
-
1130
- var isValidEventType = function isValidEventType(eventType) {
1131
- return IS_VALID_EVENT_MAP_TYPE[eventType] || false;
1132
- };
1133
-
1134
1082
  function _createForOfIteratorHelper$3(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray$3(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; } } }; }
1135
1083
 
1136
1084
  function _unsupportedIterableToArray$3(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray$3(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray$3(o, minLen); }
@@ -1426,7 +1374,7 @@ var Channel = /*#__PURE__*/function () {
1426
1374
 
1427
1375
  _defineProperty(this, "initialized", void 0);
1428
1376
 
1429
- _defineProperty(this, "staticState", void 0);
1377
+ _defineProperty(this, "offlineMode", void 0);
1430
1378
 
1431
1379
  _defineProperty(this, "lastKeyStroke", void 0);
1432
1380
 
@@ -1515,7 +1463,7 @@ var Channel = /*#__PURE__*/function () {
1515
1463
 
1516
1464
  this.state = new ChannelState(this);
1517
1465
  this.initialized = false;
1518
- this.staticState = false;
1466
+ this.offlineMode = false;
1519
1467
  this.lastTypingEvent = null;
1520
1468
  this.isTyping = false;
1521
1469
  this.disconnected = false;
@@ -1554,6 +1502,8 @@ var Channel = /*#__PURE__*/function () {
1554
1502
  * @param {Message<StreamChatGenerics>} message The Message object
1555
1503
  * @param {boolean} [options.skip_enrich_url] Do not try to enrich the URLs within message
1556
1504
  * @param {boolean} [options.skip_push] Skip sending push notifications
1505
+ * @param {boolean} [options.is_pending_message] Make this message pending
1506
+ * @param {Record<string,string>} [options.pending_message_metadata] Metadata for the pending message
1557
1507
  *
1558
1508
  * @return {Promise<SendMessageAPIResponse<StreamChatGenerics>>} The Server Response
1559
1509
  */
@@ -1960,6 +1910,7 @@ var Channel = /*#__PURE__*/function () {
1960
1910
  key: "updatePartial",
1961
1911
  value: function () {
1962
1912
  var _updatePartial = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8(update) {
1913
+ var data;
1963
1914
  return _regeneratorRuntime.wrap(function _callee8$(_context8) {
1964
1915
  while (1) {
1965
1916
  switch (_context8.prev = _context8.next) {
@@ -1968,9 +1919,11 @@ var Channel = /*#__PURE__*/function () {
1968
1919
  return this.getClient().patch(this._channelURL(), update);
1969
1920
 
1970
1921
  case 2:
1971
- return _context8.abrupt("return", _context8.sent);
1922
+ data = _context8.sent;
1923
+ this.data = data.channel;
1924
+ return _context8.abrupt("return", data);
1972
1925
 
1973
- case 3:
1926
+ case 5:
1974
1927
  case "end":
1975
1928
  return _context8.stop();
1976
1929
  }
@@ -3214,6 +3167,7 @@ var Channel = /*#__PURE__*/function () {
3214
3167
 
3215
3168
 
3216
3169
  _this$_initializeStat = this._initializeState(state, messageSetToAddToIfDoesNotExist), messageSet = _this$_initializeStat.messageSet;
3170
+ this.data = state.channel;
3217
3171
  this.getClient().dispatchEvent({
3218
3172
  type: 'channels.queried',
3219
3173
  queriedChannels: {
@@ -3223,7 +3177,7 @@ var Channel = /*#__PURE__*/function () {
3223
3177
  });
3224
3178
  return _context31.abrupt("return", state);
3225
3179
 
3226
- case 13:
3180
+ case 14:
3227
3181
  case "end":
3228
3182
  return _context31.stop();
3229
3183
  }
@@ -3542,12 +3496,6 @@ var Channel = /*#__PURE__*/function () {
3542
3496
  var _this2 = this;
3543
3497
 
3544
3498
  var key = callbackOrNothing ? callbackOrString : 'all';
3545
- var valid = isValidEventType(key);
3546
-
3547
- if (!valid) {
3548
- throw Error("Invalid event type ".concat(key));
3549
- }
3550
-
3551
3499
  var callback = callbackOrNothing ? callbackOrNothing : callbackOrString;
3552
3500
 
3553
3501
  if (!(key in this.listeners)) {
@@ -3582,12 +3530,6 @@ var Channel = /*#__PURE__*/function () {
3582
3530
  key: "off",
3583
3531
  value: function off(callbackOrString, callbackOrNothing) {
3584
3532
  var key = callbackOrNothing ? callbackOrString : 'all';
3585
- var valid = isValidEventType(key);
3586
-
3587
- if (!valid) {
3588
- throw Error("Invalid event type ".concat(key));
3589
- }
3590
-
3591
3533
  var callback = callbackOrNothing ? callbackOrNothing : callbackOrString;
3592
3534
 
3593
3535
  if (!(key in this.listeners)) {
@@ -3826,7 +3768,7 @@ var Channel = /*#__PURE__*/function () {
3826
3768
  }, {
3827
3769
  key: "_checkInitialized",
3828
3770
  value: function _checkInitialized() {
3829
- if (!this.initialized && !this.staticState && !this.getClient()._isUsingServerAuth()) {
3771
+ if (!this.initialized && !this.offlineMode && !this.getClient()._isUsingServerAuth()) {
3830
3772
  throw Error("Channel ".concat(this.cid, " hasn't been initialized yet. Make sure to call .watch() and wait for it to resolve"));
3831
3773
  }
3832
3774
  } // eslint-disable-next-line sonarjs/cognitive-complexity
@@ -3876,6 +3818,11 @@ var Channel = /*#__PURE__*/function () {
3876
3818
  }
3877
3819
 
3878
3820
  this.state.addPinnedMessages(state.pinned_messages || []);
3821
+
3822
+ if (state.pending_messages) {
3823
+ this.state.pending_messages = state.pending_messages;
3824
+ }
3825
+
3879
3826
  this.state.watcher_count = state.watcher_count || 0; // convert the arrays into objects for easier syncing...
3880
3827
 
3881
3828
  if (state.watchers) {
@@ -4551,6 +4498,11 @@ var StableWSConnection = /*#__PURE__*/function () {
4551
4498
  tags: ['connection']
4552
4499
  }, extra));
4553
4500
  }
4501
+ }, {
4502
+ key: "setClient",
4503
+ value: function setClient(client) {
4504
+ this.client = client;
4505
+ }
4554
4506
  /**
4555
4507
  * connect - Connect to the WS URL
4556
4508
  * the default 15s timeout allows between 2~3 tries
@@ -5984,6 +5936,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
5984
5936
  `messages` soft-hard will delete any messages that the user has sent.
5985
5937
  `new_channel_owner_id` any channels owned by the hard-deleted user will be transferred to this user ID
5986
5938
  */
5939
+ // TODO: add better typing
5987
5940
  var ErrorFromResponse = /*#__PURE__*/function (_Error) {
5988
5941
  _inherits(ErrorFromResponse, _Error);
5989
5942
 
@@ -6245,7 +6198,7 @@ var StreamChat = /*#__PURE__*/function () {
6245
6198
  throw Error('User is not set on client, use client.connectUser or client.connectAnonymousUser instead');
6246
6199
 
6247
6200
  case 2:
6248
- if (!((_this$wsConnection3 = _this.wsConnection) !== null && _this$wsConnection3 !== void 0 && _this$wsConnection3.isConnecting)) {
6201
+ if (!((_this$wsConnection3 = _this.wsConnection) !== null && _this$wsConnection3 !== void 0 && _this$wsConnection3.isConnecting && _this.wsPromise)) {
6249
6202
  _context3.next = 5;
6250
6203
  break;
6251
6204
  }
@@ -6254,7 +6207,7 @@ var StreamChat = /*#__PURE__*/function () {
6254
6207
  tags: ['connection', 'client']
6255
6208
  });
6256
6209
 
6257
- return _context3.abrupt("return", Promise.resolve());
6210
+ return _context3.abrupt("return", _this.wsPromise);
6258
6211
 
6259
6212
  case 5:
6260
6213
  if (!(((_this$wsConnection4 = _this.wsConnection) !== null && _this$wsConnection4 !== void 0 && _this$wsConnection4.isHealthy || (_this$wsFallback3 = _this.wsFallback) !== null && _this$wsFallback3 !== void 0 && _this$wsFallback3.isHealthy()) && _this._hasConnectionID())) {
@@ -7012,23 +6965,28 @@ var StreamChat = /*#__PURE__*/function () {
7012
6965
  */
7013
6966
  function () {
7014
6967
  var _updateAppSettings = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee7(options) {
7015
- var _options$apn_config;
7016
-
6968
+ var apn_config;
7017
6969
  return _regeneratorRuntime.wrap(function _callee7$(_context7) {
7018
6970
  while (1) {
7019
6971
  switch (_context7.prev = _context7.next) {
7020
6972
  case 0:
7021
- if ((_options$apn_config = options.apn_config) !== null && _options$apn_config !== void 0 && _options$apn_config.p12_cert) {
7022
- options.apn_config.p12_cert = Buffer.from(options.apn_config.p12_cert).toString('base64');
6973
+ apn_config = options.apn_config;
6974
+
6975
+ if (apn_config !== null && apn_config !== void 0 && apn_config.p12_cert) {
6976
+ options = _objectSpread(_objectSpread({}, options), {}, {
6977
+ apn_config: _objectSpread(_objectSpread({}, apn_config), {}, {
6978
+ p12_cert: Buffer.from(apn_config.p12_cert).toString('base64')
6979
+ })
6980
+ });
7023
6981
  }
7024
6982
 
7025
- _context7.next = 3;
6983
+ _context7.next = 4;
7026
6984
  return this.patch(this.baseURL + '/app', options);
7027
6985
 
7028
- case 3:
6986
+ case 4:
7029
6987
  return _context7.abrupt("return", _context7.sent);
7030
6988
 
7031
- case 4:
6989
+ case 5:
7032
6990
  case "end":
7033
6991
  return _context7.stop();
7034
6992
  }
@@ -7419,12 +7377,6 @@ var StreamChat = /*#__PURE__*/function () {
7419
7377
  var _this2 = this;
7420
7378
 
7421
7379
  var key = callbackOrNothing ? callbackOrString : 'all';
7422
- var valid = isValidEventType(key);
7423
-
7424
- if (!valid) {
7425
- throw Error("Invalid event type ".concat(key));
7426
- }
7427
-
7428
7380
  var callback = callbackOrNothing ? callbackOrNothing : callbackOrString;
7429
7381
 
7430
7382
  if (!(key in this.listeners)) {
@@ -7456,12 +7408,6 @@ var StreamChat = /*#__PURE__*/function () {
7456
7408
  key: "off",
7457
7409
  value: function off(callbackOrString, callbackOrNothing) {
7458
7410
  var key = callbackOrNothing ? callbackOrString : 'all';
7459
- var valid = isValidEventType(key);
7460
-
7461
- if (!valid) {
7462
- throw Error("Invalid event type ".concat(key));
7463
- }
7464
-
7465
7411
  var callback = callbackOrNothing ? callbackOrNothing : callbackOrString;
7466
7412
 
7467
7413
  if (!(key in this.listeners)) {
@@ -7716,9 +7662,16 @@ var StreamChat = /*#__PURE__*/function () {
7716
7662
  } // The StableWSConnection handles all the reconnection logic.
7717
7663
 
7718
7664
 
7719
- this.wsConnection = new StableWSConnection({
7720
- client: this
7721
- });
7665
+ if (this.options.wsConnection && this.node) {
7666
+ // Intentionally avoiding adding ts generics on wsConnection in options since its only useful for unit test purpose.
7667
+ this.options.wsConnection.setClient(this);
7668
+ this.wsConnection = this.options.wsConnection;
7669
+ } else {
7670
+ this.wsConnection = new StableWSConnection({
7671
+ client: this
7672
+ });
7673
+ }
7674
+
7722
7675
  _context15.prev = 8;
7723
7676
 
7724
7677
  if (!this.wsFallback) {
@@ -7844,7 +7797,7 @@ var StreamChat = /*#__PURE__*/function () {
7844
7797
  }; // Make sure we wait for the connect promise if there is a pending one
7845
7798
 
7846
7799
  _context16.next = 5;
7847
- return this.setUserPromise;
7800
+ return this.wsPromise;
7848
7801
 
7849
7802
  case 5:
7850
7803
  if (!this._hasConnectionID()) {
@@ -8013,7 +7966,7 @@ var StreamChat = /*#__PURE__*/function () {
8013
7966
  }; // Make sure we wait for the connect promise if there is a pending one
8014
7967
 
8015
7968
  _context19.next = 6;
8016
- return this.setUserPromise;
7969
+ return this.wsPromise;
8017
7970
 
8018
7971
  case 6:
8019
7972
  if (!this._hasConnectionID()) {
@@ -8059,8 +8012,8 @@ var StreamChat = /*#__PURE__*/function () {
8059
8012
  var channelsFromApi = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
8060
8013
  var stateOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
8061
8014
  var skipInitialization = stateOptions.skipInitialization,
8062
- _stateOptions$staticS = stateOptions.staticState,
8063
- staticState = _stateOptions$staticS === void 0 ? false : _stateOptions$staticS;
8015
+ _stateOptions$offline = stateOptions.offlineMode,
8016
+ offlineMode = _stateOptions$offline === void 0 ? false : _stateOptions$offline;
8064
8017
 
8065
8018
  var _iterator2 = _createForOfIteratorHelper(channelsFromApi),
8066
8019
  _step2;
@@ -8087,8 +8040,8 @@ var StreamChat = /*#__PURE__*/function () {
8087
8040
  var _channelState = _step3.value;
8088
8041
  var c = this.channel(_channelState.channel.type, _channelState.channel.id);
8089
8042
  c.data = _channelState.channel;
8090
- c.staticState = staticState;
8091
- c.initialized = !staticState;
8043
+ c.offlineMode = offlineMode;
8044
+ c.initialized = !offlineMode;
8092
8045
 
8093
8046
  if (skipInitialization === undefined) {
8094
8047
  c._initializeState(_channelState, 'latest');
@@ -8106,13 +8059,13 @@ var StreamChat = /*#__PURE__*/function () {
8106
8059
  _iterator3.f();
8107
8060
  }
8108
8061
 
8109
- if (!staticState) {
8062
+ if (!offlineMode) {
8110
8063
  // If the channels are coming from server, then clear out the
8111
8064
  // previously help offline channels.
8112
8065
  for (var _key5 in this.activeChannels) {
8113
8066
  var _channel7 = this.activeChannels[_key5];
8114
8067
 
8115
- if (_channel7.staticState) {
8068
+ if (_channel7.offlineMode) {
8116
8069
  delete this.activeChannels[_key5];
8117
8070
  }
8118
8071
  }
@@ -8181,7 +8134,7 @@ var StreamChat = /*#__PURE__*/function () {
8181
8134
 
8182
8135
  case 13:
8183
8136
  _context20.next = 15;
8184
- return this.setUserPromise;
8137
+ return this.wsPromise;
8185
8138
 
8186
8139
  case 15:
8187
8140
  _context20.next = 17;
@@ -9870,7 +9823,7 @@ var StreamChat = /*#__PURE__*/function () {
9870
9823
  }, {
9871
9824
  key: "getUserAgent",
9872
9825
  value: function getUserAgent() {
9873
- return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "7.0.0-offline-support.3");
9826
+ return this.userAgent || "stream-chat-javascript-client-".concat(this.node ? 'node' : 'browser', "-", "7.1.0");
9874
9827
  }
9875
9828
  }, {
9876
9829
  key: "setUserAgent",
@@ -10043,15 +9996,19 @@ var StreamChat = /*#__PURE__*/function () {
10043
9996
  /** sync - returns all events that happened for a list of channels since last sync
10044
9997
  * @param {string[]} channel_cids list of channel CIDs
10045
9998
  * @param {string} last_sync_at last time the user was online and in sync. RFC3339 ie. "2020-05-06T15:05:01.207Z"
9999
+ * @param {SyncOptions} options See JSDoc in the type fields for more info
10000
+ *
10001
+ * @returns {Promise<SyncResponse>}
10046
10002
  */
10047
10003
 
10048
10004
  }, {
10049
10005
  key: "sync",
10050
10006
  value: function sync(channel_cids, last_sync_at) {
10051
- return this.post("".concat(this.baseURL, "/sync"), {
10007
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
10008
+ return this.post("".concat(this.baseURL, "/sync"), _objectSpread({
10052
10009
  channel_cids: channel_cids,
10053
10010
  last_sync_at: last_sync_at
10054
- });
10011
+ }, options));
10055
10012
  }
10056
10013
  /**
10057
10014
  * sendUserCustomEvent - Send a custom event to a user
@@ -10186,32 +10143,34 @@ var StreamChat = /*#__PURE__*/function () {
10186
10143
  return createSegment;
10187
10144
  }()
10188
10145
  /**
10189
- * getSegment - Get a Campaign Segment
10146
+ * querySegments - Query Campaign Segments
10190
10147
  *
10191
- * @param {string} id Segment ID
10192
10148
  *
10193
- * @return {Segment} A Segment
10149
+ * @return {Segment[]} Segments
10194
10150
  */
10195
10151
 
10196
10152
  }, {
10197
- key: "getSegment",
10153
+ key: "querySegments",
10198
10154
  value: function () {
10199
- var _getSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee55(id) {
10200
- var _yield$this$get, segment;
10201
-
10155
+ var _querySegments = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee55(filters) {
10156
+ var options,
10157
+ _args55 = arguments;
10202
10158
  return _regeneratorRuntime.wrap(function _callee55$(_context55) {
10203
10159
  while (1) {
10204
10160
  switch (_context55.prev = _context55.next) {
10205
10161
  case 0:
10206
- _context55.next = 2;
10207
- return this.get(this.baseURL + "/segments/".concat(id));
10162
+ options = _args55.length > 1 && _args55[1] !== undefined ? _args55[1] : {};
10163
+ _context55.next = 3;
10164
+ return this.get(this.baseURL + "/segments", {
10165
+ payload: _objectSpread({
10166
+ filter_conditions: filters
10167
+ }, options)
10168
+ });
10208
10169
 
10209
- case 2:
10210
- _yield$this$get = _context55.sent;
10211
- segment = _yield$this$get.segment;
10212
- return _context55.abrupt("return", segment);
10170
+ case 3:
10171
+ return _context55.abrupt("return", _context55.sent);
10213
10172
 
10214
- case 5:
10173
+ case 4:
10215
10174
  case "end":
10216
10175
  return _context55.stop();
10217
10176
  }
@@ -10219,50 +10178,11 @@ var StreamChat = /*#__PURE__*/function () {
10219
10178
  }, _callee55, this);
10220
10179
  }));
10221
10180
 
10222
- function getSegment(_x74) {
10223
- return _getSegment.apply(this, arguments);
10181
+ function querySegments(_x74) {
10182
+ return _querySegments.apply(this, arguments);
10224
10183
  }
10225
10184
 
10226
- return getSegment;
10227
- }()
10228
- /**
10229
- * listSegments - List Campaign Segments
10230
- *
10231
- *
10232
- * @return {Segment[]} Segments
10233
- */
10234
-
10235
- }, {
10236
- key: "listSegments",
10237
- value: function () {
10238
- var _listSegments = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee56(options) {
10239
- var _yield$this$get2, segments;
10240
-
10241
- return _regeneratorRuntime.wrap(function _callee56$(_context56) {
10242
- while (1) {
10243
- switch (_context56.prev = _context56.next) {
10244
- case 0:
10245
- _context56.next = 2;
10246
- return this.get(this.baseURL + "/segments", options);
10247
-
10248
- case 2:
10249
- _yield$this$get2 = _context56.sent;
10250
- segments = _yield$this$get2.segments;
10251
- return _context56.abrupt("return", segments);
10252
-
10253
- case 5:
10254
- case "end":
10255
- return _context56.stop();
10256
- }
10257
- }
10258
- }, _callee56, this);
10259
- }));
10260
-
10261
- function listSegments(_x75) {
10262
- return _listSegments.apply(this, arguments);
10263
- }
10264
-
10265
- return listSegments;
10185
+ return querySegments;
10266
10186
  }()
10267
10187
  /**
10268
10188
  * updateSegment - Update a Campaign Segment
@@ -10276,32 +10196,32 @@ var StreamChat = /*#__PURE__*/function () {
10276
10196
  }, {
10277
10197
  key: "updateSegment",
10278
10198
  value: function () {
10279
- var _updateSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee57(id, params) {
10199
+ var _updateSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee56(id, params) {
10280
10200
  var _yield$this$put, segment;
10281
10201
 
10282
- return _regeneratorRuntime.wrap(function _callee57$(_context57) {
10202
+ return _regeneratorRuntime.wrap(function _callee56$(_context56) {
10283
10203
  while (1) {
10284
- switch (_context57.prev = _context57.next) {
10204
+ switch (_context56.prev = _context56.next) {
10285
10205
  case 0:
10286
- _context57.next = 2;
10206
+ _context56.next = 2;
10287
10207
  return this.put(this.baseURL + "/segments/".concat(id), {
10288
10208
  segment: params
10289
10209
  });
10290
10210
 
10291
10211
  case 2:
10292
- _yield$this$put = _context57.sent;
10212
+ _yield$this$put = _context56.sent;
10293
10213
  segment = _yield$this$put.segment;
10294
- return _context57.abrupt("return", segment);
10214
+ return _context56.abrupt("return", segment);
10295
10215
 
10296
10216
  case 5:
10297
10217
  case "end":
10298
- return _context57.stop();
10218
+ return _context56.stop();
10299
10219
  }
10300
10220
  }
10301
- }, _callee57, this);
10221
+ }, _callee56, this);
10302
10222
  }));
10303
10223
 
10304
- function updateSegment(_x76, _x77) {
10224
+ function updateSegment(_x75, _x76) {
10305
10225
  return _updateSegment.apply(this, arguments);
10306
10226
  }
10307
10227
 
@@ -10318,22 +10238,22 @@ var StreamChat = /*#__PURE__*/function () {
10318
10238
  }, {
10319
10239
  key: "deleteSegment",
10320
10240
  value: function () {
10321
- var _deleteSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee58(id) {
10322
- return _regeneratorRuntime.wrap(function _callee58$(_context58) {
10241
+ var _deleteSegment = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee57(id) {
10242
+ return _regeneratorRuntime.wrap(function _callee57$(_context57) {
10323
10243
  while (1) {
10324
- switch (_context58.prev = _context58.next) {
10244
+ switch (_context57.prev = _context57.next) {
10325
10245
  case 0:
10326
- return _context58.abrupt("return", this.delete(this.baseURL + "/segments/".concat(id)));
10246
+ return _context57.abrupt("return", this.delete(this.baseURL + "/segments/".concat(id)));
10327
10247
 
10328
10248
  case 1:
10329
10249
  case "end":
10330
- return _context58.stop();
10250
+ return _context57.stop();
10331
10251
  }
10332
10252
  }
10333
- }, _callee58, this);
10253
+ }, _callee57, this);
10334
10254
  }));
10335
10255
 
10336
- function deleteSegment(_x78) {
10256
+ function deleteSegment(_x77) {
10337
10257
  return _deleteSegment.apply(this, arguments);
10338
10258
  }
10339
10259
 
@@ -10350,115 +10270,78 @@ var StreamChat = /*#__PURE__*/function () {
10350
10270
  }, {
10351
10271
  key: "createCampaign",
10352
10272
  value: function () {
10353
- var _createCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee59(params) {
10273
+ var _createCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee58(params) {
10354
10274
  var _yield$this$post2, campaign;
10355
10275
 
10356
- return _regeneratorRuntime.wrap(function _callee59$(_context59) {
10276
+ return _regeneratorRuntime.wrap(function _callee58$(_context58) {
10357
10277
  while (1) {
10358
- switch (_context59.prev = _context59.next) {
10278
+ switch (_context58.prev = _context58.next) {
10359
10279
  case 0:
10360
- _context59.next = 2;
10280
+ _context58.next = 2;
10361
10281
  return this.post(this.baseURL + "/campaigns", {
10362
10282
  campaign: params
10363
10283
  });
10364
10284
 
10365
10285
  case 2:
10366
- _yield$this$post2 = _context59.sent;
10286
+ _yield$this$post2 = _context58.sent;
10367
10287
  campaign = _yield$this$post2.campaign;
10368
- return _context59.abrupt("return", campaign);
10288
+ return _context58.abrupt("return", campaign);
10369
10289
 
10370
10290
  case 5:
10371
10291
  case "end":
10372
- return _context59.stop();
10292
+ return _context58.stop();
10373
10293
  }
10374
10294
  }
10375
- }, _callee59, this);
10295
+ }, _callee58, this);
10376
10296
  }));
10377
10297
 
10378
- function createCampaign(_x79) {
10298
+ function createCampaign(_x78) {
10379
10299
  return _createCampaign.apply(this, arguments);
10380
10300
  }
10381
10301
 
10382
10302
  return createCampaign;
10383
10303
  }()
10384
10304
  /**
10385
- * getCampaign - Get a Campaign
10386
- *
10387
- * @param {string} id Campaign ID
10388
- *
10389
- * @return {Campaign} A Campaign
10390
- */
10391
-
10392
- }, {
10393
- key: "getCampaign",
10394
- value: function () {
10395
- var _getCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee60(id) {
10396
- var _yield$this$get3, campaign;
10397
-
10398
- return _regeneratorRuntime.wrap(function _callee60$(_context60) {
10399
- while (1) {
10400
- switch (_context60.prev = _context60.next) {
10401
- case 0:
10402
- _context60.next = 2;
10403
- return this.get(this.baseURL + "/campaigns/".concat(id));
10404
-
10405
- case 2:
10406
- _yield$this$get3 = _context60.sent;
10407
- campaign = _yield$this$get3.campaign;
10408
- return _context60.abrupt("return", campaign);
10409
-
10410
- case 5:
10411
- case "end":
10412
- return _context60.stop();
10413
- }
10414
- }
10415
- }, _callee60, this);
10416
- }));
10417
-
10418
- function getCampaign(_x80) {
10419
- return _getCampaign.apply(this, arguments);
10420
- }
10421
-
10422
- return getCampaign;
10423
- }()
10424
- /**
10425
- * listCampaigns - List Campaigns
10305
+ * queryCampaigns - Query Campaigns
10426
10306
  *
10427
10307
  *
10428
10308
  * @return {Campaign[]} Campaigns
10429
10309
  */
10430
10310
 
10431
10311
  }, {
10432
- key: "listCampaigns",
10312
+ key: "queryCampaigns",
10433
10313
  value: function () {
10434
- var _listCampaigns = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee61(options) {
10435
- var _yield$this$get4, campaigns;
10436
-
10437
- return _regeneratorRuntime.wrap(function _callee61$(_context61) {
10314
+ var _queryCampaigns = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee59(filters) {
10315
+ var options,
10316
+ _args59 = arguments;
10317
+ return _regeneratorRuntime.wrap(function _callee59$(_context59) {
10438
10318
  while (1) {
10439
- switch (_context61.prev = _context61.next) {
10319
+ switch (_context59.prev = _context59.next) {
10440
10320
  case 0:
10441
- _context61.next = 2;
10442
- return this.get(this.baseURL + "/campaigns", options);
10321
+ options = _args59.length > 1 && _args59[1] !== undefined ? _args59[1] : {};
10322
+ _context59.next = 3;
10323
+ return this.get(this.baseURL + "/campaigns", {
10324
+ payload: _objectSpread({
10325
+ filter_conditions: filters
10326
+ }, options)
10327
+ });
10443
10328
 
10444
- case 2:
10445
- _yield$this$get4 = _context61.sent;
10446
- campaigns = _yield$this$get4.campaigns;
10447
- return _context61.abrupt("return", campaigns);
10329
+ case 3:
10330
+ return _context59.abrupt("return", _context59.sent);
10448
10331
 
10449
- case 5:
10332
+ case 4:
10450
10333
  case "end":
10451
- return _context61.stop();
10334
+ return _context59.stop();
10452
10335
  }
10453
10336
  }
10454
- }, _callee61, this);
10337
+ }, _callee59, this);
10455
10338
  }));
10456
10339
 
10457
- function listCampaigns(_x81) {
10458
- return _listCampaigns.apply(this, arguments);
10340
+ function queryCampaigns(_x79) {
10341
+ return _queryCampaigns.apply(this, arguments);
10459
10342
  }
10460
10343
 
10461
- return listCampaigns;
10344
+ return queryCampaigns;
10462
10345
  }()
10463
10346
  /**
10464
10347
  * updateCampaign - Update a Campaign
@@ -10472,32 +10355,32 @@ var StreamChat = /*#__PURE__*/function () {
10472
10355
  }, {
10473
10356
  key: "updateCampaign",
10474
10357
  value: function () {
10475
- var _updateCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee62(id, params) {
10358
+ var _updateCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee60(id, params) {
10476
10359
  var _yield$this$put2, campaign;
10477
10360
 
10478
- return _regeneratorRuntime.wrap(function _callee62$(_context62) {
10361
+ return _regeneratorRuntime.wrap(function _callee60$(_context60) {
10479
10362
  while (1) {
10480
- switch (_context62.prev = _context62.next) {
10363
+ switch (_context60.prev = _context60.next) {
10481
10364
  case 0:
10482
- _context62.next = 2;
10365
+ _context60.next = 2;
10483
10366
  return this.put(this.baseURL + "/campaigns/".concat(id), {
10484
10367
  campaign: params
10485
10368
  });
10486
10369
 
10487
10370
  case 2:
10488
- _yield$this$put2 = _context62.sent;
10371
+ _yield$this$put2 = _context60.sent;
10489
10372
  campaign = _yield$this$put2.campaign;
10490
- return _context62.abrupt("return", campaign);
10373
+ return _context60.abrupt("return", campaign);
10491
10374
 
10492
10375
  case 5:
10493
10376
  case "end":
10494
- return _context62.stop();
10377
+ return _context60.stop();
10495
10378
  }
10496
10379
  }
10497
- }, _callee62, this);
10380
+ }, _callee60, this);
10498
10381
  }));
10499
10382
 
10500
- function updateCampaign(_x82, _x83) {
10383
+ function updateCampaign(_x80, _x81) {
10501
10384
  return _updateCampaign.apply(this, arguments);
10502
10385
  }
10503
10386
 
@@ -10514,22 +10397,25 @@ var StreamChat = /*#__PURE__*/function () {
10514
10397
  }, {
10515
10398
  key: "deleteCampaign",
10516
10399
  value: function () {
10517
- var _deleteCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee63(id) {
10518
- return _regeneratorRuntime.wrap(function _callee63$(_context63) {
10400
+ var _deleteCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee61(id) {
10401
+ var params,
10402
+ _args61 = arguments;
10403
+ return _regeneratorRuntime.wrap(function _callee61$(_context61) {
10519
10404
  while (1) {
10520
- switch (_context63.prev = _context63.next) {
10405
+ switch (_context61.prev = _context61.next) {
10521
10406
  case 0:
10522
- return _context63.abrupt("return", this.delete(this.baseURL + "/campaigns/".concat(id)));
10407
+ params = _args61.length > 1 && _args61[1] !== undefined ? _args61[1] : {};
10408
+ return _context61.abrupt("return", this.delete(this.baseURL + "/campaigns/".concat(id), params));
10523
10409
 
10524
- case 1:
10410
+ case 2:
10525
10411
  case "end":
10526
- return _context63.stop();
10412
+ return _context61.stop();
10527
10413
  }
10528
10414
  }
10529
- }, _callee63, this);
10415
+ }, _callee61, this);
10530
10416
  }));
10531
10417
 
10532
- function deleteCampaign(_x84) {
10418
+ function deleteCampaign(_x82) {
10533
10419
  return _deleteCampaign.apply(this, arguments);
10534
10420
  }
10535
10421
 
@@ -10547,33 +10433,33 @@ var StreamChat = /*#__PURE__*/function () {
10547
10433
  }, {
10548
10434
  key: "scheduleCampaign",
10549
10435
  value: function () {
10550
- var _scheduleCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee64(id, params) {
10436
+ var _scheduleCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee62(id, params) {
10551
10437
  var scheduledFor, _yield$this$patch, campaign;
10552
10438
 
10553
- return _regeneratorRuntime.wrap(function _callee64$(_context64) {
10439
+ return _regeneratorRuntime.wrap(function _callee62$(_context62) {
10554
10440
  while (1) {
10555
- switch (_context64.prev = _context64.next) {
10441
+ switch (_context62.prev = _context62.next) {
10556
10442
  case 0:
10557
10443
  scheduledFor = params.scheduledFor;
10558
- _context64.next = 3;
10444
+ _context62.next = 3;
10559
10445
  return this.patch(this.baseURL + "/campaigns/".concat(id, "/schedule"), {
10560
10446
  scheduled_for: scheduledFor
10561
10447
  });
10562
10448
 
10563
10449
  case 3:
10564
- _yield$this$patch = _context64.sent;
10450
+ _yield$this$patch = _context62.sent;
10565
10451
  campaign = _yield$this$patch.campaign;
10566
- return _context64.abrupt("return", campaign);
10452
+ return _context62.abrupt("return", campaign);
10567
10453
 
10568
10454
  case 6:
10569
10455
  case "end":
10570
- return _context64.stop();
10456
+ return _context62.stop();
10571
10457
  }
10572
10458
  }
10573
- }, _callee64, this);
10459
+ }, _callee62, this);
10574
10460
  }));
10575
10461
 
10576
- function scheduleCampaign(_x85, _x86) {
10462
+ function scheduleCampaign(_x83, _x84) {
10577
10463
  return _scheduleCampaign.apply(this, arguments);
10578
10464
  }
10579
10465
 
@@ -10590,30 +10476,30 @@ var StreamChat = /*#__PURE__*/function () {
10590
10476
  }, {
10591
10477
  key: "stopCampaign",
10592
10478
  value: function () {
10593
- var _stopCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee65(id) {
10479
+ var _stopCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee63(id) {
10594
10480
  var _yield$this$patch2, campaign;
10595
10481
 
10596
- return _regeneratorRuntime.wrap(function _callee65$(_context65) {
10482
+ return _regeneratorRuntime.wrap(function _callee63$(_context63) {
10597
10483
  while (1) {
10598
- switch (_context65.prev = _context65.next) {
10484
+ switch (_context63.prev = _context63.next) {
10599
10485
  case 0:
10600
- _context65.next = 2;
10486
+ _context63.next = 2;
10601
10487
  return this.patch(this.baseURL + "/campaigns/".concat(id, "/stop"));
10602
10488
 
10603
10489
  case 2:
10604
- _yield$this$patch2 = _context65.sent;
10490
+ _yield$this$patch2 = _context63.sent;
10605
10491
  campaign = _yield$this$patch2.campaign;
10606
- return _context65.abrupt("return", campaign);
10492
+ return _context63.abrupt("return", campaign);
10607
10493
 
10608
10494
  case 5:
10609
10495
  case "end":
10610
- return _context65.stop();
10496
+ return _context63.stop();
10611
10497
  }
10612
10498
  }
10613
- }, _callee65, this);
10499
+ }, _callee63, this);
10614
10500
  }));
10615
10501
 
10616
- function stopCampaign(_x87) {
10502
+ function stopCampaign(_x85) {
10617
10503
  return _stopCampaign.apply(this, arguments);
10618
10504
  }
10619
10505
 
@@ -10630,30 +10516,30 @@ var StreamChat = /*#__PURE__*/function () {
10630
10516
  }, {
10631
10517
  key: "resumeCampaign",
10632
10518
  value: function () {
10633
- var _resumeCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee66(id) {
10519
+ var _resumeCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee64(id) {
10634
10520
  var _yield$this$patch3, campaign;
10635
10521
 
10636
- return _regeneratorRuntime.wrap(function _callee66$(_context66) {
10522
+ return _regeneratorRuntime.wrap(function _callee64$(_context64) {
10637
10523
  while (1) {
10638
- switch (_context66.prev = _context66.next) {
10524
+ switch (_context64.prev = _context64.next) {
10639
10525
  case 0:
10640
- _context66.next = 2;
10526
+ _context64.next = 2;
10641
10527
  return this.patch(this.baseURL + "/campaigns/".concat(id, "/resume"));
10642
10528
 
10643
10529
  case 2:
10644
- _yield$this$patch3 = _context66.sent;
10530
+ _yield$this$patch3 = _context64.sent;
10645
10531
  campaign = _yield$this$patch3.campaign;
10646
- return _context66.abrupt("return", campaign);
10532
+ return _context64.abrupt("return", campaign);
10647
10533
 
10648
10534
  case 5:
10649
10535
  case "end":
10650
- return _context66.stop();
10536
+ return _context64.stop();
10651
10537
  }
10652
10538
  }
10653
- }, _callee66, this);
10539
+ }, _callee64, this);
10654
10540
  }));
10655
10541
 
10656
- function resumeCampaign(_x88) {
10542
+ function resumeCampaign(_x86) {
10657
10543
  return _resumeCampaign.apply(this, arguments);
10658
10544
  }
10659
10545
 
@@ -10671,35 +10557,77 @@ var StreamChat = /*#__PURE__*/function () {
10671
10557
  }, {
10672
10558
  key: "testCampaign",
10673
10559
  value: function () {
10674
- var _testCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee67(id, params) {
10560
+ var _testCampaign = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee65(id, params) {
10675
10561
  var users;
10676
- return _regeneratorRuntime.wrap(function _callee67$(_context67) {
10562
+ return _regeneratorRuntime.wrap(function _callee65$(_context65) {
10677
10563
  while (1) {
10678
- switch (_context67.prev = _context67.next) {
10564
+ switch (_context65.prev = _context65.next) {
10679
10565
  case 0:
10680
10566
  users = params.users;
10681
- _context67.next = 3;
10567
+ _context65.next = 3;
10682
10568
  return this.post(this.baseURL + "/campaigns/".concat(id, "/test"), {
10683
10569
  users: users
10684
10570
  });
10685
10571
 
10686
10572
  case 3:
10687
- return _context67.abrupt("return", _context67.sent);
10573
+ return _context65.abrupt("return", _context65.sent);
10688
10574
 
10689
10575
  case 4:
10690
10576
  case "end":
10691
- return _context67.stop();
10577
+ return _context65.stop();
10692
10578
  }
10693
10579
  }
10694
- }, _callee67, this);
10580
+ }, _callee65, this);
10695
10581
  }));
10696
10582
 
10697
- function testCampaign(_x89, _x90) {
10583
+ function testCampaign(_x87, _x88) {
10698
10584
  return _testCampaign.apply(this, arguments);
10699
10585
  }
10700
10586
 
10701
10587
  return testCampaign;
10702
10588
  }()
10589
+ /**
10590
+ * queryRecipients - Query Campaign Recipient Results
10591
+ *
10592
+ *
10593
+ * @return {Recipient[]} Recipients
10594
+ */
10595
+
10596
+ }, {
10597
+ key: "queryRecipients",
10598
+ value: function () {
10599
+ var _queryRecipients = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee66(filters) {
10600
+ var options,
10601
+ _args66 = arguments;
10602
+ return _regeneratorRuntime.wrap(function _callee66$(_context66) {
10603
+ while (1) {
10604
+ switch (_context66.prev = _context66.next) {
10605
+ case 0:
10606
+ options = _args66.length > 1 && _args66[1] !== undefined ? _args66[1] : {};
10607
+ _context66.next = 3;
10608
+ return this.get(this.baseURL + "/recipients", {
10609
+ payload: _objectSpread({
10610
+ filter_conditions: filters
10611
+ }, options)
10612
+ });
10613
+
10614
+ case 3:
10615
+ return _context66.abrupt("return", _context66.sent);
10616
+
10617
+ case 4:
10618
+ case "end":
10619
+ return _context66.stop();
10620
+ }
10621
+ }
10622
+ }, _callee66, this);
10623
+ }));
10624
+
10625
+ function queryRecipients(_x89) {
10626
+ return _queryRecipients.apply(this, arguments);
10627
+ }
10628
+
10629
+ return queryRecipients;
10630
+ }()
10703
10631
  /**
10704
10632
  * enrichURL - Get OpenGraph data of the given link
10705
10633
  *
@@ -10710,24 +10638,24 @@ var StreamChat = /*#__PURE__*/function () {
10710
10638
  }, {
10711
10639
  key: "enrichURL",
10712
10640
  value: function () {
10713
- var _enrichURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee68(url) {
10714
- return _regeneratorRuntime.wrap(function _callee68$(_context68) {
10641
+ var _enrichURL = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee67(url) {
10642
+ return _regeneratorRuntime.wrap(function _callee67$(_context67) {
10715
10643
  while (1) {
10716
- switch (_context68.prev = _context68.next) {
10644
+ switch (_context67.prev = _context67.next) {
10717
10645
  case 0:
10718
- return _context68.abrupt("return", this.get(this.baseURL + "/og", {
10646
+ return _context67.abrupt("return", this.get(this.baseURL + "/og", {
10719
10647
  url: url
10720
10648
  }));
10721
10649
 
10722
10650
  case 1:
10723
10651
  case "end":
10724
- return _context68.stop();
10652
+ return _context67.stop();
10725
10653
  }
10726
10654
  }
10727
- }, _callee68, this);
10655
+ }, _callee67, this);
10728
10656
  }));
10729
10657
 
10730
- function enrichURL(_x91) {
10658
+ function enrichURL(_x90) {
10731
10659
  return _enrichURL.apply(this, arguments);
10732
10660
  }
10733
10661
 
@@ -10744,22 +10672,22 @@ var StreamChat = /*#__PURE__*/function () {
10744
10672
  }, {
10745
10673
  key: "getTask",
10746
10674
  value: function () {
10747
- var _getTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee69(id) {
10748
- return _regeneratorRuntime.wrap(function _callee69$(_context69) {
10675
+ var _getTask = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee68(id) {
10676
+ return _regeneratorRuntime.wrap(function _callee68$(_context68) {
10749
10677
  while (1) {
10750
- switch (_context69.prev = _context69.next) {
10678
+ switch (_context68.prev = _context68.next) {
10751
10679
  case 0:
10752
- return _context69.abrupt("return", this.get("".concat(this.baseURL, "/tasks/").concat(id)));
10680
+ return _context68.abrupt("return", this.get("".concat(this.baseURL, "/tasks/").concat(id)));
10753
10681
 
10754
10682
  case 1:
10755
10683
  case "end":
10756
- return _context69.stop();
10684
+ return _context68.stop();
10757
10685
  }
10758
10686
  }
10759
- }, _callee69, this);
10687
+ }, _callee68, this);
10760
10688
  }));
10761
10689
 
10762
- function getTask(_x92) {
10690
+ function getTask(_x91) {
10763
10691
  return _getTask.apply(this, arguments);
10764
10692
  }
10765
10693
 
@@ -10777,31 +10705,31 @@ var StreamChat = /*#__PURE__*/function () {
10777
10705
  }, {
10778
10706
  key: "deleteChannels",
10779
10707
  value: function () {
10780
- var _deleteChannels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee70(cids) {
10708
+ var _deleteChannels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee69(cids) {
10781
10709
  var options,
10782
- _args70 = arguments;
10783
- return _regeneratorRuntime.wrap(function _callee70$(_context70) {
10710
+ _args69 = arguments;
10711
+ return _regeneratorRuntime.wrap(function _callee69$(_context69) {
10784
10712
  while (1) {
10785
- switch (_context70.prev = _context70.next) {
10713
+ switch (_context69.prev = _context69.next) {
10786
10714
  case 0:
10787
- options = _args70.length > 1 && _args70[1] !== undefined ? _args70[1] : {};
10788
- _context70.next = 3;
10715
+ options = _args69.length > 1 && _args69[1] !== undefined ? _args69[1] : {};
10716
+ _context69.next = 3;
10789
10717
  return this.post(this.baseURL + "/channels/delete", _objectSpread({
10790
10718
  cids: cids
10791
10719
  }, options));
10792
10720
 
10793
10721
  case 3:
10794
- return _context70.abrupt("return", _context70.sent);
10722
+ return _context69.abrupt("return", _context69.sent);
10795
10723
 
10796
10724
  case 4:
10797
10725
  case "end":
10798
- return _context70.stop();
10726
+ return _context69.stop();
10799
10727
  }
10800
10728
  }
10801
- }, _callee70, this);
10729
+ }, _callee69, this);
10802
10730
  }));
10803
10731
 
10804
- function deleteChannels(_x93) {
10732
+ function deleteChannels(_x92) {
10805
10733
  return _deleteChannels.apply(this, arguments);
10806
10734
  }
10807
10735
 
@@ -10819,13 +10747,13 @@ var StreamChat = /*#__PURE__*/function () {
10819
10747
  }, {
10820
10748
  key: "deleteUsers",
10821
10749
  value: function () {
10822
- var _deleteUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee71(user_ids, options) {
10823
- return _regeneratorRuntime.wrap(function _callee71$(_context71) {
10750
+ var _deleteUsers = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee70(user_ids, options) {
10751
+ return _regeneratorRuntime.wrap(function _callee70$(_context70) {
10824
10752
  while (1) {
10825
- switch (_context71.prev = _context71.next) {
10753
+ switch (_context70.prev = _context70.next) {
10826
10754
  case 0:
10827
10755
  if (!((options === null || options === void 0 ? void 0 : options.user) !== 'soft' && (options === null || options === void 0 ? void 0 : options.user) !== 'hard')) {
10828
- _context71.next = 2;
10756
+ _context70.next = 2;
10829
10757
  break;
10830
10758
  }
10831
10759
 
@@ -10833,7 +10761,7 @@ var StreamChat = /*#__PURE__*/function () {
10833
10761
 
10834
10762
  case 2:
10835
10763
  if (!(options.messages !== undefined && options.messages !== 'soft' && options.messages !== 'hard')) {
10836
- _context71.next = 4;
10764
+ _context70.next = 4;
10837
10765
  break;
10838
10766
  }
10839
10767
 
@@ -10841,30 +10769,30 @@ var StreamChat = /*#__PURE__*/function () {
10841
10769
 
10842
10770
  case 4:
10843
10771
  if (!(options.conversations !== undefined && options.conversations !== 'soft' && options.conversations !== 'hard')) {
10844
- _context71.next = 6;
10772
+ _context70.next = 6;
10845
10773
  break;
10846
10774
  }
10847
10775
 
10848
10776
  throw new Error('Invalid delete user options. conversations must be one of [soft hard]');
10849
10777
 
10850
10778
  case 6:
10851
- _context71.next = 8;
10779
+ _context70.next = 8;
10852
10780
  return this.post(this.baseURL + "/users/delete", _objectSpread({
10853
10781
  user_ids: user_ids
10854
10782
  }, options));
10855
10783
 
10856
10784
  case 8:
10857
- return _context71.abrupt("return", _context71.sent);
10785
+ return _context70.abrupt("return", _context70.sent);
10858
10786
 
10859
10787
  case 9:
10860
10788
  case "end":
10861
- return _context71.stop();
10789
+ return _context70.stop();
10862
10790
  }
10863
10791
  }
10864
- }, _callee71, this);
10792
+ }, _callee70, this);
10865
10793
  }));
10866
10794
 
10867
- function deleteUsers(_x94, _x95) {
10795
+ function deleteUsers(_x93, _x94) {
10868
10796
  return _deleteUsers.apply(this, arguments);
10869
10797
  }
10870
10798
 
@@ -10885,28 +10813,28 @@ var StreamChat = /*#__PURE__*/function () {
10885
10813
  }, {
10886
10814
  key: "_createImportURL",
10887
10815
  value: function () {
10888
- var _createImportURL2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee72(filename) {
10889
- return _regeneratorRuntime.wrap(function _callee72$(_context72) {
10816
+ var _createImportURL2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee71(filename) {
10817
+ return _regeneratorRuntime.wrap(function _callee71$(_context71) {
10890
10818
  while (1) {
10891
- switch (_context72.prev = _context72.next) {
10819
+ switch (_context71.prev = _context71.next) {
10892
10820
  case 0:
10893
- _context72.next = 2;
10821
+ _context71.next = 2;
10894
10822
  return this.post(this.baseURL + "/import_urls", {
10895
10823
  filename: filename
10896
10824
  });
10897
10825
 
10898
10826
  case 2:
10899
- return _context72.abrupt("return", _context72.sent);
10827
+ return _context71.abrupt("return", _context71.sent);
10900
10828
 
10901
10829
  case 3:
10902
10830
  case "end":
10903
- return _context72.stop();
10831
+ return _context71.stop();
10904
10832
  }
10905
10833
  }
10906
- }, _callee72, this);
10834
+ }, _callee71, this);
10907
10835
  }));
10908
10836
 
10909
- function _createImportURL(_x96) {
10837
+ function _createImportURL(_x95) {
10910
10838
  return _createImportURL2.apply(this, arguments);
10911
10839
  }
10912
10840
 
@@ -10928,33 +10856,33 @@ var StreamChat = /*#__PURE__*/function () {
10928
10856
  }, {
10929
10857
  key: "_createImport",
10930
10858
  value: function () {
10931
- var _createImport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee73(path) {
10859
+ var _createImport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee72(path) {
10932
10860
  var options,
10933
- _args73 = arguments;
10934
- return _regeneratorRuntime.wrap(function _callee73$(_context73) {
10861
+ _args72 = arguments;
10862
+ return _regeneratorRuntime.wrap(function _callee72$(_context72) {
10935
10863
  while (1) {
10936
- switch (_context73.prev = _context73.next) {
10864
+ switch (_context72.prev = _context72.next) {
10937
10865
  case 0:
10938
- options = _args73.length > 1 && _args73[1] !== undefined ? _args73[1] : {
10866
+ options = _args72.length > 1 && _args72[1] !== undefined ? _args72[1] : {
10939
10867
  mode: 'upsert'
10940
10868
  };
10941
- _context73.next = 3;
10869
+ _context72.next = 3;
10942
10870
  return this.post(this.baseURL + "/imports", _objectSpread({
10943
10871
  path: path
10944
10872
  }, options));
10945
10873
 
10946
10874
  case 3:
10947
- return _context73.abrupt("return", _context73.sent);
10875
+ return _context72.abrupt("return", _context72.sent);
10948
10876
 
10949
10877
  case 4:
10950
10878
  case "end":
10951
- return _context73.stop();
10879
+ return _context72.stop();
10952
10880
  }
10953
10881
  }
10954
- }, _callee73, this);
10882
+ }, _callee72, this);
10955
10883
  }));
10956
10884
 
10957
- function _createImport(_x97) {
10885
+ function _createImport(_x96) {
10958
10886
  return _createImport2.apply(this, arguments);
10959
10887
  }
10960
10888
 
@@ -10976,26 +10904,26 @@ var StreamChat = /*#__PURE__*/function () {
10976
10904
  }, {
10977
10905
  key: "_getImport",
10978
10906
  value: function () {
10979
- var _getImport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee74(id) {
10980
- return _regeneratorRuntime.wrap(function _callee74$(_context74) {
10907
+ var _getImport2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee73(id) {
10908
+ return _regeneratorRuntime.wrap(function _callee73$(_context73) {
10981
10909
  while (1) {
10982
- switch (_context74.prev = _context74.next) {
10910
+ switch (_context73.prev = _context73.next) {
10983
10911
  case 0:
10984
- _context74.next = 2;
10912
+ _context73.next = 2;
10985
10913
  return this.get(this.baseURL + "/imports/".concat(id));
10986
10914
 
10987
10915
  case 2:
10988
- return _context74.abrupt("return", _context74.sent);
10916
+ return _context73.abrupt("return", _context73.sent);
10989
10917
 
10990
10918
  case 3:
10991
10919
  case "end":
10992
- return _context74.stop();
10920
+ return _context73.stop();
10993
10921
  }
10994
10922
  }
10995
- }, _callee74, this);
10923
+ }, _callee73, this);
10996
10924
  }));
10997
10925
 
10998
- function _getImport(_x98) {
10926
+ function _getImport(_x97) {
10999
10927
  return _getImport2.apply(this, arguments);
11000
10928
  }
11001
10929
 
@@ -11017,26 +10945,26 @@ var StreamChat = /*#__PURE__*/function () {
11017
10945
  }, {
11018
10946
  key: "_listImports",
11019
10947
  value: function () {
11020
- var _listImports2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee75(options) {
11021
- return _regeneratorRuntime.wrap(function _callee75$(_context75) {
10948
+ var _listImports2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee74(options) {
10949
+ return _regeneratorRuntime.wrap(function _callee74$(_context74) {
11022
10950
  while (1) {
11023
- switch (_context75.prev = _context75.next) {
10951
+ switch (_context74.prev = _context74.next) {
11024
10952
  case 0:
11025
- _context75.next = 2;
10953
+ _context74.next = 2;
11026
10954
  return this.get(this.baseURL + "/imports", options);
11027
10955
 
11028
10956
  case 2:
11029
- return _context75.abrupt("return", _context75.sent);
10957
+ return _context74.abrupt("return", _context74.sent);
11030
10958
 
11031
10959
  case 3:
11032
10960
  case "end":
11033
- return _context75.stop();
10961
+ return _context74.stop();
11034
10962
  }
11035
10963
  }
11036
- }, _callee75, this);
10964
+ }, _callee74, this);
11037
10965
  }));
11038
10966
 
11039
- function _listImports(_x99) {
10967
+ function _listImports(_x98) {
11040
10968
  return _listImports2.apply(this, arguments);
11041
10969
  }
11042
10970
 
@@ -11055,28 +10983,28 @@ var StreamChat = /*#__PURE__*/function () {
11055
10983
  }, {
11056
10984
  key: "upsertPushProvider",
11057
10985
  value: function () {
11058
- var _upsertPushProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee76(pushProvider) {
11059
- return _regeneratorRuntime.wrap(function _callee76$(_context76) {
10986
+ var _upsertPushProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee75(pushProvider) {
10987
+ return _regeneratorRuntime.wrap(function _callee75$(_context75) {
11060
10988
  while (1) {
11061
- switch (_context76.prev = _context76.next) {
10989
+ switch (_context75.prev = _context75.next) {
11062
10990
  case 0:
11063
- _context76.next = 2;
10991
+ _context75.next = 2;
11064
10992
  return this.post(this.baseURL + "/push_providers", {
11065
10993
  push_provider: pushProvider
11066
10994
  });
11067
10995
 
11068
10996
  case 2:
11069
- return _context76.abrupt("return", _context76.sent);
10997
+ return _context75.abrupt("return", _context75.sent);
11070
10998
 
11071
10999
  case 3:
11072
11000
  case "end":
11073
- return _context76.stop();
11001
+ return _context75.stop();
11074
11002
  }
11075
11003
  }
11076
- }, _callee76, this);
11004
+ }, _callee75, this);
11077
11005
  }));
11078
11006
 
11079
- function upsertPushProvider(_x100) {
11007
+ function upsertPushProvider(_x99) {
11080
11008
  return _upsertPushProvider.apply(this, arguments);
11081
11009
  }
11082
11010
 
@@ -11095,28 +11023,28 @@ var StreamChat = /*#__PURE__*/function () {
11095
11023
  }, {
11096
11024
  key: "deletePushProvider",
11097
11025
  value: function () {
11098
- var _deletePushProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee77(_ref8) {
11026
+ var _deletePushProvider = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee76(_ref8) {
11099
11027
  var type, name;
11100
- return _regeneratorRuntime.wrap(function _callee77$(_context77) {
11028
+ return _regeneratorRuntime.wrap(function _callee76$(_context76) {
11101
11029
  while (1) {
11102
- switch (_context77.prev = _context77.next) {
11030
+ switch (_context76.prev = _context76.next) {
11103
11031
  case 0:
11104
11032
  type = _ref8.type, name = _ref8.name;
11105
- _context77.next = 3;
11033
+ _context76.next = 3;
11106
11034
  return this.delete(this.baseURL + "/push_providers/".concat(type, "/").concat(name));
11107
11035
 
11108
11036
  case 3:
11109
- return _context77.abrupt("return", _context77.sent);
11037
+ return _context76.abrupt("return", _context76.sent);
11110
11038
 
11111
11039
  case 4:
11112
11040
  case "end":
11113
- return _context77.stop();
11041
+ return _context76.stop();
11114
11042
  }
11115
11043
  }
11116
- }, _callee77, this);
11044
+ }, _callee76, this);
11117
11045
  }));
11118
11046
 
11119
- function deletePushProvider(_x101) {
11047
+ function deletePushProvider(_x100) {
11120
11048
  return _deletePushProvider.apply(this, arguments);
11121
11049
  }
11122
11050
 
@@ -11133,23 +11061,23 @@ var StreamChat = /*#__PURE__*/function () {
11133
11061
  }, {
11134
11062
  key: "listPushProviders",
11135
11063
  value: function () {
11136
- var _listPushProviders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee78() {
11137
- return _regeneratorRuntime.wrap(function _callee78$(_context78) {
11064
+ var _listPushProviders = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee77() {
11065
+ return _regeneratorRuntime.wrap(function _callee77$(_context77) {
11138
11066
  while (1) {
11139
- switch (_context78.prev = _context78.next) {
11067
+ switch (_context77.prev = _context77.next) {
11140
11068
  case 0:
11141
- _context78.next = 2;
11069
+ _context77.next = 2;
11142
11070
  return this.get(this.baseURL + "/push_providers");
11143
11071
 
11144
11072
  case 2:
11145
- return _context78.abrupt("return", _context78.sent);
11073
+ return _context77.abrupt("return", _context77.sent);
11146
11074
 
11147
11075
  case 3:
11148
11076
  case "end":
11149
- return _context78.stop();
11077
+ return _context77.stop();
11150
11078
  }
11151
11079
  }
11152
- }, _callee78, this);
11080
+ }, _callee77, this);
11153
11081
  }));
11154
11082
 
11155
11083
  function listPushProviders() {
@@ -11178,6 +11106,55 @@ var StreamChat = /*#__PURE__*/function () {
11178
11106
 
11179
11107
  _defineProperty(StreamChat, "_instance", void 0);
11180
11108
 
11109
+ var EVENT_MAP = {
11110
+ 'channel.created': true,
11111
+ 'channel.deleted': true,
11112
+ 'channel.hidden': true,
11113
+ 'channel.kicked': true,
11114
+ 'channel.muted': true,
11115
+ 'channel.truncated': true,
11116
+ 'channel.unmuted': true,
11117
+ 'channel.updated': true,
11118
+ 'channel.visible': true,
11119
+ 'health.check': true,
11120
+ 'member.added': true,
11121
+ 'member.removed': true,
11122
+ 'member.updated': true,
11123
+ 'message.deleted': true,
11124
+ 'message.new': true,
11125
+ 'message.read': true,
11126
+ 'message.updated': true,
11127
+ 'notification.added_to_channel': true,
11128
+ 'notification.channel_deleted': true,
11129
+ 'notification.channel_mutes_updated': true,
11130
+ 'notification.channel_truncated': true,
11131
+ 'notification.invite_accepted': true,
11132
+ 'notification.invite_rejected': true,
11133
+ 'notification.invited': true,
11134
+ 'notification.mark_read': true,
11135
+ 'notification.message_new': true,
11136
+ 'notification.mutes_updated': true,
11137
+ 'notification.removed_from_channel': true,
11138
+ 'reaction.deleted': true,
11139
+ 'reaction.new': true,
11140
+ 'reaction.updated': true,
11141
+ 'typing.start': true,
11142
+ 'typing.stop': true,
11143
+ 'user.banned': true,
11144
+ 'user.deleted': true,
11145
+ 'user.presence.changed': true,
11146
+ 'user.unbanned': true,
11147
+ 'user.unread_message_reminder': true,
11148
+ 'user.updated': true,
11149
+ 'user.watching.start': true,
11150
+ 'user.watching.stop': true,
11151
+ // local events
11152
+ 'channels.queried': true,
11153
+ 'connection.changed': true,
11154
+ 'connection.recovered': true,
11155
+ 'transport.changed': true
11156
+ };
11157
+
11181
11158
  var Allow = 'Allow';
11182
11159
  var Deny = 'Deny';
11183
11160
  var AnyResource = ['*'];
@@ -11252,5 +11229,5 @@ var BuiltinPermissions = {
11252
11229
  UseFrozenChannel: 'Send messages and reactions to frozen channels'
11253
11230
  };
11254
11231
 
11255
- export { Allow, AllowAll, AnyResource, AnyRole, BuiltinPermissions, BuiltinRoles, Channel, ChannelState, CheckSignature, ClientState, Deny, DenyAll, DevToken, EVENT_MAP, ErrorFromResponse, InsightMetrics, JWTServerToken, JWTUserToken, MaxPriority, MinPriority, Permission, StableWSConnection, StreamChat, TokenManager, UserFromToken, buildWsFatalInsight, buildWsSuccessAfterFailureInsight, chatCodes, decodeBase64, encodeBase64, isOwnUser, isValidEventType, logChatPromiseExecution, postInsights };
11232
+ export { Allow, AllowAll, AnyResource, AnyRole, BuiltinPermissions, BuiltinRoles, Channel, ChannelState, CheckSignature, ClientState, Deny, DenyAll, DevToken, EVENT_MAP, ErrorFromResponse, InsightMetrics, JWTServerToken, JWTUserToken, MaxPriority, MinPriority, Permission, StableWSConnection, StreamChat, TokenManager, UserFromToken, buildWsFatalInsight, buildWsSuccessAfterFailureInsight, chatCodes, decodeBase64, encodeBase64, isOwnUser, logChatPromiseExecution, postInsights };
11256
11233
  //# sourceMappingURL=browser.es.js.map